@r_masseater/fu4 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/presets.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as baseName, i as afterPrefix, o as definePlugin, s as defineRule, t as INPUT_KINDS } from "./types-CsheTVso.mjs";
1
+ import { c as baseName, i as INPUT_KINDS, l as definePlugin, s as afterPrefix, t as lineStartsOf, u as defineRule } from "./source-BRZXj75b.mjs";
2
2
  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
3
  import { layer } from "@effect/platform-node/NodeServices";
4
4
  import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/http";
@@ -527,10 +527,13 @@ const subfeature = subfeatureOf(0);
527
527
  const descendants = (node) => Array$1.prepend(pipe(node.children, Array$1.flatMap(descendants)), node);
528
528
  const anyWithin = (matches) => (root) => pipe(descendants(root), Array$1.some(matches));
529
529
  const fieldOf$2 = (field) => (node) => pipe(node.children, Array$1.findFirst((child) => child.field === field));
530
+ const fieldTextOf = (field) => (node) => pipe(fieldOf$2(field)(node), Option.map((child) => child.text));
530
531
  const fieldsOf$5 = (field) => (node) => pipe(node.children, Array$1.filter((child) => child.field === field));
531
532
  const isType = (...types) => (node) => types.includes(node.type);
532
- const namedOfType = (...types) => (node) => pipe(node.namedChildren, Array$1.filter(isType(...types)));
533
- const ofType = (...types) => (node) => pipe(node, Option.filter(isType(...types)));
533
+ const typedWithin = (select) => (...types) => (node) => pipe(select(node), Array$1.filter(isType(...types)));
534
+ const namedOfType = typedWithin((node) => node.namedChildren);
535
+ const descendantsOfType = typedWithin(descendants);
536
+ const ofType = (...types) => Option.filter(isType(...types));
534
537
  // src/app/presets/shared/yamlpath/nodes.ts
535
538
  const MAPPINGS = /* @__PURE__ */ new Set(["block_mapping", "flow_mapping"]);
536
539
  const SEQUENCES = /* @__PURE__ */ new Set(["block_sequence", "flow_sequence"]);
@@ -557,11 +560,6 @@ const anchorOf = (anchor) => pipe(parentOf$1(anchor), Option.flatMap(namedWhere(
557
560
  start: anchor.start,
558
561
  target
559
562
  })));
560
- const lineStartsOf = (text) => {
561
- const starts = [NONE$15];
562
- for (const match of String$1.matchAll(/\n/gu)(text)) starts.push(Option.getOrElse(Option.fromNullishOr(match.index), () => NONE$15) + NAME_START$1);
563
- return starts;
564
- };
565
563
  const topOf = (root) => pipe(namedWhere((child) => child.type === "document")(root), Option.flatMap(namedWhere(isContainer)), Result.fromOption(() => "document has no block_node or flow_node"));
566
564
  const hasError$1 = anyWithin((node) => node.isError || node.isMissing);
567
565
  const cache$1 = /* @__PURE__ */ new WeakMap();
@@ -590,7 +588,7 @@ const containing = (offset) => (node) => pipe(node.namedChildren, Array$1.findFi
590
588
  const offsetInsideComment = (document) => (offset) => Option.exists(containing(offset)(document.root), isComment);
591
589
  // src/app/presets/shared/yamlpath/feature.ts
592
590
  const NONE$14 = 0;
593
- const NEXT$21 = 1;
591
+ const NEXT$20 = 1;
594
592
  const SPACES$1 = /^ *$/u;
595
593
  const indentStart = (before, lineStart, fallback) => {
596
594
  if (SPACES$1.test(String$1.slice(lineStart)(before))) return lineStart;
@@ -604,7 +602,7 @@ const withLeadingWhitespace = (document) => (node) => {
604
602
  const before = String$1.slice(NONE$14, node.start)(document.text);
605
603
  const lineStart = Option.match(String$1.lastIndexOf("\n")(before), {
606
604
  onNone: () => node.start,
607
- onSome: (index) => index + NEXT$21
605
+ onSome: (index) => index + NEXT$20
608
606
  });
609
607
  const start = indentStart(before, lineStart, node.start);
610
608
  return String$1.slice(start, node.end)(document.text);
@@ -826,6 +824,7 @@ const finding = (meta) => ({
826
824
  rawLocations: [],
827
825
  tip: Option.none()
828
826
  });
827
+ const singleDraft = (meta, ...steps) => [Array$1.reduce(steps, finding(meta), (draft, step) => step(draft))];
829
828
  const severity = (value) => (draft) => ({
830
829
  ...draft,
831
830
  severity: value
@@ -855,7 +854,7 @@ const atRaw = (location) => (draft) => ({
855
854
  ...draft,
856
855
  rawLocations: [...draft.rawLocations, location]
857
856
  });
858
- const SINGLE$20 = 1;
857
+ const SINGLE$21 = 1;
859
858
  const asPrimary = (only) => ({
860
859
  ...only,
861
860
  symbolic: {
@@ -869,7 +868,7 @@ const finished$1 = (draft) => (locations) => ({
869
868
  ignored: pipe(locations, Array$1.flatMap((each) => each.concrete.comments), Array$1.some(commentIgnores(draft.ident)))
870
869
  });
871
870
  const withPrimary = (locations) => {
872
- if (locations.length === SINGLE$20) return Result.succeed(pipe(locations, Array$1.map(asPrimary)));
871
+ if (locations.length === SINGLE$21) return Result.succeed(pipe(locations, Array$1.map(asPrimary)));
873
872
  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()");
874
873
  return Result.succeed(locations);
875
874
  };
@@ -893,10 +892,14 @@ const KEY$1 = 0;
893
892
  const VALUE$1 = 1;
894
893
  const isQuoted = (node) => node.style === "single-quoted" || node.style === "double-quoted";
895
894
  const isNull = (node) => node.kind === "scalar" && node.tag === "!!null";
896
- const pairsOf = (node) => 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]) => ({
897
- key,
898
- value
899
- })), Option.toArray)));
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));
900
903
  const valueAt = (key) => (node) => pipe(pairsOf(node), Array$1.findFirst((pair) => pair.key.value === key), Option.map((pair) => pair.value));
