Command-line interface for Codmir
@codmir/cli
The Codmir CLI provides command-line access to all Codmir features.
Installation
# Global install (recommended)
npm install -g @codmir/cli
# Or use npx
npx @codmir/cli <command>Authentication
# Login with browser
codmir login
# Or set token directly
export CODMIR_TOKEN=your_token_here
# Verify authentication
codmir whoamiCommands
Chat
Interactive AI chat in your terminal.
# Start interactive chat
codmir chat
# One-shot message
codmir chat "Explain this error: TypeError..."
# With file context
codmir chat --file src/main.ts "Review this code"
# With repo context
codmir chat --repo org/repo "How does auth work?"CI Commands
Interact with CI/CD workflows.
# Report CI result to Codmir
codmir ci report --run-id $GITHUB_RUN_ID
# List recent CI runs
codmir ci list
# Get CI metrics
codmir ci metrics
# Analyze failures
codmir ci analyze --workflow build.ymlEvents
Emit and query events.
# Emit event
codmir events emit ci.deploy.completed \
--payload '{"env": "production", "version": "1.0.0"}'
# Query events
codmir events query --type "ci.*" --since 24h
# Watch events in real-time
codmir events watch --type "ci.*"Projects
Manage projects.
# List projects
codmir projects list
# Get project details
codmir projects get <project-id>
# Link current repo to project
codmir projects linkTickets
Manage tickets.
# List tickets
codmir tickets list --project <project-id>
# Create ticket
codmir tickets create --title "Bug fix" --project <project-id>
# Update ticket
codmir tickets update <ticket-id> --status in_progressConfig
Manage CLI configuration.
# Show config
codmir config show
# Set config value
codmir config set api_url https://api.codmir.com
# Reset config
codmir config resetGitHub Actions Integration
Use the CLI in your workflows:
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: npm run build
- name: Report to Codmir
env:
CODMIR_TOKEN: ${{ secrets.CODMIR_TOKEN }}
run: |
npx @codmir/cli ci report \
--run-id ${{ github.run_id }} \
--status successEnvironment Variables
| Variable | Description |
|---|---|
CODMIR_TOKEN | API authentication token |
CODMIR_API_URL | Custom API URL |
CODMIR_DEBUG | Enable debug output |
Global Options
--token, -t API token (overrides CODMIR_TOKEN)
--api-url Custom API URL
--json Output as JSON
--verbose, -v Verbose output
--help, -h Show help
--version Show versionExamples
Daily Workflow
# Morning: Check what needs attention
codmir tickets list --status open --assigned-to me
# Start work
codmir tickets update TICKET-123 --status in_progress
# Ask AI for help
codmir chat --file src/auth.ts "How can I improve this?"
# End of day: Check CI status
codmir ci list --branch main --limit 5CI Integration
# In GitHub Actions
- name: Analyze CI Failure
if: failure()
env:
CODMIR_TOKEN: ${{ secrets.CODMIR_TOKEN }}
run: |
codmir ci analyze \
--run-id ${{ github.run_id }} \
--auto-fixNext Steps
- SDK Reference - Programmatic API
- Events Guide - Event system
- CI Integration - CI/CD setup