@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,26 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import {
3
- promptProjectRegistrationOptions,
4
- renderProjectRegistrationSummary
5
- } from "./chunk-S6VIK4FF.js";
6
2
  import {
7
3
  abortIfCancelled,
8
4
  buildAutomaticStateMappings,
9
- generateProjectId,
10
5
  planWorkflowArtifacts,
11
6
  promptStateMappings,
12
7
  renderDryRunPreview,
13
8
  resolvePriorityField,
14
9
  resolveStatusField,
15
10
  validateStateMapping,
16
- writeConfig,
17
11
  writeEcosystem,
18
12
  writeWorkflowPlan
19
- } from "./chunk-JN3TQVFV.js";
20
- import "./chunk-KY6WKH66.js";
21
- import "./chunk-MYVJ6HK4.js";
22
- import "./chunk-A67CMOYE.js";
23
- import "./chunk-SXGT7LOF.js";
13
+ } from "./chunk-WM2B6BJ7.js";
14
+ import {
15
+ initRepoRuntime
16
+ } from "./chunk-GHVDABFO.js";
17
+ import "./chunk-6I753NYO.js";
24
18
  import {
25
19
  GhAuthError,
26
20
  GitHubScopeError,
@@ -31,18 +25,13 @@ import {
31
25
  getProjectDetail,
32
26
  listUserProjects,
33
27
  validateToken
34
- } from "./chunk-C67H3OUL.js";
35
- import "./chunk-QEONJ5DZ.js";
36
- import "./chunk-XN5ABWZ6.js";
37
- import "./chunk-MVRF7BES.js";
38
- import "./chunk-5NV3LSAJ.js";
39
- import "./chunk-Y6TYJMNT.js";
40
- import "./chunk-C7G7RJ4G.js";
41
- import "./chunk-ROGRTUFI.js";
28
+ } from "./chunk-Z3NZOPLZ.js";
29
+ import "./chunk-GPRCOJDJ.js";
30
+ import "./chunk-WOVNN5NW.js";
42
31
 
43
32
  // src/commands/setup.ts
44
33
  import * as p from "@clack/prompts";
45
- import { join, resolve } from "path";
34
+ import { resolve } from "path";
46
35
  var KNOWN_REQUIRED_SCOPES = ["repo", "read:org", "project"];
