@r_masseater/msch 0.26.0 → 0.28.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,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { A as publicEntriesOf, C as nestedValues, M as dependencyEntries, N as readManifest, O as publishedWorkspaces, P as workspaceDependencies, S as literalOf, T as stringsIn, a as workspaceDirectories, b as childrenOf$2, c as RUN_TASKS, d as hasVerifyTask, j as MANIFEST_FILE, k as EntryManifestJson, l as VERIFY_TASK, n as patternOf, o as runTasksOf, t as namedWorkspaces, u as definesTask, v as workspaceConfigOf, w as propertyValue, x as keyName, y as KeySchema } from "./workspace-g6vKzUNI.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$5, 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-BscmWo5N.mjs";
2
+ import { A as EntryManifestJson, C as literalOf, E as stringsIn, F as workspaceDependencies, M as MANIFEST_FILE, N as dependencyEntries, P as readManifest, S as keyName, T as propertyValue, b as KeySchema, d as definesTask, f as hasVerifyTask, j as publicEntriesOf, k as publishedWorkspaces, l as RUN_TASKS, n as namedWorkspaces, o as workspaceDirectories, r as patternOf, s as runTasksOf, t as deployEntries, u as VERIFY_TASK, w as nestedValues, x as childrenOf$2, y as workspaceConfigOf } from "./workspace-DuBjvDMC.mjs";
3
+ import { $ as isPropertyAccessExpression, A as getLeadingCommentRanges, B as isEnumDeclaration, C as uniqueByReference, D as SignatureKind, E as InternalSymbolName, F as isBinaryExpression, G as isImportDeclaration, H as isFunctionDeclaration, I as isBlock, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isCallExpression, M as getTextOfJSDocComment, N as isArrayLiteralExpression, O as SyntaxKind, P as isArrowFunction, Q as isParenthesizedExpression, R as isClassDeclaration, S as symbolAt, T as IndexKind, U as isFunctionExpression, V as isExportDeclaration, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as lineOf, a as problemAt$6, at as isSpreadElement, b as referencedSymbols, c as columnOf, ct as isTypeLiteralNode, d as descendantsOf, dt as isVariableDeclaration, et as isPropertyAssignment, f as importedModulesOf, ft as isVariableDeclarationList, g as isTypeDeclaration, h as isInsideAny, i as formatProblem, it as isSourceFile, j as getNameOfDeclaration, k as getJSDocTags, l as contains, lt as isTypeReferenceNode, m as isGenericDeclaration, n as ProblemList, nt as isSatisfiesExpression, o as sortProblems, ot as isStringLiteral, p as isExternalDeclaration, pt as isVariableStatement, q as isModuleBlock, rt as isSignatureDeclaration, s as childrenOf$3, st as isTypeAliasDeclaration, tt as isReturnStatement, u as declarationsOf, ut as isUnionTypeNode, v as packageOf$1, w as API, x as resolvedSymbol, y as propertyNamesOf, z as isElementAccessExpression } from "./cli-contract-kyLbx4PX.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
6
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
@@ -317,7 +317,7 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
317
317
  return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
318
318
  });
319
319
  // src/entities/project/model/inputs.ts
320
- const SEPARATOR$16 = "/";
320
+ const SEPARATOR$18 = "/";
321
321
  const SCOPE_PREFIX$1 = "@";
322
322
  const HIDDEN_PREFIX = ".";
323
323
  const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
@@ -359,14 +359,14 @@ const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath)
359
359
  const directories = yield* workspaceClosure(directory);
360
360
  return {
361
361
  directories,
362
- prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$16}`))
362
+ prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$18}`))
363
363
  };
364
364
  });
365
365
  const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
366
366
  const files = yield* RepositoryFiles;
367
367
  if (!String$1.startsWith(SCOPE_PREFIX$1)(name)) return [name];
368
368
  const scoped = yield* files.readDirectory(files.join(modules, name));
369
- return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$16}${entry}`));
369
+ return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$18}${entry}`));
370
370
  });
371
371
  const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
372
372
  const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
@@ -416,7 +416,7 @@ const RELATIVE$1 = /^\.\.?(?:\/|$)/u;
416
416
  const SUBPATH_IMPORT = "#";
417
417
  const WILDCARD$2 = "*";
418
418
  const SCOPE$1 = "@";
419
- const SEPARATOR$15 = "/";
419
+ const SEPARATOR$17 = "/";
420
420
  const SOURCE_SUFFIXES = [
421
421
  "",
422
422
  ".ts",
@@ -428,9 +428,9 @@ const PLAIN_SEGMENTS = 1;
428
428
  const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
429
429
  const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
430
430
  const packageNameOf = (specifier) => {
431
- const segments = String$1.split(specifier, SEPARATOR$15);
432
- if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$15));
433
- return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$15));
431
+ const segments = String$1.split(specifier, SEPARATOR$17);
432
+ if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$17));
433
+ return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$17));
434
434
  };
435
435
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
436
436
  const runtimeSpecifierOf = (statement) => {
@@ -525,7 +525,7 @@ const InstalledManifest = Schema.Struct({
525
525
  peerDependencies: DependencyMap,
526
526
  peerDependenciesMeta: PeerMeta
527
527
  });
528
- const decodeManifest$3 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
528
+ const decodeManifest$5 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
529
529
  const keysOf$2 = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
530
530
  const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
531
531
  const installedNames = (manifest) => [
@@ -536,7 +536,7 @@ const installedNames = (manifest) => [
536
536
  const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
537
537
  const files = yield* RepositoryFiles;
538
538
  const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));
539
- return pipe(text, Option.flatMap(decodeManifest$3), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
539
+ return pipe(text, Option.flatMap(decodeManifest$5), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
540
540
  });
541
541
  const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
542
542
  const files = yield* RepositoryFiles;
@@ -1008,7 +1008,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
1008
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
1009
  const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
1010
1010
  const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
1011
- const READ_CONCURRENCY$19 = 64;
1011
+ const READ_CONCURRENCY$20 = 64;
1012
1012
  const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
1013
1013
  const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
1014
1014
  /** @internal */
@@ -1031,45 +1031,45 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
1031
1031
  const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
1032
1032
  onNone: () => [],
1033
1033
  onSome: (source) => problemsIn(entry, source)
1034
- }))), { concurrency: READ_CONCURRENCY$19 });
1034
+ }))), { concurrency: READ_CONCURRENCY$20 });
1035
1035
  return Array.flatten(found);
1036
1036
  });
1037
1037
  // src/features/overrides/model/git-subpath.ts
1038
1038
  const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
1039
1039
  const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
1040
- const RULE$28 = "git-subpath-dependency";
1040
+ const RULE$30 = "git-subpath-dependency";
1041
1041
  const WHOLE_MATCH$3 = 0;
1042
- const problemAt$4 = ({ file }, source) => (found) => ({
1042
+ const problemAt$5 = ({ file }, source) => (found) => ({
1043
1043
  file,
1044
1044
  ...positionOf(source)(found.index ?? WHOLE_MATCH$3),
1045
- rule: RULE$28,
1045
+ rule: RULE$30,
1046
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$3])}\`.`
1047
1047
  });
1048
- const problemsIn$12 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$4(entry, source)));
1048
+ const problemsIn$13 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$5(entry, source)));
1049
1049
  const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
1050
1050
  /** @internal */
1051
1051
  const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
1052
1052
  const listed = yield* listedFiles(root);
1053
- return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$12);
1053
+ return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$13);
1054
1054
  });
1055
1055
  // src/features/overrides/model/restricted-rules.ts
1056
- const RULE$27 = "unnamed-restriction";
1056
+ const RULE$29 = "unnamed-restriction";
1057
1057
  const WHOLE_MATCH$2 = 0;
1058
1058
  const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
1059
- const problemsIn$11 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
1059
+ const problemsIn$12 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
1060
1060
  file: entry.file,
1061
1061
  ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
1062
- rule: RULE$27,
1062
+ rule: RULE$29,
1063
1063
  message: `${found[WHOLE_MATCH$2]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
1064
1064
  })));
1065
1065
  /** @internal */
1066
1066
  const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
1067
1067
  const listed = yield* listedFiles(root);
1068
- return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$11);
1068
+ return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$12);
1069
1069
  });
1070
1070
  // src/shared/lib/agent-docs.ts
1071
1071
  const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
1072
- const READ_CONCURRENCY$18 = 16;
1072
+ const READ_CONCURRENCY$19 = 16;
1073
1073
  const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
1074
1074
  const files = yield* RepositoryFiles;
1075
1075
  const listed = yield* files.listedFiles(root);
@@ -1078,35 +1078,35 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
1078
1078
  const file = files.join(root, name);
1079
1079
  const problemOf = Option.flatMap(problemIn(file));
1080
1080
  return files.readFile(file).pipe(Effect.map(problemOf));
1081
- }, { concurrency: READ_CONCURRENCY$18 });
1081
+ }, { concurrency: READ_CONCURRENCY$19 });
1082
1082
  return Array.getSomes(found);
1083
1083
  });
1084
1084
  // src/features/placement/model/agent-docs-length.ts
1085
1085
  const RECOMMENDED_LINES = 200;
1086
- const FIRST$14 = 1;
1087
- const RULE$26 = "agent-docs-length";
1086
+ const FIRST$15 = 1;
1087
+ const RULE$28 = "agent-docs-length";
1088
1088
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
1089
1089
  const problemFor$5 = (file) => (lines) => {
1090
1090
  if (lines <= RECOMMENDED_LINES) return Option.none();
1091
1091
  return Option.some({
1092
1092
  file,
1093
1093
  line: 201,
1094
- column: FIRST$14,
1095
- rule: RULE$26,
1094
+ column: FIRST$15,
1095
+ rule: RULE$28,
1096
1096
  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.`
1097
1097
  });
1098
1098
  };
1099
1099
  /** @internal */
1100
1100
  const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
1101
1101
  // src/features/placement/model/colocated-tests.ts
1102
- const RULE$25 = "colocated-test";
1103
- const FIRST$13 = 1;
1104
- const READ_CONCURRENCY$17 = 64;
1102
+ const RULE$27 = "colocated-test";
1103
+ const FIRST$14 = 1;
1104
+ const READ_CONCURRENCY$18 = 64;
1105
1105
  const ROOT_SUBPATH = ".";
