browserctl-cli
Advanced tools
@@ -13,3 +13,3 @@ # browserctl-flow.json 到 SKILL.md 生成规范 | ||
| 生成后的 `SKILL.md` 是数字员工可加载的业务技能。技能运行时只负责收集缺失输入、替换 `${KEY}` 占位符、调用 `browserctl batch --json`,不重新规划浏览器步骤。 | ||
| 生成后的 `SKILL.md` 是数字员工可加载的业务技能。技能运行时只负责收集缺失输入,并调用 `browserctl run-flow browserctl-flow.json`,不重新规划浏览器步骤,也不手工抽取命令数组。 | ||
@@ -29,6 +29,6 @@ 生成前必须先对输入执行等价于 `browserctl validate-flow` 的静态校验。若运行时能读取随技能保存的 | ||
| 1. 读取 `kind: "browserctl-flow"`、`schemaVersion: "1.0.0"` 的流程文件。 | ||
| 2. 按固定模板生成一个包含 `SKILL.md` 的技能目录。 | ||
| 3. 把 `metadata`、`business`、`credentials`、`inputs`、`commands`、`quality` 映射进技能。 | ||
| 4. 将 `commands[]` 以对象形式固化为固定 browserctl batch 步骤,保留 `id`、`argv`、`capture` 和安全的 command 级 metadata。 | ||
| 5. 保留 `commands[].capture`,支持多 tab 等运行时变量绑定。 | ||
| 2. 按固定模板生成一个包含 `SKILL.md` 和 `browserctl-flow.json` 的技能目录。 | ||
| 3. 把 `metadata`、`business`、`credentials`、`inputs`、`commands`、`quality` 映射进技能说明和随包 flow 文件。 | ||
| 4. 将 `browserctl-flow.json` 作为运行入口,要求运行时使用 `browserctl validate-flow` 与 `browserctl run-flow`。 | ||
| 5. 保留 `commands[].capture`,由 `run-flow` 支持多 tab 等运行时变量绑定。 | ||
| 6. 明确质量门禁:`ready` 可自动生成,`needs_review` 生成草稿,`blocked` 不生成可执行技能。 | ||
@@ -140,3 +140,3 @@ 7. 生成的技能必须约束模型不要重排、改写、跳过或重新推理浏览器操作。 | ||
| | `inputs[]` | “业务输入” | | ||
| | `commands[]` | “固定 browserctl 步骤” JSON | | ||
| | `commands[]` | 随包 `browserctl-flow.json` 中的固定步骤 | | ||
| | 顶层 `warnings[]` + `quality.warnings[]` | “审核提示” | | ||
@@ -193,3 +193,3 @@ | `quality` | “质量状态” | | ||
| 你必须严格执行下方固定 browserctl 流程。 | ||
| 你必须严格执行本技能目录下的 `browserctl-flow.json`。 | ||
@@ -211,30 +211,14 @@ 禁止: | ||
| 4. 只替换完整 token 形式的 `${KEY}`。 | ||
| 5. 使用 `browserctl batch --json` 执行“固定 browserctl 步骤”。 | ||
| 6. 如果 batch 返回 `ok:false`,按错误码报告失败,不要自行猜测新路径。 | ||
| 5. 使用 `browserctl validate-flow browserctl-flow.json` 做静态校验。 | ||
| 6. 使用 `browserctl run-flow browserctl-flow.json` 执行完整流程。 | ||
| 7. 如果 run-flow 返回 `ok:false`,按错误码报告失败,不要自行猜测新路径。 | ||
| ## 固定 browserctl 步骤 | ||
| ## 流程文件 | ||
| <!-- browserctl-commands:start --> | ||
| ```json | ||
| [ | ||
| { | ||
| "id": "cmd-001", | ||
| "argv": ["open", "${BASE_URL}"] | ||
| }, | ||
| { | ||
| "id": "cmd-002", | ||
| "argv": ["click", "button.open", "--new-tab"], | ||
| "capture": { "tabId": "DETAIL_TAB" } | ||
| }, | ||
| { | ||
| "id": "cmd-003", | ||
| "argv": ["tab", "${DETAIL_TAB}"] | ||
| } | ||
| ] | ||
| ``` | ||
| <!-- browserctl-commands:end --> | ||
| 本技能目录必须包含 `browserctl-flow.json`。运行时只读取该文件,不从 `SKILL.md` 中抽取 | ||
| `commands[]`,也不创建临时 batch JSON 文件。 | ||
| ## 结果判断 | ||
| 执行完成后,根据 batch 返回结果和成功标准判断任务是否完成。 | ||
| 执行完成后,根据 run-flow 返回结果和成功标准判断任务是否完成。 | ||
@@ -250,11 +234,13 @@ 如果固定步骤包含明确成功断言,例如 `wait --text`、`wait --selector`、`wait --url` 或 `get` 校验,必须优先使用该结果。 | ||
| 技能运行时不能把 `SKILL.md` 中的固定步骤直接逐字传给 shell。必须先解析 JSON,替换变量,然后通过 stdin 传给: | ||
| 技能运行时不能从 `SKILL.md` 中手工抽取命令,也不能创建临时 `task_commands.json`。必须优先读取与 | ||
| `SKILL.md` 同目录的 `browserctl-flow.json`,并使用: | ||
| ```bash | ||
| browserctl batch --json | ||
| browserctl validate-flow browserctl-flow.json | ||
| browserctl run-flow browserctl-flow.json | ||
| ``` | ||
| 运行器应优先读取 `browserctl-flow.json` 中的 `commands[]`。当只能从 `SKILL.md` 读取时, | ||
| 必须只解析 `<!-- browserctl-commands:start -->` 与 | ||
| `<!-- browserctl-commands:end -->` 之间的 JSON fenced block,不能让模型从自然语言段落中推断命令。 | ||
| `run-flow` 负责解析 `credentials`、`inputs`、环境变量、`--var` / `--var-file` 和命令级 `capture`。 | ||
| 只有在历史技能没有随包保存 `browserctl-flow.json` 时,才允许退回解析内嵌命令块并调用 | ||
| `browserctl batch --json`。 | ||
@@ -285,3 +271,3 @@ ### 8.1 替换规则 | ||
| `capture` 变量不在生成阶段替换,由 `browserctl batch --json` 在执行时绑定。 | ||
| `capture` 变量不在生成阶段替换,由 `browserctl run-flow` 在执行时绑定。 | ||
@@ -294,4 +280,4 @@ ### 8.2 secret 处理 | ||
| 2. 不得写入 `SKILL.md`、`browserctl-flow.json`、报告、日志或聊天消息。 | ||
| 3. 替换进 batch JSON 后不得打印完整命令。 | ||
| 4. batch 失败时错误报告必须脱敏。 | ||
| 3. 替换进 run-flow 执行参数后不得打印完整命令。 | ||
| 4. run-flow 失败时错误报告必须脱敏。 | ||
@@ -410,5 +396,5 @@ ### 8.3 batch 输入形态 | ||
| 1. 不把 secret 默认值写入 `SKILL.md`。 | ||
| 2. 不在日志中输出替换后的完整 batch JSON。 | ||
| 2. 不在日志中输出替换后的完整 run-flow 命令参数。 | ||
| 3. 不允许 `commands[].argv[0]` 为 `batch`,避免嵌套 batch。 | ||
| 4. 不允许命令参数包含平台外壳注入逻辑;`argv` 必须作为 JSON 数组传给 batch,不拼接为 shell 字符串。 | ||
| 4. 不允许命令参数包含平台外壳注入逻辑;运行时必须通过 `run-flow` 的变量机制传值,不拼接为 shell 字符串。 | ||
| 5. 不允许 `blocked` flow 自动启用。 | ||
@@ -473,3 +459,3 @@ 6. 保留原始 flow 供审计,但其中如果包含真实 secret,导入前必须拒绝或脱敏。 | ||
| 生成的 `SKILL.md` 必须包含固定步骤 JSON,并明确要求使用 `browserctl batch --json` 执行。 | ||
| 生成的 `SKILL.md` 必须明确要求使用随包 `browserctl-flow.json` 和 `browserctl run-flow` 执行。 | ||
@@ -476,0 +462,0 @@ ## 15. 验收标准 |
+1
-1
| { | ||
| "name": "browserctl-cli", | ||
| "version": "0.1.6", | ||
| "version": "0.1.7", | ||
| "description": "Self-contained browserctl CLI with auto-start Chrome/Edge daemon (no Electron required)", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
407469
0.14%8438
0.01%5
-16.67%