@dadado/agent-kit-cli 5.15.1 → 5.17.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.
Files changed (72) hide show
  1. package/dashboard/dashboard-data.mjs +69 -65
  2. package/dashboard/lib/guards.d.mts +5 -0
  3. package/dashboard/lib/guards.mjs +31 -0
  4. package/dashboard/lib/identity-probe.mjs +56 -0
  5. package/dashboard/lib/pipeline-cache.mjs +58 -0
  6. package/dashboard/lib/processes.mjs +71 -0
  7. package/dashboard/serve.mjs +43 -1
  8. package/dashboard/start-broadcast.mjs +2 -12
  9. package/dashboard/start.mjs +2 -13
  10. package/dist/add-HTYIFKMN.js +150 -0
  11. package/dist/chunk-2IPXQFJE.js +253 -0
  12. package/dist/chunk-2RDRMGD3.js +82 -0
  13. package/dist/chunk-2YU2H7I6.js +42 -0
  14. package/dist/chunk-4IWG5CVE.js +214 -0
  15. package/dist/chunk-5VCOWTTP.js +6 -0
  16. package/dist/chunk-77V75A7O.js +39 -0
  17. package/dist/chunk-7HDQEK6T.js +26 -0
  18. package/dist/chunk-AW74INUW.js +1456 -0
  19. package/dist/chunk-B73KQ5KX.js +972 -0
  20. package/dist/chunk-CBCW5R5J.js +484 -0
  21. package/dist/chunk-DE3LQFSJ.js +18 -0
  22. package/dist/chunk-DQA434Y4.js +106 -0
  23. package/dist/chunk-F4VMYR7U.js +318 -0
  24. package/dist/chunk-F6C3GFKV.js +57 -0
  25. package/dist/chunk-HFUH3HVS.js +282 -0
  26. package/dist/chunk-HS7LVVLO.js +74 -0
  27. package/dist/chunk-IHROBTNM.js +135 -0
  28. package/dist/chunk-KD2MYBB6.js +213 -0
  29. package/dist/chunk-MAPOQEA2.js +43 -0
  30. package/dist/chunk-N3HTJVBR.js +341 -0
  31. package/dist/chunk-NQ7IQ5XT.js +26 -0
  32. package/dist/chunk-OUQZC744.js +1315 -0
  33. package/dist/chunk-PCCQUWE5.js +817 -0
  34. package/dist/chunk-PNFF6OU3.js +273 -0
  35. package/dist/chunk-PNG7LO2F.js +53 -0
  36. package/dist/chunk-QTON2GQX.js +203 -0
  37. package/dist/chunk-S6GMFDKV.js +50 -0
  38. package/dist/chunk-SMGFN3Z4.js +503 -0
  39. package/dist/chunk-STGFBAYT.js +641 -0
  40. package/dist/chunk-TFZ2JUXH.js +1081 -0
  41. package/dist/chunk-VY7MTPJ2.js +205 -0
  42. package/dist/chunk-W24CMQ32.js +525 -0
  43. package/dist/chunk-WW3YZKHW.js +165 -0
  44. package/dist/chunk-ZB43YMHW.js +20 -0
  45. package/dist/chunk-ZCTSUQRR.js +874 -0
  46. package/dist/chunk-ZXKZBTXE.js +17 -0
  47. package/dist/contribute-C6AW2P6J.js +367 -0
  48. package/dist/cursor-awareness-KTL2RGKD.js +77 -0
  49. package/dist/dashboard-YSNUGBFY.js +21 -0
  50. package/dist/dashboard-broadcast-M4CMW7RX.js +119 -0
  51. package/dist/diff-VHNR62SI.js +74 -0
  52. package/dist/doctor-PET2HRRJ.js +236 -0
  53. package/dist/dogfood-KKFVRWT6.js +366 -0
  54. package/dist/guard-EHXF76ID.js +530 -0
  55. package/dist/handoff-3UI6VKVG.js +302 -0
  56. package/dist/hook-DYIMKJYL.js +1074 -0
  57. package/dist/index.js +62 -14068
  58. package/dist/init-Q4LBM6KT.js +127 -0
  59. package/dist/install-RHOS3OYZ.js +34 -0
  60. package/dist/mission-control-LJACEVVN.js +89 -0
  61. package/dist/monitors-QV2IS3MP.js +176 -0
  62. package/dist/plan-index-JMC7Z4DW.js +44 -0
  63. package/dist/public-inbound-radar-WP3XF7GS.js +68 -0
  64. package/dist/remote-issues-SZ4HDQL5.js +44 -0
  65. package/dist/run-I3BFGULT.js +243 -0
  66. package/dist/run-plan-FO7CL4M3.js +118 -0
  67. package/dist/scan-NI2SWJ2E.js +33 -0
  68. package/dist/setup-global-M42GEODI.js +340 -0
  69. package/dist/status-XPVQVQMX.js +150 -0
  70. package/dist/update-FJ2EBZVO.js +283 -0
  71. package/dist/validate-V2CW7J4B.js +201 -0
  72. package/package.json +3 -3