1106
1106
  const NAME_GROUP = "name";
1107
1107
  const SPECIFIER_GROUP = "specifier";
1108
1108
  const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
1109
- const TEST_FILE = /\.test\.[cm]?[jt]sx?$/u;
1109
+ const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
1110
1110
  const MANIFEST_NAME = /package\.json$/u;
1111
1111
  const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
1112
1112
  const SPEC_DIRECTORY = /(?:^|\/)specs?\//u;
@@ -1117,21 +1117,21 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
1117
1117
  const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
1118
1118
  const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
1119
1119
  const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
1120
- const Manifest$2 = Schema.Struct({
1120
+ const Manifest$3 = Schema.Struct({
1121
1121
  name: Schema.optional(Schema.String),
1122
1122
  exports: Schema.optional(Schema.Unknown)
1123
1123
  });
1124
- const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
1124
+ const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
1125
1125
  const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
1126
1126
  const problemFor$4 = (test, message) => ({
1127
1127
  file: test.file,
1128
- line: FIRST$13,
1129
- column: FIRST$13,
1130
- rule: RULE$25,
1128
+ line: FIRST$14,
1129
+ column: FIRST$14,
1130
+ rule: RULE$27,
1131
1131
  message: `${test.base} ${message}`
1132
1132
  });
1133
1133
  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);
1134
- 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)));
1134
+ const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE$1.test(name)));
1135
1135
  const ownerOf$3 = (packages, name) => {
1136
1136
  const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
1137
1137
  return Array.last(Array.sort(owners, byLength$1));
@@ -1147,7 +1147,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
1147
1147
  if (Option.isNone(owner)) return [];
1148
1148
  const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
1149
1149
  const join = (target) => files.join(context.root, owner.value, target);
1150
- return pipe(text, Option.flatMap(decodeManifest$2), Option.map(specifiersBeside({
1150
+ return pipe(text, Option.flatMap(decodeManifest$4), Option.map(specifiersBeside({
1151
1151
  join,
1152
1152
  dirname: files.dirname,
1153
1153
  directory: test.directory
@@ -1168,7 +1168,7 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
1168
1168
  const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
1169
1169
  const problemIn$5 = Effect.fn("problemIn")(function* problemIn(context, test) {
1170
1170
  if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$4(test, DIRECTORY_MESSAGE));
1171
- if (!TEST_FILE.test(test.name)) return Option.none();
1171
+ if (!TEST_FILE$1.test(test.name)) return Option.none();
1172
1172
  if (yield* refersIn(context, test)) return Option.none();
1173
1173
  return Option.some(problemFor$4(test, SIBLING_MESSAGE));
1174
1174
  });
@@ -1190,15 +1190,15 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
1190
1190
  directory: files.dirname(file)
1191
1191
  };
1192
1192
  }));
1193
- const found = yield* Effect.forEach(tests, (test) => problemIn$5(context, test), { concurrency: READ_CONCURRENCY$17 });
1193
+ const found = yield* Effect.forEach(tests, (test) => problemIn$5(context, test), { concurrency: READ_CONCURRENCY$18 });
1194
1194
  return Array.getSomes(found);
1195
1195
  });
1196
1196
  // src/features/placement/model/dangling-links.ts
1197
- const RULE$24 = "dangling-link";
1198
- const SEPARATOR$14 = "/";
1199
- const FIRST$12 = 1;
1200
- const READ_CONCURRENCY$16 = 16;
1201
- const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$14}`)(name);
1197
+ const RULE$26 = "dangling-link";
1198
+ const SEPARATOR$16 = "/";
1199
+ const FIRST$13 = 1;
1200
+ const READ_CONCURRENCY$17 = 16;
1201
+ const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$16}`)(name);
1202
1202
  /** @internal */
1203
1203
  const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
1204
1204
  const files = yield* RepositoryFiles;
@@ -1208,22 +1208,39 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
1208
1208
  const link = yield* files.readLink(file);
