@gh-symphony/cli 0.0.20 → 0.0.22

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 (40) hide show
  1. package/README.md +66 -2
  2. package/dist/chunk-2TSM3INR.js +1085 -0
  3. package/dist/chunk-2UW7NQLX.js +684 -0
  4. package/dist/{chunk-MVRF7BES.js → chunk-36KYEDEO.js} +10 -1
  5. package/dist/{chunk-TILHWBP6.js → chunk-C67H3OUL.js} +239 -36
  6. package/dist/{chunk-C7G7RJ4G.js → chunk-DDL4BWSL.js} +1 -1
  7. package/dist/{chunk-XN5ABWZ6.js → chunk-DFLXHNYQ.js} +26 -30
  8. package/dist/{chunk-EKKT5USP.js → chunk-E7HYEEZD.js} +487 -133
  9. package/dist/chunk-EEQQWTXS.js +3257 -0
  10. package/dist/chunk-GDE6FYN4.js +26 -0
  11. package/dist/{chunk-Y6TYJMNT.js → chunk-GSX2FV3M.js} +10 -16
  12. package/dist/{chunk-RN2PACNV.js → chunk-HMLBBZNY.js} +731 -75
  13. package/dist/{chunk-5NV3LSAJ.js → chunk-IWFX2FMA.js} +5 -1
  14. package/dist/{chunk-HZVDTAPS.js → chunk-PUDXVBSN.js} +1549 -1458
  15. package/dist/{chunk-ROGRTUFI.js → chunk-QIRE2VXS.js} +14 -3
  16. package/dist/{chunk-3AWF54PI.js → chunk-ZHOKYUO3.js} +394 -42
  17. package/dist/{config-cmd-DNXNL26Z.js → config-cmd-Z3A7V6NC.js} +1 -1
  18. package/dist/{doctor-IYHCFXOZ.js → doctor-EJUMPBMW.js} +105 -40
  19. package/dist/index.js +112 -24
  20. package/dist/{init-KZT6YNOH.js → init-54HMKNYI.js} +8 -3
  21. package/dist/{logs-6JKKYDGJ.js → logs-GTZ4U5JE.js} +2 -2
  22. package/dist/project-RMYMZSFV.js +25 -0
  23. package/dist/{recover-5KQI7WH5.js → recover-LTLKMTRX.js} +7 -5
  24. package/dist/repo-WI7GF6XQ.js +749 -0
  25. package/dist/{run-ETC5UTRA.js → run-IHN3ZL35.js} +21 -7
  26. package/dist/{setup-VWB7RZUQ.js → setup-TZJSM3QV.js} +53 -14
  27. package/dist/start-RTAHQMR2.js +19 -0
  28. package/dist/status-F4D52OVK.js +12 -0
  29. package/dist/stop-MDKMJPVR.js +10 -0
  30. package/dist/{upgrade-3YNF3VKY.js → upgrade-O33S2SJK.js} +2 -2
  31. package/dist/{version-NUBTTOG7.js → version-CW54Q7BK.js} +1 -1
  32. package/dist/worker-entry.js +848 -693
  33. package/dist/{workflow-TBIFY5MO.js → workflow-L3KT6HB7.js} +177 -11
  34. package/package.json +4 -2
  35. package/dist/chunk-M3IFVLQS.js +0 -1155
  36. package/dist/project-UUVHS3ZR.js +0 -22
  37. package/dist/repo-HDDE7OUI.js +0 -321
  38. package/dist/start-ENFLZUI6.js +0 -16
  39. package/dist/status-QSCFVGRQ.js +0 -11
  40. package/dist/stop-7MFCBQVW.js +0 -9
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- project_default,
4
- promptProjectRegistrationOptions,
5
- renderProjectRegistrationSummary
6
- } from "./chunk-3AWF54PI.js";
7
- import "./chunk-RN2PACNV.js";
8
- import "./chunk-EKKT5USP.js";
9
- import "./chunk-HZVDTAPS.js";
10
- import "./chunk-M3IFVLQS.js";
11
- import "./chunk-TILHWBP6.js";
12
- import "./chunk-XN5ABWZ6.js";
13
- import "./chunk-MVRF7BES.js";
14
- import "./chunk-5NV3LSAJ.js";
15
- import "./chunk-Y6TYJMNT.js";
16
- import "./chunk-C7G7RJ4G.js";
17
- import "./chunk-ROGRTUFI.js";
18
- export {
19
- project_default as default,
20
- promptProjectRegistrationOptions,
21
- renderProjectRegistrationSummary
22
- };
@@ -1,321 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- GitHubScopeError,
4
- checkRequiredScopes,
5
- createClient,
6
- getGhToken,
7
- getProjectDetail,
8
- validateToken
9
- } from "./chunk-TILHWBP6.js";
10
- import {
11
- loadActiveProjectConfig,
12
- loadGlobalConfig,
13
- saveProjectConfig
14
- } from "./chunk-ROGRTUFI.js";
15
-
16
- // src/commands/repo.ts
17
- var handler = async (args, options) => {
18
- const [subcommand, ...rest] = args;
19
- switch (subcommand) {
20
- case "list":
21
- await repoList(options);
22
- break;
23
- case "add":
24
- await repoAdd(rest, options);
25
- break;
26
- case "remove":
27
- await repoRemove(rest, options);
28
- break;
29
- case "sync":
30
- await repoSync(rest, options);
31
- break;
32
- default:
33
- process.stderr.write(
34
- "Usage: gh-symphony repo <list|add|remove|sync> [repo]\n"
35
- );
36
- process.exitCode = 2;
37
- }
38
- };
39
- var repo_default = handler;
40
- function repoKey(repo) {
41
- return `${repo.owner}/${repo.name}`.toLowerCase();
42
- }
43
- function toRepoConfigEntry(repo) {
44
- return {
45
- owner: repo.owner,
46
- name: repo.name,
47
- cloneUrl: repo.cloneUrl
48
- };
49
- }
50
- function parseRepoSyncFlags(args) {
51
- const flags = { dryRun: false, prune: false };
52
- for (const arg of args) {
53
- if (arg === "--dry-run") {
54
- flags.dryRun = true;
55
- } else if (arg === "--prune") {
56
- flags.prune = true;
57
- }
58
- }
59
- return flags;
60
- }
61
- function displayScopeError(error) {
62
- const plural = error.requiredScopes.length === 1 ? "" : "s";
63
- process.stderr.write(
64
- `Token is missing required scope${plural}: ${error.requiredScopes.join(", ")}
65
- `
66
- );
67
- const currentSet = new Set(error.currentScopes.map((scope) => scope.toLowerCase()));
68
- const scopesToAdd = ["repo", "read:org", "project"].filter(
69
- (scope) => !currentSet.has(scope)
70
- );
71
- const scopeArg = scopesToAdd.length > 0 ? scopesToAdd.join(",") : error.requiredScopes.join(",");
72
- process.stderr.write(
73
- `Run 'gh auth refresh --scopes ${scopeArg}' and try again.
74
- `
75
- );
76
- }
77
- function formatRepoSpec(repo) {
78
- return `${repo.owner}/${repo.name}`;
79
- }
80
- function sortRepos(repos) {
81
- return [...repos].sort(
82
- (left, right) => formatRepoSpec(left).localeCompare(formatRepoSpec(right))
83
- );
84
- }
85
- function renderRepoGroup(label, repos) {
86
- if (repos.length === 0) {
87
- return [`${label}: none`];
88
- }
89
- return [label, ...sortRepos(repos).map((repo) => ` ${formatRepoSpec(repo)}`)];
90
- }
91
- function buildSyncedRepositories(currentRepos, linkedMap, linkedRepositories, prune) {
92
- const retained = currentRepos.filter((repo) => linkedMap.has(repoKey(repo)) || !prune).map((repo) => {
93
- const linked = linkedMap.get(repoKey(repo));
94
- return linked ? toRepoConfigEntry(linked) : { ...repo };
95
- });
96
- const currentKeys = new Set(currentRepos.map((repo) => repoKey(repo)));
97
- const additions = sortRepos(
98
- linkedRepositories.filter((repo) => !currentKeys.has(repoKey(repo))).map(toRepoConfigEntry)
99
- );
100
- return [...retained, ...additions];
101
- }
102
- function writeRepoSummary(summary, options) {
103
- if (options.json) {
104
- process.stdout.write(JSON.stringify(summary, null, 2) + "\n");
105
- return;
106
- }
107
- process.stdout.write(
108
- [
109
- `Repository sync ${summary.dryRun ? "preview" : "complete"} for ${summary.projectId}`,
110
- `Mode: ${summary.prune ? "prune" : "additive"}`,
111
- ...renderRepoGroup("Added", summary.added),
112
- ...renderRepoGroup("Removed", summary.removed),
113
- ...renderRepoGroup("Unchanged", summary.unchanged),
114
- summary.dryRun ? "No config changes written." : "Configuration updated."
115
- ].join("\n") + "\n"
116
- );
117
- }
118
- async function repoList(options) {
119
- const ws = await loadActiveProjectConfig(options.configDir);
120
- if (!ws) {
121
- process.stderr.write("No project configured.\n");
122
- process.exitCode = 1;
123
- return;
124
- }
125
- if (options.json) {
126
- process.stdout.write(JSON.stringify(ws.repositories, null, 2) + "\n");
127
- return;
128
- }
129
- process.stdout.write("Repositories:\n");
130
- for (const repo of ws.repositories) {
131
- process.stdout.write(` ${repo.owner}/${repo.name}
132
- `);
133
- }
134
- }
135
- async function repoAdd(args, options) {
136
- const [repoSpec] = args;
137
- if (!repoSpec || !repoSpec.includes("/")) {
138
- process.stderr.write("Usage: gh-symphony repo add <owner/name>\n");
139
- process.exitCode = 2;
140
- return;
141
- }
142
- const global = await loadGlobalConfig(options.configDir);
143
- if (!global?.activeProject) {
144
- process.stderr.write("No active project.\n");
145
- process.exitCode = 1;
146
- return;
147
- }
148
- const ws = await loadActiveProjectConfig(options.configDir);
149
- if (!ws) {
150
- process.stderr.write("Project config missing.\n");
151
- process.exitCode = 1;
152
- return;
153
- }
154
- const [owner, name] = repoSpec.split("/");
155
- if (!owner || !name) {
156
- process.stderr.write("Invalid repo format. Use: owner/name\n");
157
- process.exitCode = 2;
158
- return;
159
- }
160
- if (ws.repositories.some(
161
- (r) => r.owner === owner && r.name === name
162
- )) {
163
- process.stdout.write(`Repository ${repoSpec} is already configured.
164
- `);
165
- return;
166
- }
167
- ws.repositories.push({
168
- owner,
169
- name,
170
- cloneUrl: `https://github.com/${owner}/${name}.git`
171
- });
172
- await saveProjectConfig(options.configDir, global.activeProject, ws);
173
- process.stdout.write(`Added repository: ${repoSpec}
174
- `);
175
- }
176
- async function repoRemove(args, options) {
177
- const [repoSpec] = args;
178
- if (!repoSpec || !repoSpec.includes("/")) {
179
- process.stderr.write("Usage: gh-symphony repo remove <owner/name>\n");
180
- process.exitCode = 2;
181
- return;
182
- }
183
- const global = await loadGlobalConfig(options.configDir);
184
- if (!global?.activeProject) {
185
- process.stderr.write("No active project.\n");
186
- process.exitCode = 1;
187
- return;
188
- }
189
- const ws = await loadActiveProjectConfig(options.configDir);
190
- if (!ws) {
191
- process.stderr.write("Project config missing.\n");
192
- process.exitCode = 1;
193
- return;
194
- }
195
- const [owner, name] = repoSpec.split("/");
196
- const idx = ws.repositories.findIndex(
197
- (r) => r.owner === owner && r.name === name
198
- );
199
- if (idx === -1) {
200
- process.stderr.write(`Repository ${repoSpec} is not configured.
201
- `);
202
- process.exitCode = 1;
203
- return;
204
- }
205
- ws.repositories.splice(idx, 1);
206
- await saveProjectConfig(options.configDir, global.activeProject, ws);
207
- process.stdout.write(`Removed repository: ${repoSpec}
208
- `);
209
- }
210
- async function repoSync(args, options) {
211
- const flags = parseRepoSyncFlags(args);
212
- const global = await loadGlobalConfig(options.configDir);
213
- if (!global?.activeProject) {
214
- process.stderr.write("No active project.\n");
215
- process.exitCode = 1;
216
- return;
217
- }
218
- const ws = await loadActiveProjectConfig(options.configDir);
219
- if (!ws) {
220
- process.stderr.write("Project config missing.\n");
221
- process.exitCode = 1;
222
- return;
223
- }
224
- const projectBindingId = typeof ws.tracker.settings?.projectId === "string" ? ws.tracker.settings.projectId : ws.tracker.bindingId;
225
- if (!projectBindingId) {
226
- process.stderr.write(
227
- "Active project is missing its GitHub Project binding. Re-run 'gh-symphony project add'.\n"
228
- );
229
- process.exitCode = 1;
230
- return;
231
- }
232
- let token;
233
- try {
234
- token = getGhToken();
235
- } catch {
236
- process.stderr.write(
237
- "Error: GitHub token not found. Run 'gh auth login --scopes repo,read:org,project' or set GITHUB_GRAPHQL_TOKEN.\n"
238
- );
239
- process.exitCode = 1;
240
- return;
241
- }
242
- const client = createClient(token);
243
- try {
244
- const viewer = await validateToken(client);
245
- const scopeCheck = checkRequiredScopes(viewer.scopes);
246
- if (!scopeCheck.valid) {
247
- process.stderr.write(
248
- `Error: Missing required PAT scopes: ${scopeCheck.missing.join(", ")}
249
- `
250
- );
251
- process.exitCode = 1;
252
- return;
253
- }
254
- } catch {
255
- process.stderr.write("Error: Invalid GitHub token.\n");
256
- process.exitCode = 1;
257
- return;
258
- }
259
- let projectDetail;
260
- try {
261
- projectDetail = await getProjectDetail(client, projectBindingId);
262
- } catch (error) {
263
- if (error instanceof GitHubScopeError) {
264
- displayScopeError(error);
265
- } else {
266
- process.stderr.write(
267
- `${error instanceof Error ? error.message : "Failed to load linked repositories."}
268
- `
269
- );
270
- }
271
- process.exitCode = 1;
272
- return;
273
- }
274
- const currentRepos = ws.repositories;
275
- const currentMap = new Map(
276
- currentRepos.map((repo) => [repoKey(repo), repo])
277
- );
278
- const linkedMap = new Map(
279
- projectDetail.linkedRepositories.map((repo) => [
280
- repoKey(repo),
281
- repo
282
- ])
283
- );
284
- const added = projectDetail.linkedRepositories.filter((repo) => !currentMap.has(repoKey(repo))).map(toRepoConfigEntry);
285
- const removed = flags.prune ? currentRepos.filter((repo) => !linkedMap.has(repoKey(repo))).map((repo) => ({ ...repo })) : [];
286
- const unchanged = flags.prune ? currentRepos.filter((repo) => linkedMap.has(repoKey(repo))).map((repo) => {
287
- const linked = linkedMap.get(repoKey(repo));
288
- return linked ? toRepoConfigEntry(linked) : { ...repo };
289
- }) : currentRepos.map((repo) => {
290
- const linked = linkedMap.get(repoKey(repo));
291
- return linked ? toRepoConfigEntry(linked) : { ...repo };
292
- });
293
- const nextRepositories = buildSyncedRepositories(
294
- currentRepos,
295
- linkedMap,
296
- projectDetail.linkedRepositories,
297
- flags.prune
298
- );
299
- if (!flags.dryRun) {
300
- await saveProjectConfig(options.configDir, global.activeProject, {
301
- ...ws,
302
- repositories: nextRepositories
303
- });
304
- }
305
- writeRepoSummary(
306
- {
307
- projectId: global.activeProject,
308
- githubProjectId: projectBindingId,
309
- dryRun: flags.dryRun,
310
- prune: flags.prune,
311
- added,
312
- removed,
313
- unchanged,
314
- repositories: nextRepositories
315
- },
316
- options
317
- );
318
- }
319
- export {
320
- repo_default as default
321
- };
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- shutdownForegroundOrchestrator,
4
- start_default
5
- } from "./chunk-EKKT5USP.js";
6
- import "./chunk-HZVDTAPS.js";
7
- import "./chunk-M3IFVLQS.js";
8
- import "./chunk-TILHWBP6.js";
9
- import "./chunk-MVRF7BES.js";
10
- import "./chunk-5NV3LSAJ.js";
11
- import "./chunk-C7G7RJ4G.js";
12
- import "./chunk-ROGRTUFI.js";
13
- export {
14
- start_default as default,
15
- shutdownForegroundOrchestrator
16
- };
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- status_default
4
- } from "./chunk-XN5ABWZ6.js";
5
- import "./chunk-MVRF7BES.js";
6
- import "./chunk-5NV3LSAJ.js";
7
- import "./chunk-C7G7RJ4G.js";
8
- import "./chunk-ROGRTUFI.js";
9
- export {
10
- status_default as default
11
- };
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- stop_default
4
- } from "./chunk-Y6TYJMNT.js";
5
- import "./chunk-C7G7RJ4G.js";
6
- import "./chunk-ROGRTUFI.js";
7
- export {
8
- stop_default as default
9
- };