@agentic-sdlc-kit/cli 0.0.0-stage → 0.8.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/LICENSE +21 -0
- package/README.md +32 -2
- package/dist/application/agent/execution-store.d.ts +55 -0
- package/dist/application/agent/execution-store.d.ts.map +1 -0
- package/dist/application/agent/execution-store.js +90 -0
- package/dist/application/agent/execution-store.js.map +1 -0
- package/dist/application/agent/gateway.d.ts +74 -0
- package/dist/application/agent/gateway.d.ts.map +1 -0
- package/dist/application/agent/gateway.js +580 -0
- package/dist/application/agent/gateway.js.map +1 -0
- package/dist/application/agent/index.d.ts +6 -0
- package/dist/application/agent/index.d.ts.map +1 -0
- package/dist/application/agent/index.js +18 -0
- package/dist/application/agent/index.js.map +1 -0
- package/dist/application/agent/orchestrator.d.ts +76 -0
- package/dist/application/agent/orchestrator.d.ts.map +1 -0
- package/dist/application/agent/orchestrator.js +422 -0
- package/dist/application/agent/orchestrator.js.map +1 -0
- package/dist/application/agent/providers/claude-code/claude-argv.d.ts +15 -0
- package/dist/application/agent/providers/claude-code/claude-argv.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/claude-argv.js +98 -0
- package/dist/application/agent/providers/claude-code/claude-argv.js.map +1 -0
- package/dist/application/agent/providers/claude-code/index.d.ts +7 -0
- package/dist/application/agent/providers/claude-code/index.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/index.js +13 -0
- package/dist/application/agent/providers/claude-code/index.js.map +1 -0
- package/dist/application/agent/providers/claude-code/mod-parity.d.ts +15 -0
- package/dist/application/agent/providers/claude-code/mod-parity.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/mod-parity.js +41 -0
- package/dist/application/agent/providers/claude-code/mod-parity.js.map +1 -0
- package/dist/application/agent/providers/claude-code/permission-config.d.ts +59 -0
- package/dist/application/agent/providers/claude-code/permission-config.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/permission-config.js +189 -0
- package/dist/application/agent/providers/claude-code/permission-config.js.map +1 -0
- package/dist/application/agent/providers/claude-code/provider.d.ts +38 -0
- package/dist/application/agent/providers/claude-code/provider.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/provider.js +577 -0
- package/dist/application/agent/providers/claude-code/provider.js.map +1 -0
- package/dist/application/agent/providers/claude-code/resume-store.d.ts +25 -0
- package/dist/application/agent/providers/claude-code/resume-store.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/resume-store.js +120 -0
- package/dist/application/agent/providers/claude-code/resume-store.js.map +1 -0
- package/dist/application/agent/providers/claude-code/stream-parser.d.ts +50 -0
- package/dist/application/agent/providers/claude-code/stream-parser.d.ts.map +1 -0
- package/dist/application/agent/providers/claude-code/stream-parser.js +129 -0
- package/dist/application/agent/providers/claude-code/stream-parser.js.map +1 -0
- package/dist/application/agent/test-fixture.d.ts +15 -0
- package/dist/application/agent/test-fixture.d.ts.map +1 -0
- package/dist/application/agent/test-fixture.js +93 -0
- package/dist/application/agent/test-fixture.js.map +1 -0
- package/dist/application/agent/workspace.d.ts +24 -0
- package/dist/application/agent/workspace.d.ts.map +1 -0
- package/dist/application/agent/workspace.js +139 -0
- package/dist/application/agent/workspace.js.map +1 -0
- package/dist/application/dispatcher.d.ts +13 -0
- package/dist/application/dispatcher.d.ts.map +1 -0
- package/dist/application/dispatcher.js +104 -0
- package/dist/application/dispatcher.js.map +1 -0
- package/dist/application/index.d.ts +5 -0
- package/dist/application/index.d.ts.map +1 -0
- package/dist/application/index.js +6 -0
- package/dist/application/index.js.map +1 -0
- package/dist/application/registry.d.ts +8 -0
- package/dist/application/registry.d.ts.map +1 -0
- package/dist/application/registry.js +17 -0
- package/dist/application/registry.js.map +1 -0
- package/dist/application/version.d.ts +2 -0
- package/dist/application/version.d.ts.map +1 -0
- package/dist/application/version.js +7 -0
- package/dist/application/version.js.map +1 -0
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +68 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/elicit.d.ts +3 -0
- package/dist/commands/elicit.d.ts.map +1 -0
- package/dist/commands/elicit.js +163 -0
- package/dist/commands/elicit.js.map +1 -0
- package/dist/commands/evolve.d.ts +3 -0
- package/dist/commands/evolve.d.ts.map +1 -0
- package/dist/commands/evolve.js +165 -0
- package/dist/commands/evolve.js.map +1 -0
- package/dist/commands/feature.d.ts +13 -0
- package/dist/commands/feature.d.ts.map +1 -0
- package/dist/commands/feature.js +326 -0
- package/dist/commands/feature.js.map +1 -0
- package/dist/commands/fix.d.ts +3 -0
- package/dist/commands/fix.d.ts.map +1 -0
- package/dist/commands/fix.js +61 -0
- package/dist/commands/fix.js.map +1 -0
- package/dist/commands/help.d.ts +4 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/help.js +32 -0
- package/dist/commands/help.js.map +1 -0
- package/dist/commands/index.d.ts +21 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +22 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +90 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/inspect.d.ts +3 -0
- package/dist/commands/inspect.d.ts.map +1 -0
- package/dist/commands/inspect.js +64 -0
- package/dist/commands/inspect.js.map +1 -0
- package/dist/commands/install.d.ts +3 -0
- package/dist/commands/install.d.ts.map +1 -0
- package/dist/commands/install.js +329 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/commands/journal.d.ts +3 -0
- package/dist/commands/journal.d.ts.map +1 -0
- package/dist/commands/journal.js +107 -0
- package/dist/commands/journal.js.map +1 -0
- package/dist/commands/memory.d.ts +3 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +85 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/new.d.ts +3 -0
- package/dist/commands/new.d.ts.map +1 -0
- package/dist/commands/new.js +68 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/next.d.ts +3 -0
- package/dist/commands/next.d.ts.map +1 -0
- package/dist/commands/next.js +107 -0
- package/dist/commands/next.js.map +1 -0
- package/dist/commands/optimize.d.ts +3 -0
- package/dist/commands/optimize.d.ts.map +1 -0
- package/dist/commands/optimize.js +28 -0
- package/dist/commands/optimize.js.map +1 -0
- package/dist/commands/plugin-linker.d.ts +34 -0
- package/dist/commands/plugin-linker.d.ts.map +1 -0
- package/dist/commands/plugin-linker.js +177 -0
- package/dist/commands/plugin-linker.js.map +1 -0
- package/dist/commands/refactor.d.ts +3 -0
- package/dist/commands/refactor.d.ts.map +1 -0
- package/dist/commands/refactor.js +32 -0
- package/dist/commands/refactor.js.map +1 -0
- package/dist/commands/types.d.ts +19 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +7 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/validate-plan.d.ts +3 -0
- package/dist/commands/validate-plan.d.ts.map +1 -0
- package/dist/commands/validate-plan.js +62 -0
- package/dist/commands/validate-plan.js.map +1 -0
- package/dist/commands/validate-spec.d.ts +3 -0
- package/dist/commands/validate-spec.d.ts.map +1 -0
- package/dist/commands/validate-spec.js +62 -0
- package/dist/commands/validate-spec.js.map +1 -0
- package/dist/commands/verify.d.ts +3 -0
- package/dist/commands/verify.d.ts.map +1 -0
- package/dist/commands/verify.js +103 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/commands/version.d.ts +3 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +12 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/output/formatter.d.ts +2 -0
- package/dist/output/formatter.d.ts.map +1 -0
- package/dist/output/formatter.js +10 -0
- package/dist/output/formatter.js.map +1 -0
- package/dist/output/index.d.ts +2 -0
- package/dist/output/index.d.ts.map +1 -0
- package/dist/output/index.js +3 -0
- package/dist/output/index.js.map +1 -0
- package/package.json +37 -3
- package/src/application/agent/execution-store.ts +162 -0
- package/src/application/agent/gateway.test.ts +529 -0
- package/src/application/agent/gateway.ts +744 -0
- package/src/application/agent/index.ts +18 -0
- package/src/application/agent/orchestrator.test.ts +341 -0
- package/src/application/agent/orchestrator.ts +628 -0
- package/src/application/agent/providers/claude-code/claude-argv.ts +119 -0
- package/src/application/agent/providers/claude-code/claude-code-smoke.test.ts +139 -0
- package/src/application/agent/providers/claude-code/fixtures/fake-claude.mjs +125 -0
- package/src/application/agent/providers/claude-code/index.ts +28 -0
- package/src/application/agent/providers/claude-code/mod-parity.ts +50 -0
- package/src/application/agent/providers/claude-code/permission-config.test.ts +221 -0
- package/src/application/agent/providers/claude-code/permission-config.ts +242 -0
- package/src/application/agent/providers/claude-code/provider.test.ts +378 -0
- package/src/application/agent/providers/claude-code/provider.ts +717 -0
- package/src/application/agent/providers/claude-code/resume-store.test.ts +161 -0
- package/src/application/agent/providers/claude-code/resume-store.ts +157 -0
- package/src/application/agent/providers/claude-code/stream-parser.ts +166 -0
- package/src/application/agent/test-fixture.ts +131 -0
- package/src/application/agent/workspace.test.ts +104 -0
- package/src/application/agent/workspace.ts +156 -0
- package/src/application/dispatcher.test.ts +89 -0
- package/src/application/dispatcher.ts +98 -0
- package/src/application/index.ts +5 -0
- package/src/application/registry.ts +24 -0
- package/src/application/version.ts +7 -0
- package/src/commands/clse.test.ts +181 -0
- package/src/commands/doctor.test.ts +29 -0
- package/src/commands/doctor.ts +78 -0
- package/src/commands/elicit.test.ts +111 -0
- package/src/commands/elicit.ts +188 -0
- package/src/commands/evolve.ts +209 -0
- package/src/commands/feature.test.ts +323 -0
- package/src/commands/feature.ts +405 -0
- package/src/commands/fix.test.ts +36 -0
- package/src/commands/fix.ts +69 -0
- package/src/commands/help.test.ts +33 -0
- package/src/commands/help.ts +35 -0
- package/src/commands/index.ts +21 -0
- package/src/commands/init.test.ts +65 -0
- package/src/commands/init.ts +103 -0
- package/src/commands/inspect.test.ts +57 -0
- package/src/commands/inspect.ts +73 -0
- package/src/commands/install.test.ts +61 -0
- package/src/commands/install.ts +375 -0
- package/src/commands/journal.ts +118 -0
- package/src/commands/memory.ts +96 -0
- package/src/commands/new.test.ts +44 -0
- package/src/commands/new.ts +77 -0
- package/src/commands/next.test.ts +241 -0
- package/src/commands/next.ts +124 -0
- package/src/commands/optimize.ts +30 -0
- package/src/commands/plugin-linker.test.ts +139 -0
- package/src/commands/plugin-linker.ts +196 -0
- package/src/commands/refactor.ts +34 -0
- package/src/commands/stack-commands.test.ts +67 -0
- package/src/commands/tier-c-conformance.test.ts +194 -0
- package/src/commands/types.ts +26 -0
- package/src/commands/validate-plan.test.ts +107 -0
- package/src/commands/validate-plan.ts +67 -0
- package/src/commands/validate-spec.test.ts +59 -0
- package/src/commands/validate-spec.ts +68 -0
- package/src/commands/verify.test.ts +117 -0
- package/src/commands/verify.ts +112 -0
- package/src/commands/version.test.ts +11 -0
- package/src/commands/version.ts +14 -0
- package/src/index.ts +30 -0
- package/src/output/formatter.ts +10 -0
- package/src/output/index.ts +2 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface CommandContext {
|
|
2
|
+
argv: ReadonlyArray<string>;
|
|
3
|
+
cwd: string;
|
|
4
|
+
stdout: (s: string) => void;
|
|
5
|
+
stderr: (s: string) => void;
|
|
6
|
+
}
|
|
7
|
+
export interface CommandResult {
|
|
8
|
+
exitCode: number;
|
|
9
|
+
message?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface Command {
|
|
12
|
+
/** Command name as invoked on the CLI: `doctor`, `version`, etc. */
|
|
13
|
+
readonly name: string;
|
|
14
|
+
/** One-line summary for `kit --help`. */
|
|
15
|
+
readonly summary: string;
|
|
16
|
+
/** Run the command. MUST NOT throw; failures return a non-zero exitCode. */
|
|
17
|
+
run(ctx: CommandContext): Promise<CommandResult> | CommandResult;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,MAAM,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,GAAG,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,aAAa,CAAC;CAClE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// packages/cli/src/commands/types.ts
|
|
2
|
+
//
|
|
3
|
+
// Command interface. Every command implements this. The dispatcher
|
|
4
|
+
// (application/dispatcher.ts) is the only place that knows the full
|
|
5
|
+
// command list. Adding a command = adding one file + one registry entry.
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/commands/types.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,EAAE;AACF,mEAAmE;AACnE,oEAAoE;AACpE,yEAAyE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-plan.d.ts","sourceRoot":"","sources":["../../src/commands/validate-plan.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,YAAY,CAAC;AAEzE,eAAO,MAAM,mBAAmB,EAAE,OA8BjC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// packages/cli/src/commands/validate-plan.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit validate-plan [path] [--json]`.
|
|
4
|
+
// Validates an implementation plan against schema, DAG acyclicity, and vertical slices.
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { loadPlan } from '@agentic-sdlc-kit/core';
|
|
7
|
+
export const validatePlanCommand = {
|
|
8
|
+
name: 'validate-plan',
|
|
9
|
+
summary: 'Validate an implementation plan against schema, DAG acyclicity, and task references.',
|
|
10
|
+
async run(ctx) {
|
|
11
|
+
if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
|
|
12
|
+
ctx.stdout(formatHelp());
|
|
13
|
+
return { exitCode: 0 };
|
|
14
|
+
}
|
|
15
|
+
const isJson = ctx.argv.includes('--json');
|
|
16
|
+
const targetArg = ctx.argv.find((a) => !a.startsWith('-'));
|
|
17
|
+
const targetPath = path.resolve(ctx.cwd, targetArg ?? 'docs/plans');
|
|
18
|
+
const res = await loadPlan(targetPath);
|
|
19
|
+
if (!res.ok) {
|
|
20
|
+
if (isJson) {
|
|
21
|
+
ctx.stdout(JSON.stringify({ valid: false, error: res.error }, null, 2) + '\n');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ctx.stderr(`kit validate-plan: FAIL: ${res.error.message}\n`);
|
|
25
|
+
}
|
|
26
|
+
return { exitCode: 1, message: res.error.message };
|
|
27
|
+
}
|
|
28
|
+
if (isJson) {
|
|
29
|
+
ctx.stdout(JSON.stringify({ valid: true, ...res.value }, null, 2) + '\n');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
ctx.stdout(formatSuccessSummary(res.value));
|
|
33
|
+
}
|
|
34
|
+
return { exitCode: 0 };
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
function formatSuccessSummary(val) {
|
|
38
|
+
const { plan, analysis } = val;
|
|
39
|
+
const highRisk = plan.tasks.filter((t) => t.risk === 'high').length;
|
|
40
|
+
const lines = [
|
|
41
|
+
`kit validate-plan: PASS`,
|
|
42
|
+
`Feature: ${plan.featureId}`,
|
|
43
|
+
`Tasks: ${plan.tasks.length} total (${highRisk} high risk)`,
|
|
44
|
+
`Slices: ${plan.verticalSlices.length} vertical slices`,
|
|
45
|
+
`Execution DAG: ${analysis.executionOrder.join(' -> ')}`,
|
|
46
|
+
];
|
|
47
|
+
return lines.join('\n') + '\n';
|
|
48
|
+
}
|
|
49
|
+
function formatHelp() {
|
|
50
|
+
return [
|
|
51
|
+
'Usage: kit validate-plan [path] [--json]',
|
|
52
|
+
'',
|
|
53
|
+
'Validate an implementation plan for schema compliance, task dependency integrity,',
|
|
54
|
+
'and acyclic execution order.',
|
|
55
|
+
'',
|
|
56
|
+
'Options:',
|
|
57
|
+
' --json Output machine-readable validation result',
|
|
58
|
+
' --help Show this message',
|
|
59
|
+
'',
|
|
60
|
+
].join('\n');
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=validate-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-plan.js","sourceRoot":"","sources":["../../src/commands/validate-plan.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,uCAAuC;AACvC,wFAAwF;AAExF,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAA6B,MAAM,wBAAwB,CAAC;AAG7E,MAAM,CAAC,MAAM,mBAAmB,GAAY;IAC1C,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,sFAAsF;IAC/F,KAAK,CAAC,GAAG,CAAC,GAAmB;QAC3B,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE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CAAC,MAAM,CAAC,oBAAoB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;IACzB,CAAC;CACF,CAAC;AAEF,SAAS,oBAAoB,CAAC,GAAyB;IACrD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC;IAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,MAAM,CAAC;IACpE,MAAM,KAAK,GAAa;QACtB,yBAAyB;QACzB,kBAAkB,IAAI,CAAC,SAAS,EAAE;QAClC,kBAAkB,IAAI,CAAC,KAAK,CAAC,MAAM,WAAW,QAAQ,aAAa;QACnE,kBAAkB,IAAI,CAAC,cAAc,CAAC,MAAM,kBAAkB;QAC9D,kBAAkB,QAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;KACzD,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,SAAS,UAAU;IACjB,OAAO;QACL,0CAA0C;QAC1C,EAAE;QACF,mFAAmF;QACnF,8BAA8B;QAC9B,EAAE;QACF,UAAU;QACV,uDAAuD;QACvD,+BAA+B;QAC/B,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-spec.d.ts","sourceRoot":"","sources":["../../src/commands/validate-spec.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,YAAY,CAAC;AAEzE,eAAO,MAAM,mBAAmB,EAAE,OA8BjC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// packages/cli/src/commands/validate-spec.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit validate-spec [path] [--json]`.
|
|
4
|
+
// Validates a feature specification against schema, acceptance criteria, and scope rules.
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { loadSpecification } from '@agentic-sdlc-kit/core';
|
|
7
|
+
export const validateSpecCommand = {
|
|
8
|
+
name: 'validate-spec',
|
|
9
|
+
summary: 'Validate a feature specification against schema, quality, and risk invariants.',
|
|
10
|
+
async run(ctx) {
|
|
11
|
+
if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
|
|
12
|
+
ctx.stdout(formatHelp());
|
|
13
|
+
return { exitCode: 0 };
|
|
14
|
+
}
|
|
15
|
+
const isJson = ctx.argv.includes('--json');
|
|
16
|
+
const targetArg = ctx.argv.find((a) => !a.startsWith('-'));
|
|
17
|
+
const targetPath = path.resolve(ctx.cwd, targetArg ?? 'docs/specifications');
|
|
18
|
+
const res = await loadSpecification(targetPath);
|
|
19
|
+
if (!res.ok) {
|
|
20
|
+
if (isJson) {
|
|
21
|
+
ctx.stdout(JSON.stringify({ valid: false, error: res.error }, null, 2) + '\n');
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
ctx.stderr(`kit validate-spec: FAIL: ${res.error.message}\n`);
|
|
25
|
+
}
|
|
26
|
+
return { exitCode: 1, message: res.error.message };
|
|
27
|
+
}
|
|
28
|
+
if (isJson) {
|
|
29
|
+
ctx.stdout(JSON.stringify({ valid: true, specification: res.value }, null, 2) + '\n');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
ctx.stdout(formatSuccessSummary(res.value));
|
|
33
|
+
}
|
|
34
|
+
return { exitCode: 0 };
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
function formatSuccessSummary(spec) {
|
|
38
|
+
const lines = [
|
|
39
|
+
`kit validate-spec: PASS`,
|
|
40
|
+
`Feature: ${spec.id} - ${spec.title}`,
|
|
41
|
+
`Scope: ${spec.scope.in.length} in-scope, ${spec.scope.out.length} out-of-scope`,
|
|
42
|
+
`Requirements: ${spec.functionalRequirements.length} functional, ${spec.nonFunctionalRequirements.length} non-functional`,
|
|
43
|
+
`Acceptance: ${spec.acceptanceCriteria.length} criteria defined`,
|
|
44
|
+
`Risks: ${spec.risks.length} analyzed (${spec.risks.filter((r) => r.severity === 'high').length} high)`,
|
|
45
|
+
`Open Questions:${spec.openQuestions.length} (${spec.openQuestions.filter((q) => !q.resolved).length} unresolved)`,
|
|
46
|
+
];
|
|
47
|
+
return lines.join('\n') + '\n';
|
|
48
|
+
}
|
|
49
|
+
function formatHelp() {
|
|
50
|
+
return [
|
|
51
|
+
'Usage: kit validate-spec [path] [--json]',
|
|
52
|
+
'',
|
|
53
|
+
'Validate a feature specification (SPEC.md or JSON) for structural completeness,',
|
|
54
|
+
'scope boundaries, ID uniqueness, and risk governance.',
|
|
55
|
+
'',
|
|
56
|
+
'Options:',
|
|
57
|
+
' --json Output machine-readable validation result',
|
|
58
|
+
' --help Show this message',
|
|
59
|
+
'',
|
|
60
|
+
].join('\n');
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=validate-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate-spec.js","sourceRoot":"","sources":["../../src/commands/validate-spec.ts"],"names":[],"mappings":"AAAA,6CAA6C;AAC7C,EAAE;AACF,uCAAuC;AACvC,0FAA0F;AAE1F,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAI3D,MAAM,CAAC,MAAM,mBAAmB,GAAY;IAC1C,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,gFAAgF;IACzF,KAAK,CAAC,GAAG,CAAC,GAAmB;QAC3B,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YAC3D,GAAG,CAAC,MAAM,C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../src/commands/verify.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,YAAY,CAAC;AAEzE,eAAO,MAAM,aAAa,EAAE,OA4D3B,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// packages/cli/src/commands/verify.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit verify [path] [--dry-run] [--json]`.
|
|
4
|
+
// Deterministic verification runner executing configured test, lint, and typecheck commands.
|
|
5
|
+
import { promises as fs } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { parseProfileYaml, ProcessVerificationRunner } from '@agentic-sdlc-kit/core';
|
|
8
|
+
export const verifyCommand = {
|
|
9
|
+
name: 'verify',
|
|
10
|
+
summary: 'Execute deterministic verification commands (tests, lint, typecheck, build).',
|
|
11
|
+
async run(ctx) {
|
|
12
|
+
if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
|
|
13
|
+
ctx.stdout(formatHelp());
|
|
14
|
+
return { exitCode: 0 };
|
|
15
|
+
}
|
|
16
|
+
const isJson = ctx.argv.includes('--json');
|
|
17
|
+
const isDryRun = ctx.argv.includes('--dry-run');
|
|
18
|
+
const targetArg = ctx.argv.find((a) => !a.startsWith('-'));
|
|
19
|
+
const targetRoot = path.resolve(ctx.cwd, targetArg ?? '.');
|
|
20
|
+
const profilePath = path.join(targetRoot, '.ai-kit', 'project.yml');
|
|
21
|
+
let yamlContent;
|
|
22
|
+
try {
|
|
23
|
+
yamlContent = await fs.readFile(profilePath, 'utf8');
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
const msg = `Profile not found at ${profilePath}. Run 'kit init' first.`;
|
|
27
|
+
ctx.stderr(`kit verify: ${msg}\n`);
|
|
28
|
+
return { exitCode: 1, message: msg };
|
|
29
|
+
}
|
|
30
|
+
const profileRes = parseProfileYaml(yamlContent);
|
|
31
|
+
if (!profileRes.ok) {
|
|
32
|
+
// Surface the structured issues (e.g. zod paths) when present — a
|
|
33
|
+
// bare "failed schema validation" with no reasons hides the cause.
|
|
34
|
+
const issues = profileRes.error.details?.issues;
|
|
35
|
+
let msg = profileRes.error.message;
|
|
36
|
+
if (Array.isArray(issues) && issues.length > 0) {
|
|
37
|
+
const rendered = issues
|
|
38
|
+
.map((i) => {
|
|
39
|
+
const issue = i;
|
|
40
|
+
const at = typeof issue.path === 'string' && issue.path ? ` at '${issue.path}'` : '';
|
|
41
|
+
return `${at}: ${String(issue.message ?? 'invalid')}`.trim();
|
|
42
|
+
})
|
|
43
|
+
.join('; ');
|
|
44
|
+
msg = `${msg} (${rendered})`;
|
|
45
|
+
}
|
|
46
|
+
ctx.stderr(`kit verify: ${msg}\n`);
|
|
47
|
+
return { exitCode: 1, message: msg };
|
|
48
|
+
}
|
|
49
|
+
const runner = new ProcessVerificationRunner();
|
|
50
|
+
const repRes = await runner.run(profileRes.value, { cwd: targetRoot, dryRun: isDryRun });
|
|
51
|
+
if (!repRes.ok) {
|
|
52
|
+
ctx.stderr(`kit verify: runner error: ${repRes.error.message}\n`);
|
|
53
|
+
return { exitCode: 1, message: repRes.error.message };
|
|
54
|
+
}
|
|
55
|
+
const report = repRes.value;
|
|
56
|
+
if (isJson) {
|
|
57
|
+
ctx.stdout(JSON.stringify(report, null, 2) + '\n');
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
ctx.stdout(formatReportSummary(report));
|
|
61
|
+
}
|
|
62
|
+
return { exitCode: report.status === 'passed' ? 0 : 1 };
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
function formatReportSummary(report) {
|
|
66
|
+
const lines = [
|
|
67
|
+
`Verification Run: ${report.runId}`,
|
|
68
|
+
`Status: ${report.status.toUpperCase()}`,
|
|
69
|
+
`Checks:`,
|
|
70
|
+
];
|
|
71
|
+
for (const c of report.checks) {
|
|
72
|
+
const dur = c.durationMs !== undefined ? ` (${c.durationMs}ms)` : '';
|
|
73
|
+
const cmdStr = c.command ? ` [${c.command.join(' ')}]` : '';
|
|
74
|
+
lines.push(` - ${c.id.padEnd(12)} ${c.status.toUpperCase()}${dur}${cmdStr}`);
|
|
75
|
+
}
|
|
76
|
+
if (report.checks.length === 0) {
|
|
77
|
+
// Zero checks usually means the profile's commands were not parsed.
|
|
78
|
+
// Surface the likely cause instead of a bare BLOCKED.
|
|
79
|
+
lines.push(' (none configured)');
|
|
80
|
+
lines.push('');
|
|
81
|
+
lines.push(' No verification commands were found. Check that');
|
|
82
|
+
lines.push(' .ai-kit/project.yml has a commands section, e.g.:');
|
|
83
|
+
lines.push(' commands:');
|
|
84
|
+
lines.push(' test:');
|
|
85
|
+
lines.push(" - ['node', '--test']");
|
|
86
|
+
}
|
|
87
|
+
return lines.join('\n') + '\n';
|
|
88
|
+
}
|
|
89
|
+
function formatHelp() {
|
|
90
|
+
return [
|
|
91
|
+
'Usage: kit verify [path] [--dry-run] [--json]',
|
|
92
|
+
'',
|
|
93
|
+
'Execute deterministic verification checks configured in .ai-kit/project.yml.',
|
|
94
|
+
'Commands run with shell: false and bounded timeouts.',
|
|
95
|
+
'',
|
|
96
|
+
'Options:',
|
|
97
|
+
' --dry-run Mark checks as skipped without executing processes',
|
|
98
|
+
' --json Output full machine-readable VerificationReport',
|
|
99
|
+
' --help Show this message',
|
|
100
|
+
'',
|
|
101
|
+
].join('\n');
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=verify.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/commands/verify.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,EAAE;AACF,4CAA4C;AAC5C,6FAA6F;AAE7F,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAIrF,MAAM,CAAC,MAAM,aAAa,GAAY;IACpC,IA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AAC,MAAM,CAAC,WAAW,EAAE,GAAG,GAAG,GAAG,MAAM,EAAE,CAAC,CAAC;IAChF,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,oEAAoE;QACpE,sDAAsD;QACtD,KAAK,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACf,KAAK,CAAC,IAAI,CAAC,mDAAmD,CAAC,CAAC;QAChE,KAAK,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAC;QAClE,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC5B,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACjC,CAAC;AAED,SAAS,UAAU;IACjB,OAAO;QACL,+CAA+C;QAC/C,EAAE;QACF,8EAA8E;QAC9E,sDAAsD;QACtD,EAAE;QACF,UAAU;QACV,kEAAkE;QAClE,+DAA+D;QAC/D,iCAAiC;QACjC,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAiB,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,cAAc,EAAE,OAM5B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// packages/cli/src/commands/version.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit --version` / `kit version`. Prints the package version.
|
|
4
|
+
import { VERSION } from '../application/version.js';
|
|
5
|
+
export const versionCommand = {
|
|
6
|
+
name: 'version',
|
|
7
|
+
summary: 'Print the kit version.',
|
|
8
|
+
run() {
|
|
9
|
+
return { exitCode: 0, message: VERSION };
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/commands/version.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,+DAA+D;AAE/D,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGpD,MAAM,CAAC,MAAM,cAAc,GAAY;IACrC,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,wBAAwB;IACjC,GAAG;QACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC3C,CAAC;CACF,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// packages/cli/src/index.ts
|
|
3
|
+
//
|
|
4
|
+
// `kit` executable entry point. Parses argv, dispatches to a command,
|
|
5
|
+
// prints output, and exits.
|
|
6
|
+
import { createDispatcher } from './application/dispatcher.js';
|
|
7
|
+
async function main() {
|
|
8
|
+
const argv = process.argv.slice(2);
|
|
9
|
+
const ctx = {
|
|
10
|
+
argv,
|
|
11
|
+
cwd: process.cwd(),
|
|
12
|
+
stdout: (s) => process.stdout.write(s + '\n'),
|
|
13
|
+
stderr: (s) => process.stderr.write(s + '\n'),
|
|
14
|
+
};
|
|
15
|
+
const { dispatch } = createDispatcher();
|
|
16
|
+
const result = await dispatch(ctx);
|
|
17
|
+
if (result.message && result.command !== 'help' && result.command !== 'doctor') {
|
|
18
|
+
// help and doctor write their own output; everything else prints the message.
|
|
19
|
+
process.stdout.write(result.message + '\n');
|
|
20
|
+
}
|
|
21
|
+
process.exit(result.exitCode);
|
|
22
|
+
}
|
|
23
|
+
main().catch((e) => {
|
|
24
|
+
process.stderr.write(`kit: internal error: ${String(e)}\n`);
|
|
25
|
+
process.exit(2);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,4BAA4B;AAC5B,EAAE;AACF,sEAAsE;AACtE,4BAA4B;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAG/D,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,GAAG,GAAmB;QAC1B,IAAI;QACJ,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;QAClB,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;QACrD,MAAM,EAAE,CAAC,CAAS,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;KACtD,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACxC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;IACnC,IAAI,MAAM,CAAC,OAAO,IAAI,MAAM,CAAC,OAAO,KAAK,MAAM,IAAI,MAAM,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC/E,8EAA8E;QAC9E,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACjB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAKA,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAIvF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// packages/cli/src/output/formatter.ts
|
|
2
|
+
//
|
|
3
|
+
// Minimal output formatter. M1 keeps this trivial; later milestones add
|
|
4
|
+
// structured JSON output and machine-readable formats.
|
|
5
|
+
export function formatLine(label, value, status) {
|
|
6
|
+
const tag = status === 'ok' ? '[ok]' : status === 'fail' ? '[FAIL]' : '';
|
|
7
|
+
const pad = ' '.repeat(Math.max(0, 14 - label.length));
|
|
8
|
+
return ` ${label}${pad}${value}${tag ? ` ${tag}` : ''}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/output/formatter.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,wEAAwE;AACxE,uDAAuD;AAEvD,MAAM,UAAU,UAAU,CAAC,KAAa,EAAE,KAAa,EAAE,MAAsB;IAC7E,MAAM,GAAG,GAAG,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IACvD,OAAO,KAAK,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AACA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/output/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,cAAc,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agentic-sdlc-kit/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "The `kit` executable: user-facing entry point for the Agentic SDLC Kit.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"bin": {
|
|
10
|
+
"kit": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"src"
|
|
21
|
+
],
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@agentic-sdlc-kit/contracts": "0.8.0",
|
|
24
|
+
"@agentic-sdlc-kit/core": "0.8.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@agentic-sdlc-kit/testing": "0.8.0",
|
|
28
|
+
"@types/node": "^20.14.0",
|
|
29
|
+
"typescript": "^5.5.0",
|
|
30
|
+
"vitest": "^2.0.0"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "tsc -p tsconfig.json",
|
|
34
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
35
|
+
"test": "vitest run",
|
|
36
|
+
"test:contract": "vitest run src/**/*.test.ts",
|
|
37
|
+
"start": "node dist/index.js",
|
|
38
|
+
"clean": "rm -rf dist *.tsbuildinfo"
|
|
39
|
+
}
|
|
6
40
|
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
// packages/cli/src/application/agent/execution-store.ts
|
|
2
|
+
//
|
|
3
|
+
// Persistence for agent execution records (ADR-0019 v2 revision A, PR3).
|
|
4
|
+
//
|
|
5
|
+
// The gateway — not the provider — owns the durable record of every
|
|
6
|
+
// execution: the ORIGINAL request (frozen before the provider is called,
|
|
7
|
+
// so it can never drift between attempts), the canonical policy snapshot
|
|
8
|
+
// it was granted under, every accepted lifecycle event, an audit trail of
|
|
9
|
+
// rejected/anomalous events, and the final result.
|
|
10
|
+
//
|
|
11
|
+
// SECURITY: resume tokens are CREDENTIALS (ADR-0020 §6). They are NEVER
|
|
12
|
+
// written here. A record that round-trips through this store must not
|
|
13
|
+
// contain a resume token anywhere; the gateway holds them in memory only.
|
|
14
|
+
//
|
|
15
|
+
// Records live at <projectRoot>/.ai-kit/state/agent-executions/<executionId>.json
|
|
16
|
+
// and are written atomically (tmp file + rename), like all kit state.
|
|
17
|
+
|
|
18
|
+
import { promises as fs } from 'node:fs';
|
|
19
|
+
import path from 'node:path';
|
|
20
|
+
import type {
|
|
21
|
+
AgentExecutionEvent,
|
|
22
|
+
AgentExecutionRequest,
|
|
23
|
+
AgentExecutionResult,
|
|
24
|
+
AgentExecutionStatus,
|
|
25
|
+
AgentPolicySnapshot,
|
|
26
|
+
} from '@agentic-sdlc-kit/contracts';
|
|
27
|
+
|
|
28
|
+
/** Terminal-ish lifecycle of a stored execution. */
|
|
29
|
+
export type StoredExecutionStatus =
|
|
30
|
+
| 'pending'
|
|
31
|
+
| 'running'
|
|
32
|
+
| AgentExecutionStatus; // completed | failed | cancelled | timed_out | interrupted | needs_approval
|
|
33
|
+
|
|
34
|
+
/** Why an event was rejected or flagged by the gateway (audit trail). */
|
|
35
|
+
export type EventAuditKind =
|
|
36
|
+
| 'invalid-event' // did not parse against AgentExecutionEventSchema
|
|
37
|
+
| 'wrong-execution-id' // event for a different execution
|
|
38
|
+
| 'policy-hash-mismatch' // echo did not match the frozen policy (fail closed)
|
|
39
|
+
| 'duplicate-event-id' // idempotent persistence skipped a repeat
|
|
40
|
+
| 'sequence-anomaly'; // non-monotonic sequence: gap or regression (stored, but flagged)
|
|
41
|
+
|
|
42
|
+
export interface EventAuditNote {
|
|
43
|
+
readonly kind: EventAuditKind;
|
|
44
|
+
readonly at: string;
|
|
45
|
+
readonly detail: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface StoredAgentExecution {
|
|
49
|
+
readonly executionId: string;
|
|
50
|
+
readonly workflowRunId: string;
|
|
51
|
+
readonly taskId: string;
|
|
52
|
+
readonly providerId: string;
|
|
53
|
+
readonly policyHash: string;
|
|
54
|
+
/** The canonical, versioned policy snapshot frozen for this execution. */
|
|
55
|
+
readonly policySnapshot: AgentPolicySnapshot;
|
|
56
|
+
/** The ORIGINAL request, frozen before the provider was called (rev A). */
|
|
57
|
+
readonly request: AgentExecutionRequest;
|
|
58
|
+
status: StoredExecutionStatus;
|
|
59
|
+
/** 1 for a fresh start; each resume attempt increments. */
|
|
60
|
+
attempts: number;
|
|
61
|
+
/** Accepted (validated, policy-matched) events in arrival order. */
|
|
62
|
+
events: AgentExecutionEvent[];
|
|
63
|
+
/** Rejections and anomalies about individual events — the fail-closed paper trail. */
|
|
64
|
+
eventAudit: EventAuditNote[];
|
|
65
|
+
/** Gateway-level facts: budget breaches, result validation failures, drains. */
|
|
66
|
+
gatewayNotes: string[];
|
|
67
|
+
/** Final result verbatim from the provider, once terminal. */
|
|
68
|
+
result?: AgentExecutionResult;
|
|
69
|
+
/**
|
|
70
|
+
* What the provider reported, when the gateway overrode it (e.g. the
|
|
71
|
+
* duration budget expired after the provider claimed `completed`).
|
|
72
|
+
* Undefined means the gateway accepted the provider's status as-is.
|
|
73
|
+
*/
|
|
74
|
+
providerReportedStatus?: AgentExecutionStatus;
|
|
75
|
+
readonly createdAt: string;
|
|
76
|
+
updatedAt: string;
|
|
77
|
+
completedAt?: string;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/** Execution ids become file names: keep them to safe characters. */
|
|
81
|
+
const EXECUTION_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
82
|
+
|
|
83
|
+
export function validateExecutionId(executionId: string): boolean {
|
|
84
|
+
return EXECUTION_ID_PATTERN.test(executionId);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function executionStoreDir(projectRoot: string): string {
|
|
88
|
+
return path.resolve(projectRoot, '.ai-kit', 'state', 'agent-executions');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export function executionRecordPath(projectRoot: string, executionId: string): string {
|
|
92
|
+
return path.join(executionStoreDir(projectRoot), `${executionId}.json`);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** Atomic save (tmp + rename). Throws on I/O failure — callers decide. */
|
|
96
|
+
export async function saveExecution(
|
|
97
|
+
projectRoot: string,
|
|
98
|
+
execution: StoredAgentExecution,
|
|
99
|
+
): Promise<void> {
|
|
100
|
+
if (!validateExecutionId(execution.executionId)) {
|
|
101
|
+
throw new Error(`refusing to persist execution with unsafe id '${execution.executionId}'`);
|
|
102
|
+
}
|
|
103
|
+
const target = executionRecordPath(projectRoot, execution.executionId);
|
|
104
|
+
await fs.mkdir(path.dirname(target), { recursive: true });
|
|
105
|
+
const tmp = `${target}.tmp`;
|
|
106
|
+
await fs.writeFile(tmp, JSON.stringify(execution, null, 2) + '\n', 'utf8');
|
|
107
|
+
await fs.rename(tmp, target);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export async function loadExecution(
|
|
111
|
+
projectRoot: string,
|
|
112
|
+
executionId: string,
|
|
113
|
+
): Promise<StoredAgentExecution | undefined> {
|
|
114
|
+
if (!validateExecutionId(executionId)) return undefined;
|
|
115
|
+
try {
|
|
116
|
+
const raw = JSON.parse(
|
|
117
|
+
await fs.readFile(executionRecordPath(projectRoot, executionId), 'utf8'),
|
|
118
|
+
) as StoredAgentExecution;
|
|
119
|
+
// Defensive shape check: the record must at least be about the id we
|
|
120
|
+
// asked for. A corrupted record surfaces as undefined (missing), the
|
|
121
|
+
// same as an absent one — the gateway never guesses.
|
|
122
|
+
if (raw.executionId !== executionId || typeof raw.request !== 'object') return undefined;
|
|
123
|
+
return raw;
|
|
124
|
+
} catch {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export async function listExecutionIds(projectRoot: string): Promise<string[]> {
|
|
130
|
+
try {
|
|
131
|
+
const entries = await fs.readdir(executionStoreDir(projectRoot));
|
|
132
|
+
return entries
|
|
133
|
+
.filter((name) => name.endsWith('.json') && !name.endsWith('.tmp.json'))
|
|
134
|
+
.map((name) => name.slice(0, -'.json'.length))
|
|
135
|
+
.filter(validateExecutionId)
|
|
136
|
+
.sort();
|
|
137
|
+
} catch {
|
|
138
|
+
return [];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Scan persisted records for a substring — used by the security test that
|
|
144
|
+
* proves resume tokens never reach disk. Returns the file paths that
|
|
145
|
+
* contain the needle.
|
|
146
|
+
*/
|
|
147
|
+
export async function findInExecutionRecords(
|
|
148
|
+
projectRoot: string,
|
|
149
|
+
needle: string,
|
|
150
|
+
): Promise<string[]> {
|
|
151
|
+
const hits: string[] = [];
|
|
152
|
+
for (const id of await listExecutionIds(projectRoot)) {
|
|
153
|
+
const file = executionRecordPath(projectRoot, id);
|
|
154
|
+
try {
|
|
155
|
+
const content = await fs.readFile(file, 'utf8');
|
|
156
|
+
if (content.includes(needle)) hits.push(file);
|
|
157
|
+
} catch {
|
|
158
|
+
// unreadable record: not a hit for this scan
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return hits;
|
|
162
|
+
}
|