@gh-symphony/cli 0.0.22 → 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 +72 -77
  2. package/dist/{chunk-IWFX2FMA.js → chunk-6I753NYO.js} +4 -1
  3. package/dist/{workflow-L3KT6HB7.js → chunk-B4ZJMAZL.js} +27 -19
  4. package/dist/{chunk-2TSM3INR.js → chunk-DLZAJXZL.js} +575 -12
  5. package/dist/chunk-GHVDABFO.js +235 -0
  6. package/dist/{chunk-EEQQWTXS.js → chunk-GPRCOJDJ.js} +158 -75
  7. package/dist/{chunk-36KYEDEO.js → chunk-MVRF7BES.js} +1 -10
  8. package/dist/{chunk-2UW7NQLX.js → chunk-VFHMHHZW.js} +1 -1
  9. package/dist/{chunk-HMLBBZNY.js → chunk-WM2B6BJ7.js} +16 -71
  10. package/dist/{chunk-QIRE2VXS.js → chunk-WOVNN5NW.js} +16 -17
  11. package/dist/{chunk-C67H3OUL.js → chunk-Z3NZOPLZ.js} +0 -81
  12. package/dist/{config-cmd-Z3A7V6NC.js → config-cmd-2ADPUYWA.js} +1 -1
  13. package/dist/{doctor-EJUMPBMW.js → doctor-EEPNFCGF.js} +464 -40
  14. package/dist/index.js +340 -294
  15. package/dist/{chunk-PUDXVBSN.js → repo-RX4OK7XH.js} +5944 -3001
  16. package/dist/{setup-TZJSM3QV.js → setup-XNHHRBGU.js} +57 -92
  17. package/dist/{upgrade-O33S2SJK.js → upgrade-NS53EO2B.js} +2 -2
  18. package/dist/{version-CW54Q7BK.js → version-2RHFZ5CI.js} +1 -1
  19. package/dist/worker-entry.js +10 -5
  20. package/dist/workflow-26QNZZWH.js +22 -0
  21. package/package.json +4 -4
  22. package/dist/chunk-DDL4BWSL.js +0 -146
  23. package/dist/chunk-DFLXHNYQ.js +0 -482
  24. package/dist/chunk-E7HYEEZD.js +0 -1318
  25. package/dist/chunk-GDE6FYN4.js +0 -26
  26. package/dist/chunk-GSX2FV3M.js +0 -103
  27. package/dist/chunk-ZHOKYUO3.js +0 -1047
  28. package/dist/init-54HMKNYI.js +0 -38
  29. package/dist/logs-GTZ4U5JE.js +0 -188
  30. package/dist/project-RMYMZSFV.js +0 -25
  31. package/dist/recover-LTLKMTRX.js +0 -133
  32. package/dist/repo-WI7GF6XQ.js +0 -749
  33. package/dist/run-IHN3ZL35.js +0 -122
  34. package/dist/start-RTAHQMR2.js +0 -19
  35. package/dist/status-F4D52OVK.js +0 -12
  36. package/dist/stop-MDKMJPVR.js +0 -10
