@agentic-sdlc-kit/cli 0.8.0 → 1.0.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 (235) hide show
  1. package/dist/application/agent/execution-store.d.ts.map +1 -1
  2. package/dist/application/agent/execution-store.js +2 -1
  3. package/dist/application/agent/execution-store.js.map +1 -1
  4. package/dist/application/agent/orchestrator.d.ts.map +1 -1
  5. package/dist/application/agent/orchestrator.js +5 -4
  6. package/dist/application/agent/orchestrator.js.map +1 -1
  7. package/dist/application/agent/providers/claude-code/permission-config.d.ts.map +1 -1
  8. package/dist/application/agent/providers/claude-code/permission-config.js +8 -2
  9. package/dist/application/agent/providers/claude-code/permission-config.js.map +1 -1
  10. package/dist/application/agent-tools/dispatch.d.ts +12 -0
  11. package/dist/application/agent-tools/dispatch.d.ts.map +1 -0
  12. package/dist/application/agent-tools/dispatch.js +189 -0
  13. package/dist/application/agent-tools/dispatch.js.map +1 -0
  14. package/dist/application/agent-tools/mcp-server.d.ts +10 -0
  15. package/dist/application/agent-tools/mcp-server.d.ts.map +1 -0
  16. package/dist/application/agent-tools/mcp-server.js +100 -0
  17. package/dist/application/agent-tools/mcp-server.js.map +1 -0
  18. package/dist/application/bench/harness.d.ts +5 -0
  19. package/dist/application/bench/harness.d.ts.map +1 -0
  20. package/dist/application/bench/harness.js +82 -0
  21. package/dist/application/bench/harness.js.map +1 -0
  22. package/dist/application/dispatcher.d.ts.map +1 -1
  23. package/dist/application/dispatcher.js +36 -0
  24. package/dist/application/dispatcher.js.map +1 -1
  25. package/dist/application/rule-adapters/ast-grep.d.ts +3 -0
  26. package/dist/application/rule-adapters/ast-grep.d.ts.map +1 -0
  27. package/dist/application/rule-adapters/ast-grep.js +112 -0
  28. package/dist/application/rule-adapters/ast-grep.js.map +1 -0
  29. package/dist/application/rule-adapters/index.d.ts +3 -0
  30. package/dist/application/rule-adapters/index.d.ts.map +1 -0
  31. package/dist/application/rule-adapters/index.js +15 -0
  32. package/dist/application/rule-adapters/index.js.map +1 -0
  33. package/dist/application/rule-adapters/linter.d.ts +31 -0
  34. package/dist/application/rule-adapters/linter.d.ts.map +1 -0
  35. package/dist/application/rule-adapters/linter.js +242 -0
  36. package/dist/application/rule-adapters/linter.js.map +1 -0
  37. package/dist/application/rule-adapters/process.d.ts +10 -0
  38. package/dist/application/rule-adapters/process.d.ts.map +1 -0
  39. package/dist/application/rule-adapters/process.js +38 -0
  40. package/dist/application/rule-adapters/process.js.map +1 -0
  41. package/dist/application/version.d.ts +1 -1
  42. package/dist/application/version.d.ts.map +1 -1
  43. package/dist/application/version.js +7 -4
  44. package/dist/application/version.js.map +1 -1
  45. package/dist/commands/attach-exclude.d.ts +8 -0
  46. package/dist/commands/attach-exclude.d.ts.map +1 -0
  47. package/dist/commands/attach-exclude.js +48 -0
  48. package/dist/commands/attach-exclude.js.map +1 -0
  49. package/dist/commands/attach-git.d.ts +11 -0
  50. package/dist/commands/attach-git.d.ts.map +1 -0
  51. package/dist/commands/attach-git.js +40 -0
  52. package/dist/commands/attach-git.js.map +1 -0
  53. package/dist/commands/attach-store.d.ts +10 -0
  54. package/dist/commands/attach-store.d.ts.map +1 -0
  55. package/dist/commands/attach-store.js +107 -0
  56. package/dist/commands/attach-store.js.map +1 -0
  57. package/dist/commands/attach.d.ts +8 -0
  58. package/dist/commands/attach.d.ts.map +1 -0
  59. package/dist/commands/attach.js +124 -0
  60. package/dist/commands/attach.js.map +1 -0
  61. package/dist/commands/bench.d.ts +3 -0
  62. package/dist/commands/bench.d.ts.map +1 -0
  63. package/dist/commands/bench.js +75 -0
  64. package/dist/commands/bench.js.map +1 -0
  65. package/dist/commands/context.d.ts +3 -0
  66. package/dist/commands/context.d.ts.map +1 -0
  67. package/dist/commands/context.js +56 -0
  68. package/dist/commands/context.js.map +1 -0
  69. package/dist/commands/doctor.d.ts.map +1 -1
  70. package/dist/commands/doctor.js +38 -0
  71. package/dist/commands/doctor.js.map +1 -1
  72. package/dist/commands/feature.d.ts.map +1 -1
  73. package/dist/commands/feature.js +48 -6
  74. package/dist/commands/feature.js.map +1 -1
  75. package/dist/commands/fix.d.ts +1 -0
  76. package/dist/commands/fix.d.ts.map +1 -1
  77. package/dist/commands/fix.js +42 -50
  78. package/dist/commands/fix.js.map +1 -1
  79. package/dist/commands/host-apply.d.ts +12 -0
  80. package/dist/commands/host-apply.d.ts.map +1 -0
  81. package/dist/commands/host-apply.js +43 -0
  82. package/dist/commands/host-apply.js.map +1 -0
  83. package/dist/commands/host.d.ts +3 -0
  84. package/dist/commands/host.d.ts.map +1 -0
  85. package/dist/commands/host.js +107 -0
  86. package/dist/commands/host.js.map +1 -0
  87. package/dist/commands/index.d.ts +12 -0
  88. package/dist/commands/index.d.ts.map +1 -1
  89. package/dist/commands/index.js +12 -0
  90. package/dist/commands/index.js.map +1 -1
  91. package/dist/commands/init.d.ts.map +1 -1
  92. package/dist/commands/init.js +5 -3
  93. package/dist/commands/init.js.map +1 -1
  94. package/dist/commands/install.d.ts.map +1 -1
  95. package/dist/commands/install.js +19 -8
  96. package/dist/commands/install.js.map +1 -1
  97. package/dist/commands/knowledge.d.ts +3 -0
  98. package/dist/commands/knowledge.d.ts.map +1 -0
  99. package/dist/commands/knowledge.js +59 -0
  100. package/dist/commands/knowledge.js.map +1 -0
  101. package/dist/commands/learning.d.ts +3 -0
  102. package/dist/commands/learning.d.ts.map +1 -0
  103. package/dist/commands/learning.js +126 -0
  104. package/dist/commands/learning.js.map +1 -0
  105. package/dist/commands/mcp.d.ts +3 -0
  106. package/dist/commands/mcp.d.ts.map +1 -0
  107. package/dist/commands/mcp.js +26 -0
  108. package/dist/commands/mcp.js.map +1 -0
  109. package/dist/commands/next.d.ts.map +1 -1
  110. package/dist/commands/next.js +3 -1
  111. package/dist/commands/next.js.map +1 -1
  112. package/dist/commands/onboard.d.ts +5 -0
  113. package/dist/commands/onboard.d.ts.map +1 -0
  114. package/dist/commands/onboard.js +137 -0
  115. package/dist/commands/onboard.js.map +1 -0
  116. package/dist/commands/plugin-linker.d.ts +10 -1
  117. package/dist/commands/plugin-linker.d.ts.map +1 -1
  118. package/dist/commands/plugin-linker.js +53 -14
  119. package/dist/commands/plugin-linker.js.map +1 -1
  120. package/dist/commands/routing.d.ts +3 -0
  121. package/dist/commands/routing.d.ts.map +1 -0
  122. package/dist/commands/routing.js +107 -0
  123. package/dist/commands/routing.js.map +1 -0
  124. package/dist/commands/rules-format.d.ts +4 -0
  125. package/dist/commands/rules-format.d.ts.map +1 -0
  126. package/dist/commands/rules-format.js +16 -0
  127. package/dist/commands/rules-format.js.map +1 -0
  128. package/dist/commands/rules.d.ts +3 -0
  129. package/dist/commands/rules.d.ts.map +1 -0
  130. package/dist/commands/rules.js +270 -0
  131. package/dist/commands/rules.js.map +1 -0
  132. package/dist/commands/skills-install-commit.d.ts +34 -0
  133. package/dist/commands/skills-install-commit.d.ts.map +1 -0
  134. package/dist/commands/skills-install-commit.js +113 -0
  135. package/dist/commands/skills-install-commit.js.map +1 -0
  136. package/dist/commands/skills-install-manifest.d.ts +35 -0
  137. package/dist/commands/skills-install-manifest.d.ts.map +1 -0
  138. package/dist/commands/skills-install-manifest.js +89 -0
  139. package/dist/commands/skills-install-manifest.js.map +1 -0
  140. package/dist/commands/skills-install-report.d.ts +12 -0
  141. package/dist/commands/skills-install-report.d.ts.map +1 -0
  142. package/dist/commands/skills-install-report.js +44 -0
  143. package/dist/commands/skills-install-report.js.map +1 -0
  144. package/dist/commands/skills-install-secure.d.ts +14 -0
  145. package/dist/commands/skills-install-secure.d.ts.map +1 -0
  146. package/dist/commands/skills-install-secure.js +96 -0
  147. package/dist/commands/skills-install-secure.js.map +1 -0
  148. package/dist/commands/skills-install.d.ts +15 -0
  149. package/dist/commands/skills-install.d.ts.map +1 -0
  150. package/dist/commands/skills-install.js +182 -0
  151. package/dist/commands/skills-install.js.map +1 -0
  152. package/dist/commands/skills.d.ts +3 -0
  153. package/dist/commands/skills.d.ts.map +1 -0
  154. package/dist/commands/skills.js +217 -0
  155. package/dist/commands/skills.js.map +1 -0
  156. package/dist/commands/uninstall.d.ts +3 -0
  157. package/dist/commands/uninstall.d.ts.map +1 -0
  158. package/dist/commands/uninstall.js +113 -0
  159. package/dist/commands/uninstall.js.map +1 -0
  160. package/dist/commands/verify.d.ts.map +1 -1
  161. package/dist/commands/verify.js +78 -6
  162. package/dist/commands/verify.js.map +1 -1
  163. package/package.json +11 -5
  164. package/src/application/agent/execution-store.ts +2 -1
  165. package/src/application/agent/orchestrator.test.ts +39 -0
  166. package/src/application/agent/orchestrator.ts +8 -1
  167. package/src/application/agent/providers/claude-code/claude-code-smoke.test.ts +1 -1
  168. package/src/application/agent/providers/claude-code/permission-config.test.ts +4 -4
  169. package/src/application/agent/providers/claude-code/permission-config.ts +8 -2
  170. package/src/application/agent/providers/claude-code/provider.test.ts +2 -2
  171. package/src/application/agent-tools/dispatch.test.ts +160 -0
  172. package/src/application/agent-tools/dispatch.ts +227 -0
  173. package/src/application/agent-tools/mcp-server.test.ts +86 -0
  174. package/src/application/agent-tools/mcp-server.ts +126 -0
  175. package/src/application/bench/harness.ts +95 -0
  176. package/src/application/dispatcher.test.ts +23 -3
  177. package/src/application/dispatcher.ts +24 -0
  178. package/src/application/rule-adapters/adapters.test.ts +224 -0
  179. package/src/application/rule-adapters/ast-grep.ts +126 -0
  180. package/src/application/rule-adapters/index.ts +16 -0
  181. package/src/application/rule-adapters/linter-paths.test.ts +95 -0
  182. package/src/application/rule-adapters/linter.ts +263 -0
  183. package/src/application/rule-adapters/process.ts +48 -0
  184. package/src/application/version.ts +9 -4
  185. package/src/commands/attach-exclude.ts +50 -0
  186. package/src/commands/attach-git.ts +50 -0
  187. package/src/commands/attach-store.ts +107 -0
  188. package/src/commands/attach.test.ts +192 -0
  189. package/src/commands/attach.ts +143 -0
  190. package/src/commands/bench.test.ts +136 -0
  191. package/src/commands/bench.ts +74 -0
  192. package/src/commands/context.test.ts +47 -0
  193. package/src/commands/context.ts +59 -0
  194. package/src/commands/doctor-isolation.test.ts +76 -0
  195. package/src/commands/doctor.test.ts +2 -1
  196. package/src/commands/doctor.ts +36 -0
  197. package/src/commands/feature.test.ts +36 -4
  198. package/src/commands/feature.ts +71 -8
  199. package/src/commands/fix.test.ts +95 -13
  200. package/src/commands/fix.ts +44 -55
  201. package/src/commands/host-apply.ts +61 -0
  202. package/src/commands/host.test.ts +120 -0
  203. package/src/commands/host.ts +125 -0
  204. package/src/commands/index.ts +12 -0
  205. package/src/commands/init.test.ts +22 -0
  206. package/src/commands/init.ts +10 -3
  207. package/src/commands/install.test.ts +31 -0
  208. package/src/commands/install.ts +25 -8
  209. package/src/commands/knowledge.test.ts +39 -0
  210. package/src/commands/knowledge.ts +63 -0
  211. package/src/commands/learning.test.ts +104 -0
  212. package/src/commands/learning.ts +134 -0
  213. package/src/commands/mcp.ts +30 -0
  214. package/src/commands/next.ts +3 -1
  215. package/src/commands/onboard.test.ts +83 -0
  216. package/src/commands/onboard.ts +146 -0
  217. package/src/commands/plugin-linker.test.ts +80 -0
  218. package/src/commands/plugin-linker.ts +62 -14
  219. package/src/commands/routing.test.ts +64 -0
  220. package/src/commands/routing.ts +107 -0
  221. package/src/commands/rules-format.ts +22 -0
  222. package/src/commands/rules.test.ts +153 -0
  223. package/src/commands/rules.ts +286 -0
  224. package/src/commands/skills-install-commit.ts +149 -0
  225. package/src/commands/skills-install-manifest.ts +124 -0
  226. package/src/commands/skills-install-report.ts +60 -0
  227. package/src/commands/skills-install-secure.ts +113 -0
  228. package/src/commands/skills-install.ts +245 -0
  229. package/src/commands/skills.test.ts +449 -0
  230. package/src/commands/skills.ts +247 -0
  231. package/src/commands/uninstall.test.ts +122 -0
  232. package/src/commands/uninstall.ts +116 -0
  233. package/src/commands/verify.test.ts +115 -0
  234. package/src/commands/verify.ts +95 -7
  235. package/src/commands/version.test.ts +9 -0
