@fongflow/cli

中文文档
2.10.4发布于 2026/11/13ES Module近 30 天下载 2300

FongFlow command-line interface — run Flow steps on your own computer (fongflow runner), give FongFlow AI a browser (fongflow computer), run and watch workflows, and capture todos from the terminal.

原始使用文档
文档目录8 节
  1. How login works
  2. Install / run
  3. Configuration
  4. Commands
  5. Examples
  6. Runner — run Flow steps on this computer
  7. Container mode
  8. Computer — a browser FongFlow AI uses for you

fongflow CLI

fongflow is FongFlow's command-line interface. It is command-only: no interactive screens. It does three things:

  • runner: makes this computer a runner for Flow's "Run on my computer" step. This is its main job.
  • flow: runs workflows and watches their runs from a shell script or CI.
  • fofo: asks FoFo, the FongFlow assistant, from the terminal.
  • capture: drops a note, piped text or a file into your Idea Capture inbox.
  • todo: quick capture of todos.

ff is installed as a short alias: ff flow ls is the same as fongflow flow ls.

How login works

The CLI uses the standard OAuth 2.0 Authorization Code flow with PKCE (RFC 7636 / RFC 8252 — "OAuth for native apps"):

  1. fongflow login starts a tiny local web server on a loopback port (127.0.0.1) and opens your browser to the backend's /oauth/authorize endpoint.
  2. You log in on the web as usual. The authorization server redirects back to the CLI's local …/callback URL with a one-time authorization code.
  3. The CLI exchanges that code (plus the PKCE verifier) at /oauth/token for an access token and refresh token, then stores them locally.
  4. Every subsequent command sends the access token as Authorization: Bearer <token>. Tokens are refreshed automatically when they expire.

The public OAuth client (client_id = fongflow-cli) and its loopback redirect URIs are seeded by the backend on startup (backend/src/modules/oauth/bootstrap.ts).

Install / run

From the repo root:

pnpm install
pnpm --filter @fongflow/cli build

Then run it directly, or link it onto your PATH:

node cli/dist/index.js --help
# or, to get a global `fongflow` command:
cd cli && npm link
fongflow --help

During development you can skip the build step:

pnpm --filter @fongflow/cli dev -- --help

Configuration

SettingHow to set itDefault
Backend URLFONGFLOW_API_URL env var, or fongflow login --api <url>https://fongflow.com
OAuth client idFONGFLOW_CLIENT_ID env varfongflow-cli
Config / token storageFONGFLOW_HOME, else $XDG_CONFIG_HOME/fongflow~/.config/fongflow

Credentials are written to ~/.config/fongflow/credentials.json with 0600 permissions.

Commands

Every list command takes --json. A command that fails exits non-zero.

fongflow login [--api <url>] [--no-browser] [--scope <scope>]
fongflow logout
fongflow whoami [--json]

# Runner (see below)
fongflow runner register | start | status | config | test | jobs | logs
fongflow runner install-service | stop | restart | uninstall-service | unregister | build-image

# Computer — a browser FongFlow AI uses for you (see below)
fongflow computer start [--browser auto|container|chrome] [--headed] [--image <img>] [--port <n>] [--chrome <path>]

# Flow — a workflow is a name (exact or a unique part of one) or an id
fongflow flow ls [--status active,paused] [--json]
fongflow flow run <workflow> [-i <json|@file|->] [--var k=v]… [--draft] [--no-wait] [-t <seconds>] [--json]
fongflow flow runs [workflow] [--status <s>] [-l <n>] [--json]
fongflow flow show <runId> [--json]
fongflow flow answer <runId> [field=value…]     # no values: print the question
fongflow flow cancel <runId>
fongflow flow on|off <workflow>

# FoFo — one question per command; the answer streams to stdout
fongflow fofo <message...> [--new] [-c <conversationId>] [-a <agent>] [--json]
fongflow fofo ls | history [id] | agents

# Idea Capture (alias: idea) — words, piped stdin, or a file (≤ 50 MB)
fongflow capture [text...] [-t <title>] [-f <file>] [--json]
#   ff capture "an idea"            → the text
#   git diff | ff capture           → the diff
#   git diff | ff capture "why"     → titled "why", the words then the diff

# Todos
fongflow todo ls [--all] [-l <n>] [--json]
fongflow todo add <title...> [-p <priority>] [-d <date>] [--json]
fongflow todo done <id>

flow run waits until the run ends and prints what its Result steps returned. Its exit code says how the run ended:

CodeMeaning
0succeeded
1failed or cancelled
2waiting on a question (flow answer resumes it)
3still running when --timeout ran out

A run waiting on a runner is not "waiting on a question": flow run keeps waiting until the runner finishes the job. flow run runs the workflow's active version; add --draft to run the latest saved draft.

fofo keeps its own conversations, separate from the web and dock chats. Each question continues the last one; --new starts over. Piped input is attached to the question (git diff | ff fofo "review this"). Tool progress goes to stderr, so stdout holds only the answer. Tools that need the web app open (such as reading the open screen) report as unavailable, and FoFo answers without them.

Examples

# Authenticate against a local backend
fongflow login --api http://localhost:9999

# In CI: run a workflow with input, fail the job if the run fails
fongflow flow run "Deploy preview" --input @payload.json --timeout 600

# What happened?
fongflow flow runs "Deploy preview" -l 5
fongflow flow show 0a50c5e7-…

Runner — run Flow steps on this computer

