@r_masseater/msch 0.21.0 → 0.23.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/cli.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
  import { A as dependencyEntries, C as propertyValue, D as publishedWorkspaces, M as workspaceDependencies, O as publicEntriesOf, S as nestedValues, _ as workspaceConfigOf, a as runTasksOf, b as keyName, c as VERIFY_TASK, i as workspaceDirectories, j as readManifest, k as MANIFEST_FILE, l as definesTask, s as RUN_TASKS, t as namedWorkspaces, u as hasVerifyTask, v as KeySchema, w as stringsIn, x as literalOf, y as childrenOf$2 } from "./workspace-CMPDXFWk.mjs";
3
- import { $ as isPropertyAssignment, A as getNameOfDeclaration, B as isExportDeclaration, C as API, D as SyntaxKind, E as SignatureKind, F as isBlock, G as isInterfaceDeclaration, H as isFunctionExpression, I as isCallExpression, J as isNewExpression, K as isModuleBlock, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isPropertyAccessExpression, R as isElementAccessExpression, S as uniqueByReference, T as InternalSymbolName, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as lineOf, a as problemAt$2, at as isStringLiteral, b as resolvedSymbol, c as childrenOf$3, ct as isTypeReferenceNode, d as declarationsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as descendantsOf, ft as isVariableStatement, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as columnOf, lt as isUnionTypeNode, m as isExternalDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as importedModulesOf, q as isModuleDeclaration, rt as isSourceFile, s as NODE_MODULES_SEGMENT, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as contains, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-Dia53DiS.mjs";
3
+ import { $ as isPropertyAssignment, A as getNameOfDeclaration, B as isExportDeclaration, C as API, D as SyntaxKind, E as SignatureKind, F as isBlock, G as isInterfaceDeclaration, H as isFunctionExpression, I as isCallExpression, J as isNewExpression, K as isModuleBlock, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isPropertyAccessExpression, R as isElementAccessExpression, S as uniqueByReference, T as InternalSymbolName, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as packageOf$1, a as problemAt$4, at as isStringLiteral, b as resolvedSymbol, c as columnOf, ct as isTypeReferenceNode, d as descendantsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as importedModulesOf, ft as isVariableStatement, g as lineOf, h as isTypeDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as contains, lt as isUnionTypeNode, m as isGenericDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as isExternalDeclaration, q as isModuleDeclaration, rt as isSourceFile, s as childrenOf$3, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as declarationsOf, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-BViRo52q.mjs";
4
4
  import { a as groupOf$1, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-B11FFAIk.mjs";
5
5
  import { t as COMMENT_DIRECTIVES } from "./comment-directives-WcDqvLwJ.mjs";
6
+ import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
6
7
  import { Array, Cause, Effect, FileSystem, Function, HashMap, HashSet, Layer, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
7
8
  import { ChildProcess } from "effect/process";
8
9
  import { parse, resolveConfigFromFile } from "vite-plus";
@@ -316,8 +317,8 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
316
317
  return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
317
318
  });
318
319
  // src/entities/project/model/inputs.ts
319
- const SEPARATOR$13 = "/";
320
- const SCOPE_PREFIX$2 = "@";
320
+ const SEPARATOR$14 = "/";
321
+ const SCOPE_PREFIX$1 = "@";
321
322
  const HIDDEN_PREFIX = ".";
322
323
  const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
323
324
  const nearestManifestDirectory = Effect.fn("nearestManifestDirectory")(function* nearestManifestDirectory(start) {
@@ -358,14 +359,14 @@ const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath)
358
359
  const directories = yield* workspaceClosure(directory);
359
360
  return {
360
361
  directories,
361
- prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$13}`))
362
+ prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$14}`))
362
363
  };
363
364
  });
364
365
  const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
365
366
  const files = yield* RepositoryFiles;
366
- if (!String$1.startsWith(SCOPE_PREFIX$2)(name)) return [name];
367
+ if (!String$1.startsWith(SCOPE_PREFIX$1)(name)) return [name];
367
368
  const scoped = yield* files.readDirectory(files.join(modules, name));
368
- return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$13}${entry}`));
369
+ return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$14}${entry}`));
369
370
  });
370
371
  const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
371
372
  const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
@@ -414,22 +415,22 @@ const positionOf = (source) => (index) => {
414
415
  const RELATIVE = /^\.\.?(?:\/|$)/u;
415
416
  const SUBPATH_IMPORT = "#";
416
417
  const WILDCARD$2 = "*";
417
- const SCOPE = "@";
418
- const SEPARATOR$12 = "/";
418
+ const SCOPE$1 = "@";
419
+ const SEPARATOR$13 = "/";
419
420
  const SOURCE_SUFFIXES = [
420
421
  "",
421
422
  ".ts",
422
423
  ".tsx",
423
424
  "/index.ts"
424
425
  ];
425
- const SCOPED_SEGMENTS$1 = 2;
426
+ const SCOPED_SEGMENTS = 2;
426
427
  const PLAIN_SEGMENTS = 1;
427
428
  const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
428
429
  const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
429
430
  const packageNameOf = (specifier) => {
430
- const segments = String$1.split(specifier, SEPARATOR$12);
431
- if (String$1.startsWith(SCOPE)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS$1), Array.join(SEPARATOR$12));
432
- return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$12));
431
+ const segments = String$1.split(specifier, SEPARATOR$13);
432
+ if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$13));
433
+ return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$13));
433
434
  };
434
435
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
435
436
  const runtimeSpecifierOf = (statement) => {
@@ -776,7 +777,7 @@ const AdvisorySchema = Schema.Struct({
776
777
  github_advisory_id: Schema.String
777
778
  });
778
779
  const AuditReport = Schema.fromJsonString(Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }));
779
- const SCOPE_PREFIX$1 = "@";
780
+ const SCOPE_PREFIX = "@";
780
781
  const NAME_START = 0;
781
782
  const SEPARATOR_LENGTH = 1;
782
783
  const PEER_CONTEXT_START = "(";
@@ -800,14 +801,14 @@ const advisoriesIn = (output) => Option.match(Schema.decodeOption(AuditReport)(o
800
801
  onSome: (report) => sorted(pipe(Record.values(report.advisories), Array.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`)))
801
802
  });
802
803
  const separatorOf = (key) => {
803
- if (!String$1.startsWith(SCOPE_PREFIX$1)(key)) return String$1.indexOf(SCOPE_PREFIX$1)(key);
804
- return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX$1), Option.map((index) => index + SEPARATOR_LENGTH));
804
+ if (!String$1.startsWith(SCOPE_PREFIX)(key)) return String$1.indexOf(SCOPE_PREFIX)(key);
805
+ return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX), Option.map((index) => index + SEPARATOR_LENGTH));
805
806
  };
806
807
  const withoutPeerContext = (version) => Option.match(String$1.indexOf(PEER_CONTEXT_START)(version), {
807
808
  onNone: () => version,
808
809
  onSome: (start) => String$1.slice(NAME_START, start)(version)
809
810
  });
810
- const packageOf$1 = (key) => Option.map(separatorOf(key), (separator) => [String$1.slice(NAME_START, separator)(key), withoutPeerContext(String$1.slice(separator + SEPARATOR_LENGTH)(key))]);
811
+ const packageOf = (key) => Option.map(separatorOf(key), (separator) => [String$1.slice(NAME_START, separator)(key), withoutPeerContext(String$1.slice(separator + SEPARATOR_LENGTH)(key))]);
811
812
  const keysOf$1 = (node) => {
812
813
  if (!isMap(node)) return [];
813
814
  return pipe(node.items, Array.flatMap((pair) => {
@@ -818,7 +819,7 @@ const keysOf$1 = (node) => {
818
819
  const lockfileKeysOf = (lockfile, section) => pipe(parseAllDocuments(lockfile), Array.flatMap((document) => keysOf$1(document.get(section))));
819
820
  const resolutionOf = (findings) => (lockfile) => {
820
821
  const snapshots = lockfileKeysOf(lockfile, "snapshots");
821
- const packages = Array.getSomes(pipe([...lockfileKeysOf(lockfile, "packages"), ...snapshots], Array.map((key) => packageOf$1(key))));
822
+ const packages = Array.getSomes(pipe([...lockfileKeysOf(lockfile, "packages"), ...snapshots], Array.map((key) => packageOf(key))));
822
823
  const versions = Record.map(Array.groupBy(packages, ([name]) => name), (entries) => sorted(pipe(entries, Array.map(([, version]) => version))));
823
824
  return {
824
825
  ...findings,
@@ -889,11 +890,11 @@ const withBaselineProbe = (manifest) => {
889
890
  return document.toString();
890
891
  };
891
892
  // src/features/overrides/model/overrides.ts
892
- const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
893
+ const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
893
894
  const LOCKFILE$1 = "pnpm-lock.yaml";
894
895
  const RESOLUTION_FILES = [
895
896
  "*package.json",
896
- WORKSPACE_FILE$2,
897
+ WORKSPACE_FILE$3,
897
898
  LOCKFILE$1,
898
899
  ".npmrc",
899
900
  "patches/*"
@@ -964,7 +965,7 @@ const resolutionWith = Effect.fn("resolutionWith")(function* resolutionWith(work
964
965
  const path = yield* Path.Path;
965
966
  const directory = yield* fs.makeTempDirectoryScoped({ prefix: "msch-overrides-" });
966
967
  yield* copyFiles(workspace, directory);
967
- yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE$2), manifest);
968
+ yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE$3), manifest);
968
969
  const output = yield* resolveIn(directory, override);
969
970
  const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE$1));
970
971
  yield* Effect.annotateCurrentSpan({ "msch.override": override });
@@ -983,7 +984,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, manifes
983
984
  };
984
985
  const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));
985
986
  const judgeAgainstBaseline = judge(baseline);
986
- const file = path.join(root, WORKSPACE_FILE$2);
987
+ const file = path.join(root, WORKSPACE_FILE$3);
987
988
  const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(Effect.map((candidate) => overrideProblem({
988
989
  ...located,
989
990
  file
@@ -995,7 +996,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, manifes
995
996
  const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
996
997
  const fs = yield* FileSystem.FileSystem;
997
998
  const path = yield* Path.Path;
998
- const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$2)).pipe(Effect.option);
999
+ const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$3)).pipe(Effect.option);
999
1000
  const keys = Option.match(manifest, {
1000
1001
  onNone: () => [],
1001
1002
  onSome: overrideKeysOf
@@ -1003,9 +1004,57 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
1003
1004
  if (Option.isNone(manifest) || !Array.isReadonlyArrayNonEmpty(keys)) return [];
1004
1005
  return yield* problemsFor(root, manifest.value, keys);
1005
1006
  });
1007
+ // src/shared/lib/scanned-files.ts
1008
+ const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
1009
+ const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
1010
+ const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
1011
+ const READ_CONCURRENCY$19 = 64;
1012
+ const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
1013
+ const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
1014
+ /** @internal */
1015
+ const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
1016
+ const files = yield* RepositoryFiles;
1017
+ const names = yield* files.listedFiles(root);
1018
+ return pipe(names, Array.map((name) => ({
1019
+ name,
1020
+ file: files.join(root, name)
1021
+ })));
1022
+ });
1023
+ /** @internal */
1024
+ const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
1025
+ const files = yield* RepositoryFiles;
1026
+ return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
1027
+ });
1028
+ /** @internal */
1029
+ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
1030
+ const files = yield* RepositoryFiles;
1031
+ const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
1032
+ onNone: () => [],
1033
+ onSome: (source) => problemsIn(entry, source)
1034
+ }))), { concurrency: READ_CONCURRENCY$19 });
1035
+ return Array.flatten(found);
1036
+ });
1037
+ // src/features/overrides/model/git-subpath.ts
1038
+ const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
1039
+ const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
1040
+ const RULE$27 = "git-subpath-dependency";
1041
+ const WHOLE_MATCH$2 = 0;
1042
+ const problemAt$3 = ({ file }, source) => (found) => ({
1043
+ file,
1044
+ ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
1045
+ rule: RULE$27,
1046
+ message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$2])}\`.`
1047
+ });
1048
+ const problemsIn$11 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$3(entry, source)));
1049
+ const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
1050
+ /** @internal */
1051
+ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
1052
+ const listed = yield* listedFiles(root);
1053
+ return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$11);
1054
+ });
1006
1055
  // src/shared/lib/agent-docs.ts
