@gh-symphony/cli 0.4.2 → 0.4.4
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.
- package/dist/{chunk-OVE4KOBD.js → chunk-4ZHWEQQL.js} +294 -7
- package/dist/{chunk-QHMT2V3X.js → chunk-I3CZXKS5.js} +2 -2
- package/dist/{doctor-LT5UQG67.js → doctor-Y2AZZKGW.js} +189 -3
- package/dist/index.js +8 -6
- package/dist/{setup-4ZBHGOXT.js → setup-DMYXHOCB.js} +1 -1
- package/dist/{upgrade-334S2JVT.js → upgrade-FJXX733J.js} +2 -2
- package/dist/{version-J6P6WDMA.js → version-FYAZ57WO.js} +1 -1
- package/dist/{workflow-R3G7IA3Z.js → workflow-TQ7UZPGP.js} +2 -2
- package/package.json +5 -5
|
@@ -326,10 +326,19 @@ ${promptBody}
|
|
|
326
326
|
function buildFrontMatter(input) {
|
|
327
327
|
const lines = [];
|
|
328
328
|
lines.push("tracker:");
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
329
|
+
if (input.tracker?.kind === "linear") {
|
|
330
|
+
lines.push(" kind: linear");
|
|
331
|
+
lines.push(
|
|
332
|
+
` endpoint: ${input.tracker.endpoint ?? "https://api.linear.app/graphql"}`
|
|
333
|
+
);
|
|
334
|
+
lines.push(` api_key: ${input.tracker.apiKey ?? "$LINEAR_API_KEY"}`);
|
|
335
|
+
lines.push(` project_slug: ${input.tracker.projectSlug}`);
|
|
336
|
+
} else {
|
|
337
|
+
lines.push(" kind: github-project");
|
|
338
|
+
lines.push(` project_id: ${input.projectId}`);
|
|
339
|
+
lines.push(` state_field: ${input.stateFieldName}`);
|
|
340
|
+
lines.push(...buildPriorityFrontMatter(input));
|
|
341
|
+
}
|
|
333
342
|
if (input.lifecycle.activeStates.length > 0) {
|
|
334
343
|
lines.push(" active_states:");
|
|
335
344
|
for (const state of input.lifecycle.activeStates) {
|
|
@@ -342,6 +351,25 @@ function buildFrontMatter(input) {
|
|
|
342
351
|
lines.push(` - ${state}`);
|
|
343
352
|
}
|
|
344
353
|
}
|
|
354
|
+
if (input.tracker?.kind === "linear") {
|
|
355
|
+
const include = input.tracker.pickupLabels?.include ?? [];
|
|
356
|
+
const exclude = input.tracker.pickupLabels?.exclude ?? [];
|
|
357
|
+
if (include.length > 0 || exclude.length > 0) {
|
|
358
|
+
lines.push(" pickup_labels:");
|
|
359
|
+
if (include.length > 0) {
|
|
360
|
+
lines.push(" include:");
|
|
361
|
+
for (const label of include) {
|
|
362
|
+
lines.push(` - ${label}`);
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
if (exclude.length > 0) {
|
|
366
|
+
lines.push(" exclude:");
|
|
367
|
+
for (const label of exclude) {
|
|
368
|
+
lines.push(` - ${label}`);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
}
|
|
345
373
|
lines.push(
|
|
346
374
|
...buildStringListFrontMatter(
|
|
347
375
|
"blocker_check_states",
|
|
@@ -2152,6 +2180,14 @@ function parseInitFlags(args) {
|
|
|
2152
2180
|
flags.project = next;
|
|
2153
2181
|
i += 1;
|
|
2154
2182
|
break;
|
|
2183
|
+
case "--tracker":
|
|
2184
|
+
flags.tracker = next;
|
|
2185
|
+
i += 1;
|
|
2186
|
+
break;
|
|
2187
|
+
case "--linear-project-slug":
|
|
2188
|
+
flags.linearProjectSlug = next;
|
|
2189
|
+
i += 1;
|
|
2190
|
+
break;
|
|
2155
2191
|
case "--output":
|
|
2156
2192
|
flags.output = next;
|
|
2157
2193
|
i += 1;
|
|
@@ -2173,7 +2209,7 @@ function parseInitFlags(args) {
|
|
|
2173
2209
|
function warnDeprecatedSkipContext() {
|
|
2174
2210
|
p.log.warn(SKIP_CONTEXT_DEPRECATION);
|
|
2175
2211
|
}
|
|
2176
|
-
async function runInitRuntimePreflight(runtime) {
|
|
2212
|
+
async function runInitRuntimePreflight(runtime, opts = {}) {
|
|
2177
2213
|
if (!isClaudeRuntime(runtime)) {
|
|
2178
2214
|
return true;
|
|
2179
2215
|
}
|
|
@@ -2183,7 +2219,7 @@ async function runInitRuntimePreflight(runtime) {
|
|
|
2183
2219
|
env: process.env,
|
|
2184
2220
|
command: resolveClaudeCommandBinary(resolveRuntimeCommand(runtime)) ?? resolveRuntimeCommand(runtime),
|
|
2185
2221
|
authMode: "local-or-api-key",
|
|
2186
|
-
includeGhAuth: !hasGitHubGraphqlToken
|
|
2222
|
+
includeGhAuth: opts.includeGhAuth ?? !hasGitHubGraphqlToken
|
|
2187
2223
|
});
|
|
2188
2224
|
const message = formatClaudePreflightText(report);
|
|
2189
2225
|
if (report.ok) {
|
|
@@ -2202,6 +2238,27 @@ var handler = async (args, options) => {
|
|
|
2202
2238
|
await runNonInteractive(flags, options);
|
|
2203
2239
|
return;
|
|
2204
2240
|
}
|
|
2241
|
+
const trackerKind = resolveInitTrackerKind(flags);
|
|
2242
|
+
if (trackerKind instanceof Error) {
|
|
2243
|
+
process.stderr.write(`Error: ${trackerKind.message}
|
|
2244
|
+
`);
|
|
2245
|
+
process.exitCode = 1;
|
|
2246
|
+
return;
|
|
2247
|
+
}
|
|
2248
|
+
const trackerFlagError = validateInitTrackerFlags(flags, trackerKind);
|
|
2249
|
+
if (trackerFlagError) {
|
|
2250
|
+
process.stderr.write(`Error: ${trackerFlagError}
|
|
2251
|
+
`);
|
|
2252
|
+
process.exitCode = 1;
|
|
2253
|
+
return;
|
|
2254
|
+
}
|
|
2255
|
+
if (trackerKind === "linear") {
|
|
2256
|
+
process.stderr.write(
|
|
2257
|
+
"Error: Linear workflow init currently requires --non-interactive.\n"
|
|
2258
|
+
);
|
|
2259
|
+
process.exitCode = 1;
|
|
2260
|
+
return;
|
|
2261
|
+
}
|
|
2205
2262
|
await runInteractive(flags, options);
|
|
2206
2263
|
};
|
|
2207
2264
|
var workflow_init_default = handler;
|
|
@@ -2668,6 +2725,143 @@ async function planWorkflowArtifacts(opts) {
|
|
|
2668
2725
|
ecosystemPlan
|
|
2669
2726
|
};
|
|
2670
2727
|
}
|
|
2728
|
+
var LINEAR_DEFAULT_STATUS_FIELD = {
|
|
2729
|
+
id: "linear-state",
|
|
2730
|
+
name: "State",
|
|
2731
|
+
options: [
|
|
2732
|
+
{
|
|
2733
|
+
id: "linear-todo",
|
|
2734
|
+
name: "Todo",
|
|
2735
|
+
description: null,
|
|
2736
|
+
color: null
|
|
2737
|
+
},
|
|
2738
|
+
{
|
|
2739
|
+
id: "linear-in-progress",
|
|
2740
|
+
name: "In Progress",
|
|
2741
|
+
description: null,
|
|
2742
|
+
color: null
|
|
2743
|
+
},
|
|
2744
|
+
{
|
|
2745
|
+
id: "linear-rework",
|
|
2746
|
+
name: "Rework",
|
|
2747
|
+
description: null,
|
|
2748
|
+
color: null
|
|
2749
|
+
},
|
|
2750
|
+
{
|
|
2751
|
+
id: "linear-human-review",
|
|
2752
|
+
name: "Human Review",
|
|
2753
|
+
description: null,
|
|
2754
|
+
color: null
|
|
2755
|
+
},
|
|
2756
|
+
{
|
|
2757
|
+
id: "linear-done",
|
|
2758
|
+
name: "Done",
|
|
2759
|
+
description: null,
|
|
2760
|
+
color: null
|
|
2761
|
+
},
|
|
2762
|
+
{
|
|
2763
|
+
id: "linear-canceled",
|
|
2764
|
+
name: "Canceled",
|
|
2765
|
+
description: null,
|
|
2766
|
+
color: null
|
|
2767
|
+
},
|
|
2768
|
+
{
|
|
2769
|
+
id: "linear-cancelled",
|
|
2770
|
+
name: "Cancelled",
|
|
2771
|
+
description: null,
|
|
2772
|
+
color: null
|
|
2773
|
+
},
|
|
2774
|
+
{
|
|
2775
|
+
id: "linear-duplicate",
|
|
2776
|
+
name: "Duplicate",
|
|
2777
|
+
description: null,
|
|
2778
|
+
color: null
|
|
2779
|
+
}
|
|
2780
|
+
]
|
|
2781
|
+
};
|
|
2782
|
+
var LINEAR_DEFAULT_MAPPINGS = {
|
|
2783
|
+
Todo: { role: "active" },
|
|
2784
|
+
"In Progress": { role: "active" },
|
|
2785
|
+
Rework: { role: "active" },
|
|
2786
|
+
"Human Review": { role: "wait" },
|
|
2787
|
+
Done: { role: "terminal" },
|
|
2788
|
+
Canceled: { role: "terminal" },
|
|
2789
|
+
Cancelled: { role: "terminal" },
|
|
2790
|
+
Duplicate: { role: "terminal" }
|
|
2791
|
+
};
|
|
2792
|
+
function buildLinearProjectDetail(projectSlug) {
|
|
2793
|
+
return {
|
|
2794
|
+
id: projectSlug,
|
|
2795
|
+
title: `Linear project ${projectSlug}`,
|
|
2796
|
+
url: "",
|
|
2797
|
+
statusFields: [LINEAR_DEFAULT_STATUS_FIELD],
|
|
2798
|
+
textFields: [],
|
|
2799
|
+
linkedRepositories: []
|
|
2800
|
+
};
|
|
2801
|
+
}
|
|
2802
|
+
function buildLinearWorkflowLifecycle() {
|
|
2803
|
+
return toWorkflowLifecycleConfig("State", LINEAR_DEFAULT_MAPPINGS, {
|
|
2804
|
+
blockerCheckStates: [],
|
|
2805
|
+
planningStates: []
|
|
2806
|
+
});
|
|
2807
|
+
}
|
|
2808
|
+
async function planLinearWorkflowArtifacts(opts) {
|
|
2809
|
+
const environment = opts.environment ?? await detectEnvironment(opts.cwd);
|
|
2810
|
+
const projectDetail = buildLinearProjectDetail(opts.projectSlug);
|
|
2811
|
+
const lifecycle = buildLinearWorkflowLifecycle();
|
|
2812
|
+
const workflowMd = generateWorkflowMarkdown({
|
|
2813
|
+
projectId: opts.projectSlug,
|
|
2814
|
+
tracker: {
|
|
2815
|
+
kind: "linear",
|
|
2816
|
+
projectSlug: opts.projectSlug
|
|
2817
|
+
},
|
|
2818
|
+
stateFieldName: LINEAR_DEFAULT_STATUS_FIELD.name,
|
|
2819
|
+
priority: null,
|
|
2820
|
+
mappings: LINEAR_DEFAULT_MAPPINGS,
|
|
2821
|
+
lifecycle,
|
|
2822
|
+
runtime: opts.runtime,
|
|
2823
|
+
detectedEnvironment: environment
|
|
2824
|
+
});
|
|
2825
|
+
const workflowPlan = await planFileChange({
|
|
2826
|
+
path: opts.outputPath,
|
|
2827
|
+
label: "WORKFLOW.md",
|
|
2828
|
+
content: workflowMd,
|
|
2829
|
+
mode: "overwrite"
|
|
2830
|
+
});
|
|
2831
|
+
const ecosystemPlan = await planEcosystem({
|
|
2832
|
+
cwd: opts.cwd,
|
|
2833
|
+
projectDetail,
|
|
2834
|
+
statusField: LINEAR_DEFAULT_STATUS_FIELD,
|
|
2835
|
+
priorityField: null,
|
|
2836
|
+
priority: buildDisabledPriority(),
|
|
2837
|
+
lifecycle,
|
|
2838
|
+
includePriorityTemplates: false,
|
|
2839
|
+
runtime: opts.runtime,
|
|
2840
|
+
skipSkills: opts.skipSkills,
|
|
2841
|
+
skipContext: opts.skipContext,
|
|
2842
|
+
environment
|
|
2843
|
+
});
|
|
2844
|
+
return {
|
|
2845
|
+
outputPath: opts.outputPath,
|
|
2846
|
+
workflowMd,
|
|
2847
|
+
workflowPlan,
|
|
2848
|
+
ecosystemPlan
|
|
2849
|
+
};
|
|
2850
|
+
}
|
|
2851
|
+
async function writeLinearEcosystem(opts) {
|
|
2852
|
+
return writeEcosystem({
|
|
2853
|
+
cwd: opts.cwd,
|
|
2854
|
+
projectDetail: buildLinearProjectDetail(opts.projectSlug),
|
|
2855
|
+
statusField: LINEAR_DEFAULT_STATUS_FIELD,
|
|
2856
|
+
priorityField: null,
|
|
2857
|
+
priority: buildDisabledPriority(),
|
|
2858
|
+
lifecycle: buildLinearWorkflowLifecycle(),
|
|
2859
|
+
includePriorityTemplates: false,
|
|
2860
|
+
runtime: opts.runtime,
|
|
2861
|
+
skipSkills: opts.skipSkills,
|
|
2862
|
+
skipContext: opts.skipContext
|
|
2863
|
+
});
|
|
2864
|
+
}
|
|
2671
2865
|
async function writeWorkflowPlan(workflowPlan) {
|
|
2672
2866
|
return writePlannedFile(workflowPlan);
|
|
2673
2867
|
}
|
|
@@ -2948,10 +3142,30 @@ async function runNonInteractive(flags, options) {
|
|
|
2948
3142
|
process.exitCode = 1;
|
|
2949
3143
|
return;
|
|
2950
3144
|
}
|
|
2951
|
-
|
|
3145
|
+
const trackerKind = resolveInitTrackerKind(flags);
|
|
3146
|
+
if (trackerKind instanceof Error) {
|
|
3147
|
+
process.stderr.write(`Error: ${trackerKind.message}
|
|
3148
|
+
`);
|
|
3149
|
+
process.exitCode = 1;
|
|
3150
|
+
return;
|
|
3151
|
+
}
|
|
3152
|
+
const trackerFlagError = validateInitTrackerFlags(flags, trackerKind);
|
|
3153
|
+
if (trackerFlagError) {
|
|
3154
|
+
process.stderr.write(`Error: ${trackerFlagError}
|
|
3155
|
+
`);
|
|
2952
3156
|
process.exitCode = 1;
|
|
2953
3157
|
return;
|
|
2954
3158
|
}
|
|
3159
|
+
if (!await runInitRuntimePreflight(runtime, {
|
|
3160
|
+
includeGhAuth: trackerKind === "linear" ? false : void 0
|
|
3161
|
+
})) {
|
|
3162
|
+
process.exitCode = 1;
|
|
3163
|
+
return;
|
|
3164
|
+
}
|
|
3165
|
+
if (trackerKind === "linear") {
|
|
3166
|
+
await runLinearNonInteractive(flags, options, runtime);
|
|
3167
|
+
return;
|
|
3168
|
+
}
|
|
2955
3169
|
let token;
|
|
2956
3170
|
try {
|
|
2957
3171
|
token = getGhTokenWithSource().token;
|
|
@@ -3085,6 +3299,79 @@ Run without --non-interactive for manual mapping.
|
|
|
3085
3299
|
});
|
|
3086
3300
|
}
|
|
3087
3301
|
}
|
|
3302
|
+
function resolveInitTrackerKind(flags) {
|
|
3303
|
+
const rawTracker = flags.tracker?.trim();
|
|
3304
|
+
if (!rawTracker) {
|
|
3305
|
+
return flags.linearProjectSlug ? "linear" : "github-project";
|
|
3306
|
+
}
|
|
3307
|
+
if (rawTracker === "github-project") {
|
|
3308
|
+
if (flags.linearProjectSlug?.trim()) {
|
|
3309
|
+
return new Error(
|
|
3310
|
+
"--linear-project-slug is only supported for --tracker linear."
|
|
3311
|
+
);
|
|
3312
|
+
}
|
|
3313
|
+
return "github-project";
|
|
3314
|
+
}
|
|
3315
|
+
if (rawTracker === "linear") {
|
|
3316
|
+
return "linear";
|
|
3317
|
+
}
|
|
3318
|
+
return new Error(
|
|
3319
|
+
`Unsupported tracker '${rawTracker}'. Choose one of: github-project, linear.`
|
|
3320
|
+
);
|
|
3321
|
+
}
|
|
3322
|
+
function validateInitTrackerFlags(flags, trackerKind) {
|
|
3323
|
+
if (trackerKind === "linear") {
|
|
3324
|
+
if (!flags.linearProjectSlug?.trim()) {
|
|
3325
|
+
return "--linear-project-slug is required when --tracker linear is used.";
|
|
3326
|
+
}
|
|
3327
|
+
if (flags.project) {
|
|
3328
|
+
return "--project is only supported for --tracker github-project.";
|
|
3329
|
+
}
|
|
3330
|
+
}
|
|
3331
|
+
return null;
|
|
3332
|
+
}
|
|
3333
|
+
async function runLinearNonInteractive(flags, options, runtime) {
|
|
3334
|
+
const projectSlug = flags.linearProjectSlug.trim();
|
|
3335
|
+
const outputPath = resolve(flags.output ?? "WORKFLOW.md");
|
|
3336
|
+
const { workflowPlan, ecosystemPlan } = await planLinearWorkflowArtifacts({
|
|
3337
|
+
cwd: process.cwd(),
|
|
3338
|
+
outputPath,
|
|
3339
|
+
projectSlug,
|
|
3340
|
+
runtime,
|
|
3341
|
+
skipSkills: flags.skipSkills,
|
|
3342
|
+
skipContext: flags.skipContext
|
|
3343
|
+
});
|
|
3344
|
+
if (flags.dryRun) {
|
|
3345
|
+
if (options.json) {
|
|
3346
|
+
process.stdout.write(
|
|
3347
|
+
JSON.stringify(
|
|
3348
|
+
buildDryRunJsonResult(outputPath, workflowPlan, ecosystemPlan)
|
|
3349
|
+
) + "\n"
|
|
3350
|
+
);
|
|
3351
|
+
return;
|
|
3352
|
+
}
|
|
3353
|
+
printDryRunPreview(outputPath, workflowPlan, ecosystemPlan);
|
|
3354
|
+
return;
|
|
3355
|
+
}
|
|
3356
|
+
await writeWorkflowPlan(workflowPlan);
|
|
3357
|
+
const ecosystemResult = await writeLinearEcosystem({
|
|
3358
|
+
cwd: process.cwd(),
|
|
3359
|
+
projectSlug,
|
|
3360
|
+
runtime,
|
|
3361
|
+
skipSkills: flags.skipSkills,
|
|
3362
|
+
skipContext: flags.skipContext
|
|
3363
|
+
});
|
|
3364
|
+
if (options.json) {
|
|
3365
|
+
process.stdout.write(
|
|
3366
|
+
JSON.stringify({ output: outputPath, status: workflowPlan.status }) + "\n"
|
|
3367
|
+
);
|
|
3368
|
+
} else {
|
|
3369
|
+
printEcosystemSummary(ecosystemResult, outputPath, {
|
|
3370
|
+
interactive: false,
|
|
3371
|
+
nextSteps: "Run 'gh-symphony repo init' from the target repository."
|
|
3372
|
+
});
|
|
3373
|
+
}
|
|
3374
|
+
}
|
|
3088
3375
|
async function runInteractive(flags, options) {
|
|
3089
3376
|
p.intro("gh-symphony \u2014 WORKFLOW.md Setup");
|
|
3090
3377
|
await runInteractiveStandalone(flags, options);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
workflow_init_default
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4ZHWEQQL.js";
|
|
5
5
|
import {
|
|
6
6
|
fetchGithubProjectIssueByRepositoryAndNumber,
|
|
7
7
|
inspectManagedProjectSelection,
|
|
@@ -377,7 +377,7 @@ Commands:
|
|
|
377
377
|
preview Render the final worker prompt from a sample or live issue
|
|
378
378
|
|
|
379
379
|
Options:
|
|
380
|
-
workflow init [--non-interactive] [--project <id>] [--output <path>] [--skip-skills] [--skip-context (deprecated no-op)] [--dry-run]
|
|
380
|
+
workflow init [--non-interactive] [--tracker <github-project|linear>] [--project <id>] [--linear-project-slug <slug>] [--output <path>] [--skip-skills] [--skip-context (deprecated no-op)] [--dry-run]
|
|
381
381
|
workflow validate [--file <path>]
|
|
382
382
|
workflow preview [issue] [--file <path>] [--issue <owner/repo#number|ENG-123>] [--project-id <projectId>] [--sample <json>] [--attempt <n>]
|
|
383
383
|
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
parseIssueReference,
|
|
6
6
|
readGitHubProjectBinding,
|
|
7
7
|
renderIssueWorkflowPreview
|
|
8
|
-
} from "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
} from "./chunk-I3CZXKS5.js";
|
|
9
|
+
import "./chunk-4ZHWEQQL.js";
|
|
10
10
|
import {
|
|
11
11
|
fetchGithubProjectIssueByRepositoryAndNumber,
|
|
12
12
|
fetchGithubProjectIssues,
|
|
@@ -766,6 +766,172 @@ function buildGithubTrackerConfig(input) {
|
|
|
766
766
|
timeoutMs: typeof settings?.timeoutMs === "number" ? settings.timeoutMs : void 0
|
|
767
767
|
};
|
|
768
768
|
}
|
|
769
|
+
async function checkLinearTrackerResolution(input) {
|
|
770
|
+
const tracker = input.projectConfig.projectConfig.tracker;
|
|
771
|
+
const projectSlug = readStringSetting(tracker.settings, "projectSlug")?.trim();
|
|
772
|
+
const activeStates = readLinearActiveStates(tracker.settings);
|
|
773
|
+
const pickupLabels = readLinearPickupLabels(tracker.settings);
|
|
774
|
+
if (!projectSlug) {
|
|
775
|
+
return failCheck(
|
|
776
|
+
"linear_tracker_resolution",
|
|
777
|
+
"Linear tracker resolution",
|
|
778
|
+
"Linear tracker resolution could not run because the project slug is missing.",
|
|
779
|
+
"Run 'gh-symphony repo init' with WORKFLOW.md field 'tracker.project_slug' configured, then re-run 'gh-symphony doctor'.",
|
|
780
|
+
{
|
|
781
|
+
reason: "missing_project_slug",
|
|
782
|
+
adapter: tracker.adapter
|
|
783
|
+
}
|
|
784
|
+
);
|
|
785
|
+
}
|
|
786
|
+
if (activeStates.length === 0) {
|
|
787
|
+
return failCheck(
|
|
788
|
+
"linear_tracker_resolution",
|
|
789
|
+
"Linear tracker resolution",
|
|
790
|
+
"Linear tracker resolution could not run because no active states are configured.",
|
|
791
|
+
"Add at least one active state to WORKFLOW.md under 'tracker.active_states', run 'gh-symphony repo init' again, then re-run 'gh-symphony doctor'.",
|
|
792
|
+
{
|
|
793
|
+
reason: "missing_active_states",
|
|
794
|
+
projectSlug
|
|
795
|
+
}
|
|
796
|
+
);
|
|
797
|
+
}
|
|
798
|
+
const token = process.env.LINEAR_API_KEY?.trim();
|
|
799
|
+
if (!token) {
|
|
800
|
+
return failCheck(
|
|
801
|
+
"linear_tracker_resolution",
|
|
802
|
+
"Linear tracker resolution",
|
|
803
|
+
"Linear tracker resolution could not run because LINEAR_API_KEY is not set.",
|
|
804
|
+
"Set LINEAR_API_KEY in the environment and re-run 'gh-symphony doctor'.",
|
|
805
|
+
{
|
|
806
|
+
reason: "missing_token",
|
|
807
|
+
projectSlug,
|
|
808
|
+
activeStates,
|
|
809
|
+
pickupLabels
|
|
810
|
+
}
|
|
811
|
+
);
|
|
812
|
+
}
|
|
813
|
+
try {
|
|
814
|
+
const project = await fetchLinearProjectBySlug({
|
|
815
|
+
endpoint: tracker.apiUrl?.trim() || "https://api.linear.app/graphql",
|
|
816
|
+
projectSlug,
|
|
817
|
+
token,
|
|
818
|
+
fetchImpl: input.deps.fetchImpl
|
|
819
|
+
});
|
|
820
|
+
if (!project) {
|
|
821
|
+
return failCheck(
|
|
822
|
+
"linear_tracker_resolution",
|
|
823
|
+
"Linear tracker resolution",
|
|
824
|
+
`Linear project "${projectSlug}" was not found or is not accessible.`,
|
|
825
|
+
"Confirm LINEAR_API_KEY can read the configured Linear project, then re-run 'gh-symphony doctor'.",
|
|
826
|
+
{
|
|
827
|
+
reason: "api_error",
|
|
828
|
+
projectSlug,
|
|
829
|
+
activeStates,
|
|
830
|
+
pickupLabels
|
|
831
|
+
}
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
return passCheck(
|
|
835
|
+
"linear_tracker_resolution",
|
|
836
|
+
"Linear tracker resolution",
|
|
837
|
+
`Resolved Linear project "${project.name}" (${project.slugId}). ${formatLinearConfigSummary(activeStates, pickupLabels)}`,
|
|
838
|
+
{
|
|
839
|
+
projectId: project.id,
|
|
840
|
+
projectSlug: project.slugId,
|
|
841
|
+
activeStates,
|
|
842
|
+
pickupLabels
|
|
843
|
+
}
|
|
844
|
+
);
|
|
845
|
+
} catch (error) {
|
|
846
|
+
return failCheck(
|
|
847
|
+
"linear_tracker_resolution",
|
|
848
|
+
"Linear tracker resolution",
|
|
849
|
+
`Failed to resolve configured Linear project "${projectSlug}".`,
|
|
850
|
+
"Confirm LINEAR_API_KEY, tracker endpoint, project slug, and network access, then re-run 'gh-symphony doctor'.",
|
|
851
|
+
{
|
|
852
|
+
reason: "api_error",
|
|
853
|
+
projectSlug,
|
|
854
|
+
activeStates,
|
|
855
|
+
pickupLabels,
|
|
856
|
+
error: formatSmokeError(error)
|
|
857
|
+
}
|
|
858
|
+
);
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
function readStringSetting(settings, key) {
|
|
862
|
+
const value = settings?.[key];
|
|
863
|
+
return typeof value === "string" ? value : null;
|
|
864
|
+
}
|
|
865
|
+
function readLinearActiveStates(settings) {
|
|
866
|
+
const value = settings?.activeStates;
|
|
867
|
+
if (Array.isArray(value)) {
|
|
868
|
+
return value.filter(
|
|
869
|
+
(state) => typeof state === "string" && state.trim().length > 0
|
|
870
|
+
);
|
|
871
|
+
}
|
|
872
|
+
if (typeof value === "string") {
|
|
873
|
+
return value.split(/\r?\n/).map((state) => state.trim()).filter((state) => state.length > 0);
|
|
874
|
+
}
|
|
875
|
+
return [];
|
|
876
|
+
}
|
|
877
|
+
function readLinearPickupLabels(settings) {
|
|
878
|
+
const value = settings?.pickupLabels;
|
|
879
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
880
|
+
return { include: [], exclude: [] };
|
|
881
|
+
}
|
|
882
|
+
return {
|
|
883
|
+
include: readStringArraySetting(value, "include"),
|
|
884
|
+
exclude: readStringArraySetting(value, "exclude")
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
function readStringArraySetting(value, key) {
|
|
888
|
+
const field = value[key];
|
|
889
|
+
return Array.isArray(field) ? field.filter(
|
|
890
|
+
(item) => typeof item === "string" && item.trim().length > 0
|
|
891
|
+
) : [];
|
|
892
|
+
}
|
|
893
|
+
function formatLinearConfigSummary(activeStates, pickupLabels) {
|
|
894
|
+
const labelSummary = pickupLabels.include.length > 0 || pickupLabels.exclude.length > 0 ? `Pickup labels include=[${pickupLabels.include.join(", ") || "none"}], exclude=[${pickupLabels.exclude.join(", ") || "none"}].` : "Pickup label filtering is not configured.";
|
|
895
|
+
return `Active states: ${activeStates.join(", ")}. ${labelSummary}`;
|
|
896
|
+
}
|
|
897
|
+
async function fetchLinearProjectBySlug(input) {
|
|
898
|
+
const response = await input.fetchImpl(input.endpoint, {
|
|
899
|
+
method: "POST",
|
|
900
|
+
headers: {
|
|
901
|
+
"Content-Type": "application/json",
|
|
902
|
+
Authorization: input.token
|
|
903
|
+
},
|
|
904
|
+
body: JSON.stringify({
|
|
905
|
+
query: `query SymphonyLinearDoctorProject($slug: String!) {
|
|
906
|
+
projects(filter: { slugId: { eq: $slug } }, first: 1) {
|
|
907
|
+
nodes {
|
|
908
|
+
id
|
|
909
|
+
name
|
|
910
|
+
slugId
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}`,
|
|
914
|
+
variables: { slug: input.projectSlug }
|
|
915
|
+
})
|
|
916
|
+
});
|
|
917
|
+
if (!response.ok) {
|
|
918
|
+
throw new Error(`Linear GraphQL request failed with HTTP ${response.status}.`);
|
|
919
|
+
}
|
|
920
|
+
const payload = await response.json();
|
|
921
|
+
if (payload.errors?.length) {
|
|
922
|
+
const message = payload.errors.map((error) => error.message).filter(Boolean).join("; ") || "Unknown Linear GraphQL error";
|
|
923
|
+
throw new Error(`Linear GraphQL request failed: ${message}`);
|
|
924
|
+
}
|
|
925
|
+
const project = payload.data?.projects?.nodes?.[0];
|
|
926
|
+
if (!project || typeof project.id !== "string" || typeof project.name !== "string" || typeof project.slugId !== "string") {
|
|
927
|
+
return null;
|
|
928
|
+
}
|
|
929
|
+
return {
|
|
930
|
+
id: project.id,
|
|
931
|
+
name: project.name,
|
|
932
|
+
slugId: project.slugId
|
|
933
|
+
};
|
|
934
|
+
}
|
|
769
935
|
async function buildPriorityMappingChecks(input) {
|
|
770
936
|
if (input.workflow.status !== "pass") {
|
|
771
937
|
return [];
|
|
@@ -1475,7 +1641,14 @@ ${DOCTOR_USAGE}`);
|
|
|
1475
1641
|
)
|
|
1476
1642
|
);
|
|
1477
1643
|
}
|
|
1478
|
-
if (resolvedProjectConfig.kind === "resolved" &&
|
|
1644
|
+
if (resolvedProjectConfig.kind === "resolved" && resolvedProjectConfig.projectConfig.tracker.adapter === "linear") {
|
|
1645
|
+
checks.push(
|
|
1646
|
+
await checkLinearTrackerResolution({
|
|
1647
|
+
projectConfig: resolvedProjectConfig,
|
|
1648
|
+
deps
|
|
1649
|
+
})
|
|
1650
|
+
);
|
|
1651
|
+
} else if (resolvedProjectConfig.kind === "resolved" && !auth) {
|
|
1479
1652
|
checks.push(
|
|
1480
1653
|
failCheck(
|
|
1481
1654
|
"github_project_resolution",
|
|
@@ -2069,6 +2242,19 @@ async function runDoctorFixes(report, deps, options) {
|
|
|
2069
2242
|
)
|
|
2070
2243
|
);
|
|
2071
2244
|
break;
|
|
2245
|
+
case "linear_tracker_resolution":
|
|
2246
|
+
steps.push(
|
|
2247
|
+
remediationStep(
|
|
2248
|
+
`remediate_${check.id}`,
|
|
2249
|
+
check.id,
|
|
2250
|
+
check.title,
|
|
2251
|
+
"manual",
|
|
2252
|
+
check.remediation ?? "Fix the Linear tracker configuration or credentials.",
|
|
2253
|
+
void 0,
|
|
2254
|
+
check.details
|
|
2255
|
+
)
|
|
2256
|
+
);
|
|
2257
|
+
break;
|
|
2072
2258
|
}
|
|
2073
2259
|
}
|
|
2074
2260
|
return steps;
|
package/dist/index.js
CHANGED
|
@@ -417,13 +417,13 @@ function createRemovedCommandHandler(message) {
|
|
|
417
417
|
|
|
418
418
|
// src/index.ts
|
|
419
419
|
var COMMANDS = {
|
|
420
|
-
workflow: () => import("./workflow-
|
|
421
|
-
setup: () => import("./setup-
|
|
422
|
-
doctor: () => import("./doctor-
|
|
423
|
-
upgrade: () => import("./upgrade-
|
|
420
|
+
workflow: () => import("./workflow-TQ7UZPGP.js"),
|
|
421
|
+
setup: () => import("./setup-DMYXHOCB.js"),
|
|
422
|
+
doctor: () => import("./doctor-Y2AZZKGW.js"),
|
|
423
|
+
upgrade: () => import("./upgrade-FJXX733J.js"),
|
|
424
424
|
repo: () => import("./repo-2NS2AU3D.js"),
|
|
425
425
|
config: () => import("./config-cmd-OIVIUKG7.js"),
|
|
426
|
-
version: () => import("./version-
|
|
426
|
+
version: () => import("./version-FYAZ57WO.js")
|
|
427
427
|
};
|
|
428
428
|
function addGlobalOptions(command) {
|
|
429
429
|
return command.option("--config <dir>", "Config directory").addOption(new Option("--config-dir <dir>").hideHelp()).option("-v, --verbose", "Enable verbose output").option("--json", "Output in JSON format").option("--no-color", "Disable color output");
|
|
@@ -525,7 +525,7 @@ function createProgram() {
|
|
|
525
525
|
);
|
|
526
526
|
});
|
|
527
527
|
addGlobalOptions(
|
|
528
|
-
workflow.command("init").description("Generate WORKFLOW.md and workflow support files").option("--non-interactive", "Run without prompts").option("--project <id>", "GitHub Project ID or URL").option("--output <path>", "Write WORKFLOW.md to a custom path").option(
|
|
528
|
+
workflow.command("init").description("Generate WORKFLOW.md and workflow support files").option("--non-interactive", "Run without prompts").option("--tracker <kind>", "Tracker kind: github-project or linear").option("--project <id>", "GitHub Project ID or URL").option("--linear-project-slug <slug>", "Linear project slug").option("--output <path>", "Write WORKFLOW.md to a custom path").option(
|
|
529
529
|
"--runtime <kind>",
|
|
530
530
|
"Runtime preset: codex-app-server or claude-print"
|
|
531
531
|
).option("--skip-skills", "Skip runtime skill generation").option("--skip-context", "Deprecated no-op").option("--dry-run", "Preview generated files without writing them").allowExcessArguments(false)
|
|
@@ -534,7 +534,9 @@ function createProgram() {
|
|
|
534
534
|
const values = this.optsWithGlobals();
|
|
535
535
|
const args = ["init"];
|
|
536
536
|
pushOption(args, "--non-interactive", values.nonInteractive);
|
|
537
|
+
pushOption(args, "--tracker", values.tracker);
|
|
537
538
|
pushOption(args, "--project", values.project);
|
|
539
|
+
pushOption(args, "--linear-project-slug", values.linearProjectSlug);
|
|
538
540
|
pushOption(args, "--output", values.output);
|
|
539
541
|
pushOption(args, "--runtime", values.runtime);
|
|
540
542
|
pushOption(args, "--skip-skills", values.skipSkills);
|
|
@@ -16,8 +16,8 @@ function execFileAsync(file, args, execFileImpl = execFileCallback) {
|
|
|
16
16
|
});
|
|
17
17
|
}
|
|
18
18
|
function resolveCurrentCliVersion() {
|
|
19
|
-
if ("0.4.
|
|
20
|
-
return "0.4.
|
|
19
|
+
if ("0.4.4".length > 0) {
|
|
20
|
+
return "0.4.4";
|
|
21
21
|
}
|
|
22
22
|
const pkg = JSON.parse(
|
|
23
23
|
readFileSync(new URL("../../package.json", import.meta.url), "utf8")
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
resetWorkflowCommandDependenciesForTest,
|
|
7
7
|
setWorkflowCommandDependenciesForTest,
|
|
8
8
|
workflow_default
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-I3CZXKS5.js";
|
|
10
|
+
import "./chunk-4ZHWEQQL.js";
|
|
11
11
|
import "./chunk-HHBXGE23.js";
|
|
12
12
|
import "./chunk-QBBJMCNC.js";
|
|
13
13
|
import "./chunk-SMNIGNS3.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gh-symphony/cli",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "hojinzs",
|
|
6
6
|
"description": "Interactive CLI for GitHub Symphony orchestration",
|
|
@@ -41,13 +41,13 @@
|
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"tsup": "^8.5.1",
|
|
44
|
-
"@gh-symphony/dashboard": "0.0.14",
|
|
45
44
|
"@gh-symphony/control-plane": "0.0.15",
|
|
46
|
-
"@gh-symphony/
|
|
45
|
+
"@gh-symphony/dashboard": "0.0.14",
|
|
47
46
|
"@gh-symphony/tracker-github": "0.0.14",
|
|
48
|
-
"@gh-symphony/runtime-claude": "0.0.14",
|
|
49
47
|
"@gh-symphony/core": "0.0.14",
|
|
50
|
-
"@gh-symphony/worker": "0.0.14"
|
|
48
|
+
"@gh-symphony/worker": "0.0.14",
|
|
49
|
+
"@gh-symphony/runtime-claude": "0.0.14",
|
|
50
|
+
"@gh-symphony/orchestrator": "0.0.14"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "tsup",
|