@scarn/sdk 0.8.21 → 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/index.js +15 -16
- package/dist/automations/index.js +14 -17
- package/dist/{chunk-6p340dd4.js → chunk-0bwsjn0b.js} +29 -29
- package/dist/{chunk-r3sbp2wn.js → chunk-0w13kxkr.js} +34 -31
- package/dist/{chunk-nkm31g10.js → chunk-3j5wf2t5.js} +44 -43
- package/dist/{chunk-0y2fy5en.js → chunk-4361gxk0.js} +7 -7
- package/dist/{chunk-8tmsvkmj.js → chunk-52520csz.js} +13 -12
- package/dist/chunk-5dnfgyx8.js +159 -0
- package/dist/{chunk-k57h6qke.js → chunk-5fa4arn1.js} +12 -8
- package/dist/{chunk-ngy1fdcx.js → chunk-631ffb6r.js} +10 -10
- package/dist/{chunk-01nfqm18.js → chunk-7anj08zc.js} +11 -9
- package/dist/{chunk-p74r4y6j.js → chunk-7dr4kybf.js} +481 -449
- package/dist/chunk-7mhr5aex.js +171 -0
- package/dist/chunk-7rywbqzz.js +27 -0
- package/dist/{chunk-xhpp6qz8.js → chunk-9ct3xypr.js} +2552 -3780
- package/dist/{chunk-azss2d1n.js → chunk-9geh4c3v.js} +153 -155
- package/dist/{chunk-8hsk6f6b.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-59arcerk.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-gasw078g.js → chunk-hma87efq.js} +40 -40
- package/dist/{chunk-5dny5jg1.js → chunk-hpv234hf.js} +11 -11
- package/dist/{chunk-y81cr6tp.js → chunk-k7xnsmp5.js} +158 -87
- package/dist/{chunk-zxzvketc.js → chunk-kbpkpxcn.js} +20 -19
- package/dist/{chunk-6tra3gw8.js → chunk-kjn1knb9.js} +7 -7
- package/dist/{chunk-0he2dx5n.js → chunk-p3s7cjfc.js} +15 -14
- 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-h1v6w1fh.js → chunk-xe2zgyz7.js} +35 -35
- package/dist/chunk-y4dwmhn2.js +14 -0
- package/dist/{chunk-8kzaxz52.js → chunk-yypj3zn0.js} +8 -8
- package/dist/chunk-yzj1mfpr.js +1515 -0
- 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/defaults/index.js +22 -23
- package/dist/definitions/automations/index.js +6 -8
- package/dist/definitions/environments/index.js +37 -38
- package/dist/definitions/pipelines/index.js +12 -14
- 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 +18 -0
- 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 +88 -59
- package/dist/push/push-from-directory.d.ts +3 -0
- 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 +137 -1
- package/package.json +6 -2
- package/dist/chunk-08gcnrzh.js +0 -96
- package/dist/chunk-5say64w8.js +0 -14
- package/dist/chunk-aph2js2v.js +0 -167
- package/dist/chunk-mrzn5tq4.js +0 -107
- package/dist/chunk-pwyj6qf3.js +0 -119
- package/dist/chunk-qt81x1pm.js +0 -275
- package/dist/chunk-vsp708vw.js +0 -167
- package/dist/chunk-y64skrwp.js +0 -17
- package/dist/chunk-y7ac1t9c.js +0 -39
package/dist/chunk-qt81x1pm.js
DELETED
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
exports_external
|
|
4
|
-
} from "./chunk-xhpp6qz8.js";
|
|
5
|
-
|
|
6
|
-
// src/contracts/pipeline-document/conditions/operators.ts
|
|
7
|
-
var COMPARISON_OPERATORS = [
|
|
8
|
-
"equal",
|
|
9
|
-
"notEqual",
|
|
10
|
-
"lessThan",
|
|
11
|
-
"lessThanInclusive",
|
|
12
|
-
"greaterThan",
|
|
13
|
-
"greaterThanInclusive"
|
|
14
|
-
];
|
|
15
|
-
var CONDITION_OPERATORS = [
|
|
16
|
-
...COMPARISON_OPERATORS,
|
|
17
|
-
"exists",
|
|
18
|
-
"isEmpty",
|
|
19
|
-
"contains",
|
|
20
|
-
"startsWith",
|
|
21
|
-
"endsWith",
|
|
22
|
-
"matches",
|
|
23
|
-
"before",
|
|
24
|
-
"after",
|
|
25
|
-
"some",
|
|
26
|
-
"every",
|
|
27
|
-
"none"
|
|
28
|
-
];
|
|
29
|
-
var COMPUTED_FUNCTIONS = [
|
|
30
|
-
"sum",
|
|
31
|
-
"avg",
|
|
32
|
-
"min",
|
|
33
|
-
"max",
|
|
34
|
-
"count"
|
|
35
|
-
];
|
|
36
|
-
var ORDERING_OPERATORS = new Set([
|
|
37
|
-
"lessThan",
|
|
38
|
-
"lessThanInclusive",
|
|
39
|
-
"greaterThan",
|
|
40
|
-
"greaterThanInclusive"
|
|
41
|
-
]);
|
|
42
|
-
var STRING_OPERATORS = new Set([
|
|
43
|
-
"startsWith",
|
|
44
|
-
"endsWith",
|
|
45
|
-
"matches"
|
|
46
|
-
]);
|
|
47
|
-
var DATE_OPERATORS = new Set(["before", "after"]);
|
|
48
|
-
var LIST_OPERATORS = new Set(["some", "every", "none"]);
|
|
49
|
-
|
|
50
|
-
// src/contracts/pipeline-document/schema.ts
|
|
51
|
-
var NODE_ID_PATTERN = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
52
|
-
var ALIAS_PATTERN = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
53
|
-
var nodeIdSchema = exports_external.string().regex(NODE_ID_PATTERN, "Node ids may only contain letters, digits, '_' and '-'");
|
|
54
|
-
var jsonValueSchema = exports_external.json();
|
|
55
|
-
var literalSchema = exports_external.strictObject({ value: jsonValueSchema });
|
|
56
|
-
var scalarArgSchema = exports_external.union([exports_external.string().min(1), literalSchema]);
|
|
57
|
-
var listSchema = exports_external.strictObject({ list: exports_external.array(scalarArgSchema) });
|
|
58
|
-
var argValueSchema = exports_external.union([
|
|
59
|
-
exports_external.string().min(1),
|
|
60
|
-
literalSchema,
|
|
61
|
-
listSchema
|
|
62
|
-
]);
|
|
63
|
-
var computedSourceSchema = exports_external.union([
|
|
64
|
-
exports_external.array(exports_external.string().min(1)).min(1),
|
|
65
|
-
exports_external.strictObject({
|
|
66
|
-
path: exports_external.string().min(1),
|
|
67
|
-
field: exports_external.string().min(1).optional(),
|
|
68
|
-
get where() {
|
|
69
|
-
return conditionSchema.optional();
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
]);
|
|
73
|
-
var LIST_OPS = new Set(["some", "every", "none"]);
|
|
74
|
-
var UNARY_OPS = new Set(["exists", "isEmpty"]);
|
|
75
|
-
var conditionSchema = exports_external.strictObject({
|
|
76
|
-
get all() {
|
|
77
|
-
return exports_external.array(conditionSchema).min(1).optional();
|
|
78
|
-
},
|
|
79
|
-
get any() {
|
|
80
|
-
return exports_external.array(conditionSchema).min(1).optional();
|
|
81
|
-
},
|
|
82
|
-
get not() {
|
|
83
|
-
return conditionSchema.optional();
|
|
84
|
-
},
|
|
85
|
-
path: exports_external.string().min(1).optional(),
|
|
86
|
-
sum: computedSourceSchema.optional(),
|
|
87
|
-
avg: computedSourceSchema.optional(),
|
|
88
|
-
min: computedSourceSchema.optional(),
|
|
89
|
-
max: computedSourceSchema.optional(),
|
|
90
|
-
count: computedSourceSchema.optional(),
|
|
91
|
-
weights: exports_external.array(exports_external.number()).min(1).optional(),
|
|
92
|
-
op: exports_external.enum(CONDITION_OPERATORS).optional(),
|
|
93
|
-
value: jsonValueSchema.optional(),
|
|
94
|
-
ref: exports_external.string().min(1).optional(),
|
|
95
|
-
get where() {
|
|
96
|
-
return conditionSchema.optional();
|
|
97
|
-
}
|
|
98
|
-
}).superRefine((condition, ctx) => {
|
|
99
|
-
const combinators = ["all", "any", "not"].filter((key) => condition[key] !== undefined);
|
|
100
|
-
const lefts = ["path", ...COMPUTED_FUNCTIONS].filter((key) => condition[key] !== undefined);
|
|
101
|
-
if (combinators.length > 0) {
|
|
102
|
-
const extras = Object.keys(condition).filter((key) => key !== combinators[0]);
|
|
103
|
-
if (combinators.length > 1 || extras.length > 0) {
|
|
104
|
-
ctx.addIssue({
|
|
105
|
-
code: "custom",
|
|
106
|
-
message: `A condition with "${String(combinators[0])}" can't have other keys (found ${[...combinators.slice(1), ...extras].map((key) => `"${key}"`).join(", ")})`
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (lefts.length !== 1) {
|
|
112
|
-
ctx.addIssue({
|
|
113
|
-
code: "custom",
|
|
114
|
-
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(", ")}`
|
|
115
|
-
});
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
if (condition.op === undefined) {
|
|
119
|
-
ctx.addIssue({
|
|
120
|
-
code: "custom",
|
|
121
|
-
message: 'A condition needs "op"',
|
|
122
|
-
path: ["op"]
|
|
123
|
-
});
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
const isList = LIST_OPS.has(condition.op);
|
|
127
|
-
const isUnary = UNARY_OPS.has(condition.op);
|
|
128
|
-
if (isList && condition.where === undefined) {
|
|
129
|
-
ctx.addIssue({
|
|
130
|
-
code: "custom",
|
|
131
|
-
message: `"${condition.op}" needs a "where" condition`,
|
|
132
|
-
path: ["where"]
|
|
133
|
-
});
|
|
134
|
-
}
|
|
135
|
-
if (!isList && condition.where !== undefined) {
|
|
136
|
-
ctx.addIssue({
|
|
137
|
-
code: "custom",
|
|
138
|
-
message: `"where" is only allowed with "some", "every" or "none", not "${condition.op}"`,
|
|
139
|
-
path: ["where"]
|
|
140
|
-
});
|
|
141
|
-
}
|
|
142
|
-
const hasValue = condition.value !== undefined;
|
|
143
|
-
const hasRef = condition.ref !== undefined;
|
|
144
|
-
if ((isList || isUnary) && (hasValue || hasRef)) {
|
|
145
|
-
ctx.addIssue({
|
|
146
|
-
code: "custom",
|
|
147
|
-
message: `"${condition.op}" takes no "value" or "ref"`,
|
|
148
|
-
path: [hasValue ? "value" : "ref"]
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
if (!isList && !isUnary && hasValue === hasRef) {
|
|
152
|
-
ctx.addIssue({
|
|
153
|
-
code: "custom",
|
|
154
|
-
message: `"${condition.op}" needs exactly one of "value" or "ref"`
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (condition.weights !== undefined && condition.avg === undefined) {
|
|
158
|
-
ctx.addIssue({
|
|
159
|
-
code: "custom",
|
|
160
|
-
message: '"weights" is only allowed with "avg"',
|
|
161
|
-
path: ["weights"]
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
var toleratedFailuresSchema = exports_external.union([
|
|
166
|
-
exports_external.strictObject({ count: exports_external.int().nonnegative() }),
|
|
167
|
-
exports_external.strictObject({ percent: exports_external.number().min(0).max(100) })
|
|
168
|
-
]);
|
|
169
|
-
var eachSchema = exports_external.strictObject({
|
|
170
|
-
over: exports_external.string().min(1),
|
|
171
|
-
maxConcurrency: exports_external.int().positive().optional(),
|
|
172
|
-
toleratedFailures: toleratedFailuresSchema.optional()
|
|
173
|
-
});
|
|
174
|
-
var routeShape = {
|
|
175
|
-
when: conditionSchema.optional(),
|
|
176
|
-
to: nodeIdSchema,
|
|
177
|
-
pipeline: exports_external.string().min(1).optional(),
|
|
178
|
-
args: exports_external.record(exports_external.string().min(1), argValueSchema).optional(),
|
|
179
|
-
each: eachSchema.optional(),
|
|
180
|
-
partial: exports_external.literal(true).optional(),
|
|
181
|
-
label: exports_external.string().min(1).max(80).optional(),
|
|
182
|
-
overridable: exports_external.literal(true).optional()
|
|
183
|
-
};
|
|
184
|
-
function noPartialWithEach(route, ctx) {
|
|
185
|
-
if (route.each !== undefined && route.partial !== undefined) {
|
|
186
|
-
ctx.addIssue({
|
|
187
|
-
code: "custom",
|
|
188
|
-
message: `A route can't have both "each" and "partial"`,
|
|
189
|
-
path: ["partial"]
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
var routeSchema = exports_external.strictObject(routeShape).superRefine(noPartialWithEach);
|
|
194
|
-
var otherwiseSchema = exports_external.strictObject(routeShape).omit({ when: true }).superRefine(noPartialWithEach);
|
|
195
|
-
var startSchema = exports_external.strictObject(routeShape).omit({ partial: true, label: true, overridable: true });
|
|
196
|
-
var MATCH_MODES = ["first", "all"];
|
|
197
|
-
var nextSchema = exports_external.strictObject({
|
|
198
|
-
match: exports_external.enum(MATCH_MODES).optional(),
|
|
199
|
-
routes: exports_external.array(routeSchema).min(1),
|
|
200
|
-
otherwise: otherwiseSchema.optional(),
|
|
201
|
-
overridable: exports_external.literal(true).optional()
|
|
202
|
-
});
|
|
203
|
-
var retrySchema = exports_external.strictObject({
|
|
204
|
-
on: exports_external.array(exports_external.string().min(1)).min(1),
|
|
205
|
-
maxAttempts: exports_external.int().positive(),
|
|
206
|
-
intervalSeconds: exports_external.number().nonnegative().optional(),
|
|
207
|
-
backoffRate: exports_external.number().positive().optional(),
|
|
208
|
-
maxDelaySeconds: exports_external.number().nonnegative().optional()
|
|
209
|
-
});
|
|
210
|
-
var catchSchema = exports_external.strictObject({
|
|
211
|
-
on: exports_external.array(exports_external.string().min(1)).min(1),
|
|
212
|
-
to: nodeIdSchema,
|
|
213
|
-
pipeline: exports_external.string().min(1).optional(),
|
|
214
|
-
args: exports_external.record(exports_external.string().min(1), argValueSchema).optional()
|
|
215
|
-
});
|
|
216
|
-
var stepNodeSchema = exports_external.strictObject({
|
|
217
|
-
kind: exports_external.literal("step"),
|
|
218
|
-
title: exports_external.string().optional(),
|
|
219
|
-
step: exports_external.string().min(1),
|
|
220
|
-
next: nextSchema.optional(),
|
|
221
|
-
retry: exports_external.array(retrySchema).optional(),
|
|
222
|
-
catch: exports_external.array(catchSchema).optional(),
|
|
223
|
-
timeoutSeconds: exports_external.int().positive().optional(),
|
|
224
|
-
heartbeatSeconds: exports_external.int().positive().optional(),
|
|
225
|
-
maxRuns: exports_external.int().positive().optional(),
|
|
226
|
-
maxTurns: exports_external.int().nonnegative().optional()
|
|
227
|
-
});
|
|
228
|
-
var DEFAULT_MAX_TURNS = 2;
|
|
229
|
-
var DECISION_BODY_MODES = ["optional", "required"];
|
|
230
|
-
var decisionActionSchema = exports_external.strictObject({
|
|
231
|
-
key: exports_external.string().min(1),
|
|
232
|
-
label: exports_external.string().min(1),
|
|
233
|
-
body: exports_external.enum(DECISION_BODY_MODES).optional()
|
|
234
|
-
});
|
|
235
|
-
var waitNodeSchema = exports_external.strictObject({
|
|
236
|
-
kind: exports_external.literal("wait"),
|
|
237
|
-
title: exports_external.string().optional(),
|
|
238
|
-
for: exports_external.enum(["decision", "reply", "event", "timer"]),
|
|
239
|
-
actions: exports_external.array(decisionActionSchema).optional(),
|
|
240
|
-
next: nextSchema.optional(),
|
|
241
|
-
catch: exports_external.array(catchSchema).optional(),
|
|
242
|
-
timeoutSeconds: exports_external.int().positive().optional(),
|
|
243
|
-
maxRuns: exports_external.int().positive().optional()
|
|
244
|
-
});
|
|
245
|
-
var succeedNodeSchema = exports_external.strictObject({
|
|
246
|
-
kind: exports_external.literal("succeed"),
|
|
247
|
-
title: exports_external.string().optional()
|
|
248
|
-
});
|
|
249
|
-
var failNodeSchema = exports_external.strictObject({
|
|
250
|
-
kind: exports_external.literal("fail"),
|
|
251
|
-
title: exports_external.string().optional(),
|
|
252
|
-
error: exports_external.string().min(1).optional(),
|
|
253
|
-
cause: exports_external.string().optional()
|
|
254
|
-
});
|
|
255
|
-
var nodeSchema = exports_external.discriminatedUnion("kind", [
|
|
256
|
-
stepNodeSchema,
|
|
257
|
-
waitNodeSchema,
|
|
258
|
-
succeedNodeSchema,
|
|
259
|
-
failNodeSchema
|
|
260
|
-
]);
|
|
261
|
-
var pipelineDocumentSchema = exports_external.strictObject({
|
|
262
|
-
$schema: exports_external.string().optional(),
|
|
263
|
-
schemaVersion: exports_external.literal(1),
|
|
264
|
-
key: exports_external.string().min(1),
|
|
265
|
-
title: exports_external.string().optional(),
|
|
266
|
-
timeoutSeconds: exports_external.int().positive().optional(),
|
|
267
|
-
workItemFields: exports_external.record(exports_external.string().regex(ALIAS_PATTERN, "Aliases must be identifiers (letters, digits, '_')"), exports_external.string().min(1)).optional(),
|
|
268
|
-
start: startSchema,
|
|
269
|
-
nodes: exports_external.record(nodeIdSchema, nodeSchema)
|
|
270
|
-
});
|
|
271
|
-
function pipelineDocumentJsonSchema() {
|
|
272
|
-
return exports_external.toJSONSchema(pipelineDocumentSchema, { io: "input" });
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
export { COMPARISON_OPERATORS, CONDITION_OPERATORS, COMPUTED_FUNCTIONS, ORDERING_OPERATORS, STRING_OPERATORS, DATE_OPERATORS, LIST_OPERATORS, NODE_ID_PATTERN, ALIAS_PATTERN, literalSchema, listSchema, argValueSchema, computedSourceSchema, conditionSchema, toleratedFailuresSchema, eachSchema, routeSchema, otherwiseSchema, startSchema, MATCH_MODES, nextSchema, retrySchema, catchSchema, stepNodeSchema, DEFAULT_MAX_TURNS, DECISION_BODY_MODES, decisionActionSchema, waitNodeSchema, succeedNodeSchema, failNodeSchema, nodeSchema, pipelineDocumentSchema, pipelineDocumentJsonSchema };
|
package/dist/chunk-vsp708vw.js
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
exports_external
|
|
4
|
-
} from "./chunk-xhpp6qz8.js";
|
|
5
|
-
|
|
6
|
-
// src/repo-config.ts
|
|
7
|
-
var MAX_REPO_COMMIT_MESSAGE_LENGTH = 500;
|
|
8
|
-
var REPO_COMMIT_MESSAGE_TOKEN_ROOTS = [
|
|
9
|
-
"input",
|
|
10
|
-
"result",
|
|
11
|
-
"workItem"
|
|
12
|
-
];
|
|
13
|
-
var REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS = [
|
|
14
|
-
"title",
|
|
15
|
-
"platformKey"
|
|
16
|
-
];
|
|
17
|
-
function commitMessageUsesWorkItem(message) {
|
|
18
|
-
for (const match of message.matchAll(TOKEN_PATTERN)) {
|
|
19
|
-
if ((match[1] ?? "").split(".")[0] === "workItem")
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
var TOKEN_PATTERN = /\{\{([^}]+)\}\}/g;
|
|
25
|
-
function findDisallowedTemplateTokens(template, rules) {
|
|
26
|
-
const disallowed = [];
|
|
27
|
-
for (const match of template.matchAll(TOKEN_PATTERN)) {
|
|
28
|
-
const path = match[1] ?? "";
|
|
29
|
-
const [root = "", ...rest] = path.split(".");
|
|
30
|
-
if (!rules.roots.includes(root)) {
|
|
31
|
-
disallowed.push(root);
|
|
32
|
-
} else if (root === "workItem" && (rest.length !== 1 || !rules.workItemKeys.includes(rest[0] ?? ""))) {
|
|
33
|
-
disallowed.push(path);
|
|
34
|
-
} else if (rules.singleSegmentRoots?.includes(root) && (rest.length !== 1 || rest[0] === "")) {
|
|
35
|
-
disallowed.push(path);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return disallowed;
|
|
39
|
-
}
|
|
40
|
-
function findDisallowedCommitMessageTokenRoots(message) {
|
|
41
|
-
return findDisallowedTemplateTokens(message, {
|
|
42
|
-
roots: REPO_COMMIT_MESSAGE_TOKEN_ROOTS,
|
|
43
|
-
workItemKeys: REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
var MAX_REPO_BASE_BRANCH_LENGTH = 255;
|
|
47
|
-
var REPO_BASE_BRANCH_TOKEN_ROOTS = [
|
|
48
|
-
"input",
|
|
49
|
-
"env",
|
|
50
|
-
"workItem"
|
|
51
|
-
];
|
|
52
|
-
var REPO_BASE_BRANCH_WORK_ITEM_KEYS = [
|
|
53
|
-
"platformKey"
|
|
54
|
-
];
|
|
55
|
-
function findDisallowedBaseBranchTokens(baseBranch) {
|
|
56
|
-
return findDisallowedTemplateTokens(baseBranch, {
|
|
57
|
-
roots: REPO_BASE_BRANCH_TOKEN_ROOTS,
|
|
58
|
-
workItemKeys: REPO_BASE_BRANCH_WORK_ITEM_KEYS,
|
|
59
|
-
singleSegmentRoots: ["env"]
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function findBaseBranchEnvProblems(baseBranch, vars) {
|
|
63
|
-
const problems = [];
|
|
64
|
-
for (const match of baseBranch.matchAll(TOKEN_PATTERN)) {
|
|
65
|
-
const path = (match[1] ?? "").trim();
|
|
66
|
-
const [root, name, ...rest] = path.split(".");
|
|
67
|
-
if (root !== "env" || name === undefined || rest.length > 0)
|
|
68
|
-
continue;
|
|
69
|
-
const entry = vars.find((candidate) => candidate.name === name);
|
|
70
|
-
if (entry === undefined) {
|
|
71
|
-
problems.push({ token: path, reason: "undeclared" });
|
|
72
|
-
} else if (entry.source === "secret" || entry.secret) {
|
|
73
|
-
problems.push({ token: path, reason: "secret" });
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
return problems;
|
|
77
|
-
}
|
|
78
|
-
function describeBaseBranchEnvProblem({
|
|
79
|
-
token,
|
|
80
|
-
reason
|
|
81
|
-
}) {
|
|
82
|
-
return reason === "secret" ? `{{${token}}} names a secret var; branch names end up in logs, git and the UI` : `{{${token}}} names a var the environment does not declare`;
|
|
83
|
-
}
|
|
84
|
-
function isValidGitBranchName(name) {
|
|
85
|
-
if (name === "" || name === "@")
|
|
86
|
-
return false;
|
|
87
|
-
if (name.startsWith("-") || name.startsWith("/"))
|
|
88
|
-
return false;
|
|
89
|
-
if (name.endsWith("/") || name.endsWith("."))
|
|
90
|
-
return false;
|
|
91
|
-
if (name.includes("..") || name.includes("//") || name.includes("@{")) {
|
|
92
|
-
return false;
|
|
93
|
-
}
|
|
94
|
-
if (/[\x00-\x20\x7f~^:?*[\\]/.test(name))
|
|
95
|
-
return false;
|
|
96
|
-
return name.split("/").every((component) => !component.startsWith(".") && !component.endsWith(".lock"));
|
|
97
|
-
}
|
|
98
|
-
function isValidBaseBranchTemplate(template) {
|
|
99
|
-
return isValidGitBranchName(template.replace(TOKEN_PATTERN, "x"));
|
|
100
|
-
}
|
|
101
|
-
var repoBaseBranchSchema = exports_external.string().max(MAX_REPO_BASE_BRANCH_LENGTH).refine((baseBranch) => !/[\r\n]/.test(baseBranch), {
|
|
102
|
-
message: "must be a single line"
|
|
103
|
-
}).refine((baseBranch) => findDisallowedBaseBranchTokens(baseBranch).length === 0, {
|
|
104
|
-
message: "may only use {{input.\u2026}}, {{env.NAME}} and {{workItem.platformKey}} tokens"
|
|
105
|
-
}).refine(isValidBaseBranchTemplate, {
|
|
106
|
-
message: "must be a valid branch name (git check-ref-format --branch)"
|
|
107
|
-
});
|
|
108
|
-
var repoWorkBranchSchema = exports_external.discriminatedUnion("kind", [
|
|
109
|
-
exports_external.object({ kind: exports_external.literal("create") }).strict(),
|
|
110
|
-
exports_external.object({ kind: exports_external.literal("base") }).strict()
|
|
111
|
-
]);
|
|
112
|
-
var repoCommitMessageSchema = exports_external.string().max(MAX_REPO_COMMIT_MESSAGE_LENGTH).refine((message) => !/[\r\n]/.test(message), {
|
|
113
|
-
message: "must be a single line"
|
|
114
|
-
}).refine((message) => findDisallowedCommitMessageTokenRoots(message).length === 0, {
|
|
115
|
-
message: `may only use {{input.\u2026}}, {{result.\u2026}}, {{${REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS.map((key) => `workItem.${key}`).join("}} and {{")}}} tokens`
|
|
116
|
-
});
|
|
117
|
-
var onPushFailureSchema = exports_external.enum(["fail", "warn"]);
|
|
118
|
-
var repoGitCredentialsSchema = exports_external.enum(["auto", "none"]);
|
|
119
|
-
var repoConfigInputSchema = exports_external.discriminatedUnion("mode", [
|
|
120
|
-
exports_external.object({
|
|
121
|
-
mode: exports_external.literal("readOnly"),
|
|
122
|
-
gitCredentials: repoGitCredentialsSchema.optional(),
|
|
123
|
-
baseBranch: repoBaseBranchSchema.nullish()
|
|
124
|
-
}).strict(),
|
|
125
|
-
exports_external.object({
|
|
126
|
-
mode: exports_external.literal("readWrite"),
|
|
127
|
-
message: repoCommitMessageSchema.nullish(),
|
|
128
|
-
onPushFailure: onPushFailureSchema.optional(),
|
|
129
|
-
gitCredentials: repoGitCredentialsSchema.optional(),
|
|
130
|
-
baseBranch: repoBaseBranchSchema.nullish(),
|
|
131
|
-
workBranch: repoWorkBranchSchema.optional()
|
|
132
|
-
}).strict()
|
|
133
|
-
]);
|
|
134
|
-
var repoConfigSchema = exports_external.discriminatedUnion("mode", [
|
|
135
|
-
exports_external.object({
|
|
136
|
-
mode: exports_external.literal("readOnly"),
|
|
137
|
-
gitCredentials: repoGitCredentialsSchema,
|
|
138
|
-
baseBranch: repoBaseBranchSchema.nullable()
|
|
139
|
-
}).strict(),
|
|
140
|
-
exports_external.object({
|
|
141
|
-
mode: exports_external.literal("readWrite"),
|
|
142
|
-
message: repoCommitMessageSchema.nullable(),
|
|
143
|
-
onPushFailure: onPushFailureSchema,
|
|
144
|
-
gitCredentials: repoGitCredentialsSchema,
|
|
145
|
-
baseBranch: repoBaseBranchSchema.nullable(),
|
|
146
|
-
workBranch: repoWorkBranchSchema
|
|
147
|
-
}).strict()
|
|
148
|
-
]);
|
|
149
|
-
function resolveRepoConfig(input) {
|
|
150
|
-
const mode = input?.mode ?? "readWrite";
|
|
151
|
-
const gitCredentials = (input && "gitCredentials" in input ? input.gitCredentials : undefined) ?? "auto";
|
|
152
|
-
const baseBranch = input?.baseBranch ?? null;
|
|
153
|
-
if (mode === "readOnly") {
|
|
154
|
-
return { mode, gitCredentials, baseBranch };
|
|
155
|
-
}
|
|
156
|
-
const readWrite = input?.mode === "readWrite" ? input : undefined;
|
|
157
|
-
return {
|
|
158
|
-
mode,
|
|
159
|
-
message: readWrite?.message ?? null,
|
|
160
|
-
onPushFailure: readWrite?.onPushFailure ?? "fail",
|
|
161
|
-
gitCredentials,
|
|
162
|
-
baseBranch,
|
|
163
|
-
workBranch: readWrite?.workBranch ?? { kind: "create" }
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
export { MAX_REPO_COMMIT_MESSAGE_LENGTH, REPO_COMMIT_MESSAGE_TOKEN_ROOTS, REPO_COMMIT_MESSAGE_WORK_ITEM_KEYS, commitMessageUsesWorkItem, findDisallowedCommitMessageTokenRoots, MAX_REPO_BASE_BRANCH_LENGTH, REPO_BASE_BRANCH_TOKEN_ROOTS, REPO_BASE_BRANCH_WORK_ITEM_KEYS, findDisallowedBaseBranchTokens, findBaseBranchEnvProblems, describeBaseBranchEnvProblem, isValidGitBranchName, isValidBaseBranchTemplate, repoBaseBranchSchema, repoWorkBranchSchema, repoCommitMessageSchema, repoGitCredentialsSchema, repoConfigInputSchema, repoConfigSchema, resolveRepoConfig };
|
package/dist/chunk-y64skrwp.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __returnValue = (v) => v;
|
|
4
|
-
function __exportSetter(name, newValue) {
|
|
5
|
-
this[name] = __returnValue.bind(null, newValue);
|
|
6
|
-
}
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, {
|
|
10
|
-
get: all[name],
|
|
11
|
-
enumerable: true,
|
|
12
|
-
configurable: true,
|
|
13
|
-
set: __exportSetter.bind(all, name)
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export { __export };
|
package/dist/chunk-y7ac1t9c.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
exports_external
|
|
4
|
-
} from "./chunk-xhpp6qz8.js";
|
|
5
|
-
|
|
6
|
-
// src/health-checks.ts
|
|
7
|
-
var healthCheckSeverityValues = ["required", "warn"];
|
|
8
|
-
var healthCheckBaseSchema = exports_external.object({
|
|
9
|
-
name: exports_external.string().trim().min(1).optional(),
|
|
10
|
-
severity: exports_external.enum(healthCheckSeverityValues).default("required"),
|
|
11
|
-
timeoutSeconds: exports_external.number().gt(0).max(3600).default(15),
|
|
12
|
-
serialGroup: exports_external.string().trim().min(1).optional()
|
|
13
|
-
});
|
|
14
|
-
var toolHealthCheckSchema = healthCheckBaseSchema.extend({
|
|
15
|
-
kind: exports_external.literal("tool").default("tool"),
|
|
16
|
-
tool: exports_external.string().trim().min(1),
|
|
17
|
-
mcp: exports_external.string().trim().min(1).optional(),
|
|
18
|
-
args: exports_external.record(exports_external.string(), exports_external.unknown()).optional()
|
|
19
|
-
}).strict();
|
|
20
|
-
var cliHealthCheckSchema = healthCheckBaseSchema.extend({
|
|
21
|
-
kind: exports_external.literal("cli"),
|
|
22
|
-
command: exports_external.array(exports_external.string().min(1)).min(1),
|
|
23
|
-
expectExitCode: exports_external.int().default(0)
|
|
24
|
-
}).strict();
|
|
25
|
-
function injectDefaultKind(value) {
|
|
26
|
-
if (typeof value === "object" && value !== null && !("kind" in value)) {
|
|
27
|
-
return { ...value, kind: "tool" };
|
|
28
|
-
}
|
|
29
|
-
return value;
|
|
30
|
-
}
|
|
31
|
-
var healthCheckSchema = exports_external.preprocess(injectDefaultKind, exports_external.discriminatedUnion("kind", [toolHealthCheckSchema, cliHealthCheckSchema]));
|
|
32
|
-
var healthChecksSchema = exports_external.array(healthCheckSchema);
|
|
33
|
-
var stepToolHealthCheckSchema = toolHealthCheckSchema.omit({ mcp: true }).strict();
|
|
34
|
-
var stepHealthChecksInputSchema = exports_external.array(exports_external.preprocess(injectDefaultKind, exports_external.discriminatedUnion("kind", [
|
|
35
|
-
stepToolHealthCheckSchema,
|
|
36
|
-
cliHealthCheckSchema
|
|
37
|
-
])));
|
|
38
|
-
|
|
39
|
-
export { healthCheckSeverityValues, toolHealthCheckSchema, cliHealthCheckSchema, healthCheckSchema, healthChecksSchema, stepToolHealthCheckSchema, stepHealthChecksInputSchema };
|