1007
1056
  const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
1008
- const READ_CONCURRENCY$19 = 16;
1057
+ const READ_CONCURRENCY$18 = 16;
1009
1058
  const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
1010
1059
  const files = yield* RepositoryFiles;
1011
1060
  const listed = yield* files.listedFiles(root);
@@ -1014,13 +1063,13 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
1014
1063
  const file = files.join(root, name);
1015
1064
  const problemOf = Option.flatMap(problemIn(file));
1016
1065
  return files.readFile(file).pipe(Effect.map(problemOf));
1017
- }, { concurrency: READ_CONCURRENCY$19 });
1066
+ }, { concurrency: READ_CONCURRENCY$18 });
1018
1067
  return Array.getSomes(found);
1019
1068
  });
1020
1069
  // src/features/placement/model/agent-docs-length.ts
1021
1070
  const RECOMMENDED_LINES = 200;
1022
1071
  const FIRST$13 = 1;
1023
- const RULE$25 = "agent-docs-length";
1072
+ const RULE$26 = "agent-docs-length";
1024
1073
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
1025
1074
  const problemFor$5 = (file) => (lines) => {
1026
1075
  if (lines <= RECOMMENDED_LINES) return Option.none();
@@ -1028,16 +1077,16 @@ const problemFor$5 = (file) => (lines) => {
1028
1077
  file,
1029
1078
  line: 201,
1030
1079
  column: FIRST$13,
1031
- rule: RULE$25,
1080
+ rule: RULE$26,
1032
1081
  message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`
1033
1082
  });
1034
1083
  };
1035
1084
  /** @internal */
1036
1085
  const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
1037
1086
  // src/features/placement/model/colocated-tests.ts
1038
- const RULE$24 = "colocated-test";
1087
+ const RULE$25 = "colocated-test";
1039
1088
  const FIRST$12 = 1;
1040
- const READ_CONCURRENCY$18 = 64;
1089
+ const READ_CONCURRENCY$17 = 64;
1041
1090
  const ROOT_SUBPATH = ".";
1042
1091
  const NAME_GROUP = "name";
1043
1092
  const SPECIFIER_GROUP = "specifier";
@@ -1061,12 +1110,12 @@ const problemFor$4 = (test, message) => ({
1061
1110
  file: test.file,
1062
1111
  line: FIRST$12,
1063
1112
  column: FIRST$12,
1064
- rule: RULE$24,
1113
+ rule: RULE$25,
1065
1114
  message: `${test.base} ${message}`
1066
1115
  });
1067
1116
  const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
1068
1117
  const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE.test(name)));
1069
- const ownerOf$1 = (packages, name) => {
1118
+ const ownerOf$2 = (packages, name) => {
1070
1119
  const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
1071
1120
  return Array.last(Array.sort(owners, byLength));
1072
1121
  };
@@ -1077,7 +1126,7 @@ const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Op
1077
1126
  }), Array.filter(({ source }) => dirname(source) === directory), Array.map(({ label }) => String$1.replace(ROOT_SUBPATH, name)(label)))), Option.getOrElse(() => []));
1078
1127
  const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context, test) {
1079
1128
  const files = yield* RepositoryFiles;
1080
- const owner = ownerOf$1(context.packages, test.name);
1129
+ const owner = ownerOf$2(context.packages, test.name);
1081
1130
  if (Option.isNone(owner)) return [];
1082
1131
  const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
1083
1132
  const join = (target) => files.join(context.root, owner.value, target);
@@ -1123,15 +1172,15 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
1123
1172
  directory: files.dirname(file)
1124
1173
  };
1125
1174
  }));
1126
- const found = yield* Effect.forEach(tests, (test) => problemIn$5(context, test), { concurrency: READ_CONCURRENCY$18 });
1175
+ const found = yield* Effect.forEach(tests, (test) => problemIn$5(context, test), { concurrency: READ_CONCURRENCY$17 });
1127
1176
  return Array.getSomes(found);
1128
1177
  });
1129
1178
  // src/features/placement/model/dangling-links.ts
1130
- const RULE$23 = "dangling-link";
1131
- const SEPARATOR$11 = "/";
1179
+ const RULE$24 = "dangling-link";
1180
+ const SEPARATOR$12 = "/";
1132
1181
  const FIRST$11 = 1;
1133
- const READ_CONCURRENCY$17 = 16;
1134
- const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$11}`)(name);
1182
+ const READ_CONCURRENCY$16 = 16;
1183
+ const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$12}`)(name);
1135
1184
  /** @internal */
1136
1185
  const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
1137
1186
  const files = yield* RepositoryFiles;
@@ -1143,31 +1192,31 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
1143
1192
  file,
1144
1193
  line: FIRST$11,
1145
1194
  column: FIRST$11,
1146
- rule: RULE$23,
1195
+ rule: RULE$24,
1147
1196
  message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
1148
1197
  })));
1149
1198
  });
1150
- const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$17 });
1199
+ const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$16 });
1151
1200
  return Array.getSomes(found);
1152
1201
  });
1153
1202
  // src/features/placement/model/nested-docs.ts
1154
- const RULE$22 = "nested-docs";
1203
+ const RULE$23 = "nested-docs";
1155
1204
  const CONFIG_FILE$4 = "vite.config.ts";
1156
- const SEPARATOR$10 = "/";
1205
+ const SEPARATOR$11 = "/";
1157
1206
  const FIRST$10 = 1;
1158
- const READ_CONCURRENCY$16 = 64;
1207
+ const READ_CONCURRENCY$15 = 64;
1159
1208
  const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
1160
1209
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
1161
1210
  const README = /^README(?:\.[^/]+)?$/iu;
1162
1211
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
1163
1212
  const taggedError$3 = Schema.TaggedError;
1164
1213
  var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
1165
- const isNested = (name) => String$1.includes(SEPARATOR$10)(name);
1214
+ const isNested = (name) => String$1.includes(SEPARATOR$11)(name);
1166
1215
  const problemFor$3 = (file, message) => ({
1167
1216
  file,
1168
1217
  line: FIRST$10,
1169
1218
  column: FIRST$10,
1170
- rule: RULE$22,
1219
+ rule: RULE$23,
1171
1220
  message
1172
1221
  });
1173
1222
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
@@ -1213,17 +1262,17 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
1213
1262
  workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
1214
1263
  workspaceAgentDocs
1215
1264
  };
1216
- const found = yield* Effect.forEach(nested, (name) => problemIn$4(root, allowed, name), { concurrency: READ_CONCURRENCY$16 });
1265
+ const found = yield* Effect.forEach(nested, (name) => problemIn$4(root, allowed, name), { concurrency: READ_CONCURRENCY$15 });
1217
1266
  return Array.getSomes(found);
1218
1267
  });
1219
1268
  // src/features/placement/model/root-docs.ts
1220
- const RULE$21 = "root-docs";
1221
- const SEPARATOR$9 = "/";
1269
+ const RULE$22 = "root-docs";
1270
+ const SEPARATOR$10 = "/";
1222
1271
  const FIRST$9 = 1;
1223
1272
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
1224
1273
  const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
1225
1274
  const MESSAGE$5 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
1226
- const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$9)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1275
+ const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$10)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1227
1276
  /** @internal */
1228
1277
  const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
1229
1278
  const files = yield* RepositoryFiles;
@@ -1232,14 +1281,14 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
1232
1281
  file: files.join(root, name),
1233
1282
  line: FIRST$9,
1234
1283
  column: FIRST$9,
1235
- rule: RULE$21,
1284
+ rule: RULE$22,
1236
1285
  message: `${name} ${MESSAGE$5}`
1237
1286
  })));
1238
1287
  });
1239
1288
  // src/features/placement/model/root-readme.ts
1240
- const RULE$20 = "root-readme";
1289
+ const RULE$21 = "root-readme";
1241
1290
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
1242
- const READ_CONCURRENCY$15 = 16;
1291
+ const READ_CONCURRENCY$14 = 16;
1243
1292
  const START$12 = 0;
1244
1293
  const CHECK_POLICY = "@r_masseater/msch";
1245
1294
  const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
@@ -1250,7 +1299,7 @@ const problemsIn$10 = (file, source) => ({ directory, pattern }) => {
1250
1299
  return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
1251
1300
  file,
1252
1301
  ...at(found.index ?? START$12),
1253
- rule: RULE$20,
1302
+ rule: RULE$21,
1254
1303
  message
1255
1304
  })));
1256
1305
  };
@@ -1268,7 +1317,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
1268
1317
  const readmes = pipe(names, Array.filter((name) => ROOT_DOC.test(name)));
1269
1318
  const named = yield* namedWorkspaces(root);
1270
1319
  const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
1271
- const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$15 });
1320
+ const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$14 });
1272
1321
  return Array.flatten(found);
1273
1322
  });
1274
1323
  // src/features/placement/model/placement-checks.ts
@@ -1291,9 +1340,9 @@ const SCRIPTS = "scripts-directory";
1291
1340
  const BIN = "bin";
1292
1341
  const SCRIPTS_DIRECTORY = "scripts";
1293
1342
  const WORKFLOW_DIRECTORY$1 = ".github/";
1294
- const SEPARATOR$8 = "/";
1343
+ const SEPARATOR$9 = "/";
1295
1344
  const CURRENT = "./";
1296
- const READ_CONCURRENCY$14 = 8;
1345
+ const READ_CONCURRENCY$13 = 8;
1297
1346
  const FIRST$8 = 1;
1298
1347
  const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
1299
1348
  const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
@@ -1337,16 +1386,16 @@ const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
1337
1386
  const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
1338
1387
  const files = yield* RepositoryFiles;
1339
1388
  const names = yield* files.readDirectory(files.join(root, directory, BIN));
1340
- return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$8}${name}`), Array.filter(isCommand$1));
1389
+ return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$9}${name}`), Array.filter(isCommand$1));
1341
1390
  });
1342
1391
  const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
1343
1392
  const files = yield* RepositoryFiles;
1344
1393
  const listed = yield* files.listedFiles(root);
1345
1394
  const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
1346
- const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$14 });
1395
+ const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$13 });
1347
1396
  return pipe(Array.getSomes(texts), Array.join("\n"));
1348
1397
  });
1349
- const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$8));
1398
+ const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$9));
1350
1399
  const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
1351
1400
  file,
1352
1401
  ...positionOf(source)(start),
@@ -1393,17 +1442,17 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
1393
1442
  const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
1394
1443
  const all = ["", ...yield* workspaceDirectories(root)];
1395
1444
  const workflows = yield* workflowText(root);
1396
- const found = yield* Effect.forEach(all, (directory) => problemsIn$9(root, directory, workflows), { concurrency: READ_CONCURRENCY$14 });
1397
- const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$14 });
1445
+ const found = yield* Effect.forEach(all, (directory) => problemsIn$9(root, directory, workflows), { concurrency: READ_CONCURRENCY$13 });
1446
+ const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$13 });
1398
1447
  return [...Array.flatten(found), ...Array.getSomes(scripts)];
1399
1448
  });
1400
1449
  // src/features/repository-layout/model/crates.ts
1401
- const RULE$19 = "unverified-crate";
1450
+ const RULE$20 = "unverified-crate";
1402
1451
  const CARGO_FILE = "Cargo.toml";
1403
1452
  const CONFIG_FILE$3 = "vite.config.ts";
1404
- const SEPARATOR$7 = "/";
1453
+ const SEPARATOR$8 = "/";
1405
1454
  const FIRST$7 = 1;
1406
- const READ_CONCURRENCY$13 = 8;
1455
+ const READ_CONCURRENCY$12 = 8;
1407
1456
  const CrateEntry = Schema.Struct({
1408
1457
  name: Schema.String,
1409
1458
  manifest_path: Schema.String
@@ -1429,14 +1478,14 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
1429
1478
  })));
1430
1479
  }, Effect.scoped);
1431
1480
  const owningWorkspace = (directories) => (directory) => {
1432
- const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$7}`)(directory)));
1481
+ const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$8}`)(directory)));
1433
1482
  return Array.last(Array.sort(owners, String$1.Order));
1434
1483
  };
1435
1484
  const problemFor$2 = (crate, message) => ({
1436
1485
  file: crate.manifest,
1437
1486
  line: FIRST$7,
1438
1487
  column: FIRST$7,
1439
- rule: RULE$19,
1488
+ rule: RULE$20,
1440
1489
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
1441
1490
  });
1442
1491
  const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
@@ -1452,11 +1501,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
1452
1501
  if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
1453
1502
  const directories = yield* workspaceDirectories(root);
1454
1503
  const crates = yield* cratesIn(root);
1455
- const found = yield* Effect.forEach(crates, (crate) => problemIn$3(root, directories, crate), { concurrency: READ_CONCURRENCY$13 });
1504
+ const found = yield* Effect.forEach(crates, (crate) => problemIn$3(root, directories, crate), { concurrency: READ_CONCURRENCY$12 });
1456
1505
  return Array.getSomes(found);
1457
1506
  });
1458
1507
  // src/features/repository-layout/model/fallow-entries.ts
1459
- const RULE$18 = "listed-entry";
1508
+ const RULE$19 = "listed-entry";
1460
1509
  const ENTRY_KEYS = [
1461
1510
  "entry",
1462
1511
  "entryPoints",
@@ -1464,9 +1513,9 @@ const ENTRY_KEYS = [
1464
1513
  ];
1465
1514
  const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
1466
1515
  const WILDCARD$1 = /[*?{[]/u;
1467
- const SEPARATOR$6 = "/";
1516
+ const SEPARATOR$7 = "/";
1468
1517
  const WRAP_OFFSET = 1;
1469
- const READ_CONCURRENCY$12 = 8;
1518
+ const READ_CONCURRENCY$11 = 8;
1470
1519
  const decodeKey = Schema.decodeUnknownOption(KeySchema);
1471
1520
  const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
1472
1521
  const entryPatternsIn = (node) => {
@@ -1476,7 +1525,7 @@ const entryPatternsIn = (node) => {
1476
1525
  })));
1477
1526
  return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
1478
1527
  };
1479
- const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$6}`)(text))) || String$1.includes(SEPARATOR$6)(text) && !WILDCARD$1.test(text);
1528
+ const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$7}`)(text))) || String$1.includes(SEPARATOR$7)(text) && !WILDCARD$1.test(text);
1480
1529
  const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
1481
1530
  const files = yield* RepositoryFiles;
1482
1531
  const path = files.join(root, file);
@@ -1486,7 +1535,7 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, di
1486
1535
  return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
1487
1536
  file: path,
1488
1537
  ...positionOf(text.value)(start),
1489
- rule: RULE$18,
1538
+ rule: RULE$19,
1490
1539
  message: `${pattern} names files one by one. Give fallow a place that every workspace uses the same way, such as bin/*.ts or a tool's config file name, or make fallow find the file through package.json.`
1491
1540
  })));
1492
1541
  });
@@ -1494,14 +1543,14 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, di
1494
1543
  const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
1495
1544
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
1496
1545
  const directories = yield* workspaceDirectories(root);
1497
- const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$8(root, file, directories), { concurrency: READ_CONCURRENCY$12 });
1546
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$8(root, file, directories), { concurrency: READ_CONCURRENCY$11 });
1498
1547
  return Array.flatten(found);
1499
1548
  });
1500
1549
  // src/features/repository-layout/model/hidden-verify.ts
1501
- const RULE$17 = "hidden-verify";
1550
+ const RULE$18 = "hidden-verify";
1502
1551
  const CONFIG_FILE$2 = "vite.config.ts";
1503
1552
  const FIRST$6 = 1;
1504
- const READ_CONCURRENCY$11 = 8;
1553
+ const READ_CONCURRENCY$10 = 8;
1505
1554
  const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
1506
1555
  const config = yield* workspaceConfigOf(root, directory);
1507
1556
  if (Option.isNone(config)) return Option.none();
@@ -1512,18 +1561,18 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
1512
1561
  file,
1513
1562
  line: FIRST$6,
1514
1563
  column: FIRST$6,
1515
- rule: RULE$17,
1564
+ rule: RULE$18,
1516
1565
  message: `${directory} gets its verify task from code outside ${CONFIG_FILE$2}. The root verify reads ${CONFIG_FILE$2} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$2}.`
1517
1566
  }).pipe(Option.filter(() => verified));
1518
1567
  });
1519
1568
  /** @internal */