1209
1209
  return pipe(link, Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))), Option.filter((target) => !pipe(listed, Array.some(holds(target)))), Option.map((target) => ({
1210
1210
  file,
1211
- line: FIRST$12,
1212
- column: FIRST$12,
1213
- rule: RULE$24,
1211
+ line: FIRST$13,
1212
+ column: FIRST$13,
1213
+ rule: RULE$26,
1214
1214
  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.`
1215
1215
  })));
1216
1216
  });
1217
- const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$16 });
1217
+ const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$17 });
1218
1218
  return Array.getSomes(found);
1219
1219
  });
1220
+ // src/features/placement/model/member-sources.ts
1221
+ const ROOT_WORKSPACE$1 = ".";
1222
+ const EXCLUDED$2 = [
1223
+ ":(exclude,attr:linguist-vendored)",
1224
+ ":(exclude,attr:linguist-generated)",
1225
+ ":(exclude,attr:linguist-documentation)"
1226
+ ];
1227
+ const memberWorkspaces = Effect.fn("memberWorkspaces")(function* memberWorkspaces(root) {
1228
+ const declared = yield* workspaceDirectories(root);
1229
+ return pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE$1));
1230
+ });
1231
+ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
1232
+ const files = yield* RepositoryFiles;
1233
+ return {
1234
+ workspaces: yield* memberWorkspaces(root),
1235
+ listed: yield* files.matchingFiles(root, EXCLUDED$2)
1236
+ };
1237
+ });
1220
1238
  // src/features/placement/model/layered-source.ts
1221
1239
  const LAYERED_RULE = "layered-source";
1222
1240
  const ENTRY_RULE = "public-entry";
1223
- const FIRST$11 = 1;
1224
- const ROOT_WORKSPACE = ".";
1241
+ const FIRST$12 = 1;
1225
1242
  const SOURCE_DIRECTORY = "src";
1226
- const SEPARATOR$13 = "/";
1243
+ const SEPARATOR$15 = "/";
1227
1244
  const LOOSE_DEPTH = 2;
1228
1245
  const LAYERS = [
1229
1246
  "app",
@@ -1236,34 +1253,29 @@ const LAYERS = [
1236
1253
  const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
1237
1254
  const ROOT_ALLOWED = /^(?:[^/]+\.config\.[cm]?[jt]s|alchemy\.[^/]+\.ts|[^/]+\.d\.[cm]?ts|bin\/.+)$/u;
1238
1255
  const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
1239
- const EXCLUDED$2 = [
1240
- ":(exclude,attr:linguist-vendored)",
1241
- ":(exclude,attr:linguist-generated)",
1242
- ":(exclude,attr:linguist-documentation)"
1243
- ];
1244
1256
  const OUTSIDE_MESSAGE = "sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root.";
1245
1257
  const LOOSE_MESSAGE = "sits directly in src/. Put it in a layer: app/ for entry points and wiring, features/<verb>-<object>/ for one operation, entities/<noun>/ for a shared domain object, or shared/<segment>/ for code without domain rules.";
1246
1258
  const LAYER_MESSAGE = `is not an FSD layer. src/ holds only ${Array.join(LAYERS, ", ")}.`;
1247
1259
  const ENTRY_MESSAGE = "is a package entry that points inside a slice. Point exports and bin at bin/<name>.ts, src/app/<entry>.ts or a slice's index.ts.";
1248
1260
  const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
1249
1261
  const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
1250
- const problemAt$3 = (file, rule, message) => ({
1262
+ const problemAt$4 = (file, rule, message) => ({
1251
1263
  file,
1252
- line: FIRST$11,
1253
- column: FIRST$11,
1264
+ line: FIRST$12,
1265
+ column: FIRST$12,
1254
1266
  rule,
1255
1267
  message
1256
1268
  });
1257
- const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$13}`)(name)), (owners) => Array.last(Array.sort(owners, byLength)), Option.map((workspace) => ({
1269
+ const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$15}`)(name)), (owners) => Array.last(Array.sort(owners, byLength)), Option.map((workspace) => ({
1258
1270
  workspace,
1259
1271
  inner: String$1.slice(workspace.length + 1)(name)
1260
1272
  })));
1261
1273
  const layerProblemOf = (owned) => {
1262
- const parts = String$1.split(owned.inner, SEPARATOR$13);
1274
+ const parts = String$1.split(owned.inner, SEPARATOR$15);
1263
1275
  const [top, layer] = parts;
1264
- if (top !== SOURCE_DIRECTORY) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$13}${owned.inner}`, OUTSIDE_MESSAGE], () => !ROOT_ALLOWED.test(owned.inner));
1265
- if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$13}${owned.inner}`, LOOSE_MESSAGE]);
1266
- return Option.liftPredicate([`${owned.workspace}${SEPARATOR$13}${SOURCE_DIRECTORY}${SEPARATOR$13}${layer}`, LAYER_MESSAGE], () => !pipe(LAYERS, Array.contains(layer ?? "")));
1276
+ if (top !== SOURCE_DIRECTORY) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$15}${owned.inner}`, OUTSIDE_MESSAGE], () => !ROOT_ALLOWED.test(owned.inner));
1277
+ if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$15}${owned.inner}`, LOOSE_MESSAGE]);
1278
+ return Option.liftPredicate([`${owned.workspace}${SEPARATOR$15}${SOURCE_DIRECTORY}${SEPARATOR$15}${layer}`, LAYER_MESSAGE], () => !pipe(LAYERS, Array.contains(layer ?? "")));
1267
1279
  };
1268
1280
  const entryProblems = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
1269
1281
  const files = yield* RepositoryFiles;
@@ -1274,36 +1286,34 @@ const entryProblems = Effect.fn("entryProblems")(function* entryProblems(root, w
1274
1286
  manifest,
1275
1287
  join,
1276
1288
  packEntries: []
1277
- })), Option.getOrElse(() => []), Array.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))), Array.map(({ label, source }) => problemAt$3(source, ENTRY_RULE, `${label} ${ENTRY_MESSAGE}`)));
1289
+ })), Option.getOrElse(() => []), Array.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))), Array.map(({ label, source }) => problemAt$4(source, ENTRY_RULE, `${label} ${ENTRY_MESSAGE}`)));
1278
1290
  });
1279
1291
  /** @internal */
1280
1292
  const checkLayeredSource = Effect.fn("checkLayeredSource")(function* checkLayeredSource(root) {
1281
1293
  const files = yield* RepositoryFiles;
1282
- const declared = yield* workspaceDirectories(root);
1283
- const workspaces = pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE));
1284
- const listed = yield* files.matchingFiles(root, EXCLUDED$2);
1285
- const layered = pipe(listed, Array.filter((name) => SCRIPT$1.test(name)), Array.map(ownerOf$2(workspaces)), Array.getSomes, Array.map(layerProblemOf), Array.getSomes, Array.dedupeWith(([left], [right]) => left === right), Array.map(([file, message]) => problemAt$3(files.join(root, file), LAYERED_RULE, message)));
1294
+ const { workspaces, listed } = yield* memberSources(root);
1295
+ const layered = pipe(listed, Array.filter((name) => SCRIPT$1.test(name)), Array.map(ownerOf$2(workspaces)), Array.getSomes, Array.map(layerProblemOf), Array.getSomes, Array.dedupeWith(([left], [right]) => left === right), Array.map(([file, message]) => problemAt$4(files.join(root, file), LAYERED_RULE, message)));
1286
1296
  const entries = yield* pipe(workspaces, Effect.forEach((workspace) => entryProblems(root, workspace)));
1287
1297
  return [...layered, ...Array.flatten(entries)];
1288
1298
  });
1289
1299
  // src/features/placement/model/nested-docs.ts
1290
- const RULE$23 = "nested-docs";
1300
+ const RULE$25 = "nested-docs";
1291
1301
  const CONFIG_FILE$4 = "vite.config.ts";
1292
- const SEPARATOR$12 = "/";
1293
- const FIRST$10 = 1;
1294
- const READ_CONCURRENCY$15 = 64;
1302
+ const SEPARATOR$14 = "/";
1303
+ const FIRST$11 = 1;
1304
+ const READ_CONCURRENCY$16 = 64;
1295
1305
  const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
1296
1306
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
1297
1307
  const README = /^README(?:\.[^/]+)?$/iu;
1298
1308
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
1299
1309
  const taggedError$3 = Schema.TaggedError;
1300
1310
  var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
1301
- const isNested = (name) => String$1.includes(SEPARATOR$12)(name);
1311
+ const isNested = (name) => String$1.includes(SEPARATOR$14)(name);
1302
1312
  const problemFor$3 = (file, message) => ({
1303
1313
  file,
1304
- line: FIRST$10,
1305
- column: FIRST$10,
1306
- rule: RULE$23,
1314
+ line: FIRST$11,
1315
+ column: FIRST$11,
1316
+ rule: RULE$25,
1307
1317
  message
1308
1318
  });
1309
1319
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
@@ -1349,38 +1359,38 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
1349
1359
  workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
1350
1360
  workspaceAgentDocs
1351
1361
  };
1352
- const found = yield* Effect.forEach(nested, (name) => problemIn$4(root, allowed, name), { concurrency: READ_CONCURRENCY$15 });
1362
+ const found = yield* Effect.forEach(nested, (name) => problemIn$4(root, allowed, name), { concurrency: READ_CONCURRENCY$16 });
1353
1363
  return Array.getSomes(found);
1354
1364
  });
1355
1365
  // src/features/placement/model/root-docs.ts
1356
- const RULE$22 = "root-docs";
1357
- const SEPARATOR$11 = "/";
1358
- const FIRST$9 = 1;
1366
+ const RULE$24 = "root-docs";
1367
+ const SEPARATOR$13 = "/";
1368
+ const FIRST$10 = 1;
1359
1369
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
1360
1370
  const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
1361
- 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.";
1362
- const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$11)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1371
+ const MESSAGE$6 = "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.";
1372
+ const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$13)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1363
1373
  /** @internal */
1364
1374
  const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
1365
1375
  const files = yield* RepositoryFiles;
1366
1376
  const names = yield* files.listedFiles(root);
1367
1377
  return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
1368
1378
  file: files.join(root, name),
1369
- line: FIRST$9,
1370
- column: FIRST$9,
1371
- rule: RULE$22,
1372
- message: `${name} ${MESSAGE$5}`
1379
+ line: FIRST$10,
1380
+ column: FIRST$10,
1381
+ rule: RULE$24,
1382
+ message: `${name} ${MESSAGE$6}`
1373
1383
  })));
1374
1384
  });
1375
1385
  // src/features/placement/model/root-readme.ts
1376
- const RULE$21 = "root-readme";
1386
+ const RULE$23 = "root-readme";
1377
1387
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
1378
- const READ_CONCURRENCY$14 = 16;
1388
+ const READ_CONCURRENCY$15 = 16;
1379
1389
  const START$12 = 0;
1380
1390
  const CHECK_POLICY = "@r_masseater/msch";
1381
1391
  const MARKETPLACE = ".claude-plugin/marketplace.json";
1382
1392
  const RELATIVE = /^\.\//u;
1383
- const SEPARATOR$10 = "/";
1393
+ const SEPARATOR$12 = "/";
1384
1394
  const MarketplacePlugin = Schema.Struct({
1385
1395
  name: Schema.optional(Schema.String),
1386
1396
  source: Schema.Unknown
@@ -1392,7 +1402,7 @@ const NO_PLUGINS = {
1392
1402
  };
1393
1403
  const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
1394
1404
  const messageFor = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
1395
- const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$10)(directory), Array.last, Option.getOrElse(() => directory));
1405
+ const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$12)(directory), Array.last, Option.getOrElse(() => directory));
1396
1406
  const pluginsOf = (plugins) => {
1397
1407
  const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE, "")));
1398
1408
  const segments = pipe(directories, Array.map(lastSegment));
@@ -1415,14 +1425,14 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf(Option.match
1415
1425
  onNone: () => ownNames(plugins, names),
1416
1426
  onSome: () => [directory]
1417
1427
  }));
1418
- const problemsIn$10 = (file, source, plugins) => (workspace) => {
1428
+ const problemsIn$11 = (file, source, plugins) => (workspace) => {
1419
1429
  const message = messageFor(workspace.directory);
1420
1430
  const at = positionOf(source);
1421
1431
  const pattern = patternFor(plugins)(workspace);
1422
1432
  return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
1423
1433
  file,
1424
1434
  ...at(found.index ?? START$12),
1425
- rule: RULE$21,
1435
+ rule: RULE$23,
1426
1436
  message
1427
1437
  })));
1428
1438
  };
@@ -1430,7 +1440,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
1430
1440
  const text = yield* (yield* RepositoryFiles).readFile(file);
1431
1441
  return pipe(text, Option.match({
1432
1442
  onNone: () => [],
1433
- onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$10(file, source, plugins)))
1443
+ onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$11(file, source, plugins)))
1434
1444
  }));
1435
1445
  });
1436
1446
  /** @internal */
@@ -1441,9 +1451,43 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
1441
1451
  const named = yield* namedWorkspaces(root);
1442
1452
  const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
1443
1453
  const plugins = yield* marketplacePlugins(root);
1444
- const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$14 });
1454
+ const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$15 });
1445
1455
  return Array.flatten(found);
1446
1456
  });
1457
+ // src/features/placement/model/source-aliases.ts
1458
+ const ALIAS_RULE = "source-alias";
1459
+ const FIRST$9 = 1;
1460
+ const SOURCE_ALIAS = "#/*";
1461
+ const SOURCE_TARGET = "./src/*";
1462
+ const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
1463
+ const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
1464
+ const Manifest$2 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
1465
+ const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
1466
+ const problemAt$3 = (file, rule, message) => ({
1467
+ file,
1468
+ line: FIRST$9,
1469
+ column: FIRST$9,
1470
+ rule,
1471
+ message
1472
+ });
1473
+ const targetsOf = (target) => {
1474
+ if (Predicate.isString(target)) return [target];
1475
+ if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
1476
+ return [];
1477
+ };
1478
+ const intoSource = ([key, target]) => !(key === SOURCE_ALIAS && pipe(targetsOf(target), Array.every((path) => path === SOURCE_TARGET))) && pipe(targetsOf(target), Array.some((path) => SOURCE_PREFIX.test(path)));
1479
+ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
1480
+ const files = yield* RepositoryFiles;
1481
+ const manifest = files.join(root, workspace, MANIFEST_FILE);
1482
+ const text = yield* files.readFile(manifest);
1483
+ return pipe(text, Option.flatMap(decodeManifest$3), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemAt$3(manifest, ALIAS_RULE, `"${key}" ${ALIAS_MESSAGE}`)));
1484
+ });
1485
+ /** @internal */
1486
+ const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
1487
+ const workspaces = yield* memberWorkspaces(root);
1488
+ const aliases = yield* pipe(workspaces, Effect.forEach((workspace) => aliasProblems(root, workspace)));
1489
+ return Array.flatten(aliases);
1490
+ });
1447
1491
  // src/features/placement/model/placement-checks.ts
1448
1492
  /** @internal */
1449
1493
  const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root) {
@@ -1454,7 +1498,8 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
1454
1498
  checkColocatedTests(root),
1455
1499
  checkAgentDocsLength(root),
1456
1500
  checkLayeredSource(root),
1457
- checkDanglingLinks(root)
1501
+ checkDanglingLinks(root),
1502
+ checkSourceAliases(root)
1458
1503
  ], { concurrency: "unbounded" });
1459
1504
  return Array.flatten(found);
1460
1505
  });
@@ -1465,9 +1510,9 @@ const SCRIPTS = "scripts-directory";
1465
1510
  const BIN = "bin";
1466
1511
  const SCRIPTS_DIRECTORY = "scripts";
1467
1512
  const WORKFLOW_DIRECTORY$1 = ".github/";
1468
- const SEPARATOR$9 = "/";
1513
+ const SEPARATOR$11 = "/";
1469
1514
  const CURRENT = "./";
1470
- const READ_CONCURRENCY$13 = 8;
1515
+ const READ_CONCURRENCY$14 = 8;
1471
1516
  const FIRST$8 = 1;
1472
1517
  const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
1473
1518
  const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
@@ -1478,7 +1523,7 @@ const Manifest$1 = Schema.Struct({
1478
1523
  exports: Schema.optional(Schema.Unknown)
1479
1524
  });
1480
1525
  const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
1481
- const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
1526
+ const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
1482
1527
  const decodeTarget = Schema.decodeUnknownOption(Schema.String);
1483
1528
  const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
1484
1529
  const NO_ENTRIES = {
@@ -1505,22 +1550,22 @@ const entriesOf$1 = (manifest) => {
1505
1550
  const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
1506
1551
  const files = yield* RepositoryFiles;
1507
1552
  const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));
1508
- return pipe(text, Option.flatMap(decodeManifest$1), Option.map(entriesOf$1), Option.getOrElse(() => NO_ENTRIES));
1553
+ return pipe(text, Option.flatMap(decodeManifest$2), Option.map(entriesOf$1), Option.getOrElse(() => NO_ENTRIES));
1509
1554
  });
1510
1555
  const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
1511
1556
  const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
1512
1557
  const files = yield* RepositoryFiles;
1513
1558
  const names = yield* files.readDirectory(files.join(root, directory, BIN));
1514
- return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$9}${name}`), Array.filter(isCommand$1));
1559
+ return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$11}${name}`), Array.filter(isCommand$1));
1515
1560
  });
1516
1561
  const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
1517
1562
  const files = yield* RepositoryFiles;
1518
1563
  const listed = yield* files.listedFiles(root);
1519
1564
  const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
1520
- const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$13 });
1565
+ const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$14 });
1521
1566
  return pipe(Array.getSomes(texts), Array.join("\n"));
1522
1567
  });
1523
- const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$9));
1568
+ const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$11));
1524
1569
  const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
1525
1570
  file,
1526
1571
  ...positionOf(source)(start),
@@ -1528,7 +1573,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
1528
1573
  message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
1529
1574
  })));
1530
1575
  const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
1531
- const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
1576
+ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
1532
1577
  const files = yield* RepositoryFiles;
1533
1578
  const config = yield* workspaceConfigOf(root, directory);
1534
1579
  const entries = yield* declaredEntries(root, directory);
@@ -1567,17 +1612,17 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
1567
1612
  const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
1568
1613
  const all = ["", ...yield* workspaceDirectories(root)];
1569
1614
  const workflows = yield* workflowText(root);
1570
- const found = yield* Effect.forEach(all, (directory) => problemsIn$9(root, directory, workflows), { concurrency: READ_CONCURRENCY$13 });
1571
- const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$13 });
1615
+ const found = yield* Effect.forEach(all, (directory) => problemsIn$10(root, directory, workflows), { concurrency: READ_CONCURRENCY$14 });
1616
+ const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$14 });
1572
1617
  return [...Array.flatten(found), ...Array.getSomes(scripts)];
1573
1618
  });
1574
1619
  // src/features/repository-layout/model/crates.ts
1575
- const RULE$20 = "unverified-crate";
1620
+ const RULE$22 = "unverified-crate";
1576
1621
  const CARGO_FILE = "Cargo.toml";
1577
1622
  const CONFIG_FILE$3 = "vite.config.ts";
1578
- const SEPARATOR$8 = "/";
1623
+ const SEPARATOR$10 = "/";
1579
1624
  const FIRST$7 = 1;
1580
- const READ_CONCURRENCY$12 = 8;
1625
+ const READ_CONCURRENCY$13 = 8;
1581
1626
  const CrateEntry = Schema.Struct({
1582
1627
  name: Schema.String,
1583
1628
  manifest_path: Schema.String
@@ -1603,14 +1648,14 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
1603
1648
  })));
1604
1649
  }, Effect.scoped);
1605
1650
  const owningWorkspace = (directories) => (directory) => {
1606
- const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$8}`)(directory)));
1651
+ const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$10}`)(directory)));
1607
1652
  return Array.last(Array.sort(owners, String$1.Order));
1608
1653
  };
1609
1654
  const problemFor$2 = (crate, message) => ({
1610
1655
  file: crate.manifest,
1611
1656
  line: FIRST$7,
1612
1657
  column: FIRST$7,
1613
- rule: RULE$20,
1658
+ rule: RULE$22,
1614
1659
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
1615
1660
  });
1616
1661
  const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
@@ -1626,11 +1671,115 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
1626
1671
  if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
1627
1672
  const directories = yield* workspaceDirectories(root);
1628
1673
  const crates = yield* cratesIn(root);
1629
- const found = yield* Effect.forEach(crates, (crate) => problemIn$3(root, directories, crate), { concurrency: READ_CONCURRENCY$12 });
1674
+ const found = yield* Effect.forEach(crates, (crate) => problemIn$3(root, directories, crate), { concurrency: READ_CONCURRENCY$13 });
1630
1675
  return Array.getSomes(found);
1631
1676
  });
1677
+ // src/features/repository-layout/model/deploy-entry-patterns.ts
1678
+ const RULE$21 = "deploy-entry-pattern";
1679
+ const FALLOW_KEYS = [
1680
+ "entry",
1681
+ "entryPoints",
1682
+ "supportEntry",
1683
+ "dynamicallyLoaded",
1684
+ "alwaysUsed"
1685
+ ];
1686
+ const VITE_KEYS = ["files"];
1687
+ const FALLOW_CONFIG$1 = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?)$/u;
1688
+ const VITE_CONFIG = /(?:^|\/)vite\.config\.[cm]?ts$/u;
1689
+ const BRACE_GROUP = /\{(?<options>[^{}]*)\}/u;
1690
+ const OPTION_SEPARATOR = ",";
1691
+ const PAIR = 2;
1692
+ const NEGATED = "!";
1693
+ const ROOT_WORKSPACE = ".";
1694
+ const WRAP_OFFSET$1 = 1;
1695
+ const NO_OFFSET = 0;
1696
+ const READ_CONCURRENCY$12 = 8;
1697
+ const MESSAGE$5 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
1698
+ const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
1699
+ const FALLOW = {
1700
+ keys: FALLOW_KEYS,
1701
+ offset: WRAP_OFFSET$1,
1702
+ sourceOf: (text) => `(${text})`,
1703
+ bases: (directory, workspaces) => [directory, ...workspaces]
1704
+ };
1705
+ const VITE = {
1706
+ keys: VITE_KEYS,
1707
+ offset: NO_OFFSET,
1708
+ sourceOf: (text) => text,
1709
+ bases: (directory) => [directory]
1710
+ };
1711
+ const isPatternProperty = (keys) => (node) => node["type"] === "Property" && pipe(decodeKey$1(node["key"]), Option.exists((key) => Array.contains(keys, keyName(key))));
1712
+ const patternsIn = (keys) => (node) => {
1713
+ if (Predicate.isReadonlyObject(node) && isPatternProperty(keys)(node)) return stringsIn(node["value"]);
1714
+ return pipe(childrenOf$2(node), Array.flatMap(patternsIn(keys)));
1715
+ };
1716
+ const choicesOf = ([literal = "", options]) => pipe(Option.fromUndefinedOr(options), Option.map(String$1.split(OPTION_SEPARATOR)), Option.getOrElse(() => [""]), Array.map((option) => `${literal}${option}`));
1717
+ const combined = (chunks) => Array.matchLeft(chunks, {
1718
+ onEmpty: () => [""],
1719
+ onNonEmpty: (head, tail) => pipe(choicesOf(head), Array.flatMap((choice) => pipe(combined(tail), Array.map((rest) => `${choice}${rest}`))))
1720
+ });
1721
+ const expanded = (pattern) => combined(Array.chunksOf(String$1.split(pattern, BRACE_GROUP), PAIR));
1722
+ const selectsOnlyDeployEntries = Effect.fn("selectsOnlyDeployEntries")(function* selectsOnlyDeployEntries({ root, bases, entries }, pattern) {
1723
+ const files = yield* RepositoryFiles;
1724
+ const pathspecs = pipe(bases, Array.flatMap((base) => pipe(expanded(pattern.text), Array.map((spec) => `:(glob)${files.join(base, spec)}`))));
1725
+ const matched = yield* files.matchingFiles(root, pathspecs);
1726
+ const selects = Array.isReadonlyArrayNonEmpty(matched) && pipe(matched, Array.every((file) => Array.contains(entries, file)));
1727
+ return Option.liftPredicate(pattern, () => selects);
1728
+ });
1729
+ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind) {
1730
+ const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
1731
+ return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
1732
+ });
1733
+ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(request) {
1734
+ const { root, file, kind, workspaces, entries } = request;
1735
+ const files = yield* RepositoryFiles;
1736
+ const path = files.join(root, file);
1737
+ const text = yield* files.readFile(path);
1738
+ if (Option.isNone(text)) return [];
1739
+ const patterns = yield* patternsOf(file, text.value, kind);
1740
+ const selection = {
1741
+ root,
1742
+ bases: kind.bases(files.dirname(file), workspaces),
1743
+ entries
1744
+ };
1745
+ const flagged = yield* pipe(patterns, Effect.forEach((pattern) => selectsOnlyDeployEntries(selection, pattern)));
1746
+ return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
1747
+ file: path,
1748
+ ...positionOf(text.value)(start - kind.offset),
1749
+ rule: RULE$21,
1750
+ message: `${pattern} ${MESSAGE$5}`
1751
+ })));
1752
+ });
1753
+ /** @internal */
1754
+ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function* checkDeployEntryPatterns(root) {
1755
+ const files = yield* RepositoryFiles;
1756
+ const entries = yield* deployEntries(root);
1757
+ if (!Array.isReadonlyArrayNonEmpty(entries)) return [];
1758
+ const listed = yield* files.listedFiles(root);
1759
+ const declared = yield* workspaceDirectories(root);
1760
+ const workspaces = pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE));
1761
+ const configs = pipe(listed, Array.flatMap((file) => {
1762
+ if (FALLOW_CONFIG$1.test(file)) return [{
1763
+ file,
1764
+ kind: FALLOW
1765
+ }];
1766
+ if (VITE_CONFIG.test(file)) return [{
1767
+ file,
1768
+ kind: VITE
1769
+ }];
1770
+ return [];
1771
+ }));
1772
+ const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$9({
1773
+ root,
1774
+ file,
1775
+ kind,
1776
+ workspaces,
1777
+ entries
1778
+ }), { concurrency: READ_CONCURRENCY$12 });
1779
+ return Array.flatten(found);
1780
+ });
1632
1781
  // src/features/repository-layout/model/fallow-entries.ts
1633
- const RULE$19 = "listed-entry";
1782
+ const RULE$20 = "listed-entry";
1634
1783
  const ENTRY_KEYS = [
1635
1784
  "entry",
1636
1785
  "entryPoints",
@@ -1638,7 +1787,7 @@ const ENTRY_KEYS = [
1638
1787
  ];
1639
1788
  const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
1640
1789
  const WILDCARD$1 = /[*?{[]/u;
1641
- const SEPARATOR$7 = "/";
1790
+ const SEPARATOR$9 = "/";
1642
1791
  const WRAP_OFFSET = 1;
1643
1792
  const READ_CONCURRENCY$11 = 8;
1644
1793
  const decodeKey = Schema.decodeUnknownOption(KeySchema);
@@ -1650,7 +1799,7 @@ const entryPatternsIn = (node) => {
1650
1799
  })));
1651
1800
  return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
1652
1801
  };
1653
- 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);
1802
+ const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$9}`)(text))) || String$1.includes(SEPARATOR$9)(text) && !WILDCARD$1.test(text);
1654
1803
  const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
