Remon Oldenbeuving e8c1ba3bf9 Default to alpha tag 4 months ago
..
src 90fe2346b5 fix: Create Logs directory if dont exist 4 months ago
.gitignore 504a381ffa refactor: move the .kilocode-cli folder to ~/.kilocode/cli 4 months ago
README.md bbf4c33e07 CLI: Update README 4 months ago
esbuild.config.mjs ff250a779d Remove unneeded files after the build step is completed 4 months ago
package.dist.json e8c1ba3bf9 Default to alpha tag 4 months ago
package.json 91204dac4b CLI: Bump version and clean up package.dist.json 4 months ago
tsconfig.json b133fdcc13 Clean up tsconfig.json to improve imports 4 months ago
turbo.json a05b93ba6f Add cli:bundle turbo definition 4 months ago

README.md

Kilo Code CLI

Terminal User Interface for Kilo Code

Installation

npm install -g @kilocode/cli

Then, make sure you place your Kilo Code API token in the CLI config:

kilocode config # this opens up your editor

You can find your Kilo Code API token on your profile page at app.kilocode.ai, and place it in the kilocodeToken field in the CLI config.

Known Issues

Outdated dependency warnings

When installing Kilo Code CLI you'll be greeted by some scary looking dependency deprecation warnings. We're aware of the issue and will resolve it shortly.

Usage

Interactive Mode

# Start interactive chat session
kilocode

# Start with a specific mode
kilocode --mode architect

# Start with a specific workspace
kilocode --workspace /path/to/project

CI Mode (Non-Interactive)

CI mode allows Kilo Code to run in automated environments like CI/CD pipelines without requiring user interaction.

# Run in CI mode with a prompt
kilocode --ci "Implement feature X"

# Run in CI mode with piped input
echo "Fix the bug in app.ts" | kilocode --ci

# Run in CI mode with timeout (in seconds)
kilocode --ci "Run tests" --timeout 300

CI Mode Behavior

When running in CI mode (--ci flag):

  1. No User Interaction: All approval requests are handled automatically based on configuration
  2. Auto-Approval/Rejection: Operations are approved or rejected based on your auto-approval settings
  3. Follow-up Questions: Automatically responded with a message instructing the AI to make autonomous decisions
  4. Automatic Exit: The CLI exits automatically when the task completes or times out

Auto-Approval Configuration

CI mode respects your auto-approval configuration. Edit your config file with kilocode config to customize:

{
	"autoApproval": {
		"enabled": true,
		"read": {
			"enabled": true,
			"outside": true
		},
		"write": {
			"enabled": true,
			"outside": false,
			"protected": false
		},
		"execute": {
			"enabled": true,
			"allowed": ["npm", "git", "pnpm"],
			"denied": ["rm -rf", "sudo"]
		},
		"browser": {
			"enabled": false
		},
		"mcp": {
			"enabled": true
		},
		"mode": {
			"enabled": true
		},
		"subtasks": {
			"enabled": true
		},
		"question": {
			"enabled": false,
			"timeout": 60
		},
		"retry": {
			"enabled": true,
			"delay": 10
		},
		"todo": {
			"enabled": true
		}
	}
}

Configuration Options:

  • read: Auto-approve file read operations
    • outside: Allow reading files outside workspace
  • write: Auto-approve file write operations
    • outside: Allow writing files outside workspace
    • protected: Allow writing to protected files (e.g., package.json)
  • execute: Auto-approve command execution
    • allowed: List of allowed command patterns (e.g., ["npm", "git"])
    • denied: List of denied command patterns (takes precedence)
  • browser: Auto-approve browser operations
  • mcp: Auto-approve MCP tool usage
  • mode: Auto-approve mode switching
  • subtasks: Auto-approve subtask creation
  • question: Auto-approve follow-up questions
  • retry: Auto-approve API retry requests
  • todo: Auto-approve todo list updates

CI Mode Follow-up Questions

In CI mode, when the AI asks a follow-up question, it receives this response:

"This process is running in non-interactive CI mode. The user cannot make decisions, so you should make the decision autonomously."

This instructs the AI to proceed without user input.

Exit Codes

  • 0: Success (task completed)
  • 124: Timeout (task exceeded time limit)
  • 1: Error (initialization or execution failure)

Example CI/CD Integration

# GitHub Actions example
- name: Run Kilo Code
  run: |
      echo "Implement the new feature" | kilocode --ci --timeout 600

Local Development

DevTools

In order to run the CLI with devtools, add DEV=true to your pnpm start command, and then run npx react-devtools to show the devtools inspector.