1520
1569
  const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
1521
1570
  const directories = yield* workspaceDirectories(root);
1522
- const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$11 });
1571
+ const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$10 });
1523
1572
  return Array.getSomes(found);
1524
1573
  });
1525
1574
  // src/features/repository-layout/model/root-workspace-paths.ts
1526
- const RULE$16 = "root-workspace-path";
1575
+ const RULE$17 = "root-workspace-path";
1527
1576
  const CONFIG_FILE$1 = "vite.config.ts";
1528
1577
  const PATH_CHARACTER = /[\w.@/-]/u;
1529
1578
  const NAME_CHARACTER = /[\w.@-]/u;
@@ -1542,7 +1591,7 @@ const mentions = (directory) => (text) => {
1542
1591
  const problemsIn$7 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
1543
1592
  file,
1544
1593
  ...positionOf(source)(found.start),
1545
- rule: RULE$16,
1594
+ rule: RULE$17,
1546
1595
  message: `${directory} is a workspace. The root ${CONFIG_FILE$1} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$1}: msch.lint, msch.devDependencies or its verify task.`
1547
1596
  })));
1548
1597
  /** @internal */
@@ -1556,8 +1605,8 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
1556
1605
  return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$7(file, source.value, directories)));
1557
1606
  });
1558
1607
  // src/features/repository-layout/model/shared-uncached-tasks.ts
