@gh-symphony/cli 0.1.3 → 0.1.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-PG332ZS4.js → chunk-DW63WPRE.js} +1 -1
- package/dist/{chunk-PEZUBHWJ.js → chunk-E7OCBNB2.js} +76 -8
- package/dist/{chunk-WCOIVNHH.js → chunk-EWTMSDCE.js} +3154 -224
- package/dist/{chunk-NESHTYXQ.js → chunk-HT3FAJAO.js} +3 -3
- package/dist/{chunk-2YF7PQUC.js → chunk-RHLUIMBN.js} +1 -1
- package/dist/{chunk-HQ7A3C7K.js → chunk-YIARPBOR.js} +1 -1
- package/dist/{doctor-2AXHIEAP.js → doctor-I32MANQ4.js} +4 -4
- package/dist/index.js +6 -6
- package/dist/{repo-SUXYT4OK.js → repo-IH6UWE4H.js} +10 -11
- package/dist/{setup-UBHOMXUG.js → setup-UJC2WYHQ.js} +3 -3
- package/dist/{upgrade-355SQJ5P.js → upgrade-XYHCUGHT.js} +2 -2
- package/dist/{version-4ILSDZQH.js → version-B2AYYGLM.js} +1 -1
- package/dist/worker-entry.js +43 -3
- package/dist/{workflow-S6YSZPQT.js → workflow-WSXHMO5B.js} +4 -4
- package/package.json +5 -5
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
|
+
DEFAULT_LINEAR_GRAPHQL_URL,
|
|
3
4
|
buildAgentInputRequiredReason,
|
|
4
5
|
createGitHubGraphQLMcpServerEntry,
|
|
6
|
+
createLinearGraphQLMcpServerEntry,
|
|
5
7
|
extractEnvForCodex,
|
|
6
8
|
readAgentCredentialCache,
|
|
7
9
|
readEnvFile,
|
|
8
10
|
resolveGitHubGraphQLToken,
|
|
9
11
|
shouldReuseAgentCredentialCache,
|
|
10
12
|
writeAgentCredentialCache
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-EWTMSDCE.js";
|
|
12
14
|
|
|
13
15
|
// ../runtime-codex/src/runtime.ts
|
|
14
16
|
import { spawn } from "child_process";
|
|
@@ -77,6 +79,35 @@ function createGitHubGraphQLToolDefinition(config) {
|
|
|
77
79
|
}
|
|
78
80
|
};
|
|
79
81
|
}
|
|
82
|
+
function createLinearGraphQLToolDefinition(config) {
|
|
83
|
+
const entry = createLinearGraphQLMcpServerEntry(config);
|
|
84
|
+
return {
|
|
85
|
+
name: "linear_graphql",
|
|
86
|
+
description: "Execute a single Linear GraphQL query or mutation for the active Linear issue using runtime-managed auth.",
|
|
87
|
+
command: entry.command,
|
|
88
|
+
args: entry.args,
|
|
89
|
+
env: entry.env,
|
|
90
|
+
inputSchema: {
|
|
91
|
+
type: "object",
|
|
92
|
+
properties: {
|
|
93
|
+
query: {
|
|
94
|
+
type: "string",
|
|
95
|
+
description: "Single GraphQL query or mutation document."
|
|
96
|
+
},
|
|
97
|
+
variables: {
|
|
98
|
+
type: "object",
|
|
99
|
+
description: "Variables for the GraphQL document."
|
|
100
|
+
},
|
|
101
|
+
operationName: {
|
|
102
|
+
type: "string",
|
|
103
|
+
description: "Optional GraphQL operation name."
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
required: ["query"],
|
|
107
|
+
additionalProperties: false
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
80
111
|
function asRecord(value) {
|
|
81
112
|
return value != null && typeof value === "object" ? value : {};
|
|
82
113
|
}
|
|
@@ -272,7 +303,15 @@ function resolvePreparedAgentEnvironment(workingDirectory, env) {
|
|
|
272
303
|
};
|
|
273
304
|
}
|
|
274
305
|
function buildCodexRuntimePlan(config) {
|
|
275
|
-
const
|
|
306
|
+
const githubTool = createGitHubGraphQLToolDefinition(config);
|
|
307
|
+
const tools = [
|
|
308
|
+
githubTool,
|
|
309
|
+
...config.enableLinearGraphqlTool ? [
|
|
310
|
+
createLinearGraphQLToolDefinition({
|
|
311
|
+
linearGraphqlUrl: config.linearGraphqlUrl ?? DEFAULT_LINEAR_GRAPHQL_URL
|
|
312
|
+
})
|
|
313
|
+
] : []
|
|
314
|
+
];
|
|
276
315
|
const gitCredentialHelper = createGitCredentialHelperEnvironment(config);
|
|
277
316
|
const shellCmd = (() => {
|
|
278
317
|
const cmd = config.agentCommand ?? "codex app-server";
|
|
@@ -282,6 +321,21 @@ function buildCodexRuntimePlan(config) {
|
|
|
282
321
|
config.workingDirectory,
|
|
283
322
|
config.agentEnv
|
|
284
323
|
);
|
|
324
|
+
const linearGraphqlEnv = config.enableLinearGraphqlTool ? {
|
|
325
|
+
LINEAR_GRAPHQL_TOOL_NAME: "linear_graphql",
|
|
326
|
+
LINEAR_GRAPHQL_URL: config.linearGraphqlUrl ?? DEFAULT_LINEAR_GRAPHQL_URL,
|
|
327
|
+
...config.linearAuthorization ? {
|
|
328
|
+
LINEAR_AUTHORIZATION: config.linearAuthorization
|
|
329
|
+
} : {},
|
|
330
|
+
...config.linearApiKey ? {
|
|
331
|
+
LINEAR_API_KEY: config.linearApiKey
|
|
332
|
+
} : {}
|
|
333
|
+
} : {
|
|
334
|
+
LINEAR_GRAPHQL_TOOL_NAME: "",
|
|
335
|
+
LINEAR_GRAPHQL_URL: void 0,
|
|
336
|
+
LINEAR_API_KEY: void 0,
|
|
337
|
+
LINEAR_AUTHORIZATION: void 0
|
|
338
|
+
};
|
|
285
339
|
return {
|
|
286
340
|
cwd: config.workingDirectory,
|
|
287
341
|
command: "bash",
|
|
@@ -292,13 +346,17 @@ function buildCodexRuntimePlan(config) {
|
|
|
292
346
|
...config.agentEnv,
|
|
293
347
|
CODEX_PROJECT_ID: config.projectId,
|
|
294
348
|
GITHUB_PROJECT_ID: config.githubProjectId ?? "",
|
|
295
|
-
GITHUB_GRAPHQL_TOOL_NAME:
|
|
296
|
-
GITHUB_GRAPHQL_TOOL_COMMAND: [
|
|
349
|
+
GITHUB_GRAPHQL_TOOL_NAME: githubTool.name,
|
|
350
|
+
GITHUB_GRAPHQL_TOOL_COMMAND: [
|
|
351
|
+
githubTool.command,
|
|
352
|
+
...githubTool.args
|
|
353
|
+
].join(" "),
|
|
354
|
+
...linearGraphqlEnv,
|
|
297
355
|
...agentEnv,
|
|
298
356
|
...gitCredentialHelper,
|
|
299
|
-
...tool.env
|
|
357
|
+
...Object.assign({}, ...tools.map((tool) => tool.env))
|
|
300
358
|
},
|
|
301
|
-
tools
|
|
359
|
+
tools
|
|
302
360
|
};
|
|
303
361
|
}
|
|
304
362
|
function launchCodexAppServer(plan, spawnImpl = spawn) {
|
|
@@ -426,7 +484,10 @@ async function resolveAgentRuntimeEnvironment(config, dependencies = {}, adapter
|
|
|
426
484
|
}
|
|
427
485
|
const now = dependencies.now ?? /* @__PURE__ */ new Date();
|
|
428
486
|
const readFileImpl = dependencies.readFileImpl ?? readFile;
|
|
429
|
-
const cachedCredentials = config.agentCredentialCachePath ? await readAgentCredentialCache(
|
|
487
|
+
const cachedCredentials = config.agentCredentialCachePath ? await readAgentCredentialCache(
|
|
488
|
+
config.agentCredentialCachePath,
|
|
489
|
+
readFileImpl
|
|
490
|
+
) : null;
|
|
430
491
|
if (cachedCredentials && shouldReuseAgentCredentialCache(cachedCredentials, now)) {
|
|
431
492
|
return resolveRuntimeCredentials(config, cachedCredentials, adapter);
|
|
432
493
|
}
|
|
@@ -460,7 +521,10 @@ async function resolveAgentRuntimeEnvironment(config, dependencies = {}, adapter
|
|
|
460
521
|
return resolvedEnv;
|
|
461
522
|
}
|
|
462
523
|
function resolveRuntimeCredentials(config, brokerResponse, adapter) {
|
|
463
|
-
return adapter ? adapter.resolveCredentials(brokerResponse) : resolvePreparedAgentEnvironment(
|
|
524
|
+
return adapter ? adapter.resolveCredentials(brokerResponse) : resolvePreparedAgentEnvironment(
|
|
525
|
+
config.workingDirectory,
|
|
526
|
+
brokerResponse.env
|
|
527
|
+
);
|
|
464
528
|
}
|
|
465
529
|
async function stageCodexHome(config, dependencies = {}) {
|
|
466
530
|
const codexHomeDir = resolveStagedCodexHome(config.workingDirectory);
|
|
@@ -524,6 +588,10 @@ function resolveLocalRuntimeLaunchConfig(env = process.env) {
|
|
|
524
588
|
agentCredentialCachePath: env.AGENT_CREDENTIAL_CACHE_PATH,
|
|
525
589
|
githubProjectId: env.GITHUB_PROJECT_ID,
|
|
526
590
|
githubGraphqlApiUrl: env.GITHUB_GRAPHQL_API_URL,
|
|
591
|
+
enableLinearGraphqlTool: env.SYMPHONY_TRACKER_KIND === "linear",
|
|
592
|
+
linearApiKey: env.LINEAR_API_KEY,
|
|
593
|
+
linearAuthorization: env.LINEAR_AUTHORIZATION,
|
|
594
|
+
linearGraphqlUrl: env.LINEAR_GRAPHQL_URL,
|
|
527
595
|
agentCommand: env.SYMPHONY_AGENT_COMMAND
|
|
528
596
|
};
|
|
529
597
|
}
|