@@ -0,0 +1,192 @@
1
+ // packages/cli/src/commands/attach.test.ts
2
+ import { execFileSync } from 'node:child_process';
3
+ import { promises as fs } from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
7
+ import { attachCommand } from './attach.js';
8
+ import { BLOCK_BEGIN, stripBlock, withBlock } from './attach-exclude.js';
9
+ import type { CommandContext } from './types.js';
10
+
11
+ const git = (cwd: string, ...args: string[]): string =>
12
+ execFileSync('git', args, { cwd, encoding: 'utf8' });
13
+
14
+ async function mkrepo(dir: string, files: Record<string, string> = { 'README.md': 'hi' }) {
15
+ await fs.mkdir(dir, { recursive: true });
16
+ git(dir, 'init', '-q');
17
+ git(dir, 'config', 'user.email', 't@t');
18
+ git(dir, 'config', 'user.name', 't');
19
+ for (const [rel, body] of Object.entries(files)) {
20
+ await fs.mkdir(path.dirname(path.join(dir, rel)), { recursive: true });
21
+ await fs.writeFile(path.join(dir, rel), body);
22
+ }
23
+ git(dir, 'add', '-A');
24
+ git(dir, 'commit', '-qm', 'init');
25
+ }
26
+
27
+ const run = async (cwd: string, ...argv: string[]) => {
28
+ const out: string[] = [];
29
+ const err: string[] = [];
30
+ const ctx: CommandContext = {
31
+ argv,
32
+ cwd,
33
+ stdout: (s) => void out.push(s),
34
+ stderr: (s) => void err.push(s),
35
+ };
36
+ const r = await attachCommand.run(ctx);
37
+ return { ...r, out: out.join('\n'), err: err.join('\n') };
38
+ };
39
+
40
+ const clean = (dir: string): boolean => git(dir, 'status', '--porcelain').trim() === '';
41
+ const exists = (p: string) => fs.lstat(p).then(() => true, () => false);
42
+
43
+ let tmp: string;
44
+ let store: string;
45
+ beforeEach(async () => {
46
+ tmp = await fs.realpath(await fs.mkdtemp(path.join(os.tmpdir(), 'kit-attach-')));
47
+ store = path.join(tmp, 'store');
48
+ process.env['KIT_ATTACH_HOME'] = store;
49
+ });
50
+ afterEach(async () => {
51
+ delete process.env['KIT_ATTACH_HOME'];
52
+ await fs.rm(tmp, { recursive: true, force: true });
53
+ });
54
+
55
+ describe('attach exclude block (pure)', () => {
56
+ it('is idempotent and preserves foreign lines', () => {
57
+ const once = withBlock('node_modules\n', ['a', 'b']);
58
+ expect(withBlock(once, ['a', 'b'])).toBe(once);
59
+ expect(stripBlock(once)).toBe('node_modules\n');
60
+ });
61
+ });
62
+
63
+ describe('kit attach', () => {
64
+ it('local: invisible to git, writes work, idempotent', async () => {
65
+ const repo = path.join(tmp, 'a');
66
+ await mkrepo(repo);
67
+ const r = await run(repo, 'local');
68
+ expect(r.exitCode).toBe(0);
69
+ await fs.writeFile(path.join(repo, '.ai-kit', 'project.yml'), 'x');
70
+ expect(clean(repo)).toBe(true);
71
+ expect((await run(repo, 'local')).exitCode).toBe(0);
72
+ const ex = await fs.readFile(path.join(repo, '.git', 'info', 'exclude'), 'utf8');
73
+ expect(ex.split(BLOCK_BEGIN).length - 1).toBe(1);
74
+ });
75
+
76
+ it('global: symlink is ignored and bytes land in the store', async () => {
77
+ const repo = path.join(tmp, 'b');
78
+ await mkrepo(repo);
79
+ expect((await run(repo, 'global')).exitCode).toBe(0);
80
+ await fs.writeFile(path.join(repo, '.ai-kit', 'project.yml'), 'x');
81
+ expect((await fs.lstat(path.join(repo, '.ai-kit'))).isSymbolicLink()).toBe(true);
82
+ expect(clean(repo)).toBe(true);
83
+ const target = await fs.readlink(path.join(repo, '.ai-kit'));
84
+ expect(target.startsWith(store)).toBe(true);
85
+ expect(await fs.readFile(path.join(target, 'project.yml'), 'utf8')).toBe('x');
86
+ });
87
+
88
+ it('refuses when a managed path has tracked files, changing nothing', async () => {
89
+ const repo = path.join(tmp, 'c');
90
+ await mkrepo(repo, { 'README.md': 'hi', 'docs/plans/keep.md': 'k' });
91
+ for (const mode of ['local', 'global']) {
92
+ const r = await run(repo, mode);
93
+ expect(r.exitCode).toBe(1);
94
+ expect(r.err).toContain('tracked files');
95
+ }
96
+ expect(await exists(path.join(repo, '.ai-kit'))).toBe(false);
97
+ });
98
+
99
+ it('global without --adopt refuses untracked content and is atomic', async () => {
100
+ const repo = path.join(tmp, 'd1');
101
+ await mkrepo(repo);
102
+ await fs.mkdir(path.join(repo, 'docs/plans'), { recursive: true });
103
+ await fs.writeFile(path.join(repo, 'docs/plans/old.md'), 'old');
104
+ const r = await run(repo, 'global');
105
+ expect(r.exitCode).toBe(1);
106
+ expect(r.err).toContain('--adopt');
107
+ expect(await exists(path.join(repo, '.ai-kit'))).toBe(false); // no half-attach
108
+ });
109
+
110
+ it('global --adopt migrates untracked content into the store', async () => {
111
+ const repo = path.join(tmp, 'd2');
112
+ await mkrepo(repo);
113
+ await fs.mkdir(path.join(repo, 'docs/plans'), { recursive: true });
114
+ await fs.writeFile(path.join(repo, 'docs/plans/old.md'), 'old');
115
+ expect((await run(repo, 'global', '--adopt')).exitCode).toBe(0);
116
+ expect(await fs.readFile(path.join(repo, 'docs/plans/old.md'), 'utf8')).toBe('old');
117
+ expect((await fs.lstat(path.join(repo, 'docs/plans'))).isSymbolicLink()).toBe(true);
118
+ expect(clean(repo)).toBe(true);
119
+ });
120
+
121
+ it('--adopt is rejected for local', async () => {
122
+ const repo = path.join(tmp, 'e1');
123
+ await mkrepo(repo);
124
+ const r = await run(repo, 'local', '--adopt');
125
+ expect(r.exitCode).toBe(1);
126
+ expect(r.err).toContain("only valid with 'global'");
127
+ });
128
+
129
+ it('local refuses to run over a global symlink', async () => {
130
+ const repo = path.join(tmp, 'e2');
131
+ await mkrepo(repo);
132
+ await run(repo, 'global');
133
+ const r = await run(repo, 'local');
134
+ expect(r.exitCode).toBe(1);
135
+ expect(r.err).toContain('detach');
136
+ });
137
+
138
+ it('detach removes symlinks and exclusion but keeps store data', async () => {
139
+ const repo = path.join(tmp, 'f');
140
+ await mkrepo(repo);
141
+ await run(repo, 'global');
142
+ await fs.writeFile(path.join(repo, '.ai-kit', 'project.yml'), 'x');
143
+ const target = await fs.readlink(path.join(repo, '.ai-kit'));
144
+ expect((await run(repo, 'detach')).exitCode).toBe(0);
145
+ expect(await exists(path.join(repo, '.ai-kit'))).toBe(false);
146
+ expect(await fs.readFile(path.join(target, 'project.yml'), 'utf8')).toBe('x');
147
+ const ex = await fs.readFile(path.join(repo, '.git', 'info', 'exclude'), 'utf8');
148
+ expect(ex).not.toContain(BLOCK_BEGIN);
149
+ });
150
+
151
+ it('detach leaves symlinks that point outside the store alone', async () => {
152
+ const repo = path.join(tmp, 'g');
153
+ await mkrepo(repo);
154
+ const foreign = path.join(tmp, 'foreign');
155
+ await fs.mkdir(foreign);
156
+ await fs.symlink(foreign, path.join(repo, '.ai-kit'), 'dir');
157
+ await run(repo, 'detach');
158
+ expect((await fs.lstat(path.join(repo, '.ai-kit'))).isSymbolicLink()).toBe(true);
159
+ });
160
+
161
+ it('linked worktree: exclude lives in the common git dir', async () => {
162
+ const repo = path.join(tmp, 'h');
163
+ await mkrepo(repo);
164
+ const wt = path.join(tmp, 'h-wt');
165
+ git(repo, 'worktree', 'add', '-q', wt, '-b', 'wt');
166
+ expect((await run(wt, 'local')).exitCode).toBe(0);
167
+ expect(await fs.readFile(path.join(repo, '.git', 'info', 'exclude'), 'utf8')).toContain(BLOCK_BEGIN);
168
+ expect(clean(wt)).toBe(true);
169
+ });
170
+
171
+ it('status reports mode and invisibility; fails closed when not attached', async () => {
172
+ const repo = path.join(tmp, 'i');
173
+ await mkrepo(repo);
174
+ await fs.mkdir(path.join(repo, '.ai-kit'));
175
+ await fs.writeFile(path.join(repo, '.ai-kit', 'x'), 'x');
176
+ const before = await run(repo, 'status');
177
+ expect(before.exitCode).toBe(1); // leaking
178
+ await run(repo, 'local');
179
+ const after = await run(repo, 'status');
180
+ expect(after.exitCode).toBe(0);
181
+ expect(after.out).toContain('exclude block: present');
182
+ });
183
+
184
+ it('errors outside a git repo and on unknown subcommand', async () => {
185
+ const plain = path.join(tmp, 'plain');
186
+ await fs.mkdir(plain);
187
+ expect((await run(plain, 'local')).err).toContain('not inside a git repository');
188
+ expect((await run(plain, 'bogus')).exitCode).toBe(1);
189
+ expect((await run(plain)).exitCode).toBe(1);
190
+ expect((await run(plain, '--help')).exitCode).toBe(0);
191
+ });
192
+ });
@@ -0,0 +1,143 @@
1
+ // packages/cli/src/commands/attach.ts
2
+ //
3
+ // `kit attach <local|global|status|detach> [--adopt]`
4
+ //
5
+ // Provisions the kit's working paths (.ai-kit, .claude, docs/specifications,
6
+ // docs/plans) WITHOUT touching tracked files, and proves git-invisibility
7
+ // before reporting success (fail closed).
8
+ // local real directories, hidden via .git/info/exclude
9
+ // global symlinks into $KIT_ATTACH_HOME/<repo>-<hash>/ (default
10
+ // ~/.agentic-sdlc/projects)
11
+ //
12
+ // Mode 1 (`kit feature <id> run`) needs committed artifacts and therefore
13
+ // cannot be used while attached; Mode 2 / `kit next` is unaffected.
14
+
15
+ import path from 'node:path';
16
+ import {
17
+ hasTrackedFiles,
18
+ isIgnored,
19
+ resolveRepo,
20
+ statusLeaks,
21
+ type RepoInfo,
22
+ } from './attach-git.js';
23
+ import { hasBlock, removeBlock, writeBlock } from './attach-exclude.js';
24
+ import {
25
+ AttachError,
26
+ MANAGED_PATHS,
27
+ attachGlobal,
28
+ attachLocal,
29
+ describePath,
30
+ detachLinks,
31
+ storeBase,
32
+ storeDirFor,
33
+ } from './attach-store.js';
34
+ import type { Command, CommandContext, CommandResult } from './types.js';
35
+
36
+ const USAGE = [
37
+ 'Usage: kit attach <local|global|status|detach> [--adopt]',
38
+ ' local real dirs in the repo, hidden via .git/info/exclude',
39
+ ' global symlinks into $KIT_ATTACH_HOME/<repo>-<hash>/',
40
+ ' status show mode per path and prove git invisibility',
41
+ ' detach remove exclude block; remove global symlinks (store data kept)',
42
+ ' --adopt global only: migrate existing UNTRACKED content into the store',
43
+ ].join('\n');
44
+
45
+ const excludeFile = (repo: RepoInfo): string => path.join(repo.commonDir, 'info', 'exclude');
46
+
47
+ /** Returns report lines; `leaked` is true when any managed path is visible to git. */
48
+ export function verifyInvisible(root: string): { lines: string[]; leaked: boolean } {
49
+ const lines: string[] = [];
50
+ let leaked = false;
51
+ for (const rel of MANAGED_PATHS) {
52
+ const ignored = isIgnored(root, rel);
53
+ lines.push(` ${ignored ? 'ignored: ' : 'NOT IGNORED:'} ${rel}`);
54
+ if (!ignored) leaked = true;
55
+ }
56
+ const leaks = statusLeaks(root, MANAGED_PATHS);
57
+ for (const l of leaks) lines.push(` git status LEAK: ${l}`);
58
+ return { lines, leaked: leaked || leaks.length > 0 };
59
+ }
60
+
61
+ function assertUntracked(root: string): void {
62
+ for (const rel of MANAGED_PATHS) {
63
+ if (hasTrackedFiles(root, rel)) {
64
+ throw new AttachError(
65
+ `REFUSED: '${rel}' contains tracked files. Untrack first (git rm -r --cached '${rel}').`,
66
+ );
67
+ }
68
+ }
69
+ }
70
+
71
+ function proof(root: string, header: string): CommandResult & { text: string } {
72
+ const v = verifyInvisible(root);
73
+ if (v.leaked) {
74
+ const text = [...v.lines, 'verification failed: managed paths are visible to git'].join('\n');
75
+ return { exitCode: 1, text };
76
+ }
77
+ return { exitCode: 0, text: [header, ...v.lines, ' git status: clean for all managed paths.'].join('\n') };
78
+ }
79
+
80
+ async function runMode(mode: 'local' | 'global', repo: RepoInfo, adopt: boolean): Promise<string> {
81
+ assertUntracked(repo.root);
82
+ const store = storeDirFor(repo.root);
83
+ if (mode === 'local') await attachLocal(repo.root);
84
+ else await attachGlobal(repo.root, store, adopt);
85
+ await writeBlock(excludeFile(repo), MANAGED_PATHS);
86
+ return mode === 'local' ? `Attached (local). Exclude: ${excludeFile(repo)}` : `Attached (global). Store: ${store}`;
87
+ }
88
+
89
+ async function runStatus(repo: RepoInfo): Promise<CommandResult & { text: string }> {
90
+ const lines = [`repo: ${repo.root}`, `store: ${storeDirFor(repo.root)}`];
91
+ for (const rel of MANAGED_PATHS) lines.push(` ${await describePath(repo.root, rel)}`);
92
+ const present = await hasBlock(excludeFile(repo));
93
+ lines.push(`exclude block: ${present ? 'present' : 'absent'}`);
94
+ const v = verifyInvisible(repo.root);
95
+ lines.push(...v.lines);
96
+ return { exitCode: v.leaked ? 1 : 0, text: lines.join('\n') };
97
+ }
98
+
99
+ async function runDetach(repo: RepoInfo): Promise<string> {
100
+ await removeBlock(excludeFile(repo));
101
+ const removed = await detachLinks(repo.root, storeBase(storeDirFor(repo.root)));
102
+ const lines = removed.map((r) => ` removed symlink: ${r} (data kept in store)`);
103
+ lines.push('Detached. Local directories (if any) left untouched.');
104
+ return lines.join('\n');
105
+ }
106
+
107
+ async function execute(sub: string, repo: RepoInfo, adopt: boolean): Promise<CommandResult & { text: string }> {
108
+ if (sub === 'status') return runStatus(repo);
109
+ if (sub === 'detach') return { exitCode: 0, text: await runDetach(repo) };
110
+ if (adopt && sub !== 'global') throw new AttachError("--adopt is only valid with 'global'");
111
+ const header = await runMode(sub as 'local' | 'global', repo, adopt);
112
+ return proof(repo.root, header);
113
+ }
114
+
115
+ export const attachCommand: Command = {
116
+ name: 'attach',
117
+ summary: 'Attach kit working paths to a repo without tracking them (local|global).',
118
+ async run(ctx: CommandContext): Promise<CommandResult> {
119
+ const positional = ctx.argv.filter((a) => !a.startsWith('-'));
120
+ const sub = positional[0];
121
+ if (ctx.argv.includes('--help') || !sub) {
122
+ ctx.stdout(USAGE);
123
+ return { exitCode: sub || ctx.argv.includes('--help') ? 0 : 1 };
124
+ }
125
+ if (!['local', 'global', 'status', 'detach'].includes(sub)) {
126
+ ctx.stderr(`kit attach: unknown subcommand '${sub}'\n${USAGE}`);
127
+ return { exitCode: 1 };
128
+ }
129
+ const repo = resolveRepo(ctx.cwd);
130
+ if (!repo) {
131
+ ctx.stderr('kit attach: not inside a git repository');
132
+ return { exitCode: 1 };
133
+ }
134
+ try {
135
+ const r = await execute(sub, repo, ctx.argv.includes('--adopt'));
136
+ (r.exitCode === 0 ? ctx.stdout : ctx.stderr)(r.text);
137
+ return { exitCode: r.exitCode };
138
+ } catch (e) {
139
+ ctx.stderr(`kit attach: ${e instanceof Error ? e.message : String(e)}`);
140
+ return { exitCode: 1 };
141
+ }
142
+ },
143
+ };
@@ -0,0 +1,136 @@
1
+ // The benchmark harness end to end on a real git fixture: per-task commits select the agent's
2
+ // behaviour (fix, do nothing, hang); a bad commit is an infrastructure error; worktrees are removed.
3
+ import { execFileSync } from 'node:child_process';
4
+ import { promises as fs } from 'node:fs';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { afterEach, beforeEach, describe, expect, it } from 'vitest';
8
+ import { loadSuite, wilson95 } from '@agentic-sdlc-kit/core';
9
+ import { BenchReportSchema } from '@agentic-sdlc-kit/contracts';
10
+ import { benchCommand } from './bench.js';
11
+ import type { CommandContext } from './types.js';
12
+
13
+ const git = (cwd: string, args: string[]): string =>
14
+ execFileSync('git', ['-c', 'user.email=t@t', '-c', 'user.name=t', ...args], { cwd, encoding: 'utf8' }).trim();
15
+
16
+ function ctx(argv: string[], cwd: string): CommandContext & { out: string[]; err: string[] } {
17
+ const out: string[] = [];
18
+ const err: string[] = [];
19
+ return { argv, cwd, stdout: (s) => void out.push(s), stderr: (s) => void err.push(s), out, err };
20
+ }
21
+
22
+ let base: string;
23
+ let repo: string;
24
+ let sha: Record<'fix' | 'noop' | 'slow', string>;
25
+
26
+ const AGENT = `const fs = require('fs');
27
+ const mode = fs.readFileSync('mode.txt', 'utf8').trim();
28
+ if (mode === 'fix') fs.writeFileSync('fixed.txt', '1');
29
+ if (mode === 'slow') setTimeout(() => {}, 60000);
30
+ `;
31
+ const CHECK = `process.exit(require('fs').existsSync('fixed.txt') ? 0 : 1);\n`;
32
+
33
+ async function commitWithMode(mode: string): Promise<string> {
34
+ await fs.writeFile(path.join(repo, 'mode.txt'), `${mode}\n`);
35
+ git(repo, ['add', '-A']);
36
+ git(repo, ['commit', '-q', '--allow-empty', '-m', mode]);
37
+ return git(repo, ['rev-parse', 'HEAD']);
38
+ }
39
+
40
+ async function task(id: string, split: 'tune' | 'holdout', commit: string, timeoutMs = 4000): Promise<void> {
41
+ await fs.writeFile(
42
+ path.join(base, 'suite', 'tasks', `${id}.yml`),
43
+ [
44
+ 'schemaVersion: 1', `id: ${id}`, `title: ${id}`, `split: ${split}`, 'repository: repo',
45
+ `commit: '${commit}'`, 'ticket: fix the check', 'acceptance:', ' - [node, check.js]',
46
+ `budget:`, ` timeoutMs: ${timeoutMs}`, '',
47
+ ].join('\n'),
48
+ );
49
+ }
50
+
51
+ beforeEach(async () => {
52
+ base = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-bench-cli-'));
53
+ repo = path.join(base, 'suite', 'repo');
54
+ await fs.mkdir(path.join(base, 'suite', 'tasks'), { recursive: true });
55
+ await fs.mkdir(repo, { recursive: true });
56
+ git(repo, ['init', '-q']);
57
+ await fs.writeFile(path.join(repo, 'agent.js'), AGENT);
58
+ await fs.writeFile(path.join(repo, 'check.js'), CHECK);
59
+ git(repo, ['add', '-A']);
60
+ git(repo, ['commit', '-q', '-m', 'base']);
61
+ sha = { fix: await commitWithMode('fix'), noop: await commitWithMode('noop'), slow: await commitWithMode('slow') };
62
+ await fs.writeFile(
63
+ path.join(base, 'suite', 'suite.yml'),
64
+ 'schemaVersion: 1\nname: fixture\nversion: 0.1.0\nrunner:\n argv: [node, agent.js]\n timeoutMs: 4000\n',
65
+ );
66
+ });
67
+
68
+ afterEach(async () => {
69
+ await fs.rm(base, { recursive: true, force: true });
70
+ });
71
+
72
+ describe('kit bench run', () => {
73
+ it('scores each task from deterministic facts and keeps the splits apart', async () => {
74
+ await task('fixes', 'tune', sha.fix);
75
+ await task('broken-commit', 'tune', '0'.repeat(40));
76
+ await task('does-nothing', 'holdout', sha.noop);
77
+ await task('hangs', 'holdout', sha.slow, 1000);
78
+
79
+ const out = ctx(['run', '--suite', path.join(base, 'suite'), '--json'], base);
80
+ const code = (await benchCommand.run(out)).exitCode;
81
+ expect(out.err.join(''), 'stderr').toBe('');
82
+ expect(code).toBe(0);
83
+ const report = BenchReportSchema.parse(JSON.parse(out.out.join('')));
84
+
85
+ const byTask = Object.fromEntries(report.runs.map((r) => [r.task, r.outcome]));
86
+ expect(byTask).toEqual({
87
+ fixes: 'success',
88
+ 'broken-commit': 'infra_error',
89
+ 'does-nothing': 'agent_failed',
90
+ hangs: 'agent_failed',
91
+ });
92
+ // Infra errors leave the rate: the one scored tune run succeeded.
93
+ expect(report.tune.successRate).toBe(1);
94
+ expect(report.tune.infraErrors).toBe(1);
95
+ expect(report.holdout.successRate).toBe(0);
96
+ expect(report.holdout.runs).toBe(2);
97
+ });
98
+
99
+ it('removes every disposable worktree it created', async () => {
100
+ await task('fixes', 'tune', sha.fix);
101
+ await task('does-nothing', 'holdout', sha.noop);
102
+ await benchCommand.run(ctx(['run', '--suite', path.join(base, 'suite'), '--json'], base));
103
+ const worktrees = git(repo, ['worktree', 'list', '--porcelain']).split('\n').filter((l) => l.startsWith('worktree '));
104
+ expect(worktrees).toHaveLength(1);
105
+ });
106
+
107
+ it('writes the report to --out and renders Markdown with the infrastructure and hold-out split shown', async () => {
108
+ await task('fixes', 'tune', sha.fix);
109
+ const outFile = path.join(base, 'report.json');
110
+ const res = ctx(['run', '--suite', path.join(base, 'suite'), '--out', outFile], base);
111
+ expect((await benchCommand.run(res)).exitCode).toBe(0);
112
+ expect(res.out.join('')).toContain('Hold-out split (never used for tuning)');
113
+ expect(BenchReportSchema.safeParse(JSON.parse(await fs.readFile(outFile, 'utf8'))).success).toBe(true);
114
+ });
115
+
116
+ it('refuses a suite with a duplicate task id', async () => {
117
+ await task('same', 'tune', sha.fix);
118
+ await fs.writeFile(path.join(base, 'suite', 'tasks', 'copy.yml'), await fs.readFile(path.join(base, 'suite', 'tasks', 'same.yml'), 'utf8'));
119
+ expect((await loadSuite(path.join(base, 'suite'))).ok).toBe(false);
120
+ });
121
+
122
+ it('report refuses a file that is not a benchmark report', async () => {
123
+ const file = path.join(base, 'x.json');
124
+ await fs.writeFile(file, '{"schemaVersion": 9}');
125
+ expect((await benchCommand.run(ctx(['report', '--from', file], base))).exitCode).toBe(1);
126
+ });
127
+ });
128
+
129
+ describe('the interval', () => {
130
+ it('is null without scored runs and wide on a small sample', () => {
131
+ expect(wilson95(0, 0)).toBeNull();
132
+ const small = wilson95(1, 1);
133
+ const large = wilson95(100, 100);
134
+ expect(small && small.high - small.low).toBeGreaterThan(large ? large.high - large.low : 1);
135
+ });
136
+ });
@@ -0,0 +1,74 @@
1
+ // packages/cli/src/commands/bench.ts
2
+ //
3
+ // `kit bench run --suite <dir> [--out <file>] [--json]` and `kit bench report --from <file> [--md]`.
4
+ // Results separate infrastructure errors from agent failures, and the hold-out split from the tune
5
+ // split. The success rate excludes infrastructure errors.
6
+
7
+ import { promises as fs } from 'node:fs';
8
+ import path from 'node:path';
9
+ import { loadSuite, renderMarkdown } from '@agentic-sdlc-kit/core';
10
+ import { BenchReportSchema } from '@agentic-sdlc-kit/contracts';
11
+ import { runSuite } from '../application/bench/harness.js';
12
+ import type { Command, CommandContext, CommandResult } from './types.js';
13
+
14
+ const HELP = `Usage: kit bench <run|report>
15
+
16
+ run --suite <dir> [--out <file>] [--json] Run every task in a suite, each in a disposable worktree.
17
+ report --from <file> [--md] Show a saved report as text or Markdown.
18
+
19
+ Runners and acceptance commands execute the repository under test. The worktree isolates the
20
+ working tree, not the process: this is not a sandbox.
21
+ `;
22
+
23
+ function flag(argv: readonly string[], name: string): string | undefined {
24
+ const i = argv.indexOf(name);
25
+ return i >= 0 ? argv[i + 1] : undefined;
26
+ }
27
+
28
+ function fail(ctx: CommandContext, message: string, exitCode = 1): CommandResult {
29
+ ctx.stderr(`kit bench: ${message}\n`);
30
+ return { exitCode, message };
31
+ }
32
+
33
+ async function runCommand(ctx: CommandContext): Promise<CommandResult> {
34
+ const suiteDir = flag(ctx.argv, '--suite');
35
+ if (suiteDir === undefined) return fail(ctx, 'run needs --suite <dir>', 2);
36
+ const loaded = await loadSuite(path.resolve(ctx.cwd, suiteDir));
37
+ if (!loaded.ok) return fail(ctx, loaded.error.message);
38
+ const report = await runSuite(loaded.value, new Date());
39
+ const text = ctx.argv.includes('--json') ? `${JSON.stringify(report, null, 2)}\n` : renderMarkdown(report);
40
+ const out = flag(ctx.argv, '--out');
41
+ if (out !== undefined) await fs.writeFile(path.resolve(ctx.cwd, out), `${JSON.stringify(report, null, 2)}\n`, 'utf8');
42
+ ctx.stdout(text);
43
+ return { exitCode: 0 };
44
+ }
45
+
46
+ async function reportCommand(ctx: CommandContext): Promise<CommandResult> {
47
+ const from = flag(ctx.argv, '--from');
48
+ if (from === undefined) return fail(ctx, 'report needs --from <file>', 2);
49
+ let json: unknown;
50
+ try {
51
+ json = JSON.parse(await fs.readFile(path.resolve(ctx.cwd, from), 'utf8'));
52
+ } catch (cause) {
53
+ return fail(ctx, `cannot read ${from}: ${cause instanceof Error ? cause.message : String(cause)}`);
54
+ }
55
+ const parsed = BenchReportSchema.safeParse(json);
56
+ if (!parsed.success) return fail(ctx, `${from} is not a valid benchmark report`);
57
+ ctx.stdout(ctx.argv.includes('--md') ? renderMarkdown(parsed.data) : `${JSON.stringify(parsed.data, null, 2)}\n`);
58
+ return { exitCode: 0 };
59
+ }
60
+
61
+ export const benchCommand: Command = {
62
+ name: 'bench',
63
+ summary: 'Run the agent regression benchmark suite, or show a saved report (roadmap Phase 5).',
64
+ async run(ctx: CommandContext): Promise<CommandResult> {
65
+ const sub = ctx.argv.find((a) => !a.startsWith('-'));
66
+ if (ctx.argv.includes('--help') || ctx.argv.includes('-h') || sub === undefined) {
67
+ ctx.stdout(HELP);
68
+ return { exitCode: sub === undefined && !ctx.argv.includes('--help') ? 2 : 0 };
69
+ }
70
+ if (sub === 'run') return runCommand(ctx);
71
+ if (sub === 'report') return reportCommand(ctx);
72
+ return fail(ctx, `unknown subcommand "${sub}"\n${HELP}`, 2);
73
+ },
74
+ };
@@ -0,0 +1,47 @@
1
+ // packages/cli/src/commands/context.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 { contextCommand } from './context.js';
7
+ import type { CommandContext } from './types.js';
8
+
9
+ function ctx(argv: string[], cwd: string): CommandContext & { out: string[]; err: string[] } {
10
+ const out: string[] = [];
11
+ const err: string[] = [];
12
+ return { argv, cwd, stdout: (s) => void out.push(s), stderr: (s) => void err.push(s), out, err };
13
+ }
14
+
15
+ let root: string;
16
+ beforeEach(async () => {
17
+ root = await fs.mkdtemp(path.join(os.tmpdir(), 'kit-cli-context-'));
18
+ });
19
+ afterEach(async () => {
20
+ await fs.rm(root, { recursive: true, force: true });
21
+ });
22
+
23
+ describe('kit context', () => {
24
+ it('prints the human summary and says when no files were given', async () => {
25
+ const c = ctx([], root);
26
+ expect((await contextCommand.run(c)).exitCode).toBe(0);
27
+ const text = c.out.join('');
28
+ expect(text).toContain('Constitution: absent');
29
+ expect(text).toContain('Files: none given');
30
+ expect(text).toContain('not evaluated');
31
+ });
32
+
33
+ it('--json emits a contract-valid context for the given files', async () => {
34
+ const c = ctx(['--json', '--files', 'packages/core/src/a.ts'], root);
35
+ expect((await contextCommand.run(c)).exitCode).toBe(0);
36
+ const parsed = JSON.parse(c.out.join(''));
37
+ expect(parsed.schemaVersion).toBe(1);
38
+ expect(parsed.files).toEqual(['packages/core/src/a.ts']);
39
+ });
40
+
41
+ it('reports an invalid profile as an error, not an empty context', async () => {
42
+ await fs.mkdir(path.join(root, '.ai-kit'), { recursive: true });
43
+ await fs.writeFile(path.join(root, '.ai-kit', 'project.yml'), 'schemaVersion: 1\nbogus: true\n');
44
+ const c = ctx([], root);
45
+ expect((await contextCommand.run(c)).exitCode).toBe(1);
46
+ });
47
+ });
@@ -0,0 +1,59 @@
1
+ // packages/cli/src/commands/context.ts
2
+ //
3
+ // `kit context [--files a,b] [--stack s,t] [--json]` (platform roadmap Phase 3).
4
+ // Read-only. Prints the task-scoped project context that agentic-mods and other
5
+ // hosts consume. Without --files it reports the project but no task-scoped rules.
6
+
7
+ import path from 'node:path';
8
+ import { projectContext } from '@agentic-sdlc-kit/core';
9
+ import type { ProjectContext } from '@agentic-sdlc-kit/contracts';
10
+ import { ProjectContextSchema } from '@agentic-sdlc-kit/contracts';
11
+ import type { Command, CommandContext, CommandResult } from './types.js';
12
+ import { constitutionAdapters } from '../application/rule-adapters/index.js';
13
+
14
+ function flagList(argv: readonly string[], name: string): string[] | undefined {
15
+ const i = argv.indexOf(name);
16
+ if (i < 0) return undefined;
17
+ return (argv[i + 1] ?? '').split(',').map((s) => s.trim()).filter(Boolean);
18
+ }
19
+
20
+ function renderContext(c: ProjectContext): string {
21
+ const gate = c.constitution.gate ?? 'not evaluated';
22
+ const verification = c.verification ? `${c.verification.status} (${c.verification.runId})` : 'none recorded';
23
+ const lines = [
24
+ `Project: ${c.project.name}`,
25
+ `Stacks: ${c.project.stacks.join(', ') || 'none declared'}`,
26
+ `Constitution: ${c.constitution.present ? `${c.constitution.ruleCount} rule(s)` : 'absent'}, required: ${c.constitution.required}, gate: ${gate}`,
27
+ `Last verify: ${verification}`,
28
+ `Files: ${c.files.length > 0 ? c.files.join(', ') : 'none given'}`,
29
+ '',
30
+ `Applicable rules (${c.rules.length}):`,
31
+ ...c.rules.map((r) => ` - ${r.id} [${r.mode}] ${r.statement}`),
32
+ `Patterns: ${c.patterns.length} Decision records: ${c.decisions.length}`,
33
+ ];
34
+ for (const note of c.notes) lines.push(`note: ${note}`);
35
+ return `${lines.join('\n')}\n`;
36
+ }
37
+
38
+ export const contextCommand: Command = {
39
+ name: 'context',
40
+ summary: 'Show task-scoped project context for the given files (read-only).',
41
+ async run(ctx: CommandContext): Promise<CommandResult> {
42
+ if (ctx.argv.includes('--help') || ctx.argv.includes('-h')) {
43
+ ctx.stdout('Usage: kit context [--files a,b] [--stack s,t] [--json]\n');
44
+ return { exitCode: 0 };
45
+ }
46
+ const result = await projectContext(path.resolve(ctx.cwd), {
47
+ files: flagList(ctx.argv, '--files'),
48
+ stacks: flagList(ctx.argv, '--stack'),
49
+ adapters: constitutionAdapters(),
50
+ });
51
+ if (!result.ok) {
52
+ ctx.stderr(`kit context: ${result.error.message}\n`);
53
+ return { exitCode: 1, message: result.error.message };
54
+ }
55
+ const payload = ProjectContextSchema.parse(result.value);
56
+ ctx.stdout(ctx.argv.includes('--json') ? `${JSON.stringify(payload, null, 2)}\n` : renderContext(payload));
57
+ return { exitCode: 0 };
58
+ },
59
+ };