CLI Package

@cdoing/cli — The terminal interface with interactive chat, configuration wizard, and multiple output formats.

Overview

The CLI package provides the cdoing command-line tool. It's built with Commander for argument parsing and Ink (React for terminals) for the interactive UI.

packages/cli/src/ ├── index.ts # Entry point + argument parsing ├── chat.ts # Interactive chat loop ├── config.ts # Configuration + setup wizard ├── tools.ts # Tool registry creation ├── callbacks.ts # Output callbacks (text, JSON, stream) ├── commands.ts # Subcommands (config, init, doctor) ├── help.ts # Help text ├── history.ts # Conversation history loading ├── oauth.ts # OAuth login/logout flow ├── serve.ts # Serve mode for debuggers ├── review.ts # Code review integration └── ui/ # Ink React components

CLI Flags

FlagDescription
-m, --model <model>Model identifier (e.g., claude-sonnet-4-6, gpt-4o)
-p, --provider <name>LLM provider (anthropic, openai, google, ollama, custom)
--base-url <url>Custom base URL for API requests
--api-key <key>API key (overrides stored config)
--mode <mode>Permission mode
-d, --dir <directory>Working directory
--loginStart Anthropic OAuth login flow
--logoutClear stored OAuth tokens
--printNon-interactive mode (single prompt, exit after response)
-r, --resume <id>Resume a previous conversation by ID
-c, --continueContinue the most recent conversation
--max-turns <n>Limit number of agent turns
--output-format <fmt>Output format: text, json, stream-json
--verboseEnable verbose logging
--system-prompt <prompt>Custom system prompt
--allowed-tools <tools>Comma-separated list of allowed tools
--disallowed-tools <tools>Comma-separated list of disallowed tools

Subcommands

cdoing config

Manage configuration settings from the terminal:

cdoing config get provider # Get a config value cdoing config set provider openai # Set a config value cdoing config list # List all settings

cdoing init

Initialize a project with a .cdoing/config.md file containing project-specific instructions for the agent.

cdoing init

cdoing doctor

Diagnose setup issues. Checks Node.js version, API key configuration, provider connectivity, and tool availability.

cdoing doctor

cdoing completions

Generate shell completion scripts for bash, zsh, or fish.

cdoing completions bash >> ~/.bashrc cdoing completions zsh >> ~/.zshrc

Output Formats

FormatUse CaseDescription
textInteractive useFormatted text with colors and markdown rendering
jsonProgrammatic useSingle JSON object with the full response
stream-jsonReal-time integrationNewline-delimited JSON objects streamed as they arrive

Setup Wizard

On first run, the CLI launches an interactive setup wizard that guides you through:

Configuration is persisted to ~/.cdoing/config.json and can be modified later with cdoing config set.

Dependencies

Key Dependencies
commander (CLI args), ink (React for terminals), chalk (colors), figlet (ASCII art), ora (spinners), react (UI components).