1655
1804
  const files = yield* RepositoryFiles;
1656
1805
  const path = files.join(root, file);
@@ -1660,8 +1809,8 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, di
1660
1809
  return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
1661
1810
  file: path,
1662
1811
  ...positionOf(text.value)(start),
1663
- rule: RULE$19,
1664
- 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.`
1812
+ rule: RULE$20,
1813
+ message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`
1665
1814
  })));
1666
1815
  });
1667
1816
  /** @internal */
@@ -1672,7 +1821,7 @@ const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallow
1672
1821
  return Array.flatten(found);
1673
1822
  });
1674
1823
  // src/features/repository-layout/model/hidden-verify.ts
1675
- const RULE$18 = "hidden-verify";
1824
+ const RULE$19 = "hidden-verify";
1676
1825
  const CONFIG_FILE$2 = "vite.config.ts";
1677
1826
  const FIRST$6 = 1;
1678
1827
  const READ_CONCURRENCY$10 = 8;
@@ -1686,7 +1835,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
1686
1835
  file,
1687
1836
  line: FIRST$6,
1688
1837
  column: FIRST$6,
1689
- rule: RULE$18,
1838
+ rule: RULE$19,
1690
1839
  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}.`
1691
1840
  }).pipe(Option.filter(() => verified));
1692
1841
  });
@@ -1697,7 +1846,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
1697
1846
  return Array.getSomes(found);
1698
1847
  });
1699
1848
  // src/features/repository-layout/model/root-workspace-paths.ts
1700
- const RULE$17 = "root-workspace-path";
1849
+ const RULE$18 = "root-workspace-path";
1701
1850
  const CONFIG_FILE$1 = "vite.config.ts";
1702
1851
  const PATH_CHARACTER = /[\w.@/-]/u;
1703
1852
  const NAME_CHARACTER = /[\w.@-]/u;
@@ -1716,7 +1865,7 @@ const mentions = (directory) => (text) => {
1716
1865
  const problemsIn$7 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
1717
1866
  file,
1718
1867
  ...positionOf(source)(found.start),
1719
- rule: RULE$17,
1868
+ rule: RULE$18,
1720
1869
  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.`
