@r_masseater/fu4 0.3.9 → 0.4.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/presets.mjs CHANGED
@@ -1,4 +1,6 @@
1
- import { a as afterPrefix, c as defineRule, i as INPUT_KINDS, o as baseName, s as definePlugin, t as lineStartsOf } from "./source-CLFOyvUG.mjs";
1
+ import { n as defineRule, t as definePlugin } from "./define-Dvnt_9zv.mjs";
2
+ import { a as afterPrefix, i as INPUT_KINDS, o as baseName, t as lineStartsOf } from "./source-Cnghop8O.mjs";
3
+ import { C as sortedQuotes, S as quotes, T as parseGoFloat, _ as valueAt, a as ancestorsBy, b as quote, c as actionOf, d as isNull, f as isQuoted$1, h as readYaml, i as workflowOf, l as runOf, m as pairsOf, n as eachEvent, o as containsExpression, p as keysOf, r as workflowRule, s as isExpressionAssigned, t as NOOP, u as describePosition, v as codePoints, w as atoi, x as quoteChar, y as ordinal } from "./workflow-rule-C1TJLS9H.mjs";
2
4
  import { Array as Array$1, Boolean as Boolean$1, Cache, Config, DateTime, Deferred, Effect, Equal, FileSystem, Function, Layer, ManagedRuntime, Match, Option, Order, Path, Predicate, Record, Redacted, Result, Schema, String as String$1, identity, pipe } from "effect";
3
5
  import { layer } from "@effect/platform-node/NodeServices";
4
6
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
@@ -7,7 +9,7 @@ const taggedError$1 = Schema.TaggedError;
7
9
  var GitHubError = class extends taggedError$1()("GitHubError", { message: Schema.String }) {};
8
10
  // src/app/presets/shared/git-protocol/pkt-line.ts
9
11
  const PREFIX$1 = 4;
10
- const HEX$4 = 16;
12
+ const HEX$3 = 16;
11
13
  const FLUSH = 0;
12
14
  const DELIM = 1;
13
15
  const SMALLEST_DATA = 5;
@@ -16,7 +18,7 @@ const ERROR = "ERR ";
16
18
  const LENGTH = /^[0-9a-f]{4}$/iu;
17
19
  const encoder$2 = new TextEncoder();
18
20
  const decoder$1 = new TextDecoder();