1559
- const RULE$15 = "shared-uncached-task";
1560
- const READ_CONCURRENCY$10 = 8;
1608
+ const RULE$16 = "shared-uncached-task";
1609
+ const READ_CONCURRENCY$9 = 8;
1561
1610
  const SHARED = 2;
1562
1611
  const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
1563
1612
  const UncachedTask = Schema.Struct({
@@ -1599,14 +1648,14 @@ const problemsOf$1 = (definitions) => {
1599
1648
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
1600
1649
  file,
1601
1650
  ...position,
1602
- rule: RULE$15,
1651
+ rule: RULE$16,
1603
1652
  message: `The uncached task ${name} (${command}) is written the same way in ${Array.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
1604
1653
  })));
1605
1654
  };
1606
1655
  /** @internal */
1607
1656
  const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
1608
1657
  const directories = yield* workspaceDirectories(root);
1609
- const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$10 });
1658
+ const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$9 });
1610
1659
  return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$1));
1611
1660
  });
1612
1661
  // src/features/repository-layout/model/workflow-nodes.ts
@@ -1645,7 +1694,7 @@ const scalarsIn = (source) => {
1645
1694
  const ROOT = ".";
1646
1695
  const LOCAL = "./";
1647
1696
  const NEGATION = "!";
1648
- const SEPARATOR$5 = "/";
1697
+ const SEPARATOR$6 = "/";
1649
1698
  const LINE$1 = "\n";
1650
1699
  const UNRESOLVED_MARKERS = [
1651
1700
  "${{",
@@ -1672,7 +1721,7 @@ const withoutLocal = (path) => {
1672
1721
  const joinPath = (base, path) => {
1673
1722
  const relative = withoutLocal(String$1.trim(path));
1674
1723
  if (base === ROOT) return relative;
1675
- return `${base}${SEPARATOR$5}${relative}`;
1724
+ return `${base}${SEPARATOR$6}${relative}`;
1676
1725
  };
1677
1726
  const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
1678
1727
  const path = String$1.trim(text);
@@ -1745,12 +1794,12 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
1745
1794
  /** @internal */
1746
1795
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
1747
1796
  // src/features/repository-layout/model/workflow-paths.ts
1748
- const RULE$14 = "workflow-path";
1797
+ const RULE$15 = "workflow-path";
1749
1798
  const WORKFLOW_DIRECTORY = ".github/workflows/";
1750
1799
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
1751
- const READ_CONCURRENCY$9 = 8;
1800
+ const READ_CONCURRENCY$8 = 8;
1752
1801
  const WILDCARD = /[*?[]/u;
1753
- const SEPARATOR$4 = "/";
1802
+ const SEPARATOR$5 = "/";
1754
1803
  const FIRST$4 = 0;
1755
1804
  const EXPECTED = {
1756
1805
  action: "a directory with action.yml",
@@ -1775,10 +1824,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
1775
1824
  return Option.getOrElse(directory, () => false);
1776
1825
  });
1777
1826
  const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
1778
- const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$4}${name}`)));
1827
+ const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$5}${name}`)));
1779
1828
  return pipe(found, Array.some(Boolean));
1780
1829
  });
1781
- const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$4))}`;
1830
+ const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$5))}`;
1782
1831
  const RESOLVERS = {
1783
1832
  action: hasAction,
1784
1833
  directory: isDirectoryAt,
@@ -1786,13 +1835,13 @@ const RESOLVERS = {
1786
1835
  glob: matchesGlob,
1787
1836
  script: Effect.fn("findsScript")(function* findsScript(root, path) {
1788
1837
  if (yield* existsAt(root, path)) return true;
1789
- const segments = String$1.split(path, SEPARATOR$4);
1838
+ const segments = String$1.split(path, SEPARATOR$5);
1790
1839
  return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
1791
1840
  })
1792
1841
  };
1793
1842
  const staticPrefix = (path) => {
1794
1843
  const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
1795
- if (String$1.endsWith(SEPARATOR$4)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
1844
+ if (String$1.endsWith(SEPARATOR$5)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
1796
1845
  return prefix;
1797
1846
  };
1798
1847
  const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
@@ -1801,7 +1850,7 @@ const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
1801
1850
  const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
1802
1851
  return Array.isReadonlyArrayNonEmpty(ignored);
1803
1852
  });
1804
- const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$4}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$4}`)(path);
1853
+ const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$5}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$5}`)(path);
1805
1854
  const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
1806
1855
  const prefix = staticPrefix(found.path);
1807
1856
  if (pipe(produced, Array.some(overlaps(prefix)))) return false;
@@ -1811,7 +1860,7 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
1811
1860
  const problemOf$5 = (file, source) => (found) => ({
1812
1861
  file,
1813
1862
  ...positionOf(source)(found.offset),
1814
- rule: RULE$14,
1863
+ rule: RULE$15,
1815
1864
  message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`
1816
1865
  });
1817
1866
  const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
@@ -1826,7 +1875,7 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow
1826
1875
  /** @internal */
1827
1876
  const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
1828
1877
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
1829
- const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$6(root, workflow), { concurrency: READ_CONCURRENCY$9 });
1878
+ const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$6(root, workflow), { concurrency: READ_CONCURRENCY$8 });
1830
1879
  return Array.flatten(found);
1831
1880
  });
1832
1881
  // src/features/repository-layout/model/workflow-scale.ts
@@ -1838,14 +1887,14 @@ const FILTER_KEYS = ["paths", "paths-ignore"];
1838
1887
  const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
1839
1888
  const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
1840
1889
  const START$11 = 0;
1841
- const READ_CONCURRENCY$8 = 8;
1842
- const SEPARATOR$3 = "/";
1890
+ const READ_CONCURRENCY$7 = 8;
1891
+ const SEPARATOR$4 = "/";
1843
1892
  const WORD_SEPARATORS = /[-_]/gu;
1844
1893
  const SPACE = " ";
1845
1894
  const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
1846
1895
  const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
1847
1896
  const keysOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
1848
- const problemAt$1 = ({ file, source }, rule, message) => (offset) => ({
1897
+ const problemAt$2 = ({ file, source }, rule, message) => (offset) => ({
1849
1898
  file,
1850
1899
  ...positionOf(source)(offset),
1851
1900
  rule,
@@ -1855,14 +1904,14 @@ const pathFiltersIn = (file, source) => {
1855
1904
  const root = parseDocument(source).contents;
1856
1905
  const triggers = pipe(entriesOf(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
1857
1906
  const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
1858
- return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$1({
1907
+ return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$2({
1859
1908
  file,
1860
1909
  source
1861
1910
  }, PATH_FILTER, FILTER_MESSAGE)(offset)));
1862
1911
  };
1863
1912
  const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ pattern }) => Option.isSome(String$1.match(pattern)(text))), Option.map(({ directory }) => directory));
1864
1913
  const named = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
1865
- const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$3}`)(path)), Option.map(({ directory }) => directory));
1914
+ const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$4}`)(path)), Option.map(({ directory }) => directory));
1866
1915
  const namesIn = (name, source) => {
1867
1916
  const root = parseDocument(source).contents;
1868
1917
  return [
@@ -1878,7 +1927,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, off
1878
1927
  text: value,
1879
1928
  offset
1880
1929
  })))));
1881
- const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$1(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
1930
+ const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$2(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
1882
1931
  const packagesIn = (workspaces, { file, name, source }) => {
1883
1932
  const where = {
1884
1933
  file,
@@ -1918,7 +1967,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
1918
1967
  name: stem,
1919
1968
  source: text
1920
1969
  })]), Option.getOrElse(() => []));
1921
- }), { concurrency: READ_CONCURRENCY$8 });
1970
+ }), { concurrency: READ_CONCURRENCY$7 });
1922
1971
  const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
1923
1972
  return [...Array.flatten(found), ...actions];
1924
1973
  });
@@ -1938,7 +1987,7 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
1938
1987
  return Array.flatten(found);
1939
1988
  });
1940
1989
  // src/features/pass-through-wrappers/model/pass-through-wrappers.ts
1941
- const RULE$13 = "pass-through-wrapper";
1990
+ const RULE$14 = "pass-through-wrapper";
1942
1991
  const SINGLE_STATEMENT = 1;
1943
1992
  const SINGLE_DECLARATION = 1;
1944
1993
  const THIS_PARAMETER = "this";
@@ -2034,8 +2083,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
2034
2083
  };
2035
2084
  const problemOf$4 = (checker) => (candidate) => {
2036
2085
  if (changesTheCall(candidate.wrapper)) return Option.none();
2037
- return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$2({
2038
- rule: RULE$13,
2086
+ return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$4({
2087
+ rule: RULE$14,
2039
2088
  message: messageOf(forward.callee.getText())
2040
2089
  })(candidate.name)));
2041
2090
  };