1721
1870
  })));
1722
1871
  /** @internal */
@@ -1730,7 +1879,7 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
1730
1879
  return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$7(file, source.value, directories)));
1731
1880
  });
1732
1881
  // src/features/repository-layout/model/shared-uncached-tasks.ts
1733
- const RULE$16 = "shared-uncached-task";
1882
+ const RULE$17 = "shared-uncached-task";
1734
1883
  const READ_CONCURRENCY$9 = 8;
1735
1884
  const SHARED = 2;
1736
1885
  const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
@@ -1773,7 +1922,7 @@ const problemsOf$1 = (definitions) => {
1773
1922
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
1774
1923
  file,
1775
1924
  ...position,
1776
- rule: RULE$16,
1925
+ rule: RULE$17,
1777
1926
  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.`
1778
1927
  })));
1779
1928
  };
@@ -1816,10 +1965,10 @@ const scalarsIn = (source) => {
1816
1965
  return found;
1817
1966
  };
1818
1967
  // src/features/repository-layout/model/workflow-references.ts
1819
- const ROOT = ".";
1968
+ const ROOT$1 = ".";
1820
1969
  const LOCAL = "./";
1821
1970
  const NEGATION = "!";
1822
- const SEPARATOR$6 = "/";
1971
+ const SEPARATOR$8 = "/";
1823
1972
  const LINE$1 = "\n";
1824
1973
  const UNRESOLVED_MARKERS = [
1825
1974
  "${{",
@@ -1845,10 +1994,10 @@ const withoutLocal = (path) => {
1845
1994
  };
1846
1995
  const joinPath = (base, path) => {
1847
1996
  const relative = withoutLocal(String$1.trim(path));
1848
- if (base === ROOT) return relative;
1849
- return `${base}${SEPARATOR$6}${relative}`;
1997
+ if (base === ROOT$1) return relative;
1998
+ return `${base}${SEPARATOR$8}${relative}`;
1850
1999
  };
1851
- const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
2000
+ const reference = (kind, field, base = ROOT$1) => ({ text, offset }) => {
1852
2001
  const path = String$1.trim(text);
1853
2002
  if (!isLiteralPath(path) || !isLiteralPath(base)) return [];
1854
2003
  return [{
@@ -1861,8 +2010,8 @@ const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
1861
2010
  const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
1862
2011
  const globsIn = (field, node) => pipe(itemsOf(node), Array.flatMap((item) => Option.toArray(stringOf(item))), Array.filter(isPositive), Array.flatMap(reference("glob", field)));
1863
2012
  const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
1864
- const directoryOf$1 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT, text)), Option.getOrElse(() => base));
1865
- const located = (kind, field, base = ROOT) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
2013
+ const directoryOf$1 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$1, text)), Option.getOrElse(() => base));
2014
+ const located = (kind, field, base = ROOT$1) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
1866
2015
  const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL)(text)));
1867
2016
  const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(text, TOKEN_SEPARATOR), Array.filter((token) => SCRIPT.test(token)), Array.dedupe, Array.flatMap((token) => reference("script", field, base)({
1868
2017
  text: token,
@@ -1906,7 +2055,7 @@ const jobsOf = (source) => entriesOf(childOf("jobs")(parseDocument(source).conte
1906
2055
  const workflowReferences = (source) => {
1907
2056
  const root = parseDocument(source).contents;
1908
2057
  const workflowDefault = workingDirectoryOf(root);
1909
- const base = directoryOf$1(workflowDefault, ROOT);
2058
+ const base = directoryOf$1(workflowDefault, ROOT$1);
1910
2059
  return [
1911
2060
  ...pipe(entriesOf(childOf("on")(root)), Array.flatMap(filtersOf)),
1912
2061
  ...located("directory", "defaults.run.working-directory")(workflowDefault),
@@ -1915,16 +2064,16 @@ const workflowReferences = (source) => {
1915
2064
  ];
1916
2065
  };
1917
2066
  const pathInputOf = (step) => childOf("path")(childOf("with")(step));
1918
- const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf), Array.map(({ text }) => joinPath(ROOT, text)), Array.filter(isLiteralPath));
2067
+ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf), Array.map(({ text }) => joinPath(ROOT$1, text)), Array.filter(isLiteralPath));
1919
2068
  /** @internal */
1920
2069
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
1921
2070
  // src/features/repository-layout/model/workflow-paths.ts
1922
- const RULE$15 = "workflow-path";
2071
+ const RULE$16 = "workflow-path";
1923
2072
  const WORKFLOW_DIRECTORY = ".github/workflows/";
1924
2073
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
1925
2074
  const READ_CONCURRENCY$8 = 8;
1926
2075
  const WILDCARD = /[*?[]/u;
1927
- const SEPARATOR$5 = "/";
2076
+ const SEPARATOR$7 = "/";
1928
2077
  const FIRST$4 = 0;
1929
2078
  const EXPECTED = {
1930
2079
  action: "a directory with action.yml",
@@ -1949,10 +2098,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
1949
2098
  return Option.getOrElse(directory, () => false);
1950
2099
  });
1951
2100
  const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
1952
- const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$5}${name}`)));
2101
+ const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$7}${name}`)));
1953
2102
  return pipe(found, Array.some(Boolean));
1954
2103
  });
1955
- const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$5))}`;
2104
+ const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$7))}`;
1956
2105
  const RESOLVERS = {
1957
2106
  action: hasAction,
1958
2107
  directory: isDirectoryAt,
@@ -1960,13 +2109,13 @@ const RESOLVERS = {
1960
2109
  glob: matchesGlob,
1961
2110
  script: Effect.fn("findsScript")(function* findsScript(root, path) {
1962
2111
  if (yield* existsAt(root, path)) return true;
1963
- const segments = String$1.split(path, SEPARATOR$5);
2112
+ const segments = String$1.split(path, SEPARATOR$7);
1964
2113
  return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
1965
2114
  })
1966
2115
  };
1967
2116
  const staticPrefix = (path) => {
1968
2117
  const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
1969
- if (String$1.endsWith(SEPARATOR$5)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
2118
+ if (String$1.endsWith(SEPARATOR$7)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
1970
2119
  return prefix;
1971
2120
  };
1972
2121
  const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
@@ -1975,17 +2124,17 @@ const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
1975
2124
  const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
1976
2125
  return Array.isReadonlyArrayNonEmpty(ignored);
1977
2126
  });
1978
- const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$5}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$5}`)(path);
2127
+ const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$7}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$7}`)(path);
1979
2128
  const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
1980
2129
  const prefix = staticPrefix(found.path);
1981
2130
  if (pipe(produced, Array.some(overlaps(prefix)))) return false;
1982
2131
  if (yield* RESOLVERS[found.kind](root, found.path)) return false;
1983
2132
  return !(yield* isIgnored$1(root, found.path));
1984
2133
  });
1985
- const problemOf$5 = (file, source) => (found) => ({
2134
+ const problemOf$6 = (file, source) => (found) => ({
1986
2135
  file,
1987
2136
  ...positionOf(source)(found.offset),
1988
- rule: RULE$15,
2137
+ rule: RULE$16,
1989
2138
  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.`