19
- const hexLength = (length) => String$1.padStart(PREFIX$1, "0")(length.toString(HEX$4));
21
+ const hexLength = (length) => String$1.padStart(PREFIX$1, "0")(length.toString(HEX$3));
20
22
  const encodeOne = Match.type().pipe(Match.discriminatorsExhaustive("type")({
21
23
  data: ({ data }) => `${hexLength(encoder$2.encode(data).length + PREFIX$1)}${data}`,
22
24
  flush: () => "0000",
@@ -26,7 +28,7 @@ const encodePackets = (packets) => encoder$2.encode(pipe(packets, Array$1.map(en
26
28
  const lengthAt = (bytes) => (position) => {
27
29
  const text = decoder$1.decode(bytes.subarray(position, position + PREFIX$1));
28
30
  if (!LENGTH.test(text)) return Result.fail(`invalid packet line length: ${text}`);
29
- return Result.succeed(Number.parseInt(text, HEX$4));
31
+ return Result.succeed(Number.parseInt(text, HEX$3));
30
32
  };
31
33
  const dataAt = (bytes, position) => (length) => {
32
34
  const end = position + length;
@@ -145,7 +147,7 @@ const refsOf = (refs) => ({
145
147
  branches: named$1(HEADS)(refs),
146
148
  tags: tagsOf(refs)
147
149
  });
148
- const parsed$3 = (url) => (reply) => {
150
+ const parsed$2 = (url) => (reply) => {
149
151
  if (reply.status === 404) return Effect.succeedNone;
150
152
  if (!isOk(reply)) return Effect.fail(unexpected$3(url)(reply));
151
153
  return Result.match(parseLsRefs(reply.bytes), {
@@ -170,7 +172,7 @@ const upload = (session, url) => (headers) => session.transport({
170
172
  const listRefs = (session) => (slug) => {
171
173
  const url = `${session.endpoints.web}/${slug}.git/git-upload-pack`;
172
174
  const send = upload(session, url);
173
- return send({ Authorization: basic(session.token) }).pipe(Effect.filterOrElse((reply) => reply.status !== UNAUTHORIZED, () => send({})), Effect.flatMap(parsed$3(url)));
175
+ return send({ Authorization: basic(session.token) }).pipe(Effect.filterOrElse((reply) => reply.status !== UNAUTHORIZED, () => send({})), Effect.flatMap(parsed$2(url)));
174
176
  };
175
177
  // src/app/presets/features/audit-workflows/api/client.ts
176
178
  const CAPACITY = Number.MAX_SAFE_INTEGER;
@@ -350,7 +352,7 @@ const started = Effect.fn("fu4.github.start")(function* started(host, root, toke
350
352
  });
351
353
  const startClient = ({ host, root, token }) => platform.contextEffect.pipe(Effect.flatMap((context) => Effect.provideContext(started(host, root, token), context)));
352
354
  // src/app/presets/features/audit-workflows/api/session.ts
353
- const SEPARATOR$2 = "\0";
355
+ const SEPARATOR$1 = "\0";
354
356
  const TOKEN = Config.Redacted("ZIZMOR_GITHUB_TOKEN").pipe(Config.orElse(() => Config.Redacted("GH_TOKEN")), Config.orElse(() => Config.Redacted("GITHUB_TOKEN")), Config.option);
355
357
  const clients = /* @__PURE__ */ new Map();
356
358
  const fresh = (key, start) => {
@@ -363,7 +365,7 @@ const clientFor = (host, root) => (token) => {
363
365
  root,
364
366
  host,
365
367
  Redacted.value(token)
366
- ], Array$1.join(SEPARATOR$2));
368
+ ], Array$1.join(SEPARATOR$1));
367
369
  return Option.match(Option.fromNullishOr(clients.get(key)), {
368
370
  onSome: Deferred.await,
369
371
  onNone: () => fresh(key, startClient({
@@ -388,106 +390,6 @@ const characterColumnOf = (text) => (offset) => {
388
390
  });
389
391
  return Array$1.fromIterable(String$1.slice(lineStart)(before)).length;
390
392
  };
391
- // src/app/presets/shared/text/number.ts
392
- const ZERO$3 = 0;
393
- const EXPONENT_ABOVE = 1e21;
394
- const EXPONENT_BELOW = 1e-4;
395
- const SIGNS = /^[+-]*/u;
396
- const FLOAT_CHARS = /^[\d.eE+-]+$/u;
397
- const INFINITE = /* @__PURE__ */ new Set(["inf", "infinity"]);
398
- const DIGITS$4 = /^[+-]?\d+$/u;
399
- const MAX_SIGNS = 1;
400
- const INT64_MIN = BigInt("-9223372036854775808");
401
- const INT64_MAX = 9223372036854775807n;
402
- const nonFinite = (value) => {
403
- if (Number.isNaN(value)) return "NaN";
404
- if (value < ZERO$3) return "-inf";
405
- return "inf";
406
- };
407
- const goFloat = (value) => {
408
- if (!Number.isFinite(value)) return nonFinite(value);
409
- if (Number.isInteger(value) && Math.abs(value) < EXPONENT_ABOVE) return value.toFixed(ZERO$3);
410
- if (Math.abs(value) >= EXPONENT_ABOVE || value !== ZERO$3 && Math.abs(value) < EXPONENT_BELOW) return value.toExponential();
411
- return String(value);
412
- };
413
- const infinite = (text) => {
414
- if (String$1.startsWith("-")(text)) return Number.NEGATIVE_INFINITY;
415
- return Number.POSITIVE_INFINITY;
416
- };
417
- const special = (text) => {
418
- const lower = pipe(text, String$1.replace(SIGNS, ""), String$1.toLowerCase);
419
- if (INFINITE.has(lower)) return Option.some(infinite(text));
420
- if (lower === "nan") return Option.some(NaN);
421
- return Option.none();
422
- };
423
- const plainFloat = (text) => {
424
- const body = String$1.replace(SIGNS, "")(text);
425
- const hex = pipe(body, String$1.toLowerCase, String$1.startsWith("0x"));
426
- if (text.length - body.length > MAX_SIGNS || String$1.includes("_")(text) || hex || !FLOAT_CHARS.test(body)) return Option.none();
427
- return Option.liftPredicate(Number(text), (value) => !Number.isNaN(value));
428
- };
429
- const parseGoFloat = (text) => Option.orElse(special(text), () => plainFloat(text));
430
- const atoi = (text) => {
431
- if (!DIGITS$4.test(text)) return "invalid syntax";
432
- const value = BigInt(text);
433
- if (value < INT64_MIN || value > INT64_MAX) return "value out of range";
434
- return Number(value);
435
- };
436
- // src/app/presets/shared/text/quote.ts
437
- const ESCAPES$2 = {
438
- "\x07": String.raw`\a`,
439
- "\b": String.raw`\b`,
440
- "\f": String.raw`\f`,
441
- "\n": String.raw`\n`,
442
- "\r": String.raw`\r`,
443
- " ": String.raw`\t`,
444
- "\v": String.raw`\v`,
445
- "\\": String.raw`\\`
446
- };
447
- const ASCII_END = 128;
448
- const BMP_END = 65536;
449
- const BYTE_DIGITS = 2;
450
- const SHORT_DIGITS = 4;
451
- const LONG_DIGITS = 8;
452
- const HEX$3 = 16;
453
- const FIRST$8 = 0;
454
- const UNPRINTABLE = /[\p{Cc}\p{Z}\uFEFF\uFFF9-\uFFFB\uE000-\uF8FF\u2028\u2029]/u;
455
- const SPACE = " ";
456
- const SEPARATOR$1 = ", ";
457
- const hex = (code, digits) => String$1.padStart(digits, "0")(code.toString(HEX$3));
458
- const unicodeEscape = (code) => {
459
- if (code < ASCII_END) return `\\x${hex(code, BYTE_DIGITS)}`;
460
- if (code < BMP_END) return `\\u${hex(code, SHORT_DIGITS)}`;
461
- return `\\U${hex(code, LONG_DIGITS)}`;
462
- };
463
- const escapeChar = (delimiter) => (character) => Option.getOrElse(Record.get(ESCAPES$2, character), () => {
464
- if (character === delimiter) return `\\${character}`;
465
- if (character !== SPACE && UNPRINTABLE.test(character)) return unicodeEscape(Option.getOrElse(String$1.codePointAt(FIRST$8)(character), () => FIRST$8));
466
- return character;
467
- });
468
- const codePoints = (text) => {
469
- const points = [];
470
- for (const point of text) points.push(point);
471
- return points;
472
- };
473
- const escaped$3 = (text, delimiter) => pipe(codePoints(text), Array$1.map(escapeChar(delimiter)), Array$1.join(""));
474
- const quote = (text) => `"${escaped$3(text, "\"")}"`;
475
- const quoteChar = (character) => `'${escaped$3(character, "'")}'`;
476
- const quotes = (items) => pipe(items, Array$1.map(quote), Array$1.join(SEPARATOR$1));
477
- const sortedQuotes = (items) => quotes(Array$1.sort(items, Order.String));
478
- const TEEN_START = 11;
479
- const TEEN_END = 13;
480
- const TEN = 10;
481
- const HUNDRED = 100;
482
- const SUFFIXES = {
483
- 1: "st",
484
- 2: "nd",
485
- 3: "rd"
486
- };
487
- const ordinal = (value) => {
488
- if (value % HUNDRED >= TEEN_START && value % HUNDRED <= TEEN_END) return `${String(value)}th`;
489
- return `${String(value)}${Option.getOrElse(Record.get(SUFFIXES, String(value % TEN)), () => "th")}`;
490
- };
491
393
  // src/app/presets/shared/subfeature/index.ts
492
394
  const WHITESPACE$2 = /\s/u;
493
395
  const RUNS = /\s+/gu;
@@ -544,7 +446,7 @@ const isMapping = (node) => MAPPINGS.has(node.type);
544
446
  const isSequence = (node) => SEQUENCES.has(node.type);
545
447
  const isPair = (node) => PAIRS$1.has(node.type);
546
448
  const isContainer = (node) => CONTAINERS.has(node.type);
547
- const isQuoted$1 = (node) => QUOTED.has(node.type);
449
+ const isQuoted = (node) => QUOTED.has(node.type);
548
450
  const isAnchor = (node) => node.type === "anchor";
549
451
  const isAlias = (node) => node.type === "alias";
550
452
  const isComment = (node) => node.type === "comment";
@@ -619,12 +521,12 @@ const featureComments = (document) => (node) => trawl(document, spanOf$1(documen
619
521
  // src/app/presets/shared/yamlpath/query.ts
620
522
  const QUOTE_WIDTH$1 = 1;
621
523
  const NAME_START = 1;
622
- const FIRST$7 = 0;
524
+ const FIRST$6 = 0;
623
525
  const resolved$1 = (document, alias, at) => Result.fromOption(resolveAnchor(document)(String$1.slice(NAME_START)(alias.text), at), () => `unknown alias: ${alias.text}`);
624
526
  const keyText = (key) => Option.match(namedWhere((child) => !isAnchor(child))(key), {
625
527
  onNone: () => key.text,
626
528
  onSome: (scalar) => {
627
- if (isQuoted$1(scalar)) return String$1.slice(QUOTE_WIDTH$1, scalar.text.length - QUOTE_WIDTH$1)(scalar.text);
529
+ if (isQuoted(scalar)) return String$1.slice(QUOTE_WIDTH$1, scalar.text.length - QUOTE_WIDTH$1)(scalar.text);
628
530
  return scalar.text;
629
531
  }
630
532
  });
@@ -665,7 +567,7 @@ const walk$2 = (document) => (route) => {
665
567
  return focus;
666
568
  };
667
569
  const resolveTarget = (document) => (node) => {
668
- const first = childAt(FIRST$7)(node);
570
+ const first = childAt(FIRST$6)(node);
669
571
  if (Option.exists(first, isAlias)) return resolved$1(document, Option.getOrThrow(first), Option.getOrThrow(first).start);
670
572
  if (Option.exists(first, isAnchor)) return Result.succeed(Option.getOrElse(namedWhere((each) => !isAnchor(each))(node), () => node));
671
573
  return Result.succeed(node);
@@ -854,7 +756,7 @@ const atRaw = (location) => (draft) => ({
854
756
  ...draft,
855
757
  rawLocations: [...draft.rawLocations, location]
856
758
  });
857
- const SINGLE$21 = 1;
759
+ const SINGLE$20 = 1;
858
760
  const asPrimary = (only) => ({
859
761
  ...only,
860
762
  symbolic: {
@@ -868,7 +770,7 @@ const finished$1 = (draft) => (locations) => ({
868
770
  ignored: pipe(locations, Array$1.flatMap((each) => each.concrete.comments), Array$1.some(commentIgnores(draft.ident)))
869
771
  });
870
772
  const withPrimary = (locations) => {
871
- if (locations.length === SINGLE$21) return Result.succeed(pipe(locations, Array$1.map(asPrimary)));
773
+ if (locations.length === SINGLE$20) return Result.succeed(pipe(locations, Array$1.map(asPrimary)));
872
774
  if (!pipe(locations, Array$1.some((each) => each.symbolic.kind === "primary"))) return Result.fail("API misuse: at least one location must be marked with primary()");
873
775
  return Result.succeed(locations);
874
776
  };
@@ -886,32 +788,6 @@ const message = (found) => {
886
788
  })} (${Option.getOrElse(location.symbolic.link, () => found.url)})`;
887
789
  };
888
790
  const primaryColumn = (text) => (found) => characterColumnOf(text)(primaryLocation(found).concrete.startOffset);
889
- // src/app/presets/shared/yaml/node.ts
890
- const PAIR$8 = 2;
891
- const KEY$1 = 0;
892
- const VALUE$1 = 1;
893
- const isQuoted = (node) => node.style === "single-quoted" || node.style === "double-quoted";
894
- const isNull = (node) => node.kind === "scalar" && node.tag === "!!null";
895
- const pairsOf = (node) => {
896
- if (node.kind !== "mapping") return [];
897
- return pipe(Array$1.chunksOf(node.children, PAIR$8), Array$1.flatMap((chunk) => pipe(Option.all([Array$1.get(chunk, KEY$1), Array$1.get(chunk, VALUE$1)]), Option.map(([key, value]) => ({
898
- key,
899
- value
900
- })), Option.toArray)));
901
- };
902
- const keysOf = (node) => pipe(pairsOf(node), Array$1.map((pair) => pair.key.value));
903
- const valueAt = (key) => (node) => pipe(pairsOf(node), Array$1.findFirst((pair) => pair.key.value === key), Option.map((pair) => pair.value));
904
- const textOf$2 = (node) => ({
905
- value: node.value,
906
- quoted: isQuoted(node),
907
- line: node.line,
908
- column: node.column
909
- });
910
- const describePosition = (position) => `line:${String(position.line)},col:${String(position.column)}`;
911
- const readYaml = (read) => (source) => pipe(Array$1.head(source.errors), Option.match({
912
- onNone: () => read(source),
913
- onSome: (error) => Result.fail(`yaml: line ${String(error.line)}: ${error.message}`)
914
- }));
915
791
  // src/app/presets/shared/yaml/decoder.ts
916
792
  const SHOWN = 10;
917
793
  const TRUE$1 = /* @__PURE__ */ new Set([
@@ -973,7 +849,7 @@ const decodeOptionalString = (sink) => (node) => pipe(Option.liftPredicate(node,
973
849
  const scalarBoolean = (node) => {
974
850
  if (isNull(node)) return Option.some(false);
975
851
  if (node.tag === "!!bool") return Option.some(TRUE_TAGGED.has(node.value));
976
- if (isQuoted(node)) return Option.none();
852
+ if (isQuoted$1(node)) return Option.none();
977
853
  if (TRUE$1.has(node.value)) return Option.some(true);
978
854
  return Option.liftPredicate(false, () => FALSE$1.has(node.value));
979
855
  };
@@ -1036,11 +912,11 @@ const fieldsOf$4 = (node) => Result.flatMap(entriesOf(node), (entries) => {
1036
912
  });
1037
913
  });
1038
914
  const nodeAt = (fields) => (name) => Option.fromNullishOr(fields.entries.get(name));
1039
- const required$1 = (name) => (decoder) => (fields) => Option.match(nodeAt(fields)(name), {
915
+ const required = (name) => (decoder) => (fields) => Option.match(nodeAt(fields)(name), {
1040
916
  onNone: () => Result.fail(`missing field \`${name}\``),
1041
917
  onSome: decoder
1042
918
  });
1043
- const optional$1 = (name) => (decoder) => (fields) => Option.match(pipe(nodeAt(fields)(name), Option.filter((node) => !isNull(node))), {
919
+ const optional = (name) => (decoder) => (fields) => Option.match(pipe(nodeAt(fields)(name), Option.filter((node) => !isNull(node))), {
1044
920
  onNone: () => Result.succeed(Option.none()),
1045
921
  onSome: (node) => Result.map(decoder(node), Option.some)
1046
922
  });
@@ -1053,8 +929,8 @@ const scalarOrVector = (item) => untagged((node) => Result.map(item(node), Array
1053
929
  const map = (decoder) => (transform) => (node) => Result.map(decoder(node), transform);
1054
930
  const struct = (build) => (node) => Result.flatMap(fieldsOf$4(node), build);
1055
931
  // src/app/presets/features/audit-workflows/lib/common.ts
1056
- const OPEN$5 = "${{";
1057
- const CLOSE$4 = "}}";
932
+ const OPEN$4 = "${{";
933
+ const CLOSE$3 = "}}";
1058
934
  const SLUG_PARTS = 3;
1059
935
  const OWNER_REPO = 2;
1060
936
  const NEXT$19 = 1;
@@ -1065,7 +941,7 @@ const PERMISSION_LEVELS = record(literal$1([
1065
941
  "write",
1066
942
  "none"
1067
943
  ]));
1068
- const isFenced = (raw) => String$1.startsWith(OPEN$5)(raw) && String$1.endsWith(CLOSE$4)(raw);
944
+ const isFenced = (raw) => String$1.startsWith(OPEN$4)(raw) && String$1.endsWith(CLOSE$3)(raw);
1069
945
  const loe = (inner) => (node) => {
1070
946
  const expr = Result.flatMap(string$1(node), (raw) => Result.liftPredicate(raw, isFenced, () => "not an expression"));
1071
947
  if (Result.isSuccess(expr)) return Result.succeed({
@@ -1194,9 +1070,9 @@ const reusableUses = (node) => Result.flatMap(stepUses(node), (uses) => {
1194
1070
  const boolOrString = untagged(map(boolean)(String), string$1);
1195
1071
  const stepHead = (fields) => Result.gen(function* decode() {
1196
1072
  return {
1197
- id: yield* optional$1("id")(string$1)(fields),
1198
- if: yield* optional$1("if")(ifCondition)(fields),
1199
- name: yield* optional$1("name")(string$1)(fields)
1073
+ id: yield* optional("id")(string$1)(fields),
1074
+ if: yield* optional("if")(ifCondition)(fields),
1075
+ name: yield* optional("name")(string$1)(fields)
1200
1076
  };
1201
1077
  });
1202
1078
  // src/app/presets/features/audit-workflows/lib/action-decode.ts
@@ -1205,24 +1081,24 @@ const emptyEnv$1 = () => ({
1205
1081
  value: /* @__PURE__ */ new Map()
1206
1082
  });
1207
1083
  const input = struct((fields) => Result.all([
1208
- optional$1("description")(anyScalar)(fields),
1209
- optional$1("required")(boolean)(fields),
1210
- optional$1("default")(anyScalar)(fields)
1084
+ optional("description")(anyScalar)(fields),
1085
+ optional("required")(boolean)(fields),
1086
+ optional("default")(anyScalar)(fields)
1211
1087
  ]));
1212
- const output = struct((fields) => Result.all([optional$1("description")(anyScalar)(fields), optional$1("value")(anyScalar)(fields)]));
1088
+ const output = struct((fields) => Result.all([optional("description")(anyScalar)(fields), optional("value")(anyScalar)(fields)]));
1213
1089
  const usesBody = struct((fields) => Result.gen(function* decode() {
1214
1090
  return {
1215
1091
  type: "uses",
1216
- uses: yield* required$1("uses")(stepUses)(fields),
1092
+ uses: yield* required("uses")(stepUses)(fields),
1217
1093
  with: yield* defaulted$1("with")(loe(env$2))(emptyEnv$1)(fields)
1218
1094
  };
1219
1095
  }));
1220
1096
  const runBody = struct((fields) => Result.gen(function* decode() {
1221
1097
  return {
1222
1098
  type: "run",
1223
- run: yield* required$1("run")(string$1)(fields),
1224
- shell: yield* required$1("shell")(loe(string$1))(fields),
1225
- workingDirectory: yield* optional$1("working-directory")(string$1)(fields)
1099
+ run: yield* required("run")(string$1)(fields),
1100
+ shell: yield* required("shell")(loe(string$1))(fields),
1101
+ workingDirectory: yield* optional("working-directory")(string$1)(fields)
1226
1102
  };
1227
1103
  }));
1228
1104
  const step$18 = struct((fields) => Result.gen(function* decode() {
@@ -1244,12 +1120,12 @@ const dockerImage$1 = untagged((node) => Result.liftPredicate({ type: "dockerfil
1244
1120
  image
1245
1121
  })));
1246
1122
  const runs = untagged(struct((fields) => Result.gen(function* decode() {
1247
- const using = yield* required$1("using")(string$1)(fields);
1248
- yield* required$1("main")(string$1)(fields);
1249
- yield* optional$1("pre")(string$1)(fields);
1250
- yield* optional$1("pre-if")(ifCondition)(fields);
1251
- yield* optional$1("post")(string$1)(fields);
1252
- yield* optional$1("post-if")(ifCondition)(fields);
1123
+ const using = yield* required("using")(string$1)(fields);
1124
+ yield* required("main")(string$1)(fields);
1125
+ yield* optional("pre")(string$1)(fields);
1126
+ yield* optional("pre-if")(ifCondition)(fields);
1127
+ yield* optional("post")(string$1)(fields);
1128
+ yield* optional("post-if")(ifCondition)(fields);
1253
1129
  return {
1254
1130
  type: "javascript",
1255
1131
  using
@@ -1257,18 +1133,18 @@ const runs = untagged(struct((fields) => Result.gen(function* decode() {
1257
1133
  })), struct((fields) => Result.gen(function* decode() {
1258
1134
  return {
1259
1135
  type: "composite",
1260
- using: yield* required$1("using")(string$1)(fields),
1261
- steps: yield* required$1("steps")(sequence$2(step$18))(fields)
1136
+ using: yield* required("using")(string$1)(fields),
1137
+ steps: yield* required("steps")(sequence$2(step$18))(fields)
1262
1138
  };
1263
1139
  })), struct((fields) => Result.gen(function* decode() {
1264
- const using = yield* required$1("using")(string$1)(fields);
1265
- const image = yield* required$1("image")(dockerImage$1)(fields);
1140
+ const using = yield* required("using")(string$1)(fields);
1141
+ const image = yield* required("image")(dockerImage$1)(fields);
1266
1142
  const dockerEnv = yield* defaulted$1("env")(env$2)(() => /* @__PURE__ */ new Map())(fields);
1267
- yield* optional$1("entrypoint")(string$1)(fields);
1268
- yield* optional$1("pre-entrypoint")(string$1)(fields);
1269
- yield* optional$1("pre-if")(ifCondition)(fields);
1270
- yield* optional$1("post-entrypoint")(string$1)(fields);
1271
- yield* optional$1("post-if")(ifCondition)(fields);
1143
+ yield* optional("entrypoint")(string$1)(fields);
1144
+ yield* optional("pre-entrypoint")(string$1)(fields);
1145
+ yield* optional("pre-if")(ifCondition)(fields);
1146
+ yield* optional("post-entrypoint")(string$1)(fields);
1147
+ yield* optional("post-if")(ifCondition)(fields);
1272
1148
  return {
1273
1149
  type: "docker",
1274
1150
  using,
@@ -1277,12 +1153,12 @@ const runs = untagged(struct((fields) => Result.gen(function* decode() {
1277
1153
  };
1278
1154
  })));
1279
1155
  const decodeAction$1 = struct((fields) => Result.gen(function* decode() {
1280
- const name = yield* optional$1("name")(anyScalar)(fields);
1281
- yield* optional$1("author")(anyScalar)(fields);
1282
- yield* optional$1("description")(anyScalar)(fields);
1156
+ const name = yield* optional("name")(anyScalar)(fields);
1157
+ yield* optional("author")(anyScalar)(fields);
1158
+ yield* optional("description")(anyScalar)(fields);
1283
1159
  const inputs = yield* defaulted$1("inputs")(record(input))(() => /* @__PURE__ */ new Map())(fields);
1284
1160
  yield* defaulted$1("outputs")(record(output))(() => /* @__PURE__ */ new Map())(fields);
1285
- const each = yield* required$1("runs")(runs)(fields);
1161
+ const each = yield* required("runs")(runs)(fields);
1286
1162
  return {
1287
1163
  name,
1288
1164
  inputs: [...inputs.keys()],
@@ -1372,7 +1248,7 @@ const lenientUnsigned = unsignedFrom(anyScalar, (text) => ({
1372
1248
  value: Number(text),
1373
1249
  isInteger: DIGITS$3.test(text)
1374
1250
  }));
1375
- const strings$4 = sequence$2(string$1);
1251
+ const strings$1 = sequence$2(string$1);
1376
1252
  const intervals = literal$1(INTERVALS);
1377
1253
  const days = literal$1(DAYS);
1378
1254
  const dependencyTypes = literal$1(DEPENDENCY_TYPES);
@@ -1393,59 +1269,59 @@ const versioningStrategies = literal$1([
1393
1269
  "widen"
1394
1270
  ]);
1395
1271
  const schedule$1 = struct((fields) => Result.gen(function* decode() {
1396
- const interval = yield* required$1("interval")(intervals)(fields);
1397
- yield* optional$1("day")(days)(fields);
1398
- yield* optional$1("time")(string$1)(fields);
1399
- yield* optional$1("timezone")(string$1)(fields);
1400
- const cronjob = yield* optional$1("cronjob")(string$1)(fields);
1272
+ const interval = yield* required("interval")(intervals)(fields);
1273
+ yield* optional("day")(days)(fields);
1274
+ yield* optional("time")(string$1)(fields);
1275
+ yield* optional("timezone")(string$1)(fields);
1276
+ const cronjob = yield* optional("cronjob")(string$1)(fields);
1401
1277
  if (interval === "cron" !== Option.isSome(cronjob)) return yield* Result.fail("invalid schedule");
1402
1278
  return interval;
1403
1279
  }));
1404
1280
  const commitMessage = struct((fields) => Result.all([
1405
- optional$1("prefix")(string$1)(fields),
1406
- optional$1("prefix-development")(string$1)(fields),
1407
- optional$1("include")(string$1)(fields)
1281
+ optional("prefix")(string$1)(fields),
1282
+ optional("prefix-development")(string$1)(fields),
1283
+ optional("include")(string$1)(fields)
1408
1284
  ]));
1409
- const branchName = struct((fields) => optional$1("separator")(string$1)(fields));
1285
+ const branchName = struct((fields) => optional("separator")(string$1)(fields));
1410
1286
  const cooldown = struct((fields) => Result.gen(function* decode() {
1411
- const defaultDays = yield* optional$1("default-days")(unsigned$1)(fields);
1412
- yield* optional$1("semver-major-days")(unsigned$1)(fields);
1413
- yield* optional$1("semver-minor-days")(unsigned$1)(fields);
1414
- yield* optional$1("semver-patch-days")(unsigned$1)(fields);
1415
- yield* defaulted$1("include")(strings$4)(noStrings$2)(fields);
1416
- yield* defaulted$1("exclude")(strings$4)(noStrings$2)(fields);
1287
+ const defaultDays = yield* optional("default-days")(unsigned$1)(fields);
1288
+ yield* optional("semver-major-days")(unsigned$1)(fields);
1289
+ yield* optional("semver-minor-days")(unsigned$1)(fields);
1290
+ yield* optional("semver-patch-days")(unsigned$1)(fields);
1291
+ yield* defaulted$1("include")(strings$1)(noStrings$2)(fields);
1292
+ yield* defaulted$1("exclude")(strings$1)(noStrings$2)(fields);
1417
1293
  return { defaultDays };
1418
1294
  }));
1419
1295
  const group = struct((fields) => Result.all([
1420
- optional$1("dependency-type")(dependencyTypes)(fields),
1421
- defaulted$1("patterns")(strings$4)(noStrings$2)(fields),
1422
- defaulted$1("exclude-patterns")(strings$4)(noStrings$2)(fields),
1296
+ optional("dependency-type")(dependencyTypes)(fields),
1297
+ defaulted$1("patterns")(strings$1)(noStrings$2)(fields),
1298
+ defaulted$1("exclude-patterns")(strings$1)(noStrings$2)(fields),
1423
1299
  defaulted$1("update-types")(updateTypes)(() => [])(fields)
1424
1300
  ]));
1425
- const allowEntries = sequence$2(struct((each) => Result.all([optional$1("dependency-name")(string$1)(each), optional$1("dependency-type")(dependencyTypes)(each)])));
1301
+ const allowEntries = sequence$2(struct((each) => Result.all([optional("dependency-name")(string$1)(each), optional("dependency-type")(dependencyTypes)(each)])));
1426
1302
  const groups = record(group);
1427
1303
  const validateUpdate = (fields) => Result.all([
1428
1304
  defaulted$1("allow")(allowEntries)(() => [])(fields),
1429
- defaulted$1("assignees")(strings$4)(noStrings$2)(fields),
1305
+ defaulted$1("assignees")(strings$1)(noStrings$2)(fields),
1430
1306
  defaulted$1("groups")(groups)(noEntries)(fields),
1431
1307
  defaulted$1("open-pull-requests-limit")(unsigned$1)(() => NO_LIMIT)(fields),
1432
1308
  defaulted$1("rebase-strategy")(rebaseStrategies)(() => "auto")(fields),
1433
1309
  defaulted$1("registries")(registries)(noStrings$2)(fields),
1434
- defaulted$1("reviewers")(strings$4)(noStrings$2)(fields),
1435
- optional$1("schedule")(schedule$1)(fields),
1310
+ defaulted$1("reviewers")(strings$1)(noStrings$2)(fields),
1311
+ optional("schedule")(schedule$1)(fields),
1436
1312
  defaulted$1("vendor")(boolean)(() => false)(fields),
1437
- optional$1("versioning-strategy")(versioningStrategies)(fields),
1438
- optional$1("exclude-paths")(strings$4)(fields)
1313
+ optional("versioning-strategy")(versioningStrategies)(fields),
1314
+ optional("exclude-paths")(strings$1)(fields)
1439
1315
  ]);
1440
1316
  const placementOf = (fields) => Result.all({
1441
- directory: optional$1("directory")(string$1)(fields),
1442
- directories: optional$1("directories")(strings$4)(fields),
1443
- multiEcosystemGroup: optional$1("multi-ecosystem-group")(string$1)(fields),
1444
- patterns: optional$1("patterns")(strings$4)(fields),
1445
- milestone: optional$1("milestone")(unsigned$1)(fields),
1446
- targetBranch: optional$1("target-branch")(string$1)(fields),
1447
- commitMessage: optional$1("commit-message")(commitMessage)(fields),
1448
- branchName: optional$1("pull-request-branch-name")(branchName)(fields)
1317
+ directory: optional("directory")(string$1)(fields),
1318
+ directories: optional("directories")(strings$1)(fields),
1319
+ multiEcosystemGroup: optional("multi-ecosystem-group")(string$1)(fields),
1320
+ patterns: optional("patterns")(strings$1)(fields),
1321
+ milestone: optional("milestone")(unsigned$1)(fields),
1322
+ targetBranch: optional("target-branch")(string$1)(fields),
1323
+ commitMessage: optional("commit-message")(commitMessage)(fields),
1324
+ branchName: optional("pull-request-branch-name")(branchName)(fields)
1449
1325
  });
1450
1326
  const conflictsWithGroup = (placement) => Option.isNone(placement.patterns) || Option.isSome(placement.milestone) || Option.isSome(placement.targetBranch) || Option.isSome(placement.commitMessage) || Option.isSome(placement.branchName);
1451
1327
  const checkPlacement = (placement) => {
@@ -1457,27 +1333,27 @@ const update = struct((fields) => Result.gen(function* decode() {
1457
1333
  yield* validateUpdate(fields);
1458
1334
  const multiEcosystemGroup = yield* pipe(placementOf(fields), Result.flatMap(checkPlacement));
1459
1335
  return {
1460
- packageEcosystem: yield* required$1("package-ecosystem")(ecosystems)(fields),
1336
+ packageEcosystem: yield* required("package-ecosystem")(ecosystems)(fields),
1461
1337
  insecureExternalCodeExecution: yield* defaulted$1("insecure-external-code-execution")(insecureModes)(() => "deny")(fields),
1462
- cooldown: yield* optional$1("cooldown")(cooldown)(fields),
1338
+ cooldown: yield* optional("cooldown")(cooldown)(fields),
1463
1339
  multiEcosystemGroup
1464
1340
  };
1465
1341
  }));
1466
1342
  const multiGroups = record(struct((fields) => Result.all([
1467
- required$1("schedule")(schedule$1)(fields),
1468
- defaulted$1("labels")(strings$4)(noStrings$2)(fields),
1469
- optional$1("milestone")(unsigned$1)(fields),
1470
- defaulted$1("assignees")(strings$4)(noStrings$2)(fields),
1471
- optional$1("target-branch")(string$1)(fields),
1472
- optional$1("commit-message")(commitMessage)(fields),
1473
- optional$1("pull-request-branch-name")(branchName)(fields)
1343
+ required("schedule")(schedule$1)(fields),
1344
+ defaulted$1("labels")(strings$1)(noStrings$2)(fields),
1345
+ optional("milestone")(unsigned$1)(fields),
1346
+ defaulted$1("assignees")(strings$1)(noStrings$2)(fields),
1347
+ optional("target-branch")(string$1)(fields),
1348
+ optional("commit-message")(commitMessage)(fields),
1349
+ optional("pull-request-branch-name")(branchName)(fields)
1474
1350
  ])));
1475
1351
  const updates = sequence$2(update);
1476
1352
  const decodeDependabot = struct((fields) => Result.gen(function* decode() {
1477
- yield* required$1("version")(lenientUnsigned)(fields);
1353
+ yield* required("version")(lenientUnsigned)(fields);
1478
1354
  yield* defaulted$1("enable-beta-ecosystems")(boolean)(() => false)(fields);
1479
1355
  yield* defaulted$1("multi-ecosystem-groups")(multiGroups)(noEntries)(fields);
1480
- return { updates: yield* required$1("updates")(updates)(fields) };
1356
+ return { updates: yield* required("updates")(updates)(fields) };
1481
1357
  }));
1482
1358
  // src/app/presets/features/audit-workflows/lib/pre-commit-decode.ts
1483
1359
  const SPECIAL$1 = /* @__PURE__ */ new Set([
@@ -1485,8 +1361,8 @@ const SPECIAL$1 = /* @__PURE__ */ new Set([
1485
1361
  "meta",
1486
1362
  "builtin"
1487
1363
  ]);
1488
- const nonEmpty$2 = (item) => (node) => Result.flatMap(sequence$2(item)(node), (items) => Result.liftPredicate(items, (each) => Array$1.isReadonlyArrayNonEmpty(each), () => "expected at least one item in list"));
1489
- const hook = struct((fields) => required$1("id")(string$1)(fields));
1364
+ const nonEmpty$1 = (item) => (node) => Result.flatMap(sequence$2(item)(node), (items) => Result.liftPredicate(items, (each) => Array$1.isReadonlyArrayNonEmpty(each), () => "expected at least one item in list"));
1365
+ const hook = struct((fields) => required("id")(string$1)(fields));
1490
1366
  const parseUrl = (text) => Result.try({
1491
1367
  try: () => {
1492
1368
  const { href, protocol, hostname, pathname } = new URL(text);
@@ -1499,15 +1375,15 @@ const parseUrl = (text) => Result.try({
1499
1375
  },
1500
1376
  catch: () => `invalid URL: ${text}`
1501
1377
  });
1502
- const repo = struct((fields) => Result.flatMap(required$1("repo")(string$1)(fields), (name) => {
1378
+ const repo = struct((fields) => Result.flatMap(required("repo")(string$1)(fields), (name) => {
1503
1379
  if (SPECIAL$1.has(name)) return Result.succeed({
1504
1380
  type: "special",
1505
1381
  repo: name
1506
1382
  });
1507
1383
  return Result.gen(function* decode() {
1508
1384
  const url = yield* parseUrl(name);
1509
- const rev = yield* required$1("rev")(string$1)(fields);
1510
- yield* required$1("hooks")(nonEmpty$2(hook))(fields);
1385
+ const rev = yield* required("rev")(string$1)(fields);
1386
+ yield* required("hooks")(nonEmpty$1(hook))(fields);
1511
1387
  return {
1512
1388
  type: "remote",
1513
1389
  repo: name,
@@ -1516,15 +1392,15 @@ const repo = struct((fields) => Result.flatMap(required$1("repo")(string$1)(fiel
1516
1392
  };
1517
1393
  });
1518
1394
  }));
1519
- const decodePreCommitConfig = struct((fields) => Result.map(required$1("repos")(nonEmpty$2(repo))(fields), (repos) => ({ repos })));
1395
+ const decodePreCommitConfig = struct((fields) => Result.map(required("repos")(nonEmpty$1(repo))(fields), (repos) => ({ repos })));
1520
1396
  const hookDefinition = struct((fields) => Result.gen(function* decode() {
1521
- const id = yield* required$1("id")(anyScalar)(fields);
1522
- yield* required$1("name")(anyScalar)(fields);
1523
- yield* required$1("entry")(anyScalar)(fields);
1524
- yield* required$1("language")(anyScalar)(fields);
1397
+ const id = yield* required("id")(anyScalar)(fields);
1398
+ yield* required("name")(anyScalar)(fields);
1399
+ yield* required("entry")(anyScalar)(fields);
1400
+ yield* required("language")(anyScalar)(fields);
1525
1401
  return id;
1526
1402
  }));
1527
- const decodePreCommitHooks = (node) => Result.map(nonEmpty$2(hookDefinition)(node), (hooks) => ({ hooks }));
1403
+ const decodePreCommitHooks = (node) => Result.map(nonEmpty$1(hookDefinition)(node), (hooks) => ({ hooks }));
1528
1404
  // src/app/presets/features/audit-workflows/model/common.ts
1529
1405
  const CACHE_MODES = [
1530
1406
  "read",
@@ -1537,7 +1413,7 @@ const emptyEnv = () => ({
1537
1413
  type: "literal",
1538
1414
  value: /* @__PURE__ */ new Map()
1539
1415
  });
1540
- const strings$3 = scalarOrVector(string$1);
1416
+ const strings = scalarOrVector(string$1);
1541
1417
  const noStrings$1 = () => [];
1542
1418
  // src/app/presets/features/audit-workflows/lib/job-decode.ts
1543
1419
  const floatText = (raw) => {
@@ -1592,27 +1468,27 @@ const matrix$2 = struct((fields) => Result.gen(function* decode() {
1592
1468
  const MINIMUM = 0;
1593
1469
  const unsigned = (node) => Result.flatMap(number$1(node), (value) => Result.liftPredicate(value, (each) => node.tag === "!!int" && each >= MINIMUM, () => "expected u64"));
1594
1470
  const strategy$1 = struct((fields) => Result.gen(function* decode() {
1595
- const each = yield* optional$1("matrix")(loe(matrix$2))(fields);
1596
- yield* optional$1("fail-fast")(loe(boolean))(fields);
1597
- yield* optional$1("max-parallel")(loe(unsigned))(fields);
1471
+ const each = yield* optional("matrix")(loe(matrix$2))(fields);
1472
+ yield* optional("fail-fast")(loe(boolean))(fields);
1473
+ yield* optional("max-parallel")(loe(unsigned))(fields);
1598
1474
  return { matrix: each };
1599
1475
  }));
1600
1476
  const dockerImage = loe(map(string$1)((raw) => parseDocker(raw)));
1601
1477
  const credentials$1 = struct((fields) => Result.gen(function* decode() {
1602
1478
  return {
1603
- username: yield* optional$1("username")(string$1)(fields),
1604
- password: yield* optional$1("password")(string$1)(fields)
1479
+ username: yield* optional("username")(string$1)(fields),
1480
+ password: yield* optional("password")(string$1)(fields)
1605
1481
  };
1606
1482
  }));
1607
1483
  const container = untagged(map(dockerImage)((image) => ({
1608
1484
  type: "name",
1609
1485
  image
1610
1486
  })), struct((fields) => Result.gen(function* decode() {
1611
- const image = yield* required$1("image")(dockerImage)(fields);
1612
- const creds = yield* optional$1("credentials")(credentials$1)(fields);
1487
+ const image = yield* required("image")(dockerImage)(fields);
1488
+ const creds = yield* optional("credentials")(credentials$1)(fields);
1613
1489
  const containerEnv = yield* defaulted$1("env")(loe(env$2))(emptyEnv)(fields);
1614
1490
  yield* defaulted$1("volumes")(sequence$2(string$1))(noStrings$1)(fields);
1615
- yield* optional$1("options")(string$1)(fields);
1491
+ yield* optional("options")(string$1)(fields);
1616
1492
  return {
1617
1493
  type: "container",
1618
1494
  image,
@@ -1660,39 +1536,39 @@ const BARE_EVENTS = [
1660
1536
  "workflow_run"
1661
1537
  ];
1662
1538
  const EVENTS = /* @__PURE__ */ new Set([...BARE_EVENTS, "schedule"]);
1663
- const typesOf = struct((fields) => defaulted$1("types")(strings$3)(noStrings$1)(fields));
1539
+ const typesOf = struct((fields) => defaulted$1("types")(strings)(noStrings$1)(fields));
1664
1540
  const genericBody = typesOf;
1665
1541
  const sequenceString = sequence$2(string$1);
1666
- const imageVersion = struct((fields) => Result.map(Result.all([required$1("names")(sequenceString)(fields), required$1("versions")(sequenceString)(fields)]), noStrings$1));
1667
- const workflowRun = struct((fields) => Result.flatMap(required$1("workflows")(sequence$2(string$1))(fields), () => typesOf(fields.node)));
1668
- const cron = map(sequence$2(struct((fields) => Result.all([required$1("cron")(string$1)(fields), optional$1("timezone")(string$1)(fields)]))))(noStrings$1);
1669
- const described = (fields) => Result.all([optional$1("description")(string$1)(fields), defaulted$1("required")(boolean)(() => false)(fields)]);
1670
- const callInput$1 = struct((fields) => Result.gen(function* decode() {
1542
+ const imageVersion = struct((fields) => Result.map(Result.all([required("names")(sequenceString)(fields), required("versions")(sequenceString)(fields)]), noStrings$1));
1543
+ const workflowRun = struct((fields) => Result.flatMap(required("workflows")(sequence$2(string$1))(fields), () => typesOf(fields.node)));
1544
+ const cron = map(sequence$2(struct((fields) => Result.all([required("cron")(string$1)(fields), optional("timezone")(string$1)(fields)]))))(noStrings$1);
1545
+ const described = (fields) => Result.all([optional("description")(string$1)(fields), defaulted$1("required")(boolean)(() => false)(fields)]);
1546
+ const callInput = struct((fields) => Result.gen(function* decode() {
1671
1547
  yield* described(fields);
1672
- return yield* required$1("type")(literal$1([
1548
+ return yield* required("type")(literal$1([
1673
1549
  "boolean",
1674
1550
  "number",
1675
1551
  "string"
1676
1552
  ]))(fields);
1677
1553
  }));
1678
- const callOutput$1 = struct((fields) => Result.gen(function* decode() {
1679
- yield* optional$1("description")(string$1)(fields);
1680
- return yield* required$1("value")(string$1)(fields);
1554
+ const callOutput = struct((fields) => Result.gen(function* decode() {
1555
+ yield* optional("description")(string$1)(fields);
1556
+ return yield* required("value")(string$1)(fields);
1681
1557
  }));
1682
- const callSecret$1 = struct(described);
1558
+ const callSecret = struct(described);
1683
1559
  const nullAsTrue = map(unit)(() => true);
1684
- const callSecrets$1 = record(untagged(nullAsTrue, map(callSecret$1)(() => true)));
1685
- const callInputs = record(callInput$1);
1686
- const callOutputs = record(callOutput$1);
1560
+ const callSecrets = record(untagged(nullAsTrue, map(callSecret)(() => true)));
1561
+ const callInputs = record(callInput);
1562
+ const callOutputs = record(callOutput);
1687
1563
  const emptyMap = () => /* @__PURE__ */ new Map();
1688
1564
  const workflowCall$1 = struct((fields) => Result.gen(function* decode() {
1689
1565
  return {
1690
1566
  inputs: yield* defaulted$1("inputs")(callInputs)(emptyMap)(fields),
1691
1567
  outputs: yield* defaulted$1("outputs")(callOutputs)(emptyMap)(fields),
1692
- secrets: [...(yield* defaulted$1("secrets")(callSecrets$1)(emptyMap)(fields)).keys()]
1568
+ secrets: [...(yield* defaulted$1("secrets")(callSecrets)(emptyMap)(fields)).keys()]
1693
1569
  };
1694
1570
  }));
1695
- const dispatchInput$1 = struct((fields) => Result.gen(function* decode() {
1571
+ const dispatchInput = struct((fields) => Result.gen(function* decode() {
1696
1572
  yield* described(fields);
1697
1573
  const type = yield* defaulted$1("type")(literal$1([
1698
1574
  "boolean",
@@ -1704,7 +1580,7 @@ const dispatchInput$1 = struct((fields) => Result.gen(function* decode() {
1704
1580
  yield* defaulted$1("options")(sequence$2(envValue))(() => [])(fields);
1705
1581
  return type;
1706
1582
  }));
1707
- const workflowDispatch = struct((fields) => Result.map(defaulted$1("inputs")(record(dispatchInput$1))(() => /* @__PURE__ */ new Map())(fields), (inputs) => ({ inputs })));
1583
+ const workflowDispatch = struct((fields) => Result.map(defaulted$1("inputs")(record(dispatchInput))(() => /* @__PURE__ */ new Map())(fields), (inputs) => ({ inputs })));
1708
1584
  const BODIES = {
1709
1585
  image_version: imageVersion,
1710
1586
  workflow_run: workflowRun,
@@ -1724,8 +1600,8 @@ const eventBody = (name) => (node) => {
1724
1600
  const namedBody = (fields) => (name) => pipe(Result.fromOption(nodeAt(fields)(name), () => `missing field \`${name}\``), Result.flatMap(eventBody(name)), Result.map((body) => [name, body]));
1725
1601
  const eventsOf = (fields) => pipe(Array$1.fromIterable(fields.entries.keys()), Array$1.filter((name) => EVENTS.has(name)), Array$1.map(namedBody(fields)), Result.all);
1726
1602
  const mappingTrigger = struct((fields) => pipe(eventsOf(fields), Result.flatMap((events) => Result.gen(function* decode() {
1727
- const call = yield* optional$1("workflow_call")(workflowCall$1)(fields);
1728
- const dispatch = yield* optional$1("workflow_dispatch")(workflowDispatch)(fields);
1603
+ const call = yield* optional("workflow_call")(workflowCall$1)(fields);
1604
+ const dispatch = yield* optional("workflow_dispatch")(workflowDispatch)(fields);
1729
1605
  return {
1730
1606
  events: new Map(events),
1731
1607
  syntax: { type: "mapping" },
@@ -1761,18 +1637,18 @@ const trigger = untagged(mappingTrigger, map(bareEvent)((name) => ({
1761
1637
  // src/app/presets/features/audit-workflows/lib/workflow-decode.ts
1762
1638
  const runDefaults = struct((fields) => Result.gen(function* decode() {
1763
1639
  return {
1764
- shell: yield* optional$1("shell")(loe(string$1))(fields),
1765
- workingDirectory: yield* optional$1("working-directory")(anyScalar)(fields)
1640
+ shell: yield* optional("shell")(loe(string$1))(fields),
1641
+ workingDirectory: yield* optional("working-directory")(anyScalar)(fields)
1766
1642
  };
1767
1643
  }));
1768
- const defaults = struct((fields) => Result.map(optional$1("run")(runDefaults)(fields), (run) => ({ run })));
1644
+ const defaults = struct((fields) => Result.map(optional("run")(runDefaults)(fields), (run) => ({ run })));
1769
1645
  const concurrency$1 = untagged(map(string$1)((group) => ({
1770
1646
  type: "bare",
1771
1647
  group
1772
1648
  })), struct((fields) => Result.gen(function* decode() {
1773
1649
  return {
1774
1650
  type: "rich",
1775
- group: yield* required$1("group")(string$1)(fields),
1651
+ group: yield* required("group")(string$1)(fields),
1776
1652
  cancelInProgress: yield* defaulted$1("cancel-in-progress")(loe(boolean))(() => ({
1777
1653
  type: "literal",
1778
1654
  value: false
@@ -1780,15 +1656,15 @@ const concurrency$1 = untagged(map(string$1)((group) => ({
1780
1656
  };
1781
1657
  })));
1782
1658
  const runsOnGroup = struct((fields) => Result.gen(function* decode() {
1783
- const group = yield* optional$1("group")(string$1)(fields);
1784
- const labels = yield* defaulted$1("labels")(strings$3)(noStrings$1)(fields);
1659
+ const group = yield* optional("group")(string$1)(fields);
1660
+ const labels = yield* defaulted$1("labels")(strings)(noStrings$1)(fields);
1785
1661
  return yield* Result.liftPredicate({
1786
1662
  type: "group",
1787
1663
  group,
1788
1664
  labels
1789
1665
  }, () => Option.isSome(group) || Array$1.isReadonlyArrayNonEmpty(labels), () => "runs-on must provide either `group` or one or more `labels`");
1790
1666
  }));
1791
- const runsOn = untagged(map(strings$3)((labels) => ({
1667
+ const runsOn = untagged(map(strings)((labels) => ({
1792
1668
  type: "target",
1793
1669
  labels
1794
1670
  })), runsOnGroup);
@@ -1798,13 +1674,13 @@ const environment = untagged(map(string$1)((name) => ({
1798
1674
  })), struct((fields) => Result.gen(function* decode() {
1799
1675
  return {
1800
1676
  type: "name-url",
1801
- name: yield* required$1("name")(string$1)(fields),
1802
- url: yield* optional$1("url")(string$1)(fields)
1677
+ name: yield* required("name")(string$1)(fields),
1678
+ url: yield* optional("url")(string$1)(fields)
1803
1679
  };
1804
1680
  })));
1805
1681
  const shared = (fields) => Result.gen(function* decode() {
1806
1682
  const head = yield* stepHead(fields);
1807
- yield* optional$1("timeout-minutes")(loe(number$1))(fields);
1683
+ yield* optional("timeout-minutes")(loe(number$1))(fields);
1808
1684
  yield* defaulted$1("continue-on-error")(loe(boolean))(() => ({
1809
1685
  type: "literal",
1810
1686
  value: false
@@ -1817,7 +1693,7 @@ const shared = (fields) => Result.gen(function* decode() {
1817
1693
  };
1818
1694
  });
1819
1695
  const usesStep = struct((fields) => Result.gen(function* decode() {
1820
- const uses = yield* required$1("uses")(stepUses)(fields);
1696
+ const uses = yield* required("uses")(stepUses)(fields);
1821
1697
  const withs = yield* defaulted$1("with")(loe(env$2))(emptyEnv)(fields);
1822
1698
  return {
1823
1699
  ...yield* shared(fields),
@@ -1829,9 +1705,9 @@ const usesStep = struct((fields) => Result.gen(function* decode() {
1829
1705
  };
1830
1706
  }));
1831
1707
  const runStep = struct((fields) => Result.gen(function* decode() {
1832
- const run = yield* required$1("run")(boolOrString)(fields);
1833
- const workingDirectory = yield* optional$1("working-directory")(string$1)(fields);
1834
- const shell = yield* optional$1("shell")(loe(string$1))(fields);
1708
+ const run = yield* required("run")(boolOrString)(fields);
1709
+ const workingDirectory = yield* optional("working-directory")(string$1)(fields);
1710
+ const shell = yield* optional("shell")(loe(string$1))(fields);
1835
1711
  return {
1836
1712
  ...yield* shared(fields),
1837
1713
  body: {
@@ -1843,25 +1719,25 @@ const runStep = struct((fields) => Result.gen(function* decode() {
1843
1719
  };
1844
1720
  }));
1845
1721
  const control = (field, decoder) => struct((fields) => Result.gen(function* decode() {
1846
- yield* optional$1("name")(string$1)(fields);
1847
- yield* optional$1("id")(string$1)(fields);
1848
- yield* required$1(field)(decoder)(fields);
1722
+ yield* optional("name")(string$1)(fields);
1723
+ yield* optional("id")(string$1)(fields);
1724
+ yield* required(field)(decoder)(fields);
1849
1725
  return { type: "control" };
1850
1726
  }));
1851
1727
  const stepModel = untagged(usesStep, runStep);
1852
1728
  const step$17 = untagged(map(stepModel)((each) => ({
1853
1729
  type: "step",
1854
1730
  step: each
1855
- })), control("wait", strings$3), control("wait-all", untagged(boolean, nullAsTrue)), control("cancel", string$1), struct((fields) => Result.map(required$1("parallel")(sequence$2(stepModel))(fields), (steps) => ({
1731
+ })), control("wait", strings), control("wait-all", untagged(boolean, nullAsTrue)), control("cancel", string$1), struct((fields) => Result.map(required("parallel")(sequence$2(stepModel))(fields), (steps) => ({
1856
1732
  type: "parallel",
1857
1733
  steps
1858
1734
  }))));
1859
1735
  const jobCommon = (fields) => Result.all({
1860
- name: optional$1("name")(string$1)(fields),
1861
- cacheMode: optional$1("cache-mode")(literal$1(CACHE_MODES))(fields),
1736
+ name: optional("name")(string$1)(fields),
1737
+ cacheMode: optional("cache-mode")(literal$1(CACHE_MODES))(fields),
1862
1738
  permissions: defaulted$1("permissions")(permissions$1)(() => DEFAULT_PERMISSIONS$1)(fields),
1863
- needs: defaulted$1("needs")(strings$3)(noStrings$1)(fields),
1864
- if: optional$1("if")(ifCondition)(fields)
1739
+ needs: defaulted$1("needs")(strings)(noStrings$1)(fields),
1740
+ if: optional("if")(ifCondition)(fields)
1865
1741
  });
1866
1742
  const loeBoolean = loe(boolean);
1867
1743
  const loeNumber = loe(number$1);
@@ -1870,20 +1746,20 @@ const loeEnv = loe(env$2);
1870
1746
  const loeRunsOn = loe(runsOn);
1871
1747
  const normalJob = struct((fields) => Result.map(Result.all({
1872
1748
  common: jobCommon(fields),
1873
- runsOn: required$1("runs-on")(loeRunsOn)(fields),
1874
- environment: optional$1("environment")(environment)(fields),
1875
- concurrency: optional$1("concurrency")(concurrency$1)(fields),
1749
+ runsOn: required("runs-on")(loeRunsOn)(fields),
1750
+ environment: optional("environment")(environment)(fields),
1751
+ concurrency: optional("concurrency")(concurrency$1)(fields),
1876
1752
  outputs: defaulted$1("outputs")(env$2)(() => /* @__PURE__ */ new Map())(fields),
1877
1753
  env: defaulted$1("env")(loeEnv)(emptyEnv)(fields),
1878
- defaults: optional$1("defaults")(defaults)(fields),
1879
- steps: required$1("steps")(sequenceStep)(fields),
1880
- timeout: optional$1("timeout-minutes")(loeNumber)(fields),
1881
- strategy: optional$1("strategy")(strategy$1)(fields),
1754
+ defaults: optional("defaults")(defaults)(fields),
1755
+ steps: required("steps")(sequenceStep)(fields),
1756
+ timeout: optional("timeout-minutes")(loeNumber)(fields),
1757
+ strategy: optional("strategy")(strategy$1)(fields),
1882
1758
  continueOnError: defaulted$1("continue-on-error")(loeBoolean)(() => ({
1883
1759
  type: "literal",
1884
1760
  value: false
1885
1761
  }))(fields),
1886
- container: optional$1("container")(container)(fields),
1762
+ container: optional("container")(container)(fields),
1887
1763
  services: defaulted$1("services")(services)(() => [])(fields)
1888
1764
  }), ({ common, outputs: _outputs, timeout: _timeout, continueOnError: _continue, ...rest }) => ({
1889
1765
  type: "normal",
@@ -1897,9 +1773,9 @@ const secrets$1 = untagged(map(literal$1(["inherit"]))(() => ({ type: "inherit"
1897
1773
  })));
1898
1774
  const job$1 = untagged(normalJob, struct((fields) => Result.map(Result.all({
1899
1775
  common: jobCommon(fields),
1900
- uses: required$1("uses")(reusableUses)(fields),
1776
+ uses: required("uses")(reusableUses)(fields),
1901
1777
  with: defaulted$1("with")(loeEnv)(emptyEnv)(fields),
1902
- secrets: optional$1("secrets")(secrets$1)(fields)
1778
+ secrets: optional("secrets")(secrets$1)(fields)
1903
1779
  }), ({ common, ...rest }) => ({
1904
1780
  type: "reusable",
1905
1781
  ...common,
@@ -1907,19 +1783,19 @@ const job$1 = untagged(normalJob, struct((fields) => Result.map(Result.all({
1907
1783
  }))));
1908
1784
  const jobs$1 = (node) => Result.flatMap(entriesOf(node), (entries) => Result.all(pipe(entries, Array$1.map(([id, each]) => Result.map(job$1(each), (decoded) => [id, decoded])))));
1909
1785
  const decodeWorkflow = struct((fields) => Result.all({
1910
- name: optional$1("name")(anyScalar)(fields),
1911
- runName: optional$1("run-name")(anyScalar)(fields),
1912
- on: required$1("on")(trigger)(fields),
1913
- cacheMode: optional$1("cache-mode")(literal$1(CACHE_MODES))(fields),
1786
+ name: optional("name")(anyScalar)(fields),
1787
+ runName: optional("run-name")(anyScalar)(fields),
1788
+ on: required("on")(trigger)(fields),
1789
+ cacheMode: optional("cache-mode")(literal$1(CACHE_MODES))(fields),
1914
1790
  permissions: defaulted$1("permissions")(permissions$1)(() => DEFAULT_PERMISSIONS$1)(fields),
1915
1791
  env: defaulted$1("env")(loe(env$2))(emptyEnv)(fields),
1916
- defaults: optional$1("defaults")(defaults)(fields),
1917
- concurrency: optional$1("concurrency")(concurrency$1)(fields),
1918
- jobs: required$1("jobs")(jobs$1)(fields)
1792
+ defaults: optional("defaults")(defaults)(fields),
1793
+ concurrency: optional("concurrency")(concurrency$1)(fields),
1794
+ jobs: required("jobs")(jobs$1)(fields)
1919
1795
  }));
1920
1796
  // src/app/presets/features/audit-workflows/lib/input.ts
1921
1797
  const HOOKS = ".pre-commit-hooks.yaml";
1922
- const EMPTY$3 = () => "empty input";
1798
+ const EMPTY$1 = () => "empty input";
1923
1799
  const cache = /* @__PURE__ */ new WeakMap();
1924
1800
  const preCommit = (base) => (node) => {
1925
1801
  if (base.filename === HOOKS) return Result.map(decodePreCommitHooks(node), (model) => ({
@@ -1958,7 +1834,7 @@ const decoded = (kind, path, source) => Result.flatMap(documentOf(source), (docu
1958
1834
  source,
1959
1835
  document
1960
1836
  });
1961
- return pipe(Option.fromNullishOr(source.yaml), Result.fromOption(EMPTY$3), Result.flatMap(build));
1837
+ return pipe(Option.fromNullishOr(source.yaml), Result.fromOption(EMPTY$1), Result.flatMap(build));
1962
1838
  });
1963
1839
  const inputOf$2 = (kind) => (path) => (source) => cache.getOrInsertComputed(source, () => Result.getSuccess(decoded(kind, path, source)));
1964
1840
  // src/app/presets/features/audit-workflows/model/finding.ts
@@ -2160,7 +2036,7 @@ const WRAP = 4294967296;
2160
2036
  const MAX = 4294967295;
2161
2037
  const INFINITY = "infinity";
2162
2038
  const PREFIX = 2;
2163
- const ZERO$2 = 0;
2039
+ const ZERO = 0;
2164
2040
  const signed32 = (value) => {
2165
2041
  if (value >= SIGNED) return value - WRAP;
2166
2042
  return value;
@@ -2183,9 +2059,9 @@ const prefixed$1 = (trimmed) => {
2183
2059
  if (String$1.startsWith("0o")(trimmed)) return radix(String$1.slice(PREFIX)(trimmed), OCTAL$1, OCTAL_DIGITS);
2184
2060
  return infinity(trimmed);
2185
2061
  };
2186
- const parseNumber$2 = (text) => {
2062
+ const parseNumber$1 = (text) => {
2187
2063
  const trimmed = String$1.trim(text);
2188
- if (String$1.isEmpty(trimmed)) return ZERO$2;
2064
+ if (String$1.isEmpty(trimmed)) return ZERO;
2189
2065
  return Option.getOrElse(decimal(trimmed), () => prefixed$1(trimmed));
2190
2066
  };
2191
2067
  // src/app/presets/entities/expression-tree/lib/evaluation.ts
@@ -2216,7 +2092,7 @@ const asBoolean = Match.type().pipe(Match.discriminatorsExhaustive("type")({
2216
2092
  object: () => true
2217
2093
  }));
2218
2094
  const asNumber = Match.type().pipe(Match.discriminatorsExhaustive("type")({
2219
- string: (value) => parseNumber$2(value.value),
2095
+ string: (value) => parseNumber$1(value.value),
2220
2096
  number: (value) => value.value,
2221
2097
  boolean: (value) => Number(value.value),
2222
2098
  null: () => NULL_NUMBER,
@@ -2515,7 +2391,7 @@ const BOUNDARY = /* @__PURE__ */ new Set([
2515
2391
  "&",
2516
2392
  "|"
2517
2393
  ]);
2518
- const SINGLE$20 = /* @__PURE__ */ new Map([
2394
+ const SINGLE$19 = /* @__PURE__ */ new Map([
2519
2395
  ["(", "("],
2520
2396
  [")", ")"],
2521
2397
  ["[", "["],
@@ -2600,7 +2476,7 @@ const lexString$1 = (src, start) => Result.fromOption(Option.map(stringEnd(src,
2600
2476
  }));
2601
2477
  const lexNumber = (src, start) => {
2602
2478
  const end = runEnd(src, start, (char) => !isBoundary(char) || char === ".");
2603
- const value = parseNumber$2(String$1.slice(start, end)(src));
2479
+ const value = parseNumber$1(String$1.slice(start, end)(src));
2604
2480
  if (Number.isNaN(value)) return Result.fail({
2605
2481
  message: "invalid numeric literal",
2606
2482
  offset: start
@@ -2659,7 +2535,7 @@ const lexPaired = (src, start) => pipe(Option.fromNullishOr(PAIRED[charAt$1(src)
2659
2535
  const lexDot = (start, previous) => Option.map(pipe(previous, Option.filter((tok) => DOT_AFTER.has(tok))), () => Result.succeed(simple(".", start, start + NEXT$17)));
2660
2536
  const lexSymbol = (src, start, previous) => {
2661
2537
  const char = charAt$1(src)(start);
2662
- return pipe(Option.fromNullishOr(SINGLE$20.get(char)), Option.map((tok) => Result.succeed(simple(tok, start, start + NEXT$17))), Option.orElse(() => lexPaired(src, start)), Option.orElse(() => Option.map(Option.liftPredicate(char, (each) => each === QUOTE$6), () => lexString$1(src, start))), Option.orElse(() => Option.flatMap(Option.liftPredicate(char, (each) => each === "."), () => lexDot(start, previous))));
2538
+ return pipe(Option.fromNullishOr(SINGLE$19.get(char)), Option.map((tok) => Result.succeed(simple(tok, start, start + NEXT$17))), Option.orElse(() => lexPaired(src, start)), Option.orElse(() => Option.map(Option.liftPredicate(char, (each) => each === QUOTE$6), () => lexString$1(src, start))), Option.orElse(() => Option.flatMap(Option.liftPredicate(char, (each) => each === "."), () => lexDot(start, previous))));
2663
2539
  };
2664
2540
  const lexOne = (src, start, previous) => Option.getOrElse(lexSymbol(src, start, previous), () => {
2665
2541
  if (NUMBER_START$1.test(charAt$1(src)(start))) return lexNumber(src, start);
@@ -2895,7 +2771,7 @@ const parseAll = (context) => {
2895
2771
  return Result.succeed(step.value);
2896
2772
  }));
2897
2773
  };
2898
- const parseExpression$1 = (src) => pipe(lex(src), Result.mapError((issue) => ({ message: issue.message })), Result.flatMap((tokens) => parseAll(contextFor(src, tokens))));
2774
+ const parseExpression = (src) => pipe(lex(src), Result.mapError((issue) => ({ message: issue.message })), Result.flatMap((tokens) => parseAll(contextFor(src, tokens))));
2899
2775
  // src/app/presets/entities/expression-tree/lib/walk.ts
2900
2776
  const COMMUTATIVE = /* @__PURE__ */ new Set([
2901
2777
  "and",
@@ -2985,8 +2861,8 @@ const commutativeMatches = (left) => (right) => {
2985
2861
  return commutativeMatches(left.lhs.expr)(right.lhs.expr) && commutativeMatches(left.rhs.expr)(right.rhs.expr) || COMMUTATIVE.has(left.op) && commutativeMatches(left.lhs.expr)(right.rhs.expr) && commutativeMatches(left.rhs.expr)(right.lhs.expr);
2986
2862
  };
2987
2863
  // src/app/presets/features/audit-workflows/lib/expressions.ts
2988
- const OPEN$4 = "${{";
2989
- const CLOSE$3 = "}}";
2864
+ const OPEN$3 = "${{";
2865
+ const CLOSE$2 = "}}";
2990
2866
  const QUOTE$5 = "'";
2991
2867
  const BRACE = "}";
2992
2868
  const START$9 = 0;
@@ -2994,7 +2870,7 @@ const NEXT$15 = 1;
2994
2870
  const STATIC_FLAG = 2;
2995
2871
  const extracted = (raw) => ({
2996
2872
  raw,
2997
- fenced: String$1.startsWith(OPEN$4)(raw) && String$1.endsWith(CLOSE$3)(raw)
2873
+ fenced: String$1.startsWith(OPEN$3)(raw) && String$1.endsWith(CLOSE$2)(raw)
2998
2874
  });
2999
2875
  const asBare = (expr) => {
3000
2876
  if (!expr.fenced) return expr.raw;
@@ -3002,7 +2878,7 @@ const asBare = (expr) => {
3002
2878
  };
3003
2879
  const parseBare = (raw) => {
3004
2880
  const bare = asBare(extracted(raw));
3005
- return Result.getSuccess(parseExpression$1(bare));
2881
+ return Result.getSuccess(parseExpression(bare));
3006
2882
  };
3007
2883
  const charAt = (view) => (index) => String$1.slice(index, index + NEXT$15)(view);
3008
2884
  const closingOf = (view) => (index, inString) => {
@@ -3022,7 +2898,7 @@ const fencedAt = (view, offset) => (start) => pipe(closingOf(view)(start, false)
3022
2898
  })));
3023
2899
  const extractFenced = (text) => (offset) => {
3024
2900
  const view = String$1.slice(offset)(text);
3025
- return pipe(view, String$1.indexOf(OPEN$4), Option.flatMap(fencedAt(view, offset)));
2901
+ return pipe(view, String$1.indexOf(OPEN$3), Option.flatMap(fencedAt(view, offset)));
3026
2902
  };
3027
2903
  const shifted = (bias) => (fenced) => ({
3028
2904
  expr: fenced.expr,
@@ -3406,7 +3282,7 @@ const expandsToStaticValues = (matrix) => (context) => {
3406
3282
  return !pipe(matrix.expansions, Array$1.some((expansion) => matchesPattern(expansion.path)(context) && !isStaticExpansion(expansion)));
3407
3283
  };
3408
3284
  // src/app/presets/features/audit-workflows/lib/workflow.ts
3409
- const SINGLE$19 = 1;
3285
+ const SINGLE$18 = 1;
3410
3286
  const DANGEROUS_TRIGGERS = [
3411
3287
  "pull_request_target",
3412
3288
  "workflow_run",
@@ -3431,7 +3307,7 @@ const triggerLocation = (workflow, event) => {
3431
3307
  return withKeys(syntax.events.indexOf(event))(parent);
3432
3308
  };
3433
3309
  const triggerAt = (event) => (workflow) => Option.liftPredicate(triggerLocation(workflow, event), () => hasEvent(workflow)(event));
3434
- const hasSingleTrigger = (workflow) => workflow.model.on.events.size === SINGLE$19;
3310
+ const hasSingleTrigger = (workflow) => workflow.model.on.events.size === SINGLE$18;
3435
3311
  const isReusableOnly = (workflow) => hasEvent(workflow)("workflow_call") && hasSingleTrigger(workflow);
3436
3312
  const isCacheWriteTrigger = (workflow) => pipe(CACHE_WRITE_EVENTS, Array$1.some((event) => hasEvent(workflow)(event)));
3437
3313
  const callCapability = (type) => {
@@ -3793,11 +3669,11 @@ const withConfig = (known) => (raw) => pipe(loadConfig(known)(raw.rules), Result
3793
3669
  online: raw.online !== false,
3794
3670
  githubHost: raw.githubHost ?? "github.com"
3795
3671
  })));
3796
- const parse$3 = (known) => (raw) => pipe(decodeSettings(raw), Result.mapError((issue) => `invalid zizmor setting: ${issue.message}`), Result.flatMap(withConfig(known)));
3672
+ const parse$2 = (known) => (raw) => pipe(decodeSettings(raw), Result.mapError((issue) => `invalid zizmor setting: ${issue.message}`), Result.flatMap(withConfig(known)));
3797
3673
  const settingsOf$1 = (known) => {
3798
3674
  const cache = /* @__PURE__ */ new WeakMap();
3799
3675
  const cached = (value) => {
3800
- const parsed = parse$3(known)(value);
3676
+ const parsed = parse$2(known)(value);
3801
3677
  cache.set(value, parsed);
3802
3678
  return parsed;
3803
3679
  };
@@ -4194,7 +4070,7 @@ const spanLocation = (input) => (annotation) => (span) => ({
4194
4070
  });
4195
4071
  // src/app/presets/features/audit-workflows/lib/secret-count.ts
4196
4072
  const NONE$12 = 0;
4197
- const ONE$5 = 1;
4073
+ const ONE$4 = 1;
4198
4074
  const none$1 = () => NONE$12;
4199
4075
  const total = (count) => (items) => Array$1.reduce(items, NONE$12, (sum, item) => sum + count(item));
4200
4076
  const counted = ({ func, hits, context }) => {
@@ -4203,7 +4079,7 @@ const counted = ({ func, hits, context }) => {
4203
4079
  star: none$1,
4204
4080
  identifier: none$1,
4205
4081
  call: (expr) => Boolean$1.match(expr.func === func && pipe(expr.args, Array$1.some(hits)), {
4206
- onTrue: () => ONE$5,
4082
+ onTrue: () => ONE$4,
4207
4083
  onFalse: () => total(count)(expr.args)
4208
4084
  }),
4209
4085
  index: (expr) => count(expr.inner),
@@ -4229,7 +4105,7 @@ const secretAudit = (counter) => {
4229
4105
  };
4230
4106
  // src/app/presets/features/audit-workflows/model/rules/overprovisioned-secrets.ts
4231
4107
  const isSecrets = matchesPattern("secrets");
4232
- const ONE$4 = 1;
4108
+ const ONE$3 = 1;
4233
4109
  const isSecretsHead = (head) => head.expr.type === "identifier" && String$1.toLowerCase(head.expr.name) === "secrets";
4234
4110
  const isDynamicIndex = (index) => index.expr.type === "index" && index.expr.inner.expr.type !== "literal";
4235
4111
  const isDynamicSecretIndex = (parts) => Array$1.match(parts, {
@@ -4246,7 +4122,7 @@ const overprovisionedSecrets = secretAudit({
4246
4122
  func: "tojson",
4247
4123
  hits: (arg) => arg.expr.type === "context" && isSecrets(arg.expr),
4248
4124
  context: (count) => (expr) => Boolean$1.match(isDynamicSecretIndex(expr.parts), {
4249
- onTrue: () => ONE$4,
4125
+ onTrue: () => ONE$3,
4250
4126
  onFalse: () => total(count)(expr.parts)
4251
4127
  })
4252
4128
  });
@@ -4770,7 +4646,7 @@ const bashTargets = (node) => {
4770
4646
  return [];
4771
4647
  };
4772
4648
  const bashDestinations = (nodes) => matching$1(BASH_DESTINATION)(pipe(nodes, Array$1.flatMap(bashTargets)));
4773
- const SINGLE$18 = 1;
4649
+ const SINGLE$17 = 1;
4774
4650
  const NEXT$13 = 1;
4775
4651
  const RUNNER_VARIABLES = /* @__PURE__ */ new Set([
4776
4652
  "GITHUB_WORKSPACE",
@@ -4781,7 +4657,7 @@ const RUNNER_VARIABLES = /* @__PURE__ */ new Set([
4781
4657
  ]);
4782
4658
  const isRunnerExpansion = (node) => node.type === "simple_expansion" && pipe(namedOfType("variable_name")(node), Array$1.every((name) => RUNNER_VARIABLES.has(name.text)));
4783
4659
  const isRunnerPath = (arg) => arg.type === "string" && pipe(arg.namedChildren, Array$1.every((child) => isType("string_content")(child) || isRunnerExpansion(child)));
4784
- const isSafeArg = (arg) => isType("word", "raw_string")(arg) || arg.namedChildren.length === SINGLE$18 && pipe(arg.namedChildren, Array$1.every(isType("string_content"))) || isRunnerPath(arg);
4660
+ const isSafeArg = (arg) => isType("word", "raw_string")(arg) || arg.namedChildren.length === SINGLE$17 && pipe(arg.namedChildren, Array$1.every(isType("string_content"))) || isRunnerPath(arg);
4785
4661
  const isStaticEcho = (command) => Option.exists(fieldTextOf("name")(command), (name) => ECHOES.has(name)) && pipe(fieldsOf$5("argument")(command), Array$1.filter((arg) => arg.named), Array$1.every(isSafeArg));
4786
4662
  const isFlaggedCommand = (command) => command.type === "command" && fieldOf$2("name")(command).pipe(ofType("command_name"), Option.isSome) && !isStaticEcho(command);
4787
4663
  const bashRedirects = (statement) => pipe(statement.namedChildren, Array$1.flatMap((command, index) => {
@@ -9798,7 +9674,7 @@ const orOperands = (spanned) => {
9798
9674
  return [spanned];
9799
9675
  };
9800
9676
  const LAST$1 = 1;
9801
- const SINGLE$17 = 1;
9677
+ const SINGLE$16 = 1;
9802
9678
  const ANNOTATION$2 = pipe(rootLocation(""), annotated("pseudo-ternary has falsy true value"), primary);
9803
9679
  const falsyTrueValue = (operand) => {
9804
9680
  const { expr } = operand;
@@ -9808,7 +9684,7 @@ const falsyTrueValue = (operand) => {
9808
9684
  const unsoundTrueValues = (spanned) => {
9809
9685
  if (isConstant$1(spanned)) return [];
9810
9686
  const operands = orOperands(spanned);
9811
- if (operands.length > SINGLE$17) return [...pipe(operands, Array$1.dropRight(LAST$1), Array$1.flatMap(falsyTrueValue)), ...pipe(operands, Array$1.flatMap(unsoundTrueValues))];
9687
+ if (operands.length > SINGLE$16) return [...pipe(operands, Array$1.dropRight(LAST$1), Array$1.flatMap(falsyTrueValue)), ...pipe(operands, Array$1.flatMap(unsoundTrueValues))];
9812
9688
  return pipe(childrenOf(spanned.expr), Array$1.flatMap(unsoundTrueValues));
9813
9689
  };
9814
9690
  // src/app/presets/features/audit-workflows/model/concerns/injection.ts
@@ -10935,11 +10811,11 @@ const NONE$11 = 0;
10935
10811
  const NEXT$12 = 1;
10936
10812
  const PAIR$2 = 2;
10937
10813
  const ASCII_LIMIT = 127;
10938
- const FIRST$6 = 0;
10814
+ const FIRST$5 = 0;
10939
10815
  const VERSION_SUFFIX = /[0-9]+$/u;
10940
10816
  const DASH_SUFFIX = /-+$/u;
10941
10817
  const WORD_DELIMITER = /[-_/]/u;
10942
- const isAscii = (char) => Option.exists(pipe(char, String$1.codePointAt(FIRST$6)), (code) => code <= ASCII_LIMIT);
10818
+ const isAscii = (char) => Option.exists(pipe(char, String$1.codePointAt(FIRST$5)), (code) => code <= ASCII_LIMIT);
10943
10819
  const charsOf = (text) => Array$1.fromIterable(text);
10944
10820
  const joined = (chars) => Array$1.join(chars, "");
10945
10821
  const ownerOf = (slug) => Option.getOrElse(Array$1.head(String$1.split("/")(slug)), () => slug);
@@ -11038,7 +10914,7 @@ const typosquatUses = {
11038
10914
  preCommitRepo: repoTargetCheck(check$4)
11039
10915
  };
11040
10916
  // src/app/presets/features/audit-workflows/model/rules/unpinned-images-candidates.ts
11041
- const SINGLE$16 = 1;
10917
+ const SINGLE$15 = 1;
11042
10918
  const concrete = (image, location, related) => {
11043
10919
  if (String$1.isEmpty(image.image) || Option.isSome(image.hash)) return Option.none();
11044
10920
  const [annotation, level] = Option.match(image.tag, {
@@ -11095,7 +10971,7 @@ const candidatesOf = (matrix) => ([image, location]) => {
11095
10971
  onNone: () => [opaque(location, [])],
11096
10972
  onSome: (parsed) => {
11097
10973
  const leaves = leafExpressions(parsed);
11098
- const single = leaves.length === SINGLE$16;
10974
+ const single = leaves.length === SINGLE$15;
11099
10975
  return pipe(leaves, Array$1.flatMap((leaf) => forLeaf(leaf, leafLocation(single, location)(leaf), matrix)));
11100
10976
  }
11101
10977
  });
@@ -11326,7 +11202,7 @@ const PUBLISHERS = [
11326
11202
  ...fixedAll(DEPLOYERS)
11327
11203
  ];
11328
11204
  // src/app/presets/features/audit-workflows/model/rules/cache-poisoning-control.ts
11329
- const TAG_PUSH_GUARD = Result.getOrThrow(parseExpression$1("github.event_name == 'push' && github.ref_type == 'tag'")).expr;
11205
+ const TAG_PUSH_GUARD = Result.getOrThrow(parseExpression("github.event_name == 'push' && github.ref_type == 'tag'")).expr;
11330
11206
  const TAG = { type: "tag" };
11331
11207
  const TAG_PREFIX = "refs/tags/";
11332
11208
  const STARTSWITH_ARGS = 2;
@@ -11603,7 +11479,7 @@ const jobVerdict = (permissions, explicitParent, location) => {
11603
11479
  ], () => !explicitParent);
11604
11480
  return Option.some(baseVerdict(permissions.base, location));
11605
11481
  };
11606
- const SINGLE$15 = 1;
11482
+ const SINGLE$14 = 1;
11607
11483
  const personaFor = (pedantic) => Boolean$1.match(pedantic, {
11608
11484
  onTrue: () => "pedantic",
11609
11485
  onFalse: () => "regular"
@@ -11615,7 +11491,7 @@ const excessivePermissions = {
11615
11491
  const allExplicit = pipe(jobs, Array$1.every((job) => !isDefault(job.job.model.permissions)));
11616
11492
  const explicitParent = !isDefault(workflow.model.permissions);
11617
11493
  const reusableOnly = isReusableOnly(workflow);
11618
- const workflowPersona = personaFor(workflow.model.jobs.length === SINGLE$15 || allExplicit || reusableOnly);
11494
+ const workflowPersona = personaFor(workflow.model.jobs.length === SINGLE$14 || allExplicit || reusableOnly);
11619
11495
  const workflowAt = primary(workflowLocation(workflow));
11620
11496
  const own = Array$1.map(workflowVerdicts(workflow.model.permissions, workflowAt), ([level, certainty, location]) => pipe(finding(meta$3), severity(level), confidence(certainty), persona(workflowPersona), at$2(location)));
11621
11497
  const perJob = pipe(jobs, Array$1.flatMap((job) => {
@@ -11844,6 +11720,211 @@ const rulesOf = (audits) => {
11844
11720
  };
11845
11721
  const zizmorPlugin = definePlugin({ rules: rulesOf(AUDITS) });
11846
11722
  const ZIZMOR_CONCERNS = pipe(CONCERNS, Record.map(identsOf));
11723
+ // src/app/presets/shared/project-cache/index.ts
11724
+ const projectCache = () => {
11725
+ const cache = /* @__PURE__ */ new WeakMap();
11726
+ const entriesOf = (project) => cache.getOrInsertComputed(project, () => /* @__PURE__ */ new Map());
11727
+ return {
11728
+ get: (project) => (key) => Option.fromNullishOr(entriesOf(project).get(key)),
11729
+ set: (project) => (key, value) => {
11730
+ entriesOf(project).set(key, value);
11731
+ }
11732
+ };
11733
+ };
11734
+ // src/app/presets/shared/uses/index.ts
11735
+ const LOCAL = "./";
11736
+ const SELF_REPOSITORY = "$/";
11737
+ const localPath = (spec) => Option.orElse(afterPrefix(LOCAL)(spec), () => afterPrefix(SELF_REPOSITORY)(spec));
11738
+ const isSelfReferenceWithRef = (spec) => Option.exists(afterPrefix(SELF_REPOSITORY)(spec), String$1.includes("@"));
11739
+ const selfReferenceError = (spec) => `self repository reference ${quote(spec)} must not include @{ref}. "$/" always resolves to the commit of the running workflow. see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsuses`;
11740
+ // src/app/presets/entities/workflow/model/reusable.ts
11741
+ const EMPTY_METADATA = {
11742
+ inputs: {},
11743
+ outputs: {},
11744
+ secrets: {}
11745
+ };
11746
+ // src/app/presets/entities/workflow/lib/reusable-sections.ts
11747
+ const KINDS = {
11748
+ boolean: "boolean",
11749
+ number: "number",
11750
+ string: "string"
11751
+ };
11752
+ const fieldsOf$2 = (sink, node) => ({
11753
+ required: flagAt(sink)("required")(node),
11754
+ defaulted: Option.exists(valueAt("default")(node), (value) => Option.isSome(decodeOptionalString(sink)(value))),
11755
+ type: Option.match(valueAt("type")(node), {
11756
+ onNone: () => "",
11757
+ onSome: decodeString(sink)
11758
+ })
11759
+ });
11760
+ const inputOf$1 = (sink) => (name, node) => {
11761
+ if (isNull(node)) return Option.some({
11762
+ name,
11763
+ required: false,
11764
+ kind: "any"
11765
+ });
11766
+ if (node.kind !== "mapping") {
11767
+ typeError(sink)(node, "actionlint.metadata");
11768
+ return Option.none();
11769
+ }
11770
+ let failed = false;
11771
+ const fields = fieldsOf$2((message) => {
11772
+ failed = true;
11773
+ sink(message);
11774
+ }, node);
11775
+ return pipe(Option.liftPredicate(fields, () => !failed), Option.map((found) => ({
11776
+ name,
11777
+ required: found.required && !found.defaulted,
11778
+ kind: Option.getOrElse(Record.get(KINDS, found.type), () => "any")
11779
+ })));
11780
+ };
11781
+ const inputsOf$1 = (sink) => (node) => {
11782
+ let out = {};
11783
+ if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.inputs")) return out;
11784
+ for (const { key, value } of pairsOf(node)) {
11785
+ const input = inputOf$1(sink)(key.value, value);
11786
+ if (Option.isNone(input)) return out;
11787
+ out = Record.set(out, lowerKey(key), input.value);
11788
+ }
11789
+ return out;
11790
+ };
11791
+ const secretRequired = (sink, node) => {
11792
+ if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadataSecret")) return Option.liftPredicate(false, () => isNull(node));
11793
+ let required = false;
11794
+ let failed = false;
11795
+ const local = (message) => {
11796
+ failed = true;
11797
+ sink(message);
11798
+ };
11799
+ for (const { key, value } of pairsOf(node)) if (key.value === "required") required = decodeBoolean(local)(value);
11800
+ return Option.liftPredicate(required, () => !failed);
11801
+ };
11802
+ const secretsOf = (sink) => (node) => {
11803
+ let out = {};
11804
+ if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.secrets")) return out;
11805
+ for (const { key, value } of pairsOf(node)) {
11806
+ const required = secretRequired(sink, value);
11807
+ if (Option.isNone(required)) return out;
11808
+ out = Record.set(out, lowerKey(key), {
11809
+ name: key.value,
11810
+ required: required.value
11811
+ });
11812
+ }
11813
+ return out;
11814
+ };
11815
+ const outputsOf$1 = (sink) => (node) => {
11816
+ if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.outputs")) return {};
11817
+ return Record.fromEntries(pipe(pairsOf(node), Array$1.map(({ key }) => [lowerKey(key), key.value])));
11818
+ };
11819
+ // src/app/presets/entities/workflow/lib/reusable.ts
11820
+ const CALL = "workflow_call";
11821
+ const isCall = (node) => String$1.toLowerCase(node.value) === CALL;
11822
+ const metadataOf$2 = (sink, node) => {
11823
+ if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadata")) return EMPTY_METADATA;
11824
+ const section = (key) => valueAt(key)(node);
11825
+ return {
11826
+ inputs: pipe(section("inputs"), Option.map(inputsOf$1(sink)), Option.getOrElse(() => ({}))),
11827
+ outputs: pipe(section("outputs"), Option.map(outputsOf$1(sink)), Option.getOrElse(() => ({}))),
11828
+ secrets: pipe(section("secrets"), Option.map(secretsOf(sink)), Option.getOrElse(() => ({})))
11829
+ };
11830
+ };
11831
+ const decodeCall = (node) => {
11832
+ const errors = [];
11833
+ const metadata = metadataOf$2((message) => {
11834
+ errors.push(message);
11835
+ }, node);
11836
+ if (Array$1.isReadonlyArrayEmpty(errors)) return Result.succeed(metadata);
11837
+ return Result.fail(`yaml: unmarshal errors:\n ${Array$1.join(errors, "\n ")}`);
11838
+ };
11839
+ const fromOn = (on) => {
11840
+ const call = pipe(pairsOf(on), Array$1.findFirst((pair) => isCall(pair.key)));
11841
+ if (on.kind === "mapping" && Option.isSome(call)) return decodeCall(call.value.value);
11842
+ if (on.kind === "scalar" && isCall(on) || on.kind === "sequence" && pipe(on.children, Array$1.some(isCall))) return Result.succeed(EMPTY_METADATA);
11843
+ return Result.fail(`"workflow_call" event trigger is not found in "on:" at line:${String(on.line)}, column:${String(on.column)}`);
11844
+ };
11845
+ const reusableOf = readYaml((source) => {
11846
+ const on = pipe(Option.fromNullishOr(source.yaml), Option.filter((root) => root.kind === "mapping"), Option.flatMap(valueAt("on")));
11847
+ if (Option.isNone(on)) return Result.fail("\"on:\" is not found");
11848
+ return fromOn(on.value);
11849
+ });
11850
+ // src/app/presets/entities/workflow/lib/local-workflows.ts
11851
+ const reusables = projectCache();
11852
+ const unreadable = (spec, relative) => Result.fail(`could not read reusable workflow file for ${quote(spec)}: open ${relative}: no such file or directory`);
11853
+ const load$1 = (project, spec, relative) => Option.match(project.parse(relative), {
11854
+ onNone: () => unreadable(spec, relative),
11855
+ onSome: (source) => Result.mapError(reusableOf(source), (message) => `error while parsing reusable workflow ${quote(spec)}: ${String$1.replaceAll("\n", " ")(message)}`)
11856
+ });
11857
+ const findReusable = (project) => (spec) => {
11858
+ const relative = Option.filter(localPath(spec), () => !containsExpression(spec));
11859
+ if (Option.isNone(relative)) return Option.none();
11860
+ const hit = reusables.get(project)(spec);
11861
+ if (Option.isSome(hit)) return hit.value;
11862
+ const loaded = Option.some(load$1(project, spec, relative.value));
11863
+ reusables.set(project)(spec, pipe(loaded, Option.filter((found) => Result.isSuccess(found))));
11864
+ return loaded;
11865
+ };
11866
+ const skipReusable = (project) => (spec) => {
11867
+ reusables.set(project)(spec, Option.none());
11868
+ };
11869
+ // src/app/presets/entities/workflow/lib/raw-compare.ts
11870
+ const sameProps = (compare, mine, theirs) => Record.size(mine) === Record.size(theirs) && pipe(Record.toEntries(mine), Array$1.every(([name, value]) => Option.exists(Record.get(theirs, name), (other) => compare(value)(other))));
11871
+ const sameElems = (compare, mine, theirs) => mine.length === theirs.length && pipe(Array$1.zip(mine, theirs), Array$1.every(([left, right]) => compare(left)(right)));
11872
+ const rawEquals = (left) => (right) => {
11873
+ if (left.type === "object" && right.type === "object") return sameProps(rawEquals, left.props, right.props);
11874
+ if (left.type === "array" && right.type === "array") return sameElems(rawEquals, left.elems, right.elems);
11875
+ return left.type === "string" && right.type === "string" && left.value === right.value;
11876
+ };
11877
+ const rawDescribe = (value) => {
11878
+ if (value.type === "object") {
11879
+ const parts = pipe(Record.toEntries(value.props), Array$1.map(([name, prop]) => `${quote(name)}: ${rawDescribe(prop)}`));
11880
+ return `{${Array$1.join(Array$1.sort(parts, Order.String), ", ")}}`;
11881
+ }
11882
+ if (value.type === "array") return `[${pipe(value.elems, Array$1.map(rawDescribe), Array$1.join(", "))}]`;
11883
+ return quote(value.value);
11884
+ };
11885
+ const isExpression = (value) => value.type === "string" && containsExpression(value.value);
11886
+ const objectSubset = (compare, value, sub) => value.type === "object" && sub.type === "object" && pipe(Record.toEntries(sub.props), Array$1.every(([name, each]) => Option.exists(Record.get(value.props, name), (prop) => compare(prop)(each))));
11887
+ const isSubset = (value) => (sub) => {
11888
+ if (isExpression(sub)) return true;
11889
+ if (value.type === "object") return objectSubset(isSubset, value, sub);
11890
+ if (value.type === "array") return sub.type === "array" && sameElems(isSubset, value.elems, sub.elems);
11891
+ return containsExpression(value.value) || rawEquals(value)(sub);
11892
+ };
11893
+ // src/app/presets/features/check-practices/model/full-history-checkout.ts
11894
+ const DEPTH = "fetch-depth";
11895
+ const WHOLE_HISTORY = "0";
11896
+ /** @internal */
11897
+ const fullHistoryCheckout = workflowRule({
11898
+ description: "Reports fetch-depth: 0, because the whole history is downloaded on every run and grows with the repository",
11899
+ docs: "https://github.com/actions/checkout#fetch-all-history-for-all-tags-and-branches",
11900
+ visitor: (fail) => ({
11901
+ ...NOOP,
11902
+ step: (step) => {
11903
+ const depths = pipe(actionOf(step), Option.flatMap(({ inputs }) => Option.fromNullishOr(inputs)), Option.flatMap(Record.get(DEPTH)), Option.filter((input) => input.value.value === WHOLE_HISTORY), Option.toArray);
11904
+ for (const input of depths) fail(input.name, "fetches the whole history with `fetch-depth: 0`. The download grows with the repository on every run. Fetch only the commits the job reads.");
11905
+ }
11906
+ })
11907
+ });
11908
+ // src/app/presets/features/check-practices/model/workflow-cancel.ts
11909
+ const PUSH = "push";
11910
+ /** @internal */
11911
+ const workflowCancel = workflowRule({
11912
+ description: "Reports cancel-in-progress on the concurrency of a workflow that a push starts, because a newer push then stops a deploy that is running and leaves it half done",
11913
+ docs: "https://docs.github.com/en/actions/using-jobs/using-concurrency",
11914
+ visitor: (fail) => ({
11915
+ ...NOOP,
11916
+ workflowPre: (workflow) => {
11917
+ const pushed = pipe(Option.fromNullishOr(workflow.on), Option.getOrElse(() => []), Array$1.some((event) => event.type === "webhook" && event.hook.value === PUSH));
11918
+ const cancels = pipe(Option.fromNullishOr(workflow.concurrency), Option.flatMap(({ cancelInProgress }) => Option.fromNullishOr(cancelInProgress)), Option.filter(({ value }) => pushed && value), Option.toArray);
11919
+ for (const found of cancels) fail(found, "cancels in progress for the whole workflow that a push starts. A newer push then stops a deploy that is running and leaves it half done. Put `cancel-in-progress: true` on the `concurrency` of the jobs that a later push redoes, and leave the deploy and release jobs on the default.");
11920
+ }
11921
+ })
11922
+ });
11923
+ // src/app/presets/features/check-practices/index.ts
11924
+ const practicesPlugin = definePlugin({ rules: {
11925
+ "workflow-cancel": workflowCancel,
11926
+ "full-history-checkout": fullHistoryCheckout
11927
+ } });
11847
11928
  // src/app/presets/features/check-workflows/lib/settings.ts
11848
11929
  const Names = Schema.String.pipe(Schema.Array, Schema.NullOr);
11849
11930
  const Runner = Schema.Struct({ labels: Schema.optional(Names) });
@@ -11852,15 +11933,15 @@ const ActionlintSettings = Schema.Struct({
11852
11933
  "config-variables": Schema.optional(Names)
11853
11934
  });
11854
11935
  const decode = Schema.decodeUnknownOption(ActionlintSettings);
11855
- const parsed$2 = /* @__PURE__ */ new WeakMap();
11856
- const parse$2 = (raw) => {
11936
+ const parsed$1 = /* @__PURE__ */ new WeakMap();
11937
+ const parse$1 = (raw) => {
11857
11938
  const found = pipe(Record.get(raw, "actionlint"), Option.flatMap(decode));
11858
11939
  return {
11859
11940
  runnerLabels: pipe(found, Option.flatMap((settings) => Option.fromNullishOr(settings["self-hosted-runner"])), Option.flatMap((runner) => Option.fromNullishOr(runner.labels)), Option.getOrElse(() => [])),
11860
11941
  configVariables: pipe(found, Option.flatMap((settings) => Option.fromNullishOr(settings["config-variables"])))
11861
11942
  };
11862
11943
  };
11863
- const settingsOf = (context) => parsed$2.getOrInsertComputed(context.settings, () => parse$2(context.settings));
11944
+ const settingsOf = (context) => parsed$1.getOrInsertComputed(context.settings, () => parse$1(context.settings));
11864
11945
  // src/app/presets/entities/expression/model/ast.ts
11865
11946
  const tokenOf = (expr) => {
11866
11947
  if (expr.type === "object-deref" || expr.type === "array-deref") return tokenOf(expr.receiver);
@@ -11875,15 +11956,15 @@ const NULL = { kind: "null" };
11875
11956
  const NUMBER$1 = { kind: "number" };
11876
11957
  const BOOL = { kind: "bool" };
11877
11958
  const STRING = { kind: "string" };
11878
- const EMPTY$2 = Record.empty();
11959
+ const EMPTY = Record.empty();
11879
11960
  const objectOf = (props) => (mapped) => ({
11880
11961
  kind: "object",
11881
11962
  props,
11882
11963
  mapped
11883
11964
  });
11884
- const strict = (props = EMPTY$2) => objectOf(props)(Option.none());
11885
- const loose = (props = EMPTY$2) => objectOf(props)(Option.some(ANY));
11886
- const mapOf = (elem) => objectOf(EMPTY$2)(Option.some(elem));
11965
+ const strict = (props = EMPTY) => objectOf(props)(Option.none());
11966
+ const loose = (props = EMPTY) => objectOf(props)(Option.some(ANY));
11967
+ const mapOf = (elem) => objectOf(EMPTY)(Option.some(elem));
11887
11968
  const arrayOf = (elem) => ({
11888
11969
  kind: "array",
11889
11970
  elem,
@@ -12434,8 +12515,8 @@ const KEYS = {
12434
12515
  }
12435
12516
  };
12436
12517
  const workflowKey = (key) => Record.get(KEYS, key);
12437
- const byKey$1 = Order.mapInput(Order.String, ([key]) => key);
12438
- const SPECIAL = pipe(Array$1.sort(Record.toEntries(KEYS), byKey$1), Array$1.flatMap(([key, found]) => pipe(found.functions, Array$1.map((name) => [name, key]))), Array$1.groupBy(([name]) => name), Record.map((pairs) => pipe(pairs, Array$1.map(([, key]) => key))));
12518
+ const byKey = Order.mapInput(Order.String, ([key]) => key);
12519
+ const SPECIAL = pipe(Array$1.sort(Record.toEntries(KEYS), byKey), Array$1.flatMap(([key, found]) => pipe(found.functions, Array$1.map((name) => [name, key]))), Array$1.groupBy(([name]) => name), Record.map((pairs) => pipe(pairs, Array$1.map(([, key]) => key))));
12439
12520
  // src/app/presets/entities/expression/lib/check-array-deref.ts
12440
12521
  const DEREF_ANY = filteredOf(ANY);
12441
12522
  const fromMapped = (scope, expr) => (object, mapped) => {
@@ -12498,7 +12579,7 @@ const ofJson = (value) => {
12498
12579
  };
12499
12580
  // src/app/presets/entities/expression/lib/format-placeholders.ts
12500
12581
  const NEXT$11 = 1;
12501
- const FIRST$5 = 0;
12582
+ const FIRST$4 = 0;
12502
12583
  const ODD = 2;
12503
12584
  const DIGIT$1 = /^\d$/u;
12504
12585
  const NUMBER = /^\d+$/u;
@@ -12560,7 +12641,7 @@ const formatPlaceholders = (format) => {
12560
12641
  const chars = codePoints(format);
12561
12642
  const found = /* @__PURE__ */ new Set();
12562
12643
  let scan = IDLE$1;
12563
- for (let index = FIRST$5; index <= chars.length; index += NEXT$11) {
12644
+ for (let index = FIRST$4; index <= chars.length; index += NEXT$11) {
12564
12645
  const next = step$2(chars, scan, index);
12565
12646
  for (const value of Option.toArray(next.found)) found.add(value);
12566
12647
  scan = next;
@@ -12570,7 +12651,7 @@ const formatPlaceholders = (format) => {
12570
12651
  // src/app/presets/entities/expression/lib/json.ts
12571
12652
  const OK = Option.none();
12572
12653
  const NEXT$10 = 1;
12573
- const FIRST$4 = 0;
12654
+ const FIRST$3 = 0;
12574
12655
  const HEX_DIGITS = 4;
12575
12656
  const CONTROL_END = 32;
12576
12657
  const SPACES = /* @__PURE__ */ new Set([
@@ -12658,7 +12739,7 @@ const escape = (scan) => {
12658
12739
  if (at$1(scan, "u")) return unicode(scan);
12659
12740
  return invalid(scan, "in string escape code");
12660
12741
  };
12661
- const isControl = (scan) => Option.exists(Option.flatMap(scan.peek(), String$1.codePointAt(FIRST$4)), (code) => code < CONTROL_END);
12742
+ const isControl = (scan) => Option.exists(Option.flatMap(scan.peek(), String$1.codePointAt(FIRST$3)), (code) => code < CONTROL_END);
12662
12743
  const stringStep = (scan) => {
12663
12744
  if (Option.isNone(scan.peek()) || isControl(scan)) return Option.some(invalid(scan, "in string literal"));
12664
12745
  if (at$1(scan, "\"")) {
@@ -12735,7 +12816,7 @@ const value = (scan) => {
12735
12816
  };
12736
12817
  const scannerOf = (text) => {
12737
12818
  const bytes = new TextEncoder().encode(text);
12738
- let position = FIRST$4;
12819
+ let position = FIRST$3;
12739
12820
  return {
12740
12821
  peek: () => pipe(Option.fromNullishOr(bytes[position]), Option.map((byte) => String.fromCodePoint(byte))),
12741
12822
  skip: () => {
@@ -12771,12 +12852,12 @@ const checkFormat = (scope, call, format) => {
12771
12852
  return call.ret;
12772
12853
  };
12773
12854
  const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
12774
- const parsed$1 = (call, text) => Option.match(decodeJson(text), {
12855
+ const parsed = (call, text) => Option.match(decodeJson(text), {
12775
12856
  onNone: () => call.ret,
12776
12857
  onSome: ofJson
12777
12858
  });
12778
12859
  const checkFromJson = (scope, call, { literal, text }) => Option.match(checkJson(text), {
12779
- onNone: () => parsed$1(call, text),
12860
+ onNone: () => parsed(call, text),
12780
12861
  onSome: (error) => {
12781
12862
  scope.fail(literal, `broken JSON string is passed to fromJSON() at offset ${String(error.offset)}: ${error.message}`);
12782
12863
  return call.ret;
@@ -13064,10 +13145,10 @@ const LITERALS$1 = {
13064
13145
  float: NUMBER$1
13065
13146
  };
13066
13147
  const NONE$9 = 0;
13067
- const ONE$3 = 1;
13148
+ const ONE$2 = 1;
13068
13149
  const contextNote = (contexts) => {
13069
13150
  if (contexts.length === NONE$9) return "no context is available here";
13070
- if (contexts.length === ONE$3) return `available context is ${quotes(contexts)}`;
13151
+ if (contexts.length === ONE$2) return `available context is ${quotes(contexts)}`;
13071
13152
  return `available contexts are ${quotes(contexts)}`;
13072
13153
  };
13073
13154
  const checkContext = (scope, expr, name) => {
@@ -13284,7 +13365,7 @@ const SAFE = /* @__PURE__ */ new Set([
13284
13365
  ]);
13285
13366
  const STEP = 1;
13286
13367
  const NONE$8 = 0;
13287
- const SINGLE$14 = 1;
13368
+ const SINGLE$13 = 1;
13288
13369
  const IDLE = {
13289
13370
  filtering: false,
13290
13371
  cur: [],
@@ -13292,7 +13373,7 @@ const IDLE = {
13292
13373
  };
13293
13374
  const isSafeCall = (expr) => expr.type === "call" && SAFE.has(String$1.toLowerCase(expr.callee));
13294
13375
  const messageOf$1 = (inputs) => {
13295
- if (inputs.length === SINGLE$14) return `${quote(Array$1.join(inputs, ""))} is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. ${ADVICE}`;
13376
+ if (inputs.length === SINGLE$13) return `${quote(Array$1.join(inputs, ""))} is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. ${ADVICE}`;
13296
13377
  return `object filter extracts potentially untrusted properties ${sortedQuotes(inputs)}. avoid using the value directly in inline scripts. instead, pass the value through an environment variable. ${ADVICE}`;
13297
13378
  };
13298
13379
  const ended = (walk) => {
@@ -13615,7 +13696,7 @@ const parseFloat = (stream) => {
13615
13696
  stream.fail(`parsing invalid float literal ${quote(text)}: strconv.ParseFloat: parsing ${quote(text)}: value out of range`);
13616
13697
  return Option.none();
13617
13698
  };
13618
- const parseString$1 = (stream) => {
13699
+ const parseString = (stream) => {
13619
13700
  const token = stream.next();
13620
13701
  const inner = String$1.replaceAll(STRING_DELIMITERS, "")(token.value);
13621
13702
  return Option.some({
@@ -13629,31 +13710,31 @@ const PARSERS = {
13629
13710
  "(": parseNested,
13630
13711
  INTEGER: () => parseInt,
13631
13712
  FLOAT: () => parseFloat,
13632
- STRING: () => parseString$1
13713
+ STRING: () => parseString
13633
13714
  };
13634
13715
  const parsePrimary = (parseOr) => (stream) => pipe(Record.get(PARSERS, stream.peek()), Option.match({
13635
13716
  onNone: () => unexpected$2(stream)("variable access, function call, null, bool, int, float or string", PRIMARY),
13636
13717
  onSome: (parser) => parser(parseOr)(stream)
13637
13718
  }));
13638
13719
  // src/app/presets/entities/expression/lib/cursor.ts
13639
- const FIRST$3 = 1;
13720
+ const FIRST$2 = 1;
13640
13721
  const NEWLINE$1 = "\n";
13641
13722
  const ORIGIN$1 = {
13642
13723
  offset: 0,
13643
- line: FIRST$3,
13644
- column: FIRST$3
13724
+ line: FIRST$2,
13725
+ column: FIRST$2
13645
13726
  };
13646
13727
  const peek = (src) => (at) => pipe(String$1.codePointAt(at.offset)(src), Option.map((point) => String.fromCodePoint(point)));
13647
13728
  const after$2 = (at, char) => {
13648
13729
  if (char === NEWLINE$1) return {
13649
13730
  offset: at.offset + char.length,
13650
- line: at.line + FIRST$3,
13651
- column: FIRST$3
13731
+ line: at.line + FIRST$2,
13732
+ column: FIRST$2
13652
13733
  };
13653
13734
  return {
13654
13735
  offset: at.offset + char.length,
13655
13736
  line: at.line,
13656
- column: at.column + FIRST$3
13737
+ column: at.column + FIRST$2
13657
13738
  };
13658
13739
  };
13659
13740
  const advance$2 = (src) => (at) => pipe(peek(src)(at), Option.match({
@@ -13799,7 +13880,7 @@ const lexNum = (scan) => {
13799
13880
  const ALPHA = "'a'..'z', 'A'..'Z', '_'";
13800
13881
  const WHITE = /^[\t\n\r ]$/u;
13801
13882
  const QUOTE$3 = "'";
13802
- const SINGLE$13 = {
13883
+ const SINGLE$12 = {
13803
13884
  "(": "(",
13804
13885
  ")": ")",
13805
13886
  "[": "[",
@@ -13877,7 +13958,7 @@ const lexPair = (scan, pair) => {
13877
13958
  }));
13878
13959
  };
13879
13960
  const lexPunct = (scan, char) => {
13880
- const single = Record.get(SINGLE$13, char);
13961
+ const single = Record.get(SINGLE$12, char);
13881
13962
  if (Option.isSome(single)) return finished(scan)(single.value, advance$2(scan.src)(scan.start));
13882
13963
  return pipe(Record.get(PAIRS, char), Option.match({
13883
13964
  onNone: () => unexpected$1(scan)({
@@ -14054,1595 +14135,13 @@ const outcome = (stream, root) => {
14054
14135
  if (stream.peek() !== "END") return Result.fail(remaining(stream));
14055
14136
  return Result.succeed(root.value);
14056
14137
  };
14057
- const parse$1 = (src) => {
14138
+ const parse = (src) => {
14058
14139
  const stream = streamOf(src);
14059
14140
  return {
14060
14141
  result: outcome(stream, parseOr(stream)),
14061
14142
  offset: stream.offset()
14062
14143
  };
14063
14144
  };
14064
- // src/app/presets/entities/workflow/lib/expression-text.ts
14065
- const OPEN$3 = "${{";
14066
- const CLOSE$2 = "}}";
14067
- const SINGLE$12 = 2;
14068
- const containsExpression = (text) => Option.match(Option.all([String$1.indexOf(OPEN$3)(text), String$1.indexOf(CLOSE$2)(text)]), {
14069
- onNone: () => false,
14070
- onSome: ([open, close]) => open < close
14071
- });
14072
- const isExpressionAssigned = (text) => {
14073
- const trimmed = String$1.trim(text);
14074
- return String$1.startsWith(OPEN$3)(trimmed) && String$1.endsWith(CLOSE$2)(trimmed) && String$1.split(OPEN$3)(trimmed).length === SINGLE$12;
14075
- };
14076
- // src/app/presets/shared/record/optional.ts
14077
- const optional = (key) => (value) => Option.match(value, {
14078
- onNone: () => ({}),
14079
- onSome: (present) => Record.singleton(key, present)
14080
- });
14081
- // src/app/presets/entities/workflow/lib/scalar.ts
14082
- const ZERO$1 = 0;
14083
- const FLOAT_TAGS = /* @__PURE__ */ new Set([
14084
- "!!float",
14085
- "!!int",
14086
- "!!str"
14087
- ]);
14088
- const nodeShape = (node) => `${node.kind} node with ${quote(node.tag)} tag`;
14089
- const emptyText = (node) => ({
14090
- value: "",
14091
- quoted: false,
14092
- line: node.line,
14093
- column: node.column
14094
- });
14095
- const checkString$1 = (sink) => (node, allowEmpty) => {
14096
- if (node.kind !== "scalar") {
14097
- sink.error(node, `expected scalar node for string value but found ${nodeShape(node)}`);
14098
- return false;
14099
- }
14100
- if (!allowEmpty && node.value === "") {
14101
- sink.error(node, "string should not be empty");
14102
- return false;
14103
- }
14104
- return true;
14105
- };
14106
- const parseString = (sink) => (node, allowEmpty) => {
14107
- if (!checkString$1(sink)(node, allowEmpty)) return emptyText(node);
14108
- return textOf$2(node);
14109
- };
14110
- const parseExpression = (sink) => (node, expecting) => {
14111
- if (!isExpressionAssigned(node.value)) {
14112
- sink.error(node, `expecting a single \${{...}} expression or ${expecting}, but found plain text node`);
14113
- return Option.none();
14114
- }
14115
- return Option.some(textOf$2(node));
14116
- };
14117
- const mayParseExpression = (node) => pipe(Option.liftPredicate(node, (value) => value.tag === "!!str" && isExpressionAssigned(value.value)), Option.map(textOf$2));
14118
- const parseBool = (sink) => (node) => {
14119
- if (node.kind !== "scalar" || node.tag !== "!!bool" && node.tag !== "!!str") {
14120
- sink.error(node, `expected bool value but found ${nodeShape(node)}`);
14121
- return Option.none();
14122
- }
14123
- const at = {
14124
- line: node.line,
14125
- column: node.column
14126
- };
14127
- if (node.tag === "!!str") {
14128
- const expression = parseExpression(sink)(node, "boolean literal \"true\" or \"false\"");
14129
- return Option.some({
14130
- ...at,
14131
- value: false,
14132
- ...optional("expression")(expression)
14133
- });
14134
- }
14135
- return Option.some({
14136
- ...at,
14137
- value: node.value === "true"
14138
- });
14139
- };
14140
- const fromExpression$1 = (expression) => pipe(expression, Option.map((text) => ({
14141
- value: ZERO$1,
14142
- expression: text
14143
- })));
14144
- const integerLiteral = (sink) => (node) => {
14145
- const parsed = atoi(node.value);
14146
- if (typeof parsed === "string") {
14147
- const shown = quote(node.value);
14148
- sink.error(node, `invalid integer value: ${shown}: strconv.Atoi: parsing ${shown}: ${parsed}`);
14149
- return Option.none();
14150
- }
14151
- return Option.some({ value: parsed });
14152
- };
14153
- const parseInteger = (sink) => (node) => {
14154
- if (node.kind !== "scalar" || node.tag !== "!!int" && node.tag !== "!!str") {
14155
- sink.error(node, `expected scalar node for integer value but found ${nodeShape(node)}`);
14156
- return Option.none();
14157
- }
14158
- if (node.tag === "!!str") return fromExpression$1(parseExpression(sink)(node, "integer literal"));
14159
- return integerLiteral(sink)(node);
14160
- };
14161
- const parseNumber$1 = (sink) => (node) => {
14162
- if (node.kind !== "scalar" || !FLOAT_TAGS.has(node.tag)) {
14163
- sink.error(node, `expected scalar node for float value but found ${nodeShape(node)}`);
14164
- return Option.none();
14165
- }
14166
- if (node.tag === "!!str") return fromExpression$1(parseExpression(sink)(node, "float number literal"));
14167
- const parsed = pipe(parseGoFloat(node.value), Option.filter((value) => !Number.isNaN(value)));
14168
- if (Option.isNone(parsed)) {
14169
- const shown = quote(node.value);
14170
- sink.error(node, `invalid float value: ${shown}: strconv.ParseFloat: parsing ${shown}: invalid syntax`);
14171
- }
14172
- return pipe(parsed, Option.map((value) => ({ value })));
14173
- };
14174
- const parseTimeoutMinutes = (sink) => (node) => {
14175
- const parsed = parseNumber$1(sink)(node);
14176
- if (Option.isSome(parsed) && Predicate.isUndefined(parsed.value.expression) && parsed.value.value <= ZERO$1) sink.error(node, `value at "timeout-minutes" must be greater than zero: ${goFloat(parsed.value.value)}`);
14177
- return parsed;
14178
- };
14179
- // src/app/presets/entities/workflow/lib/sequence.ts
14180
- const EMPTY$1 = 0;
14181
- const ONE$2 = 1;
14182
- const sectionName = (section) => {
14183
- if (String$1.includes(" ")(section)) return section;
14184
- return `${quote(section)} section`;
14185
- };
14186
- const unexpectedMessage = (input) => {
14187
- const section = sectionName(input.section);
14188
- const key = quote(input.key.value);
14189
- const [first] = input.expected;
14190
- if (input.expected.length === ONE$2 && Predicate.isNotUndefined(first)) return `expected ${quote(first)} key for ${section} but got ${key}`;
14191
- if (input.expected.length === EMPTY$1) return `unexpected key ${key} for ${section}`;
14192
- return `unexpected key ${key} for ${section}. expected one of ${sortedQuotes(input.expected)}`;
14193
- };
14194
- const unexpectedKey = (sink) => (input) => {
14195
- sink.error(input.key, unexpectedMessage(input));
14196
- };
14197
- const reportEmpty = (sink) => (section, node) => {
14198
- sink.error(node, `${quote(section)} section should not be empty`);
14199
- };
14200
- const checkNotEmpty = (sink) => (section, node) => {
14201
- if (node.children.length === EMPTY$1) {
14202
- reportEmpty(sink)(section, node);
14203
- return false;
14204
- }
14205
- return true;
14206
- };
14207
- const checkSequence$1 = (sink) => (input) => {
14208
- const { node, section } = input;
14209
- if (node.kind !== "sequence") {
14210
- sink.error(node, `${quote(section)} section must be sequence node but got ${node.kind} node with ${quote(node.tag)} tag`);
14211
- return false;
14212
- }
14213
- return input.allowEmpty || checkNotEmpty(sink)(section, node);
14214
- };
14215
- const parseStringSequence = (sink) => (input) => {
14216
- if (!checkSequence$1(sink)(input)) return [];
14217
- return pipe(input.node.children, Array$1.map((child) => parseString(sink)(child, input.allowElementEmpty)));
14218
- };
14219
- const parseStringOrSequence = (sink) => (input) => {
14220
- const { node } = input;
14221
- if (node.kind !== "scalar") return parseStringSequence(sink)(input);
14222
- if (input.allowEmpty && node.tag === "!!null") return [];
14223
- return [parseString(sink)(node, input.allowElementEmpty)];
14224
- };
14225
- // src/app/presets/entities/workflow/lib/fold.ts
14226
- const foldEntries = (input) => {
14227
- const table = Record.fromEntries(input.handlers);
14228
- return Array$1.reduce(input.entries, input.initial, (state, entry) => Option.getOrElse(Record.get(table, entry.id), () => input.unknown)(state, entry));
14229
- };
14230
- const rejecting = (input) => (state, entry) => {
14231
- unexpectedKey(input.sink)({
14232
- key: entry.key,
14233
- section: input.section,
14234
- expected: input.expected
14235
- });
14236
- return state;
14237
- };
14238
- const setters = () => ({
14239
- set: (key, parse) => (state, entry) => ({
14240
- ...state,
14241
- [key]: parse(entry)
14242
- }),
14243
- setSome: (key, parse) => (state, entry) => Option.match(parse(entry), {
14244
- onNone: () => state,
14245
- onSome: (value) => ({
14246
- ...state,
14247
- [key]: value
14248
- })
14249
- })
14250
- });
14251
- const keep = (state) => state;
14252
- // ../lint-host/src/shared/lib/collections.ts
14253
- const byKey = Order.mapInput(String$1.Order, ([key]) => key);
14254
- const sortedRecord = (entries) => Record.fromEntries(Array$1.sort(entries, byKey));
14255
- const ancestorsBy = (parentOf) => (node) => Array$1.unfold(parentOf(node), (current) => pipe(current, Option.map((found) => [found, parentOf(found)])));
14256
- // src/app/presets/entities/workflow/lib/mapping.ts
14257
- const MERGE_KEY = "<<";
14258
- const EMPTY = 0;
14259
- const emptyMessage = (place) => `${place} should not be empty. please remove this section if it's unnecessary`;
14260
- const caseNote = (caseSensitive) => {
14261
- if (caseSensitive) return "";
14262
- return ". note that this key is case insensitive";
14263
- };
14264
- const duplicateMessage = (input, key, previous) => {
14265
- const note = caseNote(input.caseSensitive);
14266
- return `key ${quote(key.value)} is duplicated in ${input.place}. previously defined at ${describePosition(previous)}${note}`;
14267
- };
14268
- const idOf = (input, key) => {
14269
- if (input.caseSensitive) return key.value;
14270
- return String$1.toLowerCase(key.value);
14271
- };
14272
- const collectPair = (sink, input) => (collected, pair) => {
14273
- const key = parseString(sink)(pair.key, false);
14274
- const id = idOf(input, key);
14275
- if (key.value === MERGE_KEY) {
14276
- sink.error(key, `GitHub Actions does not support YAML merge key "${MERGE_KEY}"`);
14277
- return collected;
14278
- }
14279
- return Option.match(Record.get(collected.seen, id), {
14280
- onSome: (previous) => {
14281
- sink.error(key, duplicateMessage(input, key, previous));
14282
- return collected;
14283
- },
14284
- onNone: () => ({
14285
- seen: {
14286
- ...collected.seen,
14287
- [id]: key
14288
- },
14289
- entries: [...collected.entries, {
14290
- id,
14291
- key,
14292
- value: pair.value
14293
- }]
14294
- })
14295
- });
14296
- };
14297
- const nonMapping = (sink, input) => {
14298
- const { node, place } = input;
14299
- if (node.kind === "scalar" && node.tag === "!!null") {
14300
- if (!input.allowEmpty) sink.error(node, emptyMessage(place));
14301
- return true;
14302
- }
14303
- if (node.kind !== "mapping") {
14304
- sink.error(node, `${place} is ${node.kind} node but mapping node is expected`);
14305
- return true;
14306
- }
14307
- return false;
14308
- };
14309
- const parseMapping = (sink) => (input) => {
14310
- if (nonMapping(sink, input)) return [];
14311
- const { entries } = Array$1.reduce(pairsOf(input.node), {
14312
- seen: {},
14313
- entries: []
14314
- }, collectPair(sink, input));
14315
- if (!input.allowEmpty && entries.length === EMPTY) sink.error(input.node, emptyMessage(input.place));
14316
- return entries;
14317
- };
14318
- const sectionWith = (flags) => (sink) => (section, node) => parseMapping(sink)({
14319
- ...flags,
14320
- node,
14321
- place: `${quote(section)} section`
14322
- });
14323
- const section$1 = sectionWith({
14324
- allowEmpty: false,
14325
- caseSensitive: true
14326
- });
14327
- const caselessSection = sectionWith({
14328
- allowEmpty: false,
14329
- caseSensitive: false
14330
- });
14331
- const emptyableSection = sectionWith({
14332
- allowEmpty: true,
14333
- caseSensitive: true
14334
- });
14335
- const emptyableCaselessSection = sectionWith({
14336
- allowEmpty: true,
14337
- caseSensitive: false
14338
- });
14339
- const entryText = (sink) => (allowEmpty) => (entry) => parseString(sink)(entry.value, allowEmpty);
14340
- const entryRecord = (parse) => (entries) => sortedRecord(pipe(entries, Array$1.map((entry) => [entry.id, parse(entry)])));
14341
- // src/app/presets/entities/workflow/lib/sink.ts
14342
- const reportMissing = (sink) => (value, at, message) => {
14343
- if (Predicate.isUndefined(value)) sink.error(at, message);
14344
- };
14345
- // src/app/presets/entities/workflow/lib/runner.ts
14346
- const labels = (sink) => (name, node) => parseStringOrSequence(sink)({
14347
- section: name,
14348
- node,
14349
- allowEmpty: false,
14350
- allowElementEmpty: false
14351
- });
14352
- const labelsHandler = (sink) => (state, entry) => Option.match(mayParseExpression(entry.value), {
14353
- onSome: (expression) => ({
14354
- ...state,
14355
- labelsExpression: expression
14356
- }),
14357
- onNone: () => ({
14358
- ...state,
14359
- labels: labels(sink)("labels", entry.value)
14360
- })
14361
- });
14362
- const parseRunsOn = (sink) => (node) => {
14363
- const expression = mayParseExpression(node);
14364
- if (Option.isSome(expression)) return {
14365
- labels: [],
14366
- labelsExpression: expression.value
14367
- };
14368
- if (node.kind === "scalar" || node.kind === "sequence") return { labels: labels(sink)("runs-on", node) };
14369
- return foldEntries({
14370
- entries: section$1(sink)("runs-on", node),
14371
- initial: { labels: [] },
14372
- handlers: [["labels", labelsHandler(sink)], ["group", setters().set("group", entryText(sink)(false))]],
14373
- unknown: rejecting({
14374
- sink,
14375
- section: "runs-on",
14376
- expected: ["labels", "group"]
14377
- })
14378
- });
14379
- };
14380
- const snapshotMapping = (sink) => (at, node) => {
14381
- const { set } = setters();
14382
- const snapshot = foldEntries({
14383
- entries: section$1(sink)("on", node),
14384
- initial: {},
14385
- handlers: [
14386
- ["image-name", set("imageName", entryText(sink)(false))],
14387
- ["version", set("version", entryText(sink)(false))],
14388
- ["if", set("condition", entryText(sink)(false))]
14389
- ],
14390
- unknown: rejecting({
14391
- sink,
14392
- section: "snapshot",
14393
- expected: [
14394
- "image-name",
14395
- "version",
14396
- "if"
14397
- ]
14398
- })
14399
- });
14400
- reportMissing(sink)(snapshot.imageName, at, "\"snapshot\" section must have \"image-name\" configuration");
14401
- return snapshot;
14402
- };
14403
- const parseSnapshot = (sink) => (at, node) => {
14404
- if (node.kind === "scalar") return Option.some({ imageName: parseString(sink)(node, false) });
14405
- if (node.kind === "mapping") return Option.some(snapshotMapping(sink)(at, node));
14406
- sink.error(node, `"snapshot" section value must be string or mapping but found ${node.kind} node`);
14407
- return Option.none();
14408
- };
14409
- const parseCallValues = (sink) => (name, node) => entryRecord((entry) => ({
14410
- name: entry.key,
14411
- value: parseString(sink)(entry.value, true)
14412
- }))(caselessSection(sink)(name, node));
14413
- // src/app/presets/entities/workflow/lib/job-fields.ts
14414
- const forJob = (handler) => (state, entry) => ({
14415
- ...state,
14416
- job: handler(state.job, entry)
14417
- });
14418
- const stepsOnly = (handler) => (state, entry) => ({
14419
- ...forJob(handler)(state, entry),
14420
- stepsOnly: entry.key
14421
- });
14422
- const callOnly = (handler) => (state, entry) => ({
14423
- ...state,
14424
- call: handler(state.call, entry),
14425
- callOnly: entry.key
14426
- });
14427
- const needs = (sink) => (entry) => {
14428
- if (entry.value.kind === "scalar") return [parseString(sink)(entry.value, false)];
14429
- return parseStringSequence(sink)({
14430
- section: "needs",
14431
- node: entry.value,
14432
- allowEmpty: false,
14433
- allowElementEmpty: false
14434
- });
14435
- };
14436
- const callSecrets = (sink) => (call, entry) => {
14437
- const node = entry.value;
14438
- if (node.kind !== "scalar") return {
14439
- ...call,
14440
- secrets: parseCallValues(sink)("secrets", node)
14441
- };
14442
- if (node.value === "inherit") return {
14443
- ...call,
14444
- inheritSecrets: true
14445
- };
14446
- sink.error(node, `expected mapping node for secrets or "inherit" string node but found ${quote(node.value)} node`);
14447
- return call;
14448
- };
14449
- const emptyJob = (id) => ({
14450
- id,
14451
- needs: [],
14452
- outputs: {},
14453
- line: id.line,
14454
- column: id.column
14455
- });
14456
- // src/app/presets/entities/workflow/lib/sections.ts
14457
- const parsePermissions = (sink) => (node) => {
14458
- if (node.kind === "scalar") return {
14459
- all: parseString(sink)(node, false),
14460
- scopes: {}
14461
- };
14462
- const entries = emptyableCaselessSection(sink)("permissions", node);
14463
- return { scopes: entryRecord((entry) => ({
14464
- name: entry.key,
14465
- value: entryText(sink)(false)(entry)
14466
- }))(entries) };
14467
- };
14468
- const parseEnv = (sink) => (node) => {
14469
- if (node.kind === "scalar") return {
14470
- vars: {},
14471
- ...optional("expression")(parseExpression(sink)(node, "mapping value for \"env\" section"))
14472
- };
14473
- return { vars: entryRecord((entry) => ({
14474
- name: entry.key,
14475
- value: parseString(sink)(entry.value, true)
14476
- }))(caselessSection(sink)("env", node)) };
14477
- };
14478
- const defaultsRun = (sink) => (node) => {
14479
- const { set } = setters();
14480
- return foldEntries({
14481
- entries: section$1(sink)("run", node),
14482
- initial: {},
14483
- handlers: [["shell", set("shell", entryText(sink)(false))], ["working-directory", set("workingDirectory", entryText(sink)(false))]],
14484
- unknown: rejecting({
14485
- sink,
14486
- section: "run",
14487
- expected: ["shell", "working-directory"]
14488
- })
14489
- });
14490
- };
14491
- const parseDefaults = (sink) => (node) => {
14492
- const defaults = foldEntries({
14493
- entries: section$1(sink)("defaults", node),
14494
- initial: {},
14495
- handlers: [["run", setters().set("run", (entry) => defaultsRun(sink)(entry.value))]],
14496
- unknown: rejecting({
14497
- sink,
14498
- section: "defaults",
14499
- expected: ["run"]
14500
- })
14501
- });
14502
- reportMissing(sink)(defaults.run, node, "\"defaults\" section should have \"run\" section");
14503
- return defaults;
14504
- };
14505
- const parseConcurrency = (sink) => (at, node) => {
14506
- if (node.kind === "scalar") return { group: parseString(sink)(node, false) };
14507
- const { set, setSome } = setters();
14508
- const concurrency = foldEntries({
14509
- entries: section$1(sink)("concurrency", node),
14510
- initial: {},
14511
- handlers: [["group", set("group", entryText(sink)(false))], ["cancel-in-progress", setSome("cancelInProgress", (entry) => parseBool(sink)(entry.value))]],
14512
- unknown: rejecting({
14513
- sink,
14514
- section: "concurrency",
14515
- expected: ["group", "cancel-in-progress"]
14516
- })
14517
- });
14518
- reportMissing(sink)(concurrency.group, at, "group name is missing in \"concurrency\" section");
14519
- return concurrency;
14520
- };
14521
- const parseEnvironment = (sink) => (at, node) => {
14522
- if (node.kind === "scalar") return { name: parseString(sink)(node, false) };
14523
- const { set, setSome } = setters();
14524
- const environment = foldEntries({
14525
- entries: section$1(sink)("environment", node),
14526
- initial: {},
14527
- handlers: [
14528
- ["name", set("name", entryText(sink)(false))],
14529
- ["url", set("url", entryText(sink)(false))],
14530
- ["deployment", setSome("deployment", (entry) => parseBool(sink)(entry.value))]
14531
- ],
14532
- unknown: rejecting({
14533
- sink,
14534
- section: "environment",
14535
- expected: [
14536
- "deployment",
14537
- "name",
14538
- "url"
14539
- ]
14540
- })
14541
- });
14542
- reportMissing(sink)(environment.name, at, "name is missing in \"environment\" section");
14543
- return environment;
14544
- };
14545
- const parseOutputs = (sink) => (node) => {
14546
- const outputs = entryRecord((entry) => parseString(sink)(entry.value, true))(caselessSection(sink)("outputs", node));
14547
- if (Record.isEmptyRecord(outputs)) reportEmpty(sink)("outputs", node);
14548
- return outputs;
14549
- };
14550
- // src/app/presets/entities/workflow/lib/container.ts
14551
- const parseCredentials = (sink) => (entry) => {
14552
- const expression = mayParseExpression(entry.value);
14553
- if (Option.isSome(expression)) return Option.some({ expression: expression.value });
14554
- const { set } = setters();
14555
- const credentials = foldEntries({
14556
- entries: section$1(sink)("credentials", entry.value),
14557
- initial: {},
14558
- handlers: [["username", set("username", entryText(sink)(false))], ["password", set("password", entryText(sink)(false))]],
14559
- unknown: rejecting({
14560
- sink,
14561
- section: "credentials",
14562
- expected: ["username", "password"]
14563
- })
14564
- });
14565
- if (Predicate.isUndefined(credentials.username) || Predicate.isUndefined(credentials.password)) {
14566
- sink.error(entry.key, "both \"username\" and \"password\" must be specified in \"credentials\" section");
14567
- return Option.none();
14568
- }
14569
- return Option.some(credentials);
14570
- };
14571
- const strings$2 = (sink, name) => (entry) => parseStringSequence(sink)({
14572
- section: name,
14573
- node: entry.value,
14574
- allowEmpty: true,
14575
- allowElementEmpty: false
14576
- });
14577
- const CONTAINER_KEYS = [
14578
- "image",
14579
- "credentials",
14580
- "env",
14581
- "ports",
14582
- "volumes",
14583
- "options"
14584
- ];
14585
- const parseContainer = (sink) => (name, at, node) => {
14586
- if (node.kind === "scalar") return {
14587
- ports: [],
14588
- volumes: [],
14589
- image: parseString(sink)(node, false)
14590
- };
14591
- const { set, setSome } = setters();
14592
- const container = foldEntries({
14593
- entries: section$1(sink)(name, node),
14594
- initial: {
14595
- ports: [],
14596
- volumes: []
14597
- },
14598
- handlers: [
14599
- ["image", set("image", entryText(sink)(false))],
14600
- ["credentials", setSome("credentials", parseCredentials(sink))],
14601
- ["env", set("env", (entry) => parseEnv(sink)(entry.value))],
14602
- ["ports", set("ports", strings$2(sink, "ports"))],
14603
- ["volumes", set("volumes", strings$2(sink, "volumes"))],
14604
- ["options", set("options", entryText(sink)(true))]
14605
- ],
14606
- unknown: rejecting({
14607
- sink,
14608
- section: name,
14609
- expected: CONTAINER_KEYS
14610
- })
14611
- });
14612
- reportMissing(sink)(container.image, at, `"image" is missing in ${quote(name)} section`);
14613
- return container;
14614
- };
14615
- const parseServices = (sink) => (node) => {
14616
- const expression = mayParseExpression(node);
14617
- if (Option.isSome(expression)) return {
14618
- value: {},
14619
- expression: expression.value
14620
- };
14621
- const entries = caselessSection(sink)("services", node);
14622
- return { value: entryRecord((entry) => ({
14623
- name: entry.key,
14624
- container: parseContainer(sink)("services", entry.key, entry.value)
14625
- }))(entries) };
14626
- };
14627
- // src/app/presets/entities/workflow/lib/raw-value.ts
14628
- const rawEntries = (parse) => (entries) => sortedRecord(pipe(entries, Array$1.flatMap((entry) => pipe(parse(entry), Option.map((value) => [entry.id, value]), Option.toArray))));
14629
- const rawArray = (node, parse) => ({
14630
- line: node.line,
14631
- column: node.column,
14632
- type: "array",
14633
- elems: pipe(node.children, Array$1.flatMap((child) => Option.toArray(parse(child))))
14634
- });
14635
- const rawObject = (sink, node, parse) => {
14636
- const entries = parseMapping(sink)({
14637
- place: "matrix row value",
14638
- node,
14639
- allowEmpty: true,
14640
- caseSensitive: false
14641
- });
14642
- return {
14643
- line: node.line,
14644
- column: node.column,
14645
- type: "object",
14646
- props: rawEntries((entry) => parse(entry.value))(entries)
14647
- };
14648
- };
14649
- const parseRawValue = (sink) => (node) => {
14650
- if (node.kind === "scalar") return Option.some({
14651
- line: node.line,
14652
- column: node.column,
14653
- type: "string",
14654
- value: node.value
14655
- });
14656
- if (node.kind === "sequence") return Option.some(rawArray(node, parseRawValue(sink)));
14657
- if (node.kind === "mapping") return Option.some(rawObject(sink, node, parseRawValue(sink)));
14658
- sink.error(node, `unexpected ${node.kind} node on parsing value in matrix row`);
14659
- return Option.none();
14660
- };
14661
- // src/app/presets/entities/workflow/lib/matrix-values.ts
14662
- const combination = (sink, section) => (child) => {
14663
- if (child.kind === "scalar") return Option.map(parseExpression(sink)(child, "mapping of matrix combination"), (expression) => ({
14664
- assigns: {},
14665
- expression
14666
- }));
14667
- const entries = parseMapping(sink)({
14668
- place: `element in ${quote(section)} section`,
14669
- node: child,
14670
- allowEmpty: false,
14671
- caseSensitive: false
14672
- });
14673
- const assigns = rawEntries((entry) => Option.map(parseRawValue(sink)(entry.value), (value) => ({
14674
- key: entry.key,
14675
- value
14676
- })))(entries);
14677
- return Option.some({ assigns });
14678
- };
14679
- const combinations = (sink) => (section, entry) => {
14680
- const node = entry.value;
14681
- if (node.kind === "scalar") return Option.some({
14682
- combinations: [],
14683
- ...optional("expression")(parseExpression(sink)(node, "array of matrix combination"))
14684
- });
14685
- if (!checkSequence$1(sink)({
14686
- section,
14687
- node,
14688
- allowEmpty: false
14689
- })) return Option.none();
14690
- return Option.some({ combinations: pipe(node.children, Array$1.flatMap((child) => Option.toArray(combination(sink, section)(child)))) });
14691
- };
14692
- const row = (sink) => (entry) => {
14693
- if (entry.value.kind === "scalar") {
14694
- const expression = parseExpression(sink)(entry.value, "array value for matrix variations");
14695
- return Option.some({
14696
- values: [],
14697
- ...optional("expression")(expression)
14698
- });
14699
- }
14700
- if (!checkSequence$1(sink)({
14701
- section: "matrix values",
14702
- node: entry.value,
14703
- allowEmpty: false
14704
- })) return Option.none();
14705
- return Option.some({
14706
- name: entry.key,
14707
- values: pipe(entry.value.children, Array$1.flatMap((child) => Option.toArray(parseRawValue(sink)(child))))
14708
- });
14709
- };
14710
- // src/app/presets/entities/workflow/lib/matrix.ts
14711
- const addRow = (sink) => (state, entry) => Option.match(row(sink)(entry), {
14712
- onNone: () => state,
14713
- onSome: (value) => ({
14714
- ...state,
14715
- rows: {
14716
- ...state.rows,
14717
- [entry.id]: value
14718
- }
14719
- })
14720
- });
14721
- const emptyMatrix = (at) => ({
14722
- rows: {},
14723
- line: at.line,
14724
- column: at.column
14725
- });
14726
- const parseMatrix = (sink) => (at, node) => {
14727
- if (node.kind === "scalar") return {
14728
- ...emptyMatrix(node),
14729
- ...optional("expression")(parseExpression(sink)(node, "matrix"))
14730
- };
14731
- const { setSome } = setters();
14732
- const matrix = foldEntries({
14733
- entries: caselessSection(sink)("matrix", node),
14734
- initial: emptyMatrix(at),
14735
- handlers: [["include", setSome("include", (entry) => combinations(sink)("include", entry))], ["exclude", setSome("exclude", (entry) => combinations(sink)("exclude", entry))]],
14736
- unknown: addRow(sink)
14737
- });
14738
- return {
14739
- ...matrix,
14740
- rows: sortedRecord(Record.toEntries(matrix.rows))
14741
- };
14742
- };
14743
- // src/app/presets/entities/workflow/lib/strategy.ts
14744
- const ZERO = 0;
14745
- const maxParallel = (sink) => (entry) => {
14746
- const parsed = parseInteger(sink)(entry.value);
14747
- if (Option.isSome(parsed) && Predicate.isUndefined(parsed.value.expression) && parsed.value.value <= ZERO) sink.error(entry.value, `value at "max-parallel" must be greater than zero: ${String(parsed.value.value)}`);
14748
- return parsed;
14749
- };
14750
- const parseStrategy = (sink) => (node) => {
14751
- const { setSome } = setters();
14752
- return foldEntries({
14753
- entries: section$1(sink)("strategy", node),
14754
- initial: {},
14755
- handlers: [
14756
- ["matrix", setSome("matrix", (entry) => Option.some(parseMatrix(sink)(entry.key, entry.value)))],
14757
- ["fail-fast", setSome("failFast", (entry) => parseBool(sink)(entry.value))],
14758
- ["max-parallel", setSome("maxParallel", maxParallel(sink))]
14759
- ],
14760
- unknown: rejecting({
14761
- sink,
14762
- section: "strategy",
14763
- expected: [
14764
- "matrix",
14765
- "fail-fast",
14766
- "max-parallel"
14767
- ]
14768
- })
14769
- });
14770
- };
14771
- // src/app/presets/entities/workflow/lib/job-general.ts
14772
- const generalHandlers = (sink) => {
14773
- const { set, setSome } = setters();
14774
- const call = setters();
14775
- return [
14776
- ["name", forJob(set("name", (entry) => parseString(sink)(entry.value, true)))],
14777
- ["needs", forJob(set("needs", needs(sink)))],
14778
- ["permissions", forJob(set("permissions", (entry) => parsePermissions(sink)(entry.value)))],
14779
- ["concurrency", forJob(set("concurrency", (entry) => parseConcurrency(sink)(entry.key, entry.value)))],
14780
- ["if", forJob(set("condition", (entry) => parseString(sink)(entry.value, false)))],
14781
- ["strategy", forJob(set("strategy", (entry) => parseStrategy(sink)(entry.value)))],
14782
- ["services", forJob(set("services", (entry) => parseServices(sink)(entry.value)))],
14783
- ["snapshot", forJob(setSome("snapshot", (entry) => parseSnapshot(sink)(entry.key, entry.value)))],
14784
- ["uses", callOnly(call.set("uses", (entry) => parseString(sink)(entry.value, false)))],
14785
- ["with", callOnly(call.set("inputs", (entry) => parseCallValues(sink)("with", entry.value)))],
14786
- ["secrets", callOnly(callSecrets(sink))]
14787
- ];
14788
- };
14789
- // src/app/presets/entities/workflow/lib/exec.ts
14790
- const COMMON = [
14791
- "id",
14792
- "if",
14793
- "name",
14794
- "env",
14795
- "continue-on-error",
14796
- "timeout-minutes"
14797
- ];
14798
- const common = () => pipe(COMMON, Array$1.map((key) => [key, keep]));
14799
- const withInput = (sink, docker) => (state, item) => {
14800
- if (docker && item.id === "entrypoint") return {
14801
- ...state,
14802
- action: {
14803
- ...state.action,
14804
- entrypoint: entryText(sink)(false)(item)
14805
- }
14806
- };
14807
- if (docker && item.id === "args") return {
14808
- ...state,
14809
- action: {
14810
- ...state.action,
14811
- args: entryText(sink)(true)(item)
14812
- }
14813
- };
14814
- const input = {
14815
- name: item.key,
14816
- value: entryText(sink)(true)(item)
14817
- };
14818
- return {
14819
- ...state,
14820
- inputs: [...state.inputs, [item.id, input]]
14821
- };
14822
- };
14823
- const parseWith = (sink, docker) => (action, entry) => {
14824
- const state = foldEntries({
14825
- entries: caselessSection(sink)("with", entry.value),
14826
- initial: {
14827
- action,
14828
- inputs: []
14829
- },
14830
- handlers: [],
14831
- unknown: withInput(sink, docker)
14832
- });
14833
- return {
14834
- ...state.action,
14835
- inputs: sortedRecord(state.inputs)
14836
- };
14837
- };
14838
- const execAction = (sink) => (entries, docker) => foldEntries({
14839
- entries,
14840
- initial: { type: "action" },
14841
- handlers: [
14842
- ...common(),
14843
- ["uses", setters().set("uses", entryText(sink)(false))],
14844
- ["with", parseWith(sink, docker)]
14845
- ],
14846
- unknown: rejecting({
14847
- sink,
14848
- section: "step to execute action",
14849
- expected: [
14850
- ...COMMON,
14851
- "uses",
14852
- "with"
14853
- ]
14854
- })
14855
- });
14856
- const runHandler = (sink) => (state, entry) => ({
14857
- ...state,
14858
- run: entryText(sink)(false)(entry),
14859
- runPosition: entry.key
14860
- });
14861
- const execRun = (sink) => (entries) => {
14862
- const { set } = setters();
14863
- return foldEntries({
14864
- entries,
14865
- initial: { type: "run" },
14866
- handlers: [
14867
- ...common(),
14868
- ["run", runHandler(sink)],
14869
- ["shell", set("shell", entryText(sink)(false))],
14870
- ["working-directory", set("workingDirectory", entryText(sink)(false))]
14871
- ],
14872
- unknown: rejecting({
14873
- sink,
14874
- section: "step to run shell command",
14875
- expected: [
14876
- ...COMMON,
14877
- "run",
14878
- "shell",
14879
- "working-directory"
14880
- ]
14881
- })
14882
- });
14883
- };
14884
- // src/app/presets/entities/workflow/lib/steps.ts
14885
- const lift$1 = (handler) => (state, entry) => ({
14886
- ...state,
14887
- step: handler(state.step, entry)
14888
- });
14889
- const usesShape = (state, entry) => {
14890
- if (String$1.startsWith("docker://")(entry.value.value)) return {
14891
- ...state,
14892
- shape: "docker"
14893
- };
14894
- return {
14895
- ...state,
14896
- shape: "action"
14897
- };
14898
- };
14899
- const runShape = (state) => ({
14900
- ...state,
14901
- shape: "run"
14902
- });
14903
- const stepHandlers$1 = (sink) => {
14904
- const { set, setSome } = setters();
14905
- const text = (allowEmpty) => (entry) => parseString(sink)(entry.value, allowEmpty);
14906
- return [
14907
- ["id", lift$1(set("id", text(false)))],
14908
- ["if", lift$1(set("condition", text(false)))],
14909
- ["name", lift$1(set("name", text(true)))],
14910
- ["env", lift$1(set("env", (entry) => parseEnv(sink)(entry.value)))],
14911
- ["continue-on-error", lift$1(setSome("continueOnError", (entry) => parseBool(sink)(entry.value)))],
14912
- ["timeout-minutes", lift$1(setSome("timeoutMinutes", (entry) => parseTimeoutMinutes(sink)(entry.value)))],
14913
- ["uses", usesShape],
14914
- ["run", runShape]
14915
- ];
14916
- };
14917
- const execOf = (sink) => (shape, entries) => {
14918
- if (shape === "run") return Option.some(execRun(sink)(entries));
14919
- if (shape === "unknown") return Option.none();
14920
- return Option.some(execAction(sink)(entries, shape === "docker"));
14921
- };
14922
- const parseStep = (sink) => (node) => {
14923
- const entries = parseMapping(sink)({
14924
- place: "element of \"steps\" section",
14925
- node,
14926
- allowEmpty: false,
14927
- caseSensitive: true
14928
- });
14929
- const state = foldEntries({
14930
- entries,
14931
- initial: {
14932
- step: {},
14933
- shape: "unknown"
14934
- },
14935
- handlers: stepHandlers$1(sink),
14936
- unknown: keep
14937
- });
14938
- if (state.shape === "unknown") sink.error(node, "step must run script with \"run\" section or run action with \"uses\" section");
14939
- return Option.match(execOf(sink)(state.shape, entries), {
14940
- onNone: () => state.step,
14941
- onSome: (exec) => ({
14942
- ...state.step,
14943
- exec
14944
- })
14945
- });
14946
- };
14947
- const parseSteps = (sink) => (node) => {
14948
- if (!checkSequence$1(sink)({
14949
- section: "steps",
14950
- node,
14951
- allowEmpty: false
14952
- })) return Option.none();
14953
- return Option.some(pipe(node.children, Array$1.map((child) => parseStep(sink)(child))));
14954
- };
14955
- // src/app/presets/entities/workflow/lib/job-steps.ts
14956
- const stepHandlers = (sink) => {
14957
- const { set, setSome } = setters();
14958
- return [
14959
- ["runs-on", stepsOnly(set("runsOn", (entry) => parseRunsOn(sink)(entry.value)))],
14960
- ["environment", stepsOnly(set("environment", (entry) => parseEnvironment(sink)(entry.key, entry.value)))],
14961
- ["outputs", stepsOnly(set("outputs", (entry) => parseOutputs(sink)(entry.value)))],
14962
- ["env", stepsOnly(set("env", (entry) => parseEnv(sink)(entry.value)))],
14963
- ["defaults", stepsOnly(set("defaults", (entry) => parseDefaults(sink)(entry.value)))],
14964
- ["steps", stepsOnly(setSome("steps", (entry) => parseSteps(sink)(entry.value)))],
14965
- ["timeout-minutes", stepsOnly(setSome("timeoutMinutes", (entry) => parseTimeoutMinutes(sink)(entry.value)))],
14966
- ["continue-on-error", stepsOnly(setSome("continueOnError", (entry) => parseBool(sink)(entry.value)))],
14967
- ["container", stepsOnly(set("container", (entry) => parseContainer(sink)("container", entry.key, entry.value)))]
14968
- ];
14969
- };
14970
- // src/app/presets/entities/workflow/lib/job.ts
14971
- const JOB_KEYS = [
14972
- "name",
14973
- "needs",
14974
- "runs-on",
14975
- "permissions",
14976
- "environment",
14977
- "concurrency",
14978
- "outputs",
14979
- "env",
14980
- "defaults",
14981
- "if",
14982
- "steps",
14983
- "timeout-minutes",
14984
- "strategy",
14985
- "continue-on-error",
14986
- "container",
14987
- "services",
14988
- "uses",
14989
- "with",
14990
- "secrets",
14991
- "snapshot"
14992
- ];
14993
- const finishCall = (sink) => (state) => {
14994
- const key = state.stepsOnly;
14995
- if (Predicate.isUndefined(key)) return {
14996
- ...state.job,
14997
- workflowCall: state.call
14998
- };
14999
- sink.error(key, `when a reusable workflow is called with "uses", ${quote(key.value)} is not available. only following keys are allowed: "name", "uses", "with", "secrets", "needs", "if", and "permissions" in job ${quote(state.job.id.value)}`);
15000
- return state.job;
15001
- };
15002
- const finishSteps = (sink) => (state) => {
15003
- const { job, callOnly: key } = state;
15004
- const id = quote(job.id.value);
15005
- reportMissing(sink)(job.steps, job.id, `"steps" section is missing in job ${id}`);
15006
- reportMissing(sink)(job.runsOn, job.id, `"runs-on" section is missing in job ${id}`);
15007
- if (Predicate.isNotUndefined(key)) sink.error(key, `${quote(key.value)} is only available for a reusable workflow call with "uses" but "uses" is not found in job ${id}`);
15008
- return job;
15009
- };
15010
- const parseJob = (sink) => (id, node) => {
15011
- const state = foldEntries({
15012
- entries: parseMapping(sink)({
15013
- place: `${quote(id.value)} job`,
15014
- node,
15015
- allowEmpty: false,
15016
- caseSensitive: true
15017
- }),
15018
- initial: {
15019
- job: emptyJob(id),
15020
- call: {
15021
- inputs: {},
15022
- secrets: {},
15023
- inheritSecrets: false
15024
- }
15025
- },
15026
- handlers: [...generalHandlers(sink), ...stepHandlers(sink)],
15027
- unknown: rejecting({
15028
- sink,
15029
- section: "job",
15030
- expected: JOB_KEYS
15031
- })
15032
- });
15033
- if (Predicate.isUndefined(state.call.uses)) return finishSteps(sink)(state);
15034
- return finishCall(sink)(state);
15035
- };
15036
- // src/app/presets/entities/workflow/lib/dispatch.ts
15037
- const DISPATCH_TYPES$1 = {
15038
- string: "string",
15039
- number: "number",
15040
- boolean: "boolean",
15041
- choice: "choice",
15042
- environment: "environment"
15043
- };
15044
- const dispatchType = (sink) => (state, entry) => {
15045
- const node = entry.value;
15046
- if (!checkString$1(sink)(node, false)) return state;
15047
- return Option.match(Record.get(DISPATCH_TYPES$1, node.value), {
15048
- onSome: (kind) => ({
15049
- ...state,
15050
- kind
15051
- }),
15052
- onNone: () => {
15053
- sink.error(node, `input type of workflow_dispatch event must be one of "string", "number", "boolean", "choice", "environment" but got ${quote(node.value)}`);
15054
- return state;
15055
- }
15056
- });
15057
- };
15058
- const strings$1 = (sink, section) => (entry) => parseStringSequence(sink)({
15059
- section,
15060
- node: entry.value,
15061
- allowEmpty: false,
15062
- allowElementEmpty: false
15063
- });
15064
- const dispatchInput = (sink) => (input) => {
15065
- const { set, setSome } = setters();
15066
- return foldEntries({
15067
- entries: parseMapping(sink)({
15068
- place: "input settings of workflow_dispatch event",
15069
- node: input.value,
15070
- allowEmpty: true,
15071
- caseSensitive: true
15072
- }),
15073
- initial: {
15074
- name: input.key,
15075
- kind: "none",
15076
- options: []
15077
- },
15078
- handlers: [
15079
- ["description", set("description", entryText(sink)(true))],
15080
- ["required", setSome("required", (entry) => parseBool(sink)(entry.value))],
15081
- ["default", set("default", entryText(sink)(true))],
15082
- ["type", dispatchType(sink)],
15083
- ["options", set("options", strings$1(sink, "options"))]
15084
- ],
15085
- unknown: rejecting({
15086
- sink,
15087
- section: "inputs",
15088
- expected: [
15089
- "description",
15090
- "required",
15091
- "default"
15092
- ]
15093
- })
15094
- });
15095
- };
15096
- const emptyDispatch = (at) => ({
15097
- type: "workflow_dispatch",
15098
- inputs: {},
15099
- line: at.line,
15100
- column: at.column
15101
- });
15102
- const parseWorkflowDispatch = (sink) => (at, node) => foldEntries({
15103
- entries: emptyableSection(sink)("workflow_dispatch", node),
15104
- initial: emptyDispatch(at),
15105
- handlers: [["inputs", setters().set("inputs", (entry) => entryRecord(dispatchInput(sink))(emptyableCaselessSection(sink)("inputs", entry.value)))]],
15106
- unknown: rejecting({
15107
- sink,
15108
- section: "workflow_dispatch",
15109
- expected: ["inputs"]
15110
- })
15111
- });
15112
- const EMPTY_IMAGE_VERSION = {
15113
- type: "image_version",
15114
- names: [],
15115
- versions: []
15116
- };
15117
- const parseImageVersion = (sink) => (node) => {
15118
- const { set } = setters();
15119
- return foldEntries({
15120
- entries: emptyableSection(sink)("image_version", node),
15121
- initial: EMPTY_IMAGE_VERSION,
15122
- handlers: [["names", set("names", strings$1(sink, "names"))], ["versions", set("versions", strings$1(sink, "versions"))]],
15123
- unknown: rejecting({
15124
- sink,
15125
- section: "image_version",
15126
- expected: ["names", "versions"]
15127
- })
15128
- });
15129
- };
15130
- // src/app/presets/entities/workflow/lib/events.ts
15131
- const SCHEDULE_ELEMENT = "element of \"schedule\" section";
15132
- const nonEmpty$1 = (sink) => (entry) => Option.liftPredicate(parseString(sink)(entry.value, false), (text) => text.value !== "");
15133
- const scheduleEntry = (sink) => (node) => {
15134
- const { setSome } = setters();
15135
- const state = foldEntries({
15136
- entries: parseMapping(sink)({
15137
- place: SCHEDULE_ELEMENT,
15138
- node,
15139
- allowEmpty: false,
15140
- caseSensitive: true
15141
- }),
15142
- initial: {},
15143
- handlers: [["cron", setSome("cron", nonEmpty$1(sink))], ["timezone", setSome("timezone", nonEmpty$1(sink))]],
15144
- unknown: rejecting({
15145
- sink,
15146
- section: SCHEDULE_ELEMENT,
15147
- expected: ["cron", "timezone"]
15148
- })
15149
- });
15150
- return pipe(Option.fromNullishOr(state.cron), Option.map((cron) => ({
15151
- cron,
15152
- ...optional("timezone")(Option.fromNullishOr(state.timezone))
15153
- })));
15154
- };
15155
- const parseSchedule = (sink) => (node) => {
15156
- if (!checkSequence$1(sink)({
15157
- section: "schedule",
15158
- node,
15159
- allowEmpty: false
15160
- })) return Option.none();
15161
- return Option.some({
15162
- type: "schedule",
15163
- schedules: pipe(node.children, Array$1.flatMap((child) => Option.toArray(scheduleEntry(sink)(child))))
15164
- });
15165
- };
15166
- const strings = (sink) => (entry) => parseStringOrSequence(sink)({
15167
- section: entry.key.value,
15168
- node: entry.value,
15169
- allowEmpty: false,
15170
- allowElementEmpty: false
15171
- });
15172
- const parseRepositoryDispatch = (sink) => (node) => foldEntries({
15173
- entries: emptyableSection(sink)("repository_dispatch", node),
15174
- initial: {
15175
- type: "repository_dispatch",
15176
- types: []
15177
- },
15178
- handlers: [["types", setters().set("types", strings(sink))]],
15179
- unknown: rejecting({
15180
- sink,
15181
- section: "repository_dispatch",
15182
- expected: ["types"]
15183
- })
15184
- });
15185
- const WEBHOOK_FILTERS = [
15186
- ["branches", "branches"],
15187
- ["branches-ignore", "branchesIgnore"],
15188
- ["tags", "tags"],
15189
- ["tags-ignore", "tagsIgnore"],
15190
- ["paths", "paths"],
15191
- ["paths-ignore", "pathsIgnore"]
15192
- ];
15193
- const WEBHOOK_KEYS = [
15194
- "types",
15195
- "branches",
15196
- "branches-ignore",
15197
- "tags",
15198
- "tags-ignore",
15199
- "paths",
15200
- "paths-ignore",
15201
- "workflows"
15202
- ];
15203
- const emptyWebhook = (name) => ({
15204
- type: "webhook",
15205
- hook: name,
15206
- types: [],
15207
- workflows: [],
15208
- line: name.line,
15209
- column: name.column
15210
- });
15211
- const webhookHandlers = (sink) => {
15212
- const { set } = setters();
15213
- const filter = (entry) => ({
15214
- name: entry.key,
15215
- values: strings(sink)(entry)
15216
- });
15217
- return [
15218
- ["types", set("types", strings(sink))],
15219
- ["workflows", set("workflows", strings(sink))],
15220
- ...pipe(WEBHOOK_FILTERS, Array$1.map(([key, field]) => [key, set(field, filter)]))
15221
- ];
15222
- };
15223
- const parseWebhook = (sink) => (name, node) => foldEntries({
15224
- entries: emptyableSection(sink)(name.value, node),
15225
- initial: emptyWebhook(name),
15226
- handlers: webhookHandlers(sink),
15227
- unknown: rejecting({
15228
- sink,
15229
- section: name.value,
15230
- expected: WEBHOOK_KEYS
15231
- })
15232
- });
15233
- // src/app/presets/entities/workflow/lib/workflow-call.ts
15234
- const CALL_TYPES$1 = {
15235
- boolean: "boolean",
15236
- number: "number",
15237
- string: "string"
15238
- };
15239
- const inputType = (sink) => (state, entry) => {
15240
- const node = entry.value;
15241
- if (!checkString$1(sink)(node, false)) return {
15242
- ...state,
15243
- typed: true
15244
- };
15245
- return Option.match(Record.get(CALL_TYPES$1, node.value), {
15246
- onSome: (kind) => ({
15247
- input: {
15248
- ...state.input,
15249
- kind
15250
- },
15251
- typed: true
15252
- }),
15253
- onNone: () => {
15254
- sink.error(node, `invalid value ${quote(node.value)} for input type of workflow_call event. it must be one of "boolean", "number", or "string"`);
15255
- return {
15256
- ...state,
15257
- typed: true
15258
- };
15259
- }
15260
- });
15261
- };
15262
- const lift = (handler) => (state, entry) => ({
15263
- ...state,
15264
- input: handler(state.input, entry)
15265
- });
15266
- const required = (sink) => (entry) => parseBool(sink)(entry.value);
15267
- const mappingOf = (sink, place) => (entry) => parseMapping(sink)({
15268
- place,
15269
- node: entry.value,
15270
- allowEmpty: true,
15271
- caseSensitive: true
15272
- });
15273
- const callInput = (sink) => (entry) => {
15274
- const { set, setSome } = setters();
15275
- const description = lift(set("description", entryText(sink)(true)));
15276
- const isRequired = lift(setSome("required", required(sink)));
15277
- const fallback = lift(set("default", entryText(sink)(true)));
15278
- const state = foldEntries({
15279
- entries: mappingOf(sink, "input of workflow_call event")(entry),
15280
- initial: {
15281
- input: {
15282
- id: entry.id,
15283
- name: entry.key,
15284
- kind: "invalid"
15285
- },
15286
- typed: false
15287
- },
15288
- handlers: [
15289
- ["description", description],
15290
- ["required", isRequired],
15291
- ["default", fallback],
15292
- ["type", inputType(sink)]
15293
- ],
15294
- unknown: rejecting({
15295
- sink,
15296
- section: "inputs at workflow_call event",
15297
- expected: [
15298
- "description",
15299
- "required",
15300
- "default",
15301
- "type"
15302
- ]
15303
- })
15304
- });
15305
- if (!state.typed) sink.error(entry.key, `"type" is missing at ${quote(entry.key.value)} input of workflow_call event`);
15306
- return state.input;
15307
- };
15308
- const callSecret = (sink) => (entry) => {
15309
- const { set, setSome } = setters();
15310
- return foldEntries({
15311
- entries: mappingOf(sink, "secret of workflow_call event")(entry),
15312
- initial: { name: entry.key },
15313
- handlers: [["description", set("description", entryText(sink)(true))], ["required", setSome("required", required(sink))]],
15314
- unknown: rejecting({
15315
- sink,
15316
- section: "secrets",
15317
- expected: ["description", "required"]
15318
- })
15319
- });
15320
- };
15321
- const callOutput = (sink) => (entry) => {
15322
- const { set } = setters();
15323
- const output = foldEntries({
15324
- entries: mappingOf(sink, "output of workflow_call event")(entry),
15325
- initial: { name: entry.key },
15326
- handlers: [["description", set("description", entryText(sink)(true))], ["value", set("value", (item) => parseString(sink)(item.value, false))]],
15327
- unknown: rejecting({
15328
- sink,
15329
- section: "outputs at workflow_call event",
15330
- expected: ["description", "value"]
15331
- })
15332
- });
15333
- reportMissing(sink)(output.value, entry.key, `"value" is missing at ${quote(entry.key.value)} output of workflow_call event`);
15334
- return output;
15335
- };
15336
- const emptyCall = (at) => ({
15337
- type: "workflow_call",
15338
- inputs: [],
15339
- outputs: {},
15340
- line: at.line,
15341
- column: at.column
15342
- });
15343
- const parseWorkflowCall = (sink) => (at, node) => {
15344
- const { set } = setters();
15345
- return foldEntries({
15346
- entries: emptyableSection(sink)("workflow_call", node),
15347
- initial: emptyCall(at),
15348
- handlers: [
15349
- ["inputs", set("inputs", (entry) => Array$1.map(emptyableCaselessSection(sink)("inputs", entry.value), callInput(sink)))],
15350
- ["secrets", set("secrets", (entry) => entryRecord(callSecret(sink))(emptyableCaselessSection(sink)("secrets", entry.value)))],
15351
- ["outputs", set("outputs", (entry) => entryRecord(callOutput(sink))(emptyableCaselessSection(sink)("outputs", entry.value)))]
15352
- ],
15353
- unknown: rejecting({
15354
- sink,
15355
- section: "workflow_call",
15356
- expected: [
15357
- "inputs",
15358
- "secrets",
15359
- "outputs"
15360
- ]
15361
- })
15362
- });
15363
- };
15364
- // src/app/presets/entities/workflow/lib/on.ts
15365
- const withoutConfig = (sink) => (node) => {
15366
- const name = parseString(sink)(node, false);
15367
- switch (name.value) {
15368
- case "": return Option.none();
15369
- case "schedule":
15370
- sink.error(node, "schedule event must be configured with mapping");
15371
- return Option.none();
15372
- case "repository_dispatch": return Option.some({
15373
- type: "repository_dispatch",
15374
- types: []
15375
- });
15376
- case "workflow_dispatch": return Option.some(emptyDispatch(node));
15377
- case "workflow_call": return Option.some(emptyCall(node));
15378
- case "image_version": return Option.some(EMPTY_IMAGE_VERSION);
15379
- default: return Option.some({
15380
- ...emptyWebhook(name),
15381
- line: node.line,
15382
- column: node.column
15383
- });
15384
- }
15385
- };
15386
- const configured = (sink) => (entry) => {
15387
- switch (entry.id) {
15388
- case "schedule": return parseSchedule(sink)(entry.value);
15389
- case "workflow_dispatch": return Option.some(parseWorkflowDispatch(sink)(entry.key, entry.value));
15390
- case "repository_dispatch": return Option.some(parseRepositoryDispatch(sink)(entry.value));
15391
- case "workflow_call": return Option.some(parseWorkflowCall(sink)(entry.key, entry.value));
15392
- case "image_version": return Option.some(parseImageVersion(sink)(entry.value));
15393
- default: return Option.some(parseWebhook(sink)(entry.key, entry.value));
15394
- }
15395
- };
15396
- const each = (parse) => (items) => pipe(items, Array$1.flatMap((item) => Option.toArray(parse(item))));
15397
- const parseEvents = (sink) => (node) => {
15398
- if (node.kind === "scalar") return withoutConfig(sink)(node).pipe(Option.toArray, Option.some);
15399
- if (node.kind === "mapping") {
15400
- const entries = section$1(sink)("on", node);
15401
- return Option.some(each(configured(sink))(entries));
15402
- }
15403
- if (node.kind === "sequence") {
15404
- checkNotEmpty(sink)("on", node);
15405
- return Option.some(each(withoutConfig(sink))(node.children));
15406
- }
15407
- sink.error(node, `"on" section value is expected to be mapping or sequence but found ${node.kind} node`);
15408
- return Option.none();
15409
- };
15410
- // src/app/presets/entities/workflow/lib/parse.ts
15411
- const WORKFLOW_KEYS = [
15412
- "name",
15413
- "run-name",
15414
- "on",
15415
- "permissions",
15416
- "env",
15417
- "defaults",
15418
- "concurrency",
15419
- "jobs"
15420
- ];
15421
- const FIRST$2 = 1;
15422
- const EMPTY_WORKFLOW = {};
15423
- const parseRoot = (sink) => (root) => {
15424
- const { set, setSome } = setters();
15425
- const workflow = foldEntries({
15426
- entries: section$1(sink)("workflow", root),
15427
- initial: EMPTY_WORKFLOW,
15428
- handlers: [
15429
- ["name", set("name", (entry) => parseString(sink)(entry.value, true))],
15430
- ["on", setSome("on", (entry) => parseEvents(sink)(entry.value))],
15431
- ["permissions", set("permissions", (entry) => parsePermissions(sink)(entry.value))],
15432
- ["env", set("env", (entry) => parseEnv(sink)(entry.value))],
15433
- ["defaults", set("defaults", (entry) => parseDefaults(sink)(entry.value))],
15434
- ["concurrency", set("concurrency", (entry) => parseConcurrency(sink)(entry.key, entry.value))],
15435
- ["jobs", set("jobs", (entry) => entryRecord((job) => parseJob(sink)(job.key, job.value))(caselessSection(sink)("jobs", entry.value)))],
15436
- ["run-name", set("runName", (entry) => parseString(sink)(entry.value, false))]
15437
- ],
15438
- unknown: rejecting({
15439
- sink,
15440
- section: "workflow",
15441
- expected: WORKFLOW_KEYS
15442
- })
15443
- });
15444
- reportMissing(sink)(workflow.on, root, "\"on\" section is missing in workflow");
15445
- reportMissing(sink)(workflow.jobs, root, "\"jobs\" section is missing in workflow");
15446
- return workflow;
15447
- };
15448
- const parseWorkflow = (sink) => (source) => {
15449
- for (const problem of source.errors) sink.error(problem, problem.message);
15450
- const root = Option.fromNullishOr(source.yaml);
15451
- if (Option.isSome(root)) return Option.some(parseRoot(sink)(root.value));
15452
- if (pipe(source.errors, Array$1.some((problem) => String$1.startsWith("could not parse")(problem.message)))) return Option.none();
15453
- sink.error({
15454
- line: FIRST$2,
15455
- column: FIRST$2
15456
- }, "workflow is empty");
15457
- return Option.some(EMPTY_WORKFLOW);
15458
- };
15459
- // src/app/presets/entities/workflow/model/parsed.ts
15460
- const parsed = /* @__PURE__ */ new WeakMap();
15461
- const parse = (source) => {
15462
- const errors = [];
15463
- const workflow = parseWorkflow({ error: (at, message) => {
15464
- errors.push({
15465
- line: at.line,
15466
- column: at.column,
15467
- message
15468
- });
15469
- } })(source);
15470
- return {
15471
- errors,
15472
- ...optional("workflow")(workflow)
15473
- };
15474
- };
15475
- const workflowOf = (source) => parsed.getOrInsertComputed(source, () => parse(source));
15476
- // src/app/presets/shared/project-cache/index.ts
15477
- const projectCache = () => {
15478
- const cache = /* @__PURE__ */ new WeakMap();
15479
- const entriesOf = (project) => cache.getOrInsertComputed(project, () => /* @__PURE__ */ new Map());
15480
- return {
15481
- get: (project) => (key) => Option.fromNullishOr(entriesOf(project).get(key)),
15482
- set: (project) => (key, value) => {
15483
- entriesOf(project).set(key, value);
15484
- }
15485
- };
15486
- };
15487
- // src/app/presets/shared/uses/index.ts
15488
- const LOCAL = "./";
15489
- const SELF_REPOSITORY = "$/";
15490
- const localPath = (spec) => Option.orElse(afterPrefix(LOCAL)(spec), () => afterPrefix(SELF_REPOSITORY)(spec));
15491
- const isSelfReferenceWithRef = (spec) => Option.exists(afterPrefix(SELF_REPOSITORY)(spec), String$1.includes("@"));
15492
- const selfReferenceError = (spec) => `self repository reference ${quote(spec)} must not include @{ref}. "$/" always resolves to the commit of the running workflow. see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idstepsuses`;
15493
- // src/app/presets/entities/workflow/model/reusable.ts
15494
- const EMPTY_METADATA = {
15495
- inputs: {},
15496
- outputs: {},
15497
- secrets: {}
15498
- };
15499
- // src/app/presets/entities/workflow/lib/reusable-sections.ts
15500
- const KINDS = {
15501
- boolean: "boolean",
15502
- number: "number",
15503
- string: "string"
15504
- };
15505
- const fieldsOf$2 = (sink, node) => ({
15506
- required: flagAt(sink)("required")(node),
15507
- defaulted: Option.exists(valueAt("default")(node), (value) => Option.isSome(decodeOptionalString(sink)(value))),
15508
- type: Option.match(valueAt("type")(node), {
15509
- onNone: () => "",
15510
- onSome: decodeString(sink)
15511
- })
15512
- });
15513
- const inputOf$1 = (sink) => (name, node) => {
15514
- if (isNull(node)) return Option.some({
15515
- name,
15516
- required: false,
15517
- kind: "any"
15518
- });
15519
- if (node.kind !== "mapping") {
15520
- typeError(sink)(node, "actionlint.metadata");
15521
- return Option.none();
15522
- }
15523
- let failed = false;
15524
- const fields = fieldsOf$2((message) => {
15525
- failed = true;
15526
- sink(message);
15527
- }, node);
15528
- return pipe(Option.liftPredicate(fields, () => !failed), Option.map((found) => ({
15529
- name,
15530
- required: found.required && !found.defaulted,
15531
- kind: Option.getOrElse(Record.get(KINDS, found.type), () => "any")
15532
- })));
15533
- };
15534
- const inputsOf$1 = (sink) => (node) => {
15535
- let out = {};
15536
- if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.inputs")) return out;
15537
- for (const { key, value } of pairsOf(node)) {
15538
- const input = inputOf$1(sink)(key.value, value);
15539
- if (Option.isNone(input)) return out;
15540
- out = Record.set(out, lowerKey(key), input.value);
15541
- }
15542
- return out;
15543
- };
15544
- const secretRequired = (sink, node) => {
15545
- if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadataSecret")) return Option.liftPredicate(false, () => isNull(node));
15546
- let required = false;
15547
- let failed = false;
15548
- const local = (message) => {
15549
- failed = true;
15550
- sink(message);
15551
- };
15552
- for (const { key, value } of pairsOf(node)) if (key.value === "required") required = decodeBoolean(local)(value);
15553
- return Option.liftPredicate(required, () => !failed);
15554
- };
15555
- const secretsOf = (sink) => (node) => {
15556
- let out = {};
15557
- if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.secrets")) return out;
15558
- for (const { key, value } of pairsOf(node)) {
15559
- const required = secretRequired(sink, value);
15560
- if (Option.isNone(required)) return out;
15561
- out = Record.set(out, lowerKey(key), {
15562
- name: key.value,
15563
- required: required.value
15564
- });
15565
- }
15566
- return out;
15567
- };
15568
- const outputsOf$1 = (sink) => (node) => {
15569
- if (isNull(node) || !isMappingOrError(sink)(node, "on.workflow_call.outputs")) return {};
15570
- return Record.fromEntries(pipe(pairsOf(node), Array$1.map(({ key }) => [lowerKey(key), key.value])));
15571
- };
15572
- // src/app/presets/entities/workflow/lib/reusable.ts
15573
- const CALL = "workflow_call";
15574
- const isCall = (node) => String$1.toLowerCase(node.value) === CALL;
15575
- const metadataOf$2 = (sink, node) => {
15576
- if (!isPresent(sink)(node, "mapping", "actionlint.ReusableWorkflowMetadata")) return EMPTY_METADATA;
15577
- const section = (key) => valueAt(key)(node);
15578
- return {
15579
- inputs: pipe(section("inputs"), Option.map(inputsOf$1(sink)), Option.getOrElse(() => ({}))),
15580
- outputs: pipe(section("outputs"), Option.map(outputsOf$1(sink)), Option.getOrElse(() => ({}))),
15581
- secrets: pipe(section("secrets"), Option.map(secretsOf(sink)), Option.getOrElse(() => ({})))
15582
- };
15583
- };
15584
- const decodeCall = (node) => {
15585
- const errors = [];
15586
- const metadata = metadataOf$2((message) => {
15587
- errors.push(message);
15588
- }, node);
15589
- if (Array$1.isReadonlyArrayEmpty(errors)) return Result.succeed(metadata);
15590
- return Result.fail(`yaml: unmarshal errors:\n ${Array$1.join(errors, "\n ")}`);
15591
- };
15592
- const fromOn = (on) => {
15593
- const call = pipe(pairsOf(on), Array$1.findFirst((pair) => isCall(pair.key)));
15594
- if (on.kind === "mapping" && Option.isSome(call)) return decodeCall(call.value.value);
15595
- if (on.kind === "scalar" && isCall(on) || on.kind === "sequence" && pipe(on.children, Array$1.some(isCall))) return Result.succeed(EMPTY_METADATA);
15596
- return Result.fail(`"workflow_call" event trigger is not found in "on:" at line:${String(on.line)}, column:${String(on.column)}`);
15597
- };
15598
- const reusableOf = readYaml((source) => {
15599
- const on = pipe(Option.fromNullishOr(source.yaml), Option.filter((root) => root.kind === "mapping"), Option.flatMap(valueAt("on")));
15600
- if (Option.isNone(on)) return Result.fail("\"on:\" is not found");
15601
- return fromOn(on.value);
15602
- });
15603
- // src/app/presets/entities/workflow/lib/local-workflows.ts
15604
- const reusables = projectCache();
15605
- const unreadable = (spec, relative) => Result.fail(`could not read reusable workflow file for ${quote(spec)}: open ${relative}: no such file or directory`);
15606
- const load$1 = (project, spec, relative) => Option.match(project.parse(relative), {
15607
- onNone: () => unreadable(spec, relative),
15608
- onSome: (source) => Result.mapError(reusableOf(source), (message) => `error while parsing reusable workflow ${quote(spec)}: ${String$1.replaceAll("\n", " ")(message)}`)
15609
- });
15610
- const findReusable = (project) => (spec) => {
15611
- const relative = Option.filter(localPath(spec), () => !containsExpression(spec));
15612
- if (Option.isNone(relative)) return Option.none();
15613
- const hit = reusables.get(project)(spec);
15614
- if (Option.isSome(hit)) return hit.value;
15615
- const loaded = Option.some(load$1(project, spec, relative.value));
15616
- reusables.set(project)(spec, pipe(loaded, Option.filter((found) => Result.isSuccess(found))));
15617
- return loaded;
15618
- };
15619
- const skipReusable = (project) => (spec) => {
15620
- reusables.set(project)(spec, Option.none());
15621
- };
15622
- // src/app/presets/entities/workflow/lib/raw-compare.ts
15623
- const sameProps = (compare, mine, theirs) => Record.size(mine) === Record.size(theirs) && pipe(Record.toEntries(mine), Array$1.every(([name, value]) => Option.exists(Record.get(theirs, name), (other) => compare(value)(other))));
15624
- const sameElems = (compare, mine, theirs) => mine.length === theirs.length && pipe(Array$1.zip(mine, theirs), Array$1.every(([left, right]) => compare(left)(right)));
15625
- const rawEquals = (left) => (right) => {
15626
- if (left.type === "object" && right.type === "object") return sameProps(rawEquals, left.props, right.props);
15627
- if (left.type === "array" && right.type === "array") return sameElems(rawEquals, left.elems, right.elems);
15628
- return left.type === "string" && right.type === "string" && left.value === right.value;
15629
- };
15630
- const rawDescribe = (value) => {
15631
- if (value.type === "object") {
15632
- const parts = pipe(Record.toEntries(value.props), Array$1.map(([name, prop]) => `${quote(name)}: ${rawDescribe(prop)}`));
15633
- return `{${Array$1.join(Array$1.sort(parts, Order.String), ", ")}}`;
15634
- }
15635
- if (value.type === "array") return `[${pipe(value.elems, Array$1.map(rawDescribe), Array$1.join(", "))}]`;
15636
- return quote(value.value);
15637
- };
15638
- const isExpression = (value) => value.type === "string" && containsExpression(value.value);
15639
- const objectSubset = (compare, value, sub) => value.type === "object" && sub.type === "object" && pipe(Record.toEntries(sub.props), Array$1.every(([name, each]) => Option.exists(Record.get(value.props, name), (prop) => compare(prop)(each))));
15640
- const isSubset = (value) => (sub) => {
15641
- if (isExpression(sub)) return true;
15642
- if (value.type === "object") return objectSubset(isSubset, value, sub);
15643
- if (value.type === "array") return sub.type === "array" && sameElems(isSubset, value.elems, sub.elems);
15644
- return containsExpression(value.value) || rawEquals(value)(sub);
15645
- };
15646
14145
  // src/app/presets/features/check-workflows/lib/expression/scan.ts
15647
14146
  const OPEN$2 = "${{";
15648
14147
  const BASE = 1;
@@ -15676,7 +14175,7 @@ const checkNode = (env) => (site) => (expr, at) => {
15676
14175
  return Option.liftPredicate(checked.type, () => Array$1.isReadonlyArrayEmpty(checked.errors));
15677
14176
  };
15678
14177
  const checkSource = (env) => (site) => (source, at) => {
15679
- const parsed = parse$1(source);
14178
+ const parsed = parse(source);
15680
14179
  if (Result.isFailure(parsed.result)) {
15681
14180
  report$1(env)(at)(parsed.result.failure);
15682
14181
  return {
@@ -38524,7 +37023,7 @@ const embedded = (env, text, key) => {
38524
37023
  return pipe(Array$1.head(typed), Option.filter(() => typed.length === SINGLE$7 && isExpressionAssigned(text.value)), Option.map((one) => one.type));
38525
37024
  };
38526
37025
  const bare = (env, text, key) => {
38527
- const parsed = parse$1(`${text.value}${CLOSE$1}`).result;
37026
+ const parsed = parse(`${text.value}${CLOSE$1}`).result;
38528
37027
  if (Result.isFailure(parsed)) {
38529
37028
  report$1(env)(text)(parsed.failure);
38530
37029
  return Option.none();
@@ -38877,46 +37376,6 @@ const expressionVisitor = ({ fail, context }) => {
38877
37376
  }
38878
37377
  };
38879
37378
  };
38880
- // src/app/presets/features/check-workflows/lib/workflow-rule.ts
38881
- const NOOP = {
38882
- workflowPre: Function.constVoid,
38883
- jobPre: Function.constVoid,
38884
- step: Function.constVoid,
38885
- jobPost: Function.constVoid,
38886
- workflowPost: Function.constVoid
38887
- };
38888
- const eachEvent = (check) => (workflow) => {
38889
- for (const event of Option.getOrElse(Option.fromNullishOr(workflow.on), () => [])) check(event);
38890
- };
38891
- const visitJob = (visitor, job) => {
38892
- visitor.jobPre(job);
38893
- for (const step of Option.getOrElse(Option.fromNullishOr(job.steps), () => [])) visitor.step(step);
38894
- visitor.jobPost(job);
38895
- };
38896
- const visit$1 = (visitor, workflow) => {
38897
- visitor.workflowPre(workflow);
38898
- for (const job of Record.values(Option.getOrElse(Option.fromNullishOr(workflow.jobs), () => ({})))) visitJob(visitor, job);
38899
- visitor.workflowPost(workflow);
38900
- };
38901
- const workflowRule = (rule) => defineRule({
38902
- meta: {
38903
- description: rule.description,
38904
- docs: rule.docs,
38905
- kinds: ["workflow"]
38906
- },
38907
- check: (context) => {
38908
- for (const workflow of Option.toArray(Option.fromNullishOr(workflowOf(context.source).workflow))) {
38909
- const fail = (at, message) => {
38910
- context.report({
38911
- line: at.line,
38912
- column: at.column,
38913
- message
38914
- });
38915
- };
38916
- visit$1(rule.visitor(fail, context), workflow);
38917
- }
38918
- }
38919
- });
38920
37379
  // src/app/presets/features/check-workflows/model/rules/expression.ts
38921
37380
  const expression = workflowRule({
38922
37381
  description: "Reports type errors, undefined properties and untrusted inputs in expressions",
@@ -39053,7 +37512,7 @@ const jobNeeds = workflowRule({
39053
37512
  const OPEN$1 = 3;
39054
37513
  const matrixProperty = (label) => {
39055
37514
  if (!isExpressionAssigned(label.value)) return Option.none();
39056
- const parsed = parse$1(String$1.slice(OPEN$1)(String$1.trim(label.value))).result;
37515
+ const parsed = parse(String$1.slice(OPEN$1)(String$1.trim(label.value))).result;
39057
37516
  return pipe(Result.getSuccess(parsed), Option.flatMap((expr) => {
39058
37517
  if (expr.type === "object-deref" && expr.receiver.type === "variable" && expr.receiver.name === "matrix") return Option.some(expr.property);
39059
37518
  return Option.none();
@@ -41118,15 +39577,6 @@ const shown = (finding) => {
41118
39577
  const code = CODES[finding.code];
41119
39578
  return `shellcheck reported issue in this script: SC${String(code.number)}:${code.level}:${String(finding.line)}:${String(finding.column)}: ${messageOf(finding)}`;
41120
39579
  };
41121
- // src/app/presets/features/check-workflows/lib/step.ts
41122
- const runOf = (step) => pipe(Option.fromNullishOr(step.exec), Option.flatMap((exec) => {
41123
- if (exec.type === "run") return Option.some(exec);
41124
- return Option.none();
41125
- }));
41126
- const actionOf = (step) => pipe(Option.fromNullishOr(step.exec), Option.flatMap((exec) => {
41127
- if (exec.type === "action") return Option.some(exec);
41128
- return Option.none();
41129
- }));
41130
39580
  // src/app/presets/features/check-workflows/model/rules/shell-name.ts
41131
39581
  const SHELLS = {
41132
39582
  unix: [
@@ -42581,7 +41031,7 @@ const START = 0;
42581
41031
  const SINGLE = 2;
42582
41032
  const checkExpression = (fail) => (at, input) => {
42583
41033
  const trimmed = String$1.trim(input);
42584
- if (pipe(parse$1(`${trimmed}${CLOSE}`).result, Result.getSuccess, Option.exists(isConstant))) fail(at, `constant expression ${quote(trimmed)} in condition. remove the if: section`);
41034
+ if (pipe(parse(`${trimmed}${CLOSE}`).result, Result.getSuccess, Option.exists(isConstant))) fail(at, `constant expression ${quote(trimmed)} in condition. remove the if: section`);
42585
41035
  };
42586
41036
  const checkPlaceholder = (fail) => (condition, start, end) => {
42587
41037
  const { value } = condition;
@@ -42755,7 +41205,12 @@ const zizmor = ({ concerns = ALL_CONCERNS, ...settings } = {}) => ({
42755
41205
  ...presetOf("zizmor", zizmorPlugin)(pipe(concerns, Array$1.flatMap((concern) => ZIZMOR_CONCERNS[concern]))),
42756
41206
  settings: { zizmor: settings }
42757
41207
  });
42758
- const recommended = () => ({ extends: [actionlint(), zizmor()] });
42759
- export { actionlint, recommended, zizmor };
41208
+ const practices = () => presetOf("practices", practicesPlugin)(Record.keys(practicesPlugin.rules));
41209
+ const recommended = () => ({ extends: [
41210
+ actionlint(),
41211
+ zizmor(),
41212
+ practices()
41213
+ ] });
41214
+ export { actionlint, practices, recommended, zizmor };
42760
41215
 
42761
41216
  //# sourceMappingURL=presets.mjs.map