901
904
  const textOf$2 = (node) => ({
902
905
  value: node.value,
@@ -953,9 +956,11 @@ const shown$1 = (node) => {
953
956
  if (chars.length > SHOWN) return `${node.tag} \`${head} ...\``;
954
957
  return `${node.tag} \`${head}\``;
955
958
  };
956
- const typeError = (sink) => (node, target) => {
957
- sink(`line ${String(node.line)}: cannot unmarshal ${shown$1(node)} into ${target}`);
959
+ const reporter = (describe) => (sink) => (node, detail) => {
960
+ sink(`line ${String(node.line)}: ${describe(node, detail)}`);
958
961
  };
962
+ const custom = reporter((_node, message) => message);
963
+ const typeError = reporter((node, target) => `cannot unmarshal ${shown$1(node)} into ${target}`);
959
964
  const decodeString = (sink) => (node) => {
960
965
  if (node.kind !== "scalar") {
961
966
  typeError(sink)(node, "string");
@@ -994,13 +999,10 @@ const isPresent = (sink) => (node, kind, target) => {
994
999
  };
995
1000
  const isMappingOrError = (sink) => (node, where) => {
996
1001
  if (node.kind === "mapping") return true;
997
- sink(`line ${String(node.line)}: yaml: ${where} must be mapping node but ${node.kind} node was found at line:${String(node.line)}, col:${String(node.column)}`);
1002
+ custom(sink)(node, `yaml: ${where} must be mapping node but ${node.kind} node was found at line:${String(node.line)}, col:${String(node.column)}`);
998
1003
  return false;
999
1004
  };
1000
1005
  const lowerKey = (node) => String$1.toLowerCase(node.value);
1001
- const custom = (sink) => (node, message) => {
1002
- sink(`line ${String(node.line)}: ${message}`);
1003
- };
1004
1006
  // src/app/presets/features/audit-workflows/lib/decode.ts
1005
1007
  const NUMERIC$1 = /* @__PURE__ */ new Set(["!!int", "!!float"]);
1006
1008
  const isString = (node) => node.kind === "scalar" && node.tag === "!!str";
@@ -1055,7 +1057,7 @@ const OPEN$5 = "${{";
1055
1057
  const CLOSE$4 = "}}";
1056
1058
  const SLUG_PARTS = 3;
1057
1059
  const OWNER_REPO = 2;
1058
- const NEXT$20 = 1;
1060
+ const NEXT$19 = 1;
1059
1061
  const FALSY$1 = 0;
1060
1062
  const DOCKER$1 = "docker://";
1061
1063
  const PERMISSION_LEVELS = record(literal$1([
@@ -1172,7 +1174,7 @@ const repositoryOf = (raw, uses) => ([path, gitRef]) => {
1172
1174
  };
1173
1175
  const parseRepository = (raw) => {
1174
1176
  const uses = String$1.trim(raw);
1175
- return pipe(uses, String$1.lastIndexOf("@"), Option.map((at) => [String$1.slice(FALSY$1, at)(uses), String$1.slice(at + NEXT$20)(uses)]), Result.fromOption(() => `malformed \`uses\` ref: missing \`@<ref>\` in ${uses}`), Result.flatMap(repositoryOf(raw, uses)));
1177
+ return pipe(uses, String$1.lastIndexOf("@"), Option.map((at) => [String$1.slice(FALSY$1, at)(uses), String$1.slice(at + NEXT$19)(uses)]), Result.fromOption(() => `malformed \`uses\` ref: missing \`@<ref>\` in ${uses}`), Result.flatMap(repositoryOf(raw, uses)));
1176
1178
  };
1177
1179
  const parseUses = (raw) => {
1178
1180
  const uses = String$1.trim(raw);
@@ -1360,9 +1362,16 @@ const NO_LIMIT = 0;
1360
1362
  const DIGITS$3 = /^\d+$/u;
1361
1363
  const noStrings$2 = () => [];
1362
1364
  const noEntries = () => /* @__PURE__ */ new Map();
1363
- const u64 = (value, isInteger) => Result.liftPredicate(value, (each) => isInteger && each >= MINIMUM$1, () => "expected u64");
1364
- const unsigned$1 = (node) => pipe(number$1(node), Result.flatMap((value) => u64(value, node.tag === "!!int")));
1365
- const lenientUnsigned = (node) => pipe(anyScalar(node), Result.flatMap((text) => u64(Number(text), DIGITS$3.test(text))));
1365
+ const u64 = ({ value, isInteger }) => Result.liftPredicate(value, (each) => isInteger && each >= MINIMUM$1, () => "expected u64");
1366
+ const unsignedFrom = (read, counted) => (node) => pipe(read(node), Result.flatMap((value) => u64(counted(value, node.tag))));
1367
+ const unsigned$1 = unsignedFrom(number$1, (value, tag) => ({
1368
+ value,
1369
+ isInteger: tag === "!!int"
1370
+ }));
1371
+ const lenientUnsigned = unsignedFrom(anyScalar, (text) => ({
1372
+ value: Number(text),
1373
+ isInteger: DIGITS$3.test(text)
1374
+ }));
1366
1375
  const strings$4 = sequence$2(string$1);
1367
1376
  const intervals = literal$1(INTERVALS);
1368
1377
  const days = literal$1(DAYS);
@@ -2058,17 +2067,13 @@ const matchesUses = (uses) => Match.type().pipe(Match.discriminatorsExhaustive("
2058
2067
  "in-owner": (pattern) => same(uses.owner, pattern.owner),
2059
2068
  any: () => true
2060
2069
  }));
2061
- const matchesSlug = (slug, gitRef) => Match.type().pipe(Match.discriminatorsExhaustive("type")({
2062
- "exact-with-ref": (pattern) => Option.isNone(pattern.subpath) && sameRepo(slug, pattern) && gitRef === pattern.gitRef,
2063
- "exact-path": () => false,
2064
- "exact-repo": (pattern) => sameRepo(slug, pattern),
2065
- "in-repo": (pattern) => sameRepo(slug, pattern),
2066
- "in-owner": (pattern) => same(slug.owner, pattern.owner),
2067
- any: () => true
2068
- }));
2069
2070
  const patternMatches = (pattern) => (ref) => {
2070
2071
  if (ref.type === "uses") return matchesUses(ref.uses)(pattern);
2071
- return pipe(ref.slug, Option.exists((slug) => matchesSlug(slug, ref.gitRef)(pattern)));
2072
+ return pipe(ref.slug, Option.exists((slug) => matchesUses({
2073
+ ...slug,
2074
+ gitRef: ref.gitRef,
2075
+ subpath: Option.none()
2076
+ })(pattern)));
2072
2077
  };
2073
2078
  const usesRef = (uses) => ({
2074
2079
  type: "uses",
@@ -2234,12 +2239,6 @@ const display = Match.type().pipe(Match.discriminatorsExhaustive("type")({
2234
2239
  array: () => "Array",
2235
2240
  object: () => "Object"
2236
2241
  }));
2237
- const semaEquals = (left) => (right) => {
2238
- if (left.type === "null" && right.type === "null") return true;
2239
- if (left.type === "boolean" && right.type === "boolean") return left.value === right.value;
2240
- if (left.type === "string" && right.type === "string") return upperSpecial(left.value) === upperSpecial(right.value);
2241
- return asNumber(left) === asNumber(right);
2242
- };
2243
2242
  const compareNumbers = (left, right) => Option.liftPredicate(Order.Number(left, right), () => !Number.isNaN(left) && !Number.isNaN(right));
2244
2243
  const semaCompare = (left) => (right) => {
2245
2244
  if (left.type === "null" && right.type === "null") return Option.some(EQUAL$1);
@@ -2247,6 +2246,7 @@ const semaCompare = (left) => (right) => {
2247
2246
  if (left.type === "string" && right.type === "string") return Option.some(Order.String(upperSpecial(left.value), upperSpecial(right.value)));
2248
2247
  return compareNumbers(asNumber(left), asNumber(right));
2249
2248
  };
2249
+ const semaEquals = (left) => (right) => Option.exists(semaCompare(left)(right), (order) => order === EQUAL$1);
2250
2250
  const isPrimitive = (value) => value.type !== "array" && value.type !== "object";
2251
2251
  const isJsonArray = (value) => Array$1.isArray(value);
2252
2252
  const isStructure = (value) => Array$1.isArray(value) || Predicate.isObject(value);
@@ -2287,25 +2287,25 @@ const toJsonValue = Match.type().pipe(Match.discriminatorsExhaustive("type")({
2287
2287
  const toJson = (value) => Result.getOrThrow(printJson(toJsonValue(value)));
2288
2288
  // src/app/presets/entities/expression-tree/lib/format.ts
2289
2289
  const START$10 = 0;
2290
- const NEXT$19 = 1;
2290
+ const NEXT$18 = 1;
2291
2291
  const PAIR$7 = 2;
2292
2292
  const BRACE$1 = /[{}]/u;
2293
2293
  const DIGITS$1 = /^\d+/u;
2294
2294
  const ESCAPES$1 = /* @__PURE__ */ new Set(["{{", "}}"]);
2295
2295
  const after$4 = (from) => (found) => pipe(found, Option.map((at) => at + from));
2296
2296
  const nextBrace = (text) => (from) => pipe(String$1.slice(from)(text), String$1.search(BRACE$1), after$4(from));
2297
- const closeAfter = (text) => (open) => pipe(String$1.slice(open + NEXT$19)(text), String$1.indexOf("}"), after$4(open + NEXT$19));
2297
+ const closeAfter = (text) => (open) => pipe(String$1.slice(open + NEXT$18)(text), String$1.indexOf("}"), after$4(open + NEXT$18));
2298
2298
  const escaped$1 = (text) => (at) => pipe(Option.liftPredicate(String$1.slice(at, at + PAIR$7)(text), (pair) => ESCAPES$1.has(pair)), Option.map((pair) => ({
2299
- text: String$1.slice(NEXT$19)(pair),
2299
+ text: String$1.slice(NEXT$18)(pair),
2300
2300
  next: at + PAIR$7
2301
2301
  })));
2302
2302
  const argumentAt = (template) => (open) => Option.gen(function* parse() {
2303
- const close = yield* Option.filter(closeAfter(template.text)(open), (at) => at > open + NEXT$19);
2304
- const [digits] = yield* Option.fromNullishOr(DIGITS$1.exec(String$1.slice(open + NEXT$19)(template.text)));
2305
- const value = yield* Array$1.get(template.args, Number(digits) + NEXT$19);
2303
+ const close = yield* Option.filter(closeAfter(template.text)(open), (at) => at > open + NEXT$18);
2304
+ const [digits] = yield* Option.fromNullishOr(DIGITS$1.exec(String$1.slice(open + NEXT$18)(template.text)));
2305
+ const value = yield* Array$1.get(template.args, Number(digits) + NEXT$18);
2306
2306
  return {
2307
2307
  text: display(value),
2308
- next: close + NEXT$19
2308
+ next: close + NEXT$18
2309
2309
  };
2310
2310
  });
2311
2311
  const stepAt = (template) => (brace) => {
@@ -2441,28 +2441,31 @@ const OPERATORS = {
2441
2441
  gt: ordered((order) => order > EQUAL),
2442
2442
  ge: ordered((order) => order >= EQUAL)
2443
2443
  };
2444
- const none$4 = () => Option.none();
2444
+ const none$3 = () => Option.none();
2445
2445
  const consteval = (expr) => Match.value(expr).pipe(Match.discriminatorsExhaustive("type")({
2446
2446
  literal: ({ literal }) => Option.some(literalValue(literal)),
2447
2447
  binary: ({ lhs, op, rhs }) => pipe(Option.all([consteval(lhs.expr), consteval(rhs.expr)]), Option.map(([left, right]) => OPERATORS[op](left, right))),
2448
2448
  not: ({ inner }) => Option.map(consteval(inner.expr), (value) => booleanOf(!asBoolean(value))),
2449
2449
  call: ({ args, func }) => pipe(args, Array$1.map((arg) => consteval(arg.expr)), Option.all, Option.flatMap(evaluateCall(func))),
2450
- star: none$4,
2451
- identifier: none$4,
2452
- index: none$4,
2453
- context: none$4
2450
+ star: none$3,
2451
+ identifier: none$3,
2452
+ index: none$3,
2453
+ context: none$3
2454
2454
  }));
2455
2455
  // src/app/presets/entities/expression-tree/lib/context.ts
2456
2456
  const PATTERN = /^[A-Za-z0-9_-]+(?:\.(?:[A-Za-z0-9_-]+|\*))*$/u;
2457
2457
  const PAIR$5 = 2;
2458
2458
  const HEAD = 0;
2459
2459
  const TAIL = 1;
2460
- const comparePart = (pattern, part) => {
2461
- if (pattern === "*") return true;
2462
- if (part.type === "identifier") return String$1.toLowerCase(pattern) === String$1.toLowerCase(part.name);
2463
- if (part.type === "index" && part.inner.expr.type === "literal" && part.inner.expr.literal.kind === "string") return String$1.toLowerCase(pattern) === String$1.toLowerCase(part.inner.expr.literal.value);
2464
- return false;
2460
+ const stringIndex = (part) => {
2461
+ if (part.type === "index" && part.inner.expr.type === "literal" && part.inner.expr.literal.kind === "string") return Option.some(part.inner.expr.literal.value);
2462
+ return Option.none();
2463
+ };
2464
+ const tailName = (last) => {
2465
+ if (last.type === "identifier") return Option.some(last.name);
2466
+ return stringIndex(last);
2465
2467
  };
2468
+ const comparePart = (pattern, part) => pattern === "*" || Option.exists(tailName(part), (name) => String$1.toLowerCase(pattern) === String$1.toLowerCase(name));
2466
2469
  const compare = (pattern, context) => {
2467
2470
  if (!PATTERN.test(pattern)) return Option.none();
2468
2471
  const patterns = String$1.split(".")(pattern);
@@ -2474,27 +2477,11 @@ const compare = (pattern, context) => {
2474
2477
  };
2475
2478
  const matchesPattern = (pattern) => (context) => Option.contains(compare(pattern, context), "match");
2476
2479
  const childOf$1 = (pattern) => (context) => Option.isSome(compare(pattern, context));
2477
- const stringIndex = (part) => {
2478
- if (part.type === "index" && part.inner.expr.type === "literal" && part.inner.expr.literal.kind === "string") return Option.some(part.inner.expr.literal.value);
2479
- return Option.none();
2480
- };
2481
- const tailName = (last) => {
2482
- if (last.type === "identifier") return Option.some(last.name);
2483
- return stringIndex(last);
2484
- };
2485
2480
  const singleTail = (context) => {
2486
2481
  if (context.parts.length !== PAIR$5) return Option.none();
2487
2482
  return pipe(Array$1.get(context.parts, HEAD), Option.filter((head) => head.expr.type === "identifier"), Option.flatMap(() => Array$1.get(context.parts, TAIL)), Option.flatMap((tail) => tailName(tail.expr)));
2488
2483
  };
2489
- const partPattern = (part) => {
2490
- if (part.type === "identifier") return Option.some(part.name);
2491
- if (part.type === "star") return Option.some("*");
2492
- if (part.type === "index") {
2493
- if (part.inner.expr.type === "literal" && part.inner.expr.literal.kind === "string") return Option.some(part.inner.expr.literal.value);
2494
- return Option.some("*");
2495
- }
2496
- return Option.none();
2497
- };
2484
+ const partPattern = (part) => tailName(part).pipe(Option.orElse(() => Option.liftPredicate("*", () => part.type === "star" || part.type === "index")));
2498
2485
  const ASCII_UPPER = /^[A-Z]$/u;
2499
2486
  const asciiLower = (char) => {
2500
2487
  if (ASCII_UPPER.test(char)) return String$1.toLowerCase(char);
@@ -2503,7 +2490,7 @@ const asciiLower = (char) => {
2503
2490
  const lowerAscii = (text) => pipe(String$1.split("")(text), Array$1.map(asciiLower), Array$1.join(""));
2504
2491
  const asPattern = (context) => pipe(Array$1.head(context.parts), Option.filter((head) => head.expr.type !== "call"), Option.flatMap(() => Option.all(pipe(context.parts, Array$1.map((part) => partPattern(part.expr))))), Option.map((parts) => lowerAscii(Array$1.join(parts, "."))));
2505
2492
  // src/app/presets/entities/expression-tree/lib/lexer.ts
2506
- const NEXT$18 = 1;
2493
+ const NEXT$17 = 1;
2507
2494
  const PAIR$4 = 2;
2508
2495
  const NO_VALUE = 0;
2509
2496
  const QUOTE$6 = "'";
@@ -2528,7 +2515,7 @@ const BOUNDARY = /* @__PURE__ */ new Set([
2528
2515
  "&",
2529
2516
  "|"
2530
2517
  ]);
2531
- const SINGLE$19 = /* @__PURE__ */ new Map([
2518
+ const SINGLE$20 = /* @__PURE__ */ new Map([
2532
2519
  ["(", "("],
2533
2520
  [")", ")"],
2534
2521
  ["[", "["],
@@ -2596,15 +2583,15 @@ const simple = (tok, start, end) => ({
2596
2583
  });
2597
2584
  const runEnd = (src, from, keep) => {
2598
2585
  let end = from;
2599
- while (end < src.length && keep(charAt$1(src)(end))) end += NEXT$18;
2586
+ while (end < src.length && keep(charAt$1(src)(end))) end += NEXT$17;
2600
2587
  return end;
2601
2588
  };
2602
2589
  const stringEnd = (src, start) => {
2603
2590
  const at = charAt$1(src);
2604
- let index = start + NEXT$18;
2605
- while (index < src.length) if (at(index) === QUOTE$6 && at(index + NEXT$18) === QUOTE$6) index += PAIR$4;
2606
- else if (at(index) === QUOTE$6) return Option.some(index + NEXT$18);
2607
- else index += NEXT$18;
2591
+ let index = start + NEXT$17;
2592
+ while (index < src.length) if (at(index) === QUOTE$6 && at(index + NEXT$17) === QUOTE$6) index += PAIR$4;
2593
+ else if (at(index) === QUOTE$6) return Option.some(index + NEXT$17);
2594
+ else index += NEXT$17;
2608
2595
  return Option.none();
2609
2596
  };
2610
2597
  const lexString$1 = (src, start) => Result.fromOption(Option.map(stringEnd(src, start), (end) => simple("string", start, end)), () => ({
@@ -2662,17 +2649,17 @@ const lexIdentifier = (src, start, previous) => {
2662
2649
  return Result.succeed(keywordToken(lexeme, start, end));
2663
2650
  };
2664
2651
  const lexPaired = (src, start) => pipe(Option.fromNullishOr(PAIRED[charAt$1(src)(start)]), Option.map(([double, single, message]) => {
2665
- if (charAt$1(src)(start + NEXT$18) === charAt$1(double)(NEXT$18)) return Result.succeed(simple(double, start, start + PAIR$4));
2652
+ if (charAt$1(src)(start + NEXT$17) === charAt$1(double)(NEXT$17)) return Result.succeed(simple(double, start, start + PAIR$4));
2666
2653
  if (single === "error") return Result.fail({
2667
2654
  message,
2668
2655
  offset: start
2669
2656
  });
2670
- return Result.succeed(simple(single, start, start + NEXT$18));
2657
+ return Result.succeed(simple(single, start, start + NEXT$17));
2671
2658
  }));
2672
- const lexDot = (start, previous) => Option.map(pipe(previous, Option.filter((tok) => DOT_AFTER.has(tok))), () => Result.succeed(simple(".", start, start + NEXT$18)));
2659
+ const lexDot = (start, previous) => Option.map(pipe(previous, Option.filter((tok) => DOT_AFTER.has(tok))), () => Result.succeed(simple(".", start, start + NEXT$17)));
2673
2660
  const lexSymbol = (src, start, previous) => {
2674
2661
  const char = charAt$1(src)(start);
2675
- return pipe(Option.fromNullishOr(SINGLE$19.get(char)), Option.map((tok) => Result.succeed(simple(tok, start, start + NEXT$18))), 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))));
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))));
2676
2663
  };
2677
2664
  const lexOne = (src, start, previous) => Option.getOrElse(lexSymbol(src, start, previous), () => {
2678
2665
  if (NUMBER_START$1.test(charAt$1(src)(start))) return lexNumber(src, start);
@@ -2924,21 +2911,26 @@ const DATAFLOW_CALLS = /* @__PURE__ */ new Set([
2924
2911
  ]);
2925
2912
  const PAIR$3 = 2;
2926
2913
  const VALUE = 1;
2927
- const noContexts = () => [];
2928
2914
  const noSpanned = () => [];
2929
- const contexts = (spanned) => Match.value(spanned.expr).pipe(Match.discriminatorsExhaustive("type")({
2930
- literal: noContexts,
2931
- star: noContexts,
2932
- identifier: noContexts,
2933
- index: (expr) => contexts(expr.inner),
2934
- not: (expr) => contexts(expr.inner),
2935
- call: (expr) => pipe(expr.args, Array$1.flatMap(contexts)),
2936
- context: (expr) => [{
2915
+ const childrenOf = Match.type().pipe(Match.discriminatorsExhaustive("type")({
2916
+ literal: noSpanned,
2917
+ star: noSpanned,
2918
+ identifier: noSpanned,
2919
+ call: (expr) => expr.args,
2920
+ context: (expr) => expr.parts,
2921
+ binary: (expr) => [expr.lhs, expr.rhs],
2922
+ not: (expr) => [expr.inner],
2923
+ index: (expr) => [expr.inner]
2924
+ }));
2925
+ const contexts = (spanned) => {
2926
+ const { expr } = spanned;
2927
+ const inner = pipe(childrenOf(expr), Array$1.flatMap(contexts));
2928
+ if (expr.type === "context") return [{
2937
2929
  context: expr,
2938
2930
  spanned
2939
- }, ...pipe(expr.parts, Array$1.flatMap(contexts))],
2940
- binary: (expr) => [...contexts(expr.lhs), ...contexts(expr.rhs)]
2941
- }));
2931
+ }, ...inner];
2932
+ return inner;
2933
+ };
2942
2934
  const valueOf$1 = (chunk) => Option.toArray(Array$1.get(chunk, VALUE));
2943
2935
  const caseValues = (args) => [...pipe(args, Array$1.chunksOf(PAIR$3), Array$1.flatMap(valueOf$1)), ...Option.toArray(Array$1.last(args))];
2944
2936
  const callDataflow = (recurse) => (expr) => {
@@ -2964,26 +2956,11 @@ const leafExpressions = (spanned) => {
2964
2956
  return [spanned];
2965
2957
  };
2966
2958
  const isComputed = (inner) => inner.expr.type !== "literal" && inner.expr.type !== "star";
2967
- const computedIndices = (spanned) => Match.value(spanned.expr).pipe(Match.discriminatorsExhaustive("type")({
2968
- literal: noSpanned,
2969
- star: noSpanned,
2970
- identifier: noSpanned,
2971
- call: (expr) => pipe(expr.args, Array$1.flatMap(computedIndices)),
2972
- index: (expr) => Option.toArray(Option.liftPredicate(spanned, () => isComputed(expr.inner))),
2973
- context: (expr) => pipe(expr.parts, Array$1.flatMap(computedIndices)),
2974
- binary: (expr) => [...computedIndices(expr.lhs), ...computedIndices(expr.rhs)],
2975
- not: (expr) => computedIndices(expr.inner)
2976
- }));
2977
- const childrenOf = Match.type().pipe(Match.discriminatorsExhaustive("type")({
2978
- literal: noSpanned,
2979
- star: noSpanned,
2980
- identifier: noSpanned,
2981
- call: (expr) => expr.args,
2982
- context: (expr) => expr.parts,
2983
- binary: (expr) => [expr.lhs, expr.rhs],
2984
- not: (expr) => [expr.inner],
2985
- index: (expr) => [expr.inner]
2986
- }));
2959
+ const computedIndices = (spanned) => {
2960
+ const { expr } = spanned;
2961
+ if (expr.type === "index") return Option.toArray(Option.liftPredicate(spanned, () => isComputed(expr.inner)));
2962
+ return pipe(childrenOf(expr), Array$1.flatMap(computedIndices));
2963
+ };
2987
2964
  const constevalSubexprs = (spanned) => {
2988
2965
  const own = pipe(Option.liftPredicate(spanned.expr, (expr) => expr.type !== "literal"), Option.flatMap(consteval));
2989
2966
  if (Option.isSome(own)) return [[spanned, own.value]];
@@ -3013,7 +2990,7 @@ const CLOSE$3 = "}}";
3013
2990
  const QUOTE$5 = "'";
3014
2991
  const BRACE = "}";
3015
2992
  const START$9 = 0;
3016
- const NEXT$16 = 1;
2993
+ const NEXT$15 = 1;
3017
2994
  const STATIC_FLAG = 2;
3018
2995
  const extracted = (raw) => ({
3019
2996
  raw,
@@ -3027,21 +3004,21 @@ const parseBare = (raw) => {
3027
3004
  const bare = asBare(extracted(raw));
3028
3005
  return Result.getSuccess(parseExpression$1(bare));
3029
3006
  };
3030
- const charAt = (view) => (index) => String$1.slice(index, index + NEXT$16)(view);
3007
+ const charAt = (view) => (index) => String$1.slice(index, index + NEXT$15)(view);
3031
3008
  const closingOf = (view) => (index, inString) => {
3032
3009
  if (index >= view.length) return Option.none();
3033
3010
  const char = charAt(view)(index);
3034
- if (char === QUOTE$5) return closingOf(view)(index + NEXT$16, !inString);
3035
- if (!inString && char === BRACE && charAt(view)(index - NEXT$16) === BRACE) return Option.some(index);
3036
- return closingOf(view)(index + NEXT$16, inString);
3011
+ if (char === QUOTE$5) return closingOf(view)(index + NEXT$15, !inString);
3012
+ if (!inString && char === BRACE && charAt(view)(index - NEXT$15) === BRACE) return Option.some(index);
3013
+ return closingOf(view)(index + NEXT$15, inString);
3037
3014
  };
3038
3015
  const fencedAt = (view, offset) => (start) => pipe(closingOf(view)(start, false), Option.map((end) => ({
3039
3016
  expr: {
3040
- raw: String$1.slice(start, end + NEXT$16)(view),
3017
+ raw: String$1.slice(start, end + NEXT$15)(view),
3041
3018
  fenced: true
3042
3019
  },
3043
3020
  start: start + offset,
3044
- end: end + offset + NEXT$16
3021
+ end: end + offset + NEXT$15
3045
3022
  })));
3046
3023
  const extractFenced = (text) => (offset) => {
3047
3024
  const view = String$1.slice(offset)(text);
@@ -3063,7 +3040,7 @@ const fencedInFeature = (document, feature) => (offset) => Option.match(extractF
3063
3040
  onNone: () => [],
3064
3041
  onSome: (next) => {
3065
3042
  const found = shifted(feature.start)(next);
3066
- if (offsetInsideComment(document)(found.start)) return fencedInFeature(document, feature)(next.start + NEXT$16);
3043
+ if (offsetInsideComment(document)(found.start)) return fencedInFeature(document, feature)(next.start + NEXT$15);
3067
3044
  if (found.end >= feature.end) return [found];
3068
3045
  return [found, ...fencedInFeature(document, feature)(next.end)];
3069
3046
  }
@@ -3429,7 +3406,7 @@ const expandsToStaticValues = (matrix) => (context) => {
3429
3406
  return !pipe(matrix.expansions, Array$1.some((expansion) => matchesPattern(expansion.path)(context) && !isStaticExpansion(expansion)));
3430
3407
  };
3431
3408
  // src/app/presets/features/audit-workflows/lib/workflow.ts
3432
- const SINGLE$18 = 1;
3409
+ const SINGLE$19 = 1;
3433
3410
  const DANGEROUS_TRIGGERS = [
3434
3411
  "pull_request_target",
3435
3412
  "workflow_run",
@@ -3454,7 +3431,7 @@ const triggerLocation = (workflow, event) => {
3454
3431
  return withKeys(syntax.events.indexOf(event))(parent);
3455
3432
  };
3456
3433
  const triggerAt = (event) => (workflow) => Option.liftPredicate(triggerLocation(workflow, event), () => hasEvent(workflow)(event));
3457
- const hasSingleTrigger = (workflow) => workflow.model.on.events.size === SINGLE$18;
3434
+ const hasSingleTrigger = (workflow) => workflow.model.on.events.size === SINGLE$19;
3458
3435
  const isReusableOnly = (workflow) => hasEvent(workflow)("workflow_call") && hasSingleTrigger(workflow);
3459
3436
  const isCacheWriteTrigger = (workflow) => pipe(CACHE_WRITE_EVENTS, Array$1.some((event) => hasEvent(workflow)(event)));
3460
3437
  const callCapability = (type) => {
@@ -3637,29 +3614,29 @@ const stepView = (step) => {
3637
3614
  };
3638
3615
  const jobConditions = (job) => [...Array$1.map(Option.toArray(job.model.if), (condition) => [condition, jobLocation(job)]), ...Array$1.flatMap(stepsOf$1(job), (step) => Array$1.map(Option.toArray(step.model.if), (condition) => [condition, stepLocation(step)]))];
3639
3616
  // src/app/presets/features/audit-workflows/lib/dispatch.ts
3640
- const none$3 = () => [];
3617
+ const none$2 = () => [];
3641
3618
  const orElse = (handler, fallback) => (input, context) => Option.match(Option.fromNullishOr(handler), {
3642
3619
  onNone: () => fallback(input, context),
3643
3620
  onSome: (run) => run(input, context)
3644
3621
  });
3645
- const defaultNormalJob = (audit) => (job) => (context) => pipe(stepsOf$1(job), producedBy((each) => orElse(audit.step, none$3)(stepView(each), context)));
3622
+ const defaultNormalJob = (audit) => (job) => (context) => pipe(stepsOf$1(job), producedBy((each) => orElse(audit.step, none$2)(stepView(each), context)));
3646
3623
  const defaultWorkflow = (audit) => (workflow) => (context) => {
3647
3624
  const normal = orElse(audit.normalJob, (job) => defaultNormalJob(audit)(job)(context));
3648
- const reusable = orElse(audit.reusableJob, none$3);
3625
+ const reusable = orElse(audit.reusableJob, none$2);
3649
3626
  return pipe(jobsOf(workflow), producedBy((job) => {
3650
3627
  if (job.type === "normal") return normal(job.job, context);
3651
3628
  return reusable(job.job, context);
3652
3629
  }));
3653
3630
  };
3654
- const dockerOf = (audit) => orElse(audit.dockerAction, none$3);
3631
+ const dockerOf = (audit) => orElse(audit.dockerAction, none$2);
3655
3632
  const defaultAction = (audit) => (action) => (context) => {
3656
- const composite = orElse(audit.compositeStep, none$3);
3633
+ const composite = orElse(audit.compositeStep, none$2);
3657
3634
  const steps = Option.getOrElse(compositeSteps(action), () => []);
3658
3635
  const docker = Array$1.filter([action], (each) => each.model.runs.type === "docker");
3659
3636
  return combined([pipe(docker, producedBy((each) => dockerOf(audit)(each, context))), pipe(steps, producedBy((step) => composite(step, context)))]);
3660
3637
  };
3661
3638
  const defaultPreCommit = (audit) => (config, context) => {
3662
- const repo = orElse(audit.preCommitRepo, none$3);
3639
+ const repo = orElse(audit.preCommitRepo, none$2);
3663
3640
  return combined(pipe(config.model.repos, Array$1.map((model, index) => repo({
3664
3641
  index,
3665
3642
  model,
@@ -3669,11 +3646,11 @@ const defaultPreCommit = (audit) => (config, context) => {
3669
3646
  const structured = (audit, context) => Match.type().pipe(Match.discriminatorsExhaustive("kind")({
3670
3647
  workflow: (input) => orElse(audit.workflow, (each) => defaultWorkflow(audit)(each)(context))(input, context),
3671
3648
  action: (input) => orElse(audit.action, (each) => defaultAction(audit)(each)(context))(input, context),
3672
- dependabot: (input) => orElse(audit.dependabot, none$3)(input, context),
3649
+ dependabot: (input) => orElse(audit.dependabot, none$2)(input, context),
3673
3650
  "pre-commit-config": (input) => orElse(audit.preCommitConfig, defaultPreCommit(audit))(input, context),
3674
- "pre-commit-hooks": (input) => orElse(audit.preCommitHooks, none$3)(input, context)
3651
+ "pre-commit-hooks": (input) => orElse(audit.preCommitHooks, none$2)(input, context)
3675
3652
  }));
3676
- const runAudit = (audit) => (input) => (context) => combined([structured(audit, context)(input), orElse(audit.raw, none$3)(input, context)]);
3653
+ const runAudit = (audit) => (input) => (context) => combined([structured(audit, context)(input), orElse(audit.raw, none$2)(input, context)]);
3677
3654
  // src/app/presets/features/audit-workflows/lib/config-decode.ts
3678
3655
  const DEFAULT_COOLDOWN = 7;
3679
3656
  const NONE$13 = 0;
@@ -4218,13 +4195,13 @@ const spanLocation = (input) => (annotation) => (span) => ({
4218
4195
  // src/app/presets/features/audit-workflows/lib/secret-count.ts
4219
4196
  const NONE$12 = 0;
4220
4197
  const ONE$5 = 1;
4221
- const none$2 = () => NONE$12;
4198
+ const none$1 = () => NONE$12;
4222
4199
  const total = (count) => (items) => Array$1.reduce(items, NONE$12, (sum, item) => sum + count(item));
4223
4200
  const counted = ({ func, hits, context }) => {
4224
4201
  const count = (spanned) => Match.value(spanned.expr).pipe(Match.discriminatorsExhaustive("type")({
4225
- literal: none$2,
4226
- star: none$2,
4227
- identifier: none$2,
4202
+ literal: none$1,
4203
+ star: none$1,
4204
+ identifier: none$1,
4228
4205
  call: (expr) => Boolean$1.match(expr.func === func && pipe(expr.args, Array$1.some(hits)), {
4229
4206
  onTrue: () => ONE$5,
4230
4207
  onFalse: () => total(count)(expr.args)
@@ -4316,7 +4293,7 @@ const unredactedSecrets = secretAudit({
4316
4293
  context: (count) => (expr) => total(count)(expr.parts)
4317
4294
  });
4318
4295
  // src/app/presets/features/audit-workflows/lib/args.ts
4319
- const NEXT$15 = 1;
4296
+ const NEXT$14 = 1;
4320
4297
  const is$2 = (...values) => (arg) => values.includes(arg);
4321
4298
  const isNot = (...values) => (arg) => !values.includes(arg);
4322
4299
  const startsWith = (prefix) => (arg) => String$1.startsWith(prefix)(arg);
@@ -4324,7 +4301,7 @@ const isOption = startsWith("-");
4324
4301
  const isOperand = (arg) => !isOption(arg);
4325
4302
  const take = (predicate) => (args) => pipe(args, Array$1.findFirstWithIndex(predicate), Option.map(([value, index]) => ({
4326
4303
  value,
4327
- rest: Array$1.drop(args, index + NEXT$15)
4304
+ rest: Array$1.drop(args, index + NEXT$14)
4328
4305
  })));
4329
4306
  const next = (args) => take(() => true)(args);
4330
4307
  const after$3 = (predicate) => (rest) => pipe(rest, Option.flatMap(take(predicate)), Option.map((taken) => taken.rest));
@@ -4343,18 +4320,18 @@ const sameOrigin = (left, right) => {
4343
4320
  return left.type === right.type;
4344
4321
  };
4345
4322
  const isNew = (left) => (origin) => !pipe(left, Array$1.some((each) => sameOrigin(each, origin)));
4346
- const merged$1 = (verdict) => (left, right) => ({
4323
+ const merged = (verdict) => (left, right) => ({
4347
4324
  verdict,
4348
4325
  origins: [...left.origins, ...pipe(right.origins, Array$1.filter(isNew(left.origins)))]
4349
4326
  });
4350
4327
  const prefer = (verdict) => (left, right) => {
4351
4328
  const onLeft = left.verdict === verdict;
4352
4329
  const onRight = right.verdict === verdict;
4353
- if (onLeft && onRight) return Option.some(merged$1(verdict)(left, right));
4330
+ if (onLeft && onRight) return Option.some(merged(verdict)(left, right));
4354
4331
  if (onLeft) return Option.some(left);
4355
4332
  return Option.liftPredicate(right, () => onRight);
4356
4333
  };
4357
- const combine = (dominant, fallback) => (left, right) => pipe(prefer(dominant)(left, right), Option.orElse(() => prefer("conditional")(left, right)), Option.getOrElse(() => merged$1(fallback)(left, right)));
4334
+ const combine = (dominant, fallback) => (left, right) => pipe(prefer(dominant)(left, right), Option.orElse(() => prefer("conditional")(left, right)), Option.getOrElse(() => merged(fallback)(left, right)));
4358
4335
  const and = combine("not-satisfied", "satisfied");
4359
4336
  const or = combine("satisfied", "not-satisfied");
4360
4337
  const negate = (evaluation) => {
@@ -4793,14 +4770,14 @@ const bashTargets = (node) => {
4793
4770
  return [];
4794
4771
  };
4795
4772
  const bashDestinations = (nodes) => matching$1(BASH_DESTINATION)(pipe(nodes, Array$1.flatMap(bashTargets)));
4796
- const SINGLE$17 = 1;
4797
- const NEXT$14 = 1;
4798
- const isSafeArg = (arg) => isType("word", "raw_string")(arg) || arg.namedChildren.length === SINGLE$17 && pipe(arg.namedChildren, Array$1.every(isType("string_content")));
4799
- const isStaticEcho = (command) => Option.exists(fieldOf$2("name")(command), (name) => ECHOES.has(name.text)) && pipe(fieldsOf$5("argument")(command), Array$1.filter((arg) => arg.named), Array$1.every(isSafeArg));
4773
+ const SINGLE$18 = 1;
4774
+ const NEXT$13 = 1;
4775
+ const isSafeArg = (arg) => isType("word", "raw_string")(arg) || arg.namedChildren.length === SINGLE$18 && pipe(arg.namedChildren, Array$1.every(isType("string_content")));
4776
+ 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));
4800
4777
  const isFlaggedCommand = (command) => command.type === "command" && fieldOf$2("name")(command).pipe(ofType("command_name"), Option.isSome) && !isStaticEcho(command);
4801
4778
  const bashRedirects = (statement) => pipe(statement.namedChildren, Array$1.flatMap((command, index) => {
4802
4779
  if (!isFlaggedCommand(command)) return [];
4803
- return pipe(Array$1.drop(statement.namedChildren, index + NEXT$14), Array$1.filter(isType("file_redirect")), Array$1.flatMap((redirect) => bashDestinations(redirect.namedChildren)));
4780
+ return pipe(Array$1.drop(statement.namedChildren, index + NEXT$13), Array$1.filter(isType("file_redirect")), Array$1.flatMap((redirect) => bashDestinations(redirect.namedChildren)));
4804
4781
  }));
4805
4782
  const namedMatching = (pattern) => (command) => command.type === "command" && Option.exists(ofType("command_name")(fieldOf$2("name")(command)), (name) => pattern.test(name.text));
4806
4783
  const bashTees = (pipeline) => pipe(namedOfType("command")(pipeline), Array$1.filter(namedMatching(TEE)), Array$1.flatMap((command) => bashDestinations(fieldsOf$5("argument")(command))));
@@ -4823,9 +4800,8 @@ const pwshParameterArgument = (child) => {
4823
4800
  };
4824
4801
  const pwshArguments = (command) => pipe(command.namedChildren, Array$1.flatMap(pwshParameterArgument), Array$1.flatMap(pwshArgument));
4825
4802
  const pwshWriters = (pipeline) => pipe(fieldsOf$5("elements")(pipeline), Array$1.filter(namedMatching(PWSH_WRITER)), Array$1.flatMap((command) => matching$1(PWSH_DESTINATION)(pwshArguments(command))));
4826
- const collect = (root) => (type, extract) => pipe(descendants(root), Array$1.filter(isType(type)), Array$1.flatMap(extract));
4827
- const bashWrites = (root) => [...collect(root)("redirected_statement", bashRedirects), ...collect(root)("pipeline", bashTees)];
4828
- const pwshWrites = (root) => [...collect(root)("redirection", pwshRedirects), ...collect(root)("pipeline", pwshWriters)];
4803
+ const bashWrites = (root) => [...Array$1.flatMap(descendantsOfType("redirected_statement")(root), bashRedirects), ...Array$1.flatMap(descendantsOfType("pipeline")(root), bashTees)];
4804
+ const pwshWrites = (root) => [...Array$1.flatMap(descendantsOfType("redirection")(root), pwshRedirects), ...Array$1.flatMap(descendantsOfType("pipeline")(root), pwshWriters)];
4829
4805
  const cmdWrites = (run) => Array$1.flatMap([...String$1.matchAll(CMD_WRITE)(run)], (match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get("destination")), Option.toArray));
4830
4806
  const TREE_WRITES = {
4831
4807
  bash: bashWrites,
@@ -9773,11 +9749,11 @@ const contextAt$1 = (second) => {
9773
9749
  return [[second.expr, second.origin.raw]];
9774
9750
  };
9775
9751
  const containsCheck = (args) => pipe(pairOf(args), Option.filter(([first]) => isStringLiteral(first)), Option.map(([, second]) => contextAt$1(second)), Option.getOrElse(() => []));
9776
- const none$1 = () => [];
9752
+ const none = () => [];
9777
9753
  const walk = (spanned) => Match.value(spanned.expr).pipe(Match.discriminatorsExhaustive("type")({
9778
- literal: none$1,
9779
- star: none$1,
9780
- identifier: none$1,
9754
+ literal: none,
9755
+ star: none,
9756
+ identifier: none,
9781
9757
  call: (expr) => {
9782
9758
  const found = containsCheck(expr.args);
9783
9759
  if (expr.func === "contains" && Array$1.isReadonlyArrayNonEmpty(found)) return found;
@@ -9813,32 +9789,18 @@ const orOperands = (spanned) => {
9813
9789
  return [spanned];
9814
9790
  };
9815
9791
  const LAST$1 = 1;
9792
+ const SINGLE$17 = 1;
9816
9793
  const ANNOTATION$2 = pipe(rootLocation(""), annotated("pseudo-ternary has falsy true value"), primary);
9817
9794
  const falsyTrueValue = (operand) => {
9818
9795
  const { expr } = operand;
9819
9796
  if (expr.type === "binary" && expr.op === "and" && isFalsy(expr.rhs)) return [expr.rhs];
9820
9797
  return [];
9821
9798
  };
9822
- const orValues = (collect) => (spanned) => {
9823
- const operands = orOperands(spanned);
9824
- return [...pipe(operands, Array$1.dropRight(LAST$1), Array$1.flatMap(falsyTrueValue)), ...pipe(operands, Array$1.flatMap(collect))];
9825
- };
9826
- const none = () => [];
9827
9799
  const unsoundTrueValues = (spanned) => {
9828
9800
  if (isConstant$1(spanned)) return [];
9829
- return Match.value(spanned.expr).pipe(Match.discriminatorsExhaustive("type")({
9830
- literal: none,
9831
- star: none,
9832
- identifier: none,
9833
- call: (expr) => pipe(expr.args, Array$1.flatMap(unsoundTrueValues)),
9834
- context: (expr) => pipe(expr.parts, Array$1.flatMap(unsoundTrueValues)),
9835
- binary: (expr) => {
9836
- if (expr.op === "or") return orValues(unsoundTrueValues)(spanned);
9837
- return [...unsoundTrueValues(expr.lhs), ...unsoundTrueValues(expr.rhs)];
9838
- },
9839
- not: (expr) => unsoundTrueValues(expr.inner),
9840
- index: (expr) => unsoundTrueValues(expr.inner)
9841
- }));
9801
+ const operands = orOperands(spanned);
9802
+ if (operands.length > SINGLE$17) return [...pipe(operands, Array$1.dropRight(LAST$1), Array$1.flatMap(falsyTrueValue)), ...pipe(operands, Array$1.flatMap(unsoundTrueValues))];
9803
+ return pipe(childrenOf(spanned.expr), Array$1.flatMap(unsoundTrueValues));
9842
9804
  };
9843
9805
  // src/app/presets/features/audit-workflows/model/concerns/injection.ts
9844
9806
  const INJECTION = [
@@ -9934,7 +9896,7 @@ const draftsIf = (draft) => (condition) => {
9934
9896
  return [];
9935
9897
  };
9936
9898
  // src/app/presets/features/audit-workflows/lib/uses-targets.ts
9937
- const targetOf$2 = ({ kind, input, location, grip }) => ({ key, text, raw, repo }, ref) => {
9899
+ const targetOf$3 = ({ kind, input, location, grip }) => ({ key, text, raw, repo }, ref) => {
9938
9900
  const within = withinText(text);
9939
9901
  return {
9940
9902
  kind,
@@ -9955,7 +9917,7 @@ const usesTarget = (uses, place) => {
9955
9917
  raw: uses.raw,
9956
9918
  repo: uses.slug
9957
9919
  };
9958
- return Option.some(targetOf$2(place)(written, usesRef(uses)));
9920
+ return Option.some(targetOf$3(place)(written, usesRef(uses)));
9959
9921
  };
9960
9922
  const checked$1 = (check, context) => (target) => Option.match(target, {
9961
9923
  onNone: () => [],
@@ -9995,7 +9957,7 @@ const repoTargetCheck = (check) => (repo, context) => {
9995
9957
  raw: model.rev,
9996
9958
  repo: model.repo
9997
9959
  };
9998
- return check(targetOf$2(place)(written, urlRef(model.url)(model.rev)), context);
9960
+ return check(targetOf$3(place)(written, urlRef(model.url)(model.rev)), context);
9999
9961
  };
10000
9962
  // src/app/presets/features/audit-workflows/model/rules/impostor-commit.ts
10001
9963
  const meta$21 = {
@@ -10041,7 +10003,7 @@ const versionOf = (client, target) => (slug) => Option.match(symbolicRef(target.
10041
10003
  onSome: (commit) => Effect.map(longestTag(client)(target.ref)(commit), Option.map((tag) => tag.name))
10042
10004
  })
10043
10005
  });
10044
- const draftOf$1 = (target) => (advisory) => [pipe(finding(meta$20), confidence("high"), severity(severityOf(advisory)), atPath(target.location, primary, withKeys("uses"), withUrl(`https://github.com/advisories/${advisory.id}`), annotated(advisory.id)))];
10006
+ const draftOf$1 = (target) => (advisory) => singleDraft(meta$20, confidence("high"), severity(severityOf(advisory)), atPath(target.location, primary, withKeys("uses"), withUrl(`https://github.com/advisories/${advisory.id}`), annotated(advisory.id)));
10045
10007
  const findings = (client, target, context) => (slug) => Effect.flatMap(versionOf(client, target)(slug), Option.match({
10046
10008
  onNone: () => Effect.succeed([]),
10047
10009
  onSome: (version) => Effect.map(client.advisories(slug)(version), (advisories) => pipe(advisories, Array$1.filter((advisory) => !context.config.knownVulnerableAllow.has(advisory.id)), Array$1.flatMap(draftOf$1(target))))
@@ -10076,7 +10038,7 @@ const refConfusion = {
10076
10038
  };
10077
10039
  // src/app/presets/features/audit-workflows/lib/lock.ts
10078
10040
  const LOCKFILE = ".github/workflows/actions.lock";
10079
- const isLocked = (project) => (path) => pipe(project.parse(LOCKFILE), Option.flatMap((source) => Option.fromNullishOr(source.yaml)), Option.flatMap(valueAt("workflows")), Option.exists((workflows) => Array$1.some(pairsOf(workflows), (pair) => pair.key.value === path)));
10041
+ const isLocked = (project) => (path) => pipe(project.parse(LOCKFILE), Option.flatMap((source) => Option.fromNullishOr(source.yaml)), Option.flatMap(valueAt("workflows")), Option.flatMap(valueAt(path)), Option.isSome);
10080
10042
  // src/app/presets/features/audit-workflows/model/rules/ref-version-mismatch-parts.ts
10081
10043
  const SHORT = 12;
10082
10044
  const START$6 = 0;
@@ -10090,8 +10052,9 @@ const stateOf = (comments) => pipe(comments, Array$1.findFirst((comment) => Opti
10090
10052
  }));
10091
10053
  const usesLocation = (target) => pipe(target.location, withKeys("uses"));
10092
10054
  const commentState = (target) => pipe(concretize(target.input.document)(usesLocation(target)), Result.getSuccess, Option.map(({ concrete }) => stateOf(concrete.comments)));
10093
- const flagged = (annotation) => ({ target }) => pipe(usesLocation(target), primary, withinText(target.raw), annotated(annotation));
10094
- const suggested = (tag) => (target) => pipe(usesLocation(target), withinText(target.raw), annotated(`is pointed to by tag ${tag}`));
10055
+ const notedUses = (target, annotation) => pipe(usesLocation(target), withinText(target.raw), annotated(annotation));
10056
+ const flagged = (annotation) => ({ target }) => primary(notedUses(target, annotation));
10057
+ const suggested = (tag) => (target) => notedUses(target, `is pointed to by tag ${tag}`);
10095
10058
  const pointsTo = (found) => Option.match(found, {
10096
10059
  onNone: () => "points to unknown ref",
10097
10060
  onSome: (ref) => `${ref.kind} points to commit ${String$1.slice(START$6, SHORT)(ref.commit)}`
@@ -10426,7 +10389,7 @@ const ARCHIVED = new Set(archived_repos_default);
10426
10389
  const isArchived = (ref) => Option.exists(refSlug(ref), (slug) => ARCHIVED.has(`${String$1.toLowerCase(slug.owner)}/${String$1.toLowerCase(slug.repo)}`));
10427
10390
  const check$6 = (target) => {
10428
10391
  if (!isArchived(target.ref)) return [];
10429
- return [pipe(finding(meta$15), confidence("high"), severity("medium"), persona("regular"), at$2(target.grip), at$2(target.at("repository is archived")))];
10392
+ return singleDraft(meta$15, confidence("high"), severity("medium"), persona("regular"), at$2(target.grip), at$2(target.at("repository is archived")));
10430
10393
  };
10431
10394
  const step$9 = stepTargetCheck(check$6);
10432
10395
  const archivedUses = {
@@ -10960,7 +10923,7 @@ const TYPOS = /* @__PURE__ */ new Map([
10960
10923
  ["/", ["-", "_"]]
10961
10924
  ]);
10962
10925
  const NONE$11 = 0;
10963
- const NEXT$13 = 1;
10926
+ const NEXT$12 = 1;
10964
10927
  const PAIR$2 = 2;
10965
10928
  const ASCII_LIMIT = 127;
10966
10929
  const FIRST$6 = 0;
@@ -10979,7 +10942,7 @@ const replaced = (chars, index, width) => (inserted) => joined(Array$1.flatten([
10979
10942
  inserted,
10980
10943
  Array$1.drop(chars, index + width)
10981
10944
  ]));
10982
- const adjacentPairs = (chars) => pipe(Array$1.zip(chars, Array$1.drop(chars, NEXT$13)), Array$1.map(([left, right], index) => [
10945
+ const adjacentPairs = (chars) => pipe(Array$1.zip(chars, Array$1.drop(chars, NEXT$12)), Array$1.map(([left, right], index) => [
10983
10946
  index,
10984
10947
  left,
10985
10948
  right
@@ -11000,20 +10963,20 @@ const omitted = (name) => {
11000
10963
  const chars = charsOf(name);
11001
10964
  return pipe(Array$1.range(NONE$11, chars.length), Array$1.flatMap((index) => pipe(ALPHABET, Array$1.map((letter) => replaced(chars, index, NONE$11)([letter])))));
11002
10965
  };
11003
- const without = (items, index) => Array$1.appendAll(Array$1.take(items, index), Array$1.drop(items, index + NEXT$13));
10966
+ const without = (items, index) => Array$1.appendAll(Array$1.take(items, index), Array$1.drop(items, index + NEXT$12));
11004
10967
  const permutations = (items, size) => {
11005
10968
  if (size === NONE$11) return [[]];
11006
- return pipe(items, Array$1.flatMap((item, index) => pipe(permutations(without(items, index), size - NEXT$13), Array$1.map((rest) => Array$1.prepend(rest, item)))));
10969
+ return pipe(items, Array$1.flatMap((item, index) => pipe(permutations(without(items, index), size - NEXT$12), Array$1.map((rest) => Array$1.prepend(rest, item)))));
11007
10970
  };
11008
10971
  const swappedWords = (name) => {
11009
10972
  const tokens = String$1.split(WORD_DELIMITER)(name);
11010
- if (tokens.length === NEXT$13) return [];
10973
+ if (tokens.length === NEXT$12) return [];
11011
10974
  return pipe(permutations(tokens, Math.min(tokens.length, MAX_WORDS)), Array$1.flatMap((words) => pipe(DELIMITERS, Array$1.map((delimiter) => Array$1.join(words, delimiter)))));
11012
10975
  };
11013
10976
  const typosOf = (char) => Option.getOrElse(Option.fromNullishOr(TYPOS.get(char)), () => []);
11014
10977
  const typos = (name) => {
11015
10978
  const chars = charsOf(name);
11016
- return pipe(chars, Array$1.flatMap((char, index) => pipe(typosOf(char), Array$1.map((typo) => replaced(chars, index, NEXT$13)([typo])))));
10979
+ return pipe(chars, Array$1.flatMap((char, index) => pipe(typosOf(char), Array$1.map((typo) => replaced(chars, index, NEXT$12)([typo])))));
11017
10980
  };
11018
10981
  const CHECKS$1 = [
11019
10982
  ["repeats characters in", repeated],
@@ -11979,6 +11942,10 @@ const merge$1 = (type) => (other) => {
11979
11942
  if (Option.exists(Record.get(STRINGY, type.kind), Array$1.contains(other.kind))) return STRING;
11980
11943
  return ANY;
11981
11944
  };
11945
+ const mergeAll$1 = (types) => Array$1.match(types, {
11946
+ onEmpty: () => ANY,
11947
+ onNonEmpty: ([first, ...rest]) => Array$1.reduce(rest, first, (acc, type) => merge$1(acc)(type))
11948
+ });
11982
11949
  // src/app/presets/entities/expression/lib/availability.ts
11983
11950
  const KEYS = {
11984
11951
  concurrency: {
@@ -12506,25 +12473,16 @@ const assignable = (type) => (other) => {
12506
12473
  return Option.exists(Record.get(SCALARS$2, type.kind), Array$1.contains(other.kind));
12507
12474
  };
12508
12475
  // src/app/presets/entities/expression/model/of-json.ts
12509
- const NEXT$12 = 1;
12510
12476
  const SCALARS$1 = {
12511
12477
  boolean: BOOL,
12512
12478
  number: NUMBER$1,
12513
12479
  string: STRING
12514
12480
  };
12515
- const merged = (types) => Option.match(Array$1.head(types), {
12516
- onNone: () => ANY,
12517
- onSome: (first) => {
12518
- let acc = first;
12519
- for (const type of Array$1.drop(types, NEXT$12)) acc = merge$1(acc)(type);
12520
- return acc;
12521
- }
12522
- });
12523
12481
  const ofJson = (value) => {
12524
12482
  if (value === null) return NULL;
12525
12483
  if (Array$1.isArray(value)) {
12526
12484
  const types = pipe(value, Array$1.map((item) => ofJson(item)));
12527
- return arrayOf(merged(types));
12485
+ return arrayOf(mergeAll$1(types));
12528
12486
  }
12529
12487
  if (Predicate.isObject(value)) return strict(pipe(value, Record.map((prop) => ofJson(prop))));
12530
12488
  return Option.getOrElse(Record.get(SCALARS$1, typeof value), () => ANY);
@@ -13747,38 +13705,44 @@ const skipWhile = (test) => (src) => (from) => {
13747
13705
  while (test(peek(src)(at))) at = advance$2(src)(at);
13748
13706
  return at;
13749
13707
  };
13750
- const digitsFrom = (place) => (scan) => (at) => {
13751
- if (!isDigit(peek(scan.src)(at))) return Result.fail(unexpected$1(scan)({
13708
+ const runFrom = (accepts, expected) => (place) => (scan) => (at) => {
13709
+ if (!accepts(peek(scan.src)(at))) return Result.fail(unexpected$1(scan)({
13752
13710
  at,
13753
13711
  place,
13754
- expected: DIGITS
13712
+ expected
13755
13713
  }));
13756
- return Result.succeed(skipWhile(isDigit)(scan.src)(at));
13714
+ return Result.succeed(skipWhile(accepts)(scan.src)(at));
13757
13715
  };
13716
+ const digitsFrom = runFrom(isDigit, DIGITS);
13717
+ const hexDigitsFrom = runFrom(isHex, `${DIGITS}, 'a'..'f', 'A'..'F'`);
13758
13718
  const optionally = (char) => (scan) => (at) => {
13759
13719
  if (isChar(char)(peek(scan.src)(at))) return advance$2(scan.src)(at);
13760
13720
  return at;
13761
13721
  };
13762
13722
  // src/app/presets/entities/expression/lib/number.ts
13763
- const fraction = (scan) => (num) => {
13764
- if (!isChar(".")(peek(scan.src)(num.at))) return Result.succeed(num);
13765
- return pipe(digitsFrom("fraction part of float number")(scan)(advance$2(scan.src)(num.at)), Result.map((at) => ({
13723
+ const floatPart = ({ starts, digits }) => (scan) => (num) => {
13724
+ if (!starts(peek(scan.src)(num.at))) return Result.succeed(num);
13725
+ return pipe(advance$2(scan.src)(num.at), digits(scan), Result.map((at) => ({
13766
13726
  at,
13767
13727
  float: true
13768
13728
  })));
13769
13729
  };
13770
- const exponentDigits = (scan) => (at) => {
13730
+ const zeroOr = (scan, digits) => (at) => {
13771
13731
  if (isChar("0")(peek(scan.src)(at))) return Result.succeed(advance$2(scan.src)(at));
13772
- return digitsFrom("exponent part of float number")(scan)(at);
13732
+ return digits(at);
13773
13733
  };
13774
- const exponent = (scan) => (num) => {
13775
- const char = peek(scan.src)(num.at);
13776
- if (!isChar("e")(char) && !isChar("E")(char)) return Result.succeed(num);
13777
- return pipe(advance$2(scan.src)(num.at), optionally("-")(scan), exponentDigits(scan), Result.map((at) => ({
13778
- at,
13779
- float: true
13780
- })));
13734
+ const exponentDigits = (scan) => (signed) => {
13735
+ const digits = digitsFrom("exponent part of float number")(scan);
13736
+ return zeroOr(scan, digits)(optionally("-")(scan)(signed));
13781
13737
  };
13738
+ const fraction = floatPart({
13739
+ starts: isChar("."),
13740
+ digits: digitsFrom("fraction part of float number")
13741
+ });
13742
+ const exponent = floatPart({
13743
+ starts: (char) => isChar("e")(char) || isChar("E")(char),
13744
+ digits: exponentDigits
13745
+ });
13782
13746
  const trailing = (scan, what) => (at) => {
13783
13747
  if (isAlnum(peek(scan.src)(at))) return Result.fail(unexpected$1(scan)({
13784
13748
  at,
@@ -13787,31 +13751,20 @@ const trailing = (scan, what) => (at) => {
13787
13751
  }));
13788
13752
  return Result.succeed(at);
13789
13753
  };
13754
+ const hexDigits = hexDigitsFrom("hex integer");
13790
13755
  const lexHex = (scan, from) => {
13791
- const digits = pipe(Result.succeed(from), Result.flatMap((at) => {
13792
- if (isChar("0")(peek(scan.src)(at))) return Result.succeed(advance$2(scan.src)(at));
13793
- if (!isHex(peek(scan.src)(at))) return Result.fail(unexpected$1(scan)({
13794
- at,
13795
- place: "hex integer",
13796
- expected: `${DIGITS}, 'a'..'f', 'A'..'F'`
13797
- }));
13798
- return Result.succeed(skipWhile(isHex)(scan.src)(at));
13799
- }), Result.flatMap(trailing(scan, "hex integer")));
13756
+ const digits = pipe(zeroOr(scan, hexDigits(scan))(from), Result.flatMap(trailing(scan, "hex integer")));
13800
13757
  return Result.match(digits, {
13801
13758
  onFailure: (lexed) => lexed,
13802
13759
  onSuccess: (end) => finished(scan)("INTEGER", end)
13803
13760
  });
13804
13761
  };
13805
- const integerPart = (scan, at) => pipe(digitsFrom("integer part of number")(scan)(at), Result.map((end) => ({
13806
- at: end,
13807
- float: false
13808
- })));
13809
13762
  const integerOf = (scan, at) => {
13810
- if (isChar("0")(peek(scan.src)(at))) return Result.succeed({
13811
- at: advance$2(scan.src)(at),
13763
+ const digits = digitsFrom("integer part of number")(scan);
13764
+ return pipe(zeroOr(scan, digits)(at), Result.map((end) => ({
13765
+ at: end,
13812
13766
  float: false
13813
- });
13814
- return integerPart(scan, at);
13767
+ })));
13815
13768
  };
13816
13769
  const kindOf$1 = (num) => {
13817
13770
  if (num.float) return "FLOAT";
@@ -14620,9 +14573,14 @@ const CONTAINER_KEYS = [
14620
14573
  "volumes",
14621
14574
  "options"
14622
14575
  ];
14623
- const containerMapping = (sink) => (name, node) => {
14576
+ const parseContainer = (sink) => (name, at, node) => {
14577
+ if (node.kind === "scalar") return {
14578
+ ports: [],
14579
+ volumes: [],
14580
+ image: parseString(sink)(node, false)
14581
+ };
14624
14582
  const { set, setSome } = setters();
14625
- return foldEntries({
14583
+ const container = foldEntries({
14626
14584
  entries: section$1(sink)(name, node),
14627
14585
  initial: {
14628
14586
  ports: [],
@@ -14642,14 +14600,6 @@ const containerMapping = (sink) => (name, node) => {
14642
14600
  expected: CONTAINER_KEYS
14643
14601
  })
14644
14602
  });
14645
- };
14646
- const parseContainer = (sink) => (name, at, node) => {
14647
- if (node.kind === "scalar") return {
14648
- ports: [],
14649
- volumes: [],
14650
- image: parseString(sink)(node, false)
14651
- };
14652
- const container = containerMapping(sink)(name, node);
14653
14603
  reportMissing(sink)(container.image, at, `"image" is missing in ${quote(name)} section`);
14654
14604
  return container;
14655
14605
  };
@@ -15794,23 +15744,18 @@ const EVALUATED_BADLY = [
15794
15744
  const checkEvaluated = (env, typed) => {
15795
15745
  for (const each of typed) if (Array$1.contains(EVALUATED_BADLY, each.type.kind)) env.fail(each, `object, array, and null values should not be evaluated in template with \${{ }} but evaluating the value of type ${describe$2(each.type)}`);
15796
15746
  };
15797
- const checkString = (env) => (text, key) => pipe(Option.fromNullishOr(text), Option.flatMap(checkExprsIn(env)({
15798
- untrusted: false,
15747
+ const checkTemplate = (env, untrusted) => (text, key) => pipe(Option.fromNullishOr(text), Option.flatMap(checkExprsIn(env)({
15748
+ untrusted,
15799
15749
  key
15800
15750
  })), Option.map((typed) => {
15801
15751
  checkEvaluated(env, typed);
15802
15752
  return typed;
15803
15753
  }), Option.getOrElse(() => []));
15754
+ const checkString = (env) => checkTemplate(env, false);
15755
+ const checkScript = (env) => checkTemplate(env, true);
15804
15756
  const checkStrings = (env) => (texts, key) => {
15805
15757
  for (const text of texts) checkString(env)(text, key);
15806
15758
  };
15807
- const checkScript = (env) => (text, key) => {
15808
- const typed = pipe(Option.fromNullishOr(text), Option.flatMap(checkExprsIn(env)({
15809
- untrusted: true,
15810
- key
15811
- })));
15812
- for (const found of Option.toArray(typed)) checkEvaluated(env, found);
15813
- };
15814
15759
  const checkOne = (env) => (text, what, key) => {
15815
15760
  const found = Option.fromNullishOr(text);
15816
15761
  if (Option.isNone(found)) return Option.none();
@@ -15862,14 +15807,6 @@ const literalType = (value) => {
15862
15807
  const trimmed = String$1.trim(value);
15863
15808
  return pipe(Record.get(LITERALS, trimmed), Option.orElse(() => Option.as(parseGoFloat(trimmed), NUMBER$1)), Option.getOrElse(() => STRING));
15864
15809
  };
15865
- const mergeAll$1 = (types) => {
15866
- let out = Option.none();
15867
- for (const type of types) out = Option.some(Option.match(out, {
15868
- onNone: () => type,
15869
- onSome: (acc) => merge$1(acc)(type)
15870
- }));
15871
- return Option.getOrElse(out, () => ANY);
15872
- };
15873
15810
  const elemOf = (type) => {
15874
15811
  if (type.kind === "array") return Option.some(type.elem);
15875
15812
  return Option.none();
@@ -16034,10 +15971,6 @@ const fieldsFor = (sink, node) => {
16034
15971
  }, node);
16035
15972
  return Option.liftPredicate(fields, () => !failed);
16036
15973
  };
16037
- const keysOf = (node) => {
16038
- if (node.kind !== "mapping") return [];
16039
- return pipe(pairsOf(node), Array$1.map((pair) => pair.key.value));
16040
- };
16041
15974
  const unexpectedOf = (name, node) => pipe(keysOf(node), Array$1.filter((key) => key !== DEPRECATION && !Array$1.contains(KNOWN_KEYS, key)), Array$1.last, Option.map((key) => `unexpected key ${quote(key)} for definition of input ${quote(name)}`));
16042
15975
  const inputOf = (name, node, fields) => ({
16043
15976
  name,
@@ -38862,12 +38795,12 @@ const checkWorkflow = (env) => (workflow) => {
38862
38795
  return vars;
38863
38796
  };
38864
38797
  const callEventOf = (workflow) => pipe(workflow.on ?? [], Array$1.findFirst((event) => event.type === "workflow_call"));
38865
- const outputsType = (job) => Option.match(Option.fromNullishOr(job.workflowCall), {
38866
- onNone: () => strict(pipe(job.outputs, Record.map(() => STRING))),
38867
- onSome: () => loose()
38868
- });
38869
- const jobsType = (workflow) => strict(pipe(workflow.jobs ?? {}, Record.map((job) => strict({ outputs: outputsType(job) }))));
38870
- const callOutputsJobs = (workflow) => pipe(callEventOf(workflow), Option.filter((call) => !Record.isEmptyRecord(call.outputs) && !Record.isEmptyRecord(workflow.jobs ?? {})), Option.map(() => jobsType(workflow)));
38798
+ const outputsType = (info) => {
38799
+ if (info.type === "call") return loose();
38800
+ return strict(Record.fromIterableWith(info.outputs, (name) => [name, STRING]));
38801
+ };
38802
+ const jobsType = (infos) => strict(pipe(infos, Record.map((info) => strict({ outputs: outputsType(info) }))));
38803
+ const callOutputsJobs = (workflow) => pipe(callEventOf(workflow), Option.filter((call) => !Record.isEmptyRecord(call.outputs)), Option.map(() => jobInfos(workflow)), Option.filter((infos) => !Record.isEmptyRecord(infos)), Option.map(jobsType));
38871
38804
  const checkCallOutputs = (env) => (workflow) => {
38872
38805
  for (const call of Option.toArray(callEventOf(workflow))) for (const output of Record.values(call.outputs)) checkString(env)(output.value, "on.workflow_call.outputs.<output_id>.value");
38873
38806
  };
@@ -39624,9 +39557,9 @@ const escaped = (glob, backslash) => {
39624
39557
  invalidRefChar(glob)(backslash, "only special characters [, ?, +, *, \\, ! can be escaped with \\");
39625
39558
  return glob.next();
39626
39559
  };
39627
- const repeat = (glob, char, what) => {
39560
+ const repeating = (char, what) => (glob) => {
39628
39561
  if (!glob.prec()) unexpected(glob)(Option.some(char), what, SPECIAL_REASON);
39629
- return Option.some(char);
39562
+ return Option.some(Option.some(char));
39630
39563
  };
39631
39564
  const carriage = (glob, char) => {
39632
39565
  const last = pipe(glob.peek(), Option.filter((found) => found === "\n"), Option.match({
@@ -39638,8 +39571,8 @@ const carriage = (glob, char) => {
39638
39571
  };
39639
39572
  const HANDLERS$1 = {
39640
39573
  "\\": (glob, char) => Option.some(escaped(glob, char)),
39641
- "?": (glob) => Option.some(repeat(glob, "?", "special character ? (zero or one)")),
39642
- "+": (glob) => Option.some(repeat(glob, "+", "special character + (one or more)")),
39574
+ "?": repeating("?", "special character ? (zero or one)"),
39575
+ "+": repeating("+", "special character + (one or more)"),
39643
39576
  "*": (_glob, char) => Option.some(char),
39644
39577
  "[": (glob) => validateClass(glob),
39645
39578
  "\r": (glob, char) => Option.some(carriage(glob, char)),
@@ -39932,6 +39865,7 @@ const isMissingName = (node) => node.isMissing && Option.exists(parentOf(node),
39932
39865
  const hasError = anyWithin((node) => node.isError || node.isMissing && !isMissingName(node));
39933
39866
  const ancestors = ancestorsBy(parentOf);
39934
39867
  const keywordOf = (node) => pipe(Array$1.head(node.children), Option.map((child) => child.text), Option.getOrElse(() => ""));
39868
+ const assignmentNameOf = (node) => Option.filter(fieldTextOf("name")(node), () => node.type === "variable_assignment");
39935
39869
  // src/app/presets/shared/shell/commands.ts
39936
39870
  const SINGLE$3 = 1;
39937
39871
  const QUOTES = 2;
@@ -40170,7 +40104,7 @@ const makeAnalysis = (execute) => {
40170
40104
  };
40171
40105
  // src/app/presets/shared/shell/assignment.ts
40172
40106
  const isAppending = (node) => pipe(node.children, Array$1.some((child) => !child.named && child.type === "+="));
40173
- const targetOf$1 = (node) => pipe(fieldOf$2("name")(node), Option.flatMap((name) => {
40107
+ const targetOf$2 = (node) => pipe(fieldOf$2("name")(node), Option.flatMap((name) => {
40174
40108
  if (name.type === "subscript") return pipe(fieldOf$2("name")(name), Option.map((found) => ({
40175
40109
  name: found.text,
40176
40110
  subscript: true
@@ -40204,7 +40138,7 @@ const assign = (analysis, flow, assignment) => {
40204
40138
  for (const found of Option.toArray(fieldOf$2("value")(assignment.node))) analysis.scan(flow, found);
40205
40139
  return pipe(Option.all({
40206
40140
  scope: flow,
40207
- target: targetOf$1(assignment.node)
40141
+ target: targetOf$2(assignment.node)
40208
40142
  }), Option.match({
40209
40143
  onNone: () => flow,
40210
40144
  onSome: ({ scope, target }) => setStatus({
@@ -40216,8 +40150,7 @@ const assign = (analysis, flow, assignment) => {
40216
40150
  const flagsOf = (prefix) => (node) => pipe(node.namedChildren, Array$1.filter((child) => child.type === "word" && String$1.startsWith(prefix)(child.text)), Array$1.map((child) => String$1.slice(FLAG$1)(child.text)), Array$1.join(""));
40217
40151
  const declaredName = (child) => {
40218
40152
  if (child.type === "variable_name") return Option.some(child.text);
40219
- if (child.type === "variable_assignment") return pipe(fieldOf$2("name")(child), Option.map((named) => named.text));
40220
- return Option.none();
40153
+ return assignmentNameOf(child);
40221
40154
  };
40222
40155
  const declarationOf = (node) => {
40223
40156
  const flags = flagsOf("-")(node);
@@ -40258,18 +40191,16 @@ const declareChild = (analysis, declaration, child) => {
40258
40191
  return flow;
40259
40192
  };
40260
40193
  };
40194
+ const integerMarks = (node, declaration) => (flow) => pipe(integerStatus(node, declaration.integer), Option.match({
40195
+ onNone: () => flow,
40196
+ onSome: (status) => setAll(pipe(node.namedChildren, Array$1.flatMap((child) => Option.toArray(declaredName(child))), Array$1.map((name) => ({
40197
+ name: integerKey(name),
40198
+ status
40199
+ }))))(flow)
40200
+ }));
40261
40201
  const declare = (analysis, flow, node) => {
40262
40202
  const declaration = declarationOf(node);
40263
- const names = pipe(node.namedChildren, Array$1.flatMap((child) => Option.toArray(declaredName(child))));
40264
- let current = pipe(integerStatus(node, declaration.integer), Option.match({
40265
- onNone: () => flow,
40266
- onSome: (status) => setAll(pipe(names, Array$1.map((name) => ({
40267
- name: integerKey(name),
40268
- status
40269
- }))))(flow)
40270
- }));
40271
- for (const child of node.namedChildren) current = declareChild(analysis, declaration, child)(current);
40272
- return current;
40203
+ return Array$1.reduce(node.namedChildren, integerMarks(node, declaration)(flow), (current, child) => declareChild(analysis, declaration, child)(current));
40273
40204
  };
40274
40205
  const ASSIGN_HANDLERS = /* @__PURE__ */ new Map([["variable_assignment", (analysis, flow, node) => assign(analysis, flow, {
40275
40206
  node,
@@ -40320,8 +40251,16 @@ const effectiveName = (name, args) => {
40320
40251
  if (name === "exec") return execTarget(args);
40321
40252
  return Option.none();
40322
40253
  };
40323
- const effectiveWordOf = (node) => pipe(fieldOf$2("name")(node), Option.flatMap((name) => pipe(literalOf(name), Option.flatMap((text) => effectiveName(text, fieldsOf$5("argument")(node))), Option.orElse(() => Array$1.head(name.namedChildren)))));
40324
- const commandNameOf = (node) => pipe(fieldOf$2("name")(node), Option.flatMap(literalOf), Option.map((name) => pipe(effectiveName(name, fieldsOf$5("argument")(node)), Option.flatMap(literalOf), Option.getOrElse(() => name))));
40254
+ const targetOf$1 = (node) => pipe(fieldOf$2("name")(node), Option.map((name) => {
40255
+ const text = literalOf(name);
40256
+ return {
40257
+ name,
40258
+ text,
40259
+ wrapped: pipe(text, Option.flatMap((word) => effectiveName(word, fieldsOf$5("argument")(node))))
40260
+ };
40261
+ }));
40262
+ const effectiveWordOf = (node) => pipe(targetOf$1(node), Option.flatMap(({ name, wrapped }) => Option.orElse(wrapped, () => Array$1.head(name.namedChildren))));
40263
+ const commandNameOf = (node) => pipe(targetOf$1(node), Option.flatMap(({ text, wrapped }) => pipe(text, Option.map((name) => pipe(wrapped, Option.flatMap(literalOf), Option.getOrElse(() => name))))));
40325
40264
  const basenameOf = (name) => pipe(String$1.split("/")(name), Array$1.last, Option.getOrElse(() => name));
40326
40265
  // src/app/presets/shared/shell/writes.ts
40327
40266
  const NEXT$5 = 1;
@@ -40689,7 +40628,7 @@ const closestCommand = (node) => {
40689
40628
  }
40690
40629
  return "";
40691
40630
  };
40692
- const isOkAssignment = (node) => pipe(ancestors(node), Array$1.take(PATH_DEPTH), Array$1.some((parent) => parent.type === "variable_assignment" && Option.exists(fieldOf$2("name")(parent), (name) => COMMONLY_QUOTED.has(name.text)) || parent.type === "unary_expression" && pipe(parent.children, Array$1.some((child) => child.text === "-v"))));
40631
+ const isOkAssignment = (node) => pipe(ancestors(node), Array$1.take(PATH_DEPTH), Array$1.some((parent) => Option.exists(assignmentNameOf(parent), (name) => COMMONLY_QUOTED.has(name)) || parent.type === "unary_expression" && pipe(parent.children, Array$1.some((child) => child.text === "-v"))));
40693
40632
  const isProbablyOk = (node, command) => isOkAssignment(node) || OK_COMMANDS.has(command) || String$1.endsWith("awk")(command) || String$1.startsWith("perl")(command);
40694
40633
  const checkSingleQuoted = (state) => (node) => {
40695
40634
  const text = String$1.slice(QUOTE, -1)(node.text);
@@ -40918,7 +40857,7 @@ const declarationFlags = (node) => pipe(node.namedChildren, Array$1.filter((chil
40918
40857
  const isAssignmentOnly = (command) => Option.exists(fieldOf$2("name")(command), (name) => pipe(name.children, Array$1.some((child) => child.isMissing)));
40919
40858
  const isExportingDeclaration = (node) => keywordOf(node) === "export" || String$1.includes("x")(declarationFlags(node));
40920
40859
  const isExported = (node) => Option.exists(parentOf(node), (parent) => parent.type === "command" && !isAssignmentOnly(parent) || parent.type === "declaration_command" && isExportingDeclaration(parent));
40921
- const assignedName = (node) => pipe(targetOf$1(node), Option.map(({ name }) => name), Option.filter((name) => !String$1.startsWith("_")(name)));
40860
+ const assignedName = (node) => pipe(targetOf$2(node), Option.map(({ name }) => name), Option.filter((name) => !String$1.startsWith("_")(name)));
40922
40861
  const checkAssignment = (state) => (node) => {
40923
40862
  if (isExported(node)) return;
40924
40863
  if (isAppending(node)) {
@@ -41689,13 +41628,25 @@ const checkUnknownRunner = (local, using) => {
41689
41628
  local.fail(local.uses, `invalid runner name ${quote(using)} at runs.using in ${name(local)} action defined at ${dir(local)}. valid runners are ${runtimes()}. see ${DOCS}#runs`);
41690
41629
  if (String$1.startsWith("node")(using)) checkJavaScript(local);
41691
41630
  };
41631
+ const RUNNERS = {
41632
+ ...Record.fromIterableWith(RUNTIMES, (runtime) => [runtime, checkJavaScript]),
41633
+ docker: checkDocker$1,
41634
+ composite: checkComposite
41635
+ };
41692
41636
  const checkRuns = (local) => {
41693
41637
  const { using } = local.action.metadata.runs;
41694
- if (String$1.isEmpty(using)) local.fail(local.uses, `"runs.using" is missing in local action ${name(local)} defined at ${dir(local)}`);
41695
- else if (using === "docker") checkDocker$1(local);
41696
- else if (using === "composite") checkComposite(local);
41697
- else if (Array$1.contains(RUNTIMES, using)) checkJavaScript(local);
41698
- else checkUnknownRunner(local, using);
41638
+ if (String$1.isEmpty(using)) {
41639
+ local.fail(local.uses, `"runs.using" is missing in local action ${name(local)} defined at ${dir(local)}`);
41640
+ return;
41641
+ }
41642
+ Option.match(Record.get(RUNNERS, using), {
41643
+ onNone: () => {
41644
+ checkUnknownRunner(local, using);
41645
+ },
41646
+ onSome: (run) => {
41647
+ run(local);
41648
+ }
41649
+ });
41699
41650
  };
41700
41651
  // src/app/presets/features/check-workflows/lib/action-metadata.ts
41701
41652
  const ICONS = icons;
@@ -42004,18 +41955,21 @@ const parseIntOrName = (bounds) => (expr) => pipe(bounds.names, Array$1.findFirs
42004
41955
  onNone: () => parseNumber(expr),
42005
41956
  onSome: (index) => Result.succeed(index + Number(bounds.min === ONE))
42006
41957
  }));
42007
- const explicitSpan = (expr, bounds) => (parts) => {
42008
- if (parts.length > PAIR) return Result.fail(`too many hyphens: ${expr}`);
41958
+ const atMostPair = (parts, expr, noun) => {
41959
+ if (parts.length > PAIR) return Result.fail(`too many ${noun}: ${expr}`);
41960
+ return Result.succeed(parts);
41961
+ };
41962
+ const explicitSpan = (expr, bounds) => (parts) => Result.flatMap(atMostPair(parts, expr, "hyphens"), (pair) => {
42009
41963
  const parse = parseIntOrName(bounds);
42010
- const head = Array$1.getUnsafe(parts, NONE$2);
42011
- const tail = Option.getOrElse(Array$1.get(parts, ONE), () => head);
41964
+ const head = Array$1.getUnsafe(pair, NONE$2);
41965
+ const tail = Option.getOrElse(Array$1.get(pair, ONE), () => head);
42012
41966
  return Result.flatMap(parse(head), (start) => Result.map(parse(tail), (end) => ({
42013
41967
  start,
42014
41968
  end,
42015
41969
  star: false,
42016
41970
  step: ONE
42017
41971
  })));
42018
- };
41972
+ });
42019
41973
  const spanOf = (expr, bounds) => (parts) => {
42020
41974
  if (Array$1.contains(WILDCARDS, Array$1.getUnsafe(parts, NONE$2))) return Result.succeed({
42021
41975
  start: bounds.min,
@@ -42035,16 +41989,14 @@ const withStep = (bounds, single) => (span) => (text) => Result.map(parseNumber(
42035
41989
  star: span.star && step <= ONE,
42036
41990
  step
42037
41991
  }));
42038
- const steppedSpan = (expr, bounds) => {
42039
- const steps = String$1.split("/")(expr);
42040
- if (steps.length > PAIR) return Result.fail(`too many slashes: ${expr}`);
41992
+ const steppedSpan = (expr, bounds) => Result.flatMap(atMostPair(String$1.split("/")(expr), expr, "slashes"), (steps) => {
42041
41993
  const ranges = String$1.split("-")(Array$1.getUnsafe(steps, NONE$2));
42042
41994
  const step = withStep(bounds, ranges.length === ONE);
42043
41995
  return Result.flatMap(spanOf(expr, bounds)(ranges), (span) => Option.match(Array$1.get(steps, ONE), {
42044
41996
  onNone: () => Result.succeed(span),
42045
41997
  onSome: step(span)
42046
41998
  }));
42047
- };
41999
+ });
42048
42000
  const validated = (expr, bounds) => (span) => {
42049
42001
  if (span.start < bounds.min) return Result.fail(`beginning of range (${String(span.start)}) below minimum (${String(bounds.min)}): ${expr}`);
42050
42002
  if (span.end > bounds.max) return Result.fail(`end of range (${String(span.end)}) above maximum (${String(bounds.max)}): ${expr}`);
@@ -42359,22 +42311,26 @@ const checkFilters = (fail, event) => {
42359
42311
  });
42360
42312
  };
42361
42313
  const checkWebhook$1 = (fail) => (event) => {
42362
- const types = Record.get(WEBHOOKS, event.hook.value);
42363
- if (Option.isNone(types)) {
42364
- fail(event, `unknown Webhook event ${quote(event.hook.value)}. see ${UNKNOWN_DOCS} for list of all Webhook event names`);
42365
- return;
42366
- }
42367
- if (typeof types.value !== "string") checkTypes(fail, event)(types.value);
42368
- checkWorkflows(fail, event);
42369
- checkFilters(fail, event);
42314
+ Option.match(Record.get(WEBHOOKS, event.hook.value), {
42315
+ onNone: () => {
42316
+ fail(event, `unknown Webhook event ${quote(event.hook.value)}. see ${UNKNOWN_DOCS} for list of all Webhook event names`);
42317
+ },
42318
+ onSome: (types) => {
42319
+ if (typeof types !== "string") checkTypes(fail, event)(types);
42320
+ checkWorkflows(fail, event);
42321
+ checkFilters(fail, event);
42322
+ }
42323
+ });
42370
42324
  };
42371
42325
  // src/app/presets/features/check-workflows/model/rules/events.ts
42372
- const checkEvent$1 = (fail) => (event) => {
42373
- if (event.type === "schedule") checkSchedule(fail)(event);
42374
- if (event.type === "workflow_dispatch") checkDispatch(fail)(event);
42375
- if (event.type === "workflow_call") checkCallDefaults(fail)(event);
42376
- if (event.type === "webhook") checkWebhook$1(fail)(event);
42377
- };
42326
+ const checkEvent$1 = (fail) => Match.type().pipe(Match.discriminatorsExhaustive("type")({
42327
+ schedule: checkSchedule(fail),
42328
+ workflow_dispatch: checkDispatch(fail),
42329
+ workflow_call: checkCallDefaults(fail),
42330
+ webhook: checkWebhook$1(fail),
42331
+ repository_dispatch: Function.constVoid,
42332
+ image_version: Function.constVoid
42333
+ }));
42378
42334
  const events = workflowRule({
42379
42335
  description: "Reports invalid triggers, filters, schedules and inputs in the on section",
42380
42336
  docs: "https://github.com/rhysd/actionlint/blob/main/docs/checks.md#check-unknown-webhook-event-and-activity-types",