@scarn/sdk 0.8.20 → 0.8.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.
- package/dist/auth/api-token-cache.d.ts +24 -0
- package/dist/auth/api-token-source.d.ts +39 -0
- package/dist/auth/authenticated-fetch.d.ts +10 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +19 -0
- package/dist/automations/index.js +14 -17
- package/dist/{chunk-habmdf89.js → chunk-0bwsjn0b.js} +29 -29
- package/dist/{chunk-mzj1j0p5.js → chunk-0w13kxkr.js} +34 -31
- package/dist/{chunk-qgkx89eg.js → chunk-3j5wf2t5.js} +44 -43
- package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
- package/dist/{chunk-n3ywwx7n.js → chunk-52520csz.js} +15 -14
- package/dist/chunk-5dnfgyx8.js +159 -0
- package/dist/{chunk-tr3v83cn.js → chunk-5fa4arn1.js} +18 -11
- package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
- package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
- package/dist/{chunk-yq0sf8sb.js → chunk-7dr4kybf.js} +483 -451
- package/dist/chunk-7mhr5aex.js +171 -0
- package/dist/chunk-7rywbqzz.js +27 -0
- package/dist/{chunk-yf15kdte.js → chunk-9ct3xypr.js} +2636 -3864
- package/dist/chunk-9geh4c3v.js +1034 -0
- package/dist/{chunk-19brnwkp.js → chunk-9qf0eg7m.js} +19 -19
- package/dist/{chunk-y11p1q7r.js → chunk-aqqywy8g.js} +4 -4
- package/dist/chunk-bcvx11fn.js +174 -0
- package/dist/{chunk-z4smq8qd.js → chunk-cyfeaz43.js} +86 -86
- package/dist/chunk-czq37rrt.js +286 -0
- package/dist/chunk-ec5z8bbq.js +126 -0
- package/dist/{chunk-rt9tq4j6.js → chunk-h9yxx0hd.js} +7 -7
- package/dist/{chunk-t1dq2c2s.js → chunk-hma87efq.js} +40 -40
- package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
- package/dist/{chunk-rq5k7m33.js → chunk-k7xnsmp5.js} +182 -97
- package/dist/{chunk-91f5gm5z.js → chunk-kbpkpxcn.js} +22 -21
- package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
- package/dist/{chunk-g4j5cfpc.js → chunk-p3s7cjfc.js} +17 -16
- package/dist/chunk-pq6hrtnb.js +49 -0
- package/dist/{chunk-mp2rqtcj.js → chunk-ptpy7nnm.js} +8 -8
- package/dist/{chunk-xqfj56m9.js → chunk-vn1rfxma.js} +8 -8
- package/dist/chunk-vyv8kvkv.js +113 -0
- package/dist/{chunk-0c60x3v8.js → chunk-xe2zgyz7.js} +35 -35
- package/dist/chunk-y4dwmhn2.js +14 -0
- package/dist/{chunk-098740f7.js → chunk-yypj3zn0.js} +8 -8
- package/dist/chunk-yzj1mfpr.js +1515 -0
- package/dist/client.d.ts +5 -1
- package/dist/client.js +62 -61
- package/dist/connectors/index.js +36 -37
- package/dist/contracts/artifact-markers.js +11 -12
- package/dist/contracts/artifacts.js +21 -23
- package/dist/contracts/automation-document/index.js +28 -30
- package/dist/contracts/pipeline-document/built-ins.d.ts +1 -1
- package/dist/contracts/pipeline-document/index.js +95 -97
- package/dist/contracts/step-artifact-submissions.js +20 -17
- package/dist/contracts/work-item-changes.js +8 -6
- package/dist/create-api-client.d.ts +11 -0
- package/dist/defaults/index.js +44 -884
- package/dist/defaults/load-push-defaults.d.ts +11 -4
- package/dist/defaults/project-ref.d.ts +2 -4
- package/dist/definitions/automations/automations-client.d.ts +2 -1
- package/dist/definitions/automations/index.js +6 -8
- package/dist/definitions/environments/environments-client.d.ts +2 -1
- package/dist/definitions/environments/index.js +37 -38
- package/dist/definitions/pipelines/index.js +12 -14
- package/dist/definitions/pipelines/pipeline-definitions-client.d.ts +2 -1
- package/dist/definitions/steps/define-mcp.d.ts +2 -2
- package/dist/definitions/steps/index.js +93 -95
- package/dist/definitions/steps/mcp-server-config.d.ts +13 -3
- package/dist/definitions/steps/step-definitions-client.d.ts +20 -1
- package/dist/definitions/validation/index.js +17 -18
- package/dist/devcontainer-config-path.js +9 -11
- package/dist/env-vars.js +37 -39
- package/dist/environment.js +41 -42
- package/dist/eslint.js +0 -2
- package/dist/generated/index.d.ts +2 -2
- package/dist/generated/sdk.gen.d.ts +41 -1
- package/dist/generated/types.gen.d.ts +1801 -0
- package/dist/git-url/git-repo-identity.js +0 -2
- package/dist/health-checks.js +15 -17
- package/dist/index.js +364 -358
- package/dist/jsonc.js +7 -8
- package/dist/managed-connections.d.ts +16 -0
- package/dist/managed-connections.js +9 -0
- package/dist/managed-runtimes.js +9 -11
- package/dist/opencode-mcp.d.ts +55 -1
- package/dist/opencode-mcp.js +33 -28
- package/dist/pipelines/index.js +78 -81
- package/dist/push/code-step-lookup.js +9 -10
- package/dist/push/index.d.ts +1 -0
- package/dist/push/index.js +109 -79
- package/dist/push/push-from-directory.d.ts +9 -1
- package/dist/push/pushed-mcp-servers.d.ts +28 -0
- package/dist/repo-config.js +41 -43
- package/dist/resolve-environment.js +14 -15
- package/dist/scarn-config-parser.js +5 -6
- package/dist/task-plane-client.d.ts +143 -1
- package/package.json +11 -3
- package/dist/chunk-46wmsgv7.js +0 -14
- package/dist/chunk-a56zc4s5.js +0 -119
- package/dist/chunk-aemxz9r7.js +0 -107
- package/dist/chunk-b9ja6ss5.js +0 -275
- package/dist/chunk-e0pt5x0e.js +0 -167
- package/dist/chunk-pqtd0hr7.js +0 -96
- package/dist/chunk-rphfy0fj.js +0 -167
- package/dist/chunk-y34zsgsw.js +0 -39
- package/dist/chunk-y64skrwp.js +0 -17
package/dist/push/index.js
CHANGED
|
@@ -1,48 +1,52 @@
|
|
|
1
1
|
// @bun
|
|
2
|
+
import"../chunk-aqqywy8g.js";
|
|
2
3
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
isStepDefinitionSpec2,
|
|
5
|
+
isEnvironmentHandle2,
|
|
6
|
+
stepsInModule2
|
|
7
|
+
} from "../chunk-kjn1knb9.js";
|
|
8
|
+
import"../chunk-k7xnsmp5.js";
|
|
6
9
|
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from "../chunk-
|
|
10
|
+
AutomationsApiError2,
|
|
11
|
+
createAutomationsClient2
|
|
12
|
+
} from "../chunk-p3s7cjfc.js";
|
|
10
13
|
import {
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
PipelineDefinitionsApiError2,
|
|
15
|
+
createPipelineDefinitionsClient2
|
|
16
|
+
} from "../chunk-kbpkpxcn.js";
|
|
13
17
|
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "../chunk-
|
|
18
|
+
EnvironmentsApiError2,
|
|
19
|
+
createEnvironmentsClient2
|
|
20
|
+
} from "../chunk-52520csz.js";
|
|
21
|
+
import"../chunk-9qf0eg7m.js";
|
|
22
|
+
import"../chunk-631ffb6r.js";
|
|
23
|
+
import"../chunk-pq6hrtnb.js";
|
|
24
|
+
import"../chunk-yypj3zn0.js";
|
|
25
|
+
import"../chunk-vyv8kvkv.js";
|
|
26
|
+
import"../chunk-y4dwmhn2.js";
|
|
27
|
+
import"../chunk-7rywbqzz.js";
|
|
28
|
+
import"../chunk-5dnfgyx8.js";
|
|
29
|
+
import"../chunk-3j5wf2t5.js";
|
|
30
|
+
import"../chunk-bcvx11fn.js";
|
|
31
|
+
import"../chunk-hma87efq.js";
|
|
32
|
+
import"../chunk-7mhr5aex.js";
|
|
17
33
|
import {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import"../chunk-y34zsgsw.js";
|
|
23
|
-
import"../chunk-t1dq2c2s.js";
|
|
34
|
+
stepEnvironmentHandle2,
|
|
35
|
+
toStepSpec2,
|
|
36
|
+
createStepDefinitionsClient2
|
|
37
|
+
} from "../chunk-7dr4kybf.js";
|
|
24
38
|
import {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from "../chunk-6tra3gw8.js";
|
|
29
|
-
import"../chunk-xqfj56m9.js";
|
|
30
|
-
import"../chunk-y11p1q7r.js";
|
|
31
|
-
import"../chunk-rphfy0fj.js";
|
|
32
|
-
import"../chunk-e0pt5x0e.js";
|
|
33
|
-
import"../chunk-098740f7.js";
|
|
34
|
-
import"../chunk-46wmsgv7.js";
|
|
35
|
-
import"../chunk-qgkx89eg.js";
|
|
36
|
-
import"../chunk-pqtd0hr7.js";
|
|
37
|
-
import"../chunk-aemxz9r7.js";
|
|
38
|
-
import"../chunk-rq5k7m33.js";
|
|
39
|
-
import"../chunk-ngy1fdcx.js";
|
|
40
|
-
import"../chunk-19brnwkp.js";
|
|
41
|
-
import"../chunk-01nfqm18.js";
|
|
39
|
+
assertValidDefinitionSpecs2
|
|
40
|
+
} from "../chunk-xe2zgyz7.js";
|
|
41
|
+
import"../chunk-vn1rfxma.js";
|
|
42
42
|
import {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
string,
|
|
44
|
+
number,
|
|
45
|
+
unknown,
|
|
46
|
+
object,
|
|
47
|
+
looseObject,
|
|
48
|
+
literal
|
|
49
|
+
} from "../chunk-9ct3xypr.js";
|
|
46
50
|
|
|
47
51
|
// src/push/collect-definitions.ts
|
|
48
52
|
import { readdirSync } from "fs";
|
|
@@ -63,12 +67,12 @@ function createCollectionState() {
|
|
|
63
67
|
function environmentHandlesInModule(mod) {
|
|
64
68
|
const found = new Map;
|
|
65
69
|
for (const [exportName, value] of Object.entries(mod)) {
|
|
66
|
-
if (exportName !== "default" &&
|
|
70
|
+
if (exportName !== "default" && isEnvironmentHandle2(value)) {
|
|
67
71
|
found.set(value, true);
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
|
-
for (const step of
|
|
71
|
-
const handle =
|
|
74
|
+
for (const step of stepsInModule2(mod)) {
|
|
75
|
+
const handle = stepEnvironmentHandle2(step);
|
|
72
76
|
if (handle && !found.has(handle))
|
|
73
77
|
found.set(handle, false);
|
|
74
78
|
}
|
|
@@ -109,11 +113,11 @@ function registerCodeStep(state, spec, sourceFile) {
|
|
|
109
113
|
}
|
|
110
114
|
function resolveCodeStepEntrypoint(spec, absoluteFilePath, absDir) {
|
|
111
115
|
if (spec.kind !== "code")
|
|
112
|
-
return
|
|
116
|
+
return toStepSpec2(spec);
|
|
113
117
|
if (!spec.entrypoint?.fn) {
|
|
114
118
|
throw new Error(`Code step "${spec.key}" (kind: "code") has no entrypoint.fn. ` + `Build it with codeStep({ fn, ... }) from "@scarn/sdk/definitions/steps".`);
|
|
115
119
|
}
|
|
116
|
-
const resolved =
|
|
120
|
+
const resolved = toStepSpec2(spec);
|
|
117
121
|
delete resolved.entrypoint;
|
|
118
122
|
resolved.entrypointJson = {
|
|
119
123
|
sourceFile: join(PIPELINE_BUILDER_DIR, relative(absDir, absoluteFilePath))
|
|
@@ -133,14 +137,14 @@ function fileNameWithoutExtension(file) {
|
|
|
133
137
|
async function collectFile(absoluteFilePath, absDir, state) {
|
|
134
138
|
const mod = await importModule(absoluteFilePath);
|
|
135
139
|
const environmentEntries = environmentEntriesForFile(state, environmentHandlesInModule(mod), relative(absDir, absoluteFilePath));
|
|
136
|
-
for (const step of
|
|
140
|
+
for (const step of stepsInModule2(mod)) {
|
|
137
141
|
registerCodeStep(state, step, absoluteFilePath);
|
|
138
142
|
}
|
|
139
143
|
for (const entry of environmentEntries) {
|
|
140
144
|
state.environments.set(entry.handle.name, entry);
|
|
141
145
|
}
|
|
142
146
|
for (const [exportName, value] of Object.entries(mod)) {
|
|
143
|
-
if (exportName === "default" || !
|
|
147
|
+
if (exportName === "default" || !isStepDefinitionSpec2(value))
|
|
144
148
|
continue;
|
|
145
149
|
const resolved = resolveCodeStepEntrypoint(value, absoluteFilePath, absDir);
|
|
146
150
|
state.stepMap.set(`${resolved.key}@v${String(resolved.version)}`, resolved);
|
|
@@ -196,13 +200,13 @@ var NON_PIPELINE_JSON = new Set([
|
|
|
196
200
|
"jsconfig.json",
|
|
197
201
|
"deno.json"
|
|
198
202
|
]);
|
|
199
|
-
var automationDocumentSchema =
|
|
200
|
-
kind:
|
|
203
|
+
var automationDocumentSchema = looseObject({
|
|
204
|
+
kind: literal("automation")
|
|
201
205
|
});
|
|
202
|
-
var pipelineDocumentSchema =
|
|
203
|
-
var documentHeaderSchema =
|
|
204
|
-
key:
|
|
205
|
-
title:
|
|
206
|
+
var pipelineDocumentSchema = looseObject({ nodes: unknown() });
|
|
207
|
+
var documentHeaderSchema = object({
|
|
208
|
+
key: string().min(1),
|
|
209
|
+
title: string().optional()
|
|
206
210
|
});
|
|
207
211
|
function documentKind(value) {
|
|
208
212
|
if (automationDocumentSchema.safeParse(value).success)
|
|
@@ -255,48 +259,72 @@ function parseJsonFile(path, file) {
|
|
|
255
259
|
throw new Error(`${file} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
256
260
|
}
|
|
257
261
|
}
|
|
262
|
+
// src/push/pushed-mcp-servers.ts
|
|
263
|
+
function pushedMcpServers(steps) {
|
|
264
|
+
return steps.flatMap((step) => Object.entries(step.opencodeMcpJson ?? {}).flatMap(([key, entry]) => {
|
|
265
|
+
if (entry.type === "local" || entry.disabled === true)
|
|
266
|
+
return [];
|
|
267
|
+
const base = {
|
|
268
|
+
step: step.key,
|
|
269
|
+
key,
|
|
270
|
+
connection: entry.auth?.connection ?? null
|
|
271
|
+
};
|
|
272
|
+
if (entry.type === "remote") {
|
|
273
|
+
return [{ ...base, type: "remote", url: entry.url }];
|
|
274
|
+
}
|
|
275
|
+
return [
|
|
276
|
+
{
|
|
277
|
+
...base,
|
|
278
|
+
type: "ref",
|
|
279
|
+
name: entry.name ?? key,
|
|
280
|
+
...entry.disabled === undefined ? {} : { disabled: entry.disabled }
|
|
281
|
+
}
|
|
282
|
+
];
|
|
283
|
+
}));
|
|
284
|
+
}
|
|
285
|
+
|
|
258
286
|
// src/push/push-from-directory.ts
|
|
259
|
-
var latestVersionSchema =
|
|
287
|
+
var latestVersionSchema = object({ version: number() });
|
|
260
288
|
async function pushFromDirectory(dir, opts) {
|
|
261
289
|
const log = opts.log ?? ((msg) => {
|
|
262
290
|
console.warn(msg);
|
|
263
291
|
});
|
|
264
|
-
const
|
|
292
|
+
const clientOptions = { fetch: opts.fetch };
|
|
265
293
|
const { steps, environments } = await collectDefinitionsFromDirectory(dir);
|
|
266
294
|
const built = collectBuiltDocuments(dir);
|
|
267
295
|
const documents = built.filter((file) => file.kind === "pipeline");
|
|
268
296
|
const automations = built.filter((file) => file.kind === "automation").sort((a, b) => Number(a.document["scope"] === "project") - Number(b.document["scope"] === "project"));
|
|
269
297
|
log(`Found ${String(environments.length)} environment(s), ${String(steps.length)} step(s), ${String(documents.length)} pipeline document(s) and ${String(automations.length)} automation document(s).`);
|
|
270
|
-
|
|
271
|
-
const environmentsClient =
|
|
272
|
-
await assertNamedEnvironmentsExist(steps, environments, opts.projectId,
|
|
298
|
+
assertValidDefinitionSpecs2(steps);
|
|
299
|
+
const environmentsClient = createEnvironmentsClient2(opts.baseUrl, clientOptions);
|
|
300
|
+
await assertNamedEnvironmentsExist(steps, environments, opts.projectId, environmentsClient);
|
|
273
301
|
const publishedEnvironments = [];
|
|
274
302
|
const unchangedEnvironments = [];
|
|
275
303
|
for (const environment of environments) {
|
|
276
|
-
const published = await publishEnvironment(environment, opts.projectId,
|
|
304
|
+
const published = await publishEnvironment(environment, opts.projectId, environmentsClient, log);
|
|
277
305
|
(published ? publishedEnvironments : unchangedEnvironments).push(environment.name);
|
|
278
306
|
}
|
|
279
|
-
const stepsClient =
|
|
307
|
+
const stepsClient = createStepDefinitionsClient2(opts.baseUrl, clientOptions);
|
|
280
308
|
for (const spec of steps) {
|
|
281
|
-
await stepsClient.upsertFromSpec(opts.projectId, spec
|
|
309
|
+
await stepsClient.upsertFromSpec(opts.projectId, spec);
|
|
282
310
|
log(`\u2713 step ${spec.key} v${String(spec.version)} \u2192 upserted`);
|
|
283
311
|
}
|
|
284
|
-
const pipelinesClient =
|
|
312
|
+
const pipelinesClient = createPipelineDefinitionsClient2(opts.baseUrl, clientOptions);
|
|
285
313
|
const publishedPipelines = [];
|
|
286
314
|
const unchangedPipelines = [];
|
|
287
315
|
if (documents.length > 0) {
|
|
288
|
-
const serverPipelines = await pipelinesClient.listByProjectId(opts.projectId
|
|
316
|
+
const serverPipelines = await pipelinesClient.listByProjectId(opts.projectId);
|
|
289
317
|
const idByKey = new Map(serverPipelines.map((p) => [p.key, p.id]));
|
|
290
318
|
for (const document of documents) {
|
|
291
|
-
const published = await publishPipelineDocument(document, idByKey.get(document.key), opts.projectId,
|
|
319
|
+
const published = await publishPipelineDocument(document, idByKey.get(document.key), opts.projectId, pipelinesClient, log);
|
|
292
320
|
(published ? publishedPipelines : unchangedPipelines).push(document.key);
|
|
293
321
|
}
|
|
294
322
|
}
|
|
295
|
-
const automationsClient =
|
|
323
|
+
const automationsClient = createAutomationsClient2(opts.baseUrl, clientOptions);
|
|
296
324
|
const publishedAutomations = [];
|
|
297
325
|
const unchangedAutomations = [];
|
|
298
326
|
for (const document of automations) {
|
|
299
|
-
const published = await publishAutomationDocument(document, opts.projectId,
|
|
327
|
+
const published = await publishAutomationDocument(document, opts.projectId, automationsClient, log);
|
|
300
328
|
(published ? publishedAutomations : unchangedAutomations).push(document.key);
|
|
301
329
|
}
|
|
302
330
|
return {
|
|
@@ -306,10 +334,11 @@ async function pushFromDirectory(dir, opts) {
|
|
|
306
334
|
publishedPipelines,
|
|
307
335
|
unchangedPipelines,
|
|
308
336
|
publishedAutomations,
|
|
309
|
-
unchangedAutomations
|
|
337
|
+
unchangedAutomations,
|
|
338
|
+
mcpServers: pushedMcpServers(steps)
|
|
310
339
|
};
|
|
311
340
|
}
|
|
312
|
-
async function assertNamedEnvironmentsExist(steps, environments, projectId,
|
|
341
|
+
async function assertNamedEnvironmentsExist(steps, environments, projectId, environmentsClient) {
|
|
313
342
|
const local = new Set(environments.map((environment) => environment.name));
|
|
314
343
|
const stepsByMissingName = new Map;
|
|
315
344
|
for (const step of steps) {
|
|
@@ -325,7 +354,7 @@ async function assertNamedEnvironmentsExist(steps, environments, projectId, head
|
|
|
325
354
|
}
|
|
326
355
|
if (stepsByMissingName.size === 0)
|
|
327
356
|
return;
|
|
328
|
-
const onServer = new Set((await environmentsClient.listByProjectId(projectId
|
|
357
|
+
const onServer = new Set((await environmentsClient.listByProjectId(projectId)).map((environment) => environment.name));
|
|
329
358
|
const unknown = [...stepsByMissingName].filter(([name]) => !onServer.has(name));
|
|
330
359
|
if (unknown.length === 0)
|
|
331
360
|
return;
|
|
@@ -336,16 +365,14 @@ async function assertNamedEnvironmentsExist(steps, environments, projectId, head
|
|
|
336
365
|
].join(`
|
|
337
366
|
`));
|
|
338
367
|
}
|
|
339
|
-
async function publishEnvironment({ name, content, sourceFile }, projectId,
|
|
368
|
+
async function publishEnvironment({ name, content, sourceFile }, projectId, environmentsClient, log) {
|
|
340
369
|
try {
|
|
341
|
-
const result = await environmentsClient.publish(projectId, name, content
|
|
342
|
-
headers
|
|
343
|
-
});
|
|
370
|
+
const result = await environmentsClient.publish(projectId, name, content);
|
|
344
371
|
const version = String(result.version.version);
|
|
345
372
|
log(result.published ? `\u2713 environment ${name} v${version} \u2192 published (${sourceFile})` : `\u2713 environment ${name} v${version} \u2192 unchanged (${sourceFile})`);
|
|
346
373
|
return result.published;
|
|
347
374
|
} catch (error) {
|
|
348
|
-
if (!(error instanceof
|
|
375
|
+
if (!(error instanceof EnvironmentsApiError2))
|
|
349
376
|
throw error;
|
|
350
377
|
const issues = error.issues.map((issue) => ` ${issue.path || "/"}: ${issue.message}`);
|
|
351
378
|
throw new Error([
|
|
@@ -355,14 +382,19 @@ async function publishEnvironment({ name, content, sourceFile }, projectId, head
|
|
|
355
382
|
`), { cause: error });
|
|
356
383
|
}
|
|
357
384
|
}
|
|
358
|
-
async function publishPipelineDocument({ file, key, title, document }, pipelineDefinitionId, projectId,
|
|
385
|
+
async function publishPipelineDocument({ file, key, title, document }, pipelineDefinitionId, projectId, pipelinesClient, log) {
|
|
359
386
|
try {
|
|
360
387
|
if (pipelineDefinitionId === undefined) {
|
|
361
|
-
await pipelinesClient.create({
|
|
388
|
+
await pipelinesClient.create({
|
|
389
|
+
projectId,
|
|
390
|
+
key,
|
|
391
|
+
name: title ?? key,
|
|
392
|
+
document
|
|
393
|
+
});
|
|
362
394
|
log(`\u2713 pipeline ${key} \u2192 created and published (${file})`);
|
|
363
395
|
return true;
|
|
364
396
|
}
|
|
365
|
-
const result = await pipelinesClient.publishVersion(pipelineDefinitionId, document
|
|
397
|
+
const result = await pipelinesClient.publishVersion(pipelineDefinitionId, document);
|
|
366
398
|
const version = String(result.version.version);
|
|
367
399
|
log(result.published ? `\u2713 pipeline ${key} v${version} \u2192 published (${file})` : `\u2713 pipeline ${key} v${version} \u2192 unchanged (${file})`);
|
|
368
400
|
return result.published;
|
|
@@ -370,11 +402,9 @@ async function publishPipelineDocument({ file, key, title, document }, pipelineD
|
|
|
370
402
|
rethrowPublishError(file, error);
|
|
371
403
|
}
|
|
372
404
|
}
|
|
373
|
-
async function publishAutomationDocument({ file, key, document }, projectId,
|
|
405
|
+
async function publishAutomationDocument({ file, key, document }, projectId, automationsClient, log) {
|
|
374
406
|
try {
|
|
375
|
-
const result = await automationsClient.publish(projectId, key, document
|
|
376
|
-
headers
|
|
377
|
-
});
|
|
407
|
+
const result = await automationsClient.publish(projectId, key, document);
|
|
378
408
|
const latest = latestVersionSchema.safeParse(result.automation.latestVersion);
|
|
379
409
|
const version = latest.success ? ` v${String(latest.data.version)}` : "";
|
|
380
410
|
log(result.published ? `\u2713 automation ${key}${version} \u2192 published (${file})` : `\u2713 automation ${key}${version} \u2192 unchanged (${file})`);
|
|
@@ -384,7 +414,7 @@ async function publishAutomationDocument({ file, key, document }, projectId, hea
|
|
|
384
414
|
}
|
|
385
415
|
}
|
|
386
416
|
function rethrowPublishError(file, error) {
|
|
387
|
-
if (!(error instanceof
|
|
417
|
+
if (!(error instanceof PipelineDefinitionsApiError2) && !(error instanceof AutomationsApiError2)) {
|
|
388
418
|
throw error;
|
|
389
419
|
}
|
|
390
420
|
const issues = error.issues.map((issue) => issue.hint === undefined ? ` ${issue.path || "/"}: ${issue.message}` : ` ${issue.path || "/"}: ${issue.message}. ${issue.hint}`);
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import type { FetchLike } from "../auth";
|
|
2
|
+
import { type PushedMcpServer } from "./pushed-mcp-servers";
|
|
1
3
|
export interface PushFromDirectoryOptions {
|
|
2
4
|
baseUrl: string;
|
|
3
5
|
projectId: string;
|
|
4
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Authenticates every request, e.g. the `fetch` from `loadPushDefaults` or
|
|
8
|
+
* one from `createAuthenticatedFetch`.
|
|
9
|
+
*/
|
|
10
|
+
fetch: FetchLike;
|
|
5
11
|
/** Override the logger; defaults to console.log. */
|
|
6
12
|
log?: (message: string) => void;
|
|
7
13
|
}
|
|
@@ -19,6 +25,8 @@ export interface PushFromDirectoryResult {
|
|
|
19
25
|
publishedAutomations: string[];
|
|
20
26
|
/** Keys of the automations whose document matched their latest version. */
|
|
21
27
|
unchangedAutomations: string[];
|
|
28
|
+
/** Every enabled `ref` and `remote` MCP server of the pushed steps. */
|
|
29
|
+
mcpServers: PushedMcpServer[];
|
|
22
30
|
}
|
|
23
31
|
/**
|
|
24
32
|
* Pushes a pipeline-builder directory to the server, in four passes:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StepDefinitionSpec } from "../definitions/steps";
|
|
2
|
+
import type { ManagedConnectionName } from "../managed-connections";
|
|
3
|
+
type PushedMcpServerBase = {
|
|
4
|
+
/** The step's key. */
|
|
5
|
+
step: string;
|
|
6
|
+
/** The server's key in the step's MCP config. */
|
|
7
|
+
key: string;
|
|
8
|
+
/** The managed connection named by `auth`, or null when it has none. */
|
|
9
|
+
connection: ManagedConnectionName | null;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* An enabled `ref` or `remote` MCP server of a pushed step, for
|
|
13
|
+
* `scarn pipelines push` to check against the project's connections. A
|
|
14
|
+
* remote carries its URL. A ref carries the name it is looked up by in the
|
|
15
|
+
* repository's MCP files, which the push script doesn't read; the CLI does.
|
|
16
|
+
*/
|
|
17
|
+
export type PushedMcpServer = (PushedMcpServerBase & {
|
|
18
|
+
type: "remote";
|
|
19
|
+
url: string;
|
|
20
|
+
}) | (PushedMcpServerBase & {
|
|
21
|
+
type: "ref";
|
|
22
|
+
name: string;
|
|
23
|
+
/** The ref's own `disabled`, which overrides the repository's. */
|
|
24
|
+
disabled?: boolean;
|
|
25
|
+
});
|
|
26
|
+
/** Every enabled `ref` or `remote` MCP server of `steps`, in step order. */
|
|
27
|
+
export declare function pushedMcpServers(steps: readonly StepDefinitionSpec[]): PushedMcpServer[];
|
|
28
|
+
export {};
|
package/dist/repo-config.js
CHANGED
|
@@ -1,47 +1,45 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import"./chunk-yf15kdte.js";
|
|
25
|
-
import"./chunk-y64skrwp.js";
|
|
3
|
+
MAX_REPO_COMMIT_MESSAGE_LENGTH2,
|
|
4
|
+
REPO_COMMIT_MESSAGE_TOKEN_ROOTS2,
|
|
5
|
+
REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS2,
|
|
6
|
+
commitMessageUsesWorkItem2,
|
|
7
|
+
findDisallowedCommitMessageTokenRoots2,
|
|
8
|
+
MAX_REPO_BASE_BRANCH_LENGTH2,
|
|
9
|
+
REPO_BASE_BRANCH_TOKEN_ROOTS2,
|
|
10
|
+
REPO_BASE_BRANCH_WORK_ITEM_KEYS2,
|
|
11
|
+
findDisallowedBaseBranchTokens2,
|
|
12
|
+
findBaseBranchEnvProblems2,
|
|
13
|
+
describeBaseBranchEnvProblem2,
|
|
14
|
+
isValidGitBranchName2,
|
|
15
|
+
isValidBaseBranchTemplate2,
|
|
16
|
+
repoBaseBranchSchema2,
|
|
17
|
+
repoWorkBranchSchema2,
|
|
18
|
+
repoCommitMessageSchema2,
|
|
19
|
+
repoGitCredentialsSchema2,
|
|
20
|
+
repoConfigInputSchema2,
|
|
21
|
+
repoConfigSchema2,
|
|
22
|
+
resolveRepoConfig2
|
|
23
|
+
} from "./chunk-7mhr5aex.js";
|
|
26
24
|
export {
|
|
27
|
-
MAX_REPO_BASE_BRANCH_LENGTH,
|
|
28
|
-
MAX_REPO_COMMIT_MESSAGE_LENGTH,
|
|
29
|
-
REPO_BASE_BRANCH_TOKEN_ROOTS,
|
|
30
|
-
REPO_BASE_BRANCH_WORK_ITEM_KEYS,
|
|
31
|
-
REPO_COMMIT_MESSAGE_TOKEN_ROOTS,
|
|
32
|
-
REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS,
|
|
33
|
-
commitMessageUsesWorkItem,
|
|
34
|
-
describeBaseBranchEnvProblem,
|
|
35
|
-
findBaseBranchEnvProblems,
|
|
36
|
-
findDisallowedBaseBranchTokens,
|
|
37
|
-
findDisallowedCommitMessageTokenRoots,
|
|
38
|
-
isValidBaseBranchTemplate,
|
|
39
|
-
isValidGitBranchName,
|
|
40
|
-
repoBaseBranchSchema,
|
|
41
|
-
repoCommitMessageSchema,
|
|
42
|
-
repoConfigInputSchema,
|
|
43
|
-
repoConfigSchema,
|
|
44
|
-
repoGitCredentialsSchema,
|
|
45
|
-
repoWorkBranchSchema,
|
|
46
|
-
resolveRepoConfig
|
|
25
|
+
MAX_REPO_BASE_BRANCH_LENGTH2 as MAX_REPO_BASE_BRANCH_LENGTH,
|
|
26
|
+
MAX_REPO_COMMIT_MESSAGE_LENGTH2 as MAX_REPO_COMMIT_MESSAGE_LENGTH,
|
|
27
|
+
REPO_BASE_BRANCH_TOKEN_ROOTS2 as REPO_BASE_BRANCH_TOKEN_ROOTS,
|
|
28
|
+
REPO_BASE_BRANCH_WORK_ITEM_KEYS2 as REPO_BASE_BRANCH_WORK_ITEM_KEYS,
|
|
29
|
+
REPO_COMMIT_MESSAGE_TOKEN_ROOTS2 as REPO_COMMIT_MESSAGE_TOKEN_ROOTS,
|
|
30
|
+
REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS2 as REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS,
|
|
31
|
+
commitMessageUsesWorkItem2 as commitMessageUsesWorkItem,
|
|
32
|
+
describeBaseBranchEnvProblem2 as describeBaseBranchEnvProblem,
|
|
33
|
+
findBaseBranchEnvProblems2 as findBaseBranchEnvProblems,
|
|
34
|
+
findDisallowedBaseBranchTokens2 as findDisallowedBaseBranchTokens,
|
|
35
|
+
findDisallowedCommitMessageTokenRoots2 as findDisallowedCommitMessageTokenRoots,
|
|
36
|
+
isValidBaseBranchTemplate2 as isValidBaseBranchTemplate,
|
|
37
|
+
isValidGitBranchName2 as isValidGitBranchName,
|
|
38
|
+
repoBaseBranchSchema2 as repoBaseBranchSchema,
|
|
39
|
+
repoCommitMessageSchema2 as repoCommitMessageSchema,
|
|
40
|
+
repoConfigInputSchema2 as repoConfigInputSchema,
|
|
41
|
+
repoConfigSchema2 as repoConfigSchema,
|
|
42
|
+
repoGitCredentialsSchema2 as repoGitCredentialsSchema,
|
|
43
|
+
repoWorkBranchSchema2 as repoWorkBranchSchema,
|
|
44
|
+
resolveRepoConfig2 as resolveRepoConfig
|
|
47
45
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import"./chunk-
|
|
8
|
-
import"./chunk-
|
|
9
|
-
import"./chunk-
|
|
10
|
-
import"./chunk-
|
|
11
|
-
import"./chunk-
|
|
12
|
-
import"./chunk-
|
|
13
|
-
import"./chunk-
|
|
14
|
-
import"./chunk-y64skrwp.js";
|
|
3
|
+
readEnvironmentDefinition2,
|
|
4
|
+
resolveEnvironment2,
|
|
5
|
+
resolveEnvironmentDefinition2
|
|
6
|
+
} from "./chunk-0w13kxkr.js";
|
|
7
|
+
import"./chunk-bcvx11fn.js";
|
|
8
|
+
import"./chunk-yypj3zn0.js";
|
|
9
|
+
import"./chunk-y4dwmhn2.js";
|
|
10
|
+
import"./chunk-3j5wf2t5.js";
|
|
11
|
+
import"./chunk-5dnfgyx8.js";
|
|
12
|
+
import"./chunk-7rywbqzz.js";
|
|
13
|
+
import"./chunk-vyv8kvkv.js";
|
|
15
14
|
export {
|
|
16
|
-
readEnvironmentDefinition,
|
|
17
|
-
resolveEnvironment,
|
|
18
|
-
resolveEnvironmentDefinition
|
|
15
|
+
readEnvironmentDefinition2 as readEnvironmentDefinition,
|
|
16
|
+
resolveEnvironment2 as resolveEnvironment,
|
|
17
|
+
resolveEnvironmentDefinition2 as resolveEnvironmentDefinition
|
|
19
18
|
};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import"./chunk-y64skrwp.js";
|
|
3
|
+
SCARN_CONFIG_RELATIVE_PATH2,
|
|
4
|
+
parseScarnConfig2
|
|
5
|
+
} from "./chunk-4361gxk0.js";
|
|
7
6
|
export {
|
|
8
|
-
SCARN_CONFIG_RELATIVE_PATH,
|
|
9
|
-
parseScarnConfig
|
|
7
|
+
SCARN_CONFIG_RELATIVE_PATH2 as SCARN_CONFIG_RELATIVE_PATH,
|
|
8
|
+
parseScarnConfig2 as parseScarnConfig
|
|
10
9
|
};
|