agentic-flow-kit 0.2.0 → 0.2.1

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.
Files changed (56) hide show
  1. package/README.md +3 -2
  2. package/modules/gates/dotnet-ca/check-architecture.sh +14 -10
  3. package/modules/hosts/trae/commands/wf-build.md +14 -14
  4. package/modules/hosts/trae/commands/wf-deploy.md +13 -13
  5. package/modules/hosts/trae/commands/wf-design.md +13 -13
  6. package/modules/hosts/trae/commands/wf-maintain.md +13 -13
  7. package/modules/hosts/trae/commands/wf-new-task.md +13 -13
  8. package/modules/hosts/trae/commands/wf-plan.md +13 -13
  9. package/modules/hosts/trae/commands/wf-review.md +13 -13
  10. package/modules/hosts/trae/commands/wf-test.md +14 -14
  11. package/modules/hosts/trae/hooks/post-edit-check.cjs +10 -0
  12. package/modules/hosts/trae/hooks/pre-shell-check.cjs +14 -4
  13. package/modules/hosts/trae/hooks/resolve-shell.cjs +30 -21
  14. package/modules/hosts/trae/rules/beautify-input-chinese.md +6 -6
  15. package/modules/hosts/trae/rules/git-commit-message.md +10 -10
  16. package/package.json +10 -2
  17. package/src/add-gate.mjs +8 -1
  18. package/src/add-host.mjs +4 -0
  19. package/src/cli.mjs +4 -3
  20. package/src/doctor.mjs +9 -2
  21. package/src/render.mjs +2 -0
  22. package/src/sync.mjs +20 -4
  23. package/src/sync.test.mjs +40 -1
  24. package/templates/AGENTS.md +2 -2
  25. package/templates/_agents/board/index.html +382 -382
  26. package/templates/_agents/board/marked.min.js +6 -6
  27. package/templates/_agents/cache/kb-index.json +1 -1
  28. package/templates/_agents/commands/build.md +1 -1
  29. package/templates/_agents/commands/design.md +1 -1
  30. package/templates/_agents/commands/maintain.md +1 -1
  31. package/templates/_agents/commands/new-task.md +73 -73
  32. package/templates/_agents/commands/plan.md +2 -2
  33. package/templates/_agents/commands/test.md +1 -1
  34. package/templates/_agents/hooks/check-pairing-incremental.sh +30 -29
  35. package/templates/_agents/hooks/commit-check.cjs +6 -1
  36. package/templates/_agents/scripts/agg-delegations.cjs +35 -18
  37. package/templates/_agents/scripts/agg-delegations.test.mjs +95 -0
  38. package/templates/_agents/scripts/check-loop.sh +6 -0
  39. package/templates/_agents/scripts/check-loop.test.sh +1042 -1042
  40. package/templates/_agents/scripts/commit-check-trigger.test.mjs +94 -0
  41. package/templates/_agents/scripts/ensure-board.ps1 +1 -1
  42. package/templates/_agents/scripts/gen-wiki-board.mjs +13 -3
  43. package/templates/_agents/scripts/gen-wiki-board.test.mjs +22 -0
  44. package/templates/_agents/scripts/gen-workflow-index.mjs +7 -2
  45. package/templates/_agents/scripts/gen-workflow-index.test.mjs +27 -0
  46. package/templates/_agents/scripts/gen-workflow-metrics.mjs +17 -3
  47. package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +21 -0
  48. package/templates/_agents/scripts/kb-search.mjs +2 -1
  49. package/templates/_agents/scripts/rule-budget.sh +8 -2
  50. package/templates/_agents/scripts/verify-wiki-consistency.mjs +6 -1
  51. package/templates/_agents/scripts/workflow-board-server.mjs +245 -244
  52. package/templates/_githooks/commit-msg +4 -2
  53. package/templates/_githooks/pre-push +32 -32
  54. package/templates/workflow/README.md +2 -2
  55. package/templates/workflow/intents/_TEMPLATE.md +40 -40
  56. package/templates/workflow/specs/_TEMPLATE.md +41 -41
package/src/sync.test.mjs CHANGED
@@ -94,7 +94,7 @@ else if (cmd === 'add-gate') addGate(rest, root);
94
94
  const rels = kit.managed.map((f) => f.rel);