Prefer a single binary with no Node install? runner/ in this repository builds fongflow-runner, a Rust port of this command with the same server protocol and the same runner.json (see runner/README.md). Everything below applies to both; replace fongflow runner <cmd> with fongflow-runner <cmd>.

fongflow runner turns this machine into a runner for the Flow app's "Run on my computer" step. The runner only makes outbound HTTPS calls: it long-polls for jobs, streams the script's output back, and reports the result, so it works behind NAT with no open ports.

# 1. Flow → Runners → Add runner, then copy the key it shows (ffrun_…):
fongflow runner register --key ffrun_… --api https://your-host/api
#    …or, when the CLI is logged in, let it create the runner for you:
fongflow runner register --name "My MacBook" --labels mac,home

# 2. Decide what this machine may run (shell scripts are OFF by default):
fongflow runner config --allow-shell on        # any script
fongflow runner config --allow "git pull"      # or only these commands

# 3. Run it
fongflow runner start                # foreground
fongflow runner install-service      # background, starts at login (macOS launchd / Linux systemd)
fongflow runner status               # config + key check
fongflow runner test "git pull" --dry-run   # would this machine run it, and where?
fongflow runner test "npm test" --image node:22   # run it the way a job would, locally
fongflow runner logs -f              # the background service's log
fongflow runner jobs                 # recent jobs on this runner (needs `fongflow login`)
fongflow runner uninstall-service
fongflow runner unregister

Container mode

A step set to Run in: Container runs in a throwaway Docker/Podman container: only the step's working directory is mounted (at /work, optionally read-only), with memory/CPU limits, no-new-privileges, and optionally no network. Containers don't need --allow-shell.

fongflow runner config --container-only on      # never run anything directly on this machine
fongflow runner config --allow-image "node:*" --allow-image "fongflow/*"   # image allowlist (empty = any)
fongflow runner config --default-image python:3.12-slim --memory 4g --cpus 4 --network off
fongflow runner build-image claude-code         # builds fongflow/claude-code (Claude Code, non-root)
fongflow runner build-image claude-code-python  # + pip, venv, uv (also claude-code-rust, claude-code-dotnet)

A credential picked on the step (Anthropic, OpenAI or GitHub) reaches the script as ANTHROPIC_API_KEY / OPENAI_API_KEY / GITHUB_TOKEN + GH_TOKEN. A Claude Code subscription token (from claude setup-token) arrives as CLAUDE_CODE_OAUTH_TOKEN, so Claude Code runs on your Pro/Max plan. The secret is fetched when the job is claimed, is never stored with the job, and is masked as •••• in logs and output.

The runner's config lives in runner.json next to the credentials. Changes to what it may run apply from the next job; no restart is needed. Scripts run in your login shell ($SHELL -l -c) so they see your normal PATH. A script runs as your user, with your permissions, so only allow shell on machines and accounts you trust your workflows with.

Computer — a browser FongFlow AI uses for you

fongflow computer start opens a browser on this machine that FongFlow's AI can drive: ask in chat with !computer … ("!computer find today's SJC gold price"). It runs as this machine's runner, so register one first.

fongflow computer start             # in a container if Docker/Podman is usable, else the installed Chrome
fongflow computer start --headed    # the installed Chrome with its window visible, to watch it work

The container mode runs chromedp/headless-shell with its DevTools port on 127.0.0.1 only, and keeps the browser profile (cookies, sign-ins) in the fongflow-computer-profile volume. The Chrome mode keeps its own profile in computer/profile next to the credentials, apart from your everyday Chrome.

Open Computer (/computer) in FongFlow to watch the browser live next to a chat with it (CLI 2.4.0+). Take over hands the browser to you — click, scroll and type on the live screen to sign in or solve a check, while the AI's changing actions wait — and Return control gives it back. Frames are only streamed while that page is open.

At a sign-in the AI shows you a private form in the chat: what you type (or a login you saved for that website) goes straight to this computer, which fills the page — the AI never sees it. Permissions on the Computer page decide what it may do without asking: fill in, send/post, delete, buy/pay — each "Do it", "Ask me" (Approve / Deny in the chat) or "Leave to me".

In Flow, the Do a task in the browser action (computer.run_task) runs a whole task unattended — on a schedule, say — and returns the answer. Keep fongflow computer start running for that; steps that need approval or a sign-in stop the task with the reason.

The AI reads pages as text and acts on numbered elements: open, click, type, press a key, scroll, back. It never types into password fields (the CLI refuses), and stops at sign-ins, payments and robot checks for you to finish in the browser. Like the runner, it only calls out to FongFlow, so it works behind NAT; Ctrl+C stops it and closes the browser.

版本与发布记录

@fongflow/cli 共发布 27 个版本,首次发布于 2026/10/05;过去 12 个月发布了 27 个版本。

版本发布日期距今
2.10.4latest2026/11/132 天前
2.10.32026/11/132 天前
2.10.22026/11/114 天前
2.9.12026/11/069 天前
2.8.02026/11/0214 天前
2.7.02026/10/2620 天前

关于 @fongflow/cli 的常见问题

@fongflow/cli 是什么?

FongFlow command-line interface — run Flow steps on your own computer (fongflow runner), give FongFlow AI a browser (fongflow computer), run and watch workflows, and capture todos from the terminal.

如何安装 @fongflow/cli?

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

@fongflow/cli 支持 TypeScript 吗?

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

@fongflow/cli 支持 ESM 还是 CommonJS?

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

@fongflow/cli 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@fongflow/cli 可以商用吗?

@fongflow/cli 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

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

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

@fongflow/cli 还在维护吗?

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