@scarn/sdk 0.0.0 → 0.8.1
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-rq3q8vg7.js → chunk-102vfpw4.js} +74 -69
- 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-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/pipelines/nodes.d.ts +1 -0
- 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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// src/scarn-config-parser.ts
|
|
3
3
|
import { access, readFile } from "fs/promises";
|
|
4
4
|
import path from "path";
|
|
5
|
-
var
|
|
5
|
+
var SCARN_CONFIG_RELATIVE_PATH = ".scarn/scarn.jsonc";
|
|
6
6
|
var stripJsoncComments = (content) => {
|
|
7
7
|
let result = "";
|
|
8
8
|
let inString = false;
|
|
@@ -90,12 +90,12 @@ var stripTrailingCommas = (content) => {
|
|
|
90
90
|
if (character === ",") {
|
|
91
91
|
let lookaheadIndex = index + 1;
|
|
92
92
|
while (lookaheadIndex < content.length) {
|
|
93
|
-
const
|
|
94
|
-
if (/\s/u.test(
|
|
93
|
+
const lookaheadCharacter2 = content.charAt(lookaheadIndex);
|
|
94
|
+
if (/\s/u.test(lookaheadCharacter2)) {
|
|
95
95
|
lookaheadIndex += 1;
|
|
96
96
|
continue;
|
|
97
97
|
}
|
|
98
|
-
if (
|
|
98
|
+
if (lookaheadCharacter2 === "}" || lookaheadCharacter2 === "]") {
|
|
99
99
|
break;
|
|
100
100
|
}
|
|
101
101
|
result += character;
|
|
@@ -146,8 +146,8 @@ var parseServices = (raw) => {
|
|
|
146
146
|
};
|
|
147
147
|
});
|
|
148
148
|
};
|
|
149
|
-
async function
|
|
150
|
-
const filePath = path.join(workspacePath,
|
|
149
|
+
async function parseScarnConfig(workspacePath) {
|
|
150
|
+
const filePath = path.join(workspacePath, SCARN_CONFIG_RELATIVE_PATH);
|
|
151
151
|
const exists = await access(filePath).then(() => true).catch(() => false);
|
|
152
152
|
if (!exists) {
|
|
153
153
|
return { found: false };
|
|
@@ -163,4 +163,4 @@ async function parseScarnConfig2(workspacePath) {
|
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
export {
|
|
166
|
+
export { SCARN_CONFIG_RELATIVE_PATH, parseScarnConfig };
|
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
// @bun
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
jsonPointer
|
|
4
|
+
} from "./chunk-p7yrcmqm.js";
|
|
5
|
+
import {
|
|
5
6
|
AuthoringError,
|
|
7
|
+
PipelineBuildError,
|
|
8
|
+
bareStepHandle,
|
|
9
|
+
captureSite,
|
|
10
|
+
chainOf,
|
|
11
|
+
eachOf,
|
|
12
|
+
nodeOf,
|
|
6
13
|
pendingChains,
|
|
14
|
+
registerEach,
|
|
7
15
|
registerNode,
|
|
8
16
|
registerTarget,
|
|
9
|
-
registerEach,
|
|
10
|
-
nodeOf,
|
|
11
|
-
targetOf,
|
|
12
|
-
eachOf,
|
|
13
|
-
chainOf,
|
|
14
17
|
requireNode,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import {
|
|
19
|
-
jsonPointer2
|
|
20
|
-
} from "./chunk-4vehh3dq.js";
|
|
18
|
+
targetOf,
|
|
19
|
+
waitHandle
|
|
20
|
+
} from "./chunk-mz53r914.js";
|
|
21
21
|
import {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
} from "./chunk-
|
|
22
|
+
CONVERSATION_RESULT_SCHEMA,
|
|
23
|
+
ERROR_SCHEMA,
|
|
24
|
+
REPLY_INPUT_SCHEMA,
|
|
25
|
+
REPLY_RESULT_SCHEMA,
|
|
26
|
+
decisionResultSchema
|
|
27
|
+
} from "./chunk-dp86pa6m.js";
|
|
28
28
|
import {
|
|
29
29
|
toJSONSchema
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-skzxcba3.js";
|
|
31
31
|
|
|
32
32
|
// src/pipelines/refs.ts
|
|
33
33
|
var REF = Symbol("scarn.ref");
|
|
@@ -392,17 +392,17 @@ function newState() {
|
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
394
|
function issue(state, site, pointer, message) {
|
|
395
|
-
state.issues.push({ site, pointer:
|
|
395
|
+
state.issues.push({ site, pointer: jsonPointer(pointer), message });
|
|
396
396
|
}
|
|
397
397
|
function mapSource(state, pointer, site) {
|
|
398
|
-
const key =
|
|
398
|
+
const key = jsonPointer(pointer);
|
|
399
399
|
if (site !== null && state.sourceMap[key] === undefined) {
|
|
400
400
|
state.sourceMap[key] = site;
|
|
401
401
|
}
|
|
402
402
|
}
|
|
403
403
|
function attempt(state, pointer, site, run) {
|
|
404
404
|
const previous = state.tracker.pointer;
|
|
405
|
-
setTrackerPointer(
|
|
405
|
+
setTrackerPointer(jsonPointer(pointer));
|
|
406
406
|
try {
|
|
407
407
|
return run();
|
|
408
408
|
} catch (error) {
|
|
@@ -439,7 +439,7 @@ function place(state, def, site, pointer) {
|
|
|
439
439
|
function schemaOf(node, source) {
|
|
440
440
|
if (node.kind === "step") {
|
|
441
441
|
if (source === "result" && node.conversation) {
|
|
442
|
-
return
|
|
442
|
+
return CONVERSATION_RESULT_SCHEMA;
|
|
443
443
|
}
|
|
444
444
|
return (source === "result" ? node.resultSchema : node.inputSchema) ?? undefined;
|
|
445
445
|
}
|
|
@@ -475,7 +475,7 @@ function makeContext(node, kind) {
|
|
|
475
475
|
});
|
|
476
476
|
} else {
|
|
477
477
|
Object.defineProperties(context, {
|
|
478
|
-
error: owned("error",
|
|
478
|
+
error: owned("error", ERROR_SCHEMA),
|
|
479
479
|
input: owned("input", schemaOf(node, "input"))
|
|
480
480
|
});
|
|
481
481
|
}
|
|
@@ -611,8 +611,8 @@ function wireBody(state, chain, json) {
|
|
|
611
611
|
}
|
|
612
612
|
const catches = chain.catch.map((entry, index) => {
|
|
613
613
|
const pointer = ["nodes", id, "catch", index];
|
|
614
|
-
const
|
|
615
|
-
const target = compileTransition(state, entry.target,
|
|
614
|
+
const context2 = makeContext(chain.node, "catch");
|
|
615
|
+
const target = compileTransition(state, entry.target, context2, pointer, entry.site, "catch");
|
|
616
616
|
return { on: [...entry.on], ...target };
|
|
617
617
|
});
|
|
618
618
|
if (catches.length > 0) {
|
|
@@ -627,9 +627,9 @@ function wireBody(state, chain, json) {
|
|
|
627
627
|
mapSource(state, pointer, next.site);
|
|
628
628
|
const entry = {};
|
|
629
629
|
if (when !== undefined) {
|
|
630
|
-
const
|
|
631
|
-
if (
|
|
632
|
-
entry["when"] =
|
|
630
|
+
const compiled2 = attempt(state, [...pointer, "when"], next.site, () => withOwners([context], () => compileCondition(conditionData(when(context)))));
|
|
631
|
+
if (compiled2 !== undefined) {
|
|
632
|
+
entry["when"] = compiled2;
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
const compiled = compileTransition(state, target, context, pointer, next.site, "next");
|
|
@@ -817,7 +817,7 @@ function compile(config, site) {
|
|
|
817
817
|
const fields = workItemFields(state);
|
|
818
818
|
const warnings = unusedChainWarnings(state);
|
|
819
819
|
if (state.issues.length > 0 || start === undefined) {
|
|
820
|
-
throw new
|
|
820
|
+
throw new PipelineBuildError(config.key, state.issues);
|
|
821
821
|
}
|
|
822
822
|
const nodes = {};
|
|
823
823
|
for (const [id, placed] of orderedNodes(state)) {
|
|
@@ -843,14 +843,14 @@ function compile(config, site) {
|
|
|
843
843
|
warnings
|
|
844
844
|
};
|
|
845
845
|
}
|
|
846
|
-
function
|
|
846
|
+
function definePipeline(config) {
|
|
847
847
|
return compile(config, captureSite());
|
|
848
848
|
}
|
|
849
849
|
// src/pipelines/nodes.ts
|
|
850
850
|
function inputSchemaJson(input) {
|
|
851
851
|
return input === undefined ? null : toJSONSchema(input);
|
|
852
852
|
}
|
|
853
|
-
function
|
|
853
|
+
function decision(id, options) {
|
|
854
854
|
const actions = Object.entries(options.actions).map(([key, action]) => ({
|
|
855
855
|
key,
|
|
856
856
|
label: action.label,
|
|
@@ -862,11 +862,11 @@ function decision2(id, options) {
|
|
|
862
862
|
for: "decision",
|
|
863
863
|
actions,
|
|
864
864
|
inputSchema: inputSchemaJson(options.input),
|
|
865
|
-
resultSchema:
|
|
865
|
+
resultSchema: decisionResultSchema(actions),
|
|
866
866
|
site: captureSite()
|
|
867
867
|
});
|
|
868
868
|
}
|
|
869
|
-
function
|
|
869
|
+
function reply(id) {
|
|
870
870
|
return waitHandle({
|
|
871
871
|
kind: "wait",
|
|
872
872
|
id,
|
|
@@ -874,10 +874,10 @@ function reply2(id) {
|
|
|
874
874
|
actions: null,
|
|
875
875
|
inputSchema: {
|
|
876
876
|
type: "object",
|
|
877
|
-
properties: { questions:
|
|
877
|
+
properties: { questions: REPLY_INPUT_SCHEMA },
|
|
878
878
|
required: ["questions"]
|
|
879
879
|
},
|
|
880
|
-
resultSchema:
|
|
880
|
+
resultSchema: REPLY_RESULT_SCHEMA,
|
|
881
881
|
site: captureSite()
|
|
882
882
|
});
|
|
883
883
|
}
|
|
@@ -891,7 +891,7 @@ function terminal(node) {
|
|
|
891
891
|
site: node.site
|
|
892
892
|
});
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function succeed(id, options = {}) {
|
|
895
895
|
return terminal({
|
|
896
896
|
kind: "succeed",
|
|
897
897
|
id,
|
|
@@ -900,7 +900,7 @@ function succeed2(id, options = {}) {
|
|
|
900
900
|
site: captureSite()
|
|
901
901
|
});
|
|
902
902
|
}
|
|
903
|
-
function
|
|
903
|
+
function fail(id, options = {}) {
|
|
904
904
|
return terminal({
|
|
905
905
|
kind: "fail",
|
|
906
906
|
id,
|
|
@@ -911,23 +911,28 @@ function fail2(id, options = {}) {
|
|
|
911
911
|
site: captureSite()
|
|
912
912
|
});
|
|
913
913
|
}
|
|
914
|
-
function
|
|
914
|
+
function stepRef(key) {
|
|
915
915
|
return bareStepHandle({ key, inputSchemaJson: null, resultSchemaJson: null, errors: [] }, false);
|
|
916
916
|
}
|
|
917
|
-
var
|
|
917
|
+
var workItem = {
|
|
918
918
|
get title() {
|
|
919
919
|
return rootPlaceholder("workItem.title", {
|
|
920
920
|
type: "string"
|
|
921
921
|
});
|
|
922
|
+
},
|
|
923
|
+
get description() {
|
|
924
|
+
return rootPlaceholder("workItem.description", {
|
|
925
|
+
type: ["string", "null"]
|
|
926
|
+
});
|
|
922
927
|
}
|
|
923
928
|
};
|
|
924
|
-
function
|
|
929
|
+
function workItemField(alias, label) {
|
|
925
930
|
return rootPlaceholder(`workItem.fields.${alias}`, undefined, {
|
|
926
931
|
field: { alias, label }
|
|
927
932
|
});
|
|
928
933
|
}
|
|
929
934
|
// src/pipelines/each.ts
|
|
930
|
-
function
|
|
935
|
+
function each(over, second, third) {
|
|
931
936
|
const data = refData(over);
|
|
932
937
|
if (data === undefined) {
|
|
933
938
|
throw new AuthoringError("each needs an array reference to iterate over");
|
|
@@ -975,55 +980,55 @@ function compare(op, left, value) {
|
|
|
975
980
|
right: value === NO_RIGHT ? { kind: "none" } : right(value)
|
|
976
981
|
}));
|
|
977
982
|
}
|
|
978
|
-
function
|
|
983
|
+
function equal(left, value) {
|
|
979
984
|
return compare("equal", left, value);
|
|
980
985
|
}
|
|
981
|
-
function
|
|
986
|
+
function notEqual(left, value) {
|
|
982
987
|
return compare("notEqual", left, value);
|
|
983
988
|
}
|
|
984
|
-
function
|
|
989
|
+
function lessThan(left, value) {
|
|
985
990
|
return compare("lessThan", left, value);
|
|
986
991
|
}
|
|
987
|
-
function
|
|
992
|
+
function lessThanInclusive(left, value) {
|
|
988
993
|
return compare("lessThanInclusive", left, value);
|
|
989
994
|
}
|
|
990
|
-
function
|
|
995
|
+
function greaterThan(left, value) {
|
|
991
996
|
return compare("greaterThan", left, value);
|
|
992
997
|
}
|
|
993
|
-
function
|
|
998
|
+
function greaterThanInclusive(left, value) {
|
|
994
999
|
return compare("greaterThanInclusive", left, value);
|
|
995
1000
|
}
|
|
996
|
-
function
|
|
1001
|
+
function exists(left) {
|
|
997
1002
|
return compare("exists", left, NO_RIGHT);
|
|
998
1003
|
}
|
|
999
|
-
function
|
|
1004
|
+
function isEmpty(left) {
|
|
1000
1005
|
return compare("isEmpty", left, NO_RIGHT);
|
|
1001
1006
|
}
|
|
1002
|
-
function
|
|
1007
|
+
function contains(left, value) {
|
|
1003
1008
|
return compare("contains", left, value);
|
|
1004
1009
|
}
|
|
1005
|
-
function
|
|
1010
|
+
function startsWith(left, value) {
|
|
1006
1011
|
return compare("startsWith", left, value);
|
|
1007
1012
|
}
|
|
1008
|
-
function
|
|
1013
|
+
function endsWith(left, value) {
|
|
1009
1014
|
return compare("endsWith", left, value);
|
|
1010
1015
|
}
|
|
1011
|
-
function
|
|
1016
|
+
function matches(left, pattern) {
|
|
1012
1017
|
return compare("matches", left, pattern);
|
|
1013
1018
|
}
|
|
1014
|
-
function
|
|
1019
|
+
function before(left, date) {
|
|
1015
1020
|
return compare("before", left, date);
|
|
1016
1021
|
}
|
|
1017
|
-
function
|
|
1022
|
+
function after(left, date) {
|
|
1018
1023
|
return compare("after", left, date);
|
|
1019
1024
|
}
|
|
1020
|
-
function
|
|
1025
|
+
function all(...conditions) {
|
|
1021
1026
|
return toCondition(new ConditionData({ kind: "all", items: conditions.map(conditionData) }));
|
|
1022
1027
|
}
|
|
1023
|
-
function
|
|
1028
|
+
function any(...conditions) {
|
|
1024
1029
|
return toCondition(new ConditionData({ kind: "any", items: conditions.map(conditionData) }));
|
|
1025
1030
|
}
|
|
1026
|
-
function
|
|
1031
|
+
function not(condition) {
|
|
1027
1032
|
return toCondition(new ConditionData({ kind: "not", item: conditionData(condition) }));
|
|
1028
1033
|
}
|
|
1029
1034
|
function element(list) {
|
|
@@ -1043,13 +1048,13 @@ function list(op, over, where) {
|
|
|
1043
1048
|
where: conditionData(where(item))
|
|
1044
1049
|
}));
|
|
1045
1050
|
}
|
|
1046
|
-
function
|
|
1051
|
+
function some(over, where) {
|
|
1047
1052
|
return list("some", over, where);
|
|
1048
1053
|
}
|
|
1049
|
-
function
|
|
1054
|
+
function every(over, where) {
|
|
1050
1055
|
return list("every", over, where);
|
|
1051
1056
|
}
|
|
1052
|
-
function
|
|
1057
|
+
function none(over, where) {
|
|
1053
1058
|
return list("none", over, where);
|
|
1054
1059
|
}
|
|
1055
1060
|
function reduce(fn, source, field, weights) {
|
|
@@ -1067,19 +1072,19 @@ function reduce(fn, source, field, weights) {
|
|
|
1067
1072
|
field: requireRef(select(field, element(data)), `the field of "${fn}"`)
|
|
1068
1073
|
}));
|
|
1069
1074
|
}
|
|
1070
|
-
function
|
|
1075
|
+
function sum(source, field) {
|
|
1071
1076
|
return reduce("sum", source, field);
|
|
1072
1077
|
}
|
|
1073
|
-
function
|
|
1078
|
+
function avg(source, second) {
|
|
1074
1079
|
return typeof second === "function" ? reduce("avg", source, second) : reduce("avg", source, undefined, second?.weights);
|
|
1075
1080
|
}
|
|
1076
|
-
function
|
|
1081
|
+
function min(source, field) {
|
|
1077
1082
|
return reduce("min", source, field);
|
|
1078
1083
|
}
|
|
1079
|
-
function
|
|
1084
|
+
function max(source, field) {
|
|
1080
1085
|
return reduce("max", source, field);
|
|
1081
1086
|
}
|
|
1082
|
-
function
|
|
1087
|
+
function count(source, where) {
|
|
1083
1088
|
if (Array.isArray(source)) {
|
|
1084
1089
|
const refs = source.map((value) => requireRef(value, 'each value of "count"'));
|
|
1085
1090
|
return toComputed(new ComputedData({ fn: "count", refs }));
|
|
@@ -1091,4 +1096,4 @@ function count2(source, where) {
|
|
|
1091
1096
|
where: conditionData(select(where, element(data)))
|
|
1092
1097
|
}));
|
|
1093
1098
|
}
|
|
1094
|
-
export {
|
|
1099
|
+
export { definePipeline, decision, reply, succeed, fail, stepRef, workItem, workItemField, each, equal, notEqual, lessThan, lessThanInclusive, greaterThan, greaterThanInclusive, exists, isEmpty, contains, startsWith, endsWith, matches, before, after, all, any, not, some, every, none, sum, avg, min, max, count };
|