CLI Interface
Use CodeSpar from the command line — an interactive REPL for testing, development, and direct agent interaction without configuring external messaging channels.
CLI Interface
The CLI (Command Line Interface) is a built-in channel that lets you interact with CodeSpar directly from your terminal. It requires no external setup — no Slack app, no Discord bot, no WhatsApp QR code. It is always available and is the fastest way to test commands and develop with CodeSpar.
When to Use the CLI
| Use Case | Why CLI |
|---|---|
| Testing commands | Instant feedback without switching to a messaging app |
| Local development | Test agent behavior while developing CodeSpar itself |
| Debugging | See raw agent responses without channel formatting |
| Quick tasks | Run a single command without opening Slack/Discord |
| CI/CD scripting | Automate CodeSpar commands in build pipelines |
Starting the CLI
From the Development Environment
If you have the CodeSpar repository cloned and built:
This starts the server with all configured channels, including the CLI. The CLI REPL appears in your terminal after the server starts.
Direct Execution
You can also start the CLI channel directly:
Expected Startup Output
Interactive REPL
The CLI provides an interactive REPL (Read-Eval-Print Loop). You type commands and see responses directly in the terminal.
Basic Commands
All commands work exactly the same as in Slack, WhatsApp, Discord, or Telegram — without the @codespar prefix:
Linking a Repository
Executing a Task
Reviewing a PR
Setting Autonomy
Viewing Audit Trail
Asking Questions (Smart Responses)
Differences from Chat Channels
| Aspect | CLI | Chat Channels |
|---|---|---|
| Prefix | No prefix needed | @codespar prefix required |
| Formatting | Plain text with ASCII formatting | Rich formatting (Slack blocks, Discord embeds) |
| Notifications | Printed to terminal as they arrive | Pushed to the messaging platform |
| Multi-user | Single user | Multiple team members |
| Approval flow | You can approve your own requests | Self-approval blocking applies |
| Persistence | Session ends when you exit | Channels are always connected |
Exiting
To exit the CLI:
Or press Ctrl+C at any time.
Environment Variables
The CLI uses the same environment variables as the rest of CodeSpar. At minimum:
| Variable | Required | Description |
|---|---|---|
ANTHROPIC_API_KEY | For AI features | Claude API key |
GITHUB_TOKEN | For repo tasks | GitHub personal access token |
Channel-specific variables (ENABLE_SLACK, etc.) are not needed for CLI-only usage.
Use in Scripts
The CLI can be used non-interactively for scripting:
This is useful for CI/CD pipelines or cron jobs that need to trigger CodeSpar actions programmatically.
Next Steps
- Configure a Project — full setup guide
- Command Reference — all available commands
- Channel Configuration — set up Slack, Discord, WhatsApp, or Telegram