@continuedev/cli

中文文档
1.5.47发布于 2026/06/19Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 2.3万

Continue CLI

原始使用文档
文档目录9 节
  1. Installation
  2. Usage
  3. Headless Mode
  4. Session Management
  5. Command Line Options
  6. Environment Variables
  7. Commands
  8. Session Listing ( cn ls )
  9. TTY-less Support

Continue CLI

The Continue CLI (cn) is a customizable command line coding agent.

Continue CLI Demo

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 messages
  • FORCE_NO_TTY: Force TTY-less mode, prevents stdin reading (useful for testing and automation)

Commands

  • cn: Start an interactive chat session
  • cn ls: List recent sessions with TUI selector to choose one to resume
  • cn login: Authenticate with Continue
  • cn logout: Sign out of current session
  • cn remote: Launch a remote instance
  • cn 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.

版本与发布记录

@continuedev/cli 共发布 332 个版本,首次发布于 2025/04/08;过去 12 个月发布了 120 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
1.5.47latest2026/06/194 个月前
1.5.462026/06/164 个月前
1.5.452026/03/058 个月前
1.5.442026/03/028 个月前
1.5.43-beta.20260203beta2026/02/039 个月前
1.5.432026/02/039 个月前

关于 @continuedev/cli 的常见问题

@continuedev/cli 是什么?

Continue CLI

如何安装 @continuedev/cli?

在项目目录运行 npm install @continuedev/cli,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 cn,可以用 npx cn 直接运行。

@continuedev/cli 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@continuedev/cli 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@continuedev/cli 可以商用吗?

@continuedev/cli 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@continuedev/cli 的下载量有多少?

根据 npm 官方下载统计,@continuedev/cli 在 2026/10/11 – 2026/11/09 这 30 天内被下载 23,247 次,日均约 775 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@continuedev/cli 还在维护吗?

最新版本 1.5.47 发布于 2026/06/19(4 个月前);至今共发布 332 个版本,其中过去 12 个月发布了 120 个;首次发布于 2025/04/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。