@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,124 @@
|
|
|
1
|
+
// packages/cli/src/commands/next.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit next [feature-id] [--json]` — the host-driven agent protocol
|
|
4
|
+
// entry point (ADR-0021 §2).
|
|
5
|
+
//
|
|
6
|
+
// A Tier C host (Cursor, AGY, CI, any terminal-capable agent) drives
|
|
7
|
+
// the entire TDD workflow with ONE loop:
|
|
8
|
+
//
|
|
9
|
+
// while true:
|
|
10
|
+
// action = kit next --json
|
|
11
|
+
// if action.requiredAction == 'run.completed': stop
|
|
12
|
+
// act on action.nextInvocation (write test / implement / refactor)
|
|
13
|
+
// run action.nextInvocation
|
|
14
|
+
//
|
|
15
|
+
// The payload is bounded and machine-readable; the evidence gate, not
|
|
16
|
+
// this command, decides what advances. With no feature id, the command
|
|
17
|
+
// resolves the single active run; ambiguity is a blocked exit, never a
|
|
18
|
+
// guess.
|
|
19
|
+
|
|
20
|
+
import path from 'node:path';
|
|
21
|
+
import { computeNextAction, listFeatureRunStates } from '@agentic-sdlc-kit/core';
|
|
22
|
+
import type { NextAction } from '@agentic-sdlc-kit/contracts';
|
|
23
|
+
import type { Command, CommandContext, CommandResult } from './types.js';
|
|
24
|
+
|
|
25
|
+
function fail(ctx: CommandContext, message: string): CommandResult {
|
|
26
|
+
ctx.stderr(`kit next: ${message}\n`);
|
|
27
|
+
return { exitCode: 1, message };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function blocked(ctx: CommandContext, message: string): CommandResult {
|
|
31
|
+
ctx.stderr(`kit next: ${message}\n`);
|
|
32
|
+
return { exitCode: 3, message };
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export const nextCommand: Command = {
|
|
36
|
+
name: 'next',
|
|
37
|
+
summary:
|
|
38
|
+
'Show the next action for the active feature run (host-driven agent protocol, ADR-0021).',
|
|
39
|
+
async run(ctx: CommandContext): Promise<CommandResult> {
|
|
40
|
+
if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
|
|
41
|
+
ctx.stdout(formatHelp());
|
|
42
|
+
return { exitCode: 0 };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
const isJson = ctx.argv.includes('--json');
|
|
46
|
+
const positional = ctx.argv.filter((a) => !a.startsWith('-'));
|
|
47
|
+
const root = path.resolve(ctx.cwd, '.');
|
|
48
|
+
|
|
49
|
+
let featureId = positional[0];
|
|
50
|
+
if (!featureId) {
|
|
51
|
+
const runs = await listFeatureRunStates(root);
|
|
52
|
+
const single = runs[0];
|
|
53
|
+
if (single === undefined) {
|
|
54
|
+
return blocked(
|
|
55
|
+
ctx,
|
|
56
|
+
'no active feature runs — start one with `kit feature <feature-id> start`',
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
if (runs.length > 1) {
|
|
60
|
+
const ids = runs.map((r) => r.featureId).join(', ');
|
|
61
|
+
return blocked(
|
|
62
|
+
ctx,
|
|
63
|
+
`multiple active feature runs (${ids}) — specify one: \`kit next <feature-id>\``,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
featureId = single.featureId;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const res = await computeNextAction({ projectRoot: root, featureId });
|
|
70
|
+
if (!res.ok) return fail(ctx, res.error.message);
|
|
71
|
+
const action = res.value;
|
|
72
|
+
|
|
73
|
+
if (isJson) {
|
|
74
|
+
ctx.stdout(JSON.stringify(action, null, 2) + '\n');
|
|
75
|
+
return { exitCode: 0 };
|
|
76
|
+
}
|
|
77
|
+
ctx.stdout(formatHuman(action));
|
|
78
|
+
return { exitCode: 0 };
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
function formatHuman(action: NextAction): string {
|
|
83
|
+
const lines: string[] = [
|
|
84
|
+
`${action.featureId} (${action.status}): ${
|
|
85
|
+
action.taskId ? `${action.taskId} ${action.phase}` : action.requiredAction
|
|
86
|
+
}`,
|
|
87
|
+
`Next: ${action.nextInvocation}`,
|
|
88
|
+
];
|
|
89
|
+
if (action.verificationCommand.length > 0) {
|
|
90
|
+
lines.push(`Verify with: ${action.verificationCommand.join(' ')}`);
|
|
91
|
+
}
|
|
92
|
+
if (action.blockingQuestions.length > 0) {
|
|
93
|
+
lines.push('Waiting on a human:');
|
|
94
|
+
for (const q of action.blockingQuestions) lines.push(` - ${q}`);
|
|
95
|
+
}
|
|
96
|
+
if (action.advisoryLessons.length > 0) {
|
|
97
|
+
lines.push('Advisory lessons (advice only, never authority):');
|
|
98
|
+
for (const lesson of action.advisoryLessons) lines.push(` - ${lesson.summary}`);
|
|
99
|
+
}
|
|
100
|
+
return lines.join('\n') + '\n';
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function formatHelp(): string {
|
|
104
|
+
return [
|
|
105
|
+
'Usage: kit next [feature-id] [--json]',
|
|
106
|
+
'',
|
|
107
|
+
'Show the next action for the active feature run — the host-driven agent',
|
|
108
|
+
'protocol entry point (ADR-0021). Tier C hosts (Cursor, AGY, CI) loop:',
|
|
109
|
+
'kit next --json, act, run nextInvocation, repeat.',
|
|
110
|
+
'',
|
|
111
|
+
'With no feature id: uses the single active run; zero or multiple active',
|
|
112
|
+
'runs are a blocked exit (3), never a guess.',
|
|
113
|
+
'',
|
|
114
|
+
'Options:',
|
|
115
|
+
' --json output the machine-readable NextAction payload',
|
|
116
|
+
' --help Show this message',
|
|
117
|
+
'',
|
|
118
|
+
'Exit codes:',
|
|
119
|
+
' 0 action resolved',
|
|
120
|
+
' 1 error (corrupt state, diverged plan)',
|
|
121
|
+
' 3 blocked: no active run, or multiple runs without a feature id',
|
|
122
|
+
'',
|
|
123
|
+
].join('\n');
|
|
124
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// packages/cli/src/commands/optimize.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit optimize` — informational. The /kit:optimize workflow is an
|
|
4
|
+
// optional M9 extension (post-M7 §3.3). Declared in 0.6.0; full state
|
|
5
|
+
// machine lands in a later release.
|
|
6
|
+
|
|
7
|
+
import type { Command, CommandContext, CommandResult } from './types.js';
|
|
8
|
+
|
|
9
|
+
export const optimizeCommand: Command = {
|
|
10
|
+
name: 'optimize',
|
|
11
|
+
summary: 'Show how to start a performance optimization workflow (/kit:optimize).',
|
|
12
|
+
run(ctx: CommandContext): CommandResult {
|
|
13
|
+
const lines: string[] = [];
|
|
14
|
+
lines.push('kit optimize — Performance optimization workflow (M9 optional)');
|
|
15
|
+
lines.push('');
|
|
16
|
+
lines.push('Status: declared in 0.6.0; full workflow lands in a later release.');
|
|
17
|
+
lines.push('');
|
|
18
|
+
lines.push('Expected lifecycle:');
|
|
19
|
+
lines.push(' define problem → establish baseline → profile bottleneck →');
|
|
20
|
+
lines.push(' propose alternatives → define measurable targets →');
|
|
21
|
+
lines.push(' implement one change at a time → benchmark → correctness +');
|
|
22
|
+
lines.push(' regression tests');
|
|
23
|
+
lines.push('');
|
|
24
|
+
lines.push('INVARIANT: performance optimization requires baseline');
|
|
25
|
+
lines.push('measurements. The kit will not propose an optimization');
|
|
26
|
+
lines.push('without an established baseline.');
|
|
27
|
+
ctx.stdout(lines.join('\n'));
|
|
28
|
+
return { exitCode: 0 };
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// packages/cli/src/commands/plugin-linker.test.ts
|
|
2
|
+
//
|
|
3
|
+
// Tests the runtime plugin linking introduced to make `kit install` do what
|
|
4
|
+
// docs/HOST_INTEGRATIONS.md documents: the four guard plugins land in
|
|
5
|
+
// <project>/.claude/plugins/ with hooks module paths that actually resolve.
|
|
6
|
+
//
|
|
7
|
+
// The shipped manifests declare `./register.ts` (TypeScript source, loaded
|
|
8
|
+
// directly by Claude Code — no build step), so the fixtures below write a
|
|
9
|
+
// register.ts source file, not a dist bundle.
|
|
10
|
+
import { promises as fs } from 'node:fs';
|
|
11
|
+
import os from 'node:os';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import { describe, expect, it } from 'vitest';
|
|
14
|
+
import {
|
|
15
|
+
RUNTIME_PLUGIN_NAMES,
|
|
16
|
+
linkRuntimePlugins,
|
|
17
|
+
resolveKitPluginsDir,
|
|
18
|
+
validatePluginHooks,
|
|
19
|
+
} from './plugin-linker.js';
|
|
20
|
+
|
|
21
|
+
async function makeFakeKit(kitRoot: string, complete: boolean): Promise<void> {
|
|
22
|
+
for (const name of RUNTIME_PLUGIN_NAMES) {
|
|
23
|
+
const pluginDir = path.join(kitRoot, 'plugins', name);
|
|
24
|
+
await fs.mkdir(path.join(pluginDir, '.claude-plugin'), { recursive: true });
|
|
25
|
+
await fs.mkdir(path.join(pluginDir, 'hooks'), { recursive: true });
|
|
26
|
+
await fs.writeFile(
|
|
27
|
+
path.join(pluginDir, '.claude-plugin', 'plugin.json'),
|
|
28
|
+
JSON.stringify({ name, version: '0.8.0', description: `${name} test plugin` }),
|
|
29
|
+
'utf8',
|
|
30
|
+
);
|
|
31
|
+
await fs.writeFile(
|
|
32
|
+
path.join(pluginDir, 'hooks', 'hooks.json'),
|
|
33
|
+
JSON.stringify({ description: `${name} hooks`, modules: ['./register.ts'] }),
|
|
34
|
+
'utf8',
|
|
35
|
+
);
|
|
36
|
+
if (complete) {
|
|
37
|
+
// The shipped layout: TypeScript source inside hooks/, committed.
|
|
38
|
+
await fs.writeFile(
|
|
39
|
+
path.join(pluginDir, 'hooks', 'register.ts'),
|
|
40
|
+
'export function register(): void {}\n',
|
|
41
|
+
'utf8',
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe('plugin-linker', () => {
|
|
48
|
+
it('links all four plugins and the hooks modules resolve through the link', async () => {
|
|
49
|
+
const kitRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-kitroot-'));
|
|
50
|
+
const project = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-project-'));
|
|
51
|
+
try {
|
|
52
|
+
await makeFakeKit(kitRoot, true);
|
|
53
|
+
const results = await linkRuntimePlugins(project, kitRoot);
|
|
54
|
+
expect(results).toHaveLength(4);
|
|
55
|
+
for (const r of results) {
|
|
56
|
+
expect(r.status).toBe('linked');
|
|
57
|
+
// The declared hooks module must exist THROUGH the project symlink —
|
|
58
|
+
// exactly what the Claude Code plugin validator checks.
|
|
59
|
+
const throughLink = path.resolve(
|
|
60
|
+
path.dirname(r.linkPath),
|
|
61
|
+
path.basename(r.linkPath),
|
|
62
|
+
'hooks/register.ts',
|
|
63
|
+
);
|
|
64
|
+
await expect(fs.access(throughLink)).resolves.toBeUndefined();
|
|
65
|
+
}
|
|
66
|
+
// Idempotent: re-running reports already-linked.
|
|
67
|
+
const again = await linkRuntimePlugins(project, kitRoot);
|
|
68
|
+
for (const r of again) expect(r.status).toBe('already-linked');
|
|
69
|
+
} finally {
|
|
70
|
+
await fs.rm(kitRoot, { recursive: true, force: true });
|
|
71
|
+
await fs.rm(project, { recursive: true, force: true });
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it('reports incomplete (with fix instructions) when the hooks module is missing', async () => {
|
|
76
|
+
const kitRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-kitroot-'));
|
|
77
|
+
const project = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-project-'));
|
|
78
|
+
try {
|
|
79
|
+
await makeFakeKit(kitRoot, false);
|
|
80
|
+
const results = await linkRuntimePlugins(project, kitRoot);
|
|
81
|
+
for (const r of results) {
|
|
82
|
+
expect(r.status).toBe('incomplete');
|
|
83
|
+
expect(r.detail).toContain('incomplete');
|
|
84
|
+
// And crucially: no symlink was created for a broken plugin.
|
|
85
|
+
await expect(fs.lstat(r.linkPath)).rejects.toThrow();
|
|
86
|
+
}
|
|
87
|
+
} finally {
|
|
88
|
+
await fs.rm(kitRoot, { recursive: true, force: true });
|
|
89
|
+
await fs.rm(project, { recursive: true, force: true });
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('validatePluginHooks flags a manifest pointing at a missing module', async () => {
|
|
94
|
+
const kitRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-kitroot-'));
|
|
95
|
+
try {
|
|
96
|
+
await makeFakeKit(kitRoot, false);
|
|
97
|
+
const dir = path.join(kitRoot, 'plugins', 'sdlc-guard');
|
|
98
|
+
const res = await validatePluginHooks(dir);
|
|
99
|
+
expect(res.ok).toBe(false);
|
|
100
|
+
expect(res.missing).toContain('./register.ts');
|
|
101
|
+
} finally {
|
|
102
|
+
await fs.rm(kitRoot, { recursive: true, force: true });
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('validatePluginHooks resolves module paths relative to the hooks/ directory (like Claude Code)', async () => {
|
|
107
|
+
const kitRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-kitroot-'));
|
|
108
|
+
try {
|
|
109
|
+
// A manifest whose path resolves only against hooks/: the module
|
|
110
|
+
// lives next to the manifest, not at the plugin root.
|
|
111
|
+
const pluginDir = path.join(kitRoot, 'plugins', 'sdlc-guard');
|
|
112
|
+
await fs.mkdir(path.join(pluginDir, 'hooks'), { recursive: true });
|
|
113
|
+
await fs.writeFile(
|
|
114
|
+
path.join(pluginDir, 'hooks', 'register.ts'),
|
|
115
|
+
'export function register(): void {}',
|
|
116
|
+
'utf8',
|
|
117
|
+
);
|
|
118
|
+
await fs.writeFile(
|
|
119
|
+
path.join(pluginDir, 'hooks', 'hooks.json'),
|
|
120
|
+
JSON.stringify({ modules: ['./register.ts'] }),
|
|
121
|
+
'utf8',
|
|
122
|
+
);
|
|
123
|
+
const res = await validatePluginHooks(pluginDir);
|
|
124
|
+
expect(res.ok).toBe(true);
|
|
125
|
+
expect(res.missing).toEqual([]);
|
|
126
|
+
} finally {
|
|
127
|
+
await fs.rm(kitRoot, { recursive: true, force: true });
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it('resolveKitPluginsDir returns null for a layout without plugins/', async () => {
|
|
132
|
+
const empty = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-empty-'));
|
|
133
|
+
try {
|
|
134
|
+
expect(resolveKitPluginsDir(empty)).toBeNull();
|
|
135
|
+
} finally {
|
|
136
|
+
await fs.rm(empty, { recursive: true, force: true });
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
});
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// packages/cli/src/commands/plugin-linker.ts
|
|
2
|
+
//
|
|
3
|
+
// Runtime plugin (Mod) linking for `kit install`.
|
|
4
|
+
//
|
|
5
|
+
// The kit ships four Claude Code plugins (model-router, run-observer,
|
|
6
|
+
// sdlc-guard, secret-guard) in `plugins/` of the kit repository. Claude Code
|
|
7
|
+
// discovers them via `<plugin>/.claude-plugin/plugin.json` and loads their
|
|
8
|
+
// hook modules from the paths declared in `hooks/hooks.json`.
|
|
9
|
+
//
|
|
10
|
+
// IMPORTANT (official docs, verified November 2026): module paths in
|
|
11
|
+
// hooks/hooks.json resolve relative to the hooks/ DIRECTORY (where the
|
|
12
|
+
// manifest lives), and Claude Code loads `.ts` hooks modules DIRECTLY —
|
|
13
|
+
// no build step. The shipped manifests therefore declare `./register.ts`
|
|
14
|
+
// (source committed in the repository), so a fresh clone validates as-is.
|
|
15
|
+
//
|
|
16
|
+
// This module:
|
|
17
|
+
// 1. Locates the kit's `plugins/` directory relative to the CLI's own
|
|
18
|
+
// installed location (so it works through `pnpm link --global`).
|
|
19
|
+
// 2. Validates each plugin's hooks module path actually exists, resolved
|
|
20
|
+
// the same way the Claude Code plugin validator resolves it (relative
|
|
21
|
+
// to the hooks/ directory).
|
|
22
|
+
// 3. Creates idempotent symlinks in `<project>/.claude/plugins/<name>`.
|
|
23
|
+
//
|
|
24
|
+
// Per the kit's no-silent-fabrication principle: a plugin whose hooks module
|
|
25
|
+
// is missing is reported as a WARNING with a fix instruction, never silently
|
|
26
|
+
// skipped, and never reported as installed when it is not.
|
|
27
|
+
|
|
28
|
+
import { existsSync, promises as fs } from 'node:fs';
|
|
29
|
+
import path from 'node:path';
|
|
30
|
+
import { fileURLToPath } from 'node:url';
|
|
31
|
+
|
|
32
|
+
export const RUNTIME_PLUGIN_NAMES = [
|
|
33
|
+
'sdlc-guard',
|
|
34
|
+
'secret-guard',
|
|
35
|
+
'model-router',
|
|
36
|
+
'run-observer',
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
export interface PluginLinkResult {
|
|
40
|
+
name: string;
|
|
41
|
+
/** Where the symlink was created (or already existed) inside the project. */
|
|
42
|
+
linkPath: string;
|
|
43
|
+
status: 'linked' | 'already-linked' | 'incomplete' | 'not-found';
|
|
44
|
+
detail?: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Resolve the kit repository's `plugins/` directory from the CLI's own
|
|
49
|
+
* module location. `packages/cli/dist/commands/plugin-linker.js` ->
|
|
50
|
+
* `<repo>/plugins`. Returns null when the layout does not match (e.g. the
|
|
51
|
+
* CLI was installed from a tarball without the plugins).
|
|
52
|
+
*
|
|
53
|
+
* `overrideRoot` exists for tests so they can point at a fake kit layout.
|
|
54
|
+
*/
|
|
55
|
+
export function resolveKitPluginsDir(overrideRoot?: string): string | null {
|
|
56
|
+
if (overrideRoot) {
|
|
57
|
+
const dir = path.join(overrideRoot, 'plugins');
|
|
58
|
+
return existsSync(dir) ? dir : null;
|
|
59
|
+
}
|
|
60
|
+
// this file: <repo>/packages/cli/dist/commands/plugin-linker.js
|
|
61
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
62
|
+
const repoRoot = path.resolve(here, '..', '..', '..', '..');
|
|
63
|
+
const pluginsDir = path.join(repoRoot, 'plugins');
|
|
64
|
+
return existsSync(pluginsDir) ? pluginsDir : null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Validate that the hooks module paths declared by a plugin's
|
|
69
|
+
* `hooks/hooks.json` resolve to real files. Paths resolve relative to the
|
|
70
|
+
* hooks/ directory — the same base the Claude Code plugin validator uses
|
|
71
|
+
* (an easy mistake: relative to the plugin root the same string would point
|
|
72
|
+
* one directory too high).
|
|
73
|
+
*/
|
|
74
|
+
export async function validatePluginHooks(
|
|
75
|
+
pluginDir: string,
|
|
76
|
+
): Promise<{ ok: boolean; missing: string[] }> {
|
|
77
|
+
const hooksDir = path.join(pluginDir, 'hooks');
|
|
78
|
+
const manifestPath = path.join(hooksDir, 'hooks.json');
|
|
79
|
+
let modules: string[] = [];
|
|
80
|
+
try {
|
|
81
|
+
const raw = await fs.readFile(manifestPath, 'utf8');
|
|
82
|
+
const parsed = JSON.parse(raw) as { modules?: unknown };
|
|
83
|
+
if (Array.isArray(parsed.modules)) {
|
|
84
|
+
modules = parsed.modules.filter((m): m is string => typeof m === 'string');
|
|
85
|
+
}
|
|
86
|
+
} catch {
|
|
87
|
+
return { ok: false, missing: [manifestPath] };
|
|
88
|
+
}
|
|
89
|
+
const missing: string[] = [];
|
|
90
|
+
for (const mod of modules) {
|
|
91
|
+
const resolved = path.resolve(hooksDir, mod);
|
|
92
|
+
try {
|
|
93
|
+
await fs.access(resolved);
|
|
94
|
+
} catch {
|
|
95
|
+
missing.push(mod);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return { ok: missing.length === 0, missing };
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Link the runtime plugins into `<project>/.claude/plugins/`.
|
|
103
|
+
* Never throws: every failure is reported per-plugin in the results.
|
|
104
|
+
*/
|
|
105
|
+
export async function linkRuntimePlugins(
|
|
106
|
+
projectRoot: string,
|
|
107
|
+
overrideKitRoot?: string,
|
|
108
|
+
): Promise<PluginLinkResult[]> {
|
|
109
|
+
const pluginsDir = resolveKitPluginsDir(overrideKitRoot);
|
|
110
|
+
const results: PluginLinkResult[] = [];
|
|
111
|
+
|
|
112
|
+
if (!pluginsDir) {
|
|
113
|
+
return RUNTIME_PLUGIN_NAMES.map((name) => ({
|
|
114
|
+
name,
|
|
115
|
+
linkPath: path.join(projectRoot, '.claude', 'plugins', name),
|
|
116
|
+
status: 'not-found' as const,
|
|
117
|
+
detail:
|
|
118
|
+
'kit plugins/ directory not found next to the CLI installation. ' +
|
|
119
|
+
'Link plugins manually (see docs/HOST_INTEGRATIONS.md).',
|
|
120
|
+
}));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const targetBase = path.join(projectRoot, '.claude', 'plugins');
|
|
124
|
+
await fs.mkdir(targetBase, { recursive: true });
|
|
125
|
+
|
|
126
|
+
for (const name of RUNTIME_PLUGIN_NAMES) {
|
|
127
|
+
const pluginDir = path.join(pluginsDir, name);
|
|
128
|
+
const linkPath = path.join(targetBase, name);
|
|
129
|
+
try {
|
|
130
|
+
// Does the plugin source exist at all?
|
|
131
|
+
await fs.access(path.join(pluginDir, '.claude-plugin', 'plugin.json'));
|
|
132
|
+
} catch {
|
|
133
|
+
results.push({
|
|
134
|
+
name,
|
|
135
|
+
linkPath,
|
|
136
|
+
status: 'not-found',
|
|
137
|
+
detail: `plugin source not found at ${pluginDir}`,
|
|
138
|
+
});
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Validate hooks modules BEFORE linking so we never install a plugin
|
|
143
|
+
// whose hook module path is broken (which is what the Claude Code
|
|
144
|
+
// plugin validator would reject). The shipped manifests point at
|
|
145
|
+
// TypeScript source inside the repository, so a missing module means
|
|
146
|
+
// an incomplete plugin directory (bad clone, partial copy) — not a
|
|
147
|
+
// missing build.
|
|
148
|
+
//
|
|
149
|
+
// Note: validatePluginHooks resolves module paths relative to the
|
|
150
|
+
// hooks/ directory — mirroring the real Claude Code validator — so a
|
|
151
|
+
// manifest that passes here also passes `claude plugin validate`.
|
|
152
|
+
const hooks = await validatePluginHooks(pluginDir);
|
|
153
|
+
if (!hooks.ok) {
|
|
154
|
+
results.push({
|
|
155
|
+
name,
|
|
156
|
+
linkPath,
|
|
157
|
+
status: 'incomplete',
|
|
158
|
+
detail:
|
|
159
|
+
`hooks module(s) ${hooks.missing.join(', ')} not found under ${pluginDir}. ` +
|
|
160
|
+
'The plugin directory is incomplete — reinstall or repair the kit repository, then re-run `kit install`.',
|
|
161
|
+
});
|
|
162
|
+
continue;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
// Idempotent linking: replace a symlink we own; keep anything else.
|
|
166
|
+
try {
|
|
167
|
+
const stat = await fs.lstat(linkPath);
|
|
168
|
+
if (stat.isSymbolicLink()) {
|
|
169
|
+
results.push({ name, linkPath, status: 'already-linked' });
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
// A real file/dir already occupies the path: do not clobber it.
|
|
173
|
+
results.push({
|
|
174
|
+
name,
|
|
175
|
+
linkPath,
|
|
176
|
+
status: 'already-linked',
|
|
177
|
+
detail: 'path already exists and is not a kit symlink; left untouched',
|
|
178
|
+
});
|
|
179
|
+
continue;
|
|
180
|
+
} catch {
|
|
181
|
+
// Path does not exist: create the symlink.
|
|
182
|
+
}
|
|
183
|
+
try {
|
|
184
|
+
await fs.symlink(pluginDir, linkPath, 'dir');
|
|
185
|
+
results.push({ name, linkPath, status: 'linked' });
|
|
186
|
+
} catch (err) {
|
|
187
|
+
results.push({
|
|
188
|
+
name,
|
|
189
|
+
linkPath,
|
|
190
|
+
status: 'not-found',
|
|
191
|
+
detail: `failed to create symlink: ${err instanceof Error ? err.message : String(err)}`,
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
return results;
|
|
196
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// packages/cli/src/commands/refactor.ts
|
|
2
|
+
//
|
|
3
|
+
// `kit refactor` — informational. The /kit:refactor workflow is driven
|
|
4
|
+
// by the /kit:refactor slash command in the host runtime.
|
|
5
|
+
|
|
6
|
+
import type { Command, CommandContext, CommandResult } from './types.js';
|
|
7
|
+
|
|
8
|
+
export const refactorCommand: Command = {
|
|
9
|
+
name: 'refactor',
|
|
10
|
+
summary: 'Show how to start a refactoring workflow (/kit:refactor).',
|
|
11
|
+
run(ctx: CommandContext): CommandResult {
|
|
12
|
+
const lines: string[] = [];
|
|
13
|
+
lines.push('kit refactor — Refactoring workflow');
|
|
14
|
+
lines.push('');
|
|
15
|
+
lines.push('The /kit:refactor workflow is driven by your AI assistant.');
|
|
16
|
+
lines.push('');
|
|
17
|
+
lines.push(' /kit:refactor <target module and goal>');
|
|
18
|
+
lines.push('');
|
|
19
|
+
lines.push('Lifecycle (M9):');
|
|
20
|
+
lines.push(' contract → discover-deps → characterization-tests →');
|
|
21
|
+
lines.push(' target-structure → identify-patterns →');
|
|
22
|
+
lines.push(' incremental-refactor → contract-validation →');
|
|
23
|
+
lines.push(' regression-testing → quality-comparison → review');
|
|
24
|
+
lines.push('');
|
|
25
|
+
lines.push('Constraints:');
|
|
26
|
+
lines.push(' - Preserve observable behavior unless behavior changes are');
|
|
27
|
+
lines.push(' explicitly approved.');
|
|
28
|
+
lines.push(' - Establish baseline tests before structural changes.');
|
|
29
|
+
lines.push(' - Do not use a design pattern simply because it exists.');
|
|
30
|
+
lines.push(' - Avoid broad renaming or formatting changes unrelated to the task.');
|
|
31
|
+
ctx.stdout(lines.join('\n'));
|
|
32
|
+
return { exitCode: 0 };
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
// CLI-level check that `kit new` and `kit init` derive commands from the stack
|
|
2
|
+
// pack. Regression: every stack used to receive npm commands.
|
|
3
|
+
import { promises as fs } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
6
|
+
import { makeTempDir, type TempDir } from '@agentic-sdlc-kit/testing';
|
|
7
|
+
import { initCommand } from './init.js';
|
|
8
|
+
import { newCommand } from './new.js';
|
|
9
|
+
import type { CommandContext } from './types.js';
|
|
10
|
+
|
|
11
|
+
const ctxFor = (argv: string[], cwd: string): CommandContext & { out: string[]; err: string[] } => {
|
|
12
|
+
const out: string[] = [];
|
|
13
|
+
const err: string[] = [];
|
|
14
|
+
return { argv, cwd, stdout: (s) => void out.push(s), stderr: (s) => void err.push(s), out, err };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
describe('kit new / kit init stack commands', () => {
|
|
18
|
+
let dir: TempDir;
|
|
19
|
+
beforeEach(async () => {
|
|
20
|
+
dir = await makeTempDir('kit-stack-cmds-');
|
|
21
|
+
});
|
|
22
|
+
afterEach(async () => dir.cleanup());
|
|
23
|
+
|
|
24
|
+
it('kit new --stack python writes pytest, not npm', async () => {
|
|
25
|
+
const c = ctxFor(['demo', '--stack', 'python', '--dir', dir.path], dir.path);
|
|
26
|
+
expect((await newCommand.run(c)).exitCode).toBe(0);
|
|
27
|
+
const yml = await fs.readFile(path.join(dir.path, 'demo', '.ai-kit', 'project.yml'), 'utf8');
|
|
28
|
+
expect(yml).toContain("['python3', '-m', 'pytest']");
|
|
29
|
+
expect(yml).not.toContain('npm');
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('kit new --stack react-spa is accepted and stored under the canonical id', async () => {
|
|
33
|
+
const c = ctxFor(['web', '--stack', 'react-spa', '--dir', dir.path], dir.path);
|
|
34
|
+
expect((await newCommand.run(c)).exitCode).toBe(0);
|
|
35
|
+
const yml = await fs.readFile(path.join(dir.path, 'web', '.ai-kit', 'project.yml'), 'utf8');
|
|
36
|
+
expect(yml).toContain('- react-typescript');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('kit new rejects an unknown stack with exit 1', async () => {
|
|
40
|
+
const c = ctxFor(['x', '--stack', 'cobol', '--dir', dir.path], dir.path);
|
|
41
|
+
expect((await newCommand.run(c)).exitCode).toBe(1);
|
|
42
|
+
expect(c.err.join('')).toMatch(/unknown stack/);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it('kit init on a Python repo derives pytest and nothing it cannot confirm', async () => {
|
|
46
|
+
const repo = path.join(dir.path, 'py-shop');
|
|
47
|
+
await fs.mkdir(path.join(repo, 'app'), { recursive: true });
|
|
48
|
+
await fs.writeFile(path.join(repo, 'pyproject.toml'), "[project]\nname='py'\n[tool.pytest.ini_options]\ntestpaths=['tests']\n");
|
|
49
|
+
const c = ctxFor([repo], dir.path);
|
|
50
|
+
expect((await initCommand.run(c)).exitCode).toBe(0);
|
|
51
|
+
const yml = await fs.readFile(path.join(repo, '.ai-kit', 'project.yml'), 'utf8');
|
|
52
|
+
expect(yml).toContain("['python3', '-m', 'pytest']");
|
|
53
|
+
expect(yml).not.toContain('ruff');
|
|
54
|
+
expect(yml).not.toContain('mypy');
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('kit init on a plain Ruby repo derives bundle-exec RSpec, not Rails commands', async () => {
|
|
58
|
+
const repo = path.join(dir.path, 'rb-lib');
|
|
59
|
+
await fs.mkdir(path.join(repo, 'spec'), { recursive: true });
|
|
60
|
+
await fs.writeFile(path.join(repo, 'Gemfile'), "source 'https://rubygems.org'\ngem 'rspec'\n");
|
|
61
|
+
const c = ctxFor([repo], dir.path);
|
|
62
|
+
expect((await initCommand.run(c)).exitCode).toBe(0);
|
|
63
|
+
const yml = await fs.readFile(path.join(repo, '.ai-kit', 'project.yml'), 'utf8');
|
|
64
|
+
expect(yml).toContain("['bundle', 'exec', 'rspec']");
|
|
65
|
+
expect(yml).not.toContain('rails');
|
|
66
|
+
});
|
|
67
|
+
});
|