1990
2139
  });
1991
2140
  const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
@@ -1995,7 +2144,7 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow
1995
2144
  if (Option.isNone(source)) return [];
1996
2145
  const produced = producedPaths(source.value);
1997
2146
  const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
1998
- return pipe(missing, Array.map(problemOf$5(file, source.value)));
2147
+ return pipe(missing, Array.map(problemOf$6(file, source.value)));
1999
2148
  });
2000
2149
  /** @internal */
2001
2150
  const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
@@ -2013,7 +2162,7 @@ const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
2013
2162
  const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
2014
2163
  const START$11 = 0;
2015
2164
  const READ_CONCURRENCY$7 = 8;
2016
- const SEPARATOR$4 = "/";
2165
+ const SEPARATOR$6 = "/";
2017
2166
  const WORD_SEPARATORS = /[-_]/gu;
2018
2167
  const SPACE = " ";
2019
2168
  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.";
@@ -2036,7 +2185,7 @@ const pathFiltersIn = (file, source) => {
2036
2185
  };
2037
2186
  const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ names }) => Array.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf(names))(text))), Option.map(({ directory }) => directory));
2038
2187
  const named = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
2039
- const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$4}`)(path)), Option.map(({ directory }) => directory));
2188
+ const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$6}`)(path)), Option.map(({ directory }) => directory));
2040
2189
  const namesIn = (name, source) => {
2041
2190
  const root = parseDocument(source).contents;
2042
2191
  return [
@@ -2102,6 +2251,7 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
2102
2251
  const found = yield* Effect.all([
2103
2252
  checkCommandEntries(root),
2104
2253
  checkCrates(root),
2254
+ checkDeployEntryPatterns(root),
2105
2255
  checkFallowEntries(root),
2106
2256
  checkHiddenVerify(root),
2107
2257
  checkRootWorkspacePaths(root),
@@ -2112,7 +2262,7 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
2112
2262
  return Array.flatten(found);
2113
2263
  });
2114
2264
  // src/features/pass-through-wrappers/model/pass-through-wrappers.ts
2115
- const RULE$14 = "pass-through-wrapper";
2265
+ const RULE$15 = "pass-through-wrapper";
2116
2266
  const SINGLE_STATEMENT = 1;
2117
2267
  const SINGLE_DECLARATION = 1;
2118
2268
  const THIS_PARAMETER = "this";
@@ -2206,14 +2356,14 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
2206
2356
  const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
2207
2357
  return Option.exists(forwardedNames(wrapper, forward), (names) => callsAnotherFunction(candidate, forward, names)) && (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) && keepsTheReturnType(checker)(wrapper, forward) && !isOverloaded(checker)(name);
2208
2358
  };
2209
- const problemOf$4 = (checker) => (candidate) => {
2359
+ const problemOf$5 = (checker) => (candidate) => {
2210
2360
  if (changesTheCall(candidate.wrapper)) return Option.none();
2211
- return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$5({
2212
- rule: RULE$14,
2361
+ return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$6({
2362
+ rule: RULE$15,
2213
2363
  message: messageOf(forward.callee.getText())
2214
2364
  })(candidate.name)));
2215
2365
  };
2216
- const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$4(checker)), Array.getSomes);
2366
+ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$5(checker)), Array.getSomes);
2217
2367
  // src/features/value-owners/model/slots.ts
2218
2368
  const ANNOTATED_KINDS = /* @__PURE__ */ new Set([
2219
2369
  SyntaxKind.Parameter,
@@ -2266,6 +2416,34 @@ const flowOf = (context) => (expression) => Option.fromUndefinedOr(context.check
2266
2416
  target
2267
2417
  })))));
2268
2418
  const flowsIn = (context) => (sourceFile) => Array.getSomes(pipe(descendantsOf(sourceFile), Array.filter((node) => isFlowSource(node)), Array.map((node) => flowOf(context)(node))));
2419
+ // src/features/value-owners/model/free-literals.ts
2420
+ const NAME = /^[\w@.#/:$-]{2,}$/u;
2421
+ const REQUIRE = "require";
2422
+ const isModuleSpecifier = (node) => {
2423
+ const { parent } = node;
2424
+ return isImportDeclaration(parent) || isExportDeclaration(parent) || parent.kind === SyntaxKind.ExternalModuleReference || parent.kind === SyntaxKind.LiteralType || isCallExpression(parent) && (parent.expression.kind === SyntaxKind.ImportKeyword || parent.expression.getText() === REQUIRE);
2425
+ };
2426
+ const isModuleScope = (node) => {
2427
+ const { parent } = node;
2428
+ if (isSourceFile(parent)) return true;
2429
+ return !isSignatureDeclaration(parent) && isModuleScope(parent);
2430
+ };
2431
+ const isDefinition = (node) => {
2432
+ const { parent } = node;
2433
+ return (isVariableDeclaration(parent) && parent.initializer === node || isPropertyAssignment(parent) && parent.initializer === node) && isModuleScope(parent);
2434
+ };
2435
+ const isTyped = (checker) => (node) => Option.fromUndefinedOr(checker.getContextualType(node)).pipe(Option.flatMap(finiteValuesOf(checker)), Option.isSome);
2436
+ const specifierOf = (statement) => {
2437
+ if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) return Option.none();
2438
+ return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));
2439
+ };
2440
+ const importedFilesOf = (checker) => (sourceFile) => pipe(sourceFile.statements, Array.map(specifierOf), Array.getSomes, Array.flatMap((specifier) => pipe(Option.fromUndefinedOr(checker.getSymbolAtLocation(specifier)), Option.flatMap((symbol) => Array.head(declarationsOf(symbol))), Option.map((declaration) => declaration.getSourceFile().fileName), Option.toArray)), Array.dedupe);
2441
+ const freeLiteralsIn = (checker) => (sourceFile, excluded) => pipe(descendantsOf(sourceFile), Array.filter((node) => isStringLiteral(node)), Array.filter((node) => NAME.test(node.text)), Array.filter(isDefinition), Array.filter((node) => !isModuleSpecifier(node)), Array.filter((node) => !isInsideAny(excluded)(node) && !isTyped(checker)(node)), Array.map((node) => node.text), Array.dedupe);
2442
+ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Array.map((sourceFile) => ({
2443
+ file: sourceFile.fileName,
2444
+ values: freeLiteralsIn(checker)(sourceFile, excluded),
2445
+ imports: importedFilesOf(checker)(sourceFile)
2446
+ })), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
2269
2447
  // src/features/value-owners/model/owners.ts
2270
2448
  const OWNER_TAG = "msch";
2271
2449
  const FIRST_OWNER_COUNT = 1;
@@ -2298,7 +2476,7 @@ const ownerValuesOf = (checker) => (declaration) => {
2298
2476
  const type = checker.getTypeAtLocation(declaration.name);
2299
2477
  return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
2300
2478
  };
2301
- const annotationProblem = (message) => problemAt$5({
2479
+ const annotationProblem = (message) => problemAt$6({
2302
2480
  rule: "owner-annotation",
2303
2481
  message
2304
2482
  });
@@ -2350,6 +2528,10 @@ const combineOwnerScans = (scans) => {
2350
2528
  problems: [...pipe(scans, Array.flatMap((scan) => scan.problems)), ...conflictProblems(owners)]
2351
2529
  };
2352
2530
  };
2531
+ const ownerDeclarationsIn = (owners) => (project) => {
2532
+ const keys = new Set(pipe(owners, Array.map((owner) => owner.key)));
2533
+ return pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(descendantsOf(sourceFile), Array.filter((node) => isVariableDeclaration(node)), Array.filter((declaration) => Option.exists(ownerKeyOf(declaration), (key) => keys.has(key))))));
2534
+ };
2353
2535
  // src/features/value-owners/model/derivation.ts
2354
2536
  const contractOf = (node) => {
2355
2537
  const { parent } = node;
@@ -2431,7 +2613,7 @@ const shapeProblem = (site, matches) => {
2431
2613
  onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
2432
2614
  onSome: () => "Use the library type instead of copying it."
2433
2615
  });
2434
- return problemAt$5({
2616
+ return problemAt$6({
2435
2617
  rule: "library-shape",
2436
2618
  message: `This shape copies ${shown}. ${advice}`
2437
2619
  })(site.node);
@@ -2478,7 +2660,17 @@ const selectsKeys = (checker) => (node, values) => {
2478
2660
  const typeArguments = parent.typeArguments ?? [];
2479
2661
  return pipe(typeArguments, Array.filter((argument) => argument !== node), Array.some((argument) => isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument)))));
2480
2662
  };
2481
- const unionValuesOf = (checker) => (node) => literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(Option.filter((values) => !selectsKeys(checker)(node, values)));
2663
+ const FILTERED_TYPE = 0;
2664
+ const isConditionalAlias = (checker) => (reference) => isTypeReferenceNode(reference) && Option.fromUndefinedOr(checker.getSymbolAtLocation(reference.typeName)).pipe(Option.map(declarationsOf), Option.exists(Array.some((declaration) => isTypeAliasDeclaration(declaration) && declaration.type.kind === SyntaxKind.ConditionalType)));
2665
+ const filtersBy = (checker) => (node) => {
2666
+ const { parent } = node;
2667
+ if (isTypeReferenceNode(parent)) {
2668
+ const typeArguments = parent.typeArguments ?? [];
2669
+ if (Array.findFirstIndex(typeArguments, (argument) => argument === node).pipe(Option.exists((position) => position > FILTERED_TYPE)) && isConditionalAlias(checker)(parent)) return true;
2670
+ }
2671
+ return parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent);
2672
+ };
2673
+ const unionValuesOf = (checker) => (node) => literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(Option.filter((values) => !selectsKeys(checker)(node, values) && !filtersBy(checker)(node)));
2482
2674
  const isExpressionSite = (node) => isArrayLiteralExpression(node) || isCallExpression(node);
2483
2675
  const expressionSiteValuesOf = (checker) => (node) => Option.liftPredicate(node, isExpressionSite).pipe(Option.flatMap(expressionValuesOf(checker)));
2484
2676
  const siteValuesOf = (checker) => (node) => {
@@ -2500,6 +2692,7 @@ const sitesUnder = (checker) => (node) => {
2500
2692
  sources: sourcesOf(checker)(node)
2501
2693
  })), Option.toArray);
