@gh-symphony/cli 0.0.14 → 0.0.16

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 (102) hide show
  1. package/dist/chunk-5NV3LSAJ.js +11 -0
  2. package/dist/chunk-6HBZC3BE.js +468 -0
  3. package/dist/chunk-76QPITKI.js +109 -0
  4. package/dist/chunk-EFMFGOWM.js +3575 -0
  5. package/dist/chunk-IWR4UQEJ.js +2250 -0
  6. package/dist/chunk-JO3AXHQI.js +130 -0
  7. package/dist/chunk-MHIWAIVD.js +876 -0
  8. package/dist/chunk-MVRF7BES.js +68 -0
  9. package/dist/chunk-ROGRTUFI.js +108 -0
  10. package/dist/chunk-TF3QNWNC.js +1121 -0
  11. package/dist/chunk-TH5QPO3Y.js +67 -0
  12. package/dist/config-cmd-AZ7POMAA.js +110 -0
  13. package/dist/index.d.ts +5 -4
  14. package/dist/index.js +568 -356
  15. package/dist/init-EZXQAXZM.js +17 -0
  16. package/dist/logs-6LNGT2GF.js +188 -0
  17. package/dist/project-557FE2GD.js +679 -0
  18. package/dist/recover-LVBI2TGH.js +131 -0
  19. package/dist/repo-R3XBIVAX.js +121 -0
  20. package/dist/run-WITYAYFZ.js +108 -0
  21. package/dist/start-JUFKNL3N.js +16 -0
  22. package/dist/status-3WK5BWRZ.js +11 -0
  23. package/dist/stop-AA3AP5M6.js +9 -0
  24. package/dist/version-VBB62JWI.js +30 -0
  25. package/dist/worker-entry.js +1828 -0
  26. package/package.json +9 -4
  27. package/dist/ansi.d.ts +0 -15
  28. package/dist/ansi.js +0 -53
  29. package/dist/commands/config-cmd.d.ts +0 -3
  30. package/dist/commands/config-cmd.js +0 -90
  31. package/dist/commands/help.d.ts +0 -3
  32. package/dist/commands/help.js +0 -55
  33. package/dist/commands/init.d.ts +0 -34
  34. package/dist/commands/init.js +0 -477
  35. package/dist/commands/logs.d.ts +0 -3
  36. package/dist/commands/logs.js +0 -184
  37. package/dist/commands/project.d.ts +0 -3
  38. package/dist/commands/project.js +0 -649
  39. package/dist/commands/recover.d.ts +0 -3
  40. package/dist/commands/recover.js +0 -119
  41. package/dist/commands/repo.d.ts +0 -3
  42. package/dist/commands/repo.js +0 -103
  43. package/dist/commands/run.d.ts +0 -3
  44. package/dist/commands/run.js +0 -95
  45. package/dist/commands/start.d.ts +0 -20
  46. package/dist/commands/start.js +0 -344
  47. package/dist/commands/status-refresh.d.ts +0 -9
  48. package/dist/commands/status-refresh.js +0 -27
  49. package/dist/commands/status.d.ts +0 -3
  50. package/dist/commands/status.js +0 -237
  51. package/dist/commands/stop.d.ts +0 -3
  52. package/dist/commands/stop.js +0 -92
  53. package/dist/commands/version.d.ts +0 -3
  54. package/dist/commands/version.js +0 -21
  55. package/dist/completion.d.ts +0 -1
  56. package/dist/completion.js +0 -204
  57. package/dist/config.d.ts +0 -38
  58. package/dist/config.js +0 -82
  59. package/dist/context/context-types.d.ts +0 -36
  60. package/dist/context/context-types.js +0 -1
  61. package/dist/context/generate-context-yaml.d.ts +0 -15
  62. package/dist/context/generate-context-yaml.js +0 -129
  63. package/dist/dashboard/renderer.d.ts +0 -9
  64. package/dist/dashboard/renderer.js +0 -220
  65. package/dist/detection/environment-detector.d.ts +0 -11
  66. package/dist/detection/environment-detector.js +0 -140
  67. package/dist/github/client.d.ts +0 -71
  68. package/dist/github/client.js +0 -348
  69. package/dist/github/gh-auth.d.ts +0 -34
  70. package/dist/github/gh-auth.js +0 -110
  71. package/dist/mapping/smart-defaults.d.ts +0 -17
  72. package/dist/mapping/smart-defaults.js +0 -86
  73. package/dist/orchestrator-runtime.d.ts +0 -1
  74. package/dist/orchestrator-runtime.js +0 -4
  75. package/dist/orchestrator-status-endpoint.d.ts +0 -5
  76. package/dist/orchestrator-status-endpoint.js +0 -27
  77. package/dist/project-selection.d.ts +0 -8
  78. package/dist/project-selection.js +0 -56
  79. package/dist/skills/skill-writer.d.ts +0 -14
  80. package/dist/skills/skill-writer.js +0 -62
  81. package/dist/skills/templates/commit.d.ts +0 -2
  82. package/dist/skills/templates/commit.js +0 -45
  83. package/dist/skills/templates/document.d.ts +0 -7
  84. package/dist/skills/templates/document.js +0 -16
  85. package/dist/skills/templates/gh-project.d.ts +0 -2
  86. package/dist/skills/templates/gh-project.js +0 -88
  87. package/dist/skills/templates/gh-symphony.d.ts +0 -2
  88. package/dist/skills/templates/gh-symphony.js +0 -125
  89. package/dist/skills/templates/index.d.ts +0 -8
  90. package/dist/skills/templates/index.js +0 -28
  91. package/dist/skills/templates/land.d.ts +0 -2
  92. package/dist/skills/templates/land.js +0 -59
  93. package/dist/skills/templates/pull.d.ts +0 -2
  94. package/dist/skills/templates/pull.js +0 -41
  95. package/dist/skills/templates/push.d.ts +0 -2
  96. package/dist/skills/templates/push.js +0 -36
  97. package/dist/skills/types.d.ts +0 -23
  98. package/dist/skills/types.js +0 -1
  99. package/dist/workflow/generate-reference-workflow.d.ts +0 -9
  100. package/dist/workflow/generate-reference-workflow.js +0 -261
  101. package/dist/workflow/generate-workflow-md.d.ts +0 -12
  102. package/dist/workflow/generate-workflow-md.js +0 -134