@@ -2073,25 +2122,13 @@ const contextSymbolsOf = (checker) => (expression) => {
2073
2122
  return slotOf(checker)(expression).pipe(Option.flatMap(annotationOf), Option.map((annotation) => referencedSymbols(checker)(annotation)), Option.getOrElse(() => []));
2074
2123
  };
2075
2124
  // src/features/value-owners/model/flows.ts
2076
- const SCOPE_PREFIX = "@";
2077
- const SCOPED_SEGMENTS = 2;
2078
- const UNSCOPED_SEGMENTS = 1;
2079
2125
  const MODULE_PREFIX = /^".*?"\./u;
2080
- const packageOf = (fileName) => {
2081
- const afterModules = pipe(fileName, String$1.lastIndexOf(NODE_MODULES_SEGMENT), Option.match({
2082
- onNone: () => fileName,
2083
- onSome: (index) => String$1.slice(index + NODE_MODULES_SEGMENT.length)(fileName)
2084
- }));
2085
- const segments = String$1.split("/")(afterModules);
2086
- if (String$1.startsWith(SCOPE_PREFIX)(afterModules)) return pipe(Array.take(segments, SCOPED_SEGMENTS), Array.join("/"));
2087
- return pipe(Array.take(segments, UNSCOPED_SEGMENTS), Array.join("/"));
2088
- };
2089
2126
  const externalDeclarationOf = (context) => (symbol) => Array.findFirst(declarationsOf(symbol), (declaration) => isExternalDeclaration(context.program)(declaration));
2090
- const aliasTarget = (context) => (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => externalDeclarationOf(context)(alias).pipe(Option.map((declaration) => `${String$1.replace(MODULE_PREFIX, "")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`))));
2127
+ const aliasTarget = (context) => (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => externalDeclarationOf(context)(alias).pipe(Option.map((declaration) => `${String$1.replace(MODULE_PREFIX, "")(context.checker.getFullyQualifiedName(alias))} from ${packageOf$1(declaration.getSourceFile().fileName)}`))));
2091
2128
  const isNamedContainer = (node) => isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);
2092
2129
  const slotTarget = (context) => (expression) => slotOf(context.checker)(expression).pipe(Option.filter((slot) => isExternalDeclaration(context.program)(slot)), Option.filter((slot) => Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot)))), Option.map((slot) => {
2093
2130
  const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))), Option.map((name) => ` of ${name.getText()}`), Option.getOrElse(() => ""));
