agentic-flow-kit 0.4.0 → 0.6.0
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 +3 -0
- package/modules/gates/dotnet-ca/check-architecture.sh +23 -5
- package/modules/hosts/omp/agents/implementer.md +47 -6
- package/modules/hosts/omp/agents/independent-reviewer.md +44 -5
- package/modules/hosts/omp/agents/ui-verifier.md +43 -6
- package/modules/hosts/opencode/agents/implementer.md +47 -1
- package/modules/hosts/opencode/agents/independent-reviewer.md +44 -1
- package/modules/hosts/opencode/agents/ui-verifier.md +43 -1
- package/modules/hosts/opencode/commands/build.md +74 -7
- package/modules/hosts/opencode/commands/deploy.md +51 -6
- package/modules/hosts/opencode/commands/design.md +36 -6
- package/modules/hosts/opencode/commands/gate-checklist.md +77 -0
- package/modules/hosts/opencode/commands/maintain.md +70 -6
- package/modules/hosts/opencode/commands/new-task.md +59 -6
- package/modules/hosts/opencode/commands/plan.md +35 -6
- package/modules/hosts/opencode/commands/review.md +41 -6
- package/modules/hosts/opencode/commands/source-sync-check.md +89 -0
- package/modules/hosts/opencode/commands/sync-hosts.md +66 -0
- package/modules/hosts/opencode/commands/test.md +58 -8
- package/modules/hosts/trae/agents/implementer.md +46 -2
- package/modules/hosts/trae/agents/independent-reviewer.md +44 -1
- package/modules/hosts/trae/agents/ui-verifier.md +41 -3
- package/modules/hosts/trae/commands/wf-build.md +74 -7
- package/modules/hosts/trae/commands/wf-deploy.md +51 -6
- package/modules/hosts/trae/commands/wf-design.md +36 -6
- package/modules/hosts/trae/commands/wf-gate-checklist.md +78 -0
- package/modules/hosts/trae/commands/wf-maintain.md +70 -6
- package/modules/hosts/trae/commands/wf-new-task.md +59 -6
- package/modules/hosts/trae/commands/wf-plan.md +35 -6
- package/modules/hosts/trae/commands/wf-review.md +41 -6
- package/modules/hosts/trae/commands/wf-source-sync-check.md +90 -0
- package/modules/hosts/trae/commands/wf-sync-hosts.md +67 -0
- package/modules/hosts/trae/commands/wf-test.md +58 -7
- package/modules/hosts/trae/hooks/post-edit-check.cjs +3 -2
- package/modules/hosts/trae/hooks/pre-shell-check.cjs +40 -9
- package/modules/hosts/trae/hooks.json +1 -1
- package/modules/hosts/zcode/agents/implementer.md +47 -6
- package/modules/hosts/zcode/agents/independent-reviewer.md +44 -5
- package/modules/hosts/zcode/agents/ui-verifier.md +43 -5
- package/package.json +6 -3
- package/src/add-gate.mjs +5 -3
- package/src/cli.mjs +15 -2
- package/src/doctor.mjs +245 -15
- package/src/gate-dotnet-ca.test.mjs +124 -0
- package/src/init.mjs +79 -17
- package/src/init.test.mjs +84 -2
- package/src/pack.test.mjs +24 -0
- package/src/render.mjs +64 -4
- package/src/run-tests.mjs +7 -11
- package/src/sync-hosts.mjs +194 -0
- package/src/sync-hosts.test.mjs +170 -0
- package/src/sync.mjs +65 -20
- package/src/sync.test.mjs +52 -0
- package/src/trae-hooks.test.mjs +115 -0
- package/templates/AGENTS.md +2 -1
- package/templates/_agents/board/index.html +32 -3
- package/templates/_agents/commands/build.md +22 -1
- package/templates/_agents/commands/design.md +2 -0
- package/templates/_agents/commands/gate-checklist.md +91 -0
- package/templates/_agents/commands/maintain.md +2 -3
- package/templates/_agents/commands/plan.md +4 -1
- package/templates/_agents/commands/review.md +1 -0
- package/templates/_agents/commands/source-sync-check.md +103 -0
- package/templates/_agents/commands/sync-hosts.md +79 -0
- package/templates/_agents/commands/test.md +4 -2
- package/templates/_agents/hooks/check-pairing-incremental.sh +20 -7
- package/templates/_agents/notes/runtime-env.md +1 -1
- package/templates/_agents/roles/implementer.md +2 -0
- package/templates/_agents/roles/independent-reviewer.md +2 -0
- package/templates/_agents/roles/ui-verifier.md +2 -0
- package/templates/_agents/rule-budgets.txt +1 -1
- package/templates/_agents/scripts/agg-delegations.cjs +39 -30
- package/templates/_agents/scripts/agg-delegations.test.mjs +32 -0
- package/templates/_agents/scripts/check-loop.mjs +763 -0
- package/templates/_agents/scripts/check-loop.sh +5 -808
- package/templates/_agents/scripts/check-loop.test.mjs +1102 -0
- package/templates/_agents/scripts/confirm-doc.mjs +228 -0
- package/templates/_agents/scripts/confirm-doc.test.mjs +321 -0
- package/templates/_agents/scripts/doctor.test.mjs +371 -0
- package/templates/_agents/scripts/ensure-board.mjs +30 -3
- package/templates/_agents/scripts/fill-intent.mjs +59 -0
- package/templates/_agents/scripts/fill-intent.test.mjs +73 -0
- package/templates/_agents/scripts/fill-plan.mjs +60 -0
- package/templates/_agents/scripts/fill-plan.test.mjs +67 -0
- package/templates/_agents/scripts/fill-spec.mjs +52 -0
- package/templates/_agents/scripts/fill-spec.test.mjs +61 -0
- package/templates/_agents/scripts/gate-checklist.mjs +194 -0
- package/templates/_agents/scripts/gate-checklist.test.mjs +204 -0
- package/templates/_agents/scripts/gen-wiki-board.mjs +38 -24
- package/templates/_agents/scripts/gen-wiki-board.test.mjs +18 -0
- package/templates/_agents/scripts/gen-workflow-index.mjs +4 -2
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +12 -3
- package/templates/_agents/scripts/kb-search.mjs +25 -9
- package/templates/_agents/scripts/kb-search.test.mjs +38 -8
- package/templates/_agents/scripts/source-sync-check.mjs +145 -0
- package/templates/_agents/scripts/source-sync-check.test.mjs +244 -0
- package/templates/_agents/scripts/verify-wiki-consistency.mjs +46 -23
- package/templates/_agents/scripts/verify.mjs +8 -10
- package/templates/_agents/scripts/verify.test.mjs +13 -1
- package/templates/_agents/scripts/wf-journal.mjs +158 -0
- package/templates/_agents/scripts/wf-journal.test.mjs +150 -0
- package/templates/_agents/scripts/workflow-board-server.mjs +73 -17
- package/templates/_agents/scripts/workflow-board-server.test.mjs +136 -0
- package/templates/_agents/scripts/workflow-enums.mjs +70 -0
- package/templates/_agents/scripts/workflow-enums.test.mjs +110 -0
- package/templates/_agents/scripts/workflows-check.mjs +260 -0
- package/templates/_agents/scripts/workflows-check.test.mjs +267 -0
- package/templates/_agents/workflow-enums.txt +19 -0
- package/templates/_agents/workflows/_TEMPLATE.md +75 -0
- package/templates/_agents/workflows/pipeline-closing.md +29 -0
- package/templates/_agents/workflows/source-sync-repair.md +30 -0
- package/templates/_agents/workflows/steps//347/244/272/344/276/213-/351/203/250/347/275/262/351/252/214/350/257/201.md +10 -0
- package/templates/_agents/workflows//347/244/272/344/276/213-/345/271/266/350/241/214/345/256/236/347/216/260/350/257/204/345/256/241.md +16 -0
- package/templates/_githooks/pre-commit +16 -1
- package/templates/workflow/README.md +1 -1
- package/templates/_agents/cache/kb-index.json +0 -1
- package/templates/_agents/scripts/check-loop.test.sh +0 -1042
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: source-sync-repair
|
|
3
|
+
description: 装户面双源漂移修复专项——跑 source-sync-check 看 4 类差异(缺失 / 孤儿 / 漂移 / frontmatter-only-diff)→ 按 B-b 决策方向修齐(包源 → 装副本同步)→ 重跑确认 0 差异 → 走 pipeline-closing 标准关单。基于 F 环节真实过程沉淀
|
|
4
|
+
concurrency: 2
|
|
5
|
+
---
|
|
6
|
+
# workflow — source-sync-repair(装户面双源漂移修复)
|
|
7
|
+
|
|
8
|
+
> 双源结构(`templates/_agents/` 包源 + `.agents/` 装副本)的差异修复。F 环节(2026-09-25-fix-double-source-drift)首次实测发现 5 个真实差异并闭环,本文件(custom)把修复路径固化为可复用编排。所有 stage 用 role 派单 + gate 终端两种形态——不引新 step。
|
|
9
|
+
|
|
10
|
+
| id | after | role | step | task / params | files(授权) | accept(验收判据) | gate | retries |
|
|
11
|
+
|----|-------|------|------|---------------|---------------|-------------------|------|---------|
|
|
12
|
+
| scan-diff | — | implementer | — | 跑 source-sync-check --diff(首次摸底) | .agents/scripts/source-sync-check.mjs | 输出 4 类差异报告(缺失 / 孤儿 / 漂移 / frontmatter-only-diff),无 error | | 0 |
|
|
13
|
+
| classify | scan-diff | implementer | — | 按差异类型分类:缺失/漂移走 repair;孤儿走白名单扩展或装副本删除;frontmatter-only-diff 走角色契约确认 | workflow/intents/<date>-fix-double-source-drift.md | intent 立 draft + 4 段改动面(漂移修复 / 白名单 / 测试 / docs)+ 9 条验收标准 | | 0 |
|
|
14
|
+
| repair | classify | implementer | — | 按 intent 改动面修漂移:包源 → 装副本同步;白名单 RENDER_OUTPUT_FILES 扩展(含 hooks/commit-check.config.json 等 init 渲染产物);test.mjs 新增 S8/S9 场景;双源纪律(包源改了装副本手动同步) | 见 intent | source-sync-check --diff 报告漂移数减少;双源文件 sha 一致 | | 1 |
|
|
15
|
+
| gate-rescan | repair | — | — | — | — | — | node .agents/scripts/source-sync-check.mjs --diff(必须 0 差异) | |
|
|
16
|
+
| sync-refresh | gate-rescan | implementer | — | 跑 flow-kit sync 刷台账(owned 哈希按盘面自愈) | .agents/kit.json | sync exit 0;doctor 报 owned 漂移已自愈 | | 0 |
|
|
17
|
+
| feat-commit | sync-refresh | implementer | — | 提交 feat commit(fix(模块名)) | 工作区所有变更文件 | pre-commit 钩子全过;commit message 含 4 段改动面 + 白名单扩展 | | 0 |
|
|
18
|
+
| closeout | feat-commit | implementer | — | 走 pipeline-closing 标准关单(intent 8 条验收勾验 + plan → done + docs commit);如有需要新建 wiki/双源漂移修复/README.md 沉淀 | workflow/intents/, workflow/plans/, workflow/INDEX.md, wiki/双源漂移修复/README.md | intent + plan 状态均 done;9 条验收勾验含 commit SHA 证据;wiki 主题更新(如适用) | | 0 |
|
|
19
|
+
|
|
20
|
+
**编排语义**:第 0 层 scan-diff → 第 1 层 classify(差异分诊)→ 第 2 层 repair(按分诊结果修漂移)→ 第 3 层 2 关静态门(gate-rescan + sync-refresh,并行 fan-out)→ 第 4 层 feat-commit → 第 5 层 closeout(复用 pipeline-closing 6 阶段闭环尾段)。失败且 retries > 0 → 重派(全新上下文);gate-rescan 非零 → 中止后续、回到 repair 重派。
|
|
21
|
+
|
|
22
|
+
**与 pipeline-closing 的关系**:source-sync-repair 是 pipeline-closing 的子集(第 3-6 层复用),不重复定义 6 阶段全流程;closeout stage 引用 pipeline-closing 的关单动作。如需完整 6 阶段闭环(含 author / gate-doc / confirm / plan-commit),直接用 pipeline-closing 即可。
|
|
23
|
+
|
|
24
|
+
**白名单扩展协议**(沿用 source-sync-check.mjs 的 RENDER_OUTPUT_FILES):init 渲染产物(`kit.json` / `settings.json` / `hooks/commit-check.config.json`)不属双源结构;新增白名单项必须同时加进 source-sync-check.mjs + test.mjs 新场景,且 gate-rescan 跑通 0 命中才认闭环。
|
|
25
|
+
|
|
26
|
+
**纪律**(先读):
|
|
27
|
+
- 声明随 plan 确认后方可执行;本 workflow 修复必须先立 intent + plan(用 pipeline-closing 的 author stage 起草)。
|
|
28
|
+
- 子智能体不跨确认门、不 commit / push(派单红线行:只改授权文件;缺输入或需偏离 → `BLOCKER:` 停下)。
|
|
29
|
+
- 留痕:每个派单 stage 完成后向 `workflow/delegations.md` 委派结果表追加一行。
|
|
30
|
+
- 解析校验先行:role ∈ `.agents/roles/`、`after` 引用存在且无环——任一不过即拒,不执行。
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
---
|
|
2
|
+
params: env(目标环境,必填);timeout-min(超时分钟,可选,默认 10)
|
|
3
|
+
---
|
|
4
|
+
# 步骤 — 部署验证(示例)
|
|
5
|
+
|
|
6
|
+
> kit steps 扩展点示例:把项目领域动作注册为可被编排脚本引用的步骤。文件名即步骤名;按项目实际改写。
|
|
7
|
+
|
|
8
|
+
1. 跑终端命令:`npm run deploy -- --env <env>`(工作目录 = 项目根);非零即步骤失败,回报 stderr 尾段
|
|
9
|
+
2. 跑冒烟检查:`curl -fsS https://<env>.example.com/healthz`(URL 按项目改写);非零即步骤失败
|
|
10
|
+
3. 回报:部署版本号(取 deploy 输出中的 version 行)+ 冒烟检查结果
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: 示例-并行实现评审
|
|
3
|
+
description: 两域并行实现 → 汇聚过测试门 → 部署验证(step)→ 独立评审(示例,按 plan 改写后使用)
|
|
4
|
+
concurrency: 2
|
|
5
|
+
---
|
|
6
|
+
# workflow — 示例:并行实现评审
|
|
7
|
+
|
|
8
|
+
> 格式示例:三形态各一处(role 派单 / gate / step);id / after / task 按 plan 改写;随 plan 确认后方可执行。机制口径见 `_TEMPLATE.md`。
|
|
9
|
+
|
|
10
|
+
| id | after | role | step | task / params | files(授权) | accept(验收判据) | gate | retries |
|
|
11
|
+
|----|-------|------|------|---------------|--------------|-------------------|------|---------|
|
|
12
|
+
| backend | — | implementer | — | 实现后端改动(示例占位,按 plan 改写) | src/api/** | 项目测试命令通过 | | 0 |
|
|
13
|
+
| frontend | — | implementer | — | 实现前端改动(示例占位,按 plan 改写) | web/** | 项目构建命令通过 | | 0 |
|
|
14
|
+
| gate-all | backend,frontend | — | — | — | — | — | npm test | |
|
|
15
|
+
| deploy-check | gate-all | — | 示例-部署验证 | env=staging | | 部署命令与冒烟 exit 0 | | 0 |
|
|
16
|
+
| review | deploy-check | independent-reviewer | — | 独立评审两域改动是否符合 plan 与验收判据 | | 符合 plan 与判据 | | 0 |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
2
|
# Git 原生 pre-commit hook(经 core.hooksPath 挂载,git 执行、不依赖 agent 客户端)— agentic-flow-kit 通用编排
|
|
3
|
-
# 通用门禁序:闭环配对(增量) → wiki 台账(增量) → 常驻面体积预算(增量) → 项目门禁(local-pre-commit) → 敏感信息扫描+条件构建(commit-check.cjs)
|
|
3
|
+
# 通用门禁序:闭环配对(增量) → wiki 台账(增量) → 常驻面体积预算(增量) → 双源一致性(增量) → 项目门禁(local-pre-commit) → 敏感信息扫描+条件构建(commit-check.cjs)
|
|
4
4
|
# 项目专属门禁(架构红线/业务守卫等)放 .agents/hooks/local-pre-commit——存在即在本钩子内执行,返回非零即阻断提交
|
|
5
5
|
# 合并提交场景由 .githooks/pre-merge-commit 原样转发到本脚本(合并时 git 调的是 pre-merge-commit,
|
|
6
6
|
# 不是 pre-commit)——门禁清单只此一份,避免两处分叉
|
|
@@ -31,6 +31,21 @@ if [ -f .agents/scripts/rule-budget.sh ] && [ -f .agents/rule-budgets.txt ]; the
|
|
|
31
31
|
run_gate "常驻面体积预算" .agents/scripts/rule-budget.sh --staged
|
|
32
32
|
fi
|
|
33
33
|
|
|
34
|
+
# 双源一致性(增量,2026-09-27 audit-gate-hardening):包源 templates/_agents/ 与装副本 .agents/ 须同提交成对。
|
|
35
|
+
# 暂存触及任一侧时跑 source-sync-check --gate(缺失/漂移 exit 1,孤儿只报告)——拦「包源改了装副本没跟」
|
|
36
|
+
# (doctor §4 台账 sha 对此静默:盘面=台账即 PASS;该故障模式曾两次真实发生,见 incidents/2026-09-25-wf-runtime)。
|
|
37
|
+
# 比较工作树而非暂存区(口径沿 check-pairing-incremental 先例):两侧都已改好、分两笔提交时不拦——最终一致即可。
|
|
38
|
+
# 已知边界(复核 P2-2 声明,2026-09-27 gate-hardening-p2-batch):包源删除文件不触发缺失/漂移——装副本残件
|
|
39
|
+
# 退化为「孤儿」只报告不计失败,删包源时须手动同步清理装副本(sync 对 removed 同样仅报告不删盘)。
|
|
40
|
+
# 装户环境(无 templates/_agents/ 包源)自然跳过。
|
|
41
|
+
if [ -d templates/_agents ] && [ -f .agents/scripts/source-sync-check.mjs ] \
|
|
42
|
+
&& git -c core.quotepath=off diff --cached --name-only | grep -qE '^(templates/_agents/|\.agents/)'; then
|
|
43
|
+
if ! node .agents/scripts/source-sync-check.mjs --gate; then
|
|
44
|
+
echo "pre-commit: 双源一致性(增量)未通过,提交已阻止——单边改动先跑 node bin/flow-kit.mjs sync 成对后原路重试" >&2
|
|
45
|
+
exit 1
|
|
46
|
+
fi
|
|
47
|
+
fi
|
|
48
|
+
|
|
34
49
|
# 项目门禁挂载点:.agents/hooks/local-pre-commit(项目自建门禁/门禁模块接线处,存在即执行)
|
|
35
50
|
if [ -f .agents/hooks/local-pre-commit ]; then
|
|
36
51
|
run_gate "项目门禁(local-pre-commit)" .agents/hooks/local-pre-commit
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
**命名一律英文 kebab-case**(如 `2026-09-07-<主题>.md`),**禁中文文件名**——check-loop 对非 ASCII 文件名给 warning。文档内容(标题/正文)不受此限。
|
|
17
17
|
|
|
18
|
-
**文档协议(frontmatter 受限子集)**:四类文档头部一律为 YAML frontmatter(每行 `键: 值`,机器字段唯一来源)——`状态`(intent/spec/plan:draft/approved/done/superseded/cancelled;incident:open/fixed/closed
|
|
18
|
+
**文档协议(frontmatter 受限子集)**:四类文档头部一律为 YAML frontmatter(每行 `键: 值`,机器字段唯一来源)——`状态`(intent/spec/plan:draft/approved/done/superseded/cancelled;incident:open/fixed/closed,**严格枚举,单源 `.agents/workflow-enums.txt`**——check-loop / 看板 / 检索 / fill-* 一律读它,改枚举改那边;附注写 `备注:` 键)、`级别`(L0-L3,同单源)、`日期`/`发现`(YYYY-MM-DD)、`模块`(**新建文档必填**,取值见 `.agents/workflow-modules.txt` 词表,单值取主导模块;存量不回填,AI 触碰时顺手补)、L3 spec 的 `确认结果`/`确认时间`、回填件 `流程: legacy`。**`状态` 迁移须经 `approved`**(确认环节的机器可见态,`done` 只在关单出现):新建的 spec/plan 若已 done 而 git 历史中从未出现行首 `状态: approved`,check-loop 报「确认态缺失」warning。check-loop 只扫 frontmatter 取机器字段(`fm_get` 字段断言),正文不再写「状态:/级别:」行;叙述性字段(独立复核/复盘三件套/验收勾验)仍留正文按节锚定。
|
|
19
19
|
|
|
20
20
|
各子目录内 `_TEMPLATE.md` 为起步模板,复制后填写,不直接改动模板本身。
|
|
21
21
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"fp":"b779761db958797b","files":{"/tmp/kb-search-test-XdDPi6::workflow/intents/2026-09-21-bbb.md":{"st":[1790253784155.5151,270],"kind":"wf","meta":{"状态":"approved","级别":"L1","日期":"2026-09-21","模块":"pipeline"},"title":"乙需求","lines":[[1,"(frontmatter)","---"],[2,"(frontmatter)","状态: approved"],[3,"(frontmatter)","级别: L1"],[4,"(frontmatter)","日期: 2026-09-21"],[5,"(frontmatter)","模块: pipeline"],[6,"(frontmatter)","---"],[7,"(标题)","# INTENT — 乙需求"],[9,"目标","## 目标"],[10,"目标","- 统一口径:编码模板与分类层级,冲突处理见 A/B乙"],[11,"目标",""]]},"/tmp/kb-search-test-XdDPi6::workflow/plans/2026-09-20-ccc.md":{"st":[1790253784155.5151,200],"kind":"wf","meta":{"状态":"approved","级别":"L1","模块":"purchase"},"title":"丙计划","lines":[[1,"(frontmatter)","---"],[2,"(frontmatter)","状态: approved"],[3,"(frontmatter)","级别: L1"],[4,"(frontmatter)","模块: purchase"],[5,"(frontmatter)","---"],[6,"(标题)","# PLAN — 丙计划"],[8,"目标","## 目标"],[9,"目标","- 只讲编码模板,不提另一个词"],[10,"目标",""]]},"/tmp/kb-search-test-XdDPi6::workflow/incidents/2026-09-01-aaa.md":{"st":[1790253784155.5151,270],"kind":"wf","meta":{"状态":"closed","级别":"L2","发现":"2026-09-01","模块":"material"},"title":"甲事故","lines":[[1,"(frontmatter)","---"],[2,"(frontmatter)","状态: closed"],[3,"(frontmatter)","级别: L2"],[4,"(frontmatter)","发现: 2026-09-01"],[5,"(frontmatter)","模块: material"],[6,"(frontmatter)","---"],[7,"(标题)","# INCIDENT — 甲事故"],[9,"目标","## 目标"],[10,"目标","- 统一口径:编码模板与分类层级,冲突处理见 A/B甲"],[11,"目标",""]]},"/tmp/kb-search-test-XdDPi6::wiki/测试主题/说明.md":{"st":[1790253784155.5151,47],"kind":"wiki","lines":[[1,"# 说明"],[2,""],[3,"编码模板的领域知识条目。"],[4,""]]}}}
|