agentic-flow-kit 0.9.1 → 1.0.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 +93 -93
- package/modules/hosts/claude/commands/wf-build.md +3 -3
- package/modules/hosts/claude/commands/wf-design.md +3 -3
- package/modules/hosts/claude/commands/wf-new-task.md +14 -2
- package/modules/hosts/claude/commands/wf-pipeline-run.md +35 -0
- package/modules/hosts/claude/commands/wf-plan.md +3 -3
- package/modules/hosts/claude/commands/wf-sync-hosts.md +1 -1
- package/modules/hosts/claude/commands/wf-test.md +1 -1
- package/modules/hosts/codex/commands/wf-build.md +3 -3
- package/modules/hosts/codex/commands/wf-design.md +3 -3
- package/modules/hosts/codex/commands/wf-new-task.md +14 -2
- package/modules/hosts/codex/commands/wf-pipeline-run.md +35 -0
- package/modules/hosts/codex/commands/wf-plan.md +3 -3
- package/modules/hosts/codex/commands/wf-sync-hosts.md +1 -1
- package/modules/hosts/codex/commands/wf-test.md +1 -1
- package/modules/hosts/cursor/commands/wf-build.md +3 -3
- package/modules/hosts/cursor/commands/wf-design.md +3 -3
- package/modules/hosts/cursor/commands/wf-new-task.md +14 -2
- package/modules/hosts/cursor/commands/wf-pipeline-run.md +35 -0
- package/modules/hosts/cursor/commands/wf-plan.md +3 -3
- package/modules/hosts/cursor/commands/wf-sync-hosts.md +1 -1
- package/modules/hosts/cursor/commands/wf-test.md +1 -1
- package/modules/hosts/opencode/commands/wf-build.md +3 -3
- package/modules/hosts/opencode/commands/wf-design.md +3 -3
- package/modules/hosts/opencode/commands/wf-new-task.md +14 -2
- package/modules/hosts/opencode/commands/wf-pipeline-run.md +35 -0
- package/modules/hosts/opencode/commands/wf-plan.md +3 -3
- package/modules/hosts/opencode/commands/wf-sync-hosts.md +1 -1
- package/modules/hosts/opencode/commands/wf-test.md +1 -1
- package/modules/hosts/trae/commands/wf-build.md +3 -3
- package/modules/hosts/trae/commands/wf-design.md +3 -3
- package/modules/hosts/trae/commands/wf-new-task.md +14 -2
- package/modules/hosts/trae/commands/wf-pipeline-run.md +36 -0
- package/modules/hosts/trae/commands/wf-plan.md +3 -3
- package/modules/hosts/trae/commands/wf-sync-hosts.md +1 -1
- package/modules/hosts/trae/commands/wf-test.md +1 -1
- package/modules/hosts/trae/rules/project-workflow.md +1 -1
- package/package.json +45 -45
- package/templates/_agents/commands/build.md +2 -2
- package/templates/_agents/commands/design.md +1 -1
- package/templates/_agents/commands/new-task.md +1 -0
- package/templates/_agents/commands/pipeline-run.md +43 -0
- package/templates/_agents/commands/plan.md +3 -3
- package/templates/_agents/commands/sync-hosts.md +1 -1
- package/templates/_agents/scripts/check-lane-surface.mjs +20 -7
- package/templates/_agents/scripts/check-lane-surface.test.mjs +24 -2
- package/templates/_agents/scripts/check-ledger-invariant.mjs +135 -0
- package/templates/_agents/scripts/check-ledger-invariant.test.mjs +161 -0
- package/templates/_agents/scripts/check-loop.mjs +70 -18
- package/templates/_agents/scripts/check-loop.test.mjs +155 -8
- package/templates/_agents/scripts/confirm-doc.mjs +19 -7
- package/templates/_agents/scripts/confirm-doc.test.mjs +31 -0
- package/templates/_agents/scripts/fill-intent.mjs +1 -1
- package/templates/_agents/scripts/fill-plan.test.mjs +4 -3
- package/templates/_agents/scripts/gate-checklist.mjs +1 -0
- package/templates/_agents/scripts/gen-workflow-metrics.mjs +75 -5
- package/templates/_agents/scripts/gen-workflow-metrics.test.mjs +104 -2
- package/templates/_agents/scripts/pipeline-run.mjs +999 -0
- package/templates/_agents/scripts/pipeline-run.test.mjs +537 -0
- package/templates/_agents/scripts/policy.mjs +1 -0
- package/templates/_agents/scripts/pre-push.test.mjs +8 -1
- package/templates/_agents/scripts/solidify-task.test.mjs +5 -2
- package/templates/_agents/scripts/stage-gates.mjs +29 -6
- package/templates/_agents/scripts/trust-mode.test.mjs +110 -0
- package/templates/_agents/scripts-test-exempt.txt +10 -0
- package/templates/_githooks/pre-commit +12 -0
- package/templates/workflow/README.md +3 -2
- package/templates/workflow/plans/_TEMPLATE.md +1 -1
|
@@ -70,8 +70,12 @@ const readMetrics = (root) => fs.readFileSync(path.join(root, 'workflow', 'metri
|
|
|
70
70
|
run(root, ['--month', '2026-09']);
|
|
71
71
|
run(root, ['--month', '2026-09']);
|
|
72
72
|
let md = readMetrics(root);
|
|
73
|
-
const
|
|
74
|
-
|
|
73
|
+
const funnelMark = '## 闭环漏斗';
|
|
74
|
+
const bodyPart = md.slice(0, md.includes(funnelMark) ? md.indexOf(funnelMark) : undefined);
|
|
75
|
+
const n09 = (bodyPart.match(/^\| 2026-09 \|/gm) || []).length;
|
|
76
|
+
const n09f = ((md.includes(funnelMark) ? md.slice(md.indexOf(funnelMark)) : '').match(/^\| 2026-09 \|/gm) || []).length;
|
|
77
|
+
check('场景 2:同月重跑只保留一行(体量表分段计数)', n09 === 1, `${n09} 行\n${md}`);
|
|
78
|
+
check('场景 2:漏斗表同月 upsert 不重复', n09f === 1, `${n09f} 行\n${md}`);
|
|
75
79
|
run(root, ['--month', '2026-08']);
|
|
76
80
|
md = readMetrics(root);
|
|
77
81
|
const i08 = md.indexOf('| 2026-08 |');
|
|
@@ -114,6 +118,104 @@ const readMetrics = (root) => fs.readFileSync(path.join(root, 'workflow', 'metri
|
|
|
114
118
|
fs.rmSync(root, { recursive: true, force: true });
|
|
115
119
|
}
|
|
116
120
|
|
|
121
|
+
// ---- 闭环漏斗(2026-10-02 ledger-funnel-metrics;口径定义式 = specs/2026-10-02-ledger-funnel-metrics.md)----
|
|
122
|
+
const LROW = (o = {}) => JSON.stringify({
|
|
123
|
+
ts: '2026-10-02T00:00:00.000Z', doc: 'workflow/intents/demo.md', stage: 'approved',
|
|
124
|
+
fingerprint: 'b'.repeat(64), prev: 'draft', source: 'chat-delegated', quote: '确认', ...o,
|
|
125
|
+
});
|
|
126
|
+
// mkfixLedger:在 mkfix 基础上写台账(LROW 已是 JSON 字符串,直接 join——勿再 stringify 双重编码)
|
|
127
|
+
const mkfixLedger = (lines) => {
|
|
128
|
+
const root = mkfix();
|
|
129
|
+
fs.writeFileSync(path.join(root, '.agents', 'confirmations.jsonl'), lines.join('\n') + '\n', 'utf8');
|
|
130
|
+
return root;
|
|
131
|
+
};
|
|
132
|
+
{
|
|
133
|
+
// L1:一次通过(approved→done 同月)→ 收口 1 / 完整链 1 / 一次通过 1 / 周期 1.0 天
|
|
134
|
+
const root = mkfixLedger([
|
|
135
|
+
LROW({ ts: '2026-10-01T00:00:00.000Z' }),
|
|
136
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z', stage: 'done', prev: 'approved' }),
|
|
137
|
+
]);
|
|
138
|
+
const r = run(root, ['--month', '2026-10']);
|
|
139
|
+
const md = readMetrics(root);
|
|
140
|
+
check('漏斗 L1 一次通过:| 2026-10 | 1 | 1 | 0 | 1 | 0 | 1.0 | 2 |',
|
|
141
|
+
r.status === 0 && /\| 2026-10 \| 1 \| 1 \| 0 \| 1 \| 0 \| 1\.0 \| 2 \|/.test(md), `${r.stdout}${md}`);
|
|
142
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
143
|
+
}
|
|
144
|
+
{
|
|
145
|
+
// L2:revert 行(回退后重走)→ 返工件
|
|
146
|
+
const root = mkfixLedger([
|
|
147
|
+
LROW({ ts: '2026-10-01T00:00:00.000Z', stage: 'revert-draft', fingerprint: 'n/a', prev: 'approved' }),
|
|
148
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z' }),
|
|
149
|
+
LROW({ ts: '2026-10-03T00:00:00.000Z', stage: 'done', prev: 'approved' }),
|
|
150
|
+
]);
|
|
151
|
+
const r = run(root, ['--month', '2026-10']);
|
|
152
|
+
const md = readMetrics(root);
|
|
153
|
+
check('漏斗 L2 revert 行 → 返工件 1(周期按首 approved 起算 1.0 天)',
|
|
154
|
+
r.status === 0 && /\| 2026-10 \| 1 \| 1 \| 0 \| 0 \| 1 \| 1\.0 \| 3 \|/.test(md), `${r.stdout}${md}`);
|
|
155
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
156
|
+
}
|
|
157
|
+
{
|
|
158
|
+
// L3:重确认(两次 approved)→ 返工件
|
|
159
|
+
const root = mkfixLedger([
|
|
160
|
+
LROW({ ts: '2026-10-01T00:00:00.000Z' }),
|
|
161
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z', quote: '重确认' }),
|
|
162
|
+
LROW({ ts: '2026-10-03T00:00:00.000Z', stage: 'done', prev: 'approved' }),
|
|
163
|
+
]);
|
|
164
|
+
const r = run(root, ['--month', '2026-10']);
|
|
165
|
+
const md = readMetrics(root);
|
|
166
|
+
check('漏斗 L3 两次 approved → 返工件 1',
|
|
167
|
+
r.status === 0 && /\| 2026-10 \| 1 \| 1 \| 0 \| 0 \| 1 \| 2\.0 \| 3 \|/.test(md), `${r.stdout}${md}`);
|
|
168
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
169
|
+
}
|
|
170
|
+
{
|
|
171
|
+
// L4:协议前(首行即终态,无 approved)→ 协议前 1(不计一次通过分母)
|
|
172
|
+
const root = mkfixLedger([
|
|
173
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z', stage: 'done', prev: 'approved' }),
|
|
174
|
+
]);
|
|
175
|
+
const r = run(root, ['--month', '2026-10']);
|
|
176
|
+
const md = readMetrics(root);
|
|
177
|
+
check('漏斗 L4 协议前 → | 1 | 0 | 1 | 0 | 0 |',
|
|
178
|
+
r.status === 0 && /\| 2026-10 \| 1 \| 0 \| 1 \| 0 \| 0 \| 0\.0 \| 1 \|/.test(md), `${r.stdout}${md}`);
|
|
179
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
180
|
+
}
|
|
181
|
+
{
|
|
182
|
+
// L5:incident 两跳(fixed→closed = incident 确认链,复核 P2-3 收口)→ 完整链一次通过
|
|
183
|
+
const root = mkfixLedger([
|
|
184
|
+
LROW({ ts: '2026-10-01T00:00:00.000Z', doc: 'workflow/incidents/inc.md', stage: 'fixed' }),
|
|
185
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z', doc: 'workflow/incidents/inc.md', stage: 'closed', prev: 'fixed' }),
|
|
186
|
+
]);
|
|
187
|
+
const r = run(root, ['--month', '2026-10']);
|
|
188
|
+
const md = readMetrics(root);
|
|
189
|
+
check('漏斗 L5 incident 两跳确认链 → 完整链 1 / 一次通过 1 / 周期 1.0',
|
|
190
|
+
r.status === 0 && /\| 2026-10 \| 1 \| 1 \| 0 \| 1 \| 0 \| 1\.0 \|/.test(md), `${r.stdout}${md}`);
|
|
191
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
192
|
+
}
|
|
193
|
+
{
|
|
194
|
+
// L7:incident 单行 closed(存量补关,无确认链)→ 协议前
|
|
195
|
+
const root = mkfixLedger([
|
|
196
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z', doc: 'workflow/incidents/old.md', stage: 'closed', prev: 'fixed' }),
|
|
197
|
+
]);
|
|
198
|
+
const r = run(root, ['--month', '2026-10']);
|
|
199
|
+
const md = readMetrics(root);
|
|
200
|
+
check('漏斗 L7 incident 单行 closed → 协议前 1',
|
|
201
|
+
r.status === 0 && /\| 2026-10 \| 1 \| 0 \| 1 \| 0 \| 0 \|/.test(md), `${r.stdout}${md}`);
|
|
202
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
203
|
+
}
|
|
204
|
+
{
|
|
205
|
+
// L6:跨月收口(9 月 approved、10 月 done)→ 归桶 10 月;9 月只计台账行
|
|
206
|
+
const root = mkfixLedger([
|
|
207
|
+
LROW({ ts: '2026-09-30T00:00:00.000Z' }),
|
|
208
|
+
LROW({ ts: '2026-10-02T00:00:00.000Z', stage: 'done', prev: 'approved' }),
|
|
209
|
+
]);
|
|
210
|
+
const rSep = run(root, ['--month', '2026-09']);
|
|
211
|
+
const rOct = run(root, ['--month', '2026-10']);
|
|
212
|
+
const md = readMetrics(root);
|
|
213
|
+
check('漏斗 L6 跨月收口归桶 10 月(9 月零收口 + 台账行 1)',
|
|
214
|
+
rSep.status === 0 && rOct.status === 0 && /\| 2026-09 \| 0 \| 0 \| 0 \| 0 \| 0 \| — \| 1 \|/.test(md)
|
|
215
|
+
&& /\| 2026-10 \| 1 \| 1 \| 0 \| 1 \| 0 \| 2\.0 \| 1 \|/.test(md), `${rSep.stdout}${rOct.stdout}${md}`);
|
|
216
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
217
|
+
}
|
|
218
|
+
|
|
117
219
|
console.log(`\n合计: PASS ${pass} / FAIL ${fail}`);
|
|
118
220
|
if (fail) {
|
|
119
221
|
console.log(`\n${USAGE}`);
|