2094
- return `${Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(Option.map((found) => found.getText()), Option.getOrElse(() => "value"))}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;
2131
+ return `${Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(Option.map((found) => found.getText()), Option.getOrElse(() => "value"))}${owner} from ${packageOf$1(slot.getSourceFile().fileName)}`;
2095
2132
  }));
2096
2133
  const libraryTargetOf = (context) => (expression, contextual) => aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));
2097
2134
  const siteWithin = (context) => (node) => Array.findFirst(context.sites, (site) => contains(node)(site.node));
@@ -2136,7 +2173,7 @@ const ownerValuesOf = (checker) => (declaration) => {
2136
2173
  const type = checker.getTypeAtLocation(declaration.name);
2137
2174
  return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
2138
2175
  };
2139
- const annotationProblem = (message) => problemAt$2({
2176
+ const annotationProblem = (message) => problemAt$4({
2140
2177
  rule: "owner-annotation",
2141
2178
  message
2142
2179
  });
@@ -2144,7 +2181,7 @@ const scanned = (owners, problems) => ({
2144
2181
  owners,
2145
2182
  problems
2146
2183
  });
2147
- const ownerOf = (project) => (annotated) => {
2184
+ const ownerOf$1 = (project) => (annotated) => {
2148
2185
  const { node, conceptId } = annotated;
2149
2186
  if (!isModuleConst(node)) return scanned([], [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)]);
2150
2187
  if (conceptId === "") return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);
@@ -2178,7 +2215,7 @@ const conflictProblems = (owners) => pipe(owners, Array.flatMap((owner, index) =
2178
2215
  return [...pipe(Array.take(sameConcept, FIRST_OWNER_COUNT), Array.map(() => ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner))), ...pipe(Array.take(sameSet, FIRST_OWNER_COUNT), Array.map((other) => ownerProblem(`The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`)(owner)))];
2179
2216
  }));
2180
2217
  const ownersIn = (project) => {
2181
- const results = pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(annotatedIn(sourceFile), Array.map((annotated) => ownerOf(project)(annotated)))));
2218
+ const results = pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(annotatedIn(sourceFile), Array.map((annotated) => ownerOf$1(project)(annotated)))));
2182
2219
  return scanned(pipe(results, Array.flatMap((result) => result.owners)), pipe(results, Array.flatMap((result) => result.problems)));
2183
2220
  };
2184
2221
  const combineOwnerScans = (scans) => {
@@ -2199,6 +2236,19 @@ const derivedDeclarationsOf = (checker) => (node) => {
2199
2236
  const scopes = Array.prepend(contractOf(node), node);
2200
2237
  return new Set(pipe(scopes, Array.flatMap((scope) => referencedSymbols(checker)(scope)), Array.flatMap((symbol) => declarationsOf(symbol)), Array.map((declaration) => declarationKey(locationOf(declaration)))));
2201
2238
  };
2239
+ // src/features/value-owners/model/property-match.ts
2240
+ const openTypeIdsOf = (checker) => ({
2241
+ any: checker.getAnyType().id,
2242
+ unknown: checker.getUnknownType().id
2243
+ });
2244
+ const sameProperty = ({ checker, open }) => (localType, library) => {
2245
+ const libraryType = checker.getTypeOfSymbol(library);
2246
+ return libraryType.id !== open.any && libraryType.id !== open.unknown && checker.isTypeAssignableTo(localType, libraryType) && checker.isTypeAssignableTo(libraryType, localType);
2247
+ };
2248
+ const declaredBy = (shape) => (library) => {
2249
+ const owner = packageOf$1(shape.declaration.file);
2250
+ return pipe(declarationsOf(library), Array.some((declaration) => packageOf$1(declaration.getSourceFile().fileName) === owner));
2251
+ };
2202
2252
  // src/features/value-owners/model/shapes.ts
2203
2253
  const MINIMUM_SHAPE_PROPERTIES = 3;
2204
2254
  const EXACT = 0;
@@ -2220,10 +2270,6 @@ const shapeSitesIn = (checker) => (sourceFile) => Array.getSomes(pipe(descendant
2220
2270
  node,
2221
2271
  type
2222
2272
  }))))));
2223
- const openTypeIdsOf = (checker) => ({
2224
- any: checker.getAnyType().id,
2225
- unknown: checker.getUnknownType().id
2226
- });
2227
2273
  const isIndexedDeclaration = (node) => isTypeDeclaration(node) || isVariableDeclaration(node);
2228
2274
  const declarationAt = (program) => (location) => Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(Option.flatMap((sourceFile) => Array.findFirst(descendantsOf(sourceFile), (node) => node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node))));
2229
2275
  const symbolOfDeclaration = (checker) => (declaration) => Option.fromUndefinedOr(checker.getSymbolAtLocation(declaration.name));
@@ -2238,13 +2284,12 @@ const hasEveryName = (locals) => (shape) => {
2238
2284
  const names = new Set(shape.propertyNames);
2239
2285
  return pipe(locals, Array.every((local) => names.has(local.name)));
2240
2286
  };
2241
- const sameProperty = (checker, open) => (localType, library) => {
2242
- const libraryType = checker.getTypeOfSymbol(library);
2243
- return libraryType.id !== open.any && libraryType.id !== open.unknown && checker.isTypeAssignableTo(localType, libraryType) && checker.isTypeAssignableTo(libraryType, localType);
2244
- };
2245
2287
  const matchOf = (context, open) => (locals, shape) => {
2246
2288
  const { checker } = context;
2247
- if (!shapeTypeOf(context)(shape).pipe(Option.exists((shapeType) => pipe(locals, Array.every((local) => Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(Option.exists((library) => sameProperty(checker, open)(local.type, library)))))))) return Option.none();
2289
+ if (!shapeTypeOf(context)(shape).pipe(Option.exists((shapeType) => pipe(locals, Array.every((local) => Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(Option.exists((library) => declaredBy(shape)(library) && sameProperty({
2290
+ checker,
2291
+ open
2292
+ })(local.type, library)))))))) return Option.none();
2248
2293
  return Option.some({
2249
2294
  shape,
2250
2295
  extra: shape.propertyNames.length - locals.length
@@ -2261,7 +2306,7 @@ const shapeProblem = (site, matches) => {
2261
2306
  onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
2262
2307
  onSome: () => "Use the library type instead of copying it."
2263
2308
  });
2264
- return problemAt$2({
2309
+ return problemAt$4({
2265
2310
  rule: "library-shape",
2266
2311
  message: `This shape copies ${shown}. ${advice}`
2267
2312
  })(site.node);
@@ -2355,7 +2400,7 @@ const derivedVerdict = (context) => (site) => {
2355
2400
  const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
2356
2401
  if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
2357
2402
  const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;
2358
- return verdict([problemAt$2({
2403
+ return verdict([problemAt$4({
2359
2404
  rule: "owner-extension",
2360
2405
  message
2361
2406
  })(site.node)], []);
@@ -2377,7 +2422,7 @@ const originalVerdict = (context) => (site) => {
2377
2422
  const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
2378
2423
  if (Array.isReadonlyArrayNonEmpty(owners)) {
2379
2424
  const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
2380
- return verdict([problemAt$2({
2425
+ return verdict([problemAt$4({
2381
2426
  rule: "owner-value-set",
2382
2427
  message
2383
2428
  })(site.node)], []);
@@ -2385,7 +2430,7 @@ const originalVerdict = (context) => (site) => {
2385
2430
  const candidates = libraryCandidates(context)(site);
2386
2431
  if (Array.isReadonlyArrayNonEmpty(candidates)) {
2387
2432
  const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
2388
- return verdict([problemAt$2({
2433
+ return verdict([problemAt$4({
2389
2434
  rule: "library-value-set",
2390
2435
  message
2391
2436
  })(site.node)], []);
@@ -2416,7 +2461,7 @@ const isValuePosition = (node) => {
2416
2461
  const { parent } = node;
2417
2462
  return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
2418
2463
  };
2419
- const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$2({
2464
+ const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$4({
2420
2465
  rule: "owned-literal",
2421
2466
  message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
2422
2467
  })(literal)));
@@ -2690,13 +2735,13 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
2690
2735
  /** @internal */
2691
2736
  const checkSources = (root) => checkRepository(root, [passThroughWrappersIn]);
2692
2737
  // src/features/agent-settings/model/missing-hooks.ts
2693
- const RULE$12 = "missing-hook";
2738
+ const RULE$13 = "missing-hook";
2694
2739
  const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
2695
2740
  const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
2696
2741
  const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
2697
2742
  const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
2698
2743
  const PLUGIN_ROOT = "..";
2699
- const READ_CONCURRENCY$7 = 16;
2744
+ const READ_CONCURRENCY$6 = 16;
2700
2745
  const START$10 = 0;
2701
2746
  const referenceOf = (found) => pipe(groupOf$1("path")(found), Option.filter(() => Option.isNone(groupOf$1("optional")(found))), Option.map((path) => ({
2702
2747
  path,
@@ -2715,7 +2760,7 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
2715
2760
  return pipe(missing, Array.map(({ path, index }) => ({
2716
2761
  file,
2717
2762
  ...positionOf(source)(index),
2718
- rule: RULE$12,
2763
+ rule: RULE$13,
2719
2764
  message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
2720
2765
  })));
2721
2766
  });
@@ -2739,7 +2784,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
2739
2784
  }];
2740
2785
  return [];
2741
2786
  }));
2742
- const found = yield* Effect.forEach(hookFiles, problemsIn$5, { concurrency: READ_CONCURRENCY$7 });
2787
+ const found = yield* Effect.forEach(hookFiles, problemsIn$5, { concurrency: READ_CONCURRENCY$6 });
2743
2788
  return Array.flatten(found);
2744
2789
  });
2745
2790
  // src/features/scripts/model/shell-scripts.ts
@@ -2747,9 +2792,9 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
2747
2792
  const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
2748
2793
  const EXTENSION = /\.[^./]+$/u;
2749
2794
  const SETTINGS_FILE = ".claude/settings.json";
2750
- const READ_CONCURRENCY$6 = 64;
2795
+ const READ_CONCURRENCY$5 = 64;
2751
2796
  const FIRST$3 = 1;
2752
- const RULE$11 = "shell-script";
2797
+ const RULE$12 = "shell-script";
2753
2798
  const MESSAGE$4 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
2754
2799
  const HookSchema = Schema.Struct({
2755
2800
  command: Schema.optional(Schema.String),
@@ -2772,7 +2817,7 @@ const problemFor$1 = (file) => ({
2772
2817
  file,
2773
2818
  line: FIRST$3,
2774
2819
  column: FIRST$3,
2775
- rule: RULE$11,
2820
+ rule: RULE$12,
2776
2821
  message: MESSAGE$4
2777
2822
  });
2778
2823
  /** @internal */
@@ -2789,12 +2834,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
2789
2834
  return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
2790
2835
  };
2791
2836
  const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
2792
- const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$6 });
2837
+ const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$5 });
2793
2838
  return pipe(shell, Array.map((name) => problemFor$1(files.join(root, name))));
2794
2839
  });
2795
2840
  // src/shared/lib/workflow-files.ts
2796
2841
  const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
2797
- const READ_CONCURRENCY$5 = 16;
2842
+ const READ_CONCURRENCY$4 = 16;
2798
2843
  const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
2799
2844
  const files = yield* RepositoryFiles;
2800
2845
  const names = yield* files.listedFiles(root);
@@ -2804,7 +2849,7 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
2804
2849
  file,
2805
2850
  source
2806
2851
  }))));
2807
- }, { concurrency: READ_CONCURRENCY$5 });
2852
+ }, { concurrency: READ_CONCURRENCY$4 });
2808
2853
  return Array.getSomes(found);
2809
2854
  });
2810
2855
  // src/shared/lib/workflow-run.ts
@@ -2825,7 +2870,7 @@ const runScriptsOf = (source) => {
2825
2870
  const COMMAND_CHAIN = /&&|\|\||;|\|/u;
2826
2871
  const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
2827
2872
  const COMMENT = "#";
2828
- const RULE$10 = "workflow-script";
2873
+ const RULE$11 = "workflow-script";
2829
2874
  const ONE_COMMAND = 1;
2830
2875
  const MESSAGE$3 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
2831
2876
  const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
@@ -2839,7 +2884,7 @@ const problemsIn$4 = (file) => (source) => {
2839
2884
  return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
2840
2885
  file,
2841
2886
  ...at(start),
2842
- rule: RULE$10,
2887
+ rule: RULE$11,
2843
2888
  message: MESSAGE$3
2844
2889
  })));
2845
2890
  };
@@ -2857,12 +2902,12 @@ const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
2857
2902
  // src/features/vite-plus/model/command-words.ts
2858
2903
  const CONTINUATION = /\\\n/gu;
2859
2904
  const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
2860
- const SEPARATOR$2 = /&&|\|\||[;|\n`]|\$\(/u;
2905
+ const SEPARATOR$3 = /&&|\|\||[;|\n`]|\$\(/u;
2861
2906
  const BLANK$1 = /\s+/u;
2862
2907
  const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
2863
2908
  const QUOTE = "\"\"";
2864
2909
  const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
2865
- const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$2), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
2910
+ const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$3), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
2866
2911
  // src/features/vite-plus/model/command-problems.ts
2867
2912
  const PACKAGE_MANAGERS = [
2868
2913
  "pnpm",
@@ -2924,7 +2969,7 @@ const STEP_FILES = [
2924
2969
  ];
2925
2970
  const HOOK_FILES = [":(glob).vite-hooks/*"];
2926
2971
  const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
2927
- const READ_CONCURRENCY$4 = 16;
2972
+ const READ_CONCURRENCY$3 = 16;
2928
2973
  const START$8 = 0;
2929
2974
  const FIRST$2 = 1;
2930
2975
  const LINE = "\n";
@@ -2995,7 +3040,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
2995
3040
  return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
2996
3041
  });
2997
3042
  const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
2998
- const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$4 });
3043
+ const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$3 });
2999
3044
  return Array.flatten(found);
3000
3045
  });
3001
3046
  const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
@@ -3007,7 +3052,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
3007
3052
  onSome: sourcesOf(file, name)
3008
3053
  });
3009
3054
  return files.readFile(file).pipe(Effect.map(sourcesIn));
3010
- }, { concurrency: READ_CONCURRENCY$4 });
3055
+ }, { concurrency: READ_CONCURRENCY$3 });
3011
3056
  return Array.flatten(found);
3012
3057
  });
3013
3058
  /** @internal */
@@ -3029,7 +3074,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
3029
3074
  return Array.flatten(found);
3030
3075
  });
3031
3076
  // src/features/vite-plus/model/package-scripts.ts
3032
- const RULE$9 = "package-script";
3077
+ const RULE$10 = "package-script";
3033
3078
  const LIFECYCLE = [
3034
3079
  "preinstall",
3035
3080
  "install",
@@ -3052,12 +3097,12 @@ const LIFECYCLE = [
3052
3097
  const problemOf$3 = ({ file, position, name }) => ({
3053
3098
  file,
3054
3099
  ...position,
3055
- rule: RULE$9,
3100
+ rule: RULE$10,
3056
3101
  message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
3057
3102
  });
3058
3103
  const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
3059
3104
  // src/features/vite-plus/model/vite-plus-block.ts
3060
- const RULE$8 = "vite-plus-block";
3105
+ const RULE$9 = "vite-plus-block";
3061
3106
  const MARKER = Array.join([
3062
3107
  "<!--",
3063
3108
  "VITE PLUS START",
@@ -3070,7 +3115,7 @@ const problemIn$1 = (file) => (source) => {
3070
3115
  return Option.some({
3071
3116
  file,
3072
3117
  ...positionOf(source)(index.value),
3073
- rule: RULE$8,
3118
+ rule: RULE$9,
3074
3119
  message: MESSAGE$2
3075
3120
  });
3076
3121
  };
@@ -3089,7 +3134,7 @@ const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
3089
3134
  // src/features/workflow-concurrency/model/workflow-queue.ts
3090
3135
  const CONCURRENCY_KEY = "concurrency";
3091
3136
  const QUEUE_KEY = "queue";
3092
- const RULE$7 = "workflow-queue";
3137
+ const RULE$8 = "workflow-queue";
3093
3138
  const MESSAGE$1 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
3094
3139
  const queueKeyOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMap((map) => Array.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === QUEUE_KEY)), Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)), Option.flatMap((key) => Option.fromNullishOr(key.range)), Option.map(([start]) => start));
3095
3140
  const queueOffsetsOf = (source) => {
@@ -3110,7 +3155,7 @@ const checkWorkflowQueues = Effect.fn("checkWorkflowQueues")(function* checkWork
3110
3155
  file,
3111
3156
  line,
3112
3157
  column,
3113
- rule: RULE$7,
3158
+ rule: RULE$8,
3114
3159
  message: MESSAGE$1
3115
3160
  };
3116
3161
  }));
@@ -3127,36 +3172,6 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
3127
3172
  ], { concurrency: "unbounded" });
3128
3173
  return Array.flatten(found);
3129
3174
  });
3130
- // src/shared/lib/scanned-files.ts
3131
- const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
3132
- const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
3133
- const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
3134
- const READ_CONCURRENCY$3 = 64;
3135
- const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
3136
- const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
3137
- /** @internal */
3138
- const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
3139
- const files = yield* RepositoryFiles;
3140
- const names = yield* files.listedFiles(root);
3141
- return pipe(names, Array.map((name) => ({
3142
- name,
3143
- file: files.join(root, name)
3144
- })));
3145
- });
3146
- /** @internal */
3147
- const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
3148
- const files = yield* RepositoryFiles;
3149
- return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
3150
- });
3151
- /** @internal */
3152
- const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
3153
- const files = yield* RepositoryFiles;
3154
- const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
3155
- onNone: () => [],
3156
- onSome: (source) => problemsIn(entry, source)
3157
- }))), { concurrency: READ_CONCURRENCY$3 });
3158
- return Array.flatten(found);
3159
- });
3160
3175
  // src/features/banned-tools/model/banned-tool.ts
3161
3176
  const FIRST_LINE$2 = 1;
3162
3177
  const FIRST_COLUMN$2 = 1;
@@ -3422,7 +3437,7 @@ const commentsWith = (grammars) => (reader, source) => {
3422
3437
  }[reader](source);
3423
3438
  };
3424
3439
  // src/features/comments/model/comments.ts
3425
- const RULE$6 = "comment";
3440
+ const RULE$7 = "comment";
3426
3441
  const CONFIG_FILE = "vite.config.ts";
3427
3442
  const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
3428
3443
  const READ_CONCURRENCY$2 = 64;
@@ -3492,14 +3507,14 @@ const isAllowed = (source, directives) => (comment) => isShebang(comment) || dir
3492
3507
  const problemOf$2 = (file, source) => ({ index }) => ({
3493
3508
  file,
3494
3509
  ...positionOf(source)(index),
3495
- rule: RULE$6,
3510
+ rule: RULE$7,
3496
3511
  message: MESSAGE
3497
3512
  });
3498
3513
  const unreadableProblem = (file, message) => ({
3499
3514
  file,
3500
3515
  line: FIRST_LINE$1,
3501
3516
  column: FIRST_COLUMN$1,
3502
- rule: RULE$6,
3517
+ rule: RULE$7,
3503
3518
  message: `msch could not read the comments in this file: ${message}`
3504
3519
  });
3505
3520
  const settingsOf = ({ msch, lint }) => ({
@@ -3564,14 +3579,14 @@ const START$5 = 0;
3564
3579
  const HEX = 16;
3565
3580
  const CODE_POINT_WIDTH = 4;
3566
3581
  const READ_CONCURRENCY$1 = 64;
3567
- const RULE$5 = "hidden-unicode";
3582
+ const RULE$6 = "hidden-unicode";
3568
3583
  const hexOf = (character) => pipe(String$1.codePointAt(START$5)(character), Option.getOrElse(() => START$5), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
3569
3584
  const problemOf$1 = (file, source) => (found) => {
3570
3585
  const hex = hexOf(found[START$5]);
3571
3586
  return {
3572
3587
  file,
3573
3588
  ...positionOf(source)(found.index ?? START$5),
3574
- rule: RULE$5,
3589
+ rule: RULE$6,
3575
3590
  message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
3576
3591
  };
3577
3592
  };
@@ -3593,7 +3608,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
3593
3608
  return Array.flatten(found);
3594
3609
  });
3595
3610
  // src/features/runtime-version/model/node-version.ts
3596
- const RULE$4 = "node-version";
3611
+ const RULE$5 = "node-version";
3597
3612
  const MINIMUM = 26;
3598
3613
  const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
3599
3614
  const MANIFEST = /(?:^|\/)package\.json$/u;
@@ -3624,19 +3639,19 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
3624
3639
  onSome: isOld
3625
3640
  }));
3626
3641
  const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
3627
- const problemAt = ({ entry, source, index }, message) => ({
3642
+ const problemAt$1 = ({ entry, source, index }, message) => ({
3628
3643
  file: entry.file,
3629
3644
  ...positionOf(source)(index),
3630
- rule: RULE$4,
3645
+ rule: RULE$5,
3631
3646
  message
3632
3647
  });
3633
3648
  const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$4));
3634
- const unstatedProblem = (entry, source) => problemAt({
3649
+ const unstatedProblem = (entry, source) => problemAt$1({
3635
3650
  entry,
3636
3651
  source,
3637
3652
  index: START$4
3638
3653
  }, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
3639
- const rangeProblem = (entry, source) => (range) => problemAt({
3654
+ const rangeProblem = (entry, source) => (range) => problemAt$1({
3640
3655
  entry,
3641
3656
  source,
3642
3657
  index: offsetOf$1(source, ENGINES_KEY)
@@ -3650,12 +3665,12 @@ const manifestProblems = (entry, source) => {
3650
3665
  if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
3651
3666
  return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
3652
3667
  };
3653
- const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
3668
+ const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt$1({
3654
3669
  entry,
3655
3670
  source,
3656
3671
  index: found.index ?? START$4
3657
3672
  }, `${SUPPORTED} \`${String$1.trim(found[START$4])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
3658
- const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
3673
+ const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$1({
3659
3674
  entry,
3660
3675
  source,
3661
3676
  index: START$4
@@ -3680,7 +3695,7 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
3680
3695
  return yield* scanText(sources, problemsIn$2);
3681
3696
  });
3682
3697
  // src/features/skills/model/skill-entry.ts
3683
- const RULE$3 = "unlocked-skill";
3698
+ const RULE$4 = "unlocked-skill";
3684
3699
  const LOCK_FILE = "skills-lock.json";
3685
3700
  const SOURCE = "masseater/skills";
3686
3701
  const ENTRY = "masseater-ecosystem";
@@ -3694,7 +3709,7 @@ const fixFor = (name) => `Run "vp exec skills add ${SOURCE} -s ${name} -y". The
3694
3709
  const problemIn = ({ file, source }) => (anchor, message) => ({
3695
3710
  file,
3696
3711
  ...positionOf(source)(pipe(String$1.indexOf(anchor)(source), Option.getOrElse(() => START$3))),
3697
- rule: RULE$3,
3712
+ rule: RULE$4,
3698
3713
  message
3699
3714
  });
3700
3715
  const lockedSkills = Effect.fn("lockedSkills")(function* lockedSkills(root) {
@@ -3719,7 +3734,7 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
3719
3734
  return pipe(entry, Option.map(namedIn), Option.getOrElse(() => []), Array.filter((name) => !Array.contains(names, name)), Array.map((name) => problemAt(`"${ENTRY}"`, `${ENTRY} tells agents to read ${name}, which this file does not install. ${fixFor(name)}`)));
3720
3735
  });
3721
3736
  // src/features/skills/model/skill-files.ts
3722
- const RULE$2 = "skill-file";
3737
+ const RULE$3 = "skill-file";
3723
3738
  const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
3724
3739
  const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
3725
3740
  const MARKDOWN = ".md";
@@ -3735,7 +3750,7 @@ const FRAGMENT = /#.*$/u;
3735
3750
  const GITHUB = "https://github.com/";
3736
3751
  const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
3737
3752
  const BLANK = /\s+/u;
3738
- const SEPARATOR$1 = "/";
3753
+ const SEPARATOR$2 = "/";
3739
3754
  const START$2 = 0;
3740
3755
  const FIRST$1 = 1;
3741
3756
  const READ_CONCURRENCY = 16;
@@ -3776,7 +3791,7 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
3776
3791
  ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
3777
3792
  file: skill.file,
3778
3793
  ...positionOf(skill.source)(index),
3779
- rule: RULE$2,
3794
+ rule: RULE$3,
3780
3795
  message
3781
3796
  })));