95
95
  check('S1 台账:版本对齐包版本', kit.version === '9.9.9');
96
96
  check('S1 台账:gone 出册、new 入册', !rels.includes('.agents/scripts/gone.txt') && rels.includes('.agents/commands/new.txt'));
97
- check('S1 台账:跳过文件基线化为用户版 sha', kit.managed.find((f) => f.rel === '.agents/scripts/loc.txt').sha256 === sha256(Buffer.from('loc USER\n')));
97
+ check('S1 台账:跳过文件保持包侧基线 sha(持续报告,不随盘面基线化)', kit.managed.find((f) => f.rel === '.agents/scripts/loc.txt').sha256 === sha256(Buffer.from('loc v1\n')));
98
98
  check('S1 台账:覆盖文件 sha 为新版', kit.managed.find((f) => f.rel === '.agents/scripts/chg.txt').sha256 === sha256(Buffer.from('chg v2 port 777\n')));
99
99
  check('S1 owned 不触碰(AGENTS.md 原样)', R(path.join(t, 'AGENTS.md')) === 'owned skeleton v2\n');
100
100
  check('S1 已装 owned 不误报新增', !out.includes('新增 owned 起步文档'), out);
@@ -182,6 +182,10 @@ else if (cmd === 'add-gate') addGate(rest, root);
182
182
  check('S8 local-pre-commit 接线(缺失则建 set -e 头)', R(path.join(t, '.agents/hooks/local-pre-commit')) === '#!/bin/sh\nset -e\nsh .agents/hooks/gate.sh\n', out);
183
183
  const kit = JSON.parse(R(path.join(t, '.agents/kit.json')));
184
184
  check('S8 owned 台账补记(归项目所有)', kit.owned.some((f) => f.rel === '.agents/hooks/gate.sh'));
185
+ check('S8 接线后 local-pre-commit 进 owned 且哈希=盘面(Shipyard 回流根因,2026-09-24)', (() => {
186
+ const e = kit.owned.find((f) => f.rel === '.agents/hooks/local-pre-commit');
187
+ return e && e.sha256 === sha256(Buffer.from(R(path.join(t, '.agents/hooks/local-pre-commit')), 'utf8'));
188
+ })(), JSON.stringify(kit.owned));
185
189
  runCmd('add-gate', fx, t, ['fakeg']); // 再跑一遍
186
190
  check('S8 幂等:接线行不重复', R(path.join(t, '.agents/hooks/local-pre-commit')) === '#!/bin/sh\nset -e\nsh .agents/hooks/gate.sh\n');
187
191
  const r3 = runCmd('add-gate', fx, t, ['nope']);
@@ -203,5 +207,40 @@ else if (cmd === 'add-gate') addGate(rest, root);
203
207
  check('S9 挂载行在 exit 0 原位之前追加', R(path.join(t, '.agents/hooks/local-pre-commit')) === '#!/bin/sh\n# 旧装态注释\nsh .agents/hooks/gate.sh\n', R(path.join(t, '.agents/hooks/local-pre-commit')));
204
208
  }
205
209
 
