@scarn/sdk 0.0.0 → 0.8.0
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-4361gxk0.js → chunk-0y2fy5en.js} +7 -7
- package/dist/{chunk-91p9vzcs.js → chunk-3ctaaseb.js} +405 -402
- package/dist/{chunk-9s07v9r1.js → chunk-4ggr8af6.js} +8 -8
- package/dist/chunk-5zsavw98.js +91 -0
- package/dist/chunk-63f90zky.js +39 -0
- package/dist/{chunk-tfm5hjzm.js → chunk-700xe701.js} +9 -9
- package/dist/{chunk-njd6npf0.js → chunk-ar6hcj1r.js} +6 -6
- package/dist/chunk-cdanncng.js +74 -0
- package/dist/chunk-dp86pa6m.js +68 -0
- package/dist/chunk-e1h021kq.js +86 -0
- package/dist/{chunk-ny07ncb9.js → chunk-gds7w7zh.js} +35 -35
- package/dist/chunk-k4y5qt4y.js +14 -0
- package/dist/{chunk-eg1hcvhb.js → chunk-mz53r914.js} +16 -16
- package/dist/{chunk-631ffb6r.js → chunk-ngy1fdcx.js} +10 -10
- package/dist/chunk-p7yrcmqm.js +322 -0
- package/dist/{chunk-h9yxx0hd.js → chunk-rt9tq4j6.js} +7 -7
- package/dist/{chunk-dnn39qt4.js → chunk-skzxcba3.js} +2960 -2217
- package/dist/{chunk-ynk2bjae.js → chunk-vfeytkqx.js} +89 -88
- package/dist/{chunk-56e4kp0a.js → chunk-y2pv8d6a.js} +19 -19
- package/dist/chunk-y64skrwp.js +17 -0
- package/dist/{chunk-rq3q8vg7.js → chunk-yjtaq94c.js} +69 -69
- package/dist/{chunk-qpw5wt1p.js → chunk-zm72ksz0.js} +26 -27
- package/dist/client.js +53 -52
- package/dist/contracts/artifact-markers.js +12 -11
- package/dist/contracts/artifacts.js +23 -21
- package/dist/contracts/pipeline-document/index.js +94 -92
- package/dist/contracts/step-artifact-submissions.js +17 -20
- package/dist/defaults/index.js +140 -139
- package/dist/definitions/pipelines/index.js +22 -20
- package/dist/definitions/steps/index.js +70 -67
- package/dist/definitions/validation/index.js +15 -13
- package/dist/devcontainer-config-path.js +11 -9
- package/dist/env-vars.js +33 -31
- package/dist/eslint.js +2 -0
- package/dist/generated/types.gen.d.ts +7 -0
- package/dist/git-url/git-repo-identity.js +2 -0
- package/dist/health-checks.js +17 -15
- package/dist/index.js +280 -277
- package/dist/jsonc.js +8 -7
- package/dist/managed-runtimes.js +11 -9
- package/dist/opencode-mcp.js +27 -25
- package/dist/pipelines/index.js +78 -75
- package/dist/push/code-step-lookup.js +8 -7
- package/dist/push/index.js +51 -52
- package/dist/repo-config.js +21 -19
- package/dist/scarn-config-parser.js +6 -5
- package/package.json +1 -1
- package/dist/chunk-4vehh3dq.js +0 -333
- package/dist/chunk-5mmj03ah.js +0 -1074
- package/dist/chunk-b21233rt.js +0 -78
- package/dist/chunk-g0rdnn0r.js +0 -95
- package/dist/chunk-p6kc9wq8.js +0 -97
- package/dist/chunk-s0gap8r8.js +0 -14
- package/dist/chunk-zpqyjgb4.js +0 -49
package/dist/chunk-4vehh3dq.js
DELETED
|
@@ -1,333 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
toJSONSchema,
|
|
4
|
-
string,
|
|
5
|
-
number,
|
|
6
|
-
int,
|
|
7
|
-
array,
|
|
8
|
-
strictObject,
|
|
9
|
-
union,
|
|
10
|
-
discriminatedUnion,
|
|
11
|
-
record,
|
|
12
|
-
_enum,
|
|
13
|
-
literal,
|
|
14
|
-
json
|
|
15
|
-
} from "./chunk-dnn39qt4.js";
|
|
16
|
-
|
|
17
|
-
// src/contracts/pipeline-document/json.ts
|
|
18
|
-
function isJsonObject2(value) {
|
|
19
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
|
-
}
|
|
21
|
-
function escapePointerSegment(segment) {
|
|
22
|
-
return String(segment).replaceAll("~", "~0").replaceAll("/", "~1");
|
|
23
|
-
}
|
|
24
|
-
function jsonPointer2(segments) {
|
|
25
|
-
return segments.map((segment) => `/${escapePointerSegment(segment)}`).join("");
|
|
26
|
-
}
|
|
27
|
-
function deepEqual2(left, right) {
|
|
28
|
-
if (left === right) {
|
|
29
|
-
return true;
|
|
30
|
-
}
|
|
31
|
-
if (Array.isArray(left)) {
|
|
32
|
-
return Array.isArray(right) && left.length === right.length && left.every((item, index) => deepEqual2(item, right[index]));
|
|
33
|
-
}
|
|
34
|
-
if (isJsonObject2(left) && isJsonObject2(right)) {
|
|
35
|
-
const leftKeys = Object.keys(left);
|
|
36
|
-
const rightKeys = Object.keys(right);
|
|
37
|
-
return leftKeys.length === rightKeys.length && leftKeys.every((key) => Object.hasOwn(right, key) && deepEqual2(left[key], right[key]));
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
// src/contracts/pipeline-document/conditions/operators.ts
|
|
42
|
-
var COMPARISON_OPERATORS2 = [
|
|
43
|
-
"equal",
|
|
44
|
-
"notEqual",
|
|
45
|
-
"lessThan",
|
|
46
|
-
"lessThanInclusive",
|
|
47
|
-
"greaterThan",
|
|
48
|
-
"greaterThanInclusive"
|
|
49
|
-
];
|
|
50
|
-
var CONDITION_OPERATORS2 = [
|
|
51
|
-
...COMPARISON_OPERATORS2,
|
|
52
|
-
"exists",
|
|
53
|
-
"isEmpty",
|
|
54
|
-
"contains",
|
|
55
|
-
"startsWith",
|
|
56
|
-
"endsWith",
|
|
57
|
-
"matches",
|
|
58
|
-
"before",
|
|
59
|
-
"after",
|
|
60
|
-
"some",
|
|
61
|
-
"every",
|
|
62
|
-
"none"
|
|
63
|
-
];
|
|
64
|
-
var COMPUTED_FUNCTIONS2 = [
|
|
65
|
-
"sum",
|
|
66
|
-
"avg",
|
|
67
|
-
"min",
|
|
68
|
-
"max",
|
|
69
|
-
"count"
|
|
70
|
-
];
|
|
71
|
-
var ORDERING_OPERATORS2 = new Set([
|
|
72
|
-
"lessThan",
|
|
73
|
-
"lessThanInclusive",
|
|
74
|
-
"greaterThan",
|
|
75
|
-
"greaterThanInclusive"
|
|
76
|
-
]);
|
|
77
|
-
var STRING_OPERATORS2 = new Set([
|
|
78
|
-
"startsWith",
|
|
79
|
-
"endsWith",
|
|
80
|
-
"matches"
|
|
81
|
-
]);
|
|
82
|
-
var DATE_OPERATORS2 = new Set(["before", "after"]);
|
|
83
|
-
var LIST_OPERATORS2 = new Set(["some", "every", "none"]);
|
|
84
|
-
|
|
85
|
-
// src/contracts/pipeline-document/schema.ts
|
|
86
|
-
var NODE_ID_PATTERN2 = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
87
|
-
var ALIAS_PATTERN2 = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
88
|
-
var nodeIdSchema = string().regex(NODE_ID_PATTERN2, "Node ids may only contain letters, digits, '_' and '-'");
|
|
89
|
-
var jsonValueSchema = json();
|
|
90
|
-
var literalSchema2 = strictObject({ value: jsonValueSchema });
|
|
91
|
-
var scalarArgSchema = union([string().min(1), literalSchema2]);
|
|
92
|
-
var listSchema2 = strictObject({ list: array(scalarArgSchema) });
|
|
93
|
-
var argValueSchema2 = union([
|
|
94
|
-
string().min(1),
|
|
95
|
-
literalSchema2,
|
|
96
|
-
listSchema2
|
|
97
|
-
]);
|
|
98
|
-
var computedSourceSchema2 = union([
|
|
99
|
-
array(string().min(1)).min(1),
|
|
100
|
-
strictObject({
|
|
101
|
-
path: string().min(1),
|
|
102
|
-
field: string().min(1).optional(),
|
|
103
|
-
get where() {
|
|
104
|
-
return conditionSchema2.optional();
|
|
105
|
-
}
|
|
106
|
-
})
|
|
107
|
-
]);
|
|
108
|
-
var LIST_OPS = new Set(["some", "every", "none"]);
|
|
109
|
-
var UNARY_OPS = new Set(["exists", "isEmpty"]);
|
|
110
|
-
var conditionSchema2 = strictObject({
|
|
111
|
-
get all() {
|
|
112
|
-
return array(conditionSchema2).min(1).optional();
|
|
113
|
-
},
|
|
114
|
-
get any() {
|
|
115
|
-
return array(conditionSchema2).min(1).optional();
|
|
116
|
-
},
|
|
117
|
-
get not() {
|
|
118
|
-
return conditionSchema2.optional();
|
|
119
|
-
},
|
|
120
|
-
path: string().min(1).optional(),
|
|
121
|
-
sum: computedSourceSchema2.optional(),
|
|
122
|
-
avg: computedSourceSchema2.optional(),
|
|
123
|
-
min: computedSourceSchema2.optional(),
|
|
124
|
-
max: computedSourceSchema2.optional(),
|
|
125
|
-
count: computedSourceSchema2.optional(),
|
|
126
|
-
weights: array(number()).min(1).optional(),
|
|
127
|
-
op: _enum(CONDITION_OPERATORS2).optional(),
|
|
128
|
-
value: jsonValueSchema.optional(),
|
|
129
|
-
ref: string().min(1).optional(),
|
|
130
|
-
get where() {
|
|
131
|
-
return conditionSchema2.optional();
|
|
132
|
-
}
|
|
133
|
-
}).superRefine((condition, ctx) => {
|
|
134
|
-
const combinators = ["all", "any", "not"].filter((key) => condition[key] !== undefined);
|
|
135
|
-
const lefts = ["path", ...COMPUTED_FUNCTIONS2].filter((key) => condition[key] !== undefined);
|
|
136
|
-
if (combinators.length > 0) {
|
|
137
|
-
const extras = Object.keys(condition).filter((key) => key !== combinators[0]);
|
|
138
|
-
if (combinators.length > 1 || extras.length > 0) {
|
|
139
|
-
ctx.addIssue({
|
|
140
|
-
code: "custom",
|
|
141
|
-
message: `A condition with "${String(combinators[0])}" can't have other keys (found ${[...combinators.slice(1), ...extras].map((key) => `"${key}"`).join(", ")})`
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
return;
|
|
145
|
-
}
|
|
146
|
-
if (lefts.length !== 1) {
|
|
147
|
-
ctx.addIssue({
|
|
148
|
-
code: "custom",
|
|
149
|
-
message: lefts.length === 0 ? 'A condition needs exactly one of "path", "sum", "avg", "min", "max", "count", or a combinator "all", "any", "not"' : `A condition can have only one of ${lefts.map((key) => `"${key}"`).join(", ")}`
|
|
150
|
-
});
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
if (condition.op === undefined) {
|
|
154
|
-
ctx.addIssue({
|
|
155
|
-
code: "custom",
|
|
156
|
-
message: 'A condition needs "op"',
|
|
157
|
-
path: ["op"]
|
|
158
|
-
});
|
|
159
|
-
return;
|
|
160
|
-
}
|
|
161
|
-
const isList = LIST_OPS.has(condition.op);
|
|
162
|
-
const isUnary = UNARY_OPS.has(condition.op);
|
|
163
|
-
if (isList && condition.where === undefined) {
|
|
164
|
-
ctx.addIssue({
|
|
165
|
-
code: "custom",
|
|
166
|
-
message: `"${condition.op}" needs a "where" condition`,
|
|
167
|
-
path: ["where"]
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
if (!isList && condition.where !== undefined) {
|
|
171
|
-
ctx.addIssue({
|
|
172
|
-
code: "custom",
|
|
173
|
-
message: `"where" is only allowed with "some", "every" or "none", not "${condition.op}"`,
|
|
174
|
-
path: ["where"]
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
const hasValue = condition.value !== undefined;
|
|
178
|
-
const hasRef = condition.ref !== undefined;
|
|
179
|
-
if ((isList || isUnary) && (hasValue || hasRef)) {
|
|
180
|
-
ctx.addIssue({
|
|
181
|
-
code: "custom",
|
|
182
|
-
message: `"${condition.op}" takes no "value" or "ref"`,
|
|
183
|
-
path: [hasValue ? "value" : "ref"]
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
if (!isList && !isUnary && hasValue === hasRef) {
|
|
187
|
-
ctx.addIssue({
|
|
188
|
-
code: "custom",
|
|
189
|
-
message: `"${condition.op}" needs exactly one of "value" or "ref"`
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
if (condition.weights !== undefined && condition.avg === undefined) {
|
|
193
|
-
ctx.addIssue({
|
|
194
|
-
code: "custom",
|
|
195
|
-
message: '"weights" is only allowed with "avg"',
|
|
196
|
-
path: ["weights"]
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
});
|
|
200
|
-
var toleratedFailuresSchema2 = union([
|
|
201
|
-
strictObject({ count: int().nonnegative() }),
|
|
202
|
-
strictObject({ percent: number().min(0).max(100) })
|
|
203
|
-
]);
|
|
204
|
-
var eachSchema2 = strictObject({
|
|
205
|
-
over: string().min(1),
|
|
206
|
-
maxConcurrency: int().positive().optional(),
|
|
207
|
-
toleratedFailures: toleratedFailuresSchema2.optional()
|
|
208
|
-
});
|
|
209
|
-
var routeShape = {
|
|
210
|
-
when: conditionSchema2.optional(),
|
|
211
|
-
to: nodeIdSchema,
|
|
212
|
-
pipeline: string().min(1).optional(),
|
|
213
|
-
args: record(string().min(1), argValueSchema2).optional(),
|
|
214
|
-
each: eachSchema2.optional(),
|
|
215
|
-
partial: literal(true).optional()
|
|
216
|
-
};
|
|
217
|
-
function noPartialWithEach(route, ctx) {
|
|
218
|
-
if (route.each !== undefined && route.partial !== undefined) {
|
|
219
|
-
ctx.addIssue({
|
|
220
|
-
code: "custom",
|
|
221
|
-
message: `A route can't have both "each" and "partial"`,
|
|
222
|
-
path: ["partial"]
|
|
223
|
-
});
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
var routeSchema2 = strictObject(routeShape).superRefine(noPartialWithEach);
|
|
227
|
-
var otherwiseSchema2 = strictObject(routeShape).omit({ when: true }).superRefine(noPartialWithEach);
|
|
228
|
-
var startSchema2 = strictObject(routeShape).omit({ partial: true });
|
|
229
|
-
var MATCH_MODES2 = ["first", "all"];
|
|
230
|
-
var nextSchema2 = strictObject({
|
|
231
|
-
match: _enum(MATCH_MODES2).optional(),
|
|
232
|
-
routes: array(routeSchema2).min(1),
|
|
233
|
-
otherwise: otherwiseSchema2.optional()
|
|
234
|
-
});
|
|
235
|
-
var retrySchema2 = strictObject({
|
|
236
|
-
on: array(string().min(1)).min(1),
|
|
237
|
-
maxAttempts: int().positive(),
|
|
238
|
-
intervalSeconds: number().nonnegative().optional(),
|
|
239
|
-
backoffRate: number().positive().optional(),
|
|
240
|
-
maxDelaySeconds: number().nonnegative().optional()
|
|
241
|
-
});
|
|
242
|
-
var catchSchema2 = strictObject({
|
|
243
|
-
on: array(string().min(1)).min(1),
|
|
244
|
-
to: nodeIdSchema,
|
|
245
|
-
pipeline: string().min(1).optional(),
|
|
246
|
-
args: record(string().min(1), argValueSchema2).optional()
|
|
247
|
-
});
|
|
248
|
-
var stepNodeSchema2 = strictObject({
|
|
249
|
-
kind: literal("step"),
|
|
250
|
-
title: string().optional(),
|
|
251
|
-
step: string().min(1),
|
|
252
|
-
next: nextSchema2.optional(),
|
|
253
|
-
retry: array(retrySchema2).optional(),
|
|
254
|
-
catch: array(catchSchema2).optional(),
|
|
255
|
-
timeoutSeconds: int().positive().optional(),
|
|
256
|
-
heartbeatSeconds: int().positive().optional(),
|
|
257
|
-
maxRuns: int().positive().optional(),
|
|
258
|
-
maxTurns: int().nonnegative().optional()
|
|
259
|
-
});
|
|
260
|
-
var DEFAULT_MAX_TURNS2 = 2;
|
|
261
|
-
var DECISION_BODY_MODES2 = ["optional", "required"];
|
|
262
|
-
var decisionActionSchema2 = strictObject({
|
|
263
|
-
key: string().min(1),
|
|
264
|
-
label: string().min(1),
|
|
265
|
-
body: _enum(DECISION_BODY_MODES2).optional()
|
|
266
|
-
});
|
|
267
|
-
var waitNodeSchema2 = strictObject({
|
|
268
|
-
kind: literal("wait"),
|
|
269
|
-
title: string().optional(),
|
|
270
|
-
for: _enum(["decision", "reply", "event", "timer"]),
|
|
271
|
-
actions: array(decisionActionSchema2).optional(),
|
|
272
|
-
next: nextSchema2.optional(),
|
|
273
|
-
catch: array(catchSchema2).optional(),
|
|
274
|
-
timeoutSeconds: int().positive().optional(),
|
|
275
|
-
maxRuns: int().positive().optional()
|
|
276
|
-
});
|
|
277
|
-
var succeedNodeSchema2 = strictObject({
|
|
278
|
-
kind: literal("succeed"),
|
|
279
|
-
title: string().optional()
|
|
280
|
-
});
|
|
281
|
-
var failNodeSchema2 = strictObject({
|
|
282
|
-
kind: literal("fail"),
|
|
283
|
-
title: string().optional(),
|
|
284
|
-
error: string().min(1).optional(),
|
|
285
|
-
cause: string().optional()
|
|
286
|
-
});
|
|
287
|
-
var nodeSchema2 = discriminatedUnion("kind", [
|
|
288
|
-
stepNodeSchema2,
|
|
289
|
-
waitNodeSchema2,
|
|
290
|
-
succeedNodeSchema2,
|
|
291
|
-
failNodeSchema2
|
|
292
|
-
]);
|
|
293
|
-
var pipelineDocumentSchema2 = strictObject({
|
|
294
|
-
$schema: string().optional(),
|
|
295
|
-
schemaVersion: literal(1),
|
|
296
|
-
key: string().min(1),
|
|
297
|
-
title: string().optional(),
|
|
298
|
-
timeoutSeconds: int().positive().optional(),
|
|
299
|
-
workItemFields: record(string().regex(ALIAS_PATTERN2, "Aliases must be identifiers (letters, digits, '_')"), string().min(1)).optional(),
|
|
300
|
-
start: startSchema2,
|
|
301
|
-
nodes: record(nodeIdSchema, nodeSchema2)
|
|
302
|
-
});
|
|
303
|
-
function pipelineDocumentJsonSchema2() {
|
|
304
|
-
return toJSONSchema(pipelineDocumentSchema2, { io: "input" });
|
|
305
|
-
}
|
|
306
|
-
// src/contracts/pipeline-document/routes.ts
|
|
307
|
-
function routeEntries2(next) {
|
|
308
|
-
if (next === undefined) {
|
|
309
|
-
return [];
|
|
310
|
-
}
|
|
311
|
-
const entries = next.routes.map((route, index) => ({
|
|
312
|
-
kind: "route",
|
|
313
|
-
index,
|
|
314
|
-
route,
|
|
315
|
-
pointer: ["routes", index]
|
|
316
|
-
}));
|
|
317
|
-
if (next.otherwise !== undefined) {
|
|
318
|
-
entries.push({
|
|
319
|
-
kind: "otherwise",
|
|
320
|
-
index: 0,
|
|
321
|
-
route: next.otherwise,
|
|
322
|
-
pointer: ["otherwise"]
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
return entries;
|
|
326
|
-
}
|
|
327
|
-
function routeAt2(next, kind, index) {
|
|
328
|
-
if (next === undefined) {
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
return kind === "otherwise" ? next.otherwise : next.routes[index];
|
|
332
|
-
}
|
|
333
|
-
export { isJsonObject2, jsonPointer2, deepEqual2, COMPARISON_OPERATORS2, CONDITION_OPERATORS2, COMPUTED_FUNCTIONS2, ORDERING_OPERATORS2, STRING_OPERATORS2, DATE_OPERATORS2, LIST_OPERATORS2, NODE_ID_PATTERN2, ALIAS_PATTERN2, literalSchema2, listSchema2, argValueSchema2, computedSourceSchema2, conditionSchema2, toleratedFailuresSchema2, eachSchema2, routeSchema2, otherwiseSchema2, startSchema2, MATCH_MODES2, nextSchema2, retrySchema2, catchSchema2, stepNodeSchema2, DEFAULT_MAX_TURNS2, DECISION_BODY_MODES2, decisionActionSchema2, waitNodeSchema2, succeedNodeSchema2, failNodeSchema2, nodeSchema2, pipelineDocumentSchema2, pipelineDocumentJsonSchema2, routeEntries2, routeAt2 };
|