3782
3797
  const linkOf = (found) => pipe(groupOf$1("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
@@ -3803,7 +3818,7 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
3803
3818
  return pipe(missing, Array.map(({ target, index }) => ({
3804
3819
  file,
3805
3820
  ...positionOf(source)(index),
3806
- rule: RULE$2,
3821
+ rule: RULE$3,
3807
3822
  message: `links to ${target}, which does not exist. Fix the path or remove the link.`
3808
3823
  })));
3809
3824
  });
@@ -3811,7 +3826,7 @@ const problemsIn$1 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
3811
3826
  const files = yield* RepositoryFiles;
3812
3827
  const file = files.join(root, name);
3813
3828
  const directory = files.dirname(name);
3814
- const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$1}`)));
3829
+ const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
3815
3830
  const text = yield* files.readFile(file);
3816
3831
  const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
3817
3832
  const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY });
@@ -3819,7 +3834,7 @@ const problemsIn$1 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
3819
3834
  file: files.join(root, entry),
3820
3835
  line: FIRST$1,
3821
3836
  column: FIRST$1,
3822
- rule: RULE$2,
3837
+ rule: RULE$3,
3823
3838
  message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
3824
3839
  })));
3825
3840
  return [
@@ -3840,8 +3855,8 @@ const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(r
3840
3855
  return Array.flatten(found);
3841
3856
  });
3842
3857
  // src/features/unneeded-files/model/alchemy-patch.ts
3843
- const RULE$1 = "alchemy-patch";
3844
- const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
3858
+ const RULE$2 = "alchemy-patch";
3859
+ const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
3845
3860
  const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
3846
3861
  const START$1 = 0;
3847
3862
  const WorkspaceFile$1 = Schema.Struct({ patchedDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)) });
@@ -3850,7 +3865,7 @@ const patchedIn = (source) => pipe(decodeWorkspaceFile$1(parse$1(source)), Optio
3850
3865
  const problemOf = (file, position, name) => ({
3851
3866
  file,
3852
3867
  ...position,
3853
- rule: RULE$1,
3868
+ rule: RULE$2,
3854
3869
  message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
3855
3870
  });
3856
3871
  const problemsIn = (file) => (source) => {
@@ -3861,10 +3876,112 @@ const problemsIn = (file) => (source) => {
3861
3876
  /** @internal */
3862
3877
  const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyPatch(root) {
3863
3878
  const files = yield* RepositoryFiles;
3864
- const file = files.join(root, WORKSPACE_FILE$1);
3879
+ const file = files.join(root, WORKSPACE_FILE$2);
3865
3880
  const text = yield* files.readFile(file);
3866
3881
  return pipe(text, Option.map(problemsIn(file)), Option.getOrElse(() => []));
3867
3882
  });
3883
+ // src/features/unneeded-files/model/applied-packages.ts
3884
+ const MSCH = "@r_masseater/msch";
3885
+ const SCOPE = "@r_masseater/";
3886
+ const RULE$1 = "applied-package";
3887
+ const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
3888
+ const NOT_FOUND = -1;
3889
+ const SEPARATOR$1 = "/";
3890
+ const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
3891
+ const BinMap = Schema.Record(Schema.String, Schema.String);
3892
+ const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
3893
+ const decodeBinField = Schema.decodeUnknownOption(Schema.fromJsonString(BinField));
3894
+ const escaped = (text) => String$1.replaceAll(/[.*+?^${}()|[\]\\]/gu, String.raw`\$&`)(text);
3895
+ const declaredNames = (manifest) => pipe([
3896
+ manifest.dependencies,
3897
+ manifest.devDependencies,
3898
+ manifest.peerDependencies
3899
+ ], Array.flatMap((field) => Record.keys(field ?? {})));
3900
+ const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
3901
+ onNone: () => [],
3902
+ onSome: (bin) => {
3903
+ if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
3904
+ return Record.keys(bin);
3905
+ }
3906
+ }));
3907
+ const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE}`)));
3908
+ const installedPackage = Effect.fn("installedPackage")(function* installedPackage(name) {
3909
+ const files = yield* RepositoryFiles;
3910
+ const text = yield* pipe(manifestOf(name), Option.match({
3911
+ onNone: () => Effect.succeed(Option.none()),
3912
+ onSome: (file) => files.readFile(file)
3913
+ }));
3914
+ return {
3915
+ name,
3916
+ bins: pipe(text, Option.map((source) => binsIn(name, source)), Option.getOrElse(() => []))
3917
+ };
3918
+ });
3919
+ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
3920
+ const files = yield* RepositoryFiles;
3921
+ const manifest = yield* pipe(manifestOf(MSCH), Option.match({
3922
+ onNone: () => Effect.succeed(Option.none()),
3923
+ onSome: (file) => readManifest(files.dirname(file))
3924
+ }));
3925
+ const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE)));
3926
+ return yield* pipe(names, Effect.forEach(installedPackage));
3927
+ });
3928
+ const problemAt = (file, source) => (index, name) => ({
3929
+ file,
3930
+ ...positionOf(source)(index),
3931
+ rule: RULE$1,
3932
+ message: `msch applies ${name}. Remove this use and let msch apply it.`
3933
+ });
3934
+ const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
3935
+ const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
3936
+ const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt(file, source)(found.index ?? NOT_FOUND, entry.name)))));
3937
+ const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
3938
+ onEmpty: () => "",
3939
+ onNonEmpty: Array.max(BY_LENGTH)
3940
+ }));
3941
+ const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$1;
3942
+ const consumersIn = Effect.fn("consumersIn")(function* consumersIn(root, directories) {
3943
+ const files = yield* RepositoryFiles;
3944
+ return yield* pipe(directories, Effect.filter((directory) => readManifest(files.join(root, directory)).pipe(Effect.map(Option.exists((manifest) => manifest.name !== MSCH && Array.contains(declaredNames(manifest), MSCH))))));
3945
+ });
3946
+ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appliedNames, directory) {
3947
+ const files = yield* RepositoryFiles;
3948
+ const file = files.join(root, directory, MANIFEST_FILE);
3949
+ const text = yield* files.readFile(file);
3950
+ const manifest = yield* readManifest(files.join(root, directory));
3951
+ return pipe(Option.all({
3952
+ source: text,
3953
+ declared: manifest
3954
+ }), Option.match({
3955
+ onNone: () => [],
3956
+ onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt(file, source)(index, name)), Option.toArray)))
3957
+ }));
3958
+ });
3959
+ const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
3960
+ const owner = ownerOf(directories);
3961
+ const listed = yield* listedFiles(root);
3962
+ const sources = pipe(listed, Array.filter((entry) => isScannedSource(entry) && Array.contains(consumers, owner(entry.name))));
3963
+ return yield* scanText(sources, usesIn(applied));
3964
+ });
3965
+ /** @internal */
3966
+ const appliedPackageProblems = Effect.fn("appliedPackageProblems")(function* appliedPackageProblems(root, applied) {
3967
+ if (!Array.isReadonlyArrayNonEmpty(applied)) return [];
3968
+ const directories = ["", ...yield* workspaceDirectories(root)];
3969
+ const consumers = yield* consumersIn(root, directories);
3970
+ const appliedNames = pipe(applied, Array.map(({ name }) => name));
3971
+ const manifestProblems = yield* pipe(consumers, Effect.forEach((directory) => manifestUses(root, appliedNames, directory)));
3972
+ const sourceProblems = yield* sourceUses({
3973
+ root,
3974
+ applied,
3975
+ directories,
3976
+ consumers
3977
+ });
3978
+ return [...Array.flatten(manifestProblems), ...sourceProblems];
3979
+ });
3980
+ /** @internal */
3981
+ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAppliedPackages(root) {
3982
+ const applied = yield* appliedByMsch();
3983
+ return yield* appliedPackageProblems(root, applied);
3984
+ });
3868
3985
  // src/features/unneeded-files/model/replaced-tools.ts
