@caffeineai/cli

中文文档
0.2.1发布于 2026/11/13SEE LICENSE IN LICENSE零依赖近 30 天下载 7322

Caffeine CLI

原始使用文档
文档目录11 节
  1. Development Release
  2. Features
  3. Installation
  4. Quick Start
  5. Supported Platforms
  6. Commands
  7. Chat Workflow
  8. JSON And Non-Interactive Mode
  9. Authentication
  10. MCP Server
  11. Links

@caffeineai/cli

The public Caffeine command-line interface for authentication, project management, local development workflows, and headless AI chat.

Development Release

This is a DEV release. It is published under the npm dev dist-tag and is subject to a rapid release cadence. Expect frequent updates while the CLI package settles.

Features

  • Device and browser-based login
  • Project listing, inspection, creation, cloning, and deletion
  • Team workspace list, status, and switch (X-Workspace-Id)
  • Local install, build, check, preview, import, export, config, doctor, and update flows
  • Interactive and detached chat sessions over the Caffeine AI API
  • Browser chat hand-off when you want the web UI

Installation

npm install -g @caffeineai/cli@dev
caffeine --version

Three equivalent command names are installed: caffeine, caf, and cfn.

Quick Start

caffeine auth login            # Sign in
caffeine projects list         # List your Caffeine projects
caffeine projects clone <id>   # Clone one locally
caffeine build                 # Build the current project
caffeine preview               # Upload a draft to Caffeine cloud

Supported Platforms

Native binaries ship for:

  • macOS arm64 and x64
  • Linux arm64 and x64, glibc and musl
  • Windows arm64 and x64

Commands

GroupCommandDescription
Authauth login [--device]Sign in via OAuth loopback or device flow
Authauth logoutSign out
Authauth statusShow current session
Projectsprojects listList your projects
Projectsprojects show <id>Show project details
Projectsprojects create <name>Create a new project
Projectsprojects clone <id> [--dest <path>] [--include-wip]Clone a project locally
Projectsprojects delete <id>Delete a project
Workspacesworkspaces listList personal account and team workspaces
Workspacesworkspaces statusShow the selected workspace
Workspacesworkspaces use <id>Persist a team workspace, or personal
Localimport <file>Import a project from a .zip
LocalexportExport the current project to a .zip
BuildinstallInstall build dependencies
BuildbuildBuild the current project
BuildcheckValidate code and configuration
BuildpreviewUpload a built project as a draft
ChatchatOpen or continue the primary interactive chat workflow
Chatchat interactiveExplicit form of the interactive chat workflow
Chatchat send <message>Send a prompt and stay attached until stable
Chatchat send --detach <message>Submit and return immediately
Chatchat reply <message>Send a freeform clarification reply
Chatchat activeDiscover likely active chat sessions
Chatchat statusShow a high-level summary for an active session
Chatchat watchAttach to a live session and stream updates
Chatchat resumeReattach and wait for the next stable state
Chatchat transcriptShow the current transcript
Chatchat feedCollect raw project feed events
Chatchat listList chat messages
Chatchat tailPoll chat messages until the AI reaches a stable state
Chatchat submit-formSubmit a structured clarification form reply
Chatchat openOpen the browser chat for a project
Configconfig list / config get <key> / config set <key> <value>Manage CLI config
Envdoctor [--fix]Diagnose local build prerequisites
MetaupdateCheck for or install a newer CLI
MetaversionShow version info

Run caffeine <command> --help for the full flag list.

Chat Workflow

caffeine chat
caffeine chat --project-id 11111111-1111-4111-8111-111111111111
caffeine chat interactive --project-id 11111111-1111-4111-8111-111111111111
caffeine chat send --detach "Build a weather dashboard"
caffeine chat active
caffeine chat status
caffeine chat watch --project-id 11111111-1111-4111-8111-111111111111
caffeine chat resume --project-id 11111111-1111-4111-8111-111111111111
caffeine chat transcript --project-id 11111111-1111-4111-8111-111111111111
caffeine chat feed --project-id 11111111-1111-4111-8111-111111111111 --timeout 5s
caffeine chat submit-form \
  --project-id 11111111-1111-4111-8111-111111111111 \
  --message-index 42 \
  --form-data '{"appName":"Habit Hero"}'
caffeine chat open

All commands support --json for machine-readable output.

caffeine chat is the primary human workflow. It resumes likely active chat sessions for the target project, shows a recent transcript tail when nothing is active, and lets you continue the conversation inline until you exit.

chat interactive is the explicit equivalent of bare chat.

Use the lower-level subcommands when you want a more scripted or detached flow:

  • chat send --detach submits work and returns immediately
  • chat watch and chat resume reattach to in-flight work
  • chat transcript, chat list, chat tail, and chat feed expose the raw chat state
  • chat reply and chat submit-form let you answer clarifications explicitly

Interactive chat does not support --json. Use the lower-level subcommands for automation, CI, and machine-readable output.

Clarification handling:

  • ai_follow_up means the AI wants more freeform input, so reply with chat reply
  • system_dialog with info.form means you should call chat submit-form
  • ai_answer means the exchange completed successfully

JSON And Non-Interactive Mode

Every command accepts --json. JSON output uses a stable envelope:

{ "ok": true, "data": {} }
{ "ok": false, "error": { "code": "...", "message": "..." } }

Use --non-interactive in scripts and CI.

--workspace <id> and --personal are process-only account overrides. They do not rewrite workspace.selectedId. caffeine workspaces use persists the selection for later CLI and local MCP processes.

Authentication

caffeine auth login opens your browser for an OAuth flow. For CI, remote SSH, or other headless environments, add --device to use the device flow instead.

Tokens are stored in your OS credential store.

MCP Server

Drive Caffeine from Claude Code, Cursor, VS Code, Codex, Windsurf, or another MCP host with the companion MCP server:

npx -y @caffeineai/mcp@dev --version

The CLI and MCP server share the same auth, workspace, project, build, and chat contract. One login flow can cover both tools on the same machine.

Caffeine platform: https://caffeine.ai

This package installs the matching platform binary through npm optional dependencies. Install the main package rather than a platform package directly.

What changed in each release is in CHANGELOG.md, next to this README.

版本与发布记录

@caffeineai/cli 共发布 56 个版本,首次发布于 2026/04/28;过去 12 个月发布了 56 个版本。

版本发布日期距今
0.2.1latest2026/11/13今天
0.2.1-dev.1dev2026/10/2915 天前
0.2.02026/10/2915 天前
0.1.0-dev.532026/10/2915 天前
0.1.0-dev.522026/10/1925 天前
0.1.0-dev.512026/09/042 个月前

关于 @caffeineai/cli 的常见问题

@caffeineai/cli 是什么?

Caffeine CLI

如何安装 @caffeineai/cli?

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

@caffeineai/cli 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/caffeineai__cli 是否存在。

@caffeineai/cli 可以商用吗?

@caffeineai/cli 使用 SEE LICENSE IN LICENSE 许可。许可条款写在包内的独立文件中,请阅读该文件确认可否商用。以上为概括,不构成法律意见,请以许可原文为准。

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

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

@caffeineai/cli 还在维护吗?

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