@@ -0,0 +1,243 @@
1
+ import {
2
+ detectAgentBackend,
3
+ listDetectBackendIds,
4
+ runPlanLoop,
5
+ shouldUseLiveTui,
6
+ withLiveTui
7
+ } from "./chunk-TFZ2JUXH.js";
8
+ import "./chunk-PCCQUWE5.js";
9
+ import "./chunk-HFUH3HVS.js";
10
+ import "./chunk-KD2MYBB6.js";
11
+ import {
12
+ buildDispatchPrompt,
13
+ classifySlash,
14
+ ensureDispatchLogPath,
15
+ normalizeSlashName,
16
+ promoteBlockedMessage,
17
+ readCommandFile,
18
+ runHeadlessDispatch,
19
+ unknownSlashMessage
20
+ } from "./chunk-WW3YZKHW.js";
21
+ import {
22
+ HITL_UNANSWERED_EXIT_CODE,
23
+ formatHitlSummary,
24
+ getBackend,
25
+ hitlExitCode
26
+ } from "./chunk-OUQZC744.js";
27
+ import "./chunk-MAPOQEA2.js";
28
+ import "./chunk-QTON2GQX.js";
29
+ import {
30
+ logger
31
+ } from "./chunk-ZB43YMHW.js";
32
+ import "./chunk-5VCOWTTP.js";
33
+ import "./chunk-77V75A7O.js";
34
+
35
+ // src/commands/run.ts
36
+ import { homedir } from "os";
37
+ import path from "path";
38
+ import { defineCommand } from "citty";
39
+ function displayPath(target, home = homedir()) {
40
+ const resolvedHome = path.resolve(home);
41
+ if (target === resolvedHome) return "~";
42
+ const prefix = resolvedHome.endsWith(path.sep) ? resolvedHome : `${resolvedHome}${path.sep}`;
43
+ return target.startsWith(prefix) ? `~${path.sep}${target.slice(prefix.length)}` : target;
44
+ }
45
+ async function executeRun(input) {
46
+ const root = path.resolve(input.cwd);
47
+ const slash = normalizeSlashName(input.slash);
48
+ if (!slash) {
49
+ return { exitCode: 1, error: "Provide a slash: agent-kit run <slash>" };
50
+ }
51
+ const kind = classifySlash(slash);
52
+ if (kind === "promote-blocked") {
53
+ return { exitCode: 1, error: promoteBlockedMessage(slash) };
54
+ }
55
+ if (kind === "unknown") {
56
+ return { exitCode: 1, error: unknownSlashMessage(slash) };
57
+ }
58
+ const detected = await detectAgentBackend(input.backend, input.whichFn);
59
+ if (!detected.ok) {
60
+ return { exitCode: 1, error: detected.message };
61
+ }
62
+ if (kind === "run-plan") {
63
+ let backend;
64
+ try {
65
+ backend = getBackend(detected.id);
66
+ } catch (err) {
67
+ return { exitCode: 1, error: String(err) };
68
+ }
69
+ if (input.dryRun) {
70
+ const preview = [
71
+ `--dry-run: alias agent-kit run-plan (backend ${detected.id} at ${displayPath(detected.bin)})`,
72
+ "No agent will be started. Tick prompt is the existing run-plan loop prompt."
73
+ ].join("\n");
74
+ return { exitCode: 0, stdout: preview };
75
+ }
76
+ const code = await runPlanLoop({
77
+ root,
78
+ maxTicks: input.maxTicks,
79
+ sleepSeconds: input.sleepSeconds,
80
+ model: input.model,
81
+ dryRun: false,
82
+ backend,
83
+ noHitl: input.noHitl === true,
84
+ plain: input.plain === true
85
+ });
86
+ return { exitCode: code };
87
+ }
88
+ const file = await readCommandFile(root, slash);
89
+ if (!file.ok) {
90
+ return { exitCode: 1, error: file.message };
91
+ }
92
+ const prompt = buildDispatchPrompt(file.body);
93
+ if (input.dryRun) {
94
+ const stdout = [
95
+ "--dry-run: no agent will be started.",
96
+ `Slash: ${slash}`,
97
+ `Command file: ${path.relative(root, file.path)}`,
98
+ `Backend: ${detected.id} (${displayPath(detected.bin)})`,
99
+ "Prompt:",
100
+ prompt
101
+ ].join("\n");
102
+ return { exitCode: 0, stdout };
103
+ }
104
+ const logPath = await ensureDispatchLogPath(root);
105
+ console.log(`Dispatch: ${slash} via ${detected.id}`);
106
+ console.log(`Command file: ${path.relative(root, file.path)}`);
107
+ console.log(`Log: ${path.relative(root, logPath)}`);
108
+ try {
109
+ const dispatch = {
110
+ backendId: detected.id,
111
+ bin: detected.bin,
112
+ workspace: root,
113
+ prompt,
114
+ model: input.model,
115
+ logPath
116
+ };
117
+ const result = shouldUseLiveTui({ plain: input.plain }) ? await withLiveTui(
118
+ { root, backend: detected.id, logPath, noHitl: input.noHitl === true },
119
+ (seams) => runHeadlessDispatch({
120
+ ...dispatch,
121
+ hitl: seams.hitl,
122
+ render: seams.render,
123
+ onSpawn: seams.onSpawn,
124
+ log: seams.log
125
+ })
126
+ ) : await runHeadlessDispatch({
127
+ ...dispatch,
128
+ hitl: { policy: input.noHitl ? "off" : "prompt" }
129
+ });
130
+ for (const line of formatHitlSummary(result.hitl)) console.log(line);
131
+ return { exitCode: hitlExitCode(result.exitCode, result.hitl) };
132
+ } catch (err) {
133
+ return { exitCode: 1, error: String(err) };
134
+ }
135
+ }
136
+ var runDispatchArgs = {
137
+ cwd: {
138
+ type: "string",
139
+ description: "Project root (default: current directory)",
140
+ default: process.cwd()
141
+ },
142
+ backend: {
143
+ type: "string",
144
+ description: `Agent CLI (${listDetectBackendIds().join(" | ")}; default: auto)`,
145
+ default: "auto"
146
+ },
147
+ model: {
148
+ type: "string",
149
+ description: "Optional model id passed to the agent CLI",
150
+ default: ""
151
+ },
152
+ "dry-run": {
153
+ type: "boolean",
154
+ description: "Print the resolved backend and prompt, then exit without starting an agent",
155
+ default: false
156
+ },
157
+ "max-ticks": {
158
+ type: "string",
159
+ description: "For run-plan alias only: maximum ticks (default: 10)",
160
+ default: "10"
161
+ },
162
+ sleep: {
163
+ type: "string",
164
+ description: "For run-plan alias only: seconds between ticks (default: 5)",
165
+ default: "5"
166
+ },
167
+ "no-hitl": {
168
+ type: "boolean",
169
+ description: `CI: never prompt; a HITL gate stops the run with exit ${HITL_UNANSWERED_EXIT_CODE} (no default answer)`,
170
+ default: false
171
+ },
172
+ plain: {
173
+ type: "boolean",
174
+ description: "Status lines instead of the Mission Control live view (the default on a TTY; non-TTY, NO_COLOR and CI are always plain)",
175
+ default: false
176
+ }
177
+ };
178
+ async function runSlashCli(slash, args) {
179
+ const maxTicks = Number.parseInt(String(args["max-ticks"]), 10);
180
+ const sleepSeconds = Number.parseFloat(String(args.sleep));
181
+ if (!Number.isFinite(maxTicks) || maxTicks < 1) {
182
+ logger.error("--max-ticks must be a positive integer");
183
+ process.exitCode = 1;
184
+ return;
185
+ }
186
+ if (!Number.isFinite(sleepSeconds) || sleepSeconds < 0) {
187
+ logger.error("--sleep must be a non-negative number");
188
+ process.exitCode = 1;
189
+ return;
190
+ }
191
+ const result = await executeRun({
192
+ slash,
193
+ cwd: String(args.cwd),
194
+ backend: String(args.backend),
195
+ model: args.model ? String(args.model) : void 0,
196
+ dryRun: Boolean(args["dry-run"]),
197
+ maxTicks,
198
+ sleepSeconds,
199
+ noHitl: Boolean(args["no-hitl"]),
200
+ plain: Boolean(args.plain)
201
+ });
202
+ if (result.stdout) {
203
+ console.log(result.stdout);
204
+ }
205
+ if (result.error) {
206
+ logger.error(result.error);
207
+ }
208
+ process.exitCode = result.exitCode;
209
+ }
210
+ var runCommand = defineCommand({
211
+ meta: {
212
+ name: "run",
213
+ description: "Start one headless session from an L0 slash file. Numbered-list HITL answered from the terminal (claude backend). Never git-prod."
214
+ },
215
+ args: {
216
+ slash: {
217
+ type: "positional",
218
+ description: "Slash name (e.g. run-plan-all, backlog-add, continue-plan)",
219
+ required: true
220
+ },
221
+ ...runDispatchArgs
222
+ },
223
+ async run({ args }) {
224
+ await runSlashCli(String(args.slash ?? ""), args);
225
+ }
226
+ });
227
+ var runPlanAllCommand = defineCommand({
228
+ meta: {
229
+ name: "run-plan-all",
230
+ description: "Headless /run-plan-all queue from the L0 file. Numbered-list HITL answered from the terminal (claude backend). Never git-prod."
231
+ },
232
+ args: runDispatchArgs,
233
+ async run({ args }) {
234
+ await runSlashCli("run-plan-all", args);
235
+ }
236
+ });
237
+ export {
238
+ displayPath,
239
+ executeRun,
240
+ runCommand,
241
+ runPlanAllCommand,
242
+ runSlashCli
243
+ };
@@ -0,0 +1,118 @@
1
+ import {
2
+ detectAgentBackend,
3
+ listDetectBackendIds,
4
+ runPlanLoop
5
+ } from "./chunk-TFZ2JUXH.js";
6
+ import "./chunk-PCCQUWE5.js";
7
+ import "./chunk-HFUH3HVS.js";
8
+ import "./chunk-KD2MYBB6.js";
9
+ import {
10
+ HITL_UNANSWERED_EXIT_CODE,
11
+ getBackend
12
+ } from "./chunk-OUQZC744.js";
13
+ import "./chunk-MAPOQEA2.js";
14
+ import "./chunk-QTON2GQX.js";
15
+ import {
16
+ logger
17
+ } from "./chunk-ZB43YMHW.js";
18
+ import "./chunk-5VCOWTTP.js";
19
+ import "./chunk-77V75A7O.js";
20
+
21
+ // src/commands/run-plan.ts
22
+ import path from "path";
23
+ import { defineCommand } from "citty";
24
+ var runPlanCommand = defineCommand({
25
+ meta: {
26
+ name: "run-plan",
27
+ description: "Headless continuous plan runner (one fresh agent per tick). Never git-prod."
28
+ },
29
+ args: {
30
+ cwd: {
31
+ type: "string",
32
+ description: "Project root (default: current directory)",
33
+ default: process.cwd()
34
+ },
35
+ "max-ticks": {
36
+ type: "string",
37
+ description: "Maximum ticks before stopping (default: 10)",
38
+ default: "10"
39
+ },
40
+ model: {
41
+ type: "string",
42
+ description: "Optional model id passed to the agent backend",
43
+ default: ""
44
+ },
45
+ sleep: {
46
+ type: "string",
47
+ description: "Seconds to sleep between ticks (default: 5)",
48
+ default: "5"
49
+ },
50
+ backend: {
51
+ type: "string",
52
+ description: `Agent backend (${listDetectBackendIds().join(" | ")}; default: cursor-agent)`,
53
+ default: "cursor-agent"
54
+ },
55
+ "dry-run": {
56
+ type: "boolean",
57
+ description: "Print the tick prompt and exit without starting an agent",
58
+ default: false
59
+ },
60
+ "no-hitl": {
61
+ type: "boolean",
62
+ description: `CI: never prompt; a HITL gate stops the run with exit ${HITL_UNANSWERED_EXIT_CODE} (no default answer)`,
63
+ default: false
64
+ },
65
+ plain: {
66
+ type: "boolean",
67
+ description: "Status lines instead of the Mission Control live view (the default on a TTY; non-TTY, NO_COLOR and CI are always plain)",
68
+ default: false
69
+ }
70
+ },
71
+ async run({ args }) {
72
+ const maxTicks = Number.parseInt(String(args["max-ticks"]), 10);
73
+ const sleepSeconds = Number.parseFloat(String(args.sleep));
74
+ if (!Number.isFinite(maxTicks) || maxTicks < 1) {
75
+ logger.error("--max-ticks must be a positive integer");
76
+ process.exitCode = 1;
77
+ return;
78
+ }
79
+ if (!Number.isFinite(sleepSeconds) || sleepSeconds < 0) {
80
+ logger.error("--sleep must be a non-negative number");
81
+ process.exitCode = 1;
82
+ return;
83
+ }
84
+ let backend;
85
+ try {
86
+ const requested = String(args.backend);
87
+ if (requested === "auto") {
88
+ const detected = await detectAgentBackend("auto");
89
+ if (!detected.ok) {
90
+ logger.error(detected.message);
91
+ process.exitCode = 1;
92
+ return;
93
+ }
94
+ backend = getBackend(detected.id);
95
+ } else {
96
+ backend = getBackend(requested);
97
+ }
98
+ } catch (err) {
99
+ logger.error(String(err));
100
+ process.exitCode = 1;
101
+ return;
102
+ }
103
+ const code = await runPlanLoop({
104
+ root: path.resolve(args.cwd),
105
+ maxTicks,
106
+ sleepSeconds,
107
+ model: args.model ? String(args.model) : void 0,
108
+ dryRun: Boolean(args["dry-run"]),
109
+ backend,
110
+ noHitl: Boolean(args["no-hitl"]),
111
+ plain: Boolean(args.plain)
112
+ });
113
+ process.exitCode = code;
114
+ }
115
+ });
116
+ export {
117
+ runPlanCommand
118
+ };
@@ -0,0 +1,33 @@
1
+ import {
2
+ runScanner
3
+ } from "./chunk-ZCTSUQRR.js";
4
+ import "./chunk-F6C3GFKV.js";
5
+ import {
6
+ logger
7
+ } from "./chunk-ZB43YMHW.js";
8
+ import "./chunk-77V75A7O.js";
9
+
10
+ // src/commands/scan.ts
11
+ import { defineCommand } from "citty";
12
+ var scanCommand = defineCommand({
13
+ meta: {
14
+ name: "scan",
15
+ description: "Scan the repository and print the detected profile."
16
+ },
17
+ args: {
18
+ cwd: {
19
+ type: "string",
20
+ description: "Project root directory",
21
+ default: process.cwd()
22
+ }
23
+ },
24
+ async run({ args }) {
25
+ const result = await runScanner(args.cwd);
26
+ logger.info(`Scan completed for ${result.rootDir}`);
27
+ logger.info(`Path: ${result.isGreenfield ? "greenfield" : "existing project"}`);
28
+ console.log(JSON.stringify(result, null, 2));
29
+ }
30
+ });
31
+ export {
32
+ scanCommand
33
+ };