agentic-flow-kit 1.7.15 → 1.7.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -3
- package/modules/hosts/claude/commands/wf-design.md +5 -4
- package/modules/hosts/claude/commands/wf-new-task.md +42 -21
- package/modules/hosts/claude/commands/wf-review.md +1 -1
- package/modules/hosts/claude/commands/wf-sync-hosts.md +7 -13
- package/modules/hosts/claude/commands/wf-test.md +1 -1
- package/modules/hosts/codex/commands/wf-design.md +5 -4
- package/modules/hosts/codex/commands/wf-new-task.md +42 -21
- package/modules/hosts/codex/commands/wf-review.md +1 -1
- package/modules/hosts/codex/commands/wf-sync-hosts.md +7 -13
- package/modules/hosts/codex/commands/wf-test.md +1 -1
- package/modules/hosts/cursor/commands/wf-design.md +5 -4
- package/modules/hosts/cursor/commands/wf-new-task.md +42 -21
- package/modules/hosts/cursor/commands/wf-review.md +1 -1
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +7 -13
- package/modules/hosts/cursor/commands/wf-test.md +1 -1
- package/modules/hosts/opencode/commands/wf-design.md +5 -4
- package/modules/hosts/opencode/commands/wf-new-task.md +42 -21
- package/modules/hosts/opencode/commands/wf-review.md +1 -1
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +7 -13
- package/modules/hosts/opencode/commands/wf-test.md +1 -1
- package/modules/hosts/trae/commands/wf-design.md +5 -4
- package/modules/hosts/trae/commands/wf-new-task.md +42 -21
- package/modules/hosts/trae/commands/wf-review.md +1 -1
- package/modules/hosts/trae/commands/wf-sync-hosts.md +7 -13
- package/modules/hosts/trae/commands/wf-test.md +1 -1
- package/package.json +1 -1
- package/src/cli.mjs +43 -4
- package/src/doctor.mjs +37 -1
- package/src/executor.mjs +245 -0
- package/src/executor.test.mjs +292 -0
- package/src/init.mjs +7 -0
- package/src/profiles.mjs +3 -0
- package/src/render.mjs +3 -3
- package/src/sync-hosts.mjs +37 -43
- package/src/sync-hosts.test.mjs +67 -56
- package/templates/.gitattributes +8 -0
- package/templates/AGENTS.md +1 -1
- package/templates/_agents/commands/design.md +5 -4
- package/templates/_agents/commands/new-task.md +42 -21
- package/templates/_agents/commands/review.md +1 -1
- package/templates/_agents/commands/sync-hosts.md +7 -13
- package/templates/_agents/commands/test.md +1 -1
- package/templates/_agents/control-surfaces.txt +1 -1
- package/templates/_agents/engine-lock.json +246 -0
- package/templates/_agents/lane-surfaces.txt +1 -1
- package/templates/_agents/level-hints.txt +30 -0
- package/templates/_agents/scripts/agg-delegations.test.mjs +5 -3
- package/templates/_agents/scripts/check-engine-integrity.mjs +55 -126
- package/templates/_agents/scripts/check-engine-integrity.test.mjs +33 -45
- package/templates/_agents/scripts/check-lane-surface.mjs +72 -23
- package/templates/_agents/scripts/check-lane-surface.test.mjs +66 -0
- package/templates/_agents/scripts/check-ledger-invariant.mjs +112 -14
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +5 -1
- package/templates/_agents/scripts/check-loop-rev.test.mjs +6 -4
- package/templates/_agents/scripts/check-loop.mjs +49 -41
- package/templates/_agents/scripts/check-loop.test.mjs +18 -13
- package/templates/_agents/scripts/check-metric-claims.mjs +4 -2
- package/templates/_agents/scripts/compact-ledgers.mjs +97 -0
- package/templates/_agents/scripts/compact-ledgers.test.mjs +162 -0
- package/templates/_agents/scripts/confirm-doc.mjs +40 -11
- package/templates/_agents/scripts/doctor.test.mjs +44 -1
- package/templates/_agents/scripts/edit-face-check.test.mjs +5 -4
- package/templates/_agents/scripts/fill-intent.mjs +2 -2
- package/templates/_agents/scripts/fixture-scripts.mjs +153 -0
- package/templates/_agents/scripts/fixture-scripts.test.mjs +107 -0
- package/templates/_agents/scripts/gate-checklist.mjs +4 -9
- package/templates/_agents/scripts/gate-checklist.test.mjs +2 -11
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +8 -11
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +9 -33
- package/templates/_agents/scripts/git-merge-jsonl.mjs +63 -0
- package/templates/_agents/scripts/git-merge-jsonl.test.mjs +125 -0
- package/templates/_agents/scripts/ledger-doc-chain.test.mjs +166 -0
- package/templates/_agents/scripts/ledger-loader.mjs +108 -0
- package/templates/_agents/scripts/ledger-loader.test.mjs +131 -0
- package/templates/_agents/scripts/ledger-prune.mjs +96 -0
- package/templates/_agents/scripts/ledger-prune.test.mjs +120 -0
- package/templates/_agents/scripts/ledger-ts-monotonic.test.mjs +135 -0
- package/templates/_agents/scripts/level-criteria.mjs +232 -0
- package/templates/_agents/scripts/level-criteria.test.mjs +279 -0
- package/templates/_agents/scripts/pipeline-run.mjs +4 -2
- package/templates/_agents/scripts/policy.mjs +47 -0
- package/templates/_agents/scripts/stage-gates.mjs +4 -9
- package/templates/_agents/scripts/wf-journal.test.mjs +1 -1
- package/templates/_agents/scripts/wiki-search.test.mjs +5 -6
- package/templates/_agents/scripts/workflows-check.mjs +1 -1
- package/templates/_agents/workflows/pipeline-closing.md +4 -5
- package/templates/_githooks/pre-commit +3 -34
- package/templates/_githooks/pre-push +3 -3
- package/templates/workflow/README.md +11 -0
- package/modules/hosts/claude/commands/wf-source-sync-check.md +0 -89
- package/modules/hosts/codex/commands/wf-source-sync-check.md +0 -89
- package/modules/hosts/cursor/commands/wf-source-sync-check.md +0 -89
- package/modules/hosts/opencode/commands/wf-source-sync-check.md +0 -89
- package/modules/hosts/trae/commands/wf-source-sync-check.md +0 -90
- package/templates/_agents/commands/source-sync-check.md +0 -103
- package/templates/_agents/scripts/check-ledger.mjs +0 -109
- package/templates/_agents/scripts/check-ledger.test.mjs +0 -199
- package/templates/_agents/scripts/source-sync-check.mjs +0 -156
- package/templates/_agents/scripts/source-sync-check.test.mjs +0 -286
- package/templates/_agents/workflows/source-sync-repair.md +0 -30
|
@@ -6,27 +6,22 @@ description: 跨宿主适配层同步(正文段 sha 比对 + 用户拍板 +
|
|
|
6
6
|
|
|
7
7
|
# Sync-Hosts · 跨宿主适配层正文段同步
|
|
8
8
|
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
> `flow-kit sync-hosts --apply`——2026-10-07 起按**目标根**自动判布局(含 `templates/_agents` + `modules/hosts` → 包源:
|
|
12
|
-
> 比 `templates/_agents` ↔ `modules/hosts/<宿主键>/`;含 `.agents` → 装户:比 `.agents` ↔ 项目根下 `<宿主点目录>/`),
|
|
13
|
-
> 目标根取 `--dir <目录>` > 当前目录。
|
|
9
|
+
> 本命令只在包源仓运行(需要 `templates/_agents` 与 `modules/hosts`)。改权威源(`templates/_agents/{commands,roles}/*.md`)后薄适配(`modules/hosts/<h>/{agents,commands}/*.md`)要同步——薄适配正文 = 权威源正文,frontmatter 各自保留宿主特化(commands 层文件名 = 宿主命令名,opencode / trae 同用 `wf-` 前缀,单源见 `src/profiles.mjs#HOSTS.commandPrefix`;trae 另有 `name: wf-X`,zcode/omp 各自原描述)。
|
|
10
|
+
> 装户的宿主文件由 `init` / `add-host` 写入。装户漂移由 `flow-kit doctor` §6.7 报告(包源环境跳过);刷新用 `flow-kit add-host <宿主> --force`。`flow-kit sync` 不更新宿主适配。
|
|
14
11
|
|
|
15
12
|
## 1. 何时跑
|
|
16
13
|
|
|
17
14
|
- 改 `templates/_agents/commands/*.md` 正文后(11 个 commands 文件)
|
|
18
15
|
- 改 `templates/_agents/roles/*.md` 正文后(3 个 roles 文件)
|
|
19
|
-
-
|
|
20
|
-
- 不跑:仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
16
|
+
- 不跑:装户仓(本命令会拒绝);仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
21
17
|
|
|
22
18
|
## 2. 怎么跑
|
|
23
19
|
|
|
24
20
|
### 2.1 默认 `--diff`(仅报告)
|
|
25
21
|
|
|
26
22
|
```
|
|
27
|
-
node bin/flow-kit.mjs sync-hosts --diff #
|
|
23
|
+
node bin/flow-kit.mjs sync-hosts --diff # 包源仓(在包源根跑,或 --dir <包源根>)
|
|
28
24
|
node bin/flow-kit.mjs sync-hosts --json # 机器可读
|
|
29
|
-
flow-kit sync-hosts --diff # 装户仓(在装户根跑;或用 --dir <项目根> 指定)
|
|
30
25
|
```
|
|
31
26
|
|
|
32
27
|
输出三类:
|
|
@@ -46,9 +41,8 @@ node bin/flow-kit.mjs sync-hosts --apply
|
|
|
46
41
|
### 2.3 自验
|
|
47
42
|
|
|
48
43
|
```
|
|
49
|
-
npm test # 含 sync-hosts.test.mjs
|
|
50
|
-
node bin/flow-kit.mjs doctor #
|
|
51
|
-
sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已探测分流
|
|
44
|
+
npm test # 含 sync-hosts.test.mjs
|
|
45
|
+
node bin/flow-kit.mjs doctor # 包源环境 §6.7 skipped
|
|
52
46
|
```
|
|
53
47
|
|
|
54
48
|
## 3. 边界(不要做)
|
|
@@ -63,7 +57,7 @@ sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已
|
|
|
63
57
|
|
|
64
58
|
- trae 钩子(`modules/hosts/trae/hooks/*.cjs`)— 独立演进的工程件
|
|
65
59
|
- trae 规则(`modules/hosts/trae/rules/*.md`)— 同上
|
|
66
|
-
-
|
|
60
|
+
- 门禁脚本与钩子(`templates/_agents/scripts`、`templates/_githooks`)— 由 `flow-kit sync` 按 managed 台账下发,不走 sync-hosts
|
|
67
61
|
|
|
68
62
|
## 5. 相关留痕
|
|
69
63
|
|
|
@@ -16,7 +16,7 @@ description: Test 阶段:静态门(架构红线 + build + test)+ UI 实测(headl
|
|
|
16
16
|
项目测试命令 # 自动化测试
|
|
17
17
|
项目类型检查命令 # 前端类型检查/构建(涉及前端时跑)
|
|
18
18
|
node .agents/scripts/verify-wiki-consistency.mjs # 触及 wiki/ 时跑(exit 1 即先修台账再继续:跑 gen-wiki-board.mjs 补索引/看板;pre-commit 已按增量自动拦,此行用于改完即验)
|
|
19
|
-
npx agentic-flow-kit doctor # §6.5 delegations + §6.6 owned 漂移 + §6.7
|
|
19
|
+
npx agentic-flow-kit doctor # §6.5 delegations + §6.6 owned 漂移 + §6.7 跨宿主薄适配正文漂移(装户环境;漂移用 add-host <宿主> --force 刷新。包源环境 §6.7 skipped)
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
> **环境注记**:本地服务占用构建产物导致编译失败、多会话并行时「谁跑静态门 / 提交谁先停服务」等约定——如有,见项目注记 `.agents/notes/runtime-env.md` §2,跑静态门前先过一眼。
|
|
@@ -15,10 +15,11 @@ description: Design 阶段 · 起 spec(L2/L3 强制,L1 可省略直接进 bu
|
|
|
15
15
|
## 1. 执行
|
|
16
16
|
|
|
17
17
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
18
|
-
2. 级别判断(对照 AGENTS.md 第 3
|
|
19
|
-
- **L1
|
|
20
|
-
- **L2
|
|
21
|
-
- **L3
|
|
18
|
+
2. 级别判断(对照 AGENTS.md 第 3 条;判据单源 = `.agents/scripts/level-criteria.mjs`,**本文件只承载流程映射,不复述判据闭集**):
|
|
19
|
+
- **L1**(未命中 L2/L3)→ 快车道:省略 spec,直接跳 `next: build.md` 起草 Quick-Plan
|
|
20
|
+
- **L2**(触达面闭集见单源 `L2_SURFACES`)→ 必须有 spec
|
|
21
|
+
- **L3**(结构面闭集见单源 `L3_SURFACES`)→ 必须有 spec + **新会话独立复核**
|
|
22
|
+
- 判哪一档:逐条对照单源的 `L2_SURFACES` / `L3_SURFACES` / `L1_NEGATIVES`,不要凭记忆——判据只读单源一处
|
|
22
23
|
3. 起草 spec:
|
|
23
24
|
- **填空工具先跑**:`node .agents/scripts/fill-spec.mjs --level <L1|L2|L3> --topic <主题> --output workflow/specs/<date>-<主题>.md`——输出含 frontmatter 5 字段 + 5 节正文(功能行为/数据流/系统改动/约束遵守映射/风险评估)的草稿;AI 据此填实
|
|
24
25
|
- 复制 `workflow/specs/_TEMPLATE.md` → `workflow/specs/YYYY-MM-DD-<主题>.md`(与入口文档同名)
|
|
@@ -20,7 +20,21 @@ description: AI-Native 闭环总入口 · 6 阶段路由(新需求 → plan /
|
|
|
20
20
|
|
|
21
21
|
## 2. 风险定级(第 0 步,先定级再路由)
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
**第 0 步先取机器面下界(必跑,不是可选提示)**:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
flow-kit route --files <预计改动面…> --kind require|fix|verify|review|deploy
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- **不给 `--files` 就拿不到路径下限**——机器面此时只能按 L1 起步并在降级栏点名,等于白跑;
|
|
30
|
+
故定级前先把**预计改动面**列出来(不必精确到最终 diff,给到目录/文件前缀即可)。
|
|
31
|
+
- 跑完**再**按 §4 逐条语义判级:机器只给「就高不就低 + 路径下限」,「一处定义、多处消费」仍要你判。
|
|
32
|
+
- **确实跳过**时必须写明理由(入口文档备注或当场告知用户)——判低的后果由两道门兜:
|
|
33
|
+
起草面 `check-lane-surface` 命中路径下限无合格入口即拦,提交面同门再拦一次。
|
|
34
|
+
**诚实边界**:机器**无法**发现你没跑 route——定级发生在改动面确定之前,没有可比对的记录面,
|
|
35
|
+
详见 [ARCHITECTURE §5](../ARCHITECTURE.md) 与 CHANGELOG 1.7.16 B3 条。
|
|
36
|
+
|
|
37
|
+
动工前按下表定风险级 L0-L3(就高不就低;判据细则见下节「级别判断」),级别即风险级,决定走哪条泳道——确认放事前,还是审计补事后:
|
|
24
38
|
|
|
25
39
|
| 泳道 | 级别 | 确认与审计口径 |
|
|
26
40
|
|------|------|---------------|
|
|
@@ -33,6 +47,10 @@ description: AI-Native 闭环总入口 · 6 阶段路由(新需求 → plan /
|
|
|
33
47
|
|
|
34
48
|
## 3. 路由判断
|
|
35
49
|
|
|
50
|
+
<!-- route-kinds: require=plan.md | fix=maintain.md | verify=test.md | review=review.md | deploy=deploy.md -->
|
|
51
|
+
<!-- ↑ 本行是 kind→入口指令的**机器单源**:`flow-kit route` 读它得出「该读哪个 md」,不再在包内自带一份映射。
|
|
52
|
+
增删 kind 或改入口文件名只改这一行(判据单源 level-criteria.mjs 的纪律同源)。 -->
|
|
53
|
+
|
|
36
54
|
- **自动化驱动(并列入口,可选)**:一句话全程走 [pipeline-run.md](pipeline-run.md)——状态机驱动+工单协议+原话代录,与下述手动路由二选一,同一任务不混用
|
|
37
55
|
- **新需求 / 功能**:从 `plan.md` 进,立 **intent**(`workflow/intents/`)
|
|
38
56
|
- **修复类任务 / 事故**:从 `maintain.md` 进,立 **incident**(`workflow/incidents/`);incident 在 L1+ 即 **intent 等价物**(check-loop 认 incident≡intent),不必另立 intent。先检索同类历史(`node .agents/scripts/kb-search.mjs "<关键词>" --scope workflow --type incidents,plans`),有同类先读其历史三件套;再按级别走:
|
|
@@ -45,28 +63,31 @@ description: AI-Native 闭环总入口 · 6 阶段路由(新需求 → plan /
|
|
|
45
63
|
|
|
46
64
|
## 4. 级别判断(AGENTS.md 第 3 条)
|
|
47
65
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
1. **编码权威**:项目内「一处生成、多处消费」的编码 / 命名 / 取号规则(编码模板、序列发生器、命名空间与去重约束——具体清单按项目 AGENTS.md)
|
|
60
|
-
2. **共享契约**:跨模块共享的基类 / DTO 形状、跨模块公共接口签名
|
|
61
|
-
3. **既有接口语义**:既有参数或端点的行为变化(由失效变生效、默认值或钳制口径改变)
|
|
62
|
-
4. **全局横切口径**:错误响应出口、分页与校验口径、聚合投影键
|
|
66
|
+
> **判据单源 = [`.agents/scripts/level-criteria.mjs`](../scripts/level-criteria.mjs)**,本节**不复述判据**。
|
|
67
|
+
> 要看判据全文,或要机器可判的部分(路径下限 / 就高不就低 / 混档取高),直接:
|
|
68
|
+
>
|
|
69
|
+
> ```bash
|
|
70
|
+
> flow-kit route --files <改动文件…> # 定级 + 下一阶段 + 该读哪个 md
|
|
71
|
+
> ```
|
|
72
|
+
>
|
|
73
|
+
> 单源导出:`LEVELS` `LEVEL_MEANING`(档位语义) / `L2_SURFACES`(四类触达面闭集) / `L3_SURFACES`(结构面) /
|
|
74
|
+
> `L1_NEGATIVES`(判低红线) / `SELF_CHECK`(自查句) / `assessLevel` `hintLevelFor` `parseLevelHints` `routeAdvice`。
|
|
75
|
+
>
|
|
76
|
+
> 路径下限清单(装户 owned,默认空):`.agents/level-hints.txt`,每行 `L2 <ERE>` / `L3 <ERE>`,登记「哪些路径一碰就至少是此档」。
|
|
63
77
|
|
|
64
|
-
|
|
65
|
-
> **自查句**:能否列出 ≥2 个受影响的消费方(模块 / 端点 / 页面)?能 → L2。
|
|
66
|
-
> 先例:本仓 `workflow/specs/`、`workflow/intents/` 下同类历史(kb 检索主题词)。
|
|
78
|
+
**本表只承载流程**(「改什么」判据以单源为准,别在本表增删判据):
|
|
67
79
|
|
|
68
|
-
|
|
69
|
-
|
|
80
|
+
| 级别 | 单源语义(摘要) | 流程 |
|
|
81
|
+
|------|-----------------|------|
|
|
82
|
+
| L0 | 文档/样式微调(无行为影响) | 直接 commit,豁免 intent |
|
|
83
|
+
| L1 | 实现级改动(未命中 L2/L3) | 快车道:液态草稿(.zcode/drafts) → 实现 → 固化(`solidify-task.mjs`)——用户确认后带 `--delegated "<原话>"` 执行;无确认来源只迁移不落账 |
|
|
84
|
+
| L2 | 规则 / 契约(一处改、多处依赖) | 入口文档(intent / incident) + spec + plan 三件套 |
|
|
85
|
+
| L3 | 数据与运行时结构(结构面闭集见单源 `L3_SURFACES`) | 同 L2 + spec 新会话独立复核 |
|
|
86
|
+
|
|
87
|
+
> 混合改动按最高档定级(就高不就低);**L1 是默认档**——判级只回答「是否命中单源 `L2_SURFACES` 或
|
|
88
|
+
> `L3_SURFACES`」,负例(`L1_NEGATIVES`)命中即不得升档;自查句:`SELF_CHECK`。
|
|
89
|
+
> 机器兜得住的只有「就高不就低」与路径下限;「一处定义、多处消费」是**语义**判定,由你按单源逐条判,
|
|
90
|
+
> 漏判由 lane-surface 触达面门在提交面兜。先例:`workflow/specs/`、`workflow/intents/` 下同类历史(kb 检索主题词)。
|
|
70
91
|
|
|
71
92
|
## 5. intent 豁免(避免小改动也走完整闭环)
|
|
72
93
|
|
|
@@ -32,7 +32,7 @@ description: Review · 代码评审(横切,合入前使用;P0/P1/P2 分级
|
|
|
32
32
|
- **Create/Update 校验同口径**:Create 已有校验 Update 必须同口径;被引用的标识符字段禁改
|
|
33
33
|
- **查询分页与状态语义**:分页参数范围校验 + 服务层钳制;非法状态与不存在分离(按项目统一错误口径,如 400 / 404)
|
|
34
34
|
- **spec 承诺的断言落地**:spec §测试列出的用例 / 断言须真落到测试或验证脚本;「写进 spec」不等于「跑得起来」,且常驻断言禁写成随时间增长的行数常量
|
|
35
|
-
-
|
|
35
|
+
- **跨宿主薄适配正文漂移**:包源仓改 `templates/_agents/{commands,roles}/*.md` 后跑 `flow-kit sync-hosts --apply`,单向同步 `modules/hosts/<h>/{agents,commands}/*.md`。装户由 `flow-kit doctor` §6.7 检查(包源环境跳过);装户刷新宿主文件用 `flow-kit add-host <宿主> --force`(`sync` 不更新宿主适配,`sync-hosts` 不在装户根运行)
|
|
36
36
|
|
|
37
37
|
## 3. P2 建议(提醒,不拦合入)
|
|
38
38
|
|
|
@@ -6,27 +6,22 @@ description: 跨宿主适配层同步(正文段 sha 比对 + 用户拍板 +
|
|
|
6
6
|
|
|
7
7
|
# Sync-Hosts · 跨宿主适配层正文段同步
|
|
8
8
|
|
|
9
|
-
>
|
|
10
|
-
>
|
|
11
|
-
> `flow-kit sync-hosts --apply`——2026-10-07 起按**目标根**自动判布局(含 `templates/_agents` + `modules/hosts` → 包源:
|
|
12
|
-
> 比 `templates/_agents` ↔ `modules/hosts/<宿主键>/`;含 `.agents` → 装户:比 `.agents` ↔ 项目根下 `<宿主点目录>/`),
|
|
13
|
-
> 目标根取 `--dir <目录>` > 当前目录。
|
|
9
|
+
> 本命令只在包源仓运行(需要 `templates/_agents` 与 `modules/hosts`)。改权威源(`templates/_agents/{commands,roles}/*.md`)后薄适配(`modules/hosts/<h>/{agents,commands}/*.md`)要同步——薄适配正文 = 权威源正文,frontmatter 各自保留宿主特化(commands 层文件名 = 宿主命令名,opencode / trae 同用 `wf-` 前缀,单源见 `src/profiles.mjs#HOSTS.commandPrefix`;trae 另有 `name: wf-X`,zcode/omp 各自原描述)。
|
|
10
|
+
> 装户的宿主文件由 `init` / `add-host` 写入。装户漂移由 `flow-kit doctor` §6.7 报告(包源环境跳过);刷新用 `flow-kit add-host <宿主> --force`。`flow-kit sync` 不更新宿主适配。
|
|
14
11
|
|
|
15
12
|
## 1. 何时跑
|
|
16
13
|
|
|
17
14
|
- 改 `templates/_agents/commands/*.md` 正文后(11 个 commands 文件)
|
|
18
15
|
- 改 `templates/_agents/roles/*.md` 正文后(3 个 roles 文件)
|
|
19
|
-
-
|
|
20
|
-
- 不跑:仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
16
|
+
- 不跑:装户仓(本命令会拒绝);仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
21
17
|
|
|
22
18
|
## 2. 怎么跑
|
|
23
19
|
|
|
24
20
|
### 2.1 默认 `--diff`(仅报告)
|
|
25
21
|
|
|
26
22
|
```
|
|
27
|
-
node bin/flow-kit.mjs sync-hosts --diff #
|
|
23
|
+
node bin/flow-kit.mjs sync-hosts --diff # 包源仓(在包源根跑,或 --dir <包源根>)
|
|
28
24
|
node bin/flow-kit.mjs sync-hosts --json # 机器可读
|
|
29
|
-
flow-kit sync-hosts --diff # 装户仓(在装户根跑;或用 --dir <项目根> 指定)
|
|
30
25
|
```
|
|
31
26
|
|
|
32
27
|
输出三类:
|
|
@@ -46,9 +41,8 @@ node bin/flow-kit.mjs sync-hosts --apply
|
|
|
46
41
|
### 2.3 自验
|
|
47
42
|
|
|
48
43
|
```
|
|
49
|
-
npm test # 含 sync-hosts.test.mjs
|
|
50
|
-
node bin/flow-kit.mjs doctor #
|
|
51
|
-
sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已探测分流
|
|
44
|
+
npm test # 含 sync-hosts.test.mjs
|
|
45
|
+
node bin/flow-kit.mjs doctor # 包源环境 §6.7 skipped
|
|
52
46
|
```
|
|
53
47
|
|
|
54
48
|
## 3. 边界(不要做)
|
|
@@ -63,7 +57,7 @@ sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已
|
|
|
63
57
|
|
|
64
58
|
- trae 钩子(`modules/hosts/trae/hooks/*.cjs`)— 独立演进的工程件
|
|
65
59
|
- trae 规则(`modules/hosts/trae/rules/*.md`)— 同上
|
|
66
|
-
-
|
|
60
|
+
- 门禁脚本与钩子(`templates/_agents/scripts`、`templates/_githooks`)— 由 `flow-kit sync` 按 managed 台账下发,不走 sync-hosts
|
|
67
61
|
|
|
68
62
|
## 5. 相关留痕
|
|
69
63
|
|
|
@@ -16,7 +16,7 @@ description: Test 阶段 · 静态门 + 切库冒烟 + UI 实测 + L2/L3 独立
|
|
|
16
16
|
项目测试命令 # 自动化测试
|
|
17
17
|
项目类型检查命令 # 前端类型检查/构建(涉及前端时跑)
|
|
18
18
|
node .agents/scripts/verify-wiki-consistency.mjs # 触及 wiki/ 时跑(exit 1 即先修台账再继续:跑 gen-wiki-board.mjs 补索引/看板;pre-commit 已按增量自动拦,此行用于改完即验)
|
|
19
|
-
npx agentic-flow-kit doctor # §6.5 delegations + §6.6 owned 漂移 + §6.7
|
|
19
|
+
npx agentic-flow-kit doctor # §6.5 delegations + §6.6 owned 漂移 + §6.7 跨宿主薄适配正文漂移(装户环境;漂移用 add-host <宿主> --force 刷新。包源环境 §6.7 skipped)
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
> **环境注记**:本地服务占用构建产物导致编译失败、多会话并行时「谁跑静态门 / 提交谁先停服务」等约定——如有,见项目注记 `.agents/notes/runtime-env.md` §2,跑静态门前先过一眼。
|
|
@@ -16,10 +16,11 @@ description: Design 阶段 · 起 spec(L2/L3 强制,L1 可省略直接进 wf
|
|
|
16
16
|
## 1. 执行
|
|
17
17
|
|
|
18
18
|
1. 确认同名入口文档已批准:新需求为 approved intent,修复为已确认的 incident 草稿;否则拒绝,分别回 `plan.md` / `maintain.md`(2026-09-30 起机器强制:fill-spec / confirm-doc 对前置未过直接拒绝 exit 2、不落盘不记账)。
|
|
19
|
-
2. 级别判断(对照 AGENTS.md 第 3
|
|
20
|
-
- **L1
|
|
21
|
-
- **L2
|
|
22
|
-
- **L3
|
|
19
|
+
2. 级别判断(对照 AGENTS.md 第 3 条;判据单源 = `.agents/scripts/level-criteria.mjs`,**本文件只承载流程映射,不复述判据闭集**):
|
|
20
|
+
- **L1**(未命中 L2/L3)→ 快车道:省略 spec,直接跳 `next: build.md` 起草 Quick-Plan
|
|
21
|
+
- **L2**(触达面闭集见单源 `L2_SURFACES`)→ 必须有 spec
|
|
22
|
+
- **L3**(结构面闭集见单源 `L3_SURFACES`)→ 必须有 spec + **新会话独立复核**
|
|
23
|
+
- 判哪一档:逐条对照单源的 `L2_SURFACES` / `L3_SURFACES` / `L1_NEGATIVES`,不要凭记忆——判据只读单源一处
|
|
23
24
|
3. 起草 spec:
|
|
24
25
|
- **填空工具先跑**:`node .agents/scripts/fill-spec.mjs --level <L1|L2|L3> --topic <主题> --output workflow/specs/<date>-<主题>.md`——输出含 frontmatter 5 字段 + 5 节正文(功能行为/数据流/系统改动/约束遵守映射/风险评估)的草稿;AI 据此填实
|
|
25
26
|
- 复制 `workflow/specs/_TEMPLATE.md` → `workflow/specs/YYYY-MM-DD-<主题>.md`(与入口文档同名)
|
|
@@ -21,7 +21,21 @@ description: 闭环总入口 · 路由判断(新需求 → wf-plan / 修复
|
|
|
21
21
|
|
|
22
22
|
## 2. 风险定级(第 0 步,先定级再路由)
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
**第 0 步先取机器面下界(必跑,不是可选提示)**:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
flow-kit route --files <预计改动面…> --kind require|fix|verify|review|deploy
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **不给 `--files` 就拿不到路径下限**——机器面此时只能按 L1 起步并在降级栏点名,等于白跑;
|
|
31
|
+
故定级前先把**预计改动面**列出来(不必精确到最终 diff,给到目录/文件前缀即可)。
|
|
32
|
+
- 跑完**再**按 §4 逐条语义判级:机器只给「就高不就低 + 路径下限」,「一处定义、多处消费」仍要你判。
|
|
33
|
+
- **确实跳过**时必须写明理由(入口文档备注或当场告知用户)——判低的后果由两道门兜:
|
|
34
|
+
起草面 `check-lane-surface` 命中路径下限无合格入口即拦,提交面同门再拦一次。
|
|
35
|
+
**诚实边界**:机器**无法**发现你没跑 route——定级发生在改动面确定之前,没有可比对的记录面,
|
|
36
|
+
详见 [ARCHITECTURE §5](../ARCHITECTURE.md) 与 CHANGELOG 1.7.16 B3 条。
|
|
37
|
+
|
|
38
|
+
动工前按下表定风险级 L0-L3(就高不就低;判据细则见下节「级别判断」),级别即风险级,决定走哪条泳道——确认放事前,还是审计补事后:
|
|
25
39
|
|
|
26
40
|
| 泳道 | 级别 | 确认与审计口径 |
|
|
27
41
|
|------|------|---------------|
|
|
@@ -34,6 +48,10 @@ description: 闭环总入口 · 路由判断(新需求 → wf-plan / 修复
|
|
|
34
48
|
|
|
35
49
|
## 3. 路由判断
|
|
36
50
|
|
|
51
|
+
<!-- route-kinds: require=plan.md | fix=maintain.md | verify=test.md | review=review.md | deploy=deploy.md -->
|
|
52
|
+
<!-- ↑ 本行是 kind→入口指令的**机器单源**:`flow-kit route` 读它得出「该读哪个 md」,不再在包内自带一份映射。
|
|
53
|
+
增删 kind 或改入口文件名只改这一行(判据单源 level-criteria.mjs 的纪律同源)。 -->
|
|
54
|
+
|
|
37
55
|
- **自动化驱动(并列入口,可选)**:一句话全程走 [pipeline-run.md](pipeline-run.md)——状态机驱动+工单协议+原话代录,与下述手动路由二选一,同一任务不混用
|
|
38
56
|
- **新需求 / 功能**:从 `plan.md` 进,立 **intent**(`workflow/intents/`)
|
|
39
57
|
- **修复类任务 / 事故**:从 `maintain.md` 进,立 **incident**(`workflow/incidents/`);incident 在 L1+ 即 **intent 等价物**(check-loop 认 incident≡intent),不必另立 intent。先检索同类历史(`node .agents/scripts/kb-search.mjs "<关键词>" --scope workflow --type incidents,plans`),有同类先读其历史三件套;再按级别走:
|
|
@@ -46,28 +64,31 @@ description: 闭环总入口 · 路由判断(新需求 → wf-plan / 修复
|
|
|
46
64
|
|
|
47
65
|
## 4. 级别判断(AGENTS.md 第 3 条)
|
|
48
66
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
>
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
1. **编码权威**:项目内「一处生成、多处消费」的编码 / 命名 / 取号规则(编码模板、序列发生器、命名空间与去重约束——具体清单按项目 AGENTS.md)
|
|
61
|
-
2. **共享契约**:跨模块共享的基类 / DTO 形状、跨模块公共接口签名
|
|
62
|
-
3. **既有接口语义**:既有参数或端点的行为变化(由失效变生效、默认值或钳制口径改变)
|
|
63
|
-
4. **全局横切口径**:错误响应出口、分页与校验口径、聚合投影键
|
|
67
|
+
> **判据单源 = [`.agents/scripts/level-criteria.mjs`](../scripts/level-criteria.mjs)**,本节**不复述判据**。
|
|
68
|
+
> 要看判据全文,或要机器可判的部分(路径下限 / 就高不就低 / 混档取高),直接:
|
|
69
|
+
>
|
|
70
|
+
> ```bash
|
|
71
|
+
> flow-kit route --files <改动文件…> # 定级 + 下一阶段 + 该读哪个 md
|
|
72
|
+
> ```
|
|
73
|
+
>
|
|
74
|
+
> 单源导出:`LEVELS` `LEVEL_MEANING`(档位语义) / `L2_SURFACES`(四类触达面闭集) / `L3_SURFACES`(结构面) /
|
|
75
|
+
> `L1_NEGATIVES`(判低红线) / `SELF_CHECK`(自查句) / `assessLevel` `hintLevelFor` `parseLevelHints` `routeAdvice`。
|
|
76
|
+
>
|
|
77
|
+
> 路径下限清单(装户 owned,默认空):`.agents/level-hints.txt`,每行 `L2 <ERE>` / `L3 <ERE>`,登记「哪些路径一碰就至少是此档」。
|
|
64
78
|
|
|
65
|
-
|
|
66
|
-
> **自查句**:能否列出 ≥2 个受影响的消费方(模块 / 端点 / 页面)?能 → L2。
|
|
67
|
-
> 先例:本仓 `workflow/specs/`、`workflow/intents/` 下同类历史(kb 检索主题词)。
|
|
79
|
+
**本表只承载流程**(「改什么」判据以单源为准,别在本表增删判据):
|
|
68
80
|
|
|
69
|
-
|
|
70
|
-
|
|
81
|
+
| 级别 | 单源语义(摘要) | 流程 |
|
|
82
|
+
|------|-----------------|------|
|
|
83
|
+
| L0 | 文档/样式微调(无行为影响) | 直接 commit,豁免 intent |
|
|
84
|
+
| L1 | 实现级改动(未命中 L2/L3) | 快车道:液态草稿(.zcode/drafts) → 实现 → 固化(`solidify-task.mjs`)——用户确认后带 `--delegated "<原话>"` 执行;无确认来源只迁移不落账 |
|
|
85
|
+
| L2 | 规则 / 契约(一处改、多处依赖) | 入口文档(intent / incident) + spec + plan 三件套 |
|
|
86
|
+
| L3 | 数据与运行时结构(结构面闭集见单源 `L3_SURFACES`) | 同 L2 + spec 新会话独立复核 |
|
|
87
|
+
|
|
88
|
+
> 混合改动按最高档定级(就高不就低);**L1 是默认档**——判级只回答「是否命中单源 `L2_SURFACES` 或
|
|
89
|
+
> `L3_SURFACES`」,负例(`L1_NEGATIVES`)命中即不得升档;自查句:`SELF_CHECK`。
|
|
90
|
+
> 机器兜得住的只有「就高不就低」与路径下限;「一处定义、多处消费」是**语义**判定,由你按单源逐条判,
|
|
91
|
+
> 漏判由 lane-surface 触达面门在提交面兜。先例:`workflow/specs/`、`workflow/intents/` 下同类历史(kb 检索主题词)。
|
|
71
92
|
|
|
72
93
|
## 5. intent 豁免(避免小改动也走完整闭环)
|
|
73
94
|
|
|
@@ -33,7 +33,7 @@ description: Review · 代码评审(横切,合入前使用;P0/P1/P2 分级
|
|
|
33
33
|
- **Create/Update 校验同口径**:Create 已有校验 Update 必须同口径;被引用的标识符字段禁改
|
|
34
34
|
- **查询分页与状态语义**:分页参数范围校验 + 服务层钳制;非法状态与不存在分离(按项目统一错误口径,如 400 / 404)
|
|
35
35
|
- **spec 承诺的断言落地**:spec §测试列出的用例 / 断言须真落到测试或验证脚本;「写进 spec」不等于「跑得起来」,且常驻断言禁写成随时间增长的行数常量
|
|
36
|
-
-
|
|
36
|
+
- **跨宿主薄适配正文漂移**:包源仓改 `templates/_agents/{commands,roles}/*.md` 后跑 `flow-kit sync-hosts --apply`,单向同步 `modules/hosts/<h>/{agents,commands}/*.md`。装户由 `flow-kit doctor` §6.7 检查(包源环境跳过);装户刷新宿主文件用 `flow-kit add-host <宿主> --force`(`sync` 不更新宿主适配,`sync-hosts` 不在装户根运行)
|
|
37
37
|
|
|
38
38
|
## 3. P2 建议(提醒,不拦合入)
|
|
39
39
|
|
|
@@ -7,27 +7,22 @@ description: 跨宿主适配层同步(正文段 sha 比对 + 用户拍板 +
|
|
|
7
7
|
|
|
8
8
|
# Sync-Hosts · 跨宿主适配层正文段同步
|
|
9
9
|
|
|
10
|
-
>
|
|
11
|
-
>
|
|
12
|
-
> `flow-kit sync-hosts --apply`——2026-10-07 起按**目标根**自动判布局(含 `templates/_agents` + `modules/hosts` → 包源:
|
|
13
|
-
> 比 `templates/_agents` ↔ `modules/hosts/<宿主键>/`;含 `.agents` → 装户:比 `.agents` ↔ 项目根下 `<宿主点目录>/`),
|
|
14
|
-
> 目标根取 `--dir <目录>` > 当前目录。
|
|
10
|
+
> 本命令只在包源仓运行(需要 `templates/_agents` 与 `modules/hosts`)。改权威源(`templates/_agents/{commands,roles}/*.md`)后薄适配(`modules/hosts/<h>/{agents,commands}/*.md`)要同步——薄适配正文 = 权威源正文,frontmatter 各自保留宿主特化(commands 层文件名 = 宿主命令名,opencode / trae 同用 `wf-` 前缀,单源见 `src/profiles.mjs#HOSTS.commandPrefix`;trae 另有 `name: wf-X`,zcode/omp 各自原描述)。
|
|
11
|
+
> 装户的宿主文件由 `init` / `add-host` 写入。装户漂移由 `flow-kit doctor` §6.7 报告(包源环境跳过);刷新用 `flow-kit add-host <宿主> --force`。`flow-kit sync` 不更新宿主适配。
|
|
15
12
|
|
|
16
13
|
## 1. 何时跑
|
|
17
14
|
|
|
18
15
|
- 改 `templates/_agents/commands/*.md` 正文后(11 个 commands 文件)
|
|
19
16
|
- 改 `templates/_agents/roles/*.md` 正文后(3 个 roles 文件)
|
|
20
|
-
-
|
|
21
|
-
- 不跑:仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
17
|
+
- 不跑:装户仓(本命令会拒绝);仅改 frontmatter;改 trae 钩子/规则;改包源其他文件
|
|
22
18
|
|
|
23
19
|
## 2. 怎么跑
|
|
24
20
|
|
|
25
21
|
### 2.1 默认 `--diff`(仅报告)
|
|
26
22
|
|
|
27
23
|
```
|
|
28
|
-
node bin/flow-kit.mjs sync-hosts --diff #
|
|
24
|
+
node bin/flow-kit.mjs sync-hosts --diff # 包源仓(在包源根跑,或 --dir <包源根>)
|
|
29
25
|
node bin/flow-kit.mjs sync-hosts --json # 机器可读
|
|
30
|
-
flow-kit sync-hosts --diff # 装户仓(在装户根跑;或用 --dir <项目根> 指定)
|
|
31
26
|
```
|
|
32
27
|
|
|
33
28
|
输出三类:
|
|
@@ -47,9 +42,8 @@ node bin/flow-kit.mjs sync-hosts --apply
|
|
|
47
42
|
### 2.3 自验
|
|
48
43
|
|
|
49
44
|
```
|
|
50
|
-
npm test # 含 sync-hosts.test.mjs
|
|
51
|
-
node bin/flow-kit.mjs doctor #
|
|
52
|
-
sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已探测分流
|
|
45
|
+
npm test # 含 sync-hosts.test.mjs
|
|
46
|
+
node bin/flow-kit.mjs doctor # 包源环境 §6.7 skipped
|
|
53
47
|
```
|
|
54
48
|
|
|
55
49
|
## 3. 边界(不要做)
|
|
@@ -64,7 +58,7 @@ sh .agents/scripts/check-loop.sh # Windows 无 sh 时 doctor 已
|
|
|
64
58
|
|
|
65
59
|
- trae 钩子(`modules/hosts/trae/hooks/*.cjs`)— 独立演进的工程件
|
|
66
60
|
- trae 规则(`modules/hosts/trae/rules/*.md`)— 同上
|
|
67
|
-
-
|
|
61
|
+
- 门禁脚本与钩子(`templates/_agents/scripts`、`templates/_githooks`)— 由 `flow-kit sync` 按 managed 台账下发,不走 sync-hosts
|
|
68
62
|
|
|
69
63
|
## 5. 相关留痕
|
|
70
64
|
|
|
@@ -17,7 +17,7 @@ description: Test 阶段 · 静态门 + 切库冒烟 + UI 实测 + L2/L3 独立
|
|
|
17
17
|
项目测试命令 # 自动化测试
|
|
18
18
|
项目类型检查命令 # 前端类型检查/构建(涉及前端时跑)
|
|
19
19
|
node .agents/scripts/verify-wiki-consistency.mjs # 触及 wiki/ 时跑(exit 1 即先修台账再继续:跑 gen-wiki-board.mjs 补索引/看板;pre-commit 已按增量自动拦,此行用于改完即验)
|
|
20
|
-
npx agentic-flow-kit doctor # §6.5 delegations + §6.6 owned 漂移 + §6.7
|
|
20
|
+
npx agentic-flow-kit doctor # §6.5 delegations + §6.6 owned 漂移 + §6.7 跨宿主薄适配正文漂移(装户环境;漂移用 add-host <宿主> --force 刷新。包源环境 §6.7 skipped)
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
> **环境注记**:本地服务占用构建产物导致编译失败、多会话并行时「谁跑静态门 / 提交谁先停服务」等约定——如有,见项目注记 `.agents/notes/runtime-env.md` §2,跑静态门前先过一眼。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow-kit",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.16",
|
|
4
4
|
"description": "AI-Native 闭环工作流 + wiki 知识层脚手架——flow-kit init 一条命令为新项目装好 .agents 工作流引擎(阶段命令/角色契约/门禁钩子/kb 检索/看板/规则面预算)+ workflow 文档闭环 + wiki 知识库,装完本地可跑、零运行时依赖",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
package/src/cli.mjs
CHANGED
|
@@ -7,6 +7,7 @@ import { sync } from './sync.mjs';
|
|
|
7
7
|
import { syncHosts } from './sync-hosts.mjs';
|
|
8
8
|
import { addHost } from './add-host.mjs';
|
|
9
9
|
import { addGate } from './add-gate.mjs';
|
|
10
|
+
import { route, runPipeline } from './executor.mjs';
|
|
10
11
|
import { existsSync, readFileSync, readdirSync } from 'node:fs';
|
|
11
12
|
import { fileURLToPath } from 'node:url';
|
|
12
13
|
import path from 'node:path';
|
|
@@ -38,6 +39,7 @@ export const HELP = `flow-kit — AI-Native 闭环工作流 + wiki 知识层脚
|
|
|
38
39
|
flow-kit sync-hosts 跨宿主适配层同步:templates/_agents/{commands,roles}/*.md 权威源 vs
|
|
39
40
|
modules/hosts/<h>/{agents,commands}/*.md 薄适配——默认 --diff 输出报告;
|
|
40
41
|
--apply 单向同步(权威→薄适配,不反向避免污染);
|
|
42
|
+
--strict 漂移判红(CI 机器门用;默认 --diff 恒 exit 0,报告器语义);
|
|
41
43
|
改一处权威源要同步 N 份薄适配,人工 grep 易漏
|
|
42
44
|
flow-kit doctor 体检:目录布局 / git 钩子 / managed 清单 / 索引漂移 / 跨宿主漂移 / check-loop
|
|
43
45
|
flow-kit validate 只读校验:包内置 check-loop 引擎对装户盘面跑闭环 20 项检查(不执行装户侧脚本,
|
|
@@ -45,6 +47,22 @@ export const HELP = `flow-kit — AI-Native 闭环工作流 + wiki 知识层脚
|
|
|
45
47
|
与 doctor 的分工:doctor 查「装得健不健康」(含装户侧引擎校验后执行),
|
|
46
48
|
validate 查「盘面内容合不合规」(判定引擎随包版本走)
|
|
47
49
|
|
|
50
|
+
── 执行面(引擎执行器:手动路由 + 自动流水线)─────────────────────────
|
|
51
|
+
md 指令与 md 子代理仍装在装户项目(.agents/commands、.agents/roles),
|
|
52
|
+
宿主读它们;本 CLI 不复制、不改写它们的正文。执行代码亦留在装户
|
|
53
|
+
.agents/scripts/,包只做薄壳转发与判定面。
|
|
54
|
+
flow-kit route 手动路由的机器面:定级(就高不就低 + 路径下限)+ 判据清单 + 泳道 + 下一阶段
|
|
55
|
+
+ 该读的 md 指令路径。判据单源 = .agents/scripts/level-criteria.mjs;
|
|
56
|
+
路径下限清单 = .agents/level-hints.txt(装户自持、内容项目私有,默认空)。
|
|
57
|
+
**诚实边界**:级别是意图面的语义判定(「一处定义、多处消费」),机器判不了语义;
|
|
58
|
+
未配 hints 时按 L1 起步并提示补配置,绝不假装判得出。
|
|
59
|
+
选项:--kind require|fix|verify|review|deploy | --level L0|L1|L2|L3
|
|
60
|
+
--files "a,b"(改动文件,参与路径下限判定)| --dir <目录> | --json
|
|
61
|
+
flow-kit run <子命令> 自动流水线:薄壳转发装户 pipeline-run 状态机
|
|
62
|
+
(start / next / status / watch / abort),参数与退出码原样透传。
|
|
63
|
+
驱动协议与停机点语义见 .agents/commands/pipeline-run.md(宿主面权威)。
|
|
64
|
+
本命令绝不 spawn AI 会话 / 不伪造原话 / 不带 --no-verify。
|
|
65
|
+
|
|
48
66
|
init 选项(全部可选,均有默认值):
|
|
49
67
|
--stack <技术栈> dotnet | node(ts/js) | python | go | none(默认 none;ts/js/typescript/javascript
|
|
50
68
|
归一为 node)——门禁配置三处:commit-check
|
|
@@ -59,8 +77,10 @@ init 选项(全部可选,均有默认值):
|
|
|
59
77
|
sync / add-host 选项:--dir <目录>、--force(覆盖本地已改 / 已装内容);add-gate 选项:--dir <目录>、--force。
|
|
60
78
|
validate 选项:--strict(advisory warning 也判红)/ --json(机器可读,stdout)/ --dir <目录>(目标项目根,默认当前目录)。
|
|
61
79
|
sync-hosts 选项:--diff(默认,仅报告,不修改)/ --apply(单向同步到薄适配)/ --json(机器可读输出)/ --dir <目录>(目标项目根,默认当前目录)。
|
|
62
|
-
sync-hosts
|
|
63
|
-
|
|
80
|
+
sync-hosts 只在包源仓运行(需要 templates/_agents 与 modules/hosts):比对 templates/_agents ↔ modules/hosts。
|
|
81
|
+
装户的宿主文件由 init / add-host 写入;刷新用 add-host <宿主> --force。
|
|
82
|
+
route 选项:--kind / --level / --files / --dir <目录>(目标项目根,默认当前目录)/ --json(机器可读)。
|
|
83
|
+
run 参数:除 --dir 外原样透传给装户 pipeline-run(--hint / --triage / --delegated / --files / --run / --json / --adopt / --to / --interval)。
|
|
64
84
|
|
|
65
85
|
示例:
|
|
66
86
|
npx agentic-flow-kit init # 交互模式:宿主 → 技术栈 → 端口 → 确认安装
|
|
@@ -72,9 +92,17 @@ sync-hosts 双布局(2026-10-07):包源仓(含 templates/_agents + modul
|
|
|
72
92
|
npx agentic-flow-kit validate --strict # 只读结构校验(CI 可用,0/1 退出码)
|
|
73
93
|
npx agentic-flow-kit sync-hosts --diff # 看权威源 vs 薄适配漂移
|
|
74
94
|
npx agentic-flow-kit sync-hosts --apply # 单向同步到薄适配
|
|
95
|
+
npx agentic-flow-kit route --kind require --level L1 --files "src/a.ts,src/b.ts"
|
|
96
|
+
npx agentic-flow-kit run start "给导入功能加审计字段"
|
|
97
|
+
npx agentic-flow-kit run next --delegated "可以"
|
|
75
98
|
|
|
76
99
|
装完本地可跑:日常闭环走项目内 .agents/scripts/(零 npm 运行时依赖);升级 / 体检 / 装门禁用 npx agentic-flow-kit(sync / doctor / add-host / add-gate);AGENTS.md 生成「AI工作流 + Wiki」骨架,项目细节在「项目适配区」自填。`;
|
|
77
100
|
|
|
101
|
+
// errText:异步命令失败的统一输出。带 code 的错误把 code 一并打出来——
|
|
102
|
+
// 例:flow-kit route 遇非法 level-hints 会抛 e.code = LEVEL_HINTS_INVALID,
|
|
103
|
+
// 只打 message 等于把机器可判的错误类别在 CLI 边界扔掉(路径与行号仍在 message 里)。
|
|
104
|
+
const errText = (e) => `❌ ${e?.code ? `[${e.code}] ` : ''}${e?.message || e}`;
|
|
105
|
+
|
|
78
106
|
export function run(argv) {
|
|
79
107
|
const cmd = argv[0];
|
|
80
108
|
if (!cmd || cmd === 'help' || cmd === '--help' || cmd === '-h') {
|
|
@@ -88,7 +116,7 @@ export function run(argv) {
|
|
|
88
116
|
}
|
|
89
117
|
if (cmd === 'init') {
|
|
90
118
|
init(argv.slice(1), PKG_ROOT).catch((e) => {
|
|
91
|
-
console.error(
|
|
119
|
+
console.error(errText(e));
|
|
92
120
|
process.exit(1);
|
|
93
121
|
});
|
|
94
122
|
return;
|
|
@@ -116,11 +144,22 @@ export function run(argv) {
|
|
|
116
144
|
}
|
|
117
145
|
if (cmd === 'validate') {
|
|
118
146
|
validate(argv.slice(1), PKG_ROOT).catch((e) => {
|
|
119
|
-
console.error(
|
|
147
|
+
console.error(errText(e));
|
|
148
|
+
process.exit(1);
|
|
149
|
+
});
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (cmd === 'route') {
|
|
153
|
+
route(argv.slice(1)).catch((e) => {
|
|
154
|
+
console.error(errText(e));
|
|
120
155
|
process.exit(1);
|
|
121
156
|
});
|
|
122
157
|
return;
|
|
123
158
|
}
|
|
159
|
+
if (cmd === 'run') {
|
|
160
|
+
runPipeline(argv.slice(1));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
124
163
|
console.error(`未知命令:${cmd}\n\n${HELP}`);
|
|
125
164
|
process.exit(1);
|
|
126
165
|
}
|
package/src/doctor.mjs
CHANGED
|
@@ -269,7 +269,7 @@ export function doctor(args, pkgRoot) {
|
|
|
269
269
|
} else if (adapterRes.drift === 0) {
|
|
270
270
|
add('PASS', `跨宿主薄适配 ${adapterRes.total} 对无正文漂移(装副本引擎 vs 注册表内宿主薄适配,B-b 语义)`);
|
|
271
271
|
} else {
|
|
272
|
-
add('WARN', `跨宿主薄适配正文漂移 ${adapterRes.drift}
|
|
272
|
+
add('WARN', `跨宿主薄适配正文漂移 ${adapterRes.drift} 对——权威源 .agents 与宿主薄适配正文段 sha 不一致。刷新用 flow-kit add-host <宿主> --force(flow-kit sync 不更新宿主适配;sync-hosts 只在包源仓比对 templates/_agents 与 modules/hosts)。`);
|
|
273
273
|
}
|
|
274
274
|
|
|
275
275
|
// 6.8 workflows 编排脚本 lint(stages 表解析校验:role/step/after 引用、无环、三形态互斥、数值枚举;
|
|
@@ -309,6 +309,18 @@ export function doctor(args, pkgRoot) {
|
|
|
309
309
|
add('WARN', `模板感知:源仓 ${tplRes.stale.length} 份模板自上次同步后有演进且盘面未跟随:${tplRes.stale.join('、')}——如需跟随从包源 templates/ 拷贝;有意定制可忽略(跑 flow-kit sync 刷新锚后本项静默)`);
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
// 6.10 level-hints 配置体检(2026-10-13 hint-doctor)——非法档位/正则此前只在**跑 flow-kit route 时**
|
|
313
|
+
// 才抛 LEVEL_HINTS_INVALID,而 route 是可选调用 → 写错的清单能静默存活很久。写错配置比没配置危险:
|
|
314
|
+
// 没配置会提示补,写错会误判档位。故给一条主动体检通道。
|
|
315
|
+
// 口径纪律:doctor 不复刻解析器(复刻=判据双源漂移),spawn 装户 level-criteria.mjs 的 --check
|
|
316
|
+
// 入口(判据单源仍是 parseLevelHints 一份)。
|
|
317
|
+
{
|
|
318
|
+
const hr = checkLevelHints(target);
|
|
319
|
+
if (hr.skipped) add('PASS', `level-hints 体检跳过(${hr.note})`);
|
|
320
|
+
else if (hr.ok) add('PASS', `level-hints 配置合法(${hr.note})`);
|
|
321
|
+
else add('FAIL', `level-hints 配置有误——非法档位或正则会让 flow-kit route fail-loud 抛错、按错误下限定级:\n${hr.detail}`);
|
|
322
|
+
}
|
|
323
|
+
|
|
312
324
|
// 7. check-loop——2026-09-26 check-loop-node 起 node 实现直跑(sh 版曾需先探 sh 可用性:Windows
|
|
313
325
|
// PowerShell 常无 sh,ENOENT 曾被吞进 hard-block 分支报成空原因假警报,incident 2026-09-24-doctor-sh-enoent;
|
|
314
326
|
// 迁移后无 sh 依赖,探针退役。check-loop.sh 为兼容 shim,pre-push 钩子路径照常)
|
|
@@ -337,6 +349,30 @@ export function doctor(args, pkgRoot) {
|
|
|
337
349
|
});
|
|
338
350
|
}
|
|
339
351
|
|
|
352
|
+
// checkLevelHints(2026-10-13 hint-doctor):.agents/level-hints.txt 的**主动**体检。
|
|
353
|
+
// 为什么不能靠 route:非法档位/ERE 此前只在跑 flow-kit route 时才抛 LEVEL_HINTS_INVALID,
|
|
354
|
+
// 而 route 是可选调用 → 写错的清单能静默存活很久,直到某次碰巧路由才炸(写错配置比没配置危险)。
|
|
355
|
+
// 口径纪律:doctor **不复刻解析器**(复刻=判据双源漂移),改为 spawn 装户 .agents/scripts/
|
|
356
|
+
// level-criteria.mjs 的 --check 入口——parseLevelHints 永远只有一份实现。
|
|
357
|
+
// 三态:skipped(无判据单源=1.7.15 前旧装户,不产出告警)/ ok(含未配置=默认空)/ 配置有误。
|
|
358
|
+
export function checkLevelHints(target) {
|
|
359
|
+
const script = path.join(target, '.agents', 'scripts', 'level-criteria.mjs');
|
|
360
|
+
if (!fs.existsSync(script)) return { skipped: true, ok: true, note: '无 .agents/scripts/level-criteria.mjs——1.7.15 之前版本无此判据单源' };
|
|
361
|
+
const r = spawnSync(process.execPath, [script, '--check', path.join(target, '.agents', 'level-hints.txt')], {
|
|
362
|
+
cwd: target, encoding: 'utf8',
|
|
363
|
+
});
|
|
364
|
+
// spawn 本身失败(ENOENT/EACCES/超时被杀)时 status 为 null 且 stderr 可能为空——
|
|
365
|
+
// 不区分会把「体检脚本跑不起来」误报成「配置有误」,排障方向直接被带偏(2026-10-13 executor-review)。
|
|
366
|
+
if (r.error) return { skipped: false, ok: false, detail: `无法执行体检脚本 ${path.basename(script)}:${r.error.message}` };
|
|
367
|
+
if (r.status === 0) return { skipped: false, ok: true, note: String(r.stdout || '').trim() || '通过' };
|
|
368
|
+
if (r.status === null) return { skipped: false, ok: false, detail: `体检脚本异常终止(无退出码,signal=${r.signal || '未知'})——无法判定 level-hints 是否合法` };
|
|
369
|
+
return {
|
|
370
|
+
skipped: false,
|
|
371
|
+
ok: false,
|
|
372
|
+
detail: String(r.stderr || '').split('\n').slice(0, 6).join('\n').trim(),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
340
376
|
function print(results) {
|
|
341
377
|
const icon = { PASS: '✅', WARN: '⚠️ ', FAIL: '❌' };
|
|
342
378
|
for (const r of results) console.log(`${icon[r.level]} ${r.msg}`);
|