210
+ // ============ 场景 10:模板树内的运行时缓存不进安装与台账 ============
211
+ {
212
+ const fx = mkFixture();
213
+ W(path.join(fx, 'templates/_agents/cache/kb-index.json'), '{"stale":"test-residue"}');
214
+ const t = mkTarget(fx); // v1 安装态无 cache 文件
215
+ const r = runCmd('sync', fx, t);
216
+ check('S10 cache 残留不被安装', !fs.existsSync(path.join(t, '.agents/cache/kb-index.json')), r.stdout + r.stderr);
217
+ const kit = JSON.parse(R(path.join(t, '.agents/kit.json')));
218
+ check('S10 cache 不入 managed 台账', !kit.managed.some((f) => f.rel.startsWith('.agents/cache/')), JSON.stringify(kit.managed.filter((f) => f.rel.includes('cache'))));
219
+ }
220
+
221
+ // ============ 场景 11:跳过件不被下次升级静默覆盖(台账保持包侧基线,2026-09-24 语义修正回归) ============
222
+ {
223
+ const fx = mkFixture(), t = mkTarget(fx);
224
+ W(path.join(t, '.agents/scripts/loc.txt'), 'loc USER\n');
225
+ runCmd('sync', fx, t); // 第一次:本地已改 → 跳过
226
+ W(path.join(fx, 'templates/_agents/scripts/loc.txt'), 'loc v3\n'); // 包再出新版
227
+ const r = runCmd('sync', fx, t);
228
+ const out = r.stdout + r.stderr;
229
+ check('S11 二次 sync 不覆盖本地改动(loc.txt 仍为用户版)', R(path.join(t, '.agents/scripts/loc.txt')) === 'loc USER\n', out);
230
+ check('S11 仍按「本地已改,跳过」报告', out.includes('本地已改,跳过') && out.includes('loc.txt'), out);
231
+ }
232
+
233
+ // ============ 场景 12:owned 台账哈希按盘面自愈(Shipyard 回流策略,2026-09-24) ============
234
+ {
235
+ const fx = mkFixture(), t = mkTarget(fx);
236
+ W(path.join(t, 'AGENTS.md'), 'owned skeleton v2 EDITED BY USER\n'); // owned 件手改 → 台账停旧值
237
+ const r = runCmd('sync', fx, t);
238
+ const out = r.stdout + r.stderr;
239
+ check('S12 owned 文件不被触碰(AGENTS.md 保持用户版)', R(path.join(t, 'AGENTS.md')) === 'owned skeleton v2 EDITED BY USER\n', out);
240
+ const kit = JSON.parse(R(path.join(t, '.agents/kit.json')));
241
+ check('S12 owned 台账哈希自愈为盘面值', kit.owned.find((f) => f.rel === 'AGENTS.md').sha256 === sha256(Buffer.from('owned skeleton v2 EDITED BY USER\n')), JSON.stringify(kit.owned));
242
+ check('S12 有刷新报告', out.includes('owned 台账哈希按盘面刷新 1 份'), out);
243
+ }
244
+
206
245
  console.log(`\n合计: PASS ${pass} / FAIL ${failCount}`);
207
246
  process.exit(failCount ? 1 : 0);
@@ -25,12 +25,12 @@
25
25
  - `.githooks/`(经 `core.hooksPath` 挂载,本地 clone 后执行 `git config core.hooksPath .githooks`):pre-commit(闭环配对 / wiki 台账 / 规则面预算 / 敏感信息扫描与条件构建)、pre-push(闭环断档扫描)、commit-msg、post-commit、pre-merge-commit。
26
26
  - **`git commit` / `git merge` / `git push` 三处一律禁 `--no-verify`**——被拦说明产出不合规,按提示修完原路重试。
27
27
  - 项目专属门禁挂 `.agents/hooks/local-pre-commit`。
28
- - 提交遵循 Conventional Commits 中文(feat / fix / docs / style / refactor / perf);L1+ 入口文档 / spec / plan 随代码同一提交。
28
+ - 提交遵循 Conventional Commits 中文(feat / fix / docs / style / refactor / perf);L1+ 入口文档 / spec / plan 随代码同一提交;确认(approved)后立即 `docs(*)` 单独提交留痕。
29
29
 
30
30
  ### 检索、看板与量化
31
31
 
32
32
  - 跨语料检索:`node .agents/scripts/kb-search.mjs "<词>"`(workflow 节级定位 + wiki 全文);活跃流程读 `workflow/INDEX.md`(状态变更后 `node .agents/scripts/gen-workflow-index.mjs` 重生成)。
33
- - workflow 看板:http://127.0.0.1:{{BOARD_PORT}}(任务入口幂等拉起 ensure-board;只读预警层,非门禁)。
33
+ - workflow 看板(可选,默认不拉起):需要时手动跑 `.agents/scripts/ensure-board.ps1`,然后访问 http://127.0.0.1:{{BOARD_PORT}}(只读预警层,非门禁)。
34
34
  - 委派 / 自做结果留痕 `workflow/delegations.md`(聚合 `node .agents/scripts/agg-delegations.cjs`);命令 / 技能卡壳记 `workflow/papercuts.md`,不当场顺手改。
35
35
 
36
36
  ### 验证与关单