Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 27 additions & 1 deletion contrib/ci/npm-packages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { chmod, mkdir, readdir, readFile, rm } from "node:fs/promises";

import { dirname, join } from "node:path";

import { version as openFlowVersion } from "@oomol-lab/open-flow/package.json";
import { describe, expect, test } from "bun:test";
import { createTemporaryDirectory } from "../../__tests__/helpers.ts";
import {
Expand Down Expand Up @@ -464,7 +465,7 @@ describe("npm-packages", () => {
});

compiledBinaryInstallTest(
"compiled binary installs bundled skills to stable file paths",
"compiled binary runs bundled Flow and installs bundled skills",
async () => {
const rootDirectoryPath = process.cwd();
const temporaryDirectoryPath = await createTemporaryDirectory(
Expand Down Expand Up @@ -514,6 +515,31 @@ describe("npm-packages", () => {
mkdir(homeDirectoryPath, { recursive: true }),
]);

for (const args of [[], ["--help"], ["--version"]]) {
const flowResult = Bun.spawnSync([executablePath, "flow", ...args], {
cwd: temporaryDirectoryPath,
env: {
...process.env,
HOME: homeDirectoryPath,
XDG_CONFIG_HOME: configHomeDirectoryPath,
XDG_CACHE_HOME: join(temporaryDirectoryPath, "cache"),
LOCALAPPDATA: join(temporaryDirectoryPath, "local-app-data"),
OO_OPEN_FLOW_COMMAND_DIR: "",
OO_TELEMETRY_DISABLED: "1",
},
stderr: "pipe",
stdin: "ignore",
stdout: "pipe",
timeout: 5_000,
});

expect(decodeOutput(flowResult.stderr)).toBe("");
expect(flowResult.exitCode).toBe(0);
expect(decodeOutput(flowResult.stdout)).toContain(
args[0] === "--version" ? openFlowVersion : "oo flow",
);
}

const installResult = Bun.spawnSync(
[executablePath, "skills", "add"],
{
Expand Down
24 changes: 6 additions & 18 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,17 @@ use. Truthy values are `1`, `true`, `yes`, or `on` (case-insensitive).

### `oo flow [args...]`

Run the Open Flow CLI release pinned by the current `oo` release. The first
invocation downloads and verifies its immutable command archive. Later
invocations reuse the verified local cache without checking for updates or
requiring network access.
Run the Open Flow CLI bundled with the current `oo` release, without any
additional download. Help and version queries work offline; operations against
a Hosted or self-hosted Server still require a connection to that service.

- The `oo` host consumes `--team <name>` for the whole Flow invocation.
Remaining arguments after `flow` are passed to Open Flow unchanged and are
kept out of debug logs.
- The effective `oo --lang` locale is passed to Open Flow as `en` or
`zh-CN`. Open Flow owns and versions its translated command text.
- `oo flow --help` and `oo flow --version` are therefore Open Flow commands.
Use `oo help flow` to show the host-side command description without loading
Open Flow.
Use `oo help flow` to show the host-side command description.
- Root help and generated shell completions always list `flow` for both Hosted
and self-hosted deployments.
- Main `oo` global options such as `--lang` and `--debug` must appear before
Expand All @@ -137,18 +135,8 @@ requiring network access.
environment, and signals. Its exit code becomes the `oo` exit code.
- With no delegated arguments, Open Flow prints help and never waits for
input, including when stdin and stdout are TTYs.
- The downloaded archive is accepted only when its length and SHA-256 digest
match the release pinned by `oo`, and its internal manifest and complete file
set agree with that release. The Bun build version recorded by the artifact
does not need to match the Bun runtime used by `oo`.
- Command Artifact v2 contains only the Control API CLI entry and license
files. It does not contain Workbench assets, a Deployment Runtime, skills,
or a local Project implementation.
- On a cache miss, interactive terminals show in-place byte progress on stderr;
non-interactive streams receive one start and one completion line. Cache hits
remain silent.
- `OO_OPEN_FLOW_COMMAND_DIR` bypasses download and cache resolution for local
repository integration testing.
- `OO_OPEN_FLOW_COMMAND_DIR` selects a local command entry for repository
integration testing.
- By default, Open Flow commands use the current `oo` credential and effective
Team. The Hosted gateway is derived from the current endpoint as
`https://open-flow.<endpoint>`; for example, `OO_ENDPOINT=oomol.dev` uses
Expand Down
17 changes: 5 additions & 12 deletions docs/commands.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ CLI 读取以下环境变量以支持内置和自动化场景。真值为 `1`、
使用指定的已展开命令产物目录。该目录必须包含 `entry.js`;Open Flow
仓库的标准构建会将它写到
`packages/command/dist/command/open-flow-command`。未设置时,`oo flow`
使用当前 `oo` 版本固定的 Open Flow release。
使用当前 `oo` 版本内置的 Open Flow CLI。
- `OO_OPEN_FLOW_URL`:用完整 HTTP(S) origin 选择自部署 Open Flow Server,例如
`http://127.0.0.1:3000`。必须与 `OO_OPEN_FLOW_TOKEN` 同时设置;两者生效时,
`oo flow` 不使用 OOMOL 账号、Team 或 `OO_ENDPOINT`。
Expand Down Expand Up @@ -95,30 +95,23 @@ CLI 读取以下环境变量以支持内置和自动化场景。真值为 `1`、

### `oo flow [args...]`

运行当前 `oo` 版本固定的 Open Flow CLI release。首次调用会下载并验证对应的
不可变命令归档;之后直接离线复用已验证的本地缓存,不会在每次启动时检查更新。
运行随当前 `oo` 版本内置的 Open Flow CLI,无需额外下载。帮助和版本查询
无需网络;访问 Hosted 或自部署 Server 的操作仍需要连接对应服务。

- `oo` 宿主读取 `--team <name>`,为整个 Flow 调用选择团队。`flow` 后的
其余参数原样传给 Open Flow,并且不写入 debug 日志。
- 当前生效的 `oo --lang` locale 会以 `en` 或 `zh-CN` 传给 Open Flow;
Open Flow 自己拥有并随版本发布对应的命令翻译文案。
- 因此 `oo flow --help` 和 `oo flow --version` 都属于 Open Flow 命令。
如需在不加载 Open Flow 的情况下查看宿主侧命令说明,请使用 `oo help flow`。
如需查看宿主侧命令说明,请使用 `oo help flow`。
- 根帮助和生成的 shell 补全始终会列出 `flow`,Hosted 与自部署模式一致。
- `--lang`、`--debug` 等 `oo` 全局选项必须放在 `flow` 前面;
团队选择也可以放在 `flow` 后或子命令后,其余选项归 Open Flow 所有。
- Open Flow 使用当前进程的工作目录、标准输入输出、环境变量和信号;
它的退出码会直接成为 `oo` 的退出码。
- 未传入后续参数时,Open Flow 只打印帮助且不等待输入;stdin 和 stdout 都是
TTY 时也保持相同行为。
- 只有归档长度和 SHA-256 与 `oo` 固定的 release 一致,且内部 manifest 和完整
文件集合与该 release 相符时,下载内容才会被接受。Artifact 中记录的 Bun 构建
版本不需要与 `oo` 使用的 Bun runtime 版本一致。
- Command Artifact v2 只包含 Control API CLI entry 和 license 文件,不包含
Workbench assets、Deployment Runtime、skills 或本地 Project 实现。
- 缓存未命中时,交互式终端会在 stderr 原地刷新字节进度;非交互式输出会分别打印
一行开始和完成信息。命中缓存时保持静默。
- `OO_OPEN_FLOW_COMMAND_DIR` 仅用于本地仓库联调;设置后会跳过下载和缓存解析。
- `OO_OPEN_FLOW_COMMAND_DIR` 仅用于本地仓库联调;设置后使用指定目录中的命令入口。
- 默认情况下,Open Flow 子命令使用当前 `oo` 登录凭证和生效的 Team。Hosted
gateway 由当前 endpoint 派生为 `https://open-flow.<endpoint>`;例如
`OO_ENDPOINT=oomol.dev` 使用 `https://open-flow.oomol.dev`。
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"typescript": "^5"
},
"dependencies": {
"@oomol-lab/open-flow": "0.1.0-beta.61",
"@vercel/detect-agent": "^1.2.5",
"@wopjs/cast": "^0.1.16",
"agentic-markdown": "^0.0.4",
Expand All @@ -59,7 +60,6 @@
},
"devDependencies": {
"@antfu/eslint-config": "^7.7.3",
"@oomol-lab/open-flow": "^0.1.0-beta.59",
"@types/bun": "latest",
"eslint": "^10.0.3",
"eslint-plugin-format": "^2.0.1",
Expand Down
Loading
Loading