@agentic-sdlc-kit/cli 0.0.0-stage → 0.9.1

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.
Files changed (309) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +32 -2
  3. package/dist/application/agent/execution-store.d.ts +55 -0
  4. package/dist/application/agent/execution-store.d.ts.map +1 -0
  5. package/dist/application/agent/execution-store.js +91 -0
  6. package/dist/application/agent/execution-store.js.map +1 -0
  7. package/dist/application/agent/gateway.d.ts +74 -0
  8. package/dist/application/agent/gateway.d.ts.map +1 -0
  9. package/dist/application/agent/gateway.js +580 -0
  10. package/dist/application/agent/gateway.js.map +1 -0
  11. package/dist/application/agent/index.d.ts +6 -0
  12. package/dist/application/agent/index.d.ts.map +1 -0
  13. package/dist/application/agent/index.js +18 -0
  14. package/dist/application/agent/index.js.map +1 -0
  15. package/dist/application/agent/orchestrator.d.ts +76 -0
  16. package/dist/application/agent/orchestrator.d.ts.map +1 -0
  17. package/dist/application/agent/orchestrator.js +422 -0
  18. package/dist/application/agent/orchestrator.js.map +1 -0
  19. package/dist/application/agent/providers/claude-code/claude-argv.d.ts +15 -0
  20. package/dist/application/agent/providers/claude-code/claude-argv.d.ts.map +1 -0
  21. package/dist/application/agent/providers/claude-code/claude-argv.js +98 -0
  22. package/dist/application/agent/providers/claude-code/claude-argv.js.map +1 -0
  23. package/dist/application/agent/providers/claude-code/index.d.ts +7 -0
  24. package/dist/application/agent/providers/claude-code/index.d.ts.map +1 -0
  25. package/dist/application/agent/providers/claude-code/index.js +13 -0
  26. package/dist/application/agent/providers/claude-code/index.js.map +1 -0
  27. package/dist/application/agent/providers/claude-code/mod-parity.d.ts +15 -0
  28. package/dist/application/agent/providers/claude-code/mod-parity.d.ts.map +1 -0
  29. package/dist/application/agent/providers/claude-code/mod-parity.js +41 -0
  30. package/dist/application/agent/providers/claude-code/mod-parity.js.map +1 -0
  31. package/dist/application/agent/providers/claude-code/permission-config.d.ts +59 -0
  32. package/dist/application/agent/providers/claude-code/permission-config.d.ts.map +1 -0
  33. package/dist/application/agent/providers/claude-code/permission-config.js +189 -0
  34. package/dist/application/agent/providers/claude-code/permission-config.js.map +1 -0
  35. package/dist/application/agent/providers/claude-code/provider.d.ts +38 -0
  36. package/dist/application/agent/providers/claude-code/provider.d.ts.map +1 -0
  37. package/dist/application/agent/providers/claude-code/provider.js +577 -0
  38. package/dist/application/agent/providers/claude-code/provider.js.map +1 -0
  39. package/dist/application/agent/providers/claude-code/resume-store.d.ts +25 -0
  40. package/dist/application/agent/providers/claude-code/resume-store.d.ts.map +1 -0
  41. package/dist/application/agent/providers/claude-code/resume-store.js +120 -0
  42. package/dist/application/agent/providers/claude-code/resume-store.js.map +1 -0
  43. package/dist/application/agent/providers/claude-code/stream-parser.d.ts +50 -0
  44. package/dist/application/agent/providers/claude-code/stream-parser.d.ts.map +1 -0
  45. package/dist/application/agent/providers/claude-code/stream-parser.js +129 -0
  46. package/dist/application/agent/providers/claude-code/stream-parser.js.map +1 -0
  47. package/dist/application/agent/test-fixture.d.ts +15 -0
  48. package/dist/application/agent/test-fixture.d.ts.map +1 -0
  49. package/dist/application/agent/test-fixture.js +93 -0
  50. package/dist/application/agent/test-fixture.js.map +1 -0
  51. package/dist/application/agent/workspace.d.ts +24 -0
  52. package/dist/application/agent/workspace.d.ts.map +1 -0
  53. package/dist/application/agent/workspace.js +139 -0
  54. package/dist/application/agent/workspace.js.map +1 -0
  55. package/dist/application/dispatcher.d.ts +13 -0
  56. package/dist/application/dispatcher.d.ts.map +1 -0
  57. package/dist/application/dispatcher.js +116 -0
  58. package/dist/application/dispatcher.js.map +1 -0
  59. package/dist/application/index.d.ts +5 -0
  60. package/dist/application/index.d.ts.map +1 -0
  61. package/dist/application/index.js +6 -0
  62. package/dist/application/index.js.map +1 -0
  63. package/dist/application/registry.d.ts +8 -0
  64. package/dist/application/registry.d.ts.map +1 -0
  65. package/dist/application/registry.js +17 -0
  66. package/dist/application/registry.js.map +1 -0
  67. package/dist/application/version.d.ts +2 -0
  68. package/dist/application/version.d.ts.map +1 -0
  69. package/dist/application/version.js +7 -0
  70. package/dist/application/version.js.map +1 -0
  71. package/dist/commands/attach-exclude.d.ts +8 -0
  72. package/dist/commands/attach-exclude.d.ts.map +1 -0
  73. package/dist/commands/attach-exclude.js +48 -0
  74. package/dist/commands/attach-exclude.js.map +1 -0
  75. package/dist/commands/attach-git.d.ts +11 -0
  76. package/dist/commands/attach-git.d.ts.map +1 -0
  77. package/dist/commands/attach-git.js +40 -0
  78. package/dist/commands/attach-git.js.map +1 -0
  79. package/dist/commands/attach-store.d.ts +10 -0
  80. package/dist/commands/attach-store.d.ts.map +1 -0
  81. package/dist/commands/attach-store.js +107 -0
  82. package/dist/commands/attach-store.js.map +1 -0
  83. package/dist/commands/attach.d.ts +8 -0
  84. package/dist/commands/attach.d.ts.map +1 -0
  85. package/dist/commands/attach.js +124 -0
  86. package/dist/commands/attach.js.map +1 -0
  87. package/dist/commands/doctor.d.ts +3 -0
  88. package/dist/commands/doctor.d.ts.map +1 -0
  89. package/dist/commands/doctor.js +68 -0
  90. package/dist/commands/doctor.js.map +1 -0
  91. package/dist/commands/elicit.d.ts +3 -0
  92. package/dist/commands/elicit.d.ts.map +1 -0
  93. package/dist/commands/elicit.js +163 -0
  94. package/dist/commands/elicit.js.map +1 -0
  95. package/dist/commands/evolve.d.ts +3 -0
  96. package/dist/commands/evolve.d.ts.map +1 -0
  97. package/dist/commands/evolve.js +165 -0
  98. package/dist/commands/evolve.js.map +1 -0
  99. package/dist/commands/feature.d.ts +13 -0
  100. package/dist/commands/feature.d.ts.map +1 -0
  101. package/dist/commands/feature.js +326 -0
  102. package/dist/commands/feature.js.map +1 -0
  103. package/dist/commands/fix.d.ts +4 -0
  104. package/dist/commands/fix.d.ts.map +1 -0
  105. package/dist/commands/fix.js +53 -0
  106. package/dist/commands/fix.js.map +1 -0
  107. package/dist/commands/help.d.ts +4 -0
  108. package/dist/commands/help.d.ts.map +1 -0
  109. package/dist/commands/help.js +32 -0
  110. package/dist/commands/help.js.map +1 -0
  111. package/dist/commands/host-apply.d.ts +12 -0
  112. package/dist/commands/host-apply.d.ts.map +1 -0
  113. package/dist/commands/host-apply.js +43 -0
  114. package/dist/commands/host-apply.js.map +1 -0
  115. package/dist/commands/host.d.ts +3 -0
  116. package/dist/commands/host.d.ts.map +1 -0
  117. package/dist/commands/host.js +107 -0
  118. package/dist/commands/host.js.map +1 -0
  119. package/dist/commands/index.d.ts +25 -0
  120. package/dist/commands/index.d.ts.map +1 -0
  121. package/dist/commands/index.js +26 -0
  122. package/dist/commands/index.js.map +1 -0
  123. package/dist/commands/init.d.ts +3 -0
  124. package/dist/commands/init.d.ts.map +1 -0
  125. package/dist/commands/init.js +92 -0
  126. package/dist/commands/init.js.map +1 -0
  127. package/dist/commands/inspect.d.ts +3 -0
  128. package/dist/commands/inspect.d.ts.map +1 -0
  129. package/dist/commands/inspect.js +64 -0
  130. package/dist/commands/inspect.js.map +1 -0
  131. package/dist/commands/install.d.ts +3 -0
  132. package/dist/commands/install.d.ts.map +1 -0
  133. package/dist/commands/install.js +337 -0
  134. package/dist/commands/install.js.map +1 -0
  135. package/dist/commands/journal.d.ts +3 -0
  136. package/dist/commands/journal.d.ts.map +1 -0
  137. package/dist/commands/journal.js +107 -0
  138. package/dist/commands/journal.js.map +1 -0
  139. package/dist/commands/memory.d.ts +3 -0
  140. package/dist/commands/memory.d.ts.map +1 -0
  141. package/dist/commands/memory.js +85 -0
  142. package/dist/commands/memory.js.map +1 -0
  143. package/dist/commands/new.d.ts +3 -0
  144. package/dist/commands/new.d.ts.map +1 -0
  145. package/dist/commands/new.js +68 -0
  146. package/dist/commands/new.js.map +1 -0
  147. package/dist/commands/next.d.ts +3 -0
  148. package/dist/commands/next.d.ts.map +1 -0
  149. package/dist/commands/next.js +107 -0
  150. package/dist/commands/next.js.map +1 -0
  151. package/dist/commands/optimize.d.ts +3 -0
  152. package/dist/commands/optimize.d.ts.map +1 -0
  153. package/dist/commands/optimize.js +28 -0
  154. package/dist/commands/optimize.js.map +1 -0
  155. package/dist/commands/plugin-linker.d.ts +43 -0
  156. package/dist/commands/plugin-linker.d.ts.map +1 -0
  157. package/dist/commands/plugin-linker.js +216 -0
  158. package/dist/commands/plugin-linker.js.map +1 -0
  159. package/dist/commands/refactor.d.ts +3 -0
  160. package/dist/commands/refactor.d.ts.map +1 -0
  161. package/dist/commands/refactor.js +32 -0
  162. package/dist/commands/refactor.js.map +1 -0
  163. package/dist/commands/skills-install-commit.d.ts +34 -0
  164. package/dist/commands/skills-install-commit.d.ts.map +1 -0
  165. package/dist/commands/skills-install-commit.js +113 -0
  166. package/dist/commands/skills-install-commit.js.map +1 -0
  167. package/dist/commands/skills-install-manifest.d.ts +35 -0
  168. package/dist/commands/skills-install-manifest.d.ts.map +1 -0
  169. package/dist/commands/skills-install-manifest.js +89 -0
  170. package/dist/commands/skills-install-manifest.js.map +1 -0
  171. package/dist/commands/skills-install-report.d.ts +12 -0
  172. package/dist/commands/skills-install-report.d.ts.map +1 -0
  173. package/dist/commands/skills-install-report.js +44 -0
  174. package/dist/commands/skills-install-report.js.map +1 -0
  175. package/dist/commands/skills-install-secure.d.ts +14 -0
  176. package/dist/commands/skills-install-secure.d.ts.map +1 -0
  177. package/dist/commands/skills-install-secure.js +96 -0
  178. package/dist/commands/skills-install-secure.js.map +1 -0
  179. package/dist/commands/skills-install.d.ts +15 -0
  180. package/dist/commands/skills-install.d.ts.map +1 -0
  181. package/dist/commands/skills-install.js +182 -0
  182. package/dist/commands/skills-install.js.map +1 -0
  183. package/dist/commands/skills.d.ts +3 -0
  184. package/dist/commands/skills.d.ts.map +1 -0
  185. package/dist/commands/skills.js +217 -0
  186. package/dist/commands/skills.js.map +1 -0
  187. package/dist/commands/types.d.ts +19 -0
  188. package/dist/commands/types.d.ts.map +1 -0
  189. package/dist/commands/types.js +7 -0
  190. package/dist/commands/types.js.map +1 -0
  191. package/dist/commands/uninstall.d.ts +3 -0
  192. package/dist/commands/uninstall.d.ts.map +1 -0
  193. package/dist/commands/uninstall.js +113 -0
  194. package/dist/commands/uninstall.js.map +1 -0
  195. package/dist/commands/validate-plan.d.ts +3 -0
  196. package/dist/commands/validate-plan.d.ts.map +1 -0
  197. package/dist/commands/validate-plan.js +62 -0
  198. package/dist/commands/validate-plan.js.map +1 -0
  199. package/dist/commands/validate-spec.d.ts +3 -0
  200. package/dist/commands/validate-spec.d.ts.map +1 -0
  201. package/dist/commands/validate-spec.js +62 -0
  202. package/dist/commands/validate-spec.js.map +1 -0
  203. package/dist/commands/verify.d.ts +3 -0
  204. package/dist/commands/verify.d.ts.map +1 -0
  205. package/dist/commands/verify.js +103 -0
  206. package/dist/commands/verify.js.map +1 -0
  207. package/dist/commands/version.d.ts +3 -0
  208. package/dist/commands/version.d.ts.map +1 -0
  209. package/dist/commands/version.js +12 -0
  210. package/dist/commands/version.js.map +1 -0
  211. package/dist/index.d.ts +3 -0
  212. package/dist/index.d.ts.map +1 -0
  213. package/dist/index.js +27 -0
  214. package/dist/index.js.map +1 -0
  215. package/dist/output/formatter.d.ts +2 -0
  216. package/dist/output/formatter.d.ts.map +1 -0
  217. package/dist/output/formatter.js +10 -0
  218. package/dist/output/formatter.js.map +1 -0
  219. package/dist/output/index.d.ts +2 -0
  220. package/dist/output/index.d.ts.map +1 -0
  221. package/dist/output/index.js +3 -0
  222. package/dist/output/index.js.map +1 -0
  223. package/package.json +37 -3
  224. package/src/application/agent/execution-store.ts +163 -0
  225. package/src/application/agent/gateway.test.ts +529 -0
  226. package/src/application/agent/gateway.ts +744 -0
  227. package/src/application/agent/index.ts +18 -0
  228. package/src/application/agent/orchestrator.test.ts +341 -0
  229. package/src/application/agent/orchestrator.ts +629 -0
  230. package/src/application/agent/providers/claude-code/claude-argv.ts +119 -0
  231. package/src/application/agent/providers/claude-code/claude-code-smoke.test.ts +139 -0
  232. package/src/application/agent/providers/claude-code/fixtures/fake-claude.mjs +125 -0
  233. package/src/application/agent/providers/claude-code/index.ts +28 -0
  234. package/src/application/agent/providers/claude-code/mod-parity.ts +50 -0
  235. package/src/application/agent/providers/claude-code/permission-config.test.ts +221 -0
  236. package/src/application/agent/providers/claude-code/permission-config.ts +242 -0
  237. package/src/application/agent/providers/claude-code/provider.test.ts +378 -0
  238. package/src/application/agent/providers/claude-code/provider.ts +717 -0
  239. package/src/application/agent/providers/claude-code/resume-store.test.ts +161 -0
  240. package/src/application/agent/providers/claude-code/resume-store.ts +157 -0
  241. package/src/application/agent/providers/claude-code/stream-parser.ts +166 -0
  242. package/src/application/agent/test-fixture.ts +131 -0
  243. package/src/application/agent/workspace.test.ts +104 -0
  244. package/src/application/agent/workspace.ts +156 -0
  245. package/src/application/dispatcher.test.ts +108 -0
  246. package/src/application/dispatcher.ts +106 -0
  247. package/src/application/index.ts +5 -0
  248. package/src/application/registry.ts +24 -0
  249. package/src/application/version.ts +7 -0
  250. package/src/commands/attach-exclude.ts +50 -0
  251. package/src/commands/attach-git.ts +50 -0
  252. package/src/commands/attach-store.ts +107 -0
  253. package/src/commands/attach.test.ts +192 -0
  254. package/src/commands/attach.ts +143 -0
  255. package/src/commands/clse.test.ts +181 -0
  256. package/src/commands/doctor.test.ts +29 -0
  257. package/src/commands/doctor.ts +78 -0
  258. package/src/commands/elicit.test.ts +111 -0
  259. package/src/commands/elicit.ts +188 -0
  260. package/src/commands/evolve.ts +209 -0
  261. package/src/commands/feature.test.ts +323 -0
  262. package/src/commands/feature.ts +405 -0
  263. package/src/commands/fix.test.ts +118 -0
  264. package/src/commands/fix.ts +58 -0
  265. package/src/commands/help.test.ts +33 -0
  266. package/src/commands/help.ts +35 -0
  267. package/src/commands/host-apply.ts +61 -0
  268. package/src/commands/host.test.ts +120 -0
  269. package/src/commands/host.ts +125 -0
  270. package/src/commands/index.ts +25 -0
  271. package/src/commands/init.test.ts +87 -0
  272. package/src/commands/init.ts +110 -0
  273. package/src/commands/inspect.test.ts +57 -0
  274. package/src/commands/inspect.ts +73 -0
  275. package/src/commands/install.test.ts +92 -0
  276. package/src/commands/install.ts +389 -0
  277. package/src/commands/journal.ts +118 -0
  278. package/src/commands/memory.ts +96 -0
  279. package/src/commands/new.test.ts +44 -0
  280. package/src/commands/new.ts +77 -0
  281. package/src/commands/next.test.ts +241 -0
  282. package/src/commands/next.ts +124 -0
  283. package/src/commands/optimize.ts +30 -0
  284. package/src/commands/plugin-linker.test.ts +219 -0
  285. package/src/commands/plugin-linker.ts +244 -0
  286. package/src/commands/refactor.ts +34 -0
  287. package/src/commands/skills-install-commit.ts +149 -0
  288. package/src/commands/skills-install-manifest.ts +124 -0
  289. package/src/commands/skills-install-report.ts +60 -0
  290. package/src/commands/skills-install-secure.ts +113 -0
  291. package/src/commands/skills-install.ts +245 -0
  292. package/src/commands/skills.test.ts +449 -0
  293. package/src/commands/skills.ts +247 -0
  294. package/src/commands/stack-commands.test.ts +67 -0
  295. package/src/commands/tier-c-conformance.test.ts +194 -0
  296. package/src/commands/types.ts +26 -0
  297. package/src/commands/uninstall.test.ts +122 -0
  298. package/src/commands/uninstall.ts +116 -0
  299. package/src/commands/validate-plan.test.ts +107 -0
  300. package/src/commands/validate-plan.ts +67 -0
  301. package/src/commands/validate-spec.test.ts +59 -0
  302. package/src/commands/validate-spec.ts +68 -0
  303. package/src/commands/verify.test.ts +117 -0
  304. package/src/commands/verify.ts +112 -0
  305. package/src/commands/version.test.ts +11 -0
  306. package/src/commands/version.ts +14 -0
  307. package/src/index.ts +30 -0
  308. package/src/output/formatter.ts +10 -0
  309. package/src/output/index.ts +2 -0
