* feat: add hooks system for CLI event interception
Adds a Claude Code-compatible hooks system that allows external handlers
(shell commands, HTTP endpoints) to intercept and respond to CLI events.
Supports 16 event types with regex-based matching, typed inputs/outputs,
sync/async execution, and multi-source config merging.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: register HookService in service container
The fireHook.ts module references services.hooks, which requires the
HookService to be registered in the service container and exposed in
the services object.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: resolve eslint errors in hooks files and services/index.ts
Fix unused imports, import ordering, and negated condition lint errors.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: handle EPIPE errors on hook stdin writes
When a hook command exits before we finish writing to stdin, an EPIPE
error is emitted. Add an error handler to suppress it gracefully.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: skip hookRunner tests on Windows
The hookRunner tests use /bin/sh syntax (>&2, single-quote echo, sleep)
that is incompatible with Windows cmd.exe.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: address cubic review - utf8 encoding, regex, EPIPE handling
- Use setEncoding("utf8") on stdout/stderr instead of data.toString()
to prevent multi-byte character corruption at buffer boundaries
- Fix env var interpolation regex to use alternation instead of
independent optionals, preventing unbalanced brace matching
- Only suppress EPIPE errors on stdin, log other errors
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Remove AI slop from hookRunner.ts
* Update AGENTS.md to document hooks system
* Fix React hooks best practices in useService.ts
* fix: correct indentation in useService.ts for prettier
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: remove invalid eslint-disable for react-hooks/exhaustive-deps
The react-hooks eslint plugin is not configured in the CLI package,
so the disable comment causes an eslint error.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: continue[bot] <230936708+continue[bot]@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| .continue/agents | ||
| .github | ||
| docs | ||
| media | ||
| scripts | ||
| spec | ||
| src | ||
| stubs | ||
| test-fixtures | ||
| .env.example | ||
| .gitignore | ||
| .npmignore | ||
| .releaserc.json | ||
| AGENTS.md | ||
| BUILD.md | ||
| build.mjs | ||
| CHANGELOG.md | ||
| demo.expect | ||
| eslint.config.js | ||
| package-lock.json | ||
| package.json | ||
| README.md | ||
| smoke-test.mjs | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| validate-aliases.mjs | ||
| vitest.config.ts | ||
| vitest.e2e.config.ts | ||
| vitest.setup.ts | ||
| vitest.smoke-api.config.ts | ||
Continue CLI
The Continue CLI (cn) is a customizable command line coding agent.
Installation
macOS / Linux:
curl -fsSL https://raw.githubusercontent.com/continuedev/continue/main/extensions/cli/scripts/install.sh | bash
Windows (PowerShell):
irm https://raw.githubusercontent.com/continuedev/continue/main/extensions/cli/scripts/install.ps1 | iex
Or install with npm if you have Node.js 20+:
npm i -g @continuedev/cli
Usage
cn
Headless Mode
Headless mode (-p flag) runs without an interactive terminal UI, making it perfect for:
- Scripts and automation
- CI/CD pipelines
- Docker containers
- VSCode/IntelliJ extension integration
- Environments without a TTY
# Basic usage
cn -p "Generate a conventional commit name for the current git changes."
# With piped input
echo "Review this code" | cn -p
# JSON output for scripting
cn -p "Analyze the code" --format json
# Silent mode (strips thinking tags)
cn -p "Write a README" --silent
TTY-less Environments: Headless mode is designed to work in environments without a terminal (TTY), such as when called from VSCode/IntelliJ extensions using terminal commands. The CLI will not attempt to read stdin or initialize the interactive UI when running in headless mode with a supplied prompt.
Session Management
The CLI automatically saves your chat history for each terminal session. You can resume where you left off:
# Resume the last session in this terminal
cn --resume
# List recent sessions and choose one to resume
cn ls
# List sessions in JSON format (for scripting)
cn ls --json
Command Line Options
-p: Run in headless mode (no TUI)--config <path>: Specify agent configuration path--resume: Resume the last session for this terminal<prompt>: Optional prompt to start with
Environment Variables
CONTINUE_CLI_DISABLE_COMMIT_SIGNATURE: Disable adding the Continue commit signature to generated commit messagesFORCE_NO_TTY: Force TTY-less mode, prevents stdin reading (useful for testing and automation)
Commands
cn: Start an interactive chat sessioncn ls: List recent sessions with TUI selector to choose one to resumecn login: Authenticate with Continuecn logout: Sign out of current sessioncn remote: Launch a remote instancecn serve: Start HTTP server mode
Session Listing (cn ls)
Shows recent sessions, limited by screen height to ensure it fits on your terminal.
--json: Output in JSON format for scripting (always shows 10 sessions)
TTY-less Support
The CLI fully supports running in environments without a TTY (terminal):
# From Docker without TTY allocation
docker run --rm my-image cn -p "Generate docs"
# From CI/CD pipeline
cn -p "Review changes" --format json
# From VSCode/IntelliJ extension terminal tool
cn -p "Analyze code" --silent
The CLI automatically detects TTY-less environments and adjusts its behavior:
- Skips stdin reading when a prompt is supplied
- Disables interactive UI components
- Ensures clean stdout/stderr output
For more details, see spec/tty-less-support.md.