@@ -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-HMLBBZNY.js";
19
- import "./chunk-C67H3OUL.js";
20
- import "./chunk-EEQQWTXS.js";
21
- import "./chunk-QIRE2VXS.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
- };
@@ -1,188 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- handleMissingManagedProjectConfig,
4
- resolveManagedProjectConfig
5
- } from "./chunk-DDL4BWSL.js";
6
- import {
7
- orchestratorLogPath
8
- } from "./chunk-QIRE2VXS.js";
9
-
10
- // src/commands/logs.ts
11
- import { readFile, readdir, stat } from "fs/promises";
12
- import { join, resolve } from "path";
13
- import { createReadStream } from "fs";
14
- import { createInterface } from "readline";
15
- function parseLogsArgs(args) {
16
- const parsed = { follow: false };
17
- for (let i = 0; i < args.length; i += 1) {
18
- const arg = args[i];
19
- if (arg === "--follow" || arg === "-f") {
20
- parsed.follow = true;
21
- }
22
- if (arg === "--issue") {
23
- parsed.issue = args[i + 1];
24
- i += 1;
25
- }
26
- if (arg === "--run") {
27
- parsed.run = args[i + 1];
28
- i += 1;
29
- }
30
- if (arg === "--level") {
31
- parsed.level = args[i + 1];
32
- i += 1;
33
- }
34
- if (arg === "--project" || arg === "--project-id") {
35
- parsed.projectId = args[i + 1];
36
- i += 1;
37
- }
38
- }
39
- return parsed;
40
- }
41
- var handler = async (args, options) => {
42
- const parsed = parseLogsArgs(args);
43
- const runtimeRoot = resolve(options.configDir);
44
- if (parsed.run) {
45
- const eventsPath = parsed.projectId ? join(
46
- runtimeRoot,
47
- "projects",
48
- parsed.projectId,
49
- "runs",
50
- parsed.run,
51
- "events.ndjson"
52
- ) : await resolveRunEventsPath(runtimeRoot, parsed.run);
53
- if (!eventsPath) {
54
- process.stderr.write(`No events found for run: ${parsed.run}
55
- `);
56
- process.exitCode = 1;
57
- return;
58
- }
59
- try {
60
- const content = await readFile(eventsPath, "utf8");
61
- const lines = content.trim().split("\n").filter(Boolean);
62
- for (const line of lines) {
63
- const event = JSON.parse(line);
64
- if (parsed.projectId && event.projectId !== parsed.projectId) continue;
65
- if (parsed.level && event.level !== parsed.level) continue;
66
- if (parsed.issue && event.issueIdentifier !== parsed.issue) continue;
67
- process.stdout.write(formatEvent(event) + "\n");
68
- }
69
- } catch {
70
- process.stderr.write(`No events found for run: ${parsed.run}
71
- `);
72
- process.exitCode = 1;
73
- }
74
- return;
75
- }
76
- if (parsed.follow) {
77
- const projectConfig = await resolveManagedProjectConfig({
78
- configDir: options.configDir,
79
- requestedProjectId: parsed.projectId
80
- });
81
- if (!projectConfig) {
82
- handleMissingManagedProjectConfig();
83
- return;
84
- }
85
- const logPath = orchestratorLogPath(
86
- options.configDir,
87
- projectConfig.projectId
88
- );
89
- try {
90
- const stream = createReadStream(logPath, { encoding: "utf8" });
91
- const rl = createInterface({ input: stream });
92
- for await (const line of rl) {
93
- process.stdout.write(line + "\n");
94
- }
95
- const { watchFile } = await import("fs");
96
- let lastSize = 0;
97
- watchFile(logPath, { interval: 1e3 }, async (curr) => {
98
- if (curr.size > lastSize) {
99
- const fd = await import("fs/promises");
100
- const handle = await fd.open(logPath, "r");
101
- const buf = Buffer.alloc(curr.size - lastSize);
102
- await handle.read(buf, 0, buf.length, lastSize);
103
- await handle.close();
104
- process.stdout.write(buf.toString("utf8"));
105
- lastSize = curr.size;
106
- }
107
- });
108
- await new Promise(() => {
109
- });
110
- } catch {
111
- process.stderr.write(
112
- "No log file found. Start the orchestrator first.\n"
113
- );
114
- process.exitCode = 1;
115
- }
116
- return;
117
- }
118
- const runRoots = parsed.projectId ? [join(runtimeRoot, "projects", parsed.projectId, "runs")] : await listProjectRunRoots(runtimeRoot);
119
- let foundRuns = false;
120
- try {
121
- for (const runsDir of runRoots) {
122
- const entries = await safeReadDir(runsDir);
123
- if (entries.length === 0) {
124
- continue;
125
- }
126
- foundRuns = true;
127
- for (const entry of entries) {
128
- const eventsPath = join(runsDir, entry, "events.ndjson");
129
- try {
130
- const content = await readFile(eventsPath, "utf8");
131
- const lines = content.trim().split("\n").filter(Boolean);
132
- for (const line of lines) {
133
- const event = JSON.parse(line);
134
- if (parsed.projectId && event.projectId !== parsed.projectId)
135
- continue;
136
- if (parsed.level && event.level !== parsed.level) continue;
137
- if (parsed.issue && event.issueIdentifier !== parsed.issue) continue;
138
- process.stdout.write(formatEvent(event) + "\n");
139
- }
140
- } catch {
141
- }
142
- }
143
- }
144
- } catch {
145
- }
146
- if (!foundRuns) {
147
- process.stderr.write("No runs found. Start the orchestrator first.\n");
148
- }
149
- };
150
- var logs_default = handler;
151
- function formatEvent(event) {
152
- const at = event.at ?? "";
153
- const eventType = event.event ?? "unknown";
154
- const issue = event.issueIdentifier ?? "";
155
- const extra = event.error ? ` error=${event.error}` : "";
156
- return `[${at}] ${eventType} ${issue}${extra}`;
157
- }
158
- async function listProjectRunRoots(runtimeRoot) {
159
- try {
160
- const projectIds = await readdir(join(runtimeRoot, "projects"));
161
- return projectIds.map(
162
- (projectId) => join(runtimeRoot, "projects", projectId, "runs")
163
- );
164
- } catch {
165
- return [];
166
- }
167
- }
168
- async function resolveRunEventsPath(runtimeRoot, runId) {
169
- for (const runsDir of await listProjectRunRoots(runtimeRoot)) {
170
- const eventsPath = join(runsDir, runId, "events.ndjson");
171
- try {
172
- await stat(eventsPath);
173
- return eventsPath;
174
- } catch {
175
- }
176
- }
177
- return null;
178
- }
179
- async function safeReadDir(path) {
180
- try {
181
- return await readdir(path);
182
- } catch {
183
- return [];
184
- }
185
- }
186
- export {
187
- logs_default as default
188
- };
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- project_default,
4
- promptProjectRegistrationOptions,
5
- renderProjectRegistrationSummary
6
- } from "./chunk-ZHOKYUO3.js";
7
- import "./chunk-HMLBBZNY.js";
8
- import "./chunk-E7HYEEZD.js";
9
- import "./chunk-PUDXVBSN.js";
10
- import "./chunk-2UW7NQLX.js";
11
- import "./chunk-2TSM3INR.js";
12
- import "./chunk-C67H3OUL.js";
13
- import "./chunk-EEQQWTXS.js";
14
- import "./chunk-DFLXHNYQ.js";
15
- import "./chunk-36KYEDEO.js";
16
- import "./chunk-IWFX2FMA.js";
17
- import "./chunk-GSX2FV3M.js";
18
- import "./chunk-GDE6FYN4.js";
19
- import "./chunk-DDL4BWSL.js";
20
- import "./chunk-QIRE2VXS.js";
21
- export {
22
- project_default as default,
23
- promptProjectRegistrationOptions,
24
- renderProjectRegistrationSummary
25
- };
@@ -1,133 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- runCli
4
- } from "./chunk-PUDXVBSN.js";
5
- import "./chunk-2UW7NQLX.js";
6
- import "./chunk-2TSM3INR.js";
7
- import "./chunk-EEQQWTXS.js";
8
- import {
9
- resolveRuntimeRoot
10
- } from "./chunk-IWFX2FMA.js";
11
- import {
12
- handleMissingManagedProjectConfig,
13
- resolveManagedProjectConfig
14
- } from "./chunk-DDL4BWSL.js";
15
- import "./chunk-QIRE2VXS.js";
16
-
17
- // src/commands/recover.ts
18
- import { readFile, readdir } from "fs/promises";
19
- import { join } from "path";
20
- function parseRecoverArgs(args) {
21
- const parsed = { dryRun: false };
22
- for (let i = 0; i < args.length; i += 1) {
23
- const arg = args[i];
24
- if (arg === "--dry-run") {
25
- parsed.dryRun = true;
26
- }
27
- if (arg === "--project" || arg === "--project-id") {
28
- parsed.projectId = args[i + 1];
29
- i += 1;
30
- }
31
- }
32
- return parsed;
33
- }
34
- var handler = async (args, options) => {
35
- const parsed = parseRecoverArgs(args);
36
- const projectConfig = await resolveManagedProjectConfig({
37
- configDir: options.configDir,
38
- requestedProjectId: parsed.projectId
39
- });
40
- if (!projectConfig) {
41
- handleMissingManagedProjectConfig();
42
- return;
43
- }
44
- const runtimeRoot = resolveRuntimeRoot(options.configDir);
45
- const projectId = projectConfig.projectId;
46
- if (parsed.dryRun) {
47
- process.stdout.write("Dry run \u2014 scanning for stalled runs...\n");
48
- const candidates = await listRecoverCandidates(runtimeRoot, projectId);
49
- if (options.json) {
50
- process.stdout.write(JSON.stringify(candidates, null, 2) + "\n");
51
- return;
52
- }
53
- if (candidates.length === 0) {
54
- process.stdout.write("No recoverable runs found.\n");
55
- return;
56
- }
57
- for (const candidate of candidates) {
58
- process.stdout.write(
59
- `${candidate.issueIdentifier} (${candidate.runId}) \u2014 ${candidate.reason}
60
- `
61
- );
62
- }
63
- return;
64
- }
65
- process.stdout.write("Recovering stalled runs...\n");
66
- await runCli([
67
- "recover",
68
- "--runtime-root",
69
- runtimeRoot,
70
- "--project-id",
71
- projectId
72
- ]);
73
- };
74
- var recover_default = handler;
75
- async function listRecoverCandidates(runtimeRoot, projectId) {
76
- const runsDir = join(runtimeRoot, "projects", projectId, "runs");
77
- const candidates = [];
78
- let entries = [];
79
- try {
80
- entries = await readdir(runsDir);
81
- } catch {
82
- return candidates;
83
- }
84
- for (const entry of entries) {
85
- const runPath = join(runsDir, entry, "run.json");
86
- try {
87
- const raw = await readFile(runPath, "utf8");
88
- const run = JSON.parse(raw);
89
- if (run.projectId !== projectId) {
90
- continue;
91
- }
92
- const reason = detectRecoveryReason(run);
93
- if (!reason) {
94
- continue;
95
- }
96
- candidates.push({
97
- runId: run.runId,
98
- issueIdentifier: run.issueIdentifier,
99
- status: run.status,
100
- reason
101
- });
102
- } catch {
103
- }
104
- }
105
- return candidates;
106
- }
107
- function detectRecoveryReason(run) {
108
- if (run.processId) {
109
- const startedAt = run.startedAt ? new Date(run.startedAt).getTime() : 0;
110
- const runningForMs = Date.now() - startedAt;
111
- if (isProcessRunning(run.processId) && runningForMs > 30 * 60 * 1e3) {
112
- return "worker appears stuck";
113
- }
114
- if (!isProcessRunning(run.processId)) {
115
- return "worker process is no longer running";
116
- }
117
- }
118
- if (run.status === "retrying" && run.nextRetryAt && new Date(run.nextRetryAt).getTime() <= Date.now()) {
119
- return "retry window has elapsed";
120
- }
121
- return null;
122
- }
123
- function isProcessRunning(pid) {
124
- try {
125
- process.kill(pid, 0);
126
- return true;
127
- } catch {
128
- return false;
129
- }
130
- }
131
- export {
132
- recover_default as default
133
- };