@@ -0,0 +1,61 @@
1
+ // packages/cli/src/commands/host-apply.ts
2
+ //
3
+ // Applies planned host-instruction targets to disk. Never overwrites a file
4
+ // the user edited (or one the kit did not write) unless --force is given.
5
+
6
+ import { promises as fs } from 'node:fs';
7
+ import path from 'node:path';
8
+ import { inspectManaged, upsertBlock, type HostTarget } from '@agentic-sdlc-kit/core';
9
+
10
+ export type ApplyAction = 'created' | 'updated' | 'unchanged' | 'refused';
11
+
12
+ export interface ApplyResult {
13
+ readonly path: string;
14
+ readonly action: ApplyAction;
15
+ readonly reason?: string;
16
+ }
17
+
18
+ async function readOrNull(p: string): Promise<string | null> {
19
+ try {
20
+ return await fs.readFile(p, 'utf8');
21
+ } catch {
22
+ return null;
23
+ }
24
+ }
25
+
26
+ interface Decision {
27
+ readonly action: ApplyAction;
28
+ readonly next?: string;
29
+ readonly reason?: string;
30
+ }
31
+
32
+ function decideBlock(existing: string | null, target: HostTarget): Decision {
33
+ const next = upsertBlock(existing, target.content);
34
+ if (existing === null) return { action: 'created', next };
35
+ return next === existing ? { action: 'unchanged' } : { action: 'updated', next };
36
+ }
37
+
38
+ function decideFile(existing: string | null, target: HostTarget, force: boolean): Decision {
39
+ const state = inspectManaged(existing);
40
+ if (state === 'absent') return { action: 'created', next: target.content };
41
+ if (existing === target.content) return { action: 'unchanged' };
42
+ if (state === 'unmodified' || force) return { action: 'updated', next: target.content };
43
+ const why = state === 'modified' ? 'edited since install' : 'not written by the kit';
44
+ return { action: 'refused', reason: `${why}; re-run with --force to replace` };
45
+ }
46
+
47
+ export async function applyTarget(
48
+ root: string,
49
+ target: HostTarget,
50
+ opts: { force: boolean; dryRun: boolean },
51
+ ): Promise<ApplyResult> {
52
+ const abs = path.join(root, target.path);
53
+ const existing = await readOrNull(abs);
54
+ const d =
55
+ target.mode === 'block' ? decideBlock(existing, target) : decideFile(existing, target, opts.force);
56
+ if (d.next !== undefined && !opts.dryRun) {
57
+ await fs.mkdir(path.dirname(abs), { recursive: true });
58
+ await fs.writeFile(abs, d.next, 'utf8');
59
+ }
60
+ return { path: abs, action: d.action, ...(d.reason ? { reason: d.reason } : {}) };
61
+ }
@@ -0,0 +1,120 @@
1
+ // packages/cli/src/commands/host.test.ts
2
+ import { promises as fs } from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
6
+ import { hostCommand } from './host.js';
7
+ import type { CommandContext } from './types.js';
8
+
9
+ let tmp: string;
10
+ let home: string;
11
+ let proj: string;
12
+
13
+ beforeEach(async () => {
14
+ tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-host-'));
15
+ home = path.join(tmp, 'home');
16
+ proj = path.join(tmp, 'proj');
17
+ await fs.mkdir(home);
18
+ await fs.mkdir(proj);
19
+ });
20
+ afterEach(() => fs.rm(tmp, { recursive: true, force: true }));
21
+
22
+ const run = async (...argv: string[]) => {
23
+ const out: string[] = [];
24
+ const err: string[] = [];
25
+ const ctx: CommandContext = {
26
+ argv: [...argv, '--home', home, '--dir', proj],
27
+ cwd: tmp,
28
+ stdout: (s) => void out.push(s),
29
+ stderr: (s) => void err.push(s),
30
+ };
31
+ const r = await hostCommand.run(ctx);
32
+ return { ...r, out: out.join('\n'), err: err.join('\n') };
33
+ };
34
+ const read = (p: string) => fs.readFile(p, 'utf8');
35
+ const exists = (p: string) => fs.stat(p).then(() => true, () => false);
36
+
37
+ describe('kit host', () => {
38
+ it('list shows every host with its default scope', async () => {
39
+ const r = await run('list');
40
+ expect(r.exitCode).toBe(0);
41
+ for (const h of ['claude-code', 'codex', 'cursor', 'agy', 'gemini', 'aider']) {
42
+ expect(r.out).toContain(h);
43
+ }
44
+ });
45
+
46
+ it('claude-code installs slash commands and a skill at user scope, nothing in the project', async () => {
47
+ const r = await run('install', 'claude-code');
48
+ expect(r.exitCode).toBe(0);
49
+ const cmd = await read(path.join(home, '.claude/commands/kit-feature.md'));
50
+ expect(cmd).toContain('$ARGUMENTS');
51
+ expect(cmd).toContain('KIT_HOST=claude-code');
52
+ expect(await exists(path.join(home, '.claude/skills/agentic-sdlc-kit/SKILL.md'))).toBe(true);
53
+ expect(await fs.readdir(proj)).toEqual([]);
54
+ });
55
+
56
+ it('is idempotent: second install reports unchanged and rewrites nothing', async () => {
57
+ await run('install', 'claude-code');
58
+ const p = path.join(home, '.claude/commands/kit-fix.md');
59
+ const before = await fs.stat(p);
60
+ const r = await run('install', 'claude-code');
61
+ expect(r.exitCode).toBe(0);
62
+ expect(r.out).not.toMatch(/created|updated|refused/);
63
+ expect((await fs.stat(p)).mtimeMs).toBe(before.mtimeMs);
64
+ });
65
+
66
+ it('refuses to overwrite an edited file; --force replaces it', async () => {
67
+ await run('install', 'cursor');
68
+ const p = path.join(proj, '.cursor/rules/sdlc.mdc');
69
+ await fs.writeFile(p, (await read(p)).replace('kit doctor', 'MY OWN RULE'));
70
+ const refused = await run('install', 'cursor');
71
+ expect(refused.exitCode).toBe(1);
72
+ expect(refused.out).toContain('refused');
73
+ expect(await read(p)).toContain('MY OWN RULE');
74
+ expect((await run('install', 'cursor', '--force')).exitCode).toBe(0);
75
+ expect(await read(p)).not.toContain('MY OWN RULE');
76
+ });
77
+
78
+ it('refuses a pre-existing file the kit did not write', async () => {
79
+ const p = path.join(home, '.gemini/skills/agentic-sdlc-kit/SKILL.md');
80
+ await fs.mkdir(path.dirname(p), { recursive: true });
81
+ await fs.writeFile(p, 'my skill');
82
+ const r = await run('install', 'agy');
83
+ expect(r.exitCode).toBe(1);
84
+ expect(await read(p)).toBe('my skill');
85
+ });
86
+
87
+ it('shared files keep user text and only the managed block is replaced', async () => {
88
+ const p = path.join(proj, 'AGENTS.md');
89
+ await fs.writeFile(p, '# My project rules\nkeep me\n');
90
+ expect((await run('install', 'codex', '--scope', 'project')).exitCode).toBe(0);
91
+ const once = await read(p);
92
+ expect(once).toContain('keep me');
93
+ expect(once).toContain('KIT_HOST=codex');
94
+ await run('install', 'codex', '--scope', 'project');
95
+ expect(await read(p)).toBe(once);
96
+ });
97
+
98
+ it('dry-run writes nothing', async () => {
99
+ const r = await run('install', 'all', '--dry-run');
100
+ expect(r.exitCode).toBe(0);
101
+ expect(r.out).toContain('dry run');
102
+ expect(await fs.readdir(home)).toEqual([]);
103
+ expect(await fs.readdir(proj)).toEqual([]);
104
+ });
105
+
106
+ it('rejects unknown hosts, bad scopes and scopes a host lacks', async () => {
107
+ expect((await run('install', 'vim')).err).toContain("unknown host 'vim'");
108
+ expect((await run('install', 'codex', '--scope', 'galaxy')).err).toContain('--scope');
109
+ expect((await run('install', 'cursor', '--scope', 'user')).err).toContain('no user-scope');
110
+ });
111
+
112
+ it('install all uses each host default scope', async () => {
113
+ const r = await run('install', 'all');
114
+ expect(r.exitCode).toBe(0);
115
+ expect(await exists(path.join(home, '.codex/AGENTS.md'))).toBe(true);
116
+ expect(await exists(path.join(home, '.gemini/GEMINI.md'))).toBe(true);
117
+ expect(await exists(path.join(proj, '.cursor/rules/sdlc.mdc'))).toBe(true);
118
+ expect(await exists(path.join(proj, 'CONVENTIONS.md'))).toBe(true);
119
+ });
120
+ });
@@ -0,0 +1,125 @@
1
+ // packages/cli/src/commands/host.ts
2
+ //
3
+ // `kit host list | install <host|all> [--scope user|project] [--dir <p>]
4
+ // [--home <p>] [--force] [--dry-run] [--json]`
5
+ //
6
+ // Installs the standing agent procedure into each AI host's instruction
7
+ // surface once, so per ticket the user types a single line and the host
8
+ // drives the kit's evidence-gated loop (`kit next --json`) on its own.
9
+
10
+ import os from 'node:os';
11
+ import path from 'node:path';
12
+ import {
13
+ DEFAULT_SCOPE,
14
+ HOST_IDS,
15
+ isHostId,
16
+ planHostTargets,
17
+ type HostId,
18
+ type HostScope,
19
+ } from '@agentic-sdlc-kit/core';
20
+ import { applyTarget, type ApplyResult } from './host-apply.js';
21
+ import type { Command, CommandContext, CommandResult } from './types.js';
22
+
23
+ const USAGE = [
24
+ 'Usage: kit host list',
25
+ ' kit host install <host|all> [--scope user|project] [--dir <project>] [--home <dir>]',
26
+ ' [--force] [--dry-run] [--json]',
27
+ '',
28
+ `Hosts: ${HOST_IDS.join(', ')}`,
29
+ 'Default scope: user where the host has a global surface, otherwise project.',
30
+ 'Existing files you edited are never overwritten without --force; shared files',
31
+ '(AGENTS.md, GEMINI.md, CONVENTIONS.md) only get a replaceable managed block.',
32
+ ].join('\n');
33
+
34
+ function opt(argv: ReadonlyArray<string>, name: string): string | undefined {
35
+ const i = argv.indexOf(name);
36
+ const v = i === -1 ? undefined : argv[i + 1];
37
+ return v && !v.startsWith('-') ? v : undefined;
38
+ }
39
+
40
+ function listText(): string {
41
+ const lines = ['kit host: instruction surfaces', ''];
42
+ for (const host of HOST_IDS) {
43
+ const scope = DEFAULT_SCOPE[host];
44
+ const paths = planHostTargets(host, scope)!.map((t) => t.path);
45
+ lines.push(` ${host.padEnd(12)} [${scope}] ${paths.join(', ')}`);
46
+ }
47
+ return lines.join('\n');
48
+ }
49
+
50
+ interface Plan {
51
+ readonly host: HostId;
52
+ readonly scope: HostScope;
53
+ readonly root: string;
54
+ }
55
+
56
+ function resolvePlans(ctx: CommandContext, which: string): Plan[] | string {
57
+ const explicit = opt(ctx.argv, '--scope');
58
+ if (explicit !== undefined && explicit !== 'user' && explicit !== 'project') {
59
+ return `--scope must be 'user' or 'project' (got '${explicit}')`;
60
+ }
61
+ if (which !== 'all' && !isHostId(which)) return `unknown host '${which}'`;
62
+ const hosts: HostId[] = which === 'all' ? [...HOST_IDS] : [which as HostId];
63
+ const home = path.resolve(opt(ctx.argv, '--home') ?? os.homedir());
64
+ const project = path.resolve(ctx.cwd, opt(ctx.argv, '--dir') ?? '.');
65
+ const plans: Plan[] = [];
66
+ for (const host of hosts) {
67
+ const scope = (explicit as HostScope | undefined) ?? DEFAULT_SCOPE[host];
68
+ if (!planHostTargets(host, scope)) {
69
+ if (which === 'all') continue; // an explicit scope that some hosts lack is not an error for 'all'
70
+ return `${host} has no ${scope}-scope instruction surface`;
71
+ }
72
+ plans.push({ host, scope, root: scope === 'user' ? home : project });
73
+ }
74
+ return plans;
75
+ }
76
+
77
+ async function runInstall(ctx: CommandContext, which: string): Promise<CommandResult> {
78
+ const plans = resolvePlans(ctx, which);
79
+ if (typeof plans === 'string') {
80
+ ctx.stderr(`kit host: ${plans}`);
81
+ return { exitCode: 1 };
82
+ }
83
+ const opts = { force: ctx.argv.includes('--force'), dryRun: ctx.argv.includes('--dry-run') };
84
+ const results: Array<ApplyResult & { host: HostId; scope: HostScope }> = [];
85
+ for (const p of plans) {
86
+ for (const t of planHostTargets(p.host, p.scope)!) {
87
+ results.push({ host: p.host, scope: p.scope, ...(await applyTarget(p.root, t, opts)) });
88
+ }
89
+ }
90
+ const refused = results.some((r) => r.action === 'refused');
91
+ ctx.stdout(formatResults(results, opts.dryRun, ctx.argv.includes('--json')));
92
+ return { exitCode: refused ? 1 : 0 };
93
+ }
94
+
95
+ function formatResults(rs: ReadonlyArray<ApplyResult & { host: HostId }>, dry: boolean, json: boolean): string {
96
+ if (json) return JSON.stringify({ dryRun: dry, results: rs }, null, 2);
97
+ const lines = rs.map((r) => ` ${r.action.padEnd(9)} ${r.host.padEnd(12)} ${r.path}${r.reason ? ` (${r.reason})` : ''}`);
98
+ return [dry ? 'kit host install (dry run, nothing written)' : 'kit host install', ...lines].join('\n');
99
+ }
100
+
101
+ export const hostCommand: Command = {
102
+ name: 'host',
103
+ summary: 'Install the standing agent procedure into AI hosts (claude-code, codex, cursor, agy, gemini, aider).',
104
+ async run(ctx: CommandContext): Promise<CommandResult> {
105
+ const positional = ctx.argv.filter((a, i) => !a.startsWith('-') && !isOptValue(ctx.argv, i));
106
+ const [sub, which] = positional;
107
+ if (ctx.argv.includes('--help') || !sub) {
108
+ ctx.stdout(USAGE);
109
+ return { exitCode: sub || ctx.argv.includes('--help') ? 0 : 1 };
110
+ }
111
+ if (sub === 'list') {
112
+ ctx.stdout(listText());
113
+ return { exitCode: 0 };
114
+ }
115
+ if (sub === 'install' && which) return runInstall(ctx, which);
116
+ ctx.stderr(`kit host: unknown or incomplete subcommand\n${USAGE}`);
117
+ return { exitCode: 1 };
118
+ },
119
+ };
120
+
121
+ /** True when argv[i] is the value of a value-taking flag (so it is not a positional). */
122
+ function isOptValue(argv: ReadonlyArray<string>, i: number): boolean {
123
+ const prev = argv[i - 1];
124
+ return prev === '--scope' || prev === '--dir' || prev === '--home';
125
+ }
@@ -0,0 +1,25 @@
1
+ // packages/cli/src/commands/index.ts
2
+ export * from './types.js';
3
+ export * from './version.js';
4
+ export * from './help.js';
5
+ export * from './doctor.js';
6
+ export * from './inspect.js';
7
+ export * from './init.js';
8
+ export * from './validate-spec.js';
9
+ export * from './validate-plan.js';
10
+ export * from './verify.js';
11
+ export * from './feature.js';
12
+ export * from './new.js';
13
+ export * from './fix.js';
14
+ export * from './install.js';
15
+ export * from './uninstall.js';
16
+ export * from './memory.js';
17
+ export * from './evolve.js';
18
+ export * from './refactor.js';
19
+ export * from './optimize.js';
20
+ export * from './elicit.js';
21
+ export * from './next.js';
22
+ export * from './journal.js';
23
+ export * from './skills.js';
24
+ export * from './attach.js';
25
+ export * from './host.js';
@@ -0,0 +1,87 @@
1
+ // packages/cli/src/commands/init.test.ts
2
+ import { promises as fs } from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { describe, expect, it } from 'vitest';
6
+ import { initCommand } from './init.js';
7
+ import type { CommandContext } from './types.js';
8
+
9
+ const makeCtx = (
10
+ argv: string[],
11
+ cwd: string,
12
+ ): CommandContext & { out: string[]; err: string[] } => {
13
+ const out: string[] = [];
14
+ const err: string[] = [];
15
+ return {
16
+ argv,
17
+ cwd,
18
+ stdout: (s) => void out.push(s),
19
+ stderr: (s) => void err.push(s),
20
+ out,
21
+ err,
22
+ };
23
+ };
24
+
25
+ describe('initCommand', () => {
26
+ it('shows help when --help is passed', async () => {
27
+ const ctx = makeCtx(['--help'], '/');
28
+ const r = await initCommand.run(ctx);
29
+ expect(r.exitCode).toBe(0);
30
+ expect(ctx.out[0]).toContain('Usage: kit init');
31
+ });
32
+
33
+ it('initializes project in a temp directory', async () => {
34
+ const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-init-test-'));
35
+ try {
36
+ await fs.writeFile(
37
+ path.join(tmp, 'package.json'),
38
+ JSON.stringify({ name: 'my-test-app', scripts: { test: 'node --test' } }),
39
+ );
40
+
41
+ const ctx = makeCtx([], tmp);
42
+ const r = await initCommand.run(ctx);
43
+ expect(r.exitCode).toBe(0);
44
+
45
+ const configPath = path.join(tmp, '.ai-kit', 'project.yml');
46
+ const stat = await fs.stat(configPath);
47
+ expect(stat.isFile()).toBe(true);
48
+
49
+ const content = await fs.readFile(configPath, 'utf8');
50
+ expect(content).toContain('schemaVersion: 1');
51
+ expect(content).toContain(`name: ${path.basename(tmp).toLowerCase()}`);
52
+
53
+ // Running again without --force must fail
54
+ const r2 = await initCommand.run(ctx);
55
+ expect(r2.exitCode).toBe(1);
56
+
57
+ // Running with --force must succeed
58
+ const ctxForce = makeCtx(['--force'], tmp);
59
+ const r3 = await initCommand.run(ctxForce);
60
+ expect(r3.exitCode).toBe(0);
61
+ } finally {
62
+ await fs.rm(tmp, { recursive: true, force: true });
63
+ }
64
+ });
65
+
66
+ it('creates state/reports under KIT_STATE_DIR, not in the project', async () => {
67
+ const tmp = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-init-state-'));
68
+ const proj = path.join(tmp, 'proj');
69
+ const stateDir = path.join(tmp, 'state');
70
+ await fs.mkdir(proj);
71
+ await fs.writeFile(
72
+ path.join(proj, 'package.json'),
73
+ JSON.stringify({ name: 'p', scripts: { test: 'node --test' } }),
74
+ );
75
+ process.env['KIT_STATE_DIR'] = stateDir;
76
+ try {
77
+ const r = await initCommand.run(makeCtx([], proj));
78
+ expect(r.exitCode).toBe(0);
79
+ expect(await fs.readdir(path.join(proj, '.ai-kit'))).toEqual(['project.yml']);
80
+ const [sub] = await fs.readdir(stateDir);
81
+ expect((await fs.readdir(path.join(stateDir, sub!))).sort()).toEqual(['reports', 'state']);
82
+ } finally {
83
+ delete process.env['KIT_STATE_DIR'];
84
+ await fs.rm(tmp, { recursive: true, force: true });
85
+ }
86
+ });
87
+ });
@@ -0,0 +1,110 @@
1
+ // packages/cli/src/commands/init.ts
2
+ //
3
+ // `kit init [path] [--force] [--json]`.
4
+ // Initializes the Agentic SDLC Kit configuration (.ai-kit/project.yml).
5
+
6
+ import { promises as fs } from 'node:fs';
7
+ import path from 'node:path';
8
+ import {
9
+ FileSystemRepositoryScanner,
10
+ generateProfile,
11
+ kitStateRoot,
12
+ writeProfile,
13
+ } from '@agentic-sdlc-kit/core';
14
+ import type { ProjectProfile } from '@agentic-sdlc-kit/contracts';
15
+ import type { Command, CommandContext, CommandResult } from './types.js';
16
+
17
+ export const initCommand: Command = {
18
+ name: 'init',
19
+ summary: 'Initialize the Agentic SDLC Kit profile (.ai-kit/project.yml) for a repository.',
20
+ async run(ctx: CommandContext): Promise<CommandResult> {
21
+ if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
22
+ ctx.stdout(formatHelp());
23
+ return { exitCode: 0 };
24
+ }
25
+
26
+ const isJson = ctx.argv.includes('--json');
27
+ const isForce = ctx.argv.includes('--force') || ctx.argv.includes('-f');
28
+ const targetArg = ctx.argv.find((a) => !a.startsWith('-'));
29
+ const targetRoot = path.resolve(ctx.cwd, targetArg ?? '.');
30
+
31
+ const configPath = path.join(targetRoot, '.ai-kit', 'project.yml');
32
+ if (!isForce && (await fileExists(configPath))) {
33
+ ctx.stderr('kit init: .ai-kit/project.yml already exists (use --force to overwrite)\n');
34
+ return { exitCode: 1, message: 'project profile already exists' };
35
+ }
36
+
37
+ const scanner = new FileSystemRepositoryScanner();
38
+ const scanRes = await scanner.scan(targetRoot);
39
+ if (!scanRes.ok) {
40
+ ctx.stderr(`kit init: discovery failed: ${scanRes.error.message}\n`);
41
+ return { exitCode: 1, message: scanRes.error.message };
42
+ }
43
+
44
+ const profileRes = generateProfile(scanRes.value);
45
+ if (!profileRes.ok) {
46
+ ctx.stderr(`kit init: profile generation failed: ${profileRes.error.message}\n`);
47
+ return { exitCode: 1, message: profileRes.error.message };
48
+ }
49
+
50
+ const profile = profileRes.value;
51
+ const writeRes = await writeProfile(targetRoot, profile);
52
+ if (!writeRes.ok) {
53
+ ctx.stderr(`kit init: write failed: ${writeRes.error.message}\n`);
54
+ return { exitCode: 1, message: writeRes.error.message };
55
+ }
56
+
57
+ await ensureDirectories(targetRoot);
58
+
59
+ if (isJson) {
60
+ ctx.stdout(JSON.stringify(profile, null, 2) + '\n');
61
+ } else {
62
+ ctx.stdout(formatOutput(targetRoot, profile));
63
+ }
64
+
65
+ return { exitCode: 0 };
66
+ },
67
+ };
68
+
69
+ async function fileExists(p: string): Promise<boolean> {
70
+ try {
71
+ const s = await fs.stat(p);
72
+ return s.isFile();
73
+ } catch {
74
+ return false;
75
+ }
76
+ }
77
+
78
+ async function ensureDirectories(root: string): Promise<void> {
79
+ // Machinery dirs follow KIT_STATE_DIR; project.yml itself stays project-rooted.
80
+ const stateRoot = kitStateRoot(root);
81
+ await fs.mkdir(path.join(stateRoot, 'state'), { recursive: true });
82
+ await fs.mkdir(path.join(stateRoot, 'reports'), { recursive: true });
83
+ }
84
+
85
+ function formatOutput(root: string, profile: ProjectProfile): string {
86
+ const lines: string[] = [
87
+ `Initialized Agentic SDLC Kit profile for '${profile.name}':`,
88
+ ` Stack: ${profile.stack.join(', ')}`,
89
+ ` Commands: ${Object.keys(profile.commands).join(', ') || '(none)'}`,
90
+ ` Config: ${path.join(root, '.ai-kit', 'project.yml')}`,
91
+ '',
92
+ "Next: Run 'kit inspect' to verify repository information.",
93
+ '',
94
+ ];
95
+ return lines.join('\n');
96
+ }
97
+
98
+ function formatHelp(): string {
99
+ return [
100
+ 'Usage: kit init [path] [--force] [--json]',
101
+ '',
102
+ 'Inspect a repository and generate .ai-kit/project.yml configuration.',
103
+ '',
104
+ 'Options:',
105
+ ' --force, -f Overwrite existing .ai-kit/project.yml',
106
+ ' --json Output generated profile as JSON',
107
+ ' -h, --help Show this help message',
108
+ '',
109
+ ].join('\n');
110
+ }
@@ -0,0 +1,57 @@
1
+ // packages/cli/src/commands/inspect.test.ts
2
+ import path from 'node:path';
3
+ import { describe, expect, it } from 'vitest';
4
+ import { inspectCommand } from './inspect.js';
5
+ import type { CommandContext } from './types.js';
6
+
7
+ const FIXTURE_ROOT = path.resolve(
8
+ new URL('../../../../fixtures/fixture-node-fullstack', import.meta.url).pathname,
9
+ );
10
+
11
+ const makeCtx = (argv: string[]): CommandContext & { out: string[]; err: string[] } => {
12
+ const out: string[] = [];
13
+ const err: string[] = [];
14
+ return {
15
+ argv,
16
+ cwd: FIXTURE_ROOT,
17
+ stdout: (s) => void out.push(s),
18
+ stderr: (s) => void err.push(s),
19
+ out,
20
+ err,
21
+ };
22
+ };
23
+
24
+ describe('inspectCommand', () => {
25
+ it('shows help when --help is passed', async () => {
26
+ const ctx = makeCtx(['--help']);
27
+ const r = await inspectCommand.run(ctx);
28
+ expect(r.exitCode).toBe(0);
29
+ expect(ctx.out[0]).toContain('Usage: kit inspect');
30
+ });
31
+
32
+ it('inspects fixture repository and prints summary', async () => {
33
+ const ctx = makeCtx([]);
34
+ const r = await inspectCommand.run(ctx);
35
+ expect(r.exitCode).toBe(0);
36
+ const text = ctx.out[0] ?? '';
37
+ expect(text).toContain('Repository:');
38
+ expect(text).toContain('node');
39
+ expect(text).toContain('node:test');
40
+ });
41
+
42
+ it('emits valid JSON when --json flag is passed', async () => {
43
+ const ctx = makeCtx(['--json']);
44
+ const r = await inspectCommand.run(ctx);
45
+ expect(r.exitCode).toBe(0);
46
+ const parsed = JSON.parse(ctx.out[0] ?? '{}');
47
+ expect(parsed.detectedStacks).toContain('node');
48
+ expect(parsed.testFrameworks).toContain('node:test');
49
+ });
50
+
51
+ it('fails when target path does not exist', async () => {
52
+ const ctx = makeCtx(['/non/existent/repo/path/xyz']);
53
+ const r = await inspectCommand.run(ctx);
54
+ expect(r.exitCode).toBe(1);
55
+ expect(ctx.err[0]).toContain('kit inspect: error:');
56
+ });
57
+ });
@@ -0,0 +1,73 @@
1
+ // packages/cli/src/commands/inspect.ts
2
+ //
3
+ // `kit inspect [path] [--json]`.
4
+ // Read-only inspection of target repository stacks, conventions, and git state.
5
+
6
+ import path from 'node:path';
7
+ import { FileSystemRepositoryScanner } from '@agentic-sdlc-kit/core';
8
+ import type { RepositoryScan } from '@agentic-sdlc-kit/contracts';
9
+ import type { Command, CommandContext, CommandResult } from './types.js';
10
+
11
+ export const inspectCommand: Command = {
12
+ name: 'inspect',
13
+ summary:
14
+ 'Inspect a repository and report detected stacks, frameworks, and conventions (read-only).',
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 targetArg = ctx.argv.find((a) => !a.startsWith('-'));
23
+ const targetRoot = path.resolve(ctx.cwd, targetArg ?? '.');
24
+
25
+ const scanner = new FileSystemRepositoryScanner();
26
+ const res = await scanner.scan(targetRoot);
27
+ if (!res.ok) {
28
+ ctx.stderr(`kit inspect: error: ${res.error.message}\n`);
29
+ return { exitCode: 1, message: res.error.message };
30
+ }
31
+
32
+ if (isJson) {
33
+ ctx.stdout(JSON.stringify(res.value, null, 2) + '\n');
34
+ } else {
35
+ ctx.stdout(formatSummary(res.value));
36
+ }
37
+
38
+ return { exitCode: 0 };
39
+ },
40
+ };
41
+
42
+ function formatSummary(scan: RepositoryScan): string {
43
+ const lines: string[] = [
44
+ `Repository: ${scan.root}`,
45
+ `Stacks: ${scan.detectedStacks.join(', ') || '(none)'}`,
46
+ `Package Mgr: ${scan.packageManagers.join(', ') || '(none)'}`,
47
+ `Test Tooling: ${scan.testFrameworks.join(', ') || '(none)'}`,
48
+ `Entry Points: ${scan.entryPoints.join(', ') || '(none)'}`,
49
+ `Migrations: ${scan.hasMigrations ? 'yes' : 'no'}`,
50
+ `CI Pipeline: ${scan.hasCi ? 'yes' : 'no'}`,
51
+ `Instructions: ${scan.agentInstructionFiles.join(', ') || '(none)'}`,
52
+ // Never fabricate git state: outside a work tree the scanner reports
53
+ // isRepo: false, and we say so instead of printing branch=main/0000000.
54
+ scan.git.isRepo
55
+ ? `Git Status: branch=${scan.git.branch || '(detached)'}, dirty=${scan.git.dirty}, commit=${scan.git.headSha.slice(0, 7)}`
56
+ : 'Git Status: (not a git repository)',
57
+ ];
58
+ return lines.join('\n') + '\n';
59
+ }
60
+
61
+ function formatHelp(): string {
62
+ return [
63
+ 'Usage: kit inspect [path] [--json]',
64
+ '',
65
+ 'Inspect a repository and report detected stacks, frameworks, and conventions.',
66
+ 'This command is strictly read-only and never modifies repository files.',
67
+ '',
68
+ 'Options:',
69
+ ' --json Output full inspection report as JSON',
70
+ ' -h, --help Show this help message',
71
+ '',
72
+ ].join('\n');
73
+ }