@gh-symphony/cli 0.0.21 → 0.1.2

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 (36) hide show
  1. package/README.md +100 -69
  2. package/dist/chunk-6I753NYO.js +18 -0
  3. package/dist/{workflow-BLJH2HC3.js → chunk-B4ZJMAZL.js} +27 -19
  4. package/dist/{chunk-SXGT7LOF.js → chunk-DLZAJXZL.js} +600 -12
  5. package/dist/chunk-GHVDABFO.js +235 -0
  6. package/dist/{chunk-QEONJ5DZ.js → chunk-GPRCOJDJ.js} +1314 -35
  7. package/dist/{chunk-A67CMOYE.js → chunk-VFHMHHZW.js} +1 -1
  8. package/dist/{chunk-JN3TQVFV.js → chunk-WM2B6BJ7.js} +16 -62
  9. package/dist/{chunk-ROGRTUFI.js → chunk-WOVNN5NW.js} +16 -6
  10. package/dist/{chunk-C67H3OUL.js → chunk-Z3NZOPLZ.js} +0 -81
  11. package/dist/{config-cmd-DNXNL26Z.js → config-cmd-2ADPUYWA.js} +1 -1
  12. package/dist/{doctor-4HBRICHP.js → doctor-EEPNFCGF.js} +464 -40
  13. package/dist/index.js +357 -244
  14. package/dist/repo-RX4OK7XH.js +6783 -0
  15. package/dist/{setup-B2SVLW2R.js → setup-XNHHRBGU.js} +57 -91
  16. package/dist/{upgrade-OJXPZRYE.js → upgrade-NS53EO2B.js} +2 -2
  17. package/dist/{version-TBDCTKDO.js → version-2RHFZ5CI.js} +1 -1
  18. package/dist/worker-entry.js +376 -15
  19. package/dist/workflow-26QNZZWH.js +22 -0
  20. package/package.json +5 -5
  21. package/dist/chunk-5NV3LSAJ.js +0 -11
  22. package/dist/chunk-C7G7RJ4G.js +0 -146
  23. package/dist/chunk-KY6WKH66.js +0 -1300
  24. package/dist/chunk-MYVJ6HK4.js +0 -3510
  25. package/dist/chunk-S6VIK4FF.js +0 -723
  26. package/dist/chunk-XN5ABWZ6.js +0 -486
  27. package/dist/chunk-Y6TYJMNT.js +0 -109
  28. package/dist/init-HZ3JEDGQ.js +0 -38
  29. package/dist/logs-6JKKYDGJ.js +0 -188
  30. package/dist/project-25NQ4J4Y.js +0 -24
  31. package/dist/recover-L3MJHHDA.js +0 -133
  32. package/dist/repo-TDCWQR6P.js +0 -379
  33. package/dist/run-XJQ6BF7U.js +0 -110
  34. package/dist/start-I2CC7BLW.js +0 -18
  35. package/dist/status-QSCFVGRQ.js +0 -11
  36. package/dist/stop-7MFCBQVW.js +0 -9