2502
2694
  };
2695
+ const sitesOutside = (checker) => (project, outers) => pipe(project.sourceFiles, Array.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)), Array.filter((site) => !isInsideAny(outers)(site.node)));
2503
2696
  // src/features/value-owners/model/value-checks.ts
2504
2697
  const OWNER_SEARCH_DEPTH = 4;
2505
2698
  const NOTHING_HIDDEN = 0;
@@ -2525,7 +2718,7 @@ const derivedVerdict = (context) => (site) => {
2525
2718
  const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
2526
2719
  if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
2527
2720
  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.`;
2528
- return verdict([problemAt$5({
2721
+ return verdict([problemAt$6({
2529
2722
  rule: "owner-extension",
2530
2723
  message
2531
2724
  })(site.node)], []);
@@ -2547,7 +2740,7 @@ const originalVerdict = (context) => (site) => {
2547
2740
  const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
2548
2741
  if (Array.isReadonlyArrayNonEmpty(owners)) {
2549
2742
  const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
2550
- return verdict([problemAt$5({
2743
+ return verdict([problemAt$6({
2551
2744
  rule: "owner-value-set",
2552
2745
  message
2553
2746
  })(site.node)], []);
@@ -2555,7 +2748,7 @@ const originalVerdict = (context) => (site) => {
2555
2748
  const candidates = libraryCandidates(context)(site);
2556
2749
  if (Array.isReadonlyArrayNonEmpty(candidates)) {
2557
2750
  const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
2558
- return verdict([problemAt$5({
2751
+ return verdict([problemAt$6({
2559
2752
  rule: "library-value-set",
2560
2753
  message
2561
2754
  })(site.node)], []);
@@ -2586,23 +2779,17 @@ const isValuePosition = (node) => {
2586
2779
  const { parent } = node;
2587
2780
  return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
2588
2781
  };
2589
- 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$5({
2782
+ 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$6({
2590
2783
  rule: "owned-literal",
2591
2784
  message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
2592
2785
  })(literal)));
2593
- const ownedLiteralProblems = (context) => (sourceFile, excluded) => Array.getSomes(pipe(descendantsOf(sourceFile), Array.filter((node) => isStringLiteral(node) || isNumericLiteral(node)), Array.filter((node) => isValuePosition(node)), Array.filter((node) => !pipe(excluded, Array.some((outer) => contains(outer)(node)))), Array.map((node) => ownedLiteralProblem(context)(node))));
2786
+ const ownedLiteralProblems = (context) => (sourceFile, excluded) => Array.getSomes(pipe(descendantsOf(sourceFile), Array.filter((node) => isStringLiteral(node) || isNumericLiteral(node)), Array.filter((node) => isValuePosition(node)), Array.filter((node) => !isInsideAny(excluded)(node)), Array.map((node) => ownedLiteralProblem(context)(node))));
2594
2787
  // src/features/value-owners/model/analysis.ts
2595
2788
  const isVisibleTo = (project) => (owner) => pipe(project.sourceFiles, Array.some((sourceFile) => sourceFile.fileName === owner.file)) || Option.exists(owner.packageName, (name) => Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name));
2596
- const ownerDeclarationsIn = (project, owners) => {
2597
- const keys = new Set(pipe(owners, Array.map((owner) => owner.key)));
2598
- return pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(descendantsOf(sourceFile), Array.filter((node) => isVariableDeclaration(node)), Array.filter((declaration) => Option.exists(ownerKeyOf(declaration), (key) => keys.has(key))))));
2599
- };
2600
- const isInside = (outers) => (node) => pipe(outers, Array.some((outer) => contains(outer)(node)));
2601
- const sitesOutside = (checker) => (project, outers) => pipe(project.sourceFiles, Array.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)), Array.filter((site) => !isInside(outers)(site.node)));
2602
2789
  const nodesOf = (sites) => pipe(sites, Array.map((site) => site.node));
2603
2790
  const analyzeProject = ({ owners, sourceChecks }) => (project) => {
2604
2791
  const { checker } = project;
2605
- const ownerDeclarations = ownerDeclarationsIn(project, owners);
2792
+ const ownerDeclarations = ownerDeclarationsIn(owners)(project);
2606
2793
  const sites = sitesOutside(checker)(project, ownerDeclarations);
2607
2794
  const flowContext = {
2608
2795
  checker,
@@ -2628,7 +2815,8 @@ const analyzeProject = ({ owners, sourceChecks }) => (project) => {
2628
2815
  ...shapeProblemsIn(shapeContext)(sourceFile),
2629
2816
  ...pipe(sourceChecks, Array.flatMap((check) => check(checker)(sourceFile)))
2630
2817
  ]))],
2631
- unowned: pipe(verdicts, Array.flatMap((found) => found.unowned))
2818
+ unowned: pipe(verdicts, Array.flatMap((found) => found.unowned)),
2819
+ literals: fileFactsIn(checker)(project.sourceFiles, excluded)
2632
2820
  };
2633
2821
  };
2634
2822
  // src/features/value-owners/model/cache.ts
@@ -2645,11 +2833,19 @@ const EMPTY = "";
2645
2833
  const FIELD_SEPARATOR = "\0";
2646
2834
  const LINE_SEPARATOR = "\n";
2647
2835
  const ValueSchema = Schema.Union([Schema.String, Schema.Finite]);
2836
+ const Strings = Schema.Array(Schema.String);
2837
+ const ScopeSchema = Schema.Struct({
2838
+ name: Schema.String,
2839
+ dependencies: Strings
2840
+ });
2841
+ const FileLiteralsSchema = Schema.Struct({
2842
+ scope: ScopeSchema,
2843
+ file: Schema.String,
2844
+ values: Strings,
2845
+ imports: Strings
2846
+ });
2648
2847
  const UnownedSiteSchema = Schema.Struct({
2649
- scope: Schema.Struct({
2650
- name: Schema.String,
2651
- dependencies: Schema.Array(Schema.String)
2652
- }),
2848
+ scope: ScopeSchema,
2653
2849
  file: Schema.String,
2654
2850
  start: Schema.Int,
2655
2851
  line: Schema.Int,
@@ -2658,7 +2854,8 @@ const UnownedSiteSchema = Schema.Struct({
2658
2854
  });
2659
2855
  const AnalysisSchema = Schema.Struct({
2660
2856
  problems: ProblemList,
2661
- unowned: Schema.Array(UnownedSiteSchema)
2857
+ unowned: Schema.Array(UnownedSiteSchema),
2858
+ literals: Schema.Array(FileLiteralsSchema)
2662
2859
  });
2663
2860
  const AnalysisJson = Schema.fromJsonString(AnalysisSchema);
2664
2861
  const hasher = Effect.gen(function* currentHasher() {
@@ -2751,7 +2948,7 @@ const unownedSiteOf = (scope) => (site) => ({
2751
2948
  column: columnOf(site.node),
2752
2949
  values: site.values
2753
2950
  });
2754
- const canDerive = (left, right) => left.scope.name === right.scope.name || left.scope.dependencies.includes(right.scope.name) || right.scope.dependencies.includes(left.scope.name);
2951
+ const canDerive$1 = (left, right) => left.scope.name === right.scope.name || left.scope.dependencies.includes(right.scope.name) || right.scope.dependencies.includes(left.scope.name);
2755
2952
  const siteKey = (site) => `${site.file}#${String(site.start)}`;
2756
2953
  const valueSetKey = (site) => {
2757
2954
  const keys = pipe(site.values, Array.map((value) => valueKey(value)));
@@ -2761,7 +2958,7 @@ const duplicateProblems = (relative) => (sites) => {
2761
2958
  const unique = Array.dedupeWith(sites, (left, right) => siteKey(left) === siteKey(right));
2762
2959
  const groups = Record.values(Array.groupBy(unique, (site) => valueSetKey(site)));
2763
2960
  return pipe(groups, Array.filter((group) => group.length > DUPLICATE_THRESHOLD), Array.flatMap((group) => pipe(group, Array.flatMap((site) => {
2764
- const related = pipe(group, Array.filter((other) => other !== site && canDerive(site, other)));
2961
+ const related = pipe(group, Array.filter((other) => other !== site && canDerive$1(site, other)));
2765
2962
  if (!Array.isReadonlyArrayNonEmpty(related)) return [];
2766
2963
  const others = pipe(related, Array.map((other) => `${relative(other.file)}:${String(other.line)}`), Array.join(", "));
2767
2964
  return [{
@@ -2773,6 +2970,154 @@ const duplicateProblems = (relative) => (sites) => {
2773
2970
  }];
2774
2971
  }))));
2775
2972
  };
2973
+ // src/features/value-owners/model/name-lists.ts
2974
+ const RULE$14 = "hand-written-names";
2975
+ const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
2976
+ const nameListOf = (site) => {
2977
+ if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
2978
+ const names = pipe(site.values, Array.filter(Predicate.isString));
2979
+ return Option.liftPredicate({
2980
+ site,
2981
+ names
2982
+ }, (list) => list.names.length === site.values.length);
2983
+ };
2984
+ const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
2985
+ const problemOf$4 = ({ list, reason }) => ({
2986
+ file: list.site.file,
2987
+ line: list.site.line,
2988
+ column: list.site.column,
2989
+ rule: RULE$14,
2990
+ message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
2991
+ });
2992
+ // src/features/value-owners/model/declared-names.ts
2993
+ const MOST_DEFINING_FILES = 2;
2994
+ const SINGLE_NAME = 1;
2995
+ const SHOWN_FILES = 3;
2996
+ const canDerive = (left, right) => left.name === right.name || left.dependencies.includes(right.name) || right.dependencies.includes(left.name);
2997
+ const definitionsOf = (entry) => pipe(entry.values, Array.map((value) => [value, {
2998
+ scope: entry.scope,
2999
+ file: entry.file
3000
+ }]));
3001
+ const uniqueFiles = (pairs) => pipe(pairs, Array.map(([, defined]) => defined), Array.dedupeWith((left, right) => left.file === right.file));
3002
+ const definedIndexOf = (files) => pipe(files, Array.filter((entry) => !TEST_FILE.test(entry.file)), Array.flatMap(definitionsOf), Array.groupBy(([value]) => value), Record.map(uniqueFiles));
3003
+ const ownedOneByOne = (defined) => {
3004
+ const hosted = pipe(defined, Array.flatMap(([, files]) => files), Array.groupBy((file) => file), Record.map((files) => files.length));
3005
+ const hostsOne = (file) => Record.get(hosted, file).pipe(Option.exists((count) => count === SINGLE_NAME));
3006
+ return pipe(defined, Array.map(([name, files]) => [name, pipe(files, Array.filter(hostsOne))]));
3007
+ };
3008
+ const filesDefining = (index, list) => (name) => {
3009
+ return [name, pipe(Record.get(index, name), Option.getOrElse(() => []), Array.filter((defined) => defined.file !== list.site.file && canDerive(list.site.scope, defined.scope)), Array.map((defined) => defined.file))];
3010
+ };
3011
+ const definingFiles = (index) => (list) => pipe(list.names, Array.map(filesDefining(index, list)), ownedOneByOne, Array.filter(([, files]) => Array.isReadonlyArrayNonEmpty(files) && files.length <= MOST_DEFINING_FILES));
3012
+ const declaredNameProblem = ({ literals, relative }) => {
3013
+ const index = definedIndexOf(literals);
3014
+ return (list) => {
3015
+ const defined = definingFiles(index)(list);
3016
+ const files = pipe(defined, Array.flatMap(([, found]) => found), Array.dedupe);
3017
+ if (defined.length < mostNamesOf(list) || files.length < 2) return Option.none();
3018
+ const names = pipe(defined, Array.map(([name]) => name));
3019
+ const shown = pipe(files, Array.take(SHOWN_FILES), Array.map(relative), Array.join(", "));
3020
+ return Option.some(problemOf$4({
3021
+ list,
3022
+ reason: `${formatValues(names)} are each written in another module (${shown}). Type those values with this list, or build this list from them, so that adding one does not mean editing two places.`
3023
+ }));
3024
+ };
3025
+ };
3026
+ // src/features/value-owners/model/listed-paths.ts
3027
+ const PATH_PREFIX = /^(?:!|\.\/)+/u;
3028
+ const GLOB = /[*?{[]/u;
3029
+ const EXTENSION$1 = /\.[^./]+$/u;
3030
+ const SEPARATOR$5 = "/";
3031
+ const ROOT = ".";
3032
+ const namedPath = (repository, file) => (name) => {
3033
+ const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
3034
+ if (GLOB.test(bare) || String$1.isEmpty(bare)) return Option.none();
3035
+ const fromFile = repository.relative(repository.join(repository.dirname(file), bare));
3036
+ return pipe([fromFile, bare], Array.findFirst((path) => HashSet.has(repository.paths, path)));
3037
+ };
3038
+ const kindOf = (repository) => (path) => {
3039
+ if (HashSet.has(repository.directories, path)) return SEPARATOR$5;
3040
+ return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array.head), Option.getOrElse(() => path));
3041
+ };
3042
+ const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
3043
+ const coversDirectory = (repository) => (group) => pipe(Array.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
3044
+ const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$5}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
3045
+ const directoryLabel = (directory) => {
3046
+ if (directory === ROOT) return "the repository root";
3047
+ return directory;
3048
+ };
3049
+ const listedPathProblem = (repository) => (list) => {
3050
+ const paths = pipe(list.names, Array.map(namedPath(repository, list.site.file)), Array.getSomes);
3051
+ const packages = pipe(list.names, Array.filter((name) => HashSet.has(repository.packages, name)));
3052
+ const directory = enumeratedDirectory(repository)(paths);
3053
+ if (Option.isSome(directory)) return Option.some(problemOf$4({
3054
+ list,
3055
+ reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`
3056
+ }));
3057
+ if (packages.length >= 2) return Option.some(problemOf$4({
3058
+ list,
3059
+ reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`
3060
+ }));
3061
+ return Option.none();
3062
+ };
3063
+ // src/features/value-owners/model/subset-lists.ts
3064
+ const SUBSET_SHARE = 2;
3065
+ const canImport = (importer, imported) => importer.name === imported.name || importer.dependencies.includes(imported.name);
3066
+ const importIndexOf = (files) => pipe(files, Array.map((entry) => [entry.file, entry.imports]), Record.fromEntries);
3067
+ const imports = (index) => (importer, imported) => Record.get(index, importer).pipe(Option.exists(Array.contains(imported)));
3068
+ const connected = (index) => (left, right) => left === right || imports(index)(left, right) || imports(index)(right, left);
3069
+ const isPartOf = (index, list) => (other) => other !== list && canImport(list.site.scope, other.site.scope) && connected(index)(list.site.file, other.site.file) && isSubsetOf(list.names, other.names) && list.names.length * SUBSET_SHARE >= other.names.length && !sameValues(list.names, other.names);
3070
+ const subsetListProblem = ({ lists, literals, relative }) => {
3071
+ const index = importIndexOf(literals);
3072
+ return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$4({
3073
+ list,
3074
+ reason: `they are a part of ${formatValues(other.names)} at ${relative(other.site.file)}:${String(other.site.line)}. Name that list once and select from it with Extract or Exclude.`
3075
+ })));
3076
+ };
3077
+ // src/features/value-owners/model/hand-lists.ts
3078
+ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
3079
+ const lists = pipe(sites, Array.dedupeWith((left, right) => left.file === right.file && left.start === right.start), Array.map(nameListOf), Array.getSomes);
3080
+ const { relative } = repository;
3081
+ const listedPath = listedPathProblem(repository);
3082
+ const declared = declaredNameProblem({
3083
+ literals,
3084
+ relative
3085
+ });
3086
+ const subset = subsetListProblem({
3087
+ lists,
3088
+ literals,
3089
+ relative
3090
+ });
3091
+ return pipe(lists, Array.map((list) => listedPath(list).pipe(Option.orElse(() => declared(list)), Option.orElse(() => subset(list)))), Array.getSomes);
3092
+ };
3093
+ // src/features/value-owners/model/repository-names.ts
3094
+ const MANIFEST$1 = "package.json";
3095
+ const SEPARATOR$4 = "/";
3096
+ const FIRST_SEGMENT = 1;
3097
+ const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
3098
+ const decodeManifest$1 = Schema.decodeUnknownOption(ManifestJson);
3099
+ const prefixesOf = (file) => {
3100
+ const segments = pipe(file, String$1.split(SEPARATOR$4));
3101
+ return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$4))));
3102
+ };
3103
+ const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
3104
+ const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$1), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
3105
+ const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
3106
+ const files = yield* RepositoryFiles;
3107
+ const listed = yield* files.listedFiles(root);
3108
+ const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === MANIFEST$1), Effect.forEach((manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf))));
3109
+ const paths = pipe(listed, Array.flatMap(prefixesOf), Array.dedupe);
3110
+ return {
3111
+ root,
3112
+ paths: HashSet.fromIterable(paths),
3113
+ directories: HashSet.fromIterable(pipe(listed, Array.flatMap(directoriesOf$1))),
3114
+ entries: pipe(paths, Array.groupBy(files.dirname)),
3115
+ packages: HashSet.fromIterable(Array.getSomes(names)),
3116
+ relative: (file) => files.relative(root, file),
3117
+ join: files.join,
3118
+ dirname: files.dirname
3119
+ };
3120
+ });
2776
3121
  // src/features/value-owners/model/check.ts
