agentic-flow-kit 1.7.0 → 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 +81 -9
- package/modules/gates/README.md +1 -0
- package/modules/gates/test-protect/README.md +23 -0
- package/modules/gates/test-protect/check-test-protect.mjs +64 -0
- package/modules/gates/test-protect/local-pre-commit.line +1 -0
- package/modules/hosts/README.md +57 -0
- package/modules/hosts/claude/commands/wf-build.md +5 -24
- package/modules/hosts/claude/commands/wf-deploy.md +1 -0
- package/modules/hosts/claude/commands/wf-design.md +7 -6
- package/modules/hosts/claude/commands/wf-gate-checklist.md +1 -3
- package/modules/hosts/claude/commands/wf-new-task.md +42 -21
- package/modules/hosts/claude/commands/wf-plan.md +1 -1
- package/modules/hosts/claude/commands/wf-review.md +1 -1
- package/modules/hosts/claude/commands/wf-sync-hosts.md +8 -16
- package/modules/hosts/claude/commands/wf-test.md +5 -4
- package/modules/hosts/codex/commands/wf-build.md +5 -24
- package/modules/hosts/codex/commands/wf-deploy.md +1 -0
- package/modules/hosts/codex/commands/wf-design.md +7 -6
- package/modules/hosts/codex/commands/wf-gate-checklist.md +1 -3
- package/modules/hosts/codex/commands/wf-new-task.md +42 -21
- package/modules/hosts/codex/commands/wf-plan.md +1 -1
- package/modules/hosts/codex/commands/wf-review.md +1 -1
- package/modules/hosts/codex/commands/wf-sync-hosts.md +8 -16
- package/modules/hosts/codex/commands/wf-test.md +5 -4
- package/modules/hosts/cursor/commands/wf-build.md +5 -24
- package/modules/hosts/cursor/commands/wf-deploy.md +1 -0
- package/modules/hosts/cursor/commands/wf-design.md +7 -6
- package/modules/hosts/cursor/commands/wf-gate-checklist.md +1 -3
- package/modules/hosts/cursor/commands/wf-new-task.md +42 -21
- package/modules/hosts/cursor/commands/wf-plan.md +1 -1
- package/modules/hosts/cursor/commands/wf-review.md +1 -1
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +8 -16
- package/modules/hosts/cursor/commands/wf-test.md +5 -4
- package/modules/hosts/opencode/commands/wf-build.md +5 -24
- package/modules/hosts/opencode/commands/wf-deploy.md +1 -0
- package/modules/hosts/opencode/commands/wf-design.md +7 -6
- package/modules/hosts/opencode/commands/wf-gate-checklist.md +1 -3
- package/modules/hosts/opencode/commands/wf-new-task.md +42 -21
- package/modules/hosts/opencode/commands/wf-plan.md +1 -1
- package/modules/hosts/opencode/commands/wf-review.md +1 -1
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +8 -16
- package/modules/hosts/opencode/commands/wf-test.md +5 -4
- package/modules/hosts/trae/commands/wf-build.md +5 -24
- package/modules/hosts/trae/commands/wf-deploy.md +1 -0
- package/modules/hosts/trae/commands/wf-design.md +7 -6
- package/modules/hosts/trae/commands/wf-gate-checklist.md +1 -3
- package/modules/hosts/trae/commands/wf-new-task.md +42 -21
- package/modules/hosts/trae/commands/wf-plan.md +1 -1
- package/modules/hosts/trae/commands/wf-review.md +1 -1
- package/modules/hosts/trae/commands/wf-sync-hosts.md +8 -16
- package/modules/hosts/trae/commands/wf-test.md +5 -4
- package/package.json +2 -2
- package/src/add-gate.mjs +25 -1
- package/src/add-gate.test.mjs +103 -0
- package/src/cli.mjs +59 -5
- package/src/doctor.mjs +136 -12
- package/src/executor.mjs +245 -0
- package/src/executor.test.mjs +292 -0
- package/src/gates.test.mjs +17 -0
- package/src/init.mjs +14 -1
- package/src/init.test.mjs +19 -0
- package/src/instance-ref.test.mjs +62 -0
- package/src/jscpd-drift.test.mjs +144 -0
- package/src/profiles.mjs +3 -0
- package/src/render.mjs +6 -1
- package/src/rule-budget.test.mjs +103 -0
- package/src/sync-hosts.mjs +41 -45
- package/src/sync-hosts.test.mjs +67 -56
- package/src/trae-hooks.test.mjs +15 -3
- package/src/validate.mjs +72 -0
- package/src/validate.test.mjs +95 -0
- package/templates/.gitattributes +8 -0
- package/templates/AGENTS.md +2 -1
- package/templates/_agents/commands/build.md +5 -24
- package/templates/_agents/commands/deploy.md +1 -0
- package/templates/_agents/commands/design.md +7 -6
- package/templates/_agents/commands/gate-checklist.md +1 -3
- package/templates/_agents/commands/new-task.md +42 -21
- package/templates/_agents/commands/plan.md +1 -1
- package/templates/_agents/commands/review.md +1 -1
- package/templates/_agents/commands/sync-hosts.md +8 -16
- package/templates/_agents/commands/test.md +5 -4
- package/templates/_agents/control-surfaces.txt +53 -0
- 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.cjs +51 -6
- package/templates/_agents/scripts/agg-delegations.test.mjs +84 -4
- package/templates/_agents/scripts/check-engine-integrity.mjs +217 -0
- package/templates/_agents/scripts/check-engine-integrity.test.mjs +215 -0
- package/templates/_agents/scripts/check-lane-surface.mjs +78 -24
- 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 +255 -45
- package/templates/_agents/scripts/check-loop.test.mjs +330 -15
- 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 +54 -12
- package/templates/_agents/scripts/confirm-doc.test.mjs +59 -0
- package/templates/_agents/scripts/doctor.test.mjs +294 -1
- package/templates/_agents/scripts/draft-sediment.mjs +178 -0
- package/templates/_agents/scripts/draft-sediment.test.mjs +272 -0
- 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 +6 -3
- package/templates/_agents/scripts/gate-checklist.test.mjs +2 -5
- package/templates/_agents/scripts/gen-wiki-board.mjs +61 -6
- package/templates/_agents/scripts/gen-wiki-board.test.mjs +74 -1
- package/templates/_agents/scripts/gen-workflow-dashboard.mjs +10 -13
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +12 -30
- 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/kb-search.mjs +87 -12
- package/templates/_agents/scripts/kb-search.test.mjs +83 -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 +5 -3
- package/templates/_agents/scripts/policy.mjs +47 -0
- package/templates/_agents/scripts/solidify-task.mjs +1 -1
- package/templates/_agents/scripts/stage-gates.mjs +52 -10
- package/templates/_agents/scripts/stage-gates.test.mjs +105 -0
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +34 -0
- package/templates/_agents/scripts/verify-wiki-consistency.test.mjs +44 -2
- package/templates/_agents/scripts/verify.mjs +1 -1
- 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/scripts-test-exempt.txt +3 -1
- package/templates/_agents/skills/wiki/SKILL.md +5 -3
- 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/wiki/INDEX.md +44 -1
- package/templates/wiki//347/237/245/350/257/206/346/262/211/346/267/200/346/200/273/350/247/210.html +22 -1
- package/templates/workflow/README.md +11 -0
- package/templates/workflow/delegations.md +5 -4
- package/templates/workflow/incidents/_TEMPLATE.md +2 -0
- package/templates/workflow/intents/_TEMPLATE.md +3 -0
- package/templates/workflow/plans/_TEMPLATE.md +4 -0
- package/templates/workflow/specs/_TEMPLATE.md +23 -0
- package/modules/hosts/claude/commands/wf-source-sync-check.md +0 -91
- package/modules/hosts/codex/commands/wf-source-sync-check.md +0 -91
- package/modules/hosts/cursor/commands/wf-source-sync-check.md +0 -91
- package/modules/hosts/opencode/commands/wf-source-sync-check.md +0 -91
- package/modules/hosts/trae/commands/wf-source-sync-check.md +0 -92
- package/templates/_agents/commands/source-sync-check.md +0 -105
- package/templates/_agents/scripts/check-ledger.mjs +0 -109
- package/templates/_agents/scripts/check-ledger.test.mjs +0 -197
- package/templates/_agents/scripts/source-sync-check.mjs +0 -156
- package/templates/_agents/scripts/source-sync-check.test.mjs +0 -281
- package/templates/_agents/workflows/source-sync-repair.md +0 -30
|
@@ -54,6 +54,17 @@
|
|
|
54
54
|
4. **敏感信息**:pre-commit 的 commit-check 扫描密钥。
|
|
55
55
|
5. **双源与台账**:doctor 核对 managed / owned 的 sha;引擎改动改包源 `templates/` 再 `sync`。
|
|
56
56
|
6. **台账不可变**(2026-10-02 ledger-ci-invariant):`confirmations.jsonl` 历史行禁删改(append-only 前缀不变量,机器门 = CI 历史全扫 + pre-commit `--staged` 前置);误写/修正只能**追加补偿行**,篡改历史属审计事件(`git revert` 整个提交后重新追加)。
|
|
57
|
+
7. **台账并发三形态与修剪通道**(2026-10-12,台账是尾部追加形态,撞三种正常协作):
|
|
58
|
+
|
|
59
|
+
| 形态 | 机制 | 用法 |
|
|
60
|
+
|---|---|---|
|
|
61
|
+
| 多人/多分支合并冲突 | `.gitattributes` 的 `.agents/*.jsonl merge=jsonl-union` → `git-merge-jsonl.mjs` 并集去重(两侧行全保留,无冲突可解) | 需目标仓 `.gitattributes` 有该行 + 本机 `git config merge.jsonl-union.driver "node .agents/scripts/git-merge-jsonl.mjs %O %A %B"`(`init` 自动配) |
|
|
62
|
+
| 单机多 worktree 并行 append | `confirm-doc --shard` 写 `.agents/confirmations.d/<doc>.jsonl`,各写各的互不覆盖;里程碑跑 `compact-ledgers.mjs [--execute]` 并回主台账 | `--shard` **依赖 doc 链口径**(`kit.json` 须 `policyVersion: 8`+),缺锚时参数期直接拒 |
|
|
63
|
+
| 所有者明令删某批文档 | **特许修剪**:同笔提交 `.agents/ledger-prune-manifest.json`(`{ts, authority, reason, removes:[被删行 sha256], docs:[家族名]}`),门禁逐行对账放行 | 无 manifest 的删/改/重排**仍全拦** |
|
|
64
|
+
|
|
65
|
+
哈希链的域是「同一 doc 的逻辑序」而非文件物理序——并发 append / 并集合并 / 分片归并都不会打断它;就地改行、删行、插行三类篡改照拦。诚实边界:manifest 是可写文件,**刻意伪造即可让任意删行合法化**(与「台账本地可写」同级),本通道只把「顺手手改」抬到「提交一份可被 git 历史对质的凭据」。
|
|
66
|
+
|
|
67
|
+
> **存量装户迁移动作**:`merge=jsonl-union` 属 `.gitattributes`,而该文件是**项目自持(owned)**、`sync` 永不覆盖——升级后**不会自动获得**,需手动在目标仓 `.gitattributes` 补一行 `.agents/*.jsonl merge=jsonl-union`。driver 是本机态配置、不跨机共享(漏配退化为文本冲突,不静默丢数据但要人工解)。
|
|
57
68
|
|
|
58
69
|
其余检查(占位符、引用、模块字段、常驻面预算、量化签名、阶段索引、适配器断线、引擎脚本测试覆盖(检查 20,包源环境——新增引擎脚本默认必须带 `.test.mjs`,库件/工具须登记 `.agents/scripts-test-exempt.txt`,2026-10-01 gate-script-test-coverage))只在 `audit` 不是 `false` 时出警告。
|
|
59
70
|
|
|
@@ -5,19 +5,20 @@
|
|
|
5
5
|
> - **委派结果表**:每次向子智能体/执行模型委派后追加一行。
|
|
6
6
|
> - **自做任务结果表**:主智能体自己完成的 **L1+ 新需求任务**,闭环时(intent→done)追加一行;**修复类不重复记**——incident 本身即故障信号,聚合脚本按月扫 `workflow/incidents/` 计数。
|
|
7
7
|
> - 结果列取值:`一次通过`(静态门首跑全过且复核无 P0/P1 返工)/ `返工×N`(回炉 N 次)/ `主兜底`(executor 失败、主智能体接手——委派口径专用,计返工信号)/ `返工待修`(未闭环,不计入率,单列提示)。
|
|
8
|
+
> - **合入结论列**(末列,2026-10-12 merge-accept-rate):`合入` / `返工后合入` / `未合入` / 留空。为什么单列而不并进结果列:结果列度量**执行过程质量**(跑了几遍),合入结论度量**产出被不被人接受**——METR 2026-03 实测落差(agent 生成的 SWE-bench 通过 PR,维护者合并判定比自动评分低约 24 个百分点、约一半不会被合入)说明「自动门全绿」与「人愿意合」是两个维度,混在一列必然被前者盖过后者。记法:关单时顺手一写;留空 = 未记录(**不计入接受率分母**,存量行零回填)。边界:结论由人工/独立复核写入,机器无法判真伪(同 `--delegated` 信任边界);它是**观测项不是门槛项**——不进 §并发扩容门槛(样本 <5 不出率)。对标:<https://metr.org/notes/2026-03-10-many-swe-bench-passing-prs-would-not-be-merged-into-main/>
|
|
8
9
|
> 聚合:`node .agents/scripts/agg-delegations.cjs` → 输出各月指标 + 扩容门判定 + 可粘贴快照行,粘贴进 §月度聚合快照(每月一行)。聚合时顺路按「三类清理清单」巡检 AGENTS.md:代码/配置已可推导的删;只针对一次需求的细节移 wiki 或删;已被脚本/hook/测试自动保证的只留入口。
|
|
9
10
|
> 口径说明:合并冲突率不适用(单人串行 + 每阶段确认);人工复核负担以「复核类委派的返工行」近似(见结果列 + 备注)。
|
|
10
11
|
> 调整某角色的模型指派前,先从 `workflow/incidents/` 取 3 个已定性 bug 丢给候选模型做回归对比,再拍板。
|
|
11
12
|
|
|
12
13
|
## 委派结果
|
|
13
14
|
|
|
14
|
-
| 日期 | 被委派方(模型) | 任务一句话 | 结果 | 备注 |
|
|
15
|
-
|
|
15
|
+
| 日期 | 被委派方(模型) | 任务一句话 | 结果 | 备注 | 合入结论 |
|
|
16
|
+
|------|----------------|------------|------|------|----------|
|
|
16
17
|
|
|
17
18
|
## 自做任务结果
|
|
18
19
|
|
|
19
|
-
| 日期 | 任务一句话 | 结果 | 备注 |
|
|
20
|
-
|
|
20
|
+
| 日期 | 任务一句话 | 结果 | 备注 | 合入结论 |
|
|
21
|
+
|------|------------|------|------|----------|
|
|
21
22
|
|
|
22
23
|
## 月度聚合快照
|
|
23
24
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
级别: L1
|
|
4
4
|
发现: YYYY-MM-DD
|
|
5
5
|
模块: <词表之一,见 .agents/workflow-modules.txt>
|
|
6
|
+
沉淀: <可选:复盘沉淀到 wiki 的相对仓根路径,如 wiki/项目规范/权限收敛方案.md;不沉淀写「无」,留空待 check-loop 提醒;关单时可跑 node .agents/scripts/draft-sediment.mjs 自动抽草稿并回写本字段>
|
|
6
7
|
---
|
|
7
8
|
# INCIDENT — <日期 主题>
|
|
8
9
|
<!-- 复制为 YYYY-MM-DD-<主题>.md;线上或实测发现的功能缺陷都记录,历史 BUG 可回填 -->
|
|
@@ -20,6 +21,7 @@
|
|
|
20
21
|
|
|
21
22
|
## 根因
|
|
22
23
|
<一句话;深层原因另起一行>
|
|
24
|
+
<!-- 复杂度收敛证据收集(P4 判据触发器,2026-10-11):根因若与重复/未收拢代码有关(改 A 处漏了同源 B 处、克隆分叉),在此写明涉及的两处位置——这是「收敛须有消费方与事故证据才启动」判据的直接采集点(证据出现再立项收拢,基线对照 scripts/jscpd-baseline.json;无关联则无视本行) -->
|
|
23
25
|
|
|
24
26
|
## 为什么之前没拦住
|
|
25
27
|
<门禁 / 测试 / 规范各查一遍:哪一层本可以拦住>
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
级别: L1
|
|
4
4
|
日期: YYYY-MM-DD
|
|
5
5
|
模块: <词表之一,见 .agents/workflow-modules.txt>
|
|
6
|
+
沉淀: <可选:沉淀到 wiki 的相对仓根路径,如 wiki/项目规范/权限收敛方案.md;不沉淀写「无」,留空待 check-loop 提醒;关单时可跑 node .agents/scripts/draft-sediment.mjs 自动抽草稿并回写本字段>
|
|
6
7
|
备注: <可选:附注自由文本,check-loop 不解析>
|
|
7
8
|
---
|
|
8
9
|
# INTENT — <主题>
|
|
@@ -39,3 +40,5 @@
|
|
|
39
40
|
|
|
40
41
|
> **闭环对账**:关单在 test 阶段(不依赖 deploy)。intent 置 done 前逐条勾验,每条勾选项后补证据——`- [x] <判据>(证据:<commit SHA / 测试用例名 / 冒烟脚本输出>)`。
|
|
41
42
|
> done 状态仍有未勾项会被 check-loop 拦截(2026-09-12 起新建 intent 为 hard-block,存量 intent 仅 warning 提示);勾选但缺「证据:」为 warning。
|
|
43
|
+
> **场景覆盖**(2026-10-10 scenario-coverage 灰度):同名 spec 写了「验收场景」节时,本节须**逐场景 ID 引用**——
|
|
44
|
+
> `- [x] 场景:S1 <判据>(证据:…)`。缺引用只出 warning(灰度第一档,不阻断);spec 无该节则本条不适用。
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
<!-- 与 intents/ 或 incidents/ 下同名入口文档配对;L2/L3 必须先有 ../specs/ 同名 spec 确认通过;AI 起草、用户对话内确认后开工 -->
|
|
8
8
|
<!-- frontmatter 受限子集(2026-09-13):状态∈draft/approved/done/superseded/cancelled(严格枚举,附注写备注键);级别∈L0/L1/L2/L3;正文不再写状态/级别行 -->
|
|
9
9
|
<!-- L1 极简形态(Quick-Plan,与 fill-plan.mjs 单源一致):单/少文件微改动只填「改动方案」+「约束与风险」+「验证计划」三节(L1 主节标题模板正文用「改动面」,fill-plan 生成「改动方案」——check-loop 证据校验对 改动面/任务拆解/改动方案 三种节名均识别为声明文件来源)——改动方案逐条列改哪个文件做什么(判据细节直接写进条目),验证计划一行静态门 + 按需 UI 实测;任务拆解/执行顺序仅 L1 多文件多步骤时保留 -->
|
|
10
|
+
<!-- 待澄清标记(2026-10-12 needs-clarification):判据不明 / 依赖不确定 / 用户没说的细节,照实写一行
|
|
11
|
+
`- 待澄清:<你卡在哪>`,不要猜(语义说明同 specs 模板:占位符=忘了填,本标记=我不知道)。
|
|
12
|
+
起草不拦,draft→approved 确认时仍挂着会被 confirm-doc 拒绝;解决后改行首为 `- 已澄清:` 或删行。 -->
|
|
10
13
|
|
|
11
14
|
对应入口:../intents/YYYY-MM-DD-<主题>.md 或 ../incidents/YYYY-MM-DD-<主题>.md(保留实际一项)
|
|
12
15
|
对应 spec:../specs/YYYY-MM-DD-<主题>.md(L1 可省略)
|
|
@@ -26,6 +29,7 @@
|
|
|
26
29
|
<1 → 2 → 3;标注依赖关系>
|
|
27
30
|
|
|
28
31
|
## 验证方式
|
|
32
|
+
- 验证层标注:每条验收标准标注验证层(单元 / 集成 / E2E / 人工实测)——关单证据按层对质,「已人工验证」不替代可自动化层
|
|
29
33
|
- 静态门:`项目构建命令`(+ `项目测试命令`,测试项目就绪后)
|
|
30
34
|
- 前端:cd frontend && npm run build(vue-tsc)
|
|
31
35
|
- UI:.agents/commands/test.md(涉及页面改动必走,headless Chrome 实测)
|
|
@@ -6,12 +6,35 @@
|
|
|
6
6
|
# SPEC — <与入口文档同名主题>
|
|
7
7
|
<!-- 与 intents/ 或 incidents/ 下同名入口文档配对;L2 / L3 必须先有 spec 确认通过方可起草 plan;L1 可省略 -->
|
|
8
8
|
<!-- frontmatter 受限子集(2026-09-13):状态∈draft/approved/done/superseded/cancelled(done=关单、superseded=曾确认后放弃、cancelled=未完成即取消);L3 确认通过后在 frontmatter 追加两行:`确认结果: approved` 与 `确认时间: YYYY-MM-DD`(check-loop 对 L3 强制校验) -->
|
|
9
|
+
<!-- 待澄清标记(2026-10-12 needs-clarification):起草时**不确定的地方照实写一行** `- 待澄清:<你卡在哪>`,
|
|
10
|
+
不要猜一个填上去——「我不知道」是负责,猜是失职(与检查 2 的模板占位符语义相反:占位符是忘了填)。
|
|
11
|
+
起草门不拦(不阻塞你继续写);但 draft→approved 确认时仍挂着未澄清项会被 confirm-doc 拒绝落账——
|
|
12
|
+
确认即「认可这份文档」,文档里写着「这里我不知道」就没法确认。
|
|
13
|
+
解决后把行首改成 `- 已澄清:…`(**保留该行**,留痕曾不清楚过,便于事后对质)或直接删行。
|
|
14
|
+
判据单源:stage-gates.mjs#openClarifications / clarifyGateFor(confirm-doc 消费)。 -->
|
|
9
15
|
|
|
10
16
|
对应入口:../intents/YYYY-MM-DD-<主题>.md 或 ../incidents/YYYY-MM-DD-<主题>.md(保留实际一项)
|
|
11
17
|
|
|
12
18
|
## 功能行为
|
|
13
19
|
<讲清功能怎么工作;分小节列用户 / 系统行为,必要时附状态机 / 时序图说明>
|
|
14
20
|
|
|
21
|
+
## 验收场景(可选)
|
|
22
|
+
<结构化验收用例,GIVEN/WHEN/THEN 三行写法。每条带场景 ID(S1、S2…),同名 intent 的「验收标准」
|
|
23
|
+
按 ID 逐条引用——check-loop 检查 8 会校验场景覆盖(缺引用 = warning,灰度第一档)。
|
|
24
|
+
THEN 行是机器对账断言:声明了场景却缺「- THEN <可观测结果>」行 = 空壳场景,check-loop 出
|
|
25
|
+
[WARN 场景无断言](advisory,灰度第一档)。
|
|
26
|
+
**本节可选**:不写时检查 8 走原「逐条勾验」判据,行为零变化;写了则 intent 的验收标准应覆盖全部场景 ID。>
|
|
27
|
+
|
|
28
|
+
### S1 <场景名>
|
|
29
|
+
- GIVEN <前置条件>
|
|
30
|
+
- WHEN <触发动作>
|
|
31
|
+
- THEN <可观测的结果断言>
|
|
32
|
+
|
|
33
|
+
### S2 <场景名>
|
|
34
|
+
- GIVEN <前置条件>
|
|
35
|
+
- WHEN <触发动作>
|
|
36
|
+
- THEN <可观测的结果断言>
|
|
37
|
+
|
|
15
38
|
## 数据流
|
|
16
39
|
<数据从哪里来 → 经过哪些处理 → 落到哪里;含字段映射、接口契约、上下游依赖>
|
|
17
40
|
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 装户面同步一致性检查(包源 templates/_agents/ vs 装副本 .agents/ 三类差异:缺失 / 孤儿 / 漂移)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> **装户边界**:本文档中 `src/`、`bin/flow-kit.mjs`、`templates/_agents/`、`modules/hosts/` 为 kit 包源仓视角引用——装户仓(无 `templates/` 包源)对应命令不适用,本仓以 `.agents/` 装副本为准。
|
|
6
|
-
|
|
7
|
-
# Source-Sync-Check · 装户面同步一致性
|
|
8
|
-
|
|
9
|
-
> `templates/_agents/` 包源 vs `.agents/` 装副本——三类差异报告:缺失 / 孤儿 / 漂移。
|
|
10
|
-
> managed 文件由 `flow-kit sync` 跟踪;owned 文件由 `flow-kit doctor` §6.6 校验——本工具补"两者都没扫"的真空地带(结构级差异)。
|
|
11
|
-
|
|
12
|
-
## 1. 何时跑
|
|
13
|
-
|
|
14
|
-
- 改 `templates/_agents/*` 包源后
|
|
15
|
-
- 怀疑装副本未跟包源更新
|
|
16
|
-
- 体检装副本完整性(清理前 / 发版前)
|
|
17
|
-
- 不跑:仅改装副本 `.agents/*`(B-b 决策「只报告」+ 不反向同步)
|
|
18
|
-
|
|
19
|
-
## 2. 怎么跑
|
|
20
|
-
|
|
21
|
-
### 2.1 默认 `--diff`(仅报告)
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
node .agents/scripts/source-sync-check.mjs --diff
|
|
25
|
-
node .agents/scripts/source-sync-check.mjs --json # 机器可读
|
|
26
|
-
node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> # 自定义路径
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
输出三类:
|
|
30
|
-
- **缺失**(missing)——包源有 / 装副本无(如新增文件 init 未执行)
|
|
31
|
-
- **孤儿**(orphan)——包源无 / 装副本有(如历史残留 / 用户本地添加)
|
|
32
|
-
- **漂移**(drift)——两者都有但 sha 不一致(如包源改了装副本未跟)
|
|
33
|
-
|
|
34
|
-
**排除**:
|
|
35
|
-
- `templates/_agents/cache/`(运行时缓存,与 `flow-kit sync` 既有约定一致)
|
|
36
|
-
- `.agents/kit.json` / `.agents/settings.json`(init 渲染产物,不属双源)
|
|
37
|
-
|
|
38
|
-
### 2.2 输出示例
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
▶ flow-kit source-sync-check --diff
|
|
42
|
-
包源 (templates/_agents/) 49 份 | 装副本 (.agents/) 49 份
|
|
43
|
-
缺失(包源有 / 装副本 无)1:
|
|
44
|
-
- scripts/source-sync-check.mjs
|
|
45
|
-
孤儿(包源无 / 装副本 有)1:
|
|
46
|
-
- hooks/commit-check.config.json
|
|
47
|
-
漂移(包源装副本都有但 sha 不一致)3:
|
|
48
|
-
- commands/maintain.md pkg=3782b695… tgt=26203f7b…
|
|
49
|
-
- notes/runtime-env.md pkg=aedde1ba… tgt=ad08441e…
|
|
50
|
-
- scripts/ensure-board.mjs pkg=e66653b0… tgt=b6f3cc9b…
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 2.3 自验
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
node .agents/scripts/source-sync-check.test.mjs # 11 场景全过
|
|
57
|
-
npm test # 含 source-sync-check 套件
|
|
58
|
-
flow-kit doctor # 10/0/0
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 3. 边界(不要做)
|
|
62
|
-
|
|
63
|
-
- 不要自动化同步(B-b 决策「只报告不修复」——与 `gate-checklist` 同源)
|
|
64
|
-
- 不改 managed 台账跟踪逻辑(`sync.mjs` 不动)
|
|
65
|
-
- 不改 owned 漂移校验(`doctor.mjs` §6.6 不动)
|
|
66
|
-
- 不反向同步——装副本独自有文件(如 hooks/commit-check.config.json)可能是装户配置,不应被删
|
|
67
|
-
- 不检查注册表内宿主 `modules/hosts/` 薄适配漂移(那是 `flow-kit sync-hosts` 范围)
|
|
68
|
-
|
|
69
|
-
## 4. 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
70
|
-
|
|
71
|
-
- **缺失**:本工具写完后未同步装副本(预期内——随本次 commit 解决)
|
|
72
|
-
- **孤儿**:`.agents/hooks/commit-check.config.json`(装副本独有,疑似装户配置)
|
|
73
|
-
- **漂移**:`commands/maintain.md` / `notes/runtime-env.md` / `scripts/ensure-board.mjs`
|
|
74
|
-
|
|
75
|
-
修复留后续 incident / intent 跟踪(不在本次范围)。
|
|
76
|
-
|
|
77
|
-
## 5. 与既有工具的关系
|
|
78
|
-
|
|
79
|
-
| 工具 | 作用域 | 算法 |
|
|
80
|
-
|---|---|---|
|
|
81
|
-
| `flow-kit sync` | managed 文件(kit.json 台账跟踪)| 三态覆盖 + 加新 + 报错缺 |
|
|
82
|
-
| `flow-kit doctor` §6.6 | owned 文件(kit.owned 哈希比对)| 盘面 sha vs 台账哈希 |
|
|
83
|
-
| **`flow-kit source-sync-check`** | **所有文件结构(包源 ↔ 装副本全集)** | **sha 全量比对 + 缺失/孤儿分类** |
|
|
84
|
-
|
|
85
|
-
三者互补,不重叠。
|
|
86
|
-
|
|
87
|
-
## 6. 相关留痕
|
|
88
|
-
|
|
89
|
-
- intent:`workflow/intents/2026-09-25-source-sync-check.md`
|
|
90
|
-
- plan:`workflow/plans/2026-09-25-source-sync-check.md`
|
|
91
|
-
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 装户面同步一致性检查(包源 templates/_agents/ vs 装副本 .agents/ 三类差异:缺失 / 孤儿 / 漂移)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> **装户边界**:本文档中 `src/`、`bin/flow-kit.mjs`、`templates/_agents/`、`modules/hosts/` 为 kit 包源仓视角引用——装户仓(无 `templates/` 包源)对应命令不适用,本仓以 `.agents/` 装副本为准。
|
|
6
|
-
|
|
7
|
-
# Source-Sync-Check · 装户面同步一致性
|
|
8
|
-
|
|
9
|
-
> `templates/_agents/` 包源 vs `.agents/` 装副本——三类差异报告:缺失 / 孤儿 / 漂移。
|
|
10
|
-
> managed 文件由 `flow-kit sync` 跟踪;owned 文件由 `flow-kit doctor` §6.6 校验——本工具补"两者都没扫"的真空地带(结构级差异)。
|
|
11
|
-
|
|
12
|
-
## 1. 何时跑
|
|
13
|
-
|
|
14
|
-
- 改 `templates/_agents/*` 包源后
|
|
15
|
-
- 怀疑装副本未跟包源更新
|
|
16
|
-
- 体检装副本完整性(清理前 / 发版前)
|
|
17
|
-
- 不跑:仅改装副本 `.agents/*`(B-b 决策「只报告」+ 不反向同步)
|
|
18
|
-
|
|
19
|
-
## 2. 怎么跑
|
|
20
|
-
|
|
21
|
-
### 2.1 默认 `--diff`(仅报告)
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
node .agents/scripts/source-sync-check.mjs --diff
|
|
25
|
-
node .agents/scripts/source-sync-check.mjs --json # 机器可读
|
|
26
|
-
node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> # 自定义路径
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
输出三类:
|
|
30
|
-
- **缺失**(missing)——包源有 / 装副本无(如新增文件 init 未执行)
|
|
31
|
-
- **孤儿**(orphan)——包源无 / 装副本有(如历史残留 / 用户本地添加)
|
|
32
|
-
- **漂移**(drift)——两者都有但 sha 不一致(如包源改了装副本未跟)
|
|
33
|
-
|
|
34
|
-
**排除**:
|
|
35
|
-
- `templates/_agents/cache/`(运行时缓存,与 `flow-kit sync` 既有约定一致)
|
|
36
|
-
- `.agents/kit.json` / `.agents/settings.json`(init 渲染产物,不属双源)
|
|
37
|
-
|
|
38
|
-
### 2.2 输出示例
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
▶ flow-kit source-sync-check --diff
|
|
42
|
-
包源 (templates/_agents/) 49 份 | 装副本 (.agents/) 49 份
|
|
43
|
-
缺失(包源有 / 装副本 无)1:
|
|
44
|
-
- scripts/source-sync-check.mjs
|
|
45
|
-
孤儿(包源无 / 装副本 有)1:
|
|
46
|
-
- hooks/commit-check.config.json
|
|
47
|
-
漂移(包源装副本都有但 sha 不一致)3:
|
|
48
|
-
- commands/maintain.md pkg=3782b695… tgt=26203f7b…
|
|
49
|
-
- notes/runtime-env.md pkg=aedde1ba… tgt=ad08441e…
|
|
50
|
-
- scripts/ensure-board.mjs pkg=e66653b0… tgt=b6f3cc9b…
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 2.3 自验
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
node .agents/scripts/source-sync-check.test.mjs # 11 场景全过
|
|
57
|
-
npm test # 含 source-sync-check 套件
|
|
58
|
-
flow-kit doctor # 10/0/0
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 3. 边界(不要做)
|
|
62
|
-
|
|
63
|
-
- 不要自动化同步(B-b 决策「只报告不修复」——与 `gate-checklist` 同源)
|
|
64
|
-
- 不改 managed 台账跟踪逻辑(`sync.mjs` 不动)
|
|
65
|
-
- 不改 owned 漂移校验(`doctor.mjs` §6.6 不动)
|
|
66
|
-
- 不反向同步——装副本独自有文件(如 hooks/commit-check.config.json)可能是装户配置,不应被删
|
|
67
|
-
- 不检查注册表内宿主 `modules/hosts/` 薄适配漂移(那是 `flow-kit sync-hosts` 范围)
|
|
68
|
-
|
|
69
|
-
## 4. 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
70
|
-
|
|
71
|
-
- **缺失**:本工具写完后未同步装副本(预期内——随本次 commit 解决)
|
|
72
|
-
- **孤儿**:`.agents/hooks/commit-check.config.json`(装副本独有,疑似装户配置)
|
|
73
|
-
- **漂移**:`commands/maintain.md` / `notes/runtime-env.md` / `scripts/ensure-board.mjs`
|
|
74
|
-
|
|
75
|
-
修复留后续 incident / intent 跟踪(不在本次范围)。
|
|
76
|
-
|
|
77
|
-
## 5. 与既有工具的关系
|
|
78
|
-
|
|
79
|
-
| 工具 | 作用域 | 算法 |
|
|
80
|
-
|---|---|---|
|
|
81
|
-
| `flow-kit sync` | managed 文件(kit.json 台账跟踪)| 三态覆盖 + 加新 + 报错缺 |
|
|
82
|
-
| `flow-kit doctor` §6.6 | owned 文件(kit.owned 哈希比对)| 盘面 sha vs 台账哈希 |
|
|
83
|
-
| **`flow-kit source-sync-check`** | **所有文件结构(包源 ↔ 装副本全集)** | **sha 全量比对 + 缺失/孤儿分类** |
|
|
84
|
-
|
|
85
|
-
三者互补,不重叠。
|
|
86
|
-
|
|
87
|
-
## 6. 相关留痕
|
|
88
|
-
|
|
89
|
-
- intent:`workflow/intents/2026-09-25-source-sync-check.md`
|
|
90
|
-
- plan:`workflow/plans/2026-09-25-source-sync-check.md`
|
|
91
|
-
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 装户面同步一致性检查(包源 templates/_agents/ vs 装副本 .agents/ 三类差异:缺失 / 孤儿 / 漂移)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> **装户边界**:本文档中 `src/`、`bin/flow-kit.mjs`、`templates/_agents/`、`modules/hosts/` 为 kit 包源仓视角引用——装户仓(无 `templates/` 包源)对应命令不适用,本仓以 `.agents/` 装副本为准。
|
|
6
|
-
|
|
7
|
-
# Source-Sync-Check · 装户面同步一致性
|
|
8
|
-
|
|
9
|
-
> `templates/_agents/` 包源 vs `.agents/` 装副本——三类差异报告:缺失 / 孤儿 / 漂移。
|
|
10
|
-
> managed 文件由 `flow-kit sync` 跟踪;owned 文件由 `flow-kit doctor` §6.6 校验——本工具补"两者都没扫"的真空地带(结构级差异)。
|
|
11
|
-
|
|
12
|
-
## 1. 何时跑
|
|
13
|
-
|
|
14
|
-
- 改 `templates/_agents/*` 包源后
|
|
15
|
-
- 怀疑装副本未跟包源更新
|
|
16
|
-
- 体检装副本完整性(清理前 / 发版前)
|
|
17
|
-
- 不跑:仅改装副本 `.agents/*`(B-b 决策「只报告」+ 不反向同步)
|
|
18
|
-
|
|
19
|
-
## 2. 怎么跑
|
|
20
|
-
|
|
21
|
-
### 2.1 默认 `--diff`(仅报告)
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
node .agents/scripts/source-sync-check.mjs --diff
|
|
25
|
-
node .agents/scripts/source-sync-check.mjs --json # 机器可读
|
|
26
|
-
node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> # 自定义路径
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
输出三类:
|
|
30
|
-
- **缺失**(missing)——包源有 / 装副本无(如新增文件 init 未执行)
|
|
31
|
-
- **孤儿**(orphan)——包源无 / 装副本有(如历史残留 / 用户本地添加)
|
|
32
|
-
- **漂移**(drift)——两者都有但 sha 不一致(如包源改了装副本未跟)
|
|
33
|
-
|
|
34
|
-
**排除**:
|
|
35
|
-
- `templates/_agents/cache/`(运行时缓存,与 `flow-kit sync` 既有约定一致)
|
|
36
|
-
- `.agents/kit.json` / `.agents/settings.json`(init 渲染产物,不属双源)
|
|
37
|
-
|
|
38
|
-
### 2.2 输出示例
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
▶ flow-kit source-sync-check --diff
|
|
42
|
-
包源 (templates/_agents/) 49 份 | 装副本 (.agents/) 49 份
|
|
43
|
-
缺失(包源有 / 装副本 无)1:
|
|
44
|
-
- scripts/source-sync-check.mjs
|
|
45
|
-
孤儿(包源无 / 装副本 有)1:
|
|
46
|
-
- hooks/commit-check.config.json
|
|
47
|
-
漂移(包源装副本都有但 sha 不一致)3:
|
|
48
|
-
- commands/maintain.md pkg=3782b695… tgt=26203f7b…
|
|
49
|
-
- notes/runtime-env.md pkg=aedde1ba… tgt=ad08441e…
|
|
50
|
-
- scripts/ensure-board.mjs pkg=e66653b0… tgt=b6f3cc9b…
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 2.3 自验
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
node .agents/scripts/source-sync-check.test.mjs # 11 场景全过
|
|
57
|
-
npm test # 含 source-sync-check 套件
|
|
58
|
-
flow-kit doctor # 10/0/0
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 3. 边界(不要做)
|
|
62
|
-
|
|
63
|
-
- 不要自动化同步(B-b 决策「只报告不修复」——与 `gate-checklist` 同源)
|
|
64
|
-
- 不改 managed 台账跟踪逻辑(`sync.mjs` 不动)
|
|
65
|
-
- 不改 owned 漂移校验(`doctor.mjs` §6.6 不动)
|
|
66
|
-
- 不反向同步——装副本独自有文件(如 hooks/commit-check.config.json)可能是装户配置,不应被删
|
|
67
|
-
- 不检查注册表内宿主 `modules/hosts/` 薄适配漂移(那是 `flow-kit sync-hosts` 范围)
|
|
68
|
-
|
|
69
|
-
## 4. 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
70
|
-
|
|
71
|
-
- **缺失**:本工具写完后未同步装副本(预期内——随本次 commit 解决)
|
|
72
|
-
- **孤儿**:`.agents/hooks/commit-check.config.json`(装副本独有,疑似装户配置)
|
|
73
|
-
- **漂移**:`commands/maintain.md` / `notes/runtime-env.md` / `scripts/ensure-board.mjs`
|
|
74
|
-
|
|
75
|
-
修复留后续 incident / intent 跟踪(不在本次范围)。
|
|
76
|
-
|
|
77
|
-
## 5. 与既有工具的关系
|
|
78
|
-
|
|
79
|
-
| 工具 | 作用域 | 算法 |
|
|
80
|
-
|---|---|---|
|
|
81
|
-
| `flow-kit sync` | managed 文件(kit.json 台账跟踪)| 三态覆盖 + 加新 + 报错缺 |
|
|
82
|
-
| `flow-kit doctor` §6.6 | owned 文件(kit.owned 哈希比对)| 盘面 sha vs 台账哈希 |
|
|
83
|
-
| **`flow-kit source-sync-check`** | **所有文件结构(包源 ↔ 装副本全集)** | **sha 全量比对 + 缺失/孤儿分类** |
|
|
84
|
-
|
|
85
|
-
三者互补,不重叠。
|
|
86
|
-
|
|
87
|
-
## 6. 相关留痕
|
|
88
|
-
|
|
89
|
-
- intent:`workflow/intents/2026-09-25-source-sync-check.md`
|
|
90
|
-
- plan:`workflow/plans/2026-09-25-source-sync-check.md`
|
|
91
|
-
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: 装户面同步一致性检查(包源 templates/_agents/ vs 装副本 .agents/ 三类差异:缺失 / 孤儿 / 漂移;横向工具)
|
|
3
|
-
---
|
|
4
|
-
|
|
5
|
-
> **装户边界**:本文档中 `src/`、`bin/flow-kit.mjs`、`templates/_agents/`、`modules/hosts/` 为 kit 包源仓视角引用——装户仓(无 `templates/` 包源)对应命令不适用,本仓以 `.agents/` 装副本为准。
|
|
6
|
-
|
|
7
|
-
# Source-Sync-Check · 装户面同步一致性
|
|
8
|
-
|
|
9
|
-
> `templates/_agents/` 包源 vs `.agents/` 装副本——三类差异报告:缺失 / 孤儿 / 漂移。
|
|
10
|
-
> managed 文件由 `flow-kit sync` 跟踪;owned 文件由 `flow-kit doctor` §6.6 校验——本工具补"两者都没扫"的真空地带(结构级差异)。
|
|
11
|
-
|
|
12
|
-
## 1. 何时跑
|
|
13
|
-
|
|
14
|
-
- 改 `templates/_agents/*` 包源后
|
|
15
|
-
- 怀疑装副本未跟包源更新
|
|
16
|
-
- 体检装副本完整性(清理前 / 发版前)
|
|
17
|
-
- 不跑:仅改装副本 `.agents/*`(B-b 决策「只报告」+ 不反向同步)
|
|
18
|
-
|
|
19
|
-
## 2. 怎么跑
|
|
20
|
-
|
|
21
|
-
### 2.1 默认 `--diff`(仅报告)
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
node .agents/scripts/source-sync-check.mjs --diff
|
|
25
|
-
node .agents/scripts/source-sync-check.mjs --json # 机器可读
|
|
26
|
-
node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> # 自定义路径
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
输出三类:
|
|
30
|
-
- **缺失**(missing)——包源有 / 装副本无(如新增文件 init 未执行)
|
|
31
|
-
- **孤儿**(orphan)——包源无 / 装副本有(如历史残留 / 用户本地添加)
|
|
32
|
-
- **漂移**(drift)——两者都有但 sha 不一致(如包源改了装副本未跟)
|
|
33
|
-
|
|
34
|
-
**排除**:
|
|
35
|
-
- `templates/_agents/cache/`(运行时缓存,与 `flow-kit sync` 既有约定一致)
|
|
36
|
-
- `.agents/kit.json` / `.agents/settings.json`(init 渲染产物,不属双源)
|
|
37
|
-
|
|
38
|
-
### 2.2 输出示例
|
|
39
|
-
|
|
40
|
-
```
|
|
41
|
-
▶ flow-kit source-sync-check --diff
|
|
42
|
-
包源 (templates/_agents/) 49 份 | 装副本 (.agents/) 49 份
|
|
43
|
-
缺失(包源有 / 装副本 无)1:
|
|
44
|
-
- scripts/source-sync-check.mjs
|
|
45
|
-
孤儿(包源无 / 装副本 有)1:
|
|
46
|
-
- hooks/commit-check.config.json
|
|
47
|
-
漂移(包源装副本都有但 sha 不一致)3:
|
|
48
|
-
- commands/maintain.md pkg=3782b695… tgt=26203f7b…
|
|
49
|
-
- notes/runtime-env.md pkg=aedde1ba… tgt=ad08441e…
|
|
50
|
-
- scripts/ensure-board.mjs pkg=e66653b0… tgt=b6f3cc9b…
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
### 2.3 自验
|
|
54
|
-
|
|
55
|
-
```
|
|
56
|
-
node .agents/scripts/source-sync-check.test.mjs # 11 场景全过
|
|
57
|
-
npm test # 含 source-sync-check 套件
|
|
58
|
-
flow-kit doctor # 10/0/0
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
## 3. 边界(不要做)
|
|
62
|
-
|
|
63
|
-
- 不要自动化同步(B-b 决策「只报告不修复」——与 `gate-checklist` 同源)
|
|
64
|
-
- 不改 managed 台账跟踪逻辑(`sync.mjs` 不动)
|
|
65
|
-
- 不改 owned 漂移校验(`doctor.mjs` §6.6 不动)
|
|
66
|
-
- 不反向同步——装副本独自有文件(如 hooks/commit-check.config.json)可能是装户配置,不应被删
|
|
67
|
-
- 不检查注册表内宿主 `modules/hosts/` 薄适配漂移(那是 `flow-kit sync-hosts` 范围)
|
|
68
|
-
|
|
69
|
-
## 4. 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
70
|
-
|
|
71
|
-
- **缺失**:本工具写完后未同步装副本(预期内——随本次 commit 解决)
|
|
72
|
-
- **孤儿**:`.agents/hooks/commit-check.config.json`(装副本独有,疑似装户配置)
|
|
73
|
-
- **漂移**:`commands/maintain.md` / `notes/runtime-env.md` / `scripts/ensure-board.mjs`
|
|
74
|
-
|
|
75
|
-
修复留后续 incident / intent 跟踪(不在本次范围)。
|
|
76
|
-
|
|
77
|
-
## 5. 与既有工具的关系
|
|
78
|
-
|
|
79
|
-
| 工具 | 作用域 | 算法 |
|
|
80
|
-
|---|---|---|
|
|
81
|
-
| `flow-kit sync` | managed 文件(kit.json 台账跟踪)| 三态覆盖 + 加新 + 报错缺 |
|
|
82
|
-
| `flow-kit doctor` §6.6 | owned 文件(kit.owned 哈希比对)| 盘面 sha vs 台账哈希 |
|
|
83
|
-
| **`flow-kit source-sync-check`** | **所有文件结构(包源 ↔ 装副本全集)** | **sha 全量比对 + 缺失/孤儿分类** |
|
|
84
|
-
|
|
85
|
-
三者互补,不重叠。
|
|
86
|
-
|
|
87
|
-
## 6. 相关留痕
|
|
88
|
-
|
|
89
|
-
- intent:`workflow/intents/2026-09-25-source-sync-check.md`
|
|
90
|
-
- plan:`workflow/plans/2026-09-25-source-sync-check.md`
|
|
91
|
-
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: wf-source-sync-check
|
|
3
|
-
description: 装户面同步一致性检查(包源 templates/_agents/ vs 装副本 .agents/ 三类差异:缺失 / 孤儿 / 漂移;横向工具)
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
> **装户边界**:本文档中 `src/`、`bin/flow-kit.mjs`、`templates/_agents/`、`modules/hosts/` 为 kit 包源仓视角引用——装户仓(无 `templates/` 包源)对应命令不适用,本仓以 `.agents/` 装副本为准。
|
|
7
|
-
|
|
8
|
-
# Source-Sync-Check · 装户面同步一致性
|
|
9
|
-
|
|
10
|
-
> `templates/_agents/` 包源 vs `.agents/` 装副本——三类差异报告:缺失 / 孤儿 / 漂移。
|
|
11
|
-
> managed 文件由 `flow-kit sync` 跟踪;owned 文件由 `flow-kit doctor` §6.6 校验——本工具补"两者都没扫"的真空地带(结构级差异)。
|
|
12
|
-
|
|
13
|
-
## 1. 何时跑
|
|
14
|
-
|
|
15
|
-
- 改 `templates/_agents/*` 包源后
|
|
16
|
-
- 怀疑装副本未跟包源更新
|
|
17
|
-
- 体检装副本完整性(清理前 / 发版前)
|
|
18
|
-
- 不跑:仅改装副本 `.agents/*`(B-b 决策「只报告」+ 不反向同步)
|
|
19
|
-
|
|
20
|
-
## 2. 怎么跑
|
|
21
|
-
|
|
22
|
-
### 2.1 默认 `--diff`(仅报告)
|
|
23
|
-
|
|
24
|
-
```
|
|
25
|
-
node .agents/scripts/source-sync-check.mjs --diff
|
|
26
|
-
node .agents/scripts/source-sync-check.mjs --json # 机器可读
|
|
27
|
-
node .agents/scripts/source-sync-check.mjs --pkg-root <path> --target <path> # 自定义路径
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
输出三类:
|
|
31
|
-
- **缺失**(missing)——包源有 / 装副本无(如新增文件 init 未执行)
|
|
32
|
-
- **孤儿**(orphan)——包源无 / 装副本有(如历史残留 / 用户本地添加)
|
|
33
|
-
- **漂移**(drift)——两者都有但 sha 不一致(如包源改了装副本未跟)
|
|
34
|
-
|
|
35
|
-
**排除**:
|
|
36
|
-
- `templates/_agents/cache/`(运行时缓存,与 `flow-kit sync` 既有约定一致)
|
|
37
|
-
- `.agents/kit.json` / `.agents/settings.json`(init 渲染产物,不属双源)
|
|
38
|
-
|
|
39
|
-
### 2.2 输出示例
|
|
40
|
-
|
|
41
|
-
```
|
|
42
|
-
▶ flow-kit source-sync-check --diff
|
|
43
|
-
包源 (templates/_agents/) 49 份 | 装副本 (.agents/) 49 份
|
|
44
|
-
缺失(包源有 / 装副本 无)1:
|
|
45
|
-
- scripts/source-sync-check.mjs
|
|
46
|
-
孤儿(包源无 / 装副本 有)1:
|
|
47
|
-
- hooks/commit-check.config.json
|
|
48
|
-
漂移(包源装副本都有但 sha 不一致)3:
|
|
49
|
-
- commands/maintain.md pkg=3782b695… tgt=26203f7b…
|
|
50
|
-
- notes/runtime-env.md pkg=aedde1ba… tgt=ad08441e…
|
|
51
|
-
- scripts/ensure-board.mjs pkg=e66653b0… tgt=b6f3cc9b…
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### 2.3 自验
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
node .agents/scripts/source-sync-check.test.mjs # 11 场景全过
|
|
58
|
-
npm test # 含 source-sync-check 套件
|
|
59
|
-
flow-kit doctor # 10/0/0
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
## 3. 边界(不要做)
|
|
63
|
-
|
|
64
|
-
- 不要自动化同步(B-b 决策「只报告不修复」——与 `gate-checklist` 同源)
|
|
65
|
-
- 不改 managed 台账跟踪逻辑(`sync.mjs` 不动)
|
|
66
|
-
- 不改 owned 漂移校验(`doctor.mjs` §6.6 不动)
|
|
67
|
-
- 不反向同步——装副本独自有文件(如 hooks/commit-check.config.json)可能是装户配置,不应被删
|
|
68
|
-
- 不检查注册表内宿主 `modules/hosts/` 薄适配漂移(那是 `flow-kit sync-hosts` 范围)
|
|
69
|
-
|
|
70
|
-
## 4. 当前已识别的真实漂点(首次实测,2026-09-25)
|
|
71
|
-
|
|
72
|
-
- **缺失**:本工具写完后未同步装副本(预期内——随本次 commit 解决)
|
|
73
|
-
- **孤儿**:`.agents/hooks/commit-check.config.json`(装副本独有,疑似装户配置)
|
|
74
|
-
- **漂移**:`commands/maintain.md` / `notes/runtime-env.md` / `scripts/ensure-board.mjs`
|
|
75
|
-
|
|
76
|
-
修复留后续 incident / intent 跟踪(不在本次范围)。
|
|
77
|
-
|
|
78
|
-
## 5. 与既有工具的关系
|
|
79
|
-
|
|
80
|
-
| 工具 | 作用域 | 算法 |
|
|
81
|
-
|---|---|---|
|
|
82
|
-
| `flow-kit sync` | managed 文件(kit.json 台账跟踪)| 三态覆盖 + 加新 + 报错缺 |
|
|
83
|
-
| `flow-kit doctor` §6.6 | owned 文件(kit.owned 哈希比对)| 盘面 sha vs 台账哈希 |
|
|
84
|
-
| **`flow-kit source-sync-check`** | **所有文件结构(包源 ↔ 装副本全集)** | **sha 全量比对 + 缺失/孤儿分类** |
|
|
85
|
-
|
|
86
|
-
三者互补,不重叠。
|
|
87
|
-
|
|
88
|
-
## 6. 相关留痕
|
|
89
|
-
|
|
90
|
-
- intent:`workflow/intents/2026-09-25-source-sync-check.md`
|
|
91
|
-
- plan:`workflow/plans/2026-09-25-source-sync-check.md`
|
|
92
|
-
- 父 incident:`workflow/incidents/2026-09-25-wf-runtime.md`(包源改了装副本未同步——本工具预防性体检)
|