@@ -1,486 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- blue,
4
- bold,
5
- clearScreen,
6
- cyan,
7
- dim,
8
- green,
9
- hideCursor,
10
- magenta,
11
- red,
12
- showCursor,
13
- stripAnsi,
14
- yellow
15
- } from "./chunk-MVRF7BES.js";
16
- import {
17
- resolveRuntimeRoot
18
- } from "./chunk-5NV3LSAJ.js";
19
- import {
20
- handleMissingManagedProjectConfig,
21
- resolveManagedProjectConfig
22
- } from "./chunk-C7G7RJ4G.js";
23
-
24
- // src/commands/status.ts
25
- import { readFile } from "fs/promises";
26
- import { join } from "path";
27
-
28
- // src/dashboard/renderer.ts
29
- var COL_ID = 24;
30
- var COL_STATUS = 14;
31
- var COL_PID = 8;
32
- var COL_AGE_TURN = 12;
33
- var COL_TOKENS = 17;
34
- var COL_SESSION = 14;
35
- var COL_ID_HEADER = COL_ID + 2;
36
- var identity = (s) => s;
37
- function makeColors(noColor) {
38
- if (noColor) {
39
- return {
40
- bold: identity,
41
- dim: identity,
42
- green: identity,
43
- red: identity,
44
- yellow: identity,
45
- cyan: identity,
46
- magenta: identity,
47
- blue: identity
48
- };
49
- }
50
- return { bold, dim, green, red, yellow, cyan, magenta, blue };
51
- }
52
- function pad(s, width, align = "left") {
53
- const visible = stripAnsi(s);
54
- if (visible.length >= width) return visible.slice(0, width);
55
- const padding = " ".repeat(width - visible.length);
56
- return align === "right" ? padding + s : s + padding;
57
- }
58
- function compactSessionId(id) {
59
- if (!id) return "\u2014";
60
- if (id.length <= 10) return id;
61
- return `${id.slice(0, 4)}...${id.slice(-6)}`;
62
- }
63
- function fmtTokens(n) {
64
- return n.toLocaleString("en-US");
65
- }
66
- function fmtTokenPair(delta, cumulative) {
67
- const left = fmtTokens(delta ?? 0);
68
- const right = fmtTokens(cumulative ?? delta ?? 0);
69
- return `${left} / ${right}`;
70
- }
71
- function fmtAge(startedAt, now) {
72
- if (!startedAt) return "0m";
73
- const diffMs = now - new Date(startedAt).getTime();
74
- if (diffMs < 0) return "0m";
75
- const totalMin = Math.floor(diffMs / 6e4);
76
- if (totalMin < 60) return `${totalMin}m`;
77
- const h = Math.floor(totalMin / 60);
78
- const m = totalMin % 60;
79
- return `${h}h ${m}m`;
80
- }
81
- function fmtRuntime(ms) {
82
- if (ms <= 0) return "0h 0m";
83
- const totalMin = Math.floor(ms / 6e4);
84
- const h = Math.floor(totalMin / 60);
85
- const m = totalMin % 60;
86
- return `${h}h ${m}m`;
87
- }
88
- function fmtRetryTime(nextRetryAt, now) {
89
- if (!nextRetryAt) return "\u2014";
90
- const diffMs = new Date(nextRetryAt).getTime() - now;
91
- if (diffMs <= 0) return "now";
92
- const totalSec = Math.ceil(diffMs / 1e3);
93
- if (totalSec < 60) return `${totalSec}s`;
94
- const m = Math.floor(totalSec / 60);
95
- const s = totalSec % 60;
96
- return s > 0 ? `${m}m ${s}s` : `${m}m`;
97
- }
98
- var COL_SEPARATORS = 6;
99
- function eventColWidth(termWidth) {
100
- const fixed = 2 + COL_ID_HEADER + COL_STATUS + COL_PID + COL_AGE_TURN + COL_TOKENS + COL_SESSION + COL_SEPARATORS;
101
- return Math.max(5, termWidth - fixed);
102
- }
103
- function statusDot(run, c) {
104
- const event = run.lastEvent;
105
- if (event === null || event === void 0 || run.status === "failed")
106
- return c.red("\u25CF");
107
- if (event === "token_count") return c.yellow("\u25CF");
108
- if (event === "task_started") return c.green("\u25CF");
109
- if (event === "turn_completed") return c.magenta("\u25CF");
110
- return c.blue("\u25CF");
111
- }
112
- function titleBar(width, c) {
113
- const title = " gh-symphony ";
114
- const side = Math.max(0, Math.floor((width - title.length) / 2));
115
- const right = Math.max(0, width - side - title.length);
116
- return c.bold("\u2550".repeat(side) + title + "\u2550".repeat(right));
117
- }
118
- function sectionDivider(label, width, c) {
119
- const prefix = `\u2500\u2500 ${label} `;
120
- const fill = "\u2500".repeat(Math.max(0, width - prefix.length));
121
- return c.dim(prefix + fill);
122
- }
123
- function buildSummaryLines(snapshots, options, c) {
124
- const now = options.now ?? Date.now();
125
- const lines = [];
126
- const totalActive = snapshots.reduce(
127
- (sum, s) => sum + s.summary.activeRuns,
128
- 0
129
- );
130
- const agentStr = options.maxAgents != null ? `${totalActive}/${options.maxAgents}` : `${totalActive}`;
131
- const totIn = snapshots.reduce(
132
- (sum, s) => sum + (s.codexTotals?.inputTokens ?? 0),
133
- 0
134
- );
135
- const totOut = snapshots.reduce(
136
- (sum, s) => sum + (s.codexTotals?.outputTokens ?? 0),
137
- 0
138
- );
139
- const totAll = snapshots.reduce(
140
- (sum, s) => sum + (s.codexTotals?.totalTokens ?? 0),
141
- 0
142
- );
143
- const allStarts = snapshots.flatMap((s) => s.activeRuns).map((r) => r.startedAt).filter((t) => t != null).map((t) => new Date(t).getTime());
144
- const runtimeMs = allStarts.length > 0 ? now - Math.min(...allStarts) : 0;
145
- const runtime = fmtRuntime(runtimeMs);
146
- lines.push(
147
- ` ${c.dim("Agents")} ${c.bold(agentStr)} ${c.dim("Runtime")} ${c.bold(runtime)} ${c.dim("Tokens")} ${fmtTokens(totIn)} in / ${fmtTokens(totOut)} out / ${c.bold(fmtTokens(totAll))} total`
148
- );
149
- const hasLimits = snapshots.some((s) => s.rateLimits != null);
150
- const limitStr = hasLimits ? "active" : "standard";
151
- lines.push(` ${c.dim("Rate Limits")} ${limitStr}`);
152
- return lines;
153
- }
154
- function tableHeaderRow(c) {
155
- const cols = [
156
- pad("ID", COL_ID_HEADER),
157
- pad("STATUS", COL_STATUS),
158
- pad("PID", COL_PID),
159
- pad("AGE/TURN", COL_AGE_TURN),
160
- pad("TOKENS", COL_TOKENS),
161
- pad("SESSION", COL_SESSION),
162
- "EVENT"
163
- ].join(" ");
164
- return ` ${c.dim(cols)}`;
165
- }
166
- function activeRunRow(run, now, evtWidth, c) {
167
- const dot = statusDot(run, c);
168
- const id = pad(run.issueIdentifier, COL_ID);
169
- const status = pad(
170
- run.issueState ?? run.executionPhase ?? "\u2014",
171
- COL_STATUS
172
- );
173
- const pid = pad(
174
- run.processId != null ? String(run.processId) : "\u2014",
175
- COL_PID
176
- );
177
- const age = fmtAge(run.startedAt, now);
178
- const turn = run.turnCount ?? 0;
179
- const ageTurn = pad(`${age}/${turn}`, COL_AGE_TURN);
180
- const tokens = pad(
181
- fmtTokenPair(
182
- run.tokenUsage?.totalTokens,
183
- run.tokenUsage?.cumulativeTotalTokens
184
- ),
185
- COL_TOKENS,
186
- "right"
187
- );
188
- const sessionId = run.runtimeSession?.sessionId ?? run.runtimeSession?.threadId ?? null;
189
- const session = pad(compactSessionId(sessionId), COL_SESSION);
190
- const event = pad(run.lastEvent ?? "\u2014", evtWidth);
191
- const columns = [id, status, pid, ageTurn, tokens, session, event].join(" ");
192
- return ` ${dot} ${columns}`;
193
- }
194
- function retryRow(entry, snapshot, now, c) {
195
- const id = entry.issueIdentifier;
196
- const kind = entry.retryKind;
197
- const timeStr = fmtRetryTime(entry.nextRetryAt, now);
198
- const matchingRun = snapshot.activeRuns.find((r) => r.runId === entry.runId);
199
- const errorHint = matchingRun?.lastEvent ?? "";
200
- return ` ${c.yellow("\u21BB")} ${id} ${kind} retrying in ${timeStr}${errorHint ? " " + errorHint : ""}`;
201
- }
202
- function renderDashboard(snapshots, options) {
203
- const width = options.terminalWidth || 115;
204
- const now = options.now ?? Date.now();
205
- const c = makeColors(options.noColor);
206
- const evtWidth = eventColWidth(width);
207
- const lines = [];
208
- lines.push(titleBar(width, c));
209
- lines.push(...buildSummaryLines(snapshots, options, c));
210
- lines.push("");
211
- for (const snap of snapshots) {
212
- const hasActiveRuns = snap.activeRuns.length > 0;
213
- const hasRetries = snap.retryQueue.length > 0;
214
- if (!hasActiveRuns && !hasRetries) continue;
215
- lines.push(sectionDivider(snap.slug, width, c));
216
- if (hasActiveRuns) {
217
- lines.push(tableHeaderRow(c));
218
- for (const rawRun of snap.activeRuns) {
219
- const run = rawRun;
220
- lines.push(activeRunRow(run, now, evtWidth, c));
221
- }
222
- }
223
- lines.push("");
224
- }
225
- const allRetries = [];
226
- for (const snap of snapshots) {
227
- for (const entry of snap.retryQueue) {
228
- allRetries.push({ entry, snapshot: snap });
229
- }
230
- }
231
- if (allRetries.length > 0) {
232
- lines.push(sectionDivider("Backoff Queue", width, c));
233
- for (const { entry, snapshot } of allRetries) {
234
- lines.push(retryRow(entry, snapshot, now, c));
235
- }
236
- lines.push("");
237
- }
238
- const result = lines.map((line) => {
239
- const visible = stripAnsi(line);
240
- if (visible.length <= width) return line;
241
- return visible.slice(0, width);
242
- });
243
- return result.join("\n");
244
- }
245
-
246
- // src/commands/status.ts
247
- function healthIcon(health) {
248
- switch (health) {
249
- case "idle":
250
- case "running":
251
- return green("\u25CF");
252
- case "degraded":
253
- return red("\u25CF");
254
- }
255
- }
256
- function relativeTime(isoString) {
257
- const now = /* @__PURE__ */ new Date();
258
- const then = new Date(isoString);
259
- const diffMs = now.getTime() - then.getTime();
260
- const diffS = Math.floor(diffMs / 1e3);
261
- const diffM = Math.floor(diffS / 60);
262
- const diffH = Math.floor(diffM / 60);
263
- if (diffS < 60) return `${diffS}s ago`;
264
- if (diffM < 60) return `${diffM}m ago`;
265
- return `${diffH}h ago`;
266
- }
267
- function truncate(s, len) {
268
- if (s.length <= len) return s;
269
- return s.slice(0, len - 3) + "...";
270
- }
271
- function formatTokenPair(delta, cumulative) {
272
- return `${delta.toLocaleString("en-US")} / ${cumulative.toLocaleString("en-US")}`;
273
- }
274
- function resolveProjectTokenDelta(snapshot) {
275
- return snapshot.activeRuns.reduce(
276
- (sum, run) => sum + (run.tokenUsage?.totalTokens ?? 0),
277
- 0
278
- );
279
- }
280
- function renderLegacyStatus(snapshot, noColor) {
281
- const apply = noColor ? (s) => stripAnsi(s) : (s) => s;
282
- const lines = [];
283
- const headerTitle = `gh-symphony \u2219 ${snapshot.slug}`;
284
- const headerWidth = 45;
285
- const headerPadding = Math.max(
286
- 0,
287
- headerWidth - stripAnsi(headerTitle).length
288
- );
289
- lines.push("\u256D" + "\u2500".repeat(headerWidth) + "\u256E");
290
- lines.push(
291
- "\u2502 " + apply(bold(headerTitle)) + " ".repeat(headerPadding) + "\u2502"
292
- );
293
- lines.push("\u2570" + "\u2500".repeat(headerWidth) + "\u256F");
294
- lines.push("");
295
- const healthStr = apply(
296
- `${healthIcon(snapshot.health)} Health ${snapshot.health}`
297
- );
298
- const lastTickStr = apply(`Last tick ${relativeTime(snapshot.lastTickAt)}`);
299
- lines.push(
300
- ` ${healthStr}${" ".repeat(Math.max(0, 30 - stripAnsi(healthStr).length))}${lastTickStr}`
301
- );
302
- lines.push("");
303
- const dispatchedStr = apply(`Dispatched ${snapshot.summary.dispatched}`);
304
- const activeRunsStr = apply(`Active Runs ${snapshot.summary.activeRuns}`);
305
- const suppressedStr = apply(`Suppressed ${snapshot.summary.suppressed}`);
306
- const recoveredStr = apply(`Recovered ${snapshot.summary.recovered}`);
307
- lines.push(
308
- ` ${dispatchedStr}${" ".repeat(Math.max(0, 20 - stripAnsi(dispatchedStr).length))}${activeRunsStr}`
309
- );
310
- lines.push(
311
- ` ${suppressedStr}${" ".repeat(Math.max(0, 20 - stripAnsi(suppressedStr).length))}${recoveredStr}`
312
- );
313
- lines.push("");
314
- if (snapshot.activeRuns.length > 0) {
315
- lines.push(" Active Runs:");
316
- for (const run of snapshot.activeRuns) {
317
- const runIdDisplay = truncate(run.runId, 12);
318
- const stateStr = apply(cyan(run.issueState));
319
- const statusColor = run.status === "running" ? green : run.status === "failed" ? red : run.status === "succeeded" ? green : dim;
320
- const statusStr = apply(statusColor(run.status));
321
- lines.push(
322
- ` ${runIdDisplay} ${run.issueIdentifier} ${stateStr} ${statusStr}`
323
- );
324
- }
325
- lines.push("");
326
- } else {
327
- lines.push(" No active runs.");
328
- lines.push("");
329
- }
330
- if (snapshot.retryQueue.length > 0) {
331
- lines.push(" Retry Queue:");
332
- for (const retry of snapshot.retryQueue) {
333
- const runIdDisplay = truncate(retry.runId, 12);
334
- const nextRetryDisplay = retry.nextRetryAt ? relativeTime(retry.nextRetryAt) : "pending";
335
- lines.push(
336
- ` ${runIdDisplay} ${retry.issueIdentifier} ${apply(yellow(retry.retryKind))} ${nextRetryDisplay}`
337
- );
338
- }
339
- lines.push("");
340
- }
341
- if (snapshot.lastError) {
342
- lines.push(apply(red(` \u2717 ${snapshot.lastError}`)));
343
- lines.push("");
344
- }
345
- if (snapshot.codexTotals) {
346
- const tokenDelta = resolveProjectTokenDelta(snapshot);
347
- const tokenStr = apply(
348
- `Tokens: ${formatTokenPair(tokenDelta, snapshot.codexTotals.totalTokens)} total`
349
- );
350
- lines.push(` ${tokenStr}`);
351
- } else {
352
- lines.push(" Tokens: 0 / 0 total");
353
- }
354
- return lines.join("\n");
355
- }
356
- function parseStatusArgs(args) {
357
- const parsed = {
358
- watch: false
359
- };
360
- for (let i = 0; i < args.length; i += 1) {
361
- const arg = args[i];
362
- if (arg === "--watch" || arg === "-w") {
363
- parsed.watch = true;
364
- continue;
365
- }
366
- if (arg === "--project" || arg === "--project-id") {
367
- const value = args[i + 1];
368
- if (!value || value.startsWith("-")) {
369
- parsed.error = `Option '${arg}' argument missing`;
370
- return parsed;
371
- }
372
- parsed.projectId = value;
373
- i += 1;
374
- continue;
375
- }
376
- if (arg?.startsWith("-")) {
377
- parsed.error = `Unknown option '${arg}'`;
378
- return parsed;
379
- }
380
- }
381
- return parsed;
382
- }
383
- async function readStatusSnapshot(runtimeRoot, projectId) {
384
- try {
385
- const statusPath = join(
386
- runtimeRoot,
387
- "projects",
388
- projectId,
389
- "status.json"
390
- );
391
- const content = await readFile(statusPath, "utf-8");
392
- return JSON.parse(content);
393
- } catch {
394
- return null;
395
- }
396
- }
397
- var handler = async (args, options) => {
398
- const parsed = parseStatusArgs(args);
399
- if (parsed.error) {
400
- process.stderr.write(`${parsed.error}
401
- `);
402
- process.stderr.write(
403
- "Usage: gh-symphony status [--project-id <project-id>] [--watch]\n"
404
- );
405
- process.exitCode = 2;
406
- return;
407
- }
408
- const projectConfig = await resolveManagedProjectConfig({
409
- configDir: options.configDir,
410
- requestedProjectId: parsed.projectId
411
- });
412
- if (!projectConfig) {
413
- handleMissingManagedProjectConfig();
414
- return;
415
- }
416
- const runtimeRoot = resolveRuntimeRoot(options.configDir);
417
- const projectId = projectConfig.projectId;
418
- if (parsed.watch) {
419
- const isTTY = process.stdout.isTTY === true;
420
- let terminalWidth = process.stdout.columns ?? 115;
421
- let runPromise = null;
422
- const run = async () => {
423
- const snapshot2 = await readStatusSnapshot(runtimeRoot, projectId);
424
- if (options.json || !isTTY) {
425
- process.stdout.write(JSON.stringify(snapshot2, null, 2) + "\n");
426
- } else {
427
- if (!snapshot2) {
428
- process.stdout.write(
429
- clearScreen() + "Unable to read status snapshot.\n"
430
- );
431
- return;
432
- }
433
- process.stdout.write(
434
- clearScreen() + renderDashboard([snapshot2], {
435
- terminalWidth,
436
- noColor: options.noColor
437
- }) + "\n"
438
- );
439
- }
440
- };
441
- const tick = () => {
442
- if (runPromise) {
443
- return;
444
- }
445
- runPromise = run().finally(() => {
446
- runPromise = null;
447
- });
448
- };
449
- if (isTTY) {
450
- process.stdout.write(hideCursor());
451
- }
452
- tick();
453
- await runPromise;
454
- const interval = setInterval(tick, 2e3);
455
- process.on("SIGWINCH", () => {
456
- terminalWidth = process.stdout.columns ?? terminalWidth;
457
- });
458
- const shutdown = () => {
459
- clearInterval(interval);
460
- process.stdout.write(showCursor() + "\n");
461
- process.exit(0);
462
- };
463
- process.on("SIGINT", shutdown);
464
- process.on("SIGTERM", shutdown);
465
- await new Promise(() => {
466
- });
467
- }
468
- const snapshot = await readStatusSnapshot(runtimeRoot, projectId);
469
- if (snapshot) {
470
- if (options.json) {
471
- process.stdout.write(JSON.stringify(snapshot, null, 2) + "\n");
472
- } else {
473
- process.stdout.write(
474
- renderLegacyStatus(snapshot, options.noColor) + "\n"
475
- );
476
- }
477
- } else {
478
- process.stderr.write("Unable to read status snapshot.\n");
479
- process.exitCode = 1;
480
- }
481
- };
482
- var status_default = handler;
483
-
484
- export {
485
- status_default
486
- };
@@ -1,109 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- handleMissingManagedProjectConfig,
4
- resolveManagedProjectConfig
5
- } from "./chunk-C7G7RJ4G.js";
6
- import {
7
- daemonPidPath
8
- } from "./chunk-ROGRTUFI.js";
9
-
10
- // src/commands/stop.ts
11
- import { readFile, rm } from "fs/promises";
12
- function parseStopArgs(args) {
13
- const parsed = {
14
- force: false
15
- };
16
- for (let i = 0; i < args.length; i += 1) {
17
- const arg = args[i];
18
- if (arg === "--force") {
19
- parsed.force = true;
20
- continue;
21
- }
22
- if (arg === "--project" || arg === "--project-id") {
23
- const value = args[i + 1];
24
- if (!value || value.startsWith("-")) {
25
- parsed.error = `Option '${arg}' argument missing`;
26
- return parsed;
27
- }
28
- parsed.projectId = value;
29
- i += 1;
30
- continue;
31
- }
32
- if (arg?.startsWith("-")) {
33
- parsed.error = `Unknown option '${arg}'`;
34
- return parsed;
35
- }
36
- }
37
- return parsed;
38
- }
39
- var handler = async (args, options) => {
40
- const parsed = parseStopArgs(args);
41
- if (parsed.error) {
42
- process.stderr.write(`${parsed.error}
43
- `);
44
- process.stderr.write(
45
- "Usage: gh-symphony stop --project-id <project-id> [--force]\n"
46
- );
47
- process.exitCode = 2;
48
- return;
49
- }
50
- const resolvedForce = parsed.force;
51
- const projectConfig = await resolveManagedProjectConfig({
52
- configDir: options.configDir,
53
- requestedProjectId: parsed.projectId
54
- });
55
- if (!projectConfig) {
56
- handleMissingManagedProjectConfig();
57
- return;
58
- }
59
- const resolvedProjectId = projectConfig.projectId;
60
- const pidPath = daemonPidPath(options.configDir, resolvedProjectId);
61
- let pidStr;
62
- try {
63
- pidStr = await readFile(pidPath, "utf8");
64
- } catch {
65
- process.stderr.write(
66
- `No running daemon found for project "${resolvedProjectId}" (PID file missing).
67
- `
68
- );
69
- process.exitCode = 1;
70
- return;
71
- }
72
- const pid = Number.parseInt(pidStr.trim(), 10);
73
- if (!Number.isFinite(pid)) {
74
- process.stderr.write(`Invalid PID in ${pidPath}: ${pidStr}
75
- `);
76
- process.exitCode = 1;
77
- return;
78
- }
79
- try {
80
- process.kill(pid, 0);
81
- } catch {
82
- process.stdout.write(
83
- `Daemon for project "${resolvedProjectId}" (PID ${pid}) is not running. Cleaning up PID file.
84
- `
85
- );
86
- await rm(pidPath, { force: true });
87
- return;
88
- }
89
- const signal = resolvedForce ? "SIGKILL" : "SIGTERM";
90
- try {
91
- process.kill(pid, signal);
92
- process.stdout.write(`Sent ${signal} to orchestrator (PID ${pid}).
93
- `);
94
- } catch (error) {
95
- process.stderr.write(
96
- `Failed to stop process ${pid}: ${error instanceof Error ? error.message : "Unknown error"}
97
- `
98
- );
99
- process.exitCode = 1;
100
- return;
101
- }
102
- await rm(pidPath, { force: true });
103
- process.stdout.write("Daemon stopped.\n");
104
- };
105
- var stop_default = handler;
106
-
107
- export {
108
- stop_default
109
- };
@@ -1,38 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- abortIfCancelled,
4
- buildAutomaticStateMappings,
5
- buildDryRunJsonResult,
6
- generateProjectId,
7
- init_default,
8
- planEcosystem,
9
- planWorkflowArtifacts,
10
- promptStateMappings,
11
- renderDryRunPreview,
12
- resolvePriorityField,
13
- resolveStatusField,
14
- warnIfProjectDiscoveryPartial,
15
- writeConfig,
16
- writeEcosystem,
17
- writeWorkflowPlan
18
- } from "./chunk-JN3TQVFV.js";
19
- import "./chunk-C67H3OUL.js";
20
- import "./chunk-QEONJ5DZ.js";
21
- import "./chunk-ROGRTUFI.js";
22
- export {
23
- abortIfCancelled,
24
- buildAutomaticStateMappings,
25
- buildDryRunJsonResult,
26
- init_default as default,
27
- generateProjectId,
28
- planEcosystem,
29
- planWorkflowArtifacts,
30
- promptStateMappings,
31
- renderDryRunPreview,
32
- resolvePriorityField,
33
- resolveStatusField,
34
- warnIfProjectDiscoveryPartial,
35
- writeConfig,
36
- writeEcosystem,
37
- writeWorkflowPlan
38
- };