47
36
  function parseSetupFlags(args) {
48
37
  const flags = {
@@ -57,14 +46,6 @@ function parseSetupFlags(args) {
57
46
  case "--non-interactive":
58
47
  flags.nonInteractive = true;
59
48
  break;
60
- case "--project":
61
- flags.project = next;
62
- i += 1;
63
- break;
64
- case "--workspace-dir":
65
- flags.workspaceDir = next;
66
- i += 1;
67
- break;
68
49
  case "--assigned-only":
69
50
  flags.assignedOnly = true;
70
51
  break;
@@ -78,6 +59,12 @@ function parseSetupFlags(args) {
78
59
  case "--skip-context":
79
60
  flags.skipContext = true;
80
61
  break;
62
+ default:
63
+ if (arg?.startsWith("-")) {
64
+ throw new Error(
65
+ `Unknown option '${arg}'. Removed project/workspace flags are no longer supported; run 'gh-symphony setup' from inside the target repository. Supported flags: --non-interactive, --assigned-only, --output, --skip-skills, --skip-context.`
66
+ );
67
+ }
81
68
  }
82
69
  }
83
70
  return flags;
@@ -97,26 +84,19 @@ Then re-run: ${retryCommand}`,
97
84
  "Fix missing scope"
98
85
  );
99
86
  }
100
- async function resolveProjectDetail(client, projectArg) {
87
+ async function resolveProjectDetail(client) {
101
88
  const projects = await listUserProjects(client);
102
89
  if (projects.length === 0) {
103
90
  throw new Error(
104
91
  "No GitHub Projects found. Create a project first and re-run setup."
105
92
  );
106
93
  }
107
- if (projectArg) {
108
- const match = projects.find(
109
- (project) => project.id === projectArg || project.url === projectArg
110
- );
111
- if (!match) {
112
- throw new Error(`Project not found: ${projectArg}`);
113
- }
114
- return getProjectDetail(client, match.id);
115
- }
116
94
  if (projects.length === 1) {
117
95
  return getProjectDetail(client, projects[0].id);
118
96
  }
119
- throw new Error("Error: --project is required when multiple projects exist.");
97
+ throw new Error(
98
+ "Error: non-interactive setup requires exactly one GitHub Project. Use 'gh-symphony workflow init' for project selection, then run 'gh-symphony repo init'."
99
+ );
120
100
  }
121
101
  async function selectProjectSummary(client) {
122
102
  const projects = await listUserProjects(client);
@@ -138,22 +118,29 @@ async function selectProjectSummary(client) {
138
118
  );
139
119
  return projects.find((project) => project.id === selectedProjectId);
140
120
  }
141
- function formatRepoSummary(projectDetail, selectedRepos) {
142
- return selectedRepos.length === projectDetail.linkedRepositories.length ? `${selectedRepos.map((repo) => `${repo.owner}/${repo.name}`).join(", ")} (all ${selectedRepos.length} linked)` : `${selectedRepos.map((repo) => `${repo.owner}/${repo.name}`).join(", ")} (${selectedRepos.length} of ${projectDetail.linkedRepositories.length} linked)`;
143
- }
144
121
  function printNonInteractiveSummary(input) {
145
122
  process.stdout.write(
146
123
  [
147
124
  `GitHub Project ${input.githubProjectTitle} (${input.githubProjectId})`,
148
- `Managed project ${input.projectId}`,
125
+ `Repository ${input.repository}`,
149
126
  `WORKFLOW.md ${input.workflowPath}`,
150
- `Workspace root ${input.workspaceDir}`,
151
- "Ready. Run 'gh-symphony start' to begin orchestration."
127
+ `Runtime ${input.runtimeDir}`,
128
+ "Ready. Run 'gh-symphony repo start' to begin orchestration."
152
129
  ].map((line) => ` ${line}`).join("\n") + "\n"
153
130
  );
154
131
  }
155
132
  var handler = async (args, options) => {
156
- const flags = parseSetupFlags(args);
133
+ let flags;
134
+ try {
135
+ flags = parseSetupFlags(args);
136
+ } catch (error) {
137
+ process.stderr.write(
138
+ `${error instanceof Error ? error.message : "Invalid setup arguments"}
139
+ `
140
+ );
141
+ process.exitCode = 2;
142
+ return;
143
+ }
157
144
  if (flags.nonInteractive) {
158
145
  await runNonInteractive(flags, options);
159
146
  return;
@@ -192,7 +179,7 @@ async function runNonInteractive(flags, options) {
192
179
  }
193
180
  let projectDetail;
194
181
  try {
195
- projectDetail = await resolveProjectDetail(client, flags.project);
182
+ projectDetail = await resolveProjectDetail(client);
196
183
  } catch (error) {
197
184
  process.stderr.write(
198
185
  `${error instanceof Error ? error.message : "Unknown error"}
@@ -247,13 +234,9 @@ Run setup without --non-interactive for manual mapping.
247
234
  skipSkills: flags.skipSkills,
248
235
  skipContext: flags.skipContext
249
236
  });
250
- const projectId = generateProjectId(projectDetail.title, projectDetail.id);
251
- const workspaceDir = flags.workspaceDir ?? join(options.configDir, "workspaces");
252
- await writeConfig(options.configDir, {
253
- projectId,
254
- project: projectDetail,
255
- repos: projectDetail.linkedRepositories,
256
- workspaceDir,
237
+ const runtime = await initRepoRuntime({
238
+ repoDir: process.cwd(),
239
+ workflowFile: workflowPath,
257
240
  assignedOnly: flags.assignedOnly
258
241
  });
259
242
  if (options.json) {
@@ -261,21 +244,22 @@ Run setup without --non-interactive for manual mapping.
261
244
  JSON.stringify({
262
245
  status: "created",
263
246
  output: workflowPath,
264
- projectId,
247
+ runtimeDir: runtime.configDir,
248
+ repository: `${runtime.repository.owner}/${runtime.repository.name}`,
265
249
  githubProjectId: projectDetail.id
266
250
  }) + "\n"
267
251
  );
268
252
  return;
269
253
  }
270
254
  printNonInteractiveSummary({
271
- projectId,
272
255
  githubProjectTitle: projectDetail.title,
273
256
  githubProjectId: projectDetail.id,
274
257
  workflowPath,
275
- workspaceDir
258
+ runtimeDir: runtime.configDir,
259
+ repository: `${runtime.repository.owner}/${runtime.repository.name}`
276
260
  });
277
261
  }