@@ -0,0 +1,131 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runCli
4
+ } from "./chunk-EFMFGOWM.js";
5
+ import "./chunk-TF3QNWNC.js";
6
+ import {
7
+ resolveRuntimeRoot
8
+ } from "./chunk-5NV3LSAJ.js";
9
+ import {
10
+ handleMissingManagedProjectConfig,
11
+ resolveManagedProjectConfig
12
+ } from "./chunk-TH5QPO3Y.js";
13
+ import "./chunk-ROGRTUFI.js";
14
+
15
+ // src/commands/recover.ts
16
+ import { readFile, readdir } from "fs/promises";
17
+ import { join } from "path";
18
+ function parseRecoverArgs(args) {
19
+ const parsed = { dryRun: false };
20
+ for (let i = 0; i < args.length; i += 1) {
21
+ const arg = args[i];
22
+ if (arg === "--dry-run") {
23
+ parsed.dryRun = true;
24
+ }
25
+ if (arg === "--project" || arg === "--project-id") {
26
+ parsed.projectId = args[i + 1];
27
+ i += 1;
28
+ }
29
+ }
30
+ return parsed;
31
+ }
32
+ var handler = async (args, options) => {
33
+ const parsed = parseRecoverArgs(args);
34
+ const projectConfig = await resolveManagedProjectConfig({
35
+ configDir: options.configDir,
36
+ requestedProjectId: parsed.projectId
37
+ });
38
+ if (!projectConfig) {
39
+ handleMissingManagedProjectConfig();
40
+ return;
41
+ }
42
+ const runtimeRoot = resolveRuntimeRoot(options.configDir);
43
+ const projectId = projectConfig.projectId;
44
+ if (parsed.dryRun) {
45
+ process.stdout.write("Dry run \u2014 scanning for stalled runs...\n");
46
+ const candidates = await listRecoverCandidates(runtimeRoot, projectId);
47
+ if (options.json) {
48
+ process.stdout.write(JSON.stringify(candidates, null, 2) + "\n");
49
+ return;
50
+ }
51
+ if (candidates.length === 0) {
52
+ process.stdout.write("No recoverable runs found.\n");
53
+ return;
54
+ }
55
+ for (const candidate of candidates) {
56
+ process.stdout.write(
57
+ `${candidate.issueIdentifier} (${candidate.runId}) \u2014 ${candidate.reason}
58
+ `
59
+ );
60
+ }
61
+ return;
62
+ }
63
+ process.stdout.write("Recovering stalled runs...\n");
64
+ await runCli([
65
+ "recover",
66
+ "--runtime-root",
67
+ runtimeRoot,
68
+ "--project-id",
69
+ projectId
70
+ ]);
71
+ };
72
+ var recover_default = handler;
73
+ async function listRecoverCandidates(runtimeRoot, projectId) {
74
+ const runsDir = join(runtimeRoot, "projects", projectId, "runs");
75
+ const candidates = [];
76
+ let entries = [];
77
+ try {
78
+ entries = await readdir(runsDir);
79
+ } catch {
80
+ return candidates;
81
+ }
82
+ for (const entry of entries) {
83
+ const runPath = join(runsDir, entry, "run.json");
84
+ try {
85
+ const raw = await readFile(runPath, "utf8");
86
+ const run = JSON.parse(raw);
87
+ if (run.projectId !== projectId) {
88
+ continue;
89
+ }
90
+ const reason = detectRecoveryReason(run);
91
+ if (!reason) {
92
+ continue;
93
+ }
94
+ candidates.push({
95
+ runId: run.runId,
96
+ issueIdentifier: run.issueIdentifier,
97
+ status: run.status,
98
+ reason
99
+ });
100
+ } catch {
101
+ }
102
+ }
103
+ return candidates;
104
+ }
105
+ function detectRecoveryReason(run) {
106
+ if (run.processId) {
107
+ const startedAt = run.startedAt ? new Date(run.startedAt).getTime() : 0;
108
+ const runningForMs = Date.now() - startedAt;
109
+ if (isProcessRunning(run.processId) && runningForMs > 30 * 60 * 1e3) {
110
+ return "worker appears stuck";
111
+ }
112
+ if (!isProcessRunning(run.processId)) {
113
+ return "worker process is no longer running";
114
+ }
115
+ }
116
+ if (run.status === "retrying" && run.nextRetryAt && new Date(run.nextRetryAt).getTime() <= Date.now()) {
117
+ return "retry window has elapsed";
118
+ }
119
+ return null;
120
+ }
121
+ function isProcessRunning(pid) {
122
+ try {
123
+ process.kill(pid, 0);
124
+ return true;
125
+ } catch {
126
+ return false;
127
+ }
128
+ }
129
+ export {
130
+ recover_default as default
131
+ };
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ loadActiveProjectConfig,
4
+ loadGlobalConfig,
5
+ saveProjectConfig
6
+ } from "./chunk-ROGRTUFI.js";
7
+
8
+ // src/commands/repo.ts
9
+ var handler = async (args, options) => {
10
+ const [subcommand, ...rest] = args;
11
+ switch (subcommand) {
12
+ case "list":
13
+ await repoList(options);
14
+ break;
15
+ case "add":
16
+ await repoAdd(rest, options);
17
+ break;
18
+ case "remove":
19
+ await repoRemove(rest, options);
20
+ break;
21
+ default:
22
+ process.stderr.write(
23
+ "Usage: gh-symphony repo <list|add|remove> [repo]\n"
24
+ );
25
+ process.exitCode = 2;
26
+ }
27
+ };
28
+ var repo_default = handler;
29
+ async function repoList(options) {
30
+ const ws = await loadActiveProjectConfig(options.configDir);
31
+ if (!ws) {
32
+ process.stderr.write("No project configured.\n");
33
+ process.exitCode = 1;
34
+ return;
35
+ }
36
+ if (options.json) {
37
+ process.stdout.write(JSON.stringify(ws.repositories, null, 2) + "\n");
38
+ return;
39
+ }
40
+ process.stdout.write("Repositories:\n");
41
+ for (const repo of ws.repositories) {
42
+ process.stdout.write(` ${repo.owner}/${repo.name}
43
+ `);
44
+ }
45
+ }
46
+ async function repoAdd(args, options) {
47
+ const [repoSpec] = args;
48
+ if (!repoSpec || !repoSpec.includes("/")) {
49
+ process.stderr.write("Usage: gh-symphony repo add <owner/name>\n");
50
+ process.exitCode = 2;
51
+ return;
52
+ }
53
+ const global = await loadGlobalConfig(options.configDir);
54
+ if (!global?.activeProject) {
55
+ process.stderr.write("No active project.\n");
56
+ process.exitCode = 1;
57
+ return;
58
+ }
59
+ const ws = await loadActiveProjectConfig(options.configDir);
60
+ if (!ws) {
61
+ process.stderr.write("Project config missing.\n");
62
+ process.exitCode = 1;
63
+ return;
64
+ }
65
+ const [owner, name] = repoSpec.split("/");
66
+ if (!owner || !name) {
67
+ process.stderr.write("Invalid repo format. Use: owner/name\n");
68
+ process.exitCode = 2;
69
+ return;
70
+ }
71
+ if (ws.repositories.some((r) => r.owner === owner && r.name === name)) {
72
+ process.stdout.write(`Repository ${repoSpec} is already configured.
73
+ `);
74
+ return;
75
+ }
76
+ ws.repositories.push({
77
+ owner,
78
+ name,
79
+ cloneUrl: `https://github.com/${owner}/${name}.git`
80
+ });
81
+ await saveProjectConfig(options.configDir, global.activeProject, ws);
82
+ process.stdout.write(`Added repository: ${repoSpec}
83
+ `);
84
+ }
85
+ async function repoRemove(args, options) {
86
+ const [repoSpec] = args;
87
+ if (!repoSpec || !repoSpec.includes("/")) {
88
+ process.stderr.write("Usage: gh-symphony repo remove <owner/name>\n");
89
+ process.exitCode = 2;
90
+ return;
91
+ }
92
+ const global = await loadGlobalConfig(options.configDir);
93
+ if (!global?.activeProject) {
94
+ process.stderr.write("No active project.\n");
95
+ process.exitCode = 1;
96
+ return;
97
+ }
98
+ const ws = await loadActiveProjectConfig(options.configDir);
99
+ if (!ws) {
100
+ process.stderr.write("Project config missing.\n");
101
+ process.exitCode = 1;
102
+ return;
103
+ }
104
+ const [owner, name] = repoSpec.split("/");
105
+ const idx = ws.repositories.findIndex(
106
+ (r) => r.owner === owner && r.name === name
107
+ );
108
+ if (idx === -1) {
109
+ process.stderr.write(`Repository ${repoSpec} is not configured.
110
+ `);
111
+ process.exitCode = 1;
112
+ return;
113
+ }
114
+ ws.repositories.splice(idx, 1);
115
+ await saveProjectConfig(options.configDir, global.activeProject, ws);
116
+ process.stdout.write(`Removed repository: ${repoSpec}
117
+ `);
118
+ }
119
+ export {
120
+ repo_default as default
121
+ };
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runCli
4
+ } from "./chunk-EFMFGOWM.js";
5
+ import "./chunk-TF3QNWNC.js";
6
+ import {
7
+ resolveRuntimeRoot
8
+ } from "./chunk-5NV3LSAJ.js";
9
+ import {
10
+ handleMissingManagedProjectConfig,
11
+ resolveManagedProjectConfig
12
+ } from "./chunk-TH5QPO3Y.js";
13
+ import "./chunk-ROGRTUFI.js";
14
+
15
+ // src/commands/run.ts
16
+ function parseRunArgs(args) {
17
+ const parsed = {
18
+ watch: false
19
+ };
20
+ for (let i = 0; i < args.length; i += 1) {
21
+ const arg = args[i];
22
+ if (arg === "--watch" || arg === "-w") {
23
+ parsed.watch = true;
24
+ } else if (arg === "--project" || arg === "--project-id") {
25
+ const value = args[i + 1];
26
+ if (!value || value.startsWith("-")) {
27
+ parsed.error = `Option '${arg}' argument missing`;
28
+ return parsed;
29
+ }
30
+ parsed.projectId = value;
31
+ i += 1;
32
+ } else if (arg === "--log-level") {
33
+ const value = args[i + 1];
34
+ if (!value || value.startsWith("-")) {
35
+ parsed.error = `Option '${arg}' argument missing`;
36
+ return parsed;
37
+ }
38
+ parsed.logLevel = value;
39
+ i += 1;
40
+ } else if (!arg?.startsWith("-")) {
41
+ parsed.issue = arg;
42
+ } else {
43
+ parsed.error = `Unknown option '${arg}'`;
44
+ return parsed;
45
+ }
46
+ }
47
+ return parsed;
48
+ }
49
+ var handler = async (args, options) => {
50
+ const parsed = parseRunArgs(args);
51
+ if (parsed.error) {
52
+ process.stderr.write(`${parsed.error}
53
+ `);
54
+ process.exitCode = 2;
55
+ return;
56
+ }
57
+ if (!parsed.issue) {
58
+ process.stderr.write("Usage: gh-symphony run <owner/repo#number>\n");
59
+ process.exitCode = 2;
60
+ return;
61
+ }
62
+ const projectConfig = await resolveManagedProjectConfig({
63
+ configDir: options.configDir,
64
+ requestedProjectId: parsed.projectId
65
+ });
66
+ if (!projectConfig) {
67
+ handleMissingManagedProjectConfig();
68
+ return;
69
+ }
70
+ const runtimeRoot = resolveRuntimeRoot(options.configDir);
71
+ const projectId = projectConfig.projectId;
72
+ const [repoSpec] = parsed.issue.split("#");
73
+ if (repoSpec && !projectConfig.repositories.some((r) => `${r.owner}/${r.name}` === repoSpec)) {
74
+ process.stderr.write(
75
+ `Repository "${repoSpec}" is not configured in this project.
76
+ Configured repos: ${projectConfig.repositories.map((r) => `${r.owner}/${r.name}`).join(", ")}
77
+ `
78
+ );
79
+ process.exitCode = 1;
80
+ return;
81
+ }
82
+ process.stdout.write(`Dispatching issue: ${parsed.issue}
83
+ `);
84
+ await runCli([
85
+ "run-issue",
86
+ "--runtime-root",
87
+ runtimeRoot,
88
+ "--project-id",
89
+ projectId,
90
+ "--issue",
91
+ parsed.issue,
92
+ ...parsed.logLevel ? ["--log-level", parsed.logLevel] : []
93
+ ]);
94
+ if (parsed.watch) {
95
+ process.stdout.write("\nWatching for status changes...\n");
96
+ await runCli([
97
+ "status",
98
+ "--runtime-root",
99
+ runtimeRoot,
100
+ "--project-id",
101
+ projectId
102
+ ]);
103
+ }
104
+ };
105
+ var run_default = handler;
106
+ export {
107
+ run_default as default
108
+ };
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ shutdownForegroundOrchestrator,
4
+ start_default
5
+ } from "./chunk-MHIWAIVD.js";
6
+ import "./chunk-JO3AXHQI.js";
7
+ import "./chunk-MVRF7BES.js";
8
+ import "./chunk-EFMFGOWM.js";
9
+ import "./chunk-TF3QNWNC.js";
10
+ import "./chunk-5NV3LSAJ.js";
11
+ import "./chunk-TH5QPO3Y.js";
12
+ import "./chunk-ROGRTUFI.js";
13
+ export {
14
+ start_default as default,
15
+ shutdownForegroundOrchestrator
16
+ };
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ status_default
4
+ } from "./chunk-6HBZC3BE.js";
5
+ import "./chunk-MVRF7BES.js";
6
+ import "./chunk-5NV3LSAJ.js";
7
+ import "./chunk-TH5QPO3Y.js";
8
+ import "./chunk-ROGRTUFI.js";
9
+ export {
10
+ status_default as default
11
+ };
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ stop_default
4
+ } from "./chunk-76QPITKI.js";
5
+ import "./chunk-TH5QPO3Y.js";
6
+ import "./chunk-ROGRTUFI.js";
7
+ export {
8
+ stop_default as default
9
+ };
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/commands/version.ts
4
+ import { readFile } from "fs/promises";
5
+ import { resolve, dirname } from "path";
6
+ import { fileURLToPath } from "url";
7
+ var handler = async (_args, options) => {
8
+ let version = "0.0.0";
9
+ try {
10
+ const pkgPath = resolve(
11
+ dirname(fileURLToPath(import.meta.url)),
12
+ "..",
13
+ "..",
14
+ "package.json"
15
+ );
16
+ const pkg = JSON.parse(await readFile(pkgPath, "utf8"));
17
+ version = pkg.version ?? version;
18
+ } catch {
19
+ }
20
+ if (options.json) {
21
+ process.stdout.write(JSON.stringify({ version }) + "\n");
22
+ } else {
23
+ process.stdout.write(`gh-symphony v${version}
24
+ `);
25
+ }
26
+ };
27
+ var version_default = handler;
28
+ export {
29
+ version_default as default
30
+ };