2777
3122
  const scanOwners = Effect.fn("scanOwners")(function* scanOwners(workspace, configPaths) {
2778
3123
  const ownerConfigs = yield* pipe(configPaths, Effect.filter(mentions$1(`@${OWNER_TAG}`)(workspace.compiler)));
@@ -2791,7 +3136,11 @@ const freshAnalysis = ({ workspace, owners, sourceChecks }) => (configPath) => w
2791
3136
  const scope = scopeOf(project, configPath);
2792
3137
  return {
2793
3138
  problems: analysis.problems,
2794
- unowned: pipe(analysis.unowned, Array.map(unownedSiteOf(scope)))
3139
+ unowned: pipe(analysis.unowned, Array.map(unownedSiteOf(scope))),
3140
+ literals: pipe(analysis.literals, Array.map((entry) => ({
3141
+ ...entry,
3142
+ scope
3143
+ })))
2795
3144
  };
2796
3145
  }).pipe(Effect.withSpan("analyzeProject")));
2797
3146
  const keyedAnalysis = (context) => (configPath, key) => Effect.gen(function* lookupAnalysis() {
@@ -2835,6 +3184,18 @@ const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(w
2835
3184
  yield* pruneAnalyses(cache)(pipe(found, Array.map(([key]) => key)));
2836
3185
  return pipe(found, Array.map(([, analysis]) => analysis));
2837
3186
  });
3187
+ const repositoryProblems = (repository) => (analyses) => {
3188
+ const unowned = pipe(analyses, Array.flatMap((analysis) => analysis.unowned));
3189
+ const literals = pipe(analyses, Array.flatMap((analysis) => analysis.literals));
3190
+ return [
3191
+ ...pipe(analyses, Array.flatMap((analysis) => analysis.problems)),
3192
+ ...duplicateProblems(repository.relative)(unowned),
3193
+ ...handWrittenNameProblems({
3194
+ repository,
3195
+ literals
3196
+ })(unowned)
3197
+ ];
3198
+ };
2838
3199
  const checkRepository = Effect.fn("checkRepository")(function* checkRepository(root, sourceChecks = []) {
2839
3200
  const files = yield* RepositoryFiles;
2840
3201
  const workspace = {
@@ -2848,13 +3209,8 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
2848
3209
  owners: ownerScan.owners,
2849
3210
  sourceChecks
2850
3211
  }, configPaths);
2851
- const relative = (file) => files.relative(root, file);
2852
- const unowned = pipe(analyses, Array.flatMap((analysis) => analysis.unowned));
2853
- return sortProblems([
2854
- ...ownerScan.problems,
2855
- ...pipe(analyses, Array.flatMap((analysis) => analysis.problems)),
2856
- ...duplicateProblems(relative)(unowned)
2857
- ]);
3212
+ const repository = yield* repositoryNamesOf(root);
3213
+ return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
2858
3214
  }, Effect.scoped);
2859
3215
  // src/app/source-checks.ts
2860
3216
  /** @internal */