@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,112 @@
|
|
|
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
|
+
|
|
6
|
+
import { promises as fs } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { parseProfileYaml, ProcessVerificationRunner } from '@agentic-sdlc-kit/core';
|
|
9
|
+
import type { VerificationReport } from '@agentic-sdlc-kit/contracts';
|
|
10
|
+
import type { Command, CommandContext, CommandResult } from './types.js';
|
|
11
|
+
|
|
12
|
+
export const verifyCommand: Command = {
|
|
13
|
+
name: 'verify',
|
|
14
|
+
summary: 'Execute deterministic verification commands (tests, lint, typecheck, build).',
|
|
15
|
+
async run(ctx: CommandContext): Promise<CommandResult> {
|
|
16
|
+
if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
|
|
17
|
+
ctx.stdout(formatHelp());
|
|
18
|
+
return { exitCode: 0 };
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const isJson = ctx.argv.includes('--json');
|
|
22
|
+
const isDryRun = ctx.argv.includes('--dry-run');
|
|
23
|
+
const targetArg = ctx.argv.find((a) => !a.startsWith('-'));
|
|
24
|
+
const targetRoot = path.resolve(ctx.cwd, targetArg ?? '.');
|
|
25
|
+
const profilePath = path.join(targetRoot, '.ai-kit', 'project.yml');
|
|
26
|
+
|
|
27
|
+
let yamlContent: string;
|
|
28
|
+
try {
|
|
29
|
+
yamlContent = await fs.readFile(profilePath, 'utf8');
|
|
30
|
+
} catch {
|
|
31
|
+
const msg = `Profile not found at ${profilePath}. Run 'kit init' first.`;
|
|
32
|
+
ctx.stderr(`kit verify: ${msg}\n`);
|
|
33
|
+
return { exitCode: 1, message: msg };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const profileRes = parseProfileYaml(yamlContent);
|
|
37
|
+
if (!profileRes.ok) {
|
|
38
|
+
// Surface the structured issues (e.g. zod paths) when present — a
|
|
39
|
+
// bare "failed schema validation" with no reasons hides the cause.
|
|
40
|
+
const issues = profileRes.error.details?.issues;
|
|
41
|
+
let msg = profileRes.error.message;
|
|
42
|
+
if (Array.isArray(issues) && issues.length > 0) {
|
|
43
|
+
const rendered = issues
|
|
44
|
+
.map((i) => {
|
|
45
|
+
const issue = i as { path?: unknown; message?: unknown };
|
|
46
|
+
const at = typeof issue.path === 'string' && issue.path ? ` at '${issue.path}'` : '';
|
|
47
|
+
return `${at}: ${String(issue.message ?? 'invalid')}`.trim();
|
|
48
|
+
})
|
|
49
|
+
.join('; ');
|
|
50
|
+
msg = `${msg} (${rendered})`;
|
|
51
|
+
}
|
|
52
|
+
ctx.stderr(`kit verify: ${msg}\n`);
|
|
53
|
+
return { exitCode: 1, message: msg };
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const runner = new ProcessVerificationRunner();
|
|
57
|
+
const repRes = await runner.run(profileRes.value, { cwd: targetRoot, dryRun: isDryRun });
|
|
58
|
+
if (!repRes.ok) {
|
|
59
|
+
ctx.stderr(`kit verify: runner error: ${repRes.error.message}\n`);
|
|
60
|
+
return { exitCode: 1, message: repRes.error.message };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const report = repRes.value;
|
|
64
|
+
if (isJson) {
|
|
65
|
+
ctx.stdout(JSON.stringify(report, null, 2) + '\n');
|
|
66
|
+
} else {
|
|
67
|
+
ctx.stdout(formatReportSummary(report));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
return { exitCode: report.status === 'passed' ? 0 : 1 };
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
function formatReportSummary(report: VerificationReport): string {
|
|
75
|
+
const lines: string[] = [
|
|
76
|
+
`Verification Run: ${report.runId}`,
|
|
77
|
+
`Status: ${report.status.toUpperCase()}`,
|
|
78
|
+
`Checks:`,
|
|
79
|
+
];
|
|
80
|
+
for (const c of report.checks) {
|
|
81
|
+
const dur = c.durationMs !== undefined ? ` (${c.durationMs}ms)` : '';
|
|
82
|
+
const cmdStr = c.command ? ` [${c.command.join(' ')}]` : '';
|
|
83
|
+
lines.push(` - ${c.id.padEnd(12)} ${c.status.toUpperCase()}${dur}${cmdStr}`);
|
|
84
|
+
}
|
|
85
|
+
if (report.checks.length === 0) {
|
|
86
|
+
// Zero checks usually means the profile's commands were not parsed.
|
|
87
|
+
// Surface the likely cause instead of a bare BLOCKED.
|
|
88
|
+
lines.push(' (none configured)');
|
|
89
|
+
lines.push('');
|
|
90
|
+
lines.push(' No verification commands were found. Check that');
|
|
91
|
+
lines.push(' .ai-kit/project.yml has a commands section, e.g.:');
|
|
92
|
+
lines.push(' commands:');
|
|
93
|
+
lines.push(' test:');
|
|
94
|
+
lines.push(" - ['node', '--test']");
|
|
95
|
+
}
|
|
96
|
+
return lines.join('\n') + '\n';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function formatHelp(): string {
|
|
100
|
+
return [
|
|
101
|
+
'Usage: kit verify [path] [--dry-run] [--json]',
|
|
102
|
+
'',
|
|
103
|
+
'Execute deterministic verification checks configured in .ai-kit/project.yml.',
|
|
104
|
+
'Commands run with shell: false and bounded timeouts.',
|
|
105
|
+
'',
|
|
106
|
+
'Options:',
|
|
107
|
+
' --dry-run Mark checks as skipped without executing processes',
|
|
108
|
+
' --json Output full machine-readable VerificationReport',
|
|
109
|
+
' --help Show this message',
|
|
110
|
+
'',
|
|
111
|
+
].join('\n');
|
|
112
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// packages/cli/src/commands/version.test.ts
|
|
2
|
+
import { describe, expect, it } from 'vitest';
|
|
3
|
+
import { versionCommand } from './version.js';
|
|
4
|
+
|
|
5
|
+
describe('versionCommand', () => {
|
|
6
|
+
it('returns the version with exit code 0', () => {
|
|
7
|
+
const r = versionCommand.run({ argv: [], cwd: '/', stdout: () => {}, stderr: () => {} });
|
|
8
|
+
expect(r.exitCode).toBe(0);
|
|
9
|
+
expect(r.message).toMatch(/^\d+\.\d+\.\d+$/);
|
|
10
|
+
});
|
|
11
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// packages/cli/src/commands/version.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit --version` / `kit version`. Prints the package version.
|
|
4
|
+
|
|
5
|
+
import { VERSION } from '../application/version.js';
|
|
6
|
+
import type { Command, CommandResult } from './types.js';
|
|
7
|
+
|
|
8
|
+
export const versionCommand: Command = {
|
|
9
|
+
name: 'version',
|
|
10
|
+
summary: 'Print the kit version.',
|
|
11
|
+
run(): CommandResult {
|
|
12
|
+
return { exitCode: 0, message: VERSION };
|
|
13
|
+
},
|
|
14
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
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
|
+
|
|
7
|
+
import { createDispatcher } from './application/dispatcher.js';
|
|
8
|
+
import type { CommandContext } from './commands/types.js';
|
|
9
|
+
|
|
10
|
+
async function main(): Promise<void> {
|
|
11
|
+
const argv = process.argv.slice(2);
|
|
12
|
+
const ctx: CommandContext = {
|
|
13
|
+
argv,
|
|
14
|
+
cwd: process.cwd(),
|
|
15
|
+
stdout: (s: string) => process.stdout.write(s + '\n'),
|
|
16
|
+
stderr: (s: string) => process.stderr.write(s + '\n'),
|
|
17
|
+
};
|
|
18
|
+
const { dispatch } = createDispatcher();
|
|
19
|
+
const result = await dispatch(ctx);
|
|
20
|
+
if (result.message && result.command !== 'help' && result.command !== 'doctor') {
|
|
21
|
+
// help and doctor write their own output; everything else prints the message.
|
|
22
|
+
process.stdout.write(result.message + '\n');
|
|
23
|
+
}
|
|
24
|
+
process.exit(result.exitCode);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
main().catch((e) => {
|
|
28
|
+
process.stderr.write(`kit: internal error: ${String(e)}\n`);
|
|
29
|
+
process.exit(2);
|
|
30
|
+
});
|
|
@@ -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
|
+
|
|
6
|
+
export function formatLine(label: string, value: string, status?: 'ok' | 'fail'): string {
|
|
7
|
+
const tag = status === 'ok' ? '[ok]' : status === 'fail' ? '[FAIL]' : '';
|
|
8
|
+
const pad = ' '.repeat(Math.max(0, 14 - label.length));
|
|
9
|
+
return ` ${label}${pad}${value}${tag ? ` ${tag}` : ''}`;
|
|
10
|
+
}
|