278
- async function runInteractive(flags, options) {
262
+ async function runInteractive(flags, _options) {
279
263
  p.intro("gh-symphony \u2014 One-command Setup");
280
264
  const authSpinner = p.spinner();
281
265
  authSpinner.start("Checking gh CLI authentication...");
@@ -332,13 +316,6 @@ async function runInteractive(flags, options) {
332
316
  process.exitCode = 1;
333
317
  return;
334
318
  }
335
- if (projectDetail.linkedRepositories.length === 0) {
336
- p.log.error(
337
- "No linked repositories found in this project. Add issues from repositories to the project first."
338
- );
339
- process.exitCode = 1;
340
- return;
341
- }
342
319
  const statusField = resolveStatusField(projectDetail);
343
320
  if (!statusField) {
344
321
  p.log.error(
@@ -386,16 +363,12 @@ async function runInteractive(flags, options) {
386
363
  }
387
364
  return priorityResolution.ambiguous.find((field) => field.id === selectedId) ?? null;
388
365
  })() : priorityResolution.field;
389
- const {
390
- assignedOnly: promptAssignedOnly,
391
- selectedRepos,
392
- workspaceDir
393
- } = await promptProjectRegistrationOptions({
394
- projectDetail,
395
- defaultWorkspaceDir: flags.workspaceDir ?? join(options.configDir, "workspaces"),
396
- assignedOnlyMessage: `${priorityResolution.ambiguous.length > 0 ? "Step 4/4" : "Step 3/3"} \u2014 Only process issues assigned to the authenticated GitHub user?`,
397
- assignedOnlyInitialValue: flags.assignedOnly
398
- });
366
+ const promptAssignedOnly = await abortIfCancelled(
367
+ p.confirm({
368
+ message: `${priorityResolution.ambiguous.length > 0 ? "Step 4/4" : "Step 3/3"} \u2014 Only process issues assigned to the authenticated GitHub user?`,
369
+ initialValue: flags.assignedOnly ?? false
370
+ })
371
+ );
399
372
  const assignedOnly = flags.assignedOnly || promptAssignedOnly;
400
373
  const workflowPath = resolve(flags.output ?? "WORKFLOW.md");
401
374
  const { workflowPlan, ecosystemPlan } = await planWorkflowArtifacts({
@@ -409,16 +382,12 @@ async function runInteractive(flags, options) {
409
382
  skipSkills: flags.skipSkills,
410
383
  skipContext: flags.skipContext
411
384
  });
412
- const projectId = generateProjectId(projectDetail.title, projectDetail.id);
413
385
  p.note(
414
386
  [
415
- renderProjectRegistrationSummary({
416
- login,
417
- projectTitle: projectDetail.title,
418
- repoSummary: formatRepoSummary(projectDetail, selectedRepos),
419
- assignedOnly,
420
- workspaceDir
421
- }),
387
+ `GitHub Project: ${projectDetail.title}`,
388
+ `Authenticated: ${login}`,
389
+ `Repository: current working directory`,
390
+ `Assigned: ${assignedOnly ? `Only issues assigned to ${login}` : "All project issues"}`,
422
391
  "",
423
392
  renderDryRunPreview(workflowPath, workflowPlan, ecosystemPlan).trimEnd()
424
393
  ].join("\n"),
@@ -445,14 +414,12 @@ async function runInteractive(flags, options) {
445
414
  skipSkills: flags.skipSkills,
446
415
  skipContext: flags.skipContext
447
416
  });
448
- await writeConfig(options.configDir, {
449
- projectId,
450
- project: projectDetail,
451
- repos: selectedRepos,
452
- workspaceDir,
417
+ const runtime = await initRepoRuntime({
418
+ repoDir: process.cwd(),
419
+ workflowFile: workflowPath,
453
420
  assignedOnly
454
421
  });
455
- writeSpinner.stop("Setup saved.");
422
+ writeSpinner.stop(`Setup saved for ${runtime.repository.owner}/${runtime.repository.name}.`);
456
423
  } catch (error) {
457
424
  writeSpinner.stop("Setup failed.");
458
425
  p.log.error(error instanceof Error ? error.message : "Unknown error");
@@ -460,8 +427,7 @@ async function runInteractive(flags, options) {
460
427
  return;
461
428
  }
462
429
  p.outro(
463
- `Project "${projectId}" is ready.
464
- Run 'gh-symphony start' to begin orchestration.`
430
+ "Repository runtime is ready.\n Run 'gh-symphony repo start' to begin orchestration."
465
431
  );
466
432
  }
467
433
  export {
@@ -16,8 +16,8 @@ function execFileAsync(file, args, execFileImpl = execFileCallback) {
16
16
  });
17
17
  }
18
18
  function resolveCurrentCliVersion() {
19
- if ("0.0.21".length > 0) {
20
- return "0.0.21";
19
+ if ("0.1.2".length > 0) {
20
+ return "0.1.2";
21
21
  }
22
22
  const pkg = JSON.parse(
23
23
  readFileSync(new URL("../../package.json", import.meta.url), "utf8")
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/commands/version.ts
4
4
  var handler = async (_args, options) => {
5
- const version = "0.0.21";
5
+ const version = "0.1.2";
6
6
  if (options.json) {
7
7
  process.stdout.write(JSON.stringify({ version }) + "\n");
8
8
  } else {