3869
3986
  const RULE = "replaced-tool";
3870
3987
  const FIRST = 1;
@@ -4090,7 +4207,9 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
4090
4207
  checkNodeVersion(root),
4091
4208
  checkSkillFiles(root),
4092
4209
  checkSkillEntry(root),
4093
- checkComments(root)
4210
+ checkComments(root),
4211
+ checkAppliedPackages(root),
4212
+ checkGitSubpath(root)
4094
4213
  ], { concurrency: "unbounded" });
4095
4214
  return Array.flatten(found);
4096
4215
  });
@@ -4131,25 +4250,46 @@ const runCli = (program) => {
4131
4250
  };
4132
4251
  // bin/msch.ts
4133
4252
  const NO_PROBLEMS = 0;
4134
- const reportText = (root, problems) => Effect.gen(function* report() {
4253
+ const ONE_FAILURE = 1;
4254
+ const NO_CONFIG = "config-missing";
4255
+ const writeProblems = (root, problems) => Effect.gen(function* report() {
4135
4256
  const files = yield* RepositoryFiles;
4136
4257
  const format = formatProblem((file) => files.relative(root, file));
4137
4258
  yield* writeStdout(pipe(problems, Array.map((problem) => `${format(problem)}\n`), Array.join("")));
4138
- if (problems.length > NO_PROBLEMS) return yield* ProblemsFound.make({ count: problems.length });
4139
- return yield* Effect.void;
4259
+ });
4260
+ const writeStderr = Effect.fn("writeStderr")(function* writeStderr(text) {
4261
+ const stdio = yield* Stdio.Stdio;
4262
+ yield* Stream.make(text).pipe(Stream.run(stdio.stderr()), Effect.orDie);
4263
+ });
4264
+ const failuresOf = (args, kind, message) => {
4265
+ if (Array.isReadonlyArrayEmpty(args) && kind === NO_CONFIG) return Effect.succeed(NO_PROBLEMS);
4266
+ return writeStderr(`${message}\n`).pipe(Effect.as(ONE_FAILURE));
4267
+ };
4268
+ const toolChecks = (root, args) => runVpa(root, args).pipe(Effect.as(NO_PROBLEMS), Effect.catchIf(Schema.is(VpToolsError), (failure) => failuresOf(args, failure.kind, failure.message)));
4269
+ const failWhenAny = (count) => {
4270
+ if (count > NO_PROBLEMS) return Effect.fail(ProblemsFound.make({ count }));
4271
+ return Effect.void;
4272
+ };
4273
+ const writeJson = Effect.fn("writeJson")(function* writeJson(root) {
4274
+ const found = yield* checkAll(root);
4275
+ const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(sortProblems(found));
4276
+ return yield* writeStdout(text);
4277
+ });
4278
+ const checkEverything = Effect.fn("checkEverything")(function* checkEverything(root) {
4279
+ const found = yield* checkAll(root);
4280
+ const problems = sortProblems(found);
4281
+ yield* writeProblems(root, problems);
4282
+ const toolFailures = yield* toolChecks(root, []);
4283
+ return yield* failWhenAny(problems.length + toolFailures);
4140
4284
  });
4141
4285
  runCli(Effect.gen(function* msch() {
4142
4286
  const stdio = yield* Stdio.Stdio;
4143
4287
  const files = yield* RepositoryFiles;
4144
4288
  const args = yield* stdio.args;
4145
4289
  const root = files.resolve(".");
4146
- const found = yield* checkAll(root);
4147
- const problems = sortProblems(found);
4148
- if (args.includes("--json")) {
4149
- const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);
4150
- return yield* writeStdout(text);
4151
- }
4152
- return yield* reportText(root, problems);
4290
+ if (args.includes("--json")) return yield* writeJson(root);
4291
+ if (Array.isReadonlyArrayNonEmpty(args)) return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));
4292
+ return yield* checkEverything(root);
4153
4293
  }));
4154
4294
  export {};
4155
4295