@r_masseater/msch 0.54.0 → 0.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/README.md +18 -18
  2. package/dist/app-B22Gq0no.mjs +2120 -0
  3. package/dist/app-B22Gq0no.mjs.map +1 -0
  4. package/dist/cargo-inputs.d.mts +1 -1
  5. package/dist/cargo-inputs.mjs +5 -11
  6. package/dist/cargo-inputs.mjs.map +1 -1
  7. package/dist/changed.mjs +90 -19
  8. package/dist/changed.mjs.map +1 -1
  9. package/dist/cli.mjs +1361 -707
  10. package/dist/cli.mjs.map +1 -1
  11. package/dist/config.d.mts +1 -1
  12. package/dist/config.mjs +3 -2
  13. package/dist/config.mjs.map +1 -1
  14. package/dist/credential-broker-9FMyTp1H.mjs +44 -0
  15. package/dist/credential-broker-9FMyTp1H.mjs.map +1 -0
  16. package/dist/decision-rules.d.mts +1 -1
  17. package/dist/decision-rules.mjs +1 -1
  18. package/dist/{define-lint-preset-CWEkZVIC.mjs → define-lint-preset-DeLIlDuA.mjs} +7 -634
  19. package/dist/define-lint-preset-DeLIlDuA.mjs.map +1 -0
  20. package/dist/dependencies-B6p7x90y.mjs +215 -0
  21. package/dist/dependencies-B6p7x90y.mjs.map +1 -0
  22. package/dist/exits.mjs +4 -5
  23. package/dist/exits.mjs.map +1 -1
  24. package/dist/{ignored-directories-BTMTNuAx.mjs → ignored-directories-BgUqwuc4.mjs} +12 -3
  25. package/dist/ignored-directories-BgUqwuc4.mjs.map +1 -0
  26. package/dist/{index-BeH2yfX6.d.mts → index-Cwnhs7VE.d.mts} +4 -51
  27. package/dist/library.d.mts +18 -0
  28. package/dist/library.mjs +28 -0
  29. package/dist/library.mjs.map +1 -0
  30. package/dist/lint-rules.mjs +243 -40
  31. package/dist/lint-rules.mjs.map +1 -1
  32. package/dist/lint.d.mts +2 -2
  33. package/dist/lint.mjs +1 -1
  34. package/dist/locked-inputs-DMSoGCa-.mjs +20 -0
  35. package/dist/locked-inputs-DMSoGCa-.mjs.map +1 -0
  36. package/dist/locked-inputs.d.mts +2 -3
  37. package/dist/locked-inputs.mjs +1 -20
  38. package/dist/oxlint.mjs +28 -14
  39. package/dist/oxlint.mjs.map +1 -1
  40. package/dist/{project-C4uzq7_4.mjs → pass-records-BCT1Ls9c.mjs} +38 -66
  41. package/dist/pass-records-BCT1Ls9c.mjs.map +1 -0
  42. package/dist/{problem-CzOlOb5f.mjs → problem-BoHYLMQT.mjs} +10 -6
  43. package/dist/problem-BoHYLMQT.mjs.map +1 -0
  44. package/dist/publish.mjs +634 -303
  45. package/dist/publish.mjs.map +1 -1
  46. package/dist/published-BNJdq0h1.mjs +510 -0
  47. package/dist/published-BNJdq0h1.mjs.map +1 -0
  48. package/dist/runtime-LT40e_l3.mjs +28 -0
  49. package/dist/runtime-LT40e_l3.mjs.map +1 -0
  50. package/dist/{syntax-3AJkpCcs.mjs → syntax-CTiXR0EJ.mjs} +13 -4
  51. package/dist/syntax-CTiXR0EJ.mjs.map +1 -0
  52. package/dist/{check-upstream-exits-DYxWDyHC.mjs → upstream-exits-DitN-yYH.mjs} +10 -92
  53. package/dist/upstream-exits-DitN-yYH.mjs.map +1 -0
  54. package/dist/wake.d.mts +1 -0
  55. package/dist/wake.mjs +25 -0
  56. package/dist/wake.mjs.map +1 -0
  57. package/dist/workspace-settings.mjs +69 -7
  58. package/dist/workspace-settings.mjs.map +1 -1
  59. package/package.json +31 -22
  60. package/skills/{publishing → msch-publishing}/SKILL.md +8 -2
  61. package/skills/{repository-config → msch-repository-config}/SKILL.md +5 -2
  62. package/skills/{workspace-settings → msch-workspace-settings}/SKILL.md +4 -3
  63. package/dist/check-upstream-exits-DYxWDyHC.mjs.map +0 -1
  64. package/dist/define-lint-preset-CWEkZVIC.mjs.map +0 -1
  65. package/dist/dependencies-DCJv7YcW.mjs +0 -684
  66. package/dist/dependencies-DCJv7YcW.mjs.map +0 -1
  67. package/dist/ignored-directories-BTMTNuAx.mjs.map +0 -1
  68. package/dist/locked-inputs.mjs.map +0 -1
  69. package/dist/package-LeBO9czg.mjs +0 -144
  70. package/dist/package-LeBO9czg.mjs.map +0 -1
  71. package/dist/problem-CzOlOb5f.mjs.map +0 -1
  72. package/dist/project-C4uzq7_4.mjs.map +0 -1
  73. package/dist/reachable-Cc-255L3.mjs +0 -13
  74. package/dist/reachable-Cc-255L3.mjs.map +0 -1
  75. package/dist/runtime-DFsdNYI0.mjs +0 -29
  76. package/dist/runtime-DFsdNYI0.mjs.map +0 -1
  77. package/dist/syntax-3AJkpCcs.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,17 +1,19 @@
1
1
  #!/usr/bin/env node
2
- import { B as propertyValue, C as RUN_TASKS, E as hasVerifyTask, F as KeySchema, I as childrenOf$1, L as keyName, P as workspaceConfigOf, R as literalOf, T as definesTask, V as stringsIn, _ as publishedProjects, a as cratesIn, b as workspaceManifest, c as workspaceLinks, d as deployEntries, f as namedWorkspaces, h as shadcnUiOf, l as lockedGraph, o as owningWorkspace, p as patternOf$1, r as readManifest, t as MANIFEST_FILE$3, u as lockedPackages, v as workspaceDirectories, w as VERIFY_TASK, x as runTasksOf, y as workspaceProjects, z as nestedValues } from "./dependencies-DCJv7YcW.mjs";
3
- import { C as valueKey, S as schemaTypeOf, _ as formatValues, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as recordsIn, l as mentions$1, m as isObjectType, n as contentKey, o as projectInputs, p as describeLibraryType, r as keepOnly, t as implementationFingerprint, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./project-C4uzq7_4.mjs";
2
+ import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-BNJdq0h1.mjs";
3
+ import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-B6p7x90y.mjs";
4
+ import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-BCT1Ls9c.mjs";
4
5
  import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
5
- import { a as isRecord, c as isScannedText, d as presentFiles, f as scanText, i as collectNodes, l as isToolVersions, n as checkUpstreamExits, o as tomlSourceComments, p as positionOf, s as yamlSourceComments, t as checkScatteredDeviations, u as listedFiles } from "./check-upstream-exits-DYxWDyHC.mjs";
6
- import { a as publicEntriesOf, i as EntryManifestJson, r as publishedWorkspaces } from "./package-LeBO9czg.mjs";
7
- import { a as problemInFile, i as problemAt$8, o as sortProblems, r as formatProblem, t as ProblemList } from "./problem-CzOlOb5f.mjs";
6
+ import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-DitN-yYH.mjs";
7
+ import { n as baseName, r as isInside, t as matcher } from "./app-B22Gq0no.mjs";
8
+ import { a as problemAtPosition, i as problemAt$8, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-BoHYLMQT.mjs";
8
9
  import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-CXgB6xpE.mjs";
9
10
  import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
10
- import { $ as isSpreadElement, A as isBlock, B as isInterfaceDeclaration, C as getJSDocTags, D as isArrayLiteralExpression, E as getTextOfJSDocComment, F as isExportDeclaration, G as isObjectLiteralExpression, H as isModuleDeclaration, I as isFunctionDeclaration, J as isPropertyAssignment, K as isParenthesizedExpression, L as isFunctionExpression, M as isClassDeclaration, N as isElementAccessExpression, O as isArrowFunction, P as isEnumDeclaration, Q as isSourceFile, R as isIdentifier, S as SyntaxKind, T as getNameOfDeclaration, U as isNewExpression, V as isModuleBlock, W as isNumericLiteral, X as isSatisfiesExpression, Y as isReturnStatement, Z as isSignatureDeclaration, _ as uniqueByReference, a as descendantsOf, at as isVariableDeclaration, c as isGenericDeclaration, d as lineOf$3, et as isStringLiteral, f as packageOf$1, g as symbolAt, i as declarationsOf, it as isUnionTypeNode, j as isCallExpression, k as isBinaryExpression, l as isInsideAny, m as referencedSymbols, n as columnOf, nt as isTypeLiteralNode, o as importedModulesOf, ot as isVariableDeclarationList, p as propertyNamesOf, q as isPropertyAccessExpression, r as contains, rt as isTypeReferenceNode, s as isExternalDeclaration, st as isVariableStatement, t as childrenOf$2, tt as isTypeAliasDeclaration, u as isTypeDeclaration, x as SignatureKind, z as isImportDeclaration } from "./syntax-3AJkpCcs.mjs";
11
- import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-DFsdNYI0.mjs";
11
+ import { $ as isPropertyAssignment, A as getTextOfJSDocComment, B as isExpressionStatement, D as getJSDocTags, E as SyntaxKind, F as isCallExpression, G as isInterfaceDeclaration, H as isFunctionExpression, I as isClassDeclaration, J as isNewExpression, K as isModuleBlock, L as isElementAccessExpression, M as isArrowFunction, N as isBinaryExpression, P as isBlock, Q as isPropertyAccessExpression, R as isEnumDeclaration, T as SymbolFlags, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as referencedSymbols, a as declarationsOf, at as isStringLiteral, b as uniqueByReference, c as importedModulesOf, ct as isTypeReferenceNode, d as isInsideAny, dt as isVariableDeclarationList, et as isReturnStatement, f as isOutsideDeclaration, ft as isVariableStatement, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSpreadElement, j as isArrayLiteralExpression, k as getNameOfDeclaration, l as isExternalDeclaration, lt as isUnionTypeNode, m as lineOf$3, n as childrenOf$2, nt as isSignatureDeclaration, o as declaresAType, ot as isTypeAliasDeclaration, p as isTypeDeclaration, q as isModuleDeclaration, r as columnOf, rt as isSourceFile, s as descendantsOf, st as isTypeLiteralNode, t as carriesTag, tt as isSatisfiesExpression, u as isGenericDeclaration, ut as isVariableDeclaration, w as SignatureKind, y as symbolAt, z as isExportDeclaration } from "./syntax-CTiXR0EJ.mjs";
12
+ import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-LT40e_l3.mjs";
12
13
  import "./cli-contract-D7btWrEu.mjs";
14
+ import { builtinModules } from "node:module";
13
15
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
14
- import { Array, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
16
+ import { Array, Boolean as Boolean$1, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
15
17
  import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
16
18
  import { ChildProcess } from "effect/process";
17
19
  import { parse, resolveConfigFromFile } from "vite-plus";
@@ -19,17 +21,110 @@ import { parse as parse$1 } from "@pnpm/deps.path";
19
21
  import { fileURLToPath } from "node:url";
20
22
  import treeSitter from "@vscode/tree-sitter-wasm";
21
23
  import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
24
+ import { rolldown } from "vite/rolldown";
25
+ import { stripVTControlCharacters } from "node:util";
22
26
  import semver from "semver";
23
27
  import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
24
28
  import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
25
29
  import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4";
26
- import path from "node:path";
27
30
  import { isComment, isTag, isText } from "domhandler";
28
31
  import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
29
32
  import { DockerfileParser } from "dockerfile-ast";
30
33
  import { parse as parse$3 } from "sql-parser-cst";
31
34
  import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
32
35
  import { findSkillFiles } from "@tanstack/intent";
36
+ // src/entities/workspace/model/run-tasks.ts
37
+ const TaskProperty = Schema.Struct({
38
+ type: Schema.Literal("Property"),
39
+ computed: Schema.Literal(false),
40
+ key: KeySchema,
41
+ value: Schema.Unknown,
42
+ start: Schema.Finite
43
+ });
44
+ const TaskObject = Schema.Struct({
45
+ type: Schema.Literal("ObjectExpression"),
46
+ properties: Schema.Array(Schema.Unknown)
47
+ });
48
+ const decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);
49
+ const decodeTaskObject = Schema.decodeUnknownOption(TaskObject);
50
+ const tasksIn = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap((tasks) => pipe(decodeTaskObject(tasks), Option.map(({ properties }) => properties), Option.getOrElse(() => []))), Array.flatMap((property) => Option.toArray(decodeTaskProperty(property))));
51
+ const runTasksOf = Effect.fn("runTasksOf")(function* runTasksOf(root, directory) {
52
+ const config = yield* workspaceConfigOf(root, directory);
53
+ return pipe(config, Option.map(({ file, source, program }) => ({
54
+ file,
55
+ source,
56
+ tasks: tasksIn(program)
57
+ })));
58
+ });
59
+ // src/entities/workspace/model/workspace-names.ts
60
+ const ALTERNATIVE$1 = "|";
61
+ const SCOPE$3 = /^@[^/]+\//u;
62
+ const SPECIAL$1 = /[$()*+.?[\\\]^{|}]/gu;
63
+ /** @internal */
64
+ const patternOf$1 = (names) => {
65
+ const alternatives = pipe(names, Array.map(String$1.replaceAll(SPECIAL$1, String.raw`\$&`)));
66
+ return new RegExp(`(?<![\\p{L}\\p{N}_-])(?:${Array.join(alternatives, ALTERNATIVE$1)})(?![\\p{L}\\p{N}_-])`, "gu");
67
+ };
68
+ const namedIn = (basename) => ({ directory, packageName }) => {
69
+ const unscoped = pipe(packageName, Option.map(String$1.replace(SCOPE$3, "")));
70
+ return {
71
+ directory,
72
+ names: pipe([
73
+ Option.some(directory),
74
+ Option.some(basename(directory)),
75
+ packageName,
76
+ unscoped
77
+ ], Array.getSomes, Array.dedupe),
78
+ packageName
79
+ };
80
+ };
81
+ /** @internal */
82
+ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(root) {
83
+ const files = yield* RepositoryFiles;
84
+ const projects = yield* workspaceProjects(root);
85
+ return pipe(projects, Array.map(namedIn((directory) => files.basename(directory))));
86
+ });
87
+ // src/entities/workspace/model/cargo-crates.ts
88
+ const SEPARATOR$21 = "/";
89
+ const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
90
+ const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
91
+ const CrateEntry = Schema.Struct({
92
+ name: Schema.String,
93
+ version: Schema.String,
94
+ manifest_path: Schema.String,
95
+ targets: Schema.Array(CrateTarget),
96
+ dependencies: Schema.Array(CrateDependency)
97
+ });
98
+ const CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));
99
+ const decodeCrateList = Schema.decodeUnknownEffect(CrateList);
100
+ const crateOf$1 = (crate) => ({
101
+ name: crate.name,
102
+ version: crate.version,
103
+ manifest: crate.manifest_path,
104
+ kinds: pipe(crate.targets, Array.flatMap(({ kind }) => kind), Array.dedupe),
105
+ pathDependencies: pipe(crate.dependencies, Array.flatMap(({ path }) => Option.toArray(Option.fromUndefinedOr(path))))
106
+ });
107
+ /** @internal */
108
+ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
109
+ const output = yield* (yield* ChildProcess.make("cargo", [
110
+ "metadata",
111
+ "--no-deps",
112
+ "--format-version",
113
+ "1",
114
+ "--offline"
115
+ ], {
116
+ cwd: root,
117
+ extendEnv: true,
118
+ stdin: "ignore"
119
+ })).stdout.pipe(Stream.decodeText(), Stream.mkString);
120
+ const list = yield* decodeCrateList(output);
121
+ return pipe(list.packages, Array.map(crateOf$1));
122
+ }, Effect.scoped);
123
+ /** @internal */
124
+ const owningWorkspace = (directories) => (directory) => {
125
+ const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$21}`)(directory)));
126
+ return Array.last(Array.sort(owners, String$1.Order));
127
+ };
33
128
  // src/features/check-overrides/model/override-findings.ts
34
129
  const describeVersions = (versions) => Option.getOrElse(Option.liftPredicate(Array.join(versions, ","), (joined) => joined !== ""), () => "-");
35
130
  const describeChanges = (report) => {
@@ -55,6 +150,56 @@ const overrideProblem = (located) => (report) => {
55
150
  });
56
151
  return Option.none();
57
152
  };
153
+ // src/entities/project/model/implementation.ts
154
+ const MANIFEST_ENTRY = "package.json";
155
+ const SOURCE_ENTRY = "src";
156
+ const LOWER_LAYERS = ["entities", "shared"];
157
+ const PATH_SEPARATOR = "/";
158
+ const NOT_INSTALLED = [];
159
+ const walked = (directory) => Effect.gen(function* walkFrom() {
160
+ const files = yield* RepositoryFiles;
161
+ const found = yield* files.walkDirectory(directory);
162
+ return pipe(found, Array.map((file) => files.join(directory, file)));
163
+ });
164
+ const sourceFiles = Effect.fn("sourceFiles")(function* sourceFiles(root, moduleDirectory) {
165
+ const files = yield* RepositoryFiles;
166
+ const source = files.join(root, SOURCE_ENTRY);
167
+ const layers = pipe(LOWER_LAYERS, Array.map((layer) => files.join(source, layer)));
168
+ const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, { concurrency: 1 });
169
+ return Array.flatten(nested);
170
+ });
171
+ const bundleParts = Effect.fn("bundleParts")(function* bundleParts(root, moduleDirectory) {
172
+ const files = yield* RepositoryFiles;
173
+ const bundled = yield* walked(moduleDirectory);
174
+ return {
175
+ listed: [files.join(root, MANIFEST_ENTRY), ...bundled],
176
+ installed: NOT_INSTALLED
177
+ };
178
+ });
179
+ const sourceParts = Effect.fn("sourceParts")(function* sourceParts(root, moduleDirectory) {
180
+ return {
181
+ listed: yield* sourceFiles(root, moduleDirectory),
182
+ installed: yield* installedPackages(root, root)
183
+ };
184
+ });
185
+ /** @internal */
186
+ const implementationOf = Effect.fn("implementationOf")(function* implementationOf(moduleDirectory) {
187
+ const files = yield* RepositoryFiles;
188
+ const root = yield* nearestManifestDirectory(moduleDirectory);
189
+ const fromSource = String$1.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(moduleDirectory);
190
+ const parts = yield* Boolean$1.match(fromSource, {
191
+ onFalse: () => bundleParts(root, moduleDirectory),
192
+ onTrue: () => sourceParts(root, moduleDirectory)
193
+ });
194
+ return {
195
+ files: pipe(Array.sort(parts.listed, String$1.Order), Array.map((file) => [files.relative(root, file), file])),
196
+ installed: parts.installed
197
+ };
198
+ });
199
+ const implementationFingerprint = Effect.fn("implementationFingerprint")(function* implementationFingerprint(moduleDirectory) {
200
+ const implementation = yield* implementationOf(moduleDirectory);
201
+ return yield* contentKey(implementation.installed, implementation.files);
202
+ });
58
203
  // src/features/check-overrides/model/override-records.ts
59
204
  const RECORDS = [
60
205
  NODE_MODULES,
@@ -224,10 +369,10 @@ const RESOLUTION_FILES = [
224
369
  ".npmrc",
225
370
  "patches/*"
226
371
  ];
227
- const RESOLUTION_CONCURRENCY = 4;
372
+ const RESOLUTION_CONCURRENCY = 2;
228
373
  const SUCCEEDED$1 = 0;
229
- const taggedError$7 = Schema.TaggedError;
230
- var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
374
+ const taggedError$8 = Schema.TaggedError;
375
+ var OverrideResolutionFailed = class extends taggedError$8()("OverrideResolutionFailed", {
231
376
  override: Schema.String,
232
377
  output: Schema.String
233
378
  }) {};
@@ -345,58 +490,103 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
345
490
  overrides
346
491
  }, keys));
347
492
  });
493
+ // src/shared/lib/scanned-files.ts
494
+ 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;
495
+ const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
496
+ const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
497
+ const READ_CONCURRENCY$33 = 64;
498
+ const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
499
+ const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
500
+ /** @internal */
501
+ const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
502
+ const files = yield* RepositoryFiles;
503
+ const names = yield* files.ownedFiles(root);
504
+ return pipe(names, Array.map((name) => ({
505
+ name,
506
+ file: files.join(root, name)
507
+ })));
508
+ });
509
+ /** @internal */
510
+ const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
511
+ const files = yield* RepositoryFiles;
512
+ return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
513
+ });
514
+ /** @internal */
515
+ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
516
+ const files = yield* RepositoryFiles;
517
+ const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
518
+ onNone: () => [],
519
+ onSome: (source) => problemsIn(entry, source)
520
+ }))), { concurrency: READ_CONCURRENCY$33 });
521
+ return Array.flatten(found);
522
+ });
348
523
  // src/features/check-overrides/model/git-subpath.ts
349
524
  const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
350
525
  const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
351
- const RULE$57 = "git-subpath-dependency";
352
- const WHOLE_MATCH$3 = 0;
526
+ const RULE$63 = "git-subpath-dependency";
527
+ const WHOLE_MATCH$4 = 0;
353
528
  const problemAt$7 = ({ file }, source) => (found) => ({
354
529
  file,
355
- ...positionOf(source)(found.index ?? WHOLE_MATCH$3),
356
- rule: RULE$57,
357
- 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])}\`.`
530
+ ...positionOf(source)(found.index ?? WHOLE_MATCH$4),
531
+ rule: RULE$63,
532
+ 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$4])}\`.`
358
533
  });
359
- const problemsIn$19 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
534
+ const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
360
535
  const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
361
536
  /** @internal */
362
537
  const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
363
538
  const listed = yield* listedFiles(root);
364
- return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$19);
539
+ return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$22);
365
540
  });
366
541
  // src/features/check-overrides/model/restricted-rules.ts
367
- const RULE$56 = "unnamed-restriction";
368
- const WHOLE_MATCH$2 = 0;
542
+ const RULE$62 = "unnamed-restriction";
543
+ const WHOLE_MATCH$3 = 0;
369
544
  const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
370
- const problemsIn$18 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
545
+ const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
371
546
  file: entry.file,
372
- ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
373
- rule: RULE$56,
374
- 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.`
547
+ ...positionOf(source)(found.index ?? WHOLE_MATCH$3),
548
+ rule: RULE$62,
549
+ message: `${found[WHOLE_MATCH$3]} 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.`
375
550
  })));
376
551
  /** @internal */
377
552
  const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
378
553
  const listed = yield* listedFiles(root);
379
- return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$18);
554
+ return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
555
+ });
556
+ // src/features/check-overrides/model/type-exemptions.ts
557
+ const RULE$61 = "named-type-exemption";
558
+ const WHOLE_MATCH$2 = 0;
559
+ const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
560
+ const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
561
+ file: entry.file,
562
+ ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
563
+ rule: RULE$61,
564
+ message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
565
+ })));
566
+ /** @internal */
567
+ const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
568
+ const listed = yield* listedFiles(root);
569
+ return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
380
570
  });
381
571
  // src/features/check-overrides/model/package-registry.ts
382
- const RULE$55 = "package-registry";
572
+ const RULE$60 = "package-registry";
383
573
  const REGISTRY = "https://npm.flatt.tech/";
384
574
  const TRAILING_SLASH = /\/$/u;
385
575
  const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
386
576
  const NPMRC = /(?:^|\/)\.npmrc$/u;
387
577
  const WORKSPACE_REGISTRY = /^registry:/mu;
388
578
  const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
389
- const START$21 = 0;
579
+ const START$24 = 0;
390
580
  const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
391
581
  const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
392
582
  const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
393
583
  const withoutSlash = String$1.replace(TRAILING_SLASH, "");
394
584
  const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
395
- const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$21));
585
+ const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$24));
396
586
  const workspaceProblem = (file, source, registry) => ({
397
587
  file,
398
588
  ...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
399
- rule: RULE$55,
589
+ rule: RULE$60,
400
590
  message: Option.match(registry, {
401
591
  onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
402
592
  onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
@@ -404,9 +594,9 @@ const workspaceProblem = (file, source, registry) => ({
404
594
  });
405
595
  const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
406
596
  file: entry.file,
407
- ...positionOf(source)(found.index ?? START$21),
408
- rule: RULE$55,
409
- message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$21])}\`. Remove the line.`
597
+ ...positionOf(source)(found.index ?? START$24),
598
+ rule: RULE$60,
599
+ message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
410
600
  })));
411
601
  const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
412
602
  const files = yield* RepositoryFiles;
@@ -425,36 +615,34 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
425
615
  return [...yield* checkWorkspace(root), ...overrides];
426
616
  });
427
617
  // src/features/check-placement/model/colocated-git-patterns.ts
428
- const RULE$54 = "colocated-git-patterns";
618
+ const RULE$59 = "colocated-git-patterns";
429
619
  const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
430
620
  const ROOT$3 = ".";
431
- const SEPARATOR$22 = "/";
432
621
  const NEGATION$1 = "!";
433
622
  const COMMENT$1 = "#";
434
623
  const ANY_DEPTH = "**";
435
- const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$22}`;
624
+ const FLOATING_PREFIX = `${ANY_DEPTH}/`;
436
625
  const LEADING_SLASHES = /^\/+/u;
437
626
  const TRAILING_SLASHES = /\/+$/u;
438
627
  const SPACES = /\s+/u;
439
- const FIRST$21 = 1;
440
- const READ_CONCURRENCY$31 = 16;
441
- const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$3 || String$1.startsWith(`${directory}${SEPARATOR$22}`)(inner));
628
+ const FIRST$22 = 1;
629
+ const READ_CONCURRENCY$32 = 16;
442
630
  const withoutPrefix = (prefix, text) => {
443
631
  if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
444
632
  return text;
445
633
  };
446
634
  const isAnchored = (pattern) => {
447
635
  const body = withoutPrefix(NEGATION$1, pattern);
448
- return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$22));
636
+ return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes("/"));
449
637
  };
450
638
  const segmentsOf = ({ directory, pattern }) => {
451
639
  const body = withoutPrefix(NEGATION$1, pattern);
452
640
  const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
453
- const own = String$1.split(SEPARATOR$22)(trimmed);
641
+ const own = String$1.split("/")(trimmed);
454
642
  if (directory === ROOT$3) return own;
455
- return [...String$1.split(SEPARATOR$22)(directory), ...own];
643
+ return [...String$1.split("/")(directory), ...own];
456
644
  };
457
- const depthOf = (directory) => String$1.split(SEPARATOR$22)(directory).length;
645
+ const depthOf = (directory) => String$1.split("/")(directory).length;
458
646
  const entryOf$1 = (file, kind, directory) => (line, index) => {
459
647
  const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
460
648
  if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT$1)(pattern)) return Option.none();
@@ -462,7 +650,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
462
650
  file,
463
651
  kind,
464
652
  directory,
465
- line: index + FIRST$21,
653
+ line: index + FIRST$22,
466
654
  pattern,
467
655
  values: Array.join(values, " ")
468
656
  });
@@ -474,15 +662,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
474
662
  const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
475
663
  return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
476
664
  });
477
- const problemAt$6 = (entry, message) => ({
478
- file: entry.file,
665
+ const patternProblem = (entry, message) => problemAtPosition(RULE$59)(entry.file, {
479
666
  line: entry.line,
480
- column: FIRST$21,
481
- rule: RULE$54,
482
- message
483
- });
667
+ column: FIRST$22
668
+ }, message);
484
669
  const misplacedMessage = (kind, workspaces) => {
485
- if (workspaces.length === FIRST$21) {
670
+ if (workspaces.length === FIRST$22) {
486
671
  const workspace = Array.join(workspaces, "");
487
672
  return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
488
673
  }
@@ -492,7 +677,7 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
492
677
  const files = yield* RepositoryFiles;
493
678
  const leading = Array.take(segments, depth);
494
679
  if (Array.contains(leading, ANY_DEPTH)) return [];
495
- const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$22)}${SEPARATOR$22}${MANIFEST_FILE$3}`]);
680
+ const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, "/")}/${MANIFEST_FILE$3}`]);
496
681
  return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
497
682
  });
498
683
  const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
@@ -508,17 +693,17 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
508
693
  if (!isAnchored(entry.pattern)) return Option.none();
509
694
  const deepest = yield* matchedWorkspaces(root, workspaces, entry);
510
695
  if (Array.isReadonlyArrayEmpty(deepest)) return Option.none();
511
- return Option.some(problemAt$6(entry, misplacedMessage(entry.kind, deepest)));
696
+ return Option.some(patternProblem(entry, misplacedMessage(entry.kind, deepest)));
512
697
  });
513
698
  const isFloating = (pattern) => !String$1.startsWith(NEGATION$1)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
514
699
  const ownLevelName = (pattern) => {
515
700
  if (isFloating(pattern)) return Option.some(pattern);
516
- const name = withoutPrefix(SEPARATOR$22, pattern);
701
+ const name = withoutPrefix("/", pattern);
517
702
  return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));
518
703
  };
519
704
  const sameName = (outer, name) => {
520
705
  if (outer === name) return true;
521
- return String$1.endsWith(SEPARATOR$22)(name) && `${outer}${SEPARATOR$22}` === name;
706
+ return String$1.endsWith("/")(name) && `${outer}/` === name;
522
707
  };
523
708
  const coveredBy = (entry, name) => (outer) => outer.kind === entry.kind && outer.values === entry.values && isFloating(outer.pattern) && isInside(outer.directory)(entry.directory) && sameName(outer.pattern, name);
524
709
  const outerName = ({ directory, kind }) => {
@@ -527,22 +712,22 @@ const outerName = ({ directory, kind }) => {
527
712
  };
528
713
  const repeated = (entries) => (entry) => {
529
714
  const outer = pipe(ownLevelName(entry.pattern), Option.flatMap((name) => pipe(entries, Array.findFirst(coveredBy(entry, name)))));
530
- return pipe(outer, Option.map((found) => problemAt$6(entry, `repeats ${found.pattern} from ${outerName(found)}, which already applies here. Delete it.`)));
715
+ return pipe(outer, Option.map((found) => patternProblem(entry, `repeats ${found.pattern} from ${outerName(found)}, which already applies here. Delete it.`)));
531
716
  };
532
717
  /** @internal */
533
718
  const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
534
719
  const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
535
- const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$31 });
720
+ const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$32 });
536
721
  const entries = Array.flatten(read);
537
722
  const workspaces = yield* workspaceDirectories(root);
538
- const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$31 });
723
+ const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$32 });
539
724
  const repeatedFound = pipe(entries, Array.map(repeated(entries)));
540
725
  return Array.getSomes([...misplacedFound, ...repeatedFound]);
541
726
  });
542
727
  // src/features/check-placement/model/colocated-tests.ts
543
- const RULE$53 = "colocated-test";
544
- const FIRST$20 = 1;
545
- const READ_CONCURRENCY$30 = 64;
728
+ const RULE$58 = "colocated-test";
729
+ const FIRST$21 = 1;
730
+ const READ_CONCURRENCY$31 = 64;
546
731
  const ROOT_SUBPATH = ".";
547
732
  const NAME_GROUP = "name";
548
733
  const SPECIFIER_GROUP = "specifier";
@@ -558,17 +743,17 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
558
743
  const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
559
744
  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.";
560
745
  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>.";
561
- const Manifest$6 = Schema.Struct({
746
+ const Manifest$8 = Schema.Struct({
562
747
  name: Schema.optional(Schema.String),
563
748
  exports: Schema.optional(Schema.Unknown)
564
749
  });
565
- const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
750
+ const decodeManifest$11 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$8));
566
751
  const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
567
- const problemFor$7 = (test, message) => ({
752
+ const problemFor$9 = (test, message) => ({
568
753
  file: test.file,
569
- line: FIRST$20,
570
- column: FIRST$20,
571
- rule: RULE$53,
754
+ line: FIRST$21,
755
+ column: FIRST$21,
756
+ rule: RULE$58,
572
757
  message: `${test.base} ${message}`
573
758
  });
574
759
  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);
@@ -588,7 +773,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
588
773
  if (Option.isNone(owner)) return [];
589
774
  const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
590
775
  const join = (target) => files.join(context.root, owner.value, target);
591
- return pipe(text, Option.flatMap(decodeManifest$10), Option.map(specifiersBeside({
776
+ return pipe(text, Option.flatMap(decodeManifest$11), Option.map(specifiersBeside({
592
777
  join,
593
778
  dirname: files.dirname,
594
779
  directory: test.directory
@@ -607,11 +792,11 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
607
792
  return yield* refersToOwnDirectory(context, test, source.value);
608
793
  });
609
794
  const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
610
- const problemIn$7 = Effect.fn("problemIn")(function* problemIn(context, test) {
611
- if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$7(test, DIRECTORY_MESSAGE));
795
+ const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
796
+ if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$9(test, DIRECTORY_MESSAGE));
612
797
  if (!TEST_FILE$2.test(test.name)) return Option.none();
613
798
  if (yield* refersIn(context, test)) return Option.none();
614
- return Option.some(problemFor$7(test, SIBLING_MESSAGE));
799
+ return Option.some(problemFor$9(test, SIBLING_MESSAGE));
615
800
  });
616
801
  /** @internal */
617
802
  const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
@@ -631,12 +816,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
631
816
  directory: files.dirname(file)
632
817
  };
633
818
  }));
634
- const found = yield* Effect.forEach(tests, (test) => problemIn$7(context, test), { concurrency: READ_CONCURRENCY$30 });
819
+ const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$31 });
635
820
  return Array.getSomes(found);
636
821
  });
637
822
  // src/shared/lib/agent-docs.ts
638
823
  const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
639
- const READ_CONCURRENCY$29 = 16;
824
+ const READ_CONCURRENCY$30 = 16;
640
825
  const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
641
826
  const files = yield* RepositoryFiles;
642
827
  const listed = yield* files.listedFiles(root);
@@ -645,32 +830,32 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
645
830
  const file = files.join(root, name);
646
831
  const problemOf = Option.flatMap(problemIn(file));
647
832
  return files.readFile(file).pipe(Effect.map(problemOf));
648
- }, { concurrency: READ_CONCURRENCY$29 });
833
+ }, { concurrency: READ_CONCURRENCY$30 });
649
834
  return Array.getSomes(found);
650
835
  });
651
836
  // src/features/check-placement/model/agent-docs-length.ts
652
837
  const RECOMMENDED_LINES = 200;
653
- const FIRST$19 = 1;
654
- const RULE$52 = "agent-docs-length";
838
+ const FIRST$20 = 1;
839
+ const RULE$57 = "agent-docs-length";
655
840
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
656
- const problemFor$6 = (file) => (lines) => {
841
+ const problemFor$8 = (file) => (lines) => {
657
842
  if (lines <= RECOMMENDED_LINES) return Option.none();
658
843
  return Option.some({
659
844
  file,
660
845
  line: 201,
661
- column: FIRST$19,
662
- rule: RULE$52,
846
+ column: FIRST$20,
847
+ rule: RULE$57,
663
848
  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.`
664
849
  });
665
850
  };
666
851
  /** @internal */
667
- const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$6(file)(lineCount(source)));
852
+ const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
668
853
  // src/features/check-placement/model/claude-link.ts
669
- const RULE$51 = "claude-md-link";
854
+ const RULE$56 = "claude-md-link";
670
855
  const CLAUDE = "CLAUDE.md";
671
856
  const AGENTS = "AGENTS.md";
672
- const FIRST$18 = 1;
673
- const READ_CONCURRENCY$28 = 16;
857
+ const FIRST$19 = 1;
858
+ const READ_CONCURRENCY$29 = 16;
674
859
  const MESSAGE$16 = "CLAUDE.md must be a symbolic link to AGENTS.md";
675
860
  /** @internal */
676
861
  const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
@@ -683,22 +868,22 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
683
868
  const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
684
869
  return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
685
870
  file: path,
686
- line: FIRST$18,
687
- column: FIRST$18,
688
- rule: RULE$51,
871
+ line: FIRST$19,
872
+ column: FIRST$19,
873
+ rule: RULE$56,
689
874
  message: MESSAGE$16
690
875
  })));
691
876
  });
692
877
  const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
693
- const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$28 });
878
+ const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$29 });
694
879
  return Array.getSomes(found);
695
880
  });
696
881
  // src/features/check-placement/model/dangling-links.ts
697
- const RULE$50 = "dangling-link";
698
- const SEPARATOR$21 = "/";
699
- const FIRST$17 = 1;
700
- const READ_CONCURRENCY$27 = 16;
701
- const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$21}`)(name);
882
+ const RULE$55 = "dangling-link";
883
+ const SEPARATOR$20 = "/";
884
+ const FIRST$18 = 1;
885
+ const READ_CONCURRENCY$28 = 16;
886
+ const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
702
887
  /** @internal */
703
888
  const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
704
889
  const files = yield* RepositoryFiles;
@@ -708,19 +893,19 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
708
893
  const link = yield* files.readLink(file);
709
894
  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) => ({
710
895
  file,
711
- line: FIRST$17,
712
- column: FIRST$17,
713
- rule: RULE$50,
896
+ line: FIRST$18,
897
+ column: FIRST$18,
898
+ rule: RULE$55,
714
899
  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.`
715
900
  })));
716
901
  });
717
- const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$27 });
902
+ const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$28 });
718
903
  return Array.getSomes(found);
719
904
  });
720
905
  // src/features/check-placement/model/member-sources.ts
721
906
  const ROOT_WORKSPACE$1 = ".";
722
- const FIRST$16 = 1;
723
- const SEPARATOR$20 = "/";
907
+ const FIRST$17 = 1;
908
+ const SEPARATOR$19 = "/";
724
909
  const EXCLUDED$7 = [
725
910
  ":(exclude,attr:linguist-vendored)",
726
911
  ":(exclude,attr:linguist-generated)",
@@ -740,12 +925,12 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
740
925
  const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
741
926
  const fileProblem$1 = ({ file, rule, message }) => ({
742
927
  file,
743
- line: FIRST$16,
744
- column: FIRST$16,
928
+ line: FIRST$17,
929
+ column: FIRST$17,
745
930
  rule,
746
931
  message
747
932
  });
748
- const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$20}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
933
+ const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$19}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
749
934
  workspace,
750
935
  inner: String$1.slice(workspace.length + 1)(name)
751
936
  })));
@@ -768,10 +953,10 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
768
953
  }));
769
954
  });
770
955
  // src/features/check-placement/model/deployed-readme.ts
771
- const RULE$49 = "deployed-readme";
956
+ const RULE$54 = "deployed-readme";
772
957
  const ROOT_DIRECTORY$2 = "";
773
- const READ_CONCURRENCY$26 = 16;
774
- const MISSING_MESSAGE$1 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
958
+ const READ_CONCURRENCY$27 = 16;
959
+ const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
775
960
  const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
776
961
  const ADDRESS_KEYS = [
777
962
  "domain",
@@ -804,18 +989,18 @@ const deploysTo = Effect.fn("deploysTo")(function* deploysTo(root, file) {
804
989
  const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: "ts" }));
805
990
  return servesAddress(parsed.program);
806
991
  });
807
- const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, directory) {
992
+ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory) {
808
993
  const readme = yield* readReadme({
809
994
  root,
810
995
  directory,
811
- rule: RULE$49,
812
- missingMessage: MISSING_MESSAGE$1
996
+ rule: RULE$54,
997
+ missingMessage: MISSING_MESSAGE$2
813
998
  });
814
999
  return Result.match(readme, {
815
1000
  onFailure: Option.some,
816
1001
  onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
817
1002
  file,
818
- rule: RULE$49,
1003
+ rule: RULE$54,
819
1004
  message: NO_URL_MESSAGE
820
1005
  })))
821
1006
  });
@@ -826,37 +1011,41 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
826
1011
  const listed = yield* files.listedFiles(root);
827
1012
  const directories = yield* workspaceDirectories(root);
828
1013
  const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
829
- const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$26 });
1014
+ const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$27 });
830
1015
  const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$2))), Array.dedupe);
831
- const found = yield* Effect.forEach(owners, (directory) => problemIn$6(root, directory), { concurrency: READ_CONCURRENCY$26 });
1016
+ const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$27 });
832
1017
  return Array.getSomes(found);
833
1018
  });
834
1019
  // src/features/check-placement/model/nested-docs.ts
835
- const RULE$48 = "nested-docs";
1020
+ const RULE$53 = "nested-docs";
836
1021
  const CONFIG_FILE$7 = "vite.config.ts";
837
- const SEPARATOR$19 = "/";
838
- const READ_CONCURRENCY$25 = 64;
1022
+ const SEPARATOR$18 = "/";
1023
+ const READ_CONCURRENCY$26 = 64;
839
1024
  const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
840
1025
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
841
1026
  const README = /^README(?:\.[^/]+)?$/iu;
1027
+ const MANIFEST$5 = "package.json";
1028
+ const MISSING_RULE = "workspace-agents-md";
842
1029
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
843
- const taggedError$6 = Schema.TaggedError;
844
- var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
845
- const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
846
- const problemFor$5 = problemInFile(RULE$48);
1030
+ const taggedError$7 = Schema.TaggedError;
1031
+ var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
1032
+ const isNested = (name) => String$1.includes(SEPARATOR$18)(name);
1033
+ const problemFor$7 = problemInFile(RULE$53);
847
1034
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
848
1035
  const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
1036
+ const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
849
1037
  const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
850
1038
  const agentDocProblem = ({ file, base, directory }, allowed) => {
851
- if (!allowed.workspaceAgentDocs) return Option.some(problemFor$5(file, `${base} ${AGENT_DOCS_MESSAGE}`));
1039
+ if (!allowed.workspaceAgentDocs) return Option.some(problemFor$7(file, `${base} ${AGENT_DOCS_MESSAGE}`));
852
1040
  if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
853
- return Option.some(problemFor$5(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
1041
+ return Option.some(problemFor$7(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
854
1042
  };
855
1043
  const readmeProblem = ({ file, base, directory }, allowed) => {
856
1044
  if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
857
- return Option.some(problemFor$5(file, `${base} ${README_MESSAGE}`));
1045
+ return Option.some(problemFor$7(file, `${base} ${README_MESSAGE}`));
858
1046
  };
859
- const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
1047
+ const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$5), MISSING_MESSAGE$1)));
1048
+ const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
860
1049
  const files = yield* RepositoryFiles;
861
1050
  const file = files.join(root, name);
862
1051
  const doc = {
@@ -888,19 +1077,25 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
888
1077
  workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
889
1078
  workspaceAgentDocs
890
1079
  };
891
- const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$25 });
892
- return Array.getSomes(found);
1080
+ const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$26 });
1081
+ const missing = missingProblems({
1082
+ required: workspaceAgentDocs,
1083
+ directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
1084
+ present: pipe(names, Array.map((name) => files.join(root, name)), HashSet.fromIterable),
1085
+ join: files.join
1086
+ });
1087
+ return [...Array.getSomes(found), ...missing];
893
1088
  });
894
1089
  // src/features/check-placement/model/published-readme.ts
895
- const RULE$47 = "published-readme";
896
- const READ_CONCURRENCY$24 = 16;
1090
+ const RULE$52 = "published-readme";
1091
+ const READ_CONCURRENCY$25 = 16;
897
1092
  const MESSAGE$15 = "contains Japanese. This package is published to npm, so write its README in English.";
898
1093
  const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
899
- const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
1094
+ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
900
1095
  const readme = yield* readReadme({
901
1096
  root,
902
1097
  directory,
903
- rule: RULE$47,
1098
+ rule: RULE$52,
904
1099
  missingMessage: MISSING_MESSAGE
905
1100
  });
906
1101
  return Result.match(readme, {
@@ -911,7 +1106,7 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
911
1106
  file,
912
1107
  line,
913
1108
  column,
914
- rule: RULE$47,
1109
+ rule: RULE$52,
915
1110
  message: MESSAGE$15
916
1111
  };
917
1112
  }))
@@ -920,17 +1115,17 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
920
1115
  /** @internal */
921
1116
  const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
922
1117
  const projects = yield* publishedProjects(root);
923
- const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$24 });
1118
+ const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$25 });
924
1119
  return Array.getSomes(found);
925
1120
  });
926
1121
  // src/features/check-placement/model/published-tests.ts
927
- const RULE$46 = "published-tests";
1122
+ const RULE$51 = "published-tests";
928
1123
  const MANIFEST_FILE$2 = "package.json";
929
1124
  const FILE_START = 1;
930
1125
  const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
931
1126
  const MESSAGE$14 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
932
1127
  const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
933
- const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
1128
+ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
934
1129
  const files = yield* RepositoryFiles;
935
1130
  const absolute = files.join(root, directory);
936
1131
  const prefix = `${absolute}/`;
@@ -939,7 +1134,7 @@ const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed,
939
1134
  file: files.join(absolute, MANIFEST_FILE$2),
940
1135
  line: FILE_START,
941
1136
  column: FILE_START,
942
- rule: RULE$46,
1137
+ rule: RULE$51,
943
1138
  message: MESSAGE$14
944
1139
  });
945
1140
  });
@@ -949,38 +1144,38 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
949
1144
  const projects = yield* publishedProjects(root);
950
1145
  const listed = yield* files.listedFiles(root);
951
1146
  const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
952
- const found = yield* Effect.forEach(projects, (project) => problemFor$4(root, absolute, project), { concurrency: 1 });
1147
+ const found = yield* Effect.forEach(projects, (project) => problemFor$6(root, absolute, project), { concurrency: 1 });
953
1148
  return Array.getSomes(found);
954
1149
  });
955
1150
  // src/features/check-placement/model/root-docs.ts
956
- const RULE$45 = "root-docs";
957
- const SEPARATOR$18 = "/";
958
- const FIRST$15 = 1;
1151
+ const RULE$50 = "root-docs";
1152
+ const SEPARATOR$17 = "/";
1153
+ const FIRST$16 = 1;
959
1154
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
960
1155
  const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
961
1156
  const MESSAGE$13 = "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.";
962
- const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
1157
+ const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$17)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
963
1158
  /** @internal */
964
1159
  const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
965
1160
  const files = yield* RepositoryFiles;
966
1161
  const names = yield* files.listedFiles(root);
967
1162
  return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
968
1163
  file: files.join(root, name),
969
- line: FIRST$15,
970
- column: FIRST$15,
971
- rule: RULE$45,
1164
+ line: FIRST$16,
1165
+ column: FIRST$16,
1166
+ rule: RULE$50,
972
1167
  message: `${name} ${MESSAGE$13}`
973
1168
  })));
974
1169
  });
975
1170
  // src/features/check-placement/model/root-readme.ts
976
- const RULE$44 = "root-readme";
1171
+ const RULE$49 = "root-readme";
977
1172
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
978
- const READ_CONCURRENCY$23 = 16;
979
- const START$20 = 0;
1173
+ const READ_CONCURRENCY$24 = 16;
1174
+ const START$23 = 0;
980
1175
  const CHECK_POLICY = "@r_masseater/msch";
981
1176
  const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
982
1177
  const RELATIVE$1 = /^\.\//u;
983
- const SEPARATOR$17 = "/";
1178
+ const SEPARATOR$16 = "/";
984
1179
  const MarketplacePlugin = Schema.Struct({
985
1180
  name: Schema.optional(Schema.String),
986
1181
  source: Schema.Unknown
@@ -992,7 +1187,7 @@ const NO_PLUGINS = {
992
1187
  };
993
1188
  const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
994
1189
  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.`;
995
- const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$17)(directory), Array.last, Option.getOrElse(() => directory));
1190
+ const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$16)(directory), Array.last, Option.getOrElse(() => directory));
996
1191
  const pluginsOf = (plugins) => {
997
1192
  const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
998
1193
  const segments = pipe(directories, Array.map(lastSegment));
@@ -1015,22 +1210,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
1015
1210
  onNone: () => ownNames(plugins, names),
1016
1211
  onSome: () => [directory]
1017
1212
  }));
1018
- const problemsIn$17 = (file, source, plugins) => (workspace) => {
1213
+ const problemsIn$19 = (file, source, plugins) => (workspace) => {
1019
1214
  const message = messageFor(workspace.directory);
1020
1215
  const at = positionOf(source);
1021
1216
  const pattern = patternFor(plugins)(workspace);
1022
- return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
1023
- file,
1024
- ...at(found.index ?? START$20),
1025
- rule: RULE$44,
1026
- message
1027
- })));
1217
+ return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$49)(file, at(found.index ?? START$23), message)));
1028
1218
  };
1029
1219
  const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
1030
1220
  const text = yield* (yield* RepositoryFiles).readFile(file);
1031
1221
  return pipe(text, Option.match({
1032
1222
  onNone: () => [],
1033
- onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$17(file, source, plugins)))
1223
+ onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$19(file, source, plugins)))
1034
1224
  }));
1035
1225
  });
1036
1226
  /** @internal */
@@ -1041,7 +1231,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
1041
1231
  const named = yield* namedWorkspaces(root);
1042
1232
  const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
1043
1233
  const plugins = yield* marketplacePlugins(root);
1044
- const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$23 });
1234
+ const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$24 });
1045
1235
  return Array.flatten(found);
1046
1236
  });
1047
1237
  // src/features/check-placement/model/doc-placement.ts
@@ -1061,10 +1251,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
1061
1251
  return Array.flatten(found);
1062
1252
  });
1063
1253
  // src/features/check-placement/model/docs-mirror.ts
1064
- const RULE$43 = "docs-mirror";
1254
+ const RULE$48 = "docs-mirror";
1065
1255
  const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
1066
1256
  const MIRROR_LIMIT = 3;
1067
- const READ_CONCURRENCY$22 = 16;
1257
+ const READ_CONCURRENCY$23 = 16;
1068
1258
  const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
1069
1259
  const BEFORE = String.raw`(?<![\w@/.-])`;
1070
1260
  const AFTER = String.raw`(?![\w@.-])`;
@@ -1080,20 +1270,20 @@ const firstMention = (source, workspace) => {
1080
1270
  };
1081
1271
  const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
1082
1272
  const describe = (mentions) => pipe(mentions, Array.map(({ directory }) => `\`${directory}\``), Array.join(", "));
1083
- const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
1273
+ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
1084
1274
  const { line, column } = positionOf(source)(offset);
1085
1275
  return {
1086
1276
  file,
1087
1277
  line,
1088
1278
  column,
1089
- rule: RULE$43,
1279
+ rule: RULE$48,
1090
1280
  message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`
1091
1281
  };
1092
1282
  }), Option.toArray);
1093
1283
  const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$3(doc)(workspace)));
1094
- const problemIn$3 = (workspaces) => (doc, file, source) => {
1284
+ const problemIn$4 = (workspaces) => (doc, file, source) => {
1095
1285
  const mentions = pipe(othersIn(doc, workspaces), Array.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
1096
- return problemFor$3(file, source, Array.sort(mentions, byOffset));
1286
+ return problemFor$5(file, source, Array.sort(mentions, byOffset));
1097
1287
  };
1098
1288
  const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
1099
1289
  const files = yield* RepositoryFiles;
@@ -1101,7 +1291,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
1101
1291
  return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
1102
1292
  directory,
1103
1293
  names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
1104
- }))), { concurrency: READ_CONCURRENCY$22 });
1294
+ }))), { concurrency: READ_CONCURRENCY$23 });
1105
1295
  });
1106
1296
  /** @internal */
1107
1297
  const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
@@ -1112,15 +1302,15 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
1112
1302
  const file = files.join(root, doc);
1113
1303
  return files.readFile(file).pipe(Effect.map((source) => Option.match(source, {
1114
1304
  onNone: () => [],
1115
- onSome: (text) => problemIn$3(workspaces)(doc, file, text)
1305
+ onSome: (text) => problemIn$4(workspaces)(doc, file, text)
1116
1306
  })));
1117
- }, { concurrency: READ_CONCURRENCY$22 });
1307
+ }, { concurrency: READ_CONCURRENCY$23 });
1118
1308
  return Array.flatten(found);
1119
1309
  });
1120
1310
  // src/features/check-placement/model/ignored-sources.ts
1121
- const RULE$42 = "ignored-sources";
1311
+ const RULE$47 = "ignored-sources";
1122
1312
  const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
1123
- const FIRST$14 = 1;
1313
+ const FIRST$15 = 1;
1124
1314
  const MESSAGE$12 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
1125
1315
  /** @internal */
1126
1316
  const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
@@ -1128,9 +1318,9 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
1128
1318
  const ignored = yield* files.ignoredFiles(root, SOURCES);
1129
1319
  return pipe(ignored, Array.map((file) => ({
1130
1320
  file: files.join(root, file),
1131
- line: FIRST$14,
1132
- column: FIRST$14,
1133
- rule: RULE$42,
1321
+ line: FIRST$15,
1322
+ column: FIRST$15,
1323
+ rule: RULE$47,
1134
1324
  message: MESSAGE$12
1135
1325
  })));
1136
1326
  });
@@ -1161,8 +1351,8 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
1161
1351
  return Array.flatten(entries);
1162
1352
  });
1163
1353
  // src/shared/lib/tree-sitter.ts
1164
- const taggedError$5 = Schema.TaggedError;
1165
- var GrammarUnreadable = class extends taggedError$5()("GrammarUnreadable", {
1354
+ const taggedError$6 = Schema.TaggedError;
1355
+ var GrammarUnreadable = class extends taggedError$6()("GrammarUnreadable", {
1166
1356
  grammar: Schema.String,
1167
1357
  message: Schema.String
1168
1358
  }) {};
@@ -1205,7 +1395,7 @@ const LAYERS = [
1205
1395
  ];
1206
1396
  const RUST_FILE = /\.rs$/u;
1207
1397
  const BINARY = /^src\/bin\/[^/]+\.rs$/u;
1208
- const MANIFEST$3 = /(?:^|\/)Cargo\.toml$/u;
1398
+ const MANIFEST$4 = /(?:^|\/)Cargo\.toml$/u;
1209
1399
  const MODULE_INDEX = "mod";
1210
1400
  const CRATE_ROOTS = ["src/lib.rs", "src/main.rs"];
1211
1401
  const OUTSIDE_ALLOWED = /^(?:build\.rs|benches\/.+)$/u;
@@ -1221,7 +1411,7 @@ const LAYER_DEPTH = 1;
1221
1411
  const SOURCE_PREFIX$1 = `src/`;
1222
1412
  const ROOT_CRATE = "";
1223
1413
  const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
1224
- const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$3.test(name)), Array.map((name) => String$1.replace(MANIFEST$3, "")(name)));
1414
+ const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$4.test(name)), Array.map((name) => String$1.replace(MANIFEST$4, "")(name)));
1225
1415
  const ownedBy = (crate, name) => {
1226
1416
  if (crate === ROOT_CRATE) return {
1227
1417
  crate,
@@ -9712,7 +9902,7 @@ var english_verbs_default = [
9712
9902
  const SLICE_RULE$1 = "feature-slice-name";
9713
9903
  const ENTRY_RULE$2 = "deploy-entry-name";
9714
9904
  const SEGMENT_RULE = "slice-segment-name";
9715
- const SEPARATOR$15 = "/";
9905
+ const SEPARATOR$14 = "/";
9716
9906
  const NEXT$3 = 1;
9717
9907
  const WORD_SEPARATOR$1 = "-";
9718
9908
  const MINIMUM_WORDS = 2;
@@ -9738,7 +9928,7 @@ const isVerbObjectBy = (separator) => (slice) => {
9738
9928
  return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
9739
9929
  };
9740
9930
  const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
9741
- const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$15))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$15}${FEATURES$1}${slice}`));
9931
+ const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$14))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$14}${FEATURES$1}${slice}`));
9742
9932
  const SLICE_LAYERS = [
9743
9933
  "features",
9744
9934
  "entities",
@@ -9746,26 +9936,26 @@ const SLICE_LAYERS = [
9746
9936
  "pages"
9747
9937
  ];
9748
9938
  const SLICE_DEPTHS = [3, 4];
9749
- const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$15);
9939
+ const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$14);
9750
9940
  const isInSliceLayer = (parts) => {
9751
9941
  const [source, layer] = parts;
9752
- return `${source}${SEPARATOR$15}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
9942
+ return `${source}${SEPARATOR$14}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
9753
9943
  };
9754
9944
  const indexedSlice = (owned) => {
9755
- const parts = String$1.split(owned.inner, SEPARATOR$15);
9945
+ const parts = String$1.split(owned.inner, SEPARATOR$14);
9756
9946
  const depth = parts.length - NEXT$3;
9757
- return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$15}${pathPrefix(parts, depth)}`));
9947
+ return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$14}${pathPrefix(parts, depth)}`));
9758
9948
  };
9759
9949
  const misnamedSegment = (slices) => ({ workspace, inner }) => {
9760
- const parts = String$1.split(inner, SEPARATOR$15);
9761
- const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$15}${pathPrefix(parts, depth)}`);
9950
+ const parts = String$1.split(inner, SEPARATOR$14);
9951
+ const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$14}${pathPrefix(parts, depth)}`);
9762
9952
  const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
9763
- return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$15}${pathPrefix(parts, depth + NEXT$3)}`));
9953
+ return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$14}${pathPrefix(parts, depth + NEXT$3)}`));
9764
9954
  };
9765
9955
  const deployNamed = ({ workspace, inner }) => {
9766
9956
  if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
9767
- const segments = String$1.split(inner, SEPARATOR$15);
9768
- return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$15}${Array.join(Array.take(segments, index + NEXT$3), SEPARATOR$15)}`));
9957
+ const segments = String$1.split(inner, SEPARATOR$14);
9958
+ return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$14}${Array.join(Array.take(segments, index + NEXT$3), SEPARATOR$14)}`));
9769
9959
  };
9770
9960
  /** @internal */
9771
9961
  const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
@@ -9808,7 +9998,7 @@ const LAYER_ITEMS = [
9808
9998
  "attribute_item",
9809
9999
  "inner_attribute_item"
9810
10000
  ];
9811
- const READ_CONCURRENCY$21 = 64;
10001
+ const READ_CONCURRENCY$22 = 64;
9812
10002
  const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
9813
10003
  const NONE$2 = [];
9814
10004
  const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
@@ -9817,13 +10007,7 @@ const ENTRY_MESSAGE = "makes an inner module of a slice public. Declare it with
9817
10007
  const TEST_MESSAGE = "sits in a separate test directory. Put the test next to the code it tests as a #[cfg(test)] module; only a test that replaces the global allocator needs its own binary in tests/.";
9818
10008
  const SLICE_MESSAGE = "is not named <verb>_<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check_layout, sync_manuscripts).";
9819
10009
  const isFeatureName = isVerbObjectBy(WORD_SEPARATOR);
9820
- const itemProblem = (file, rule, message) => ({ line, column }) => ({
9821
- file,
9822
- line,
9823
- column,
9824
- rule,
9825
- message
9826
- });
10010
+ const itemProblem = (file, rule, message) => (position) => problemAtPosition(rule)(file, position, message);
9827
10011
  const isRootItem = (inner) => (item) => {
9828
10012
  if (Array.contains(ROOT_ITEMS, item.kind)) return true;
9829
10013
  if (item.kind === "mod_item") return !item.inline && Option.exists(item.name, (name) => Array.contains(LAYERS, name));
@@ -9890,17 +10074,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
9890
10074
  if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
9891
10075
  const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
9892
10076
  const parse = parsedWith(language);
9893
- const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$21 });
10077
+ const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$22 });
9894
10078
  return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
9895
10079
  });
9896
10080
  // src/features/check-placement/model/shadcn-ui-alias.ts
9897
- const RULE$41 = "shadcn-ui-alias";
9898
- const FIRST$13 = 1;
9899
- const problemOf$8 = (directory, { file, alias }) => ({
10081
+ const RULE$46 = "shadcn-ui-alias";
10082
+ const FIRST$14 = 1;
10083
+ const problemOf$9 = (directory, { file, alias }) => ({
9900
10084
  file,
9901
- line: FIRST$13,
9902
- column: FIRST$13,
9903
- rule: RULE$41,
10085
+ line: FIRST$14,
10086
+ column: FIRST$14,
10087
+ rule: RULE$46,
9904
10088
  message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
9905
10089
  });
9906
10090
  /** @internal */
@@ -9912,7 +10096,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
9912
10096
  onNone: () => Effect.succeed(false),
9913
10097
  onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
9914
10098
  })) return Array.empty();
9915
- return [problemOf$8(directory, found.value)];
10099
+ return [problemOf$9(directory, found.value)];
9916
10100
  });
9917
10101
  // src/features/check-placement/model/source-aliases.ts
9918
10102
  const ALIAS_RULE = "source-alias";
@@ -9920,8 +10104,8 @@ const SOURCE_ALIAS = "#/*";
9920
10104
  const SOURCE_TARGET = "./src/*";
9921
10105
  const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
9922
10106
  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.`;
9923
- const Manifest$5 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
9924
- const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
10107
+ const Manifest$7 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
10108
+ const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
9925
10109
  const targetsOf = (target) => {
9926
10110
  if (Predicate.isString(target)) return [target];
9927
10111
  if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
@@ -9932,7 +10116,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
9932
10116
  const files = yield* RepositoryFiles;
9933
10117
  const manifest = files.join(root, workspace, MANIFEST_FILE$3);
9934
10118
  const text = yield* files.readFile(manifest);
9935
- return pipe(text, Option.flatMap(decodeManifest$9), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
10119
+ return pipe(text, Option.flatMap(decodeManifest$10), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
9936
10120
  });
9937
10121
  /** @internal */
9938
10122
  const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
@@ -9963,22 +10147,19 @@ const SCRIPTS = "scripts-directory";
9963
10147
  const BIN = "bin";
9964
10148
  const SCRIPTS_DIRECTORY = "scripts";
9965
10149
  const WORKFLOW_DIRECTORY$1 = ".github/";
9966
- const SEPARATOR$14 = "/";
10150
+ const SEPARATOR$13 = "/";
9967
10151
  const CURRENT = "./";
9968
- const READ_CONCURRENCY$20 = 8;
9969
- const FIRST$12 = 1;
10152
+ const READ_CONCURRENCY$21 = 8;
10153
+ const FIRST$13 = 1;
9970
10154
  const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
9971
10155
  const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
9972
10156
  const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
9973
- const Manifest$4 = Schema.Struct({
10157
+ const Manifest$6 = Schema.Struct({
9974
10158
  bin: Schema.optional(Schema.Unknown),
9975
10159
  main: Schema.optional(Schema.Unknown),
9976
10160
  exports: Schema.optional(Schema.Unknown)
9977
10161
  });
9978
- const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
9979
- const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
9980
- const decodeTarget = Schema.decodeUnknownOption(Schema.String);
9981
- const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
10162
+ const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
9982
10163
  const NO_ENTRIES = {
9983
10164
  all: [],
9984
10165
  bins: []
@@ -9988,14 +10169,14 @@ const runsIn = ({ text, start }) => pipe(Array.fromIterable(String$1.matchAll(RU
9988
10169
  path: withoutCurrent(path),
9989
10170
  start
9990
10171
  })), Option.toArray)));
9991
- const targetsIn = (held) => [...pipe(decodeTarget(held), Option.map(withoutCurrent), Option.toArray), ...pipe(decodeTargetMap(held), Option.map(Record.values), Option.getOrElse(() => []), Array.flatMap(targetsIn))];
10172
+ const targetPaths = (held) => pipe(targetsIn(held), Array.map(withoutCurrent));
9992
10173
  const entriesOf$2 = (manifest) => {
9993
- const bins = targetsIn(manifest.bin);
10174
+ const bins = targetPaths(manifest.bin);
9994
10175
  return {
9995
10176
  all: [
9996
10177
  ...bins,
9997
- ...targetsIn(manifest.main),
9998
- ...targetsIn(manifest.exports)
10178
+ ...targetPaths(manifest.main),
10179
+ ...targetPaths(manifest.exports)
9999
10180
  ],
10000
10181
  bins
10001
10182
  };
@@ -10003,22 +10184,22 @@ const entriesOf$2 = (manifest) => {
10003
10184
  const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
10004
10185
  const files = yield* RepositoryFiles;
10005
10186
  const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
10006
- return pipe(text, Option.flatMap(decodeManifest$8), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
10187
+ return pipe(text, Option.flatMap(decodeManifest$9), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
10007
10188
  });
10008
10189
  const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
10009
10190
  const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
10010
10191
  const files = yield* RepositoryFiles;
10011
10192
  const names = yield* files.readDirectory(files.join(root, directory, BIN));
10012
- return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$14}${name}`), Array.filter(isCommand$1));
10193
+ return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$13}${name}`), Array.filter(isCommand$1));
10013
10194
  });
10014
10195
  const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
10015
10196
  const files = yield* RepositoryFiles;
10016
10197
  const listed = yield* files.listedFiles(root);
10017
10198
  const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
10018
- const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$20 });
10199
+ const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$21 });
10019
10200
  return pipe(Array.getSomes(texts), Array.join("\n"));
10020
10201
  });
10021
- const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$14));
10202
+ const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13));
10022
10203
  const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND$1.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
10023
10204
  file,
10024
10205
  ...positionOf(source)(start),
@@ -10026,7 +10207,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
10026
10207
  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.`
10027
10208
  })));
10028
10209
  const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
10029
- const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
10210
+ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
10030
10211
  const files = yield* RepositoryFiles;
10031
10212
  const config = yield* workspaceConfigOf(root, directory);
10032
10213
  const entries = yield* declaredEntries(root, directory);
@@ -10042,8 +10223,8 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, directo
10042
10223
  const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
10043
10224
  const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
10044
10225
  file: files.join(root, directory, path),
10045
- line: FIRST$12,
10046
- column: FIRST$12,
10226
+ line: FIRST$13,
10227
+ column: FIRST$13,
10047
10228
  rule: UNRUN,
10048
10229
  message: `No task, package.json bin or workflow runs ${workspacePath(directory, path)}. Files in ${BIN}/ are entry points for fallow, so an unused one is never reported. Run it from a task or delete it.`
10049
10230
  })));
@@ -10055,8 +10236,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
10055
10236
  const isDirectory = yield* files.isDirectory(file);
10056
10237
  return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
10057
10238
  file,
10058
- line: FIRST$12,
10059
- column: FIRST$12,
10239
+ line: FIRST$13,
10240
+ column: FIRST$13,
10060
10241
  rule: SCRIPTS,
10061
10242
  message: `${workspacePath(directory, SCRIPTS_DIRECTORY)} is a scripts directory. Put each command at ${BIN}/<name>.ts and the code that it shares in the package's own source, so that every workspace runs its commands the same way.`
10062
10243
  })));
@@ -10065,47 +10246,47 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
10065
10246
  const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
10066
10247
  const all = ["", ...yield* workspaceDirectories(root)];
10067
10248
  const workflows = yield* workflowText(root);
10068
- const found = yield* Effect.forEach(all, (directory) => problemsIn$16(root, directory, workflows), { concurrency: READ_CONCURRENCY$20 });
10069
- const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$20 });
10249
+ const found = yield* Effect.forEach(all, (directory) => problemsIn$18(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
10250
+ const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
10070
10251
  return [...Array.flatten(found), ...Array.getSomes(scripts)];
10071
10252
  });
10072
10253
  // src/features/check-repository-layout/model/crates.ts
10073
- const RULE$40 = "unverified-crate";
10254
+ const RULE$45 = "unverified-crate";
10074
10255
  const VERSION_RULE = "release-version";
10075
10256
  const MANIFEST_FILE$1 = "package.json";
10076
10257
  const APP_DIRECTORIES = ["", "src-tauri"];
10077
10258
  const CARGO_FILE$1 = "Cargo.toml";
10078
10259
  const CONFIG_FILE$6 = "vite.config.ts";
10079
- const SEPARATOR$13 = "/";
10080
- const FIRST$11 = 1;
10081
- const READ_CONCURRENCY$19 = 8;
10260
+ const SEPARATOR$12 = "/";
10261
+ const FIRST$12 = 1;
10262
+ const READ_CONCURRENCY$20 = 8;
10082
10263
  const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
10083
- const problemFor$2 = (crate, message) => ({
10264
+ const problemFor$4 = (crate, message) => ({
10084
10265
  file: crate.manifest,
10085
- line: FIRST$11,
10086
- column: FIRST$11,
10087
- rule: RULE$40,
10266
+ line: FIRST$12,
10267
+ column: FIRST$12,
10268
+ rule: RULE$45,
10088
10269
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
10089
10270
  });
10090
- const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
10271
+ const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
10091
10272
  const files = yield* RepositoryFiles;
10092
10273
  const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
10093
- if (Option.isNone(workspace)) return Option.some(problemFor$2(crate, "is outside every workspace package"));
10274
+ if (Option.isNone(workspace)) return Option.some(problemFor$4(crate, "is outside every workspace package"));
10094
10275
  if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
10095
- return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
10276
+ return Option.some(problemFor$4(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
10096
10277
  });
10097
10278
  const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
10098
10279
  const files = yield* RepositoryFiles;
10099
10280
  const directory = files.relative(root, files.dirname(crate.manifest));
10100
- const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13))), Array.contains(directory))));
10281
+ const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$12))), Array.contains(directory))));
10101
10282
  if (Option.isNone(workspace)) return Option.none();
10102
10283
  const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE$1));
10103
10284
  const version = pipe(text, Option.flatMap(Schema.decodeOption(PackageVersion)), Option.map((manifest) => manifest.version));
10104
10285
  if (Option.isNone(version) || version.value === crate.version) return Option.none();
10105
10286
  return Option.some({
10106
10287
  file: crate.manifest,
10107
- line: FIRST$11,
10108
- column: FIRST$11,
10288
+ line: FIRST$12,
10289
+ column: FIRST$12,
10109
10290
  rule: VERSION_RULE,
10110
10291
  message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE$1} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
10111
10292
  });
@@ -10116,11 +10297,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
10116
10297
  if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
10117
10298
  const directories = yield* workspaceDirectories(root);
10118
10299
  const crates = yield* cratesIn(root);
10119
- const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$19 });
10300
+ const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$20 });
10120
10301
  return Array.getSomes(Array.flatten(found));
10121
10302
  });
10122
10303
  // src/features/check-repository-layout/model/deploy-entry-patterns.ts
10123
- const RULE$39 = "deploy-entry-pattern";
10304
+ const RULE$44 = "deploy-entry-pattern";
10124
10305
  const FALLOW_KEYS = [
10125
10306
  "entry",
10126
10307
  "entryPoints",
@@ -10138,7 +10319,7 @@ const NEGATED = "!";
10138
10319
  const ROOT_WORKSPACE = ".";
10139
10320
  const WRAP_OFFSET$1 = 1;
10140
10321
  const NO_OFFSET = 0;
10141
- const READ_CONCURRENCY$18 = 8;
10322
+ const READ_CONCURRENCY$19 = 8;
10142
10323
  const MESSAGE$11 = "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.";
10143
10324
  const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
10144
10325
  const FALLOW = {
@@ -10175,7 +10356,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
10175
10356
  const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
10176
10357
  return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
10177
10358
  });
10178
- const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(request) {
10359
+ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
10179
10360
  const { root, file, kind, workspaces, entries } = request;
10180
10361
  const files = yield* RepositoryFiles;
10181
10362
  const path = files.join(root, file);
@@ -10191,7 +10372,7 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(request) {
10191
10372
  return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
10192
10373
  file: path,
10193
10374
  ...positionOf(text.value)(start - kind.offset),
10194
- rule: RULE$39,
10375
+ rule: RULE$44,
10195
10376
  message: `${pattern} ${MESSAGE$11}`
10196
10377
  })));
10197
10378
  });
@@ -10214,17 +10395,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
10214
10395
  }];
10215
10396
  return [];
10216
10397
  }));
10217
- const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$15({
10398
+ const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$17({
10218
10399
  root,
10219
10400
  file,
10220
10401
  kind,
10221
10402
  workspaces,
10222
10403
  entries
10223
- }), { concurrency: READ_CONCURRENCY$18 });
10404
+ }), { concurrency: READ_CONCURRENCY$19 });
10224
10405
  return Array.flatten(found);
10225
10406
  });
10226
10407
  // src/features/check-repository-layout/model/fallow-entries.ts
10227
- const RULE$38 = "listed-entry";
10408
+ const RULE$43 = "listed-entry";
10228
10409
  const ENTRY_KEYS = [
10229
10410
  "entry",
10230
10411
  "entryPoints",
@@ -10232,9 +10413,9 @@ const ENTRY_KEYS = [
10232
10413
  ];
10233
10414
  const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
10234
10415
  const WILDCARD$3 = /[*?{[]/u;
10235
- const SEPARATOR$12 = "/";
10416
+ const SEPARATOR$11 = "/";
10236
10417
  const WRAP_OFFSET = 1;
10237
- const READ_CONCURRENCY$17 = 8;
10418
+ const READ_CONCURRENCY$18 = 8;
10238
10419
  const decodeKey = Schema.decodeUnknownOption(KeySchema);
10239
10420
  const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
10240
10421
  const entryPatternsIn = (node) => {
@@ -10244,8 +10425,8 @@ const entryPatternsIn = (node) => {
10244
10425
  })));
10245
10426
  return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
10246
10427
  };
10247
- const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$12}`)(text))) || String$1.includes(SEPARATOR$12)(text) && !WILDCARD$3.test(text);
10248
- const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
10428
+ const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
10429
+ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
10249
10430
  const files = yield* RepositoryFiles;
10250
10431
  const path = files.join(root, file);
10251
10432
  const text = yield* files.readFile(path);
@@ -10254,7 +10435,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
10254
10435
  return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
10255
10436
  file: path,
10256
10437
  ...positionOf(text.value)(start),
10257
- rule: RULE$38,
10438
+ rule: RULE$43,
10258
10439
  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.`
10259
10440
  })));
10260
10441
  });
@@ -10262,15 +10443,15 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
10262
10443
  const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
10263
10444
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10264
10445
  const directories = yield* workspaceDirectories(root);
10265
- const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$14(root, file, directories), { concurrency: READ_CONCURRENCY$17 });
10446
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$16(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
10266
10447
  return Array.flatten(found);
10267
10448
  });
10268
10449
  // src/features/check-repository-layout/model/root-workspace-paths.ts
10269
- const RULE$37 = "root-workspace-path";
10450
+ const RULE$42 = "root-workspace-path";
10270
10451
  const CONFIG_FILE$5 = "vite.config.ts";
10271
10452
  const PATH_CHARACTER = /[\w.@/-]/u;
10272
10453
  const NAME_CHARACTER = /[\w.@-]/u;
10273
- const FIRST$10 = 0;
10454
+ const FIRST$11 = 0;
10274
10455
  const NEXT$2 = 1;
10275
10456
  const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
10276
10457
  const mentions = (directory) => (text) => {
@@ -10278,14 +10459,14 @@ const mentions = (directory) => (text) => {
10278
10459
  return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
10279
10460
  const before = parts[index] ?? "";
10280
10461
  const previous = String$1.slice(before.length - NEXT$2)(before);
10281
- const following = String$1.slice(FIRST$10, NEXT$2)(after);
10462
+ const following = String$1.slice(FIRST$11, NEXT$2)(after);
10282
10463
  return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
10283
10464
  }));
10284
10465
  };
10285
- const problemsIn$13 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
10466
+ const problemsIn$15 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
10286
10467
  file,
10287
10468
  ...positionOf(source)(found.start),
10288
- rule: RULE$37,
10469
+ rule: RULE$42,
10289
10470
  message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
10290
10471
  })));
10291
10472
  /** @internal */
@@ -10296,14 +10477,14 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
10296
10477
  if (Option.isNone(source)) return [];
10297
10478
  const directories = yield* workspaceDirectories(root);
10298
10479
  const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
10299
- return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$13(file, source.value, directories)));
10480
+ return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$15(file, source.value, directories)));
10300
10481
  });
10301
10482
  // src/features/check-repository-layout/model/hidden-verify.ts
10302
- const RULE$36 = "hidden-verify";
10483
+ const RULE$41 = "hidden-verify";
10303
10484
  const CONFIG_FILE$4 = "vite.config.ts";
10304
- const FIRST$9 = 1;
10305
- const READ_CONCURRENCY$16 = 8;
10306
- const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
10485
+ const FIRST$10 = 1;
10486
+ const READ_CONCURRENCY$17 = 8;
10487
+ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
10307
10488
  const config = yield* workspaceConfigOf(root, directory);
10308
10489
  if (Option.isNone(config)) return Option.none();
10309
10490
  const { file, program } = config.value;
@@ -10311,21 +10492,21 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
10311
10492
  const verified = yield* hasVerifyTask(file);
10312
10493
  return Option.some({
10313
10494
  file,
10314
- line: FIRST$9,
10315
- column: FIRST$9,
10316
- rule: RULE$36,
10495
+ line: FIRST$10,
10496
+ column: FIRST$10,
10497
+ rule: RULE$41,
10317
10498
  message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
10318
10499
  }).pipe(Option.filter(() => verified));
10319
10500
  });
10320
10501
  /** @internal */
10321
10502
  const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
10322
10503
  const directories = yield* workspaceDirectories(root);
10323
- const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$16 });
10504
+ const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$17 });
10324
10505
  return Array.getSomes(found);
10325
10506
  });
10326
10507
  // src/features/check-repository-layout/model/shared-uncached-tasks.ts
10327
- const RULE$35 = "shared-uncached-task";
10328
- const READ_CONCURRENCY$15 = 8;
10508
+ const RULE$40 = "shared-uncached-task";
10509
+ const READ_CONCURRENCY$16 = 8;
10329
10510
  const SHARED = 2;
10330
10511
  const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
10331
10512
  const UncachedTask = Schema.Struct({
@@ -10367,19 +10548,19 @@ const problemsOf$3 = (definitions) => {
10367
10548
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
10368
10549
  file,
10369
10550
  ...position,
10370
- rule: RULE$35,
10551
+ rule: RULE$40,
10371
10552
  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.`
10372
10553
  })));
10373
10554
  };
10374
10555
  /** @internal */
10375
10556
  const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
10376
10557
  const directories = yield* workspaceDirectories(root);
10377
- const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$15 });
10558
+ const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$16 });
10378
10559
  return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
10379
10560
  });
10380
10561
  // src/features/check-repository-layout/model/unlocked-tasks.ts
10381
- const RULE$34 = "unlocked-task";
10382
- const READ_CONCURRENCY$14 = 8;
10562
+ const RULE$39 = "unlocked-task";
10563
+ const READ_CONCURRENCY$15 = 8;
10383
10564
  const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
10384
10565
  const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
10385
10566
  const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array.findFirst(Array.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
@@ -10390,13 +10571,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
10390
10571
  const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
10391
10572
  file,
10392
10573
  ...positionOf(source)(task.start),
10393
- rule: RULE$34,
10574
+ rule: RULE$39,
10394
10575
  message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
10395
10576
  })), Option.toArray)));
10396
10577
  /** @internal */
10397
10578
  const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
10398
10579
  const directories = yield* workspaceDirectories(root);
10399
- const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$14 });
10580
+ const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$15 });
10400
10581
  return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
10401
10582
  });
10402
10583
  // src/features/check-repository-layout/model/task-checks.ts
@@ -10445,7 +10626,7 @@ const scalarsIn = (source) => {
10445
10626
  const ROOT$2 = ".";
10446
10627
  const LOCAL$1 = "./";
10447
10628
  const NEGATION = "!";
10448
- const SEPARATOR$11 = "/";
10629
+ const SEPARATOR$10 = "/";
10449
10630
  const LINE$1 = "\n";
10450
10631
  const UNRESOLVED_MARKERS = [
10451
10632
  "${{",
@@ -10472,7 +10653,7 @@ const withoutLocal = (path) => {
10472
10653
  const joinPath = (base, path) => {
10473
10654
  const relative = withoutLocal(String$1.trim(path));
10474
10655
  if (base === ROOT$2) return relative;
10475
- return `${base}${SEPARATOR$11}${relative}`;
10656
+ return `${base}${SEPARATOR$10}${relative}`;
10476
10657
  };
10477
10658
  const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
10478
10659
  const path = String$1.trim(text);
@@ -10495,11 +10676,11 @@ const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(tex
10495
10676
  offset
10496
10677
  })));
10497
10678
  const isFileInput = ([key]) => String$1.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;
10498
- const linesOf = ({ text, offset }) => pipe(String$1.split(text, LINE$1), Array.map((line) => ({
10679
+ const linesOf$1 = ({ text, offset }) => pipe(String$1.split(text, LINE$1), Array.map((line) => ({
10499
10680
  text: line,
10500
10681
  offset
10501
10682
  })));
10502
- const fileInputOf = (field) => ([key, value]) => pipe(stringOf(value), Option.toArray, Array.flatMap(linesOf), Array.flatMap(reference("glob", `${field}.with.${key}`)));
10683
+ const fileInputOf = (field) => ([key, value]) => pipe(stringOf(value), Option.toArray, Array.flatMap(linesOf$1), Array.flatMap(reference("glob", `${field}.with.${key}`)));
10503
10684
  const fileInputsIn = (field, step) => pipe(entriesOf$1(childOf("with")(step)), Array.filter(isFileInput), Array.flatMap(fileInputOf(field)));
10504
10685
  const stepReferences = (job, base) => (step, index) => {
10505
10686
  const field = `jobs.${job}.steps[${index}]`;
@@ -10541,17 +10722,17 @@ const workflowReferences = (source) => {
10541
10722
  ];
10542
10723
  };
10543
10724
  const pathInputOf = (step) => childOf("path")(childOf("with")(step));
10544
- const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf), Array.map(({ text }) => joinPath(ROOT$2, text)), Array.filter(isLiteralPath));
10725
+ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf$1), Array.map(({ text }) => joinPath(ROOT$2, text)), Array.filter(isLiteralPath));
10545
10726
  /** @internal */
10546
10727
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
10547
10728
  // src/features/check-repository-layout/model/workflow-paths.ts
10548
- const RULE$33 = "workflow-path";
10729
+ const RULE$38 = "workflow-path";
10549
10730
  const WORKFLOW_DIRECTORY = ".github/workflows/";
10550
10731
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
10551
- const READ_CONCURRENCY$13 = 8;
10732
+ const READ_CONCURRENCY$14 = 8;
10552
10733
  const WILDCARD$2 = /[*?[]/u;
10553
- const SEPARATOR$10 = "/";
10554
- const FIRST$8 = 0;
10734
+ const SEPARATOR$9 = "/";
10735
+ const FIRST$9 = 0;
10555
10736
  const EXPECTED = {
10556
10737
  action: "a directory with action.yml",
10557
10738
  directory: "a directory",
@@ -10575,10 +10756,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
10575
10756
  return Option.getOrElse(directory, () => false);
10576
10757
  });
10577
10758
  const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
10578
- const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$10}${name}`), { concurrency: 1 });
10759
+ const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$9}${name}`), { concurrency: 1 });
10579
10760
  return pipe(found, Array.some(Boolean));
10580
10761
  });
10581
- const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$10))}`;
10762
+ const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$9))}`;
10582
10763
  const RESOLVERS = {
10583
10764
  action: hasAction,
10584
10765
  directory: isDirectoryAt,
@@ -10586,47 +10767,47 @@ const RESOLVERS = {
10586
10767
  glob: matchesGlob,
10587
10768
  script: Effect.fn("findsScript")(function* findsScript(root, path) {
10588
10769
  if (yield* existsAt(root, path)) return true;
10589
- const segments = String$1.split(path, SEPARATOR$10);
10770
+ const segments = String$1.split(path, SEPARATOR$9);
10590
10771
  return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
10591
10772
  })
10592
10773
  };
10593
10774
  const staticPrefix = (path) => {
10594
10775
  const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
10595
- if (String$1.endsWith(SEPARATOR$10)(prefix)) return String$1.slice(FIRST$8, -1)(prefix);
10776
+ if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
10596
10777
  return prefix;
10597
10778
  };
10598
- const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
10779
+ const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
10599
10780
  const prefix = staticPrefix(path);
10600
10781
  if (String$1.isEmpty(prefix)) return false;
10601
10782
  const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
10602
10783
  return Array.isReadonlyArrayNonEmpty(ignored);
10603
10784
  });
10604
- const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$10}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$10}`)(path);
10785
+ const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$9}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$9}`)(path);
10605
10786
  const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
10606
10787
  const prefix = staticPrefix(found.path);
10607
10788
  if (pipe(produced, Array.some(overlaps(prefix)))) return false;
10608
10789
  if (yield* RESOLVERS[found.kind](root, found.path)) return false;
10609
- return !(yield* isIgnored$1(root, found.path));
10790
+ return !(yield* isIgnored(root, found.path));
10610
10791
  });
10611
- const problemOf$7 = (file, source) => (found) => ({
10792
+ const problemOf$8 = (file, source) => (found) => ({
10612
10793
  file,
10613
10794
  ...positionOf(source)(found.offset),
10614
- rule: RULE$33,
10795
+ rule: RULE$38,
10615
10796
  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.`
10616
10797
  });
10617
- const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
10798
+ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
10618
10799
  const files = yield* RepositoryFiles;
10619
10800
  const file = files.join(root, workflow);
10620
10801
  const source = yield* files.readFile(file);
10621
10802
  if (Option.isNone(source)) return [];
10622
10803
  const produced = producedPaths(source.value);
10623
10804
  const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing$1(root, produced, found));
10624
- return pipe(missing, Array.map(problemOf$7(file, source.value)));
10805
+ return pipe(missing, Array.map(problemOf$8(file, source.value)));
10625
10806
  });
10626
10807
  /** @internal */
10627
10808
  const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
10628
10809
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10629
- const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$12(root, workflow), { concurrency: READ_CONCURRENCY$13 });
10810
+ const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$14(root, workflow), { concurrency: READ_CONCURRENCY$14 });
10630
10811
  return Array.flatten(found);
10631
10812
  });
10632
10813
  // src/features/check-repository-layout/model/workflow-scale.ts
@@ -10637,15 +10818,15 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
10637
10818
  const FILTER_KEYS = ["paths", "paths-ignore"];
10638
10819
  const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
10639
10820
  const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
10640
- const START$19 = 0;
10641
- const READ_CONCURRENCY$12 = 8;
10642
- const SEPARATOR$9 = "/";
10821
+ const START$22 = 0;
10822
+ const READ_CONCURRENCY$13 = 8;
10823
+ const SEPARATOR$8 = "/";
10643
10824
  const WORD_SEPARATORS = /[-_]/gu;
10644
10825
  const SPACE = " ";
10645
10826
  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.";
10646
10827
  const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
10647
10828
  const keysOf$1 = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
10648
- const problemAt$5 = ({ file, source }, rule, message) => (offset) => ({
10829
+ const problemAt$6 = ({ file, source }, rule, message) => (offset) => ({
10649
10830
  file,
10650
10831
  ...positionOf(source)(offset),
10651
10832
  rule,
@@ -10655,20 +10836,20 @@ const pathFiltersIn = (file, source) => {
10655
10836
  const root = parseDocument(source).contents;
10656
10837
  const triggers = pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf$1(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
10657
10838
  const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
10658
- return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$5({
10839
+ return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$6({
10659
10840
  file,
10660
10841
  source
10661
10842
  }, PATH_FILTER, FILTER_MESSAGE)(offset)));
10662
10843
  };
10663
10844
  const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ names }) => Array.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf$1(names))(text))), Option.map(({ directory }) => directory));
10664
10845
  const named$1 = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
10665
- const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$9}`)(path)), Option.map(({ directory }) => directory));
10666
- const namesIn = (name, source) => {
10846
+ const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$8}`)(path)), Option.map(({ directory }) => directory));
10847
+ const namesIn$1 = (name, source) => {
10667
10848
  const root = parseDocument(source).contents;
10668
10849
  return [
10669
10850
  {
10670
10851
  text: name,
10671
- offset: START$19
10852
+ offset: START$22
10672
10853
  },
10673
10854
  ...Option.toArray(stringOf(childOf("name")(root))),
10674
10855
  ...keysOf$1(childOf("jobs")(root))
@@ -10678,13 +10859,13 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, off
10678
10859
  text: value,
10679
10860
  offset
10680
10861
  })))));
10681
- const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$5(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
10862
+ const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$6(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
10682
10863
  const packagesIn = (workspaces, { file, name, source }) => {
10683
10864
  const where = {
10684
10865
  file,
10685
10866
  source
10686
10867
  };
10687
- const fromNames = pipe(namesIn(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
10868
+ const fromNames = pipe(namesIn$1(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
10688
10869
  const referenced = pipe(workflowReferences(source), Array.filter(({ field }) => !String$1.startsWith("on.")(field)), Array.flatMap(({ field, path, offset }) => reported(where, offset, field)(containing(workspaces, path))));
10689
10870
  const filtered = pipe(filtersIn(source), Array.flatMap(({ text, offset }) => reported(where, offset, `--filter ${text}`)(matching(workspaces, text))));
10690
10871
  return [
@@ -10718,7 +10899,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
10718
10899
  name: stem,
10719
10900
  source: text
10720
10901
  })]), Option.getOrElse(() => []));
10721
- }), { concurrency: READ_CONCURRENCY$12 });
10902
+ }), { concurrency: READ_CONCURRENCY$13 });
10722
10903
  const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
10723
10904
  return [...Array.flatten(found), ...actions];
10724
10905
  });
@@ -10737,63 +10918,28 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
10737
10918
  ], { concurrency: "unbounded" });
10738
10919
  return Array.flatten(found);
10739
10920
  });
10740
- // src/features/check-typescript-generation/model/typescript-generation.ts
10741
- const RULE$32 = "legacy-typescript";
10742
- const LOCKFILE = "pnpm-lock.yaml";
10743
- const COMPILER = "typescript";
10744
- const CURRENT_MAJOR = 7;
10745
- const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
10746
- const FIRST$7 = 1;
10747
- const legacyOf = (id) => {
10748
- const { name, version } = parse$1(id);
10749
- const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
10750
- return pipe(Option.fromNullishOr(name), Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? "")), Option.map((found) => ({
10751
- id,
10752
- name: found
10753
- })));
10921
+ // src/shared/lib/package-name.ts
10922
+ const SCOPE$2 = "@";
10923
+ const SEPARATOR$7 = "/";
10924
+ const SCOPED_SEGMENTS = 2;
10925
+ const PLAIN_SEGMENTS = 1;
10926
+ const segmentCount = (specifier) => {
10927
+ if (String$1.startsWith(SCOPE$2)(specifier)) return SCOPED_SEGMENTS;
10928
+ return PLAIN_SEGMENTS;
10754
10929
  };
10755
- const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
10756
- const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
10757
- onNone: () => FIRST$7,
10758
- onSome: (index) => index + FIRST$7
10759
- }));
10760
- const messageOf$2 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array.join(dependents, ", ")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;
10761
- /** @internal */
10762
- const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(function* checkTypescriptGeneration(root) {
10763
- const files = yield* RepositoryFiles;
10764
- const file = files.join(root, LOCKFILE);
10765
- const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));
10766
- const read = yield* files.readFile(file);
10767
- const source = Option.getOrElse(read, () => "");
10768
- return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
10769
- file,
10770
- line: lineOf$2(source)(legacy.id),
10771
- column: FIRST$7,
10772
- rule: RULE$32,
10773
- message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
10774
- })));
10775
- });
10930
+ const packageNameOf = (specifier) => pipe(String$1.split(specifier, SEPARATOR$7), Array.take(segmentCount(specifier)), Array.join(SEPARATOR$7));
10776
10931
  // src/features/measure-install-size/model/import-graph.ts
10777
10932
  const RELATIVE = /^\.\.?(?:\/|$)/u;
10778
- const SUBPATH_IMPORT = "#";
10933
+ const SUBPATH_IMPORT$1 = "#";
10779
10934
  const WILDCARD$1 = "*";
10780
- const SCOPE$2 = "@";
10781
- const SEPARATOR$8 = "/";
10782
10935
  const SOURCE_SUFFIXES = [
10783
10936
  "",
10784
10937
  ".ts",
10785
10938
  ".tsx",
10786
10939
  "/index.ts"
10787
10940
  ];
10788
- const SCOPED_SEGMENTS = 2;
10789
- const PLAIN_SEGMENTS = 1;
10790
10941
  const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
10791
10942
  const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
10792
- const packageNameOf = (specifier) => {
10793
- const segments = String$1.split(specifier, SEPARATOR$8);
10794
- if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$8));
10795
- return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$8));
10796
- };
10797
10943
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
10798
10944
  const runtimeSpecifierOf = (statement) => {
10799
10945
  if (isImportDeclaration(statement)) {
@@ -10830,7 +10976,7 @@ const localFile = Effect.fn("localFile")(function* localFile({ directory, import
10830
10976
  return yield* existingSource(files.resolve(directory, target.value));
10831
10977
  });
10832
10978
  const referenceOf$2 = (graph, from, specifier) => {
10833
- if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
10979
+ if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT$1)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
10834
10980
  const name = packageNameOf(specifier);
10835
10981
  return Effect.succeedSome(Result.fail(name));
10836
10982
  };
@@ -10887,7 +11033,7 @@ const InstalledManifest = Schema.Struct({
10887
11033
  peerDependencies: DependencyMap,
10888
11034
  peerDependenciesMeta: PeerMeta
10889
11035
  });
10890
- const decodeManifest$7 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
11036
+ const decodeManifest$8 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
10891
11037
  const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
10892
11038
  const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
10893
11039
  const installedNames = (manifest) => [
@@ -10898,7 +11044,7 @@ const installedNames = (manifest) => [
10898
11044
  const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
10899
11045
  const files = yield* RepositoryFiles;
10900
11046
  const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
10901
- return pipe(text, Option.flatMap(decodeManifest$7), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
11047
+ return pipe(text, Option.flatMap(decodeManifest$8), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
10902
11048
  });
10903
11049
  const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
10904
11050
  const files = yield* RepositoryFiles;
@@ -10955,30 +11101,30 @@ const INSTALL_SIZE = "install-size";
10955
11101
  const STACK_DEPENDENCY = "stack-dependency";
10956
11102
  const STACK_CATALOG = "catalog:stack";
10957
11103
  const BUDGET_KEY = "installSize";
10958
- const DEPENDENCIES_KEY = "\"dependencies\"";
11104
+ const DEPENDENCIES_KEY$1 = "\"dependencies\"";
10959
11105
  const LISTED_LARGEST = 5;
10960
11106
  const SIZE_CONCURRENCY = 32;
10961
11107
  const MEGABYTE = 1e6;
10962
11108
  const MEGABYTE_DIGITS = 1;
10963
- const START$18 = 0;
11109
+ const START$21 = 0;
10964
11110
  const SINGLE_ENTRY = 1;
10965
11111
  const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
10966
11112
  const usageHint = (dependency, entryCount) => {
10967
- if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$18 && dependency.entries.length < entryCount)) return "";
11113
+ if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$21 && dependency.entries.length < entryCount)) return "";
10968
11114
  return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
10969
11115
  };
10970
- const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
11116
+ const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
10971
11117
  const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun) {
10972
11118
  const files = yield* RepositoryFiles;
10973
11119
  const { workspace, total } = overrun;
10974
11120
  const config = yield* files.readFile(workspace.configFile);
10975
11121
  const source = Option.getOrElse(config, () => "");
10976
- const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$18);
11122
+ const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$21);
10977
11123
  return {
10978
11124
  file: workspace.configFile,
10979
11125
  ...positionOf(source)(index),
10980
11126
  rule: INSTALL_SIZE,
10981
- message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`
11127
+ message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed$1(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`
10982
11128
  };
10983
11129
  });
10984
11130
  const measure = Effect.fn("measure")(function* measure({ workspace, provided }, direct) {
@@ -10990,7 +11136,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
10990
11136
  const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
10991
11137
  const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
10992
11138
  const sizes = HashMap.fromIterable(measured);
10993
- const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$18))));
11139
+ const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$21)), Number$1.sumAll);
10994
11140
  return {
10995
11141
  closures,
10996
11142
  sizeOf,
@@ -11023,11 +11169,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
11023
11169
  })];
11024
11170
  });
11025
11171
  const stackProblems = (file, source, dependencies) => {
11026
- const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$18);
11172
+ const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$21);
11027
11173
  const rest = String$1.slice(section)(source);
11028
11174
  return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
11029
11175
  file,
11030
- ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$18)),
11176
+ ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$21)),
11031
11177
  rule: STACK_DEPENDENCY,
11032
11178
  message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
11033
11179
  })));
@@ -11057,7 +11203,7 @@ const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
11057
11203
  }, Record.keys(dependencies));
11058
11204
  return [...stackProblems(file, source, dependencies), ...sized];
11059
11205
  });
11060
- const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
11206
+ const workspaceProblems$1 = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
11061
11207
  const files = yield* RepositoryFiles;
11062
11208
  const file = files.join(workspace.directory, MANIFEST_FILE$3);
11063
11209
  const source = yield* files.readFile(file);
@@ -11069,27 +11215,462 @@ const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProb
11069
11215
  /** @internal */
11070
11216
  const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* checkPublishedPackages(root) {
11071
11217
  const workspaces = yield* publishedWorkspaces(root);
11072
- const found = yield* Effect.forEach(workspaces, workspaceProblems, { concurrency: 1 });
11218
+ const found = yield* Effect.forEach(workspaces, workspaceProblems$1, { concurrency: 1 });
11073
11219
  return Array.flatten(found);
11074
11220
  });
11075
- // src/features/check-value-owners/model/slots.ts
11076
- const ANNOTATED_KINDS = /* @__PURE__ */ new Set([
11077
- SyntaxKind.Parameter,
11078
- SyntaxKind.VariableDeclaration,
11079
- SyntaxKind.PropertySignature,
11080
- SyntaxKind.PropertyDeclaration
11081
- ]);
11082
- const isAnnotated = (declaration) => ANNOTATED_KINDS.has(declaration.kind);
11083
- const annotationOf = (declaration) => Option.liftPredicate(declaration, isAnnotated).pipe(Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)));
11084
- const argumentSlot = (checker) => (expression) => {
11085
- const call = expression.parent;
11086
- if (!isCallExpression(call) && !isNewExpression(call)) return Option.none();
11087
- const { arguments: listed } = call;
11088
- const index = (listed ?? []).indexOf(expression);
11089
- return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())), Option.filter(isSignatureDeclaration), Option.flatMap((declaration) => Array.get(declaration.parameters, index)));
11221
+ // src/shared/lib/bundle-error.ts
11222
+ const ERROR_LINE = /\[[A-Z_]+\]/u;
11223
+ const SHOWN_ERRORS = 3;
11224
+ const HEADER = "Build failed";
11225
+ const NO_DETAIL = "Run the bundle to see the error.";
11226
+ const linesOf = (error) => pipe(Option.liftPredicate(error, Predicate.isError), Option.map(({ message }) => message), Option.getOrElse(() => String(error)), stripVTControlCharacters, String$1.split("\n"), Array.map(String$1.trim), Array.filter(String$1.isNonEmpty));
11227
+ const bundleErrorDetail = (error) => {
11228
+ const lines = linesOf(error);
11229
+ return pipe(lines, Array.filter((line) => ERROR_LINE.test(line)), Array.take(SHOWN_ERRORS), Array.match({
11230
+ onEmpty: () => pipe(lines, Array.findFirst((line) => !String$1.startsWith(HEADER)(line)), Option.getOrElse(() => NO_DETAIL)),
11231
+ onNonEmpty: Array.join(" ")
11232
+ }));
11090
11233
  };
11091
- const propertySlot = (checker) => (expression) => {
11092
- const assignment = expression.parent;
11234
+ // src/features/check-tree-shaking/model/consumer-bundle.ts
11235
+ const VIRTUAL_PREFIX = "\0";
11236
+ const VIRTUAL = `${VIRTUAL_PREFIX}tree-shaking-consumer`;
11237
+ const VIRTUAL_ID = /^\0tree-shaking-consumer$/u;
11238
+ const ABSOLUTE = /^(?:[A-Za-z]:)?[\\/]/u;
11239
+ const NODE_PROTOCOL = "node:";
11240
+ const SUBPATH_IMPORT = "#";
11241
+ const RELATIVE_PREFIX = ".";
11242
+ const NAMESPACE = "namespace";
11243
+ const Quoted = Schema.fromJsonString(Schema.String);
11244
+ const quote = (text) => pipe(Schema.encodeOption(Quoted)(text), Option.getOrElse(() => text));
11245
+ const builtins = new Set(builtinModules);
11246
+ const always = () => true;
11247
+ const never = () => false;
11248
+ const taggedError$5 = Schema.TaggedError;
11249
+ var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schema.String }) {};
11250
+ const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
11251
+ const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
11252
+ const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
11253
+ const isExternal = ({ bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && !Array.contains(bundled, packageNameOf(specifier));
11254
+ const consumerSource = ({ entry, member }) => Option.match(member, {
11255
+ onNone: () => `export * from ${quote(entry)};\n`,
11256
+ onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`
11257
+ });
11258
+ const baseOptions = (scope, effectful) => ({
11259
+ platform: "node",
11260
+ logLevel: "silent",
11261
+ external: isExternal(scope),
11262
+ treeshake: { moduleSideEffects: effectful }
11263
+ });
11264
+ const consumerPlugin = (consumer) => [{
11265
+ name: "tree-shaking-consumer",
11266
+ resolveId: {
11267
+ filter: { id: VIRTUAL_ID },
11268
+ handler: () => VIRTUAL
11269
+ },
11270
+ load: {
11271
+ filter: { id: VIRTUAL_ID },
11272
+ handler: () => consumerSource(consumer)
11273
+ }
11274
+ }];
11275
+ const optionsFor = (scope, input, effectful) => {
11276
+ const base = baseOptions(scope, effectful);
11277
+ if (input.kind === "program") return {
11278
+ ...base,
11279
+ input: input.file
11280
+ };
11281
+ return {
11282
+ ...base,
11283
+ input: VIRTUAL,
11284
+ plugins: consumerPlugin(input.consumer)
11285
+ };
11286
+ };
11287
+ const isChunk = (item) => item.type === "chunk";
11288
+ const keptBy = (chunks) => ({
11289
+ modules: pipe(chunks, Array.flatMap((chunk) => Record.keys(chunk.modules)), Array.filter((id) => !String$1.startsWith(VIRTUAL_PREFIX)(id)), Array.dedupe, Array.sortBy(Order.String)),
11290
+ packages: pipe(chunks, Array.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]), Array.filter((specifier) => isBare(specifier) && !isBuiltin(specifier)), Array.map(packageNameOf), Array.dedupe, Array.sortBy(Order.String))
11291
+ });
11292
+ const generate = (options) => Effect.acquireUseRelease(Effect.tryPromise({
11293
+ try: () => rolldown(options),
11294
+ catch: failed
11295
+ }), (bundle) => Effect.tryPromise({
11296
+ try: () => bundle.generate({ format: "esm" }),
11297
+ catch: failed
11298
+ }), (bundle) => Effect.promise(() => bundle.close())).pipe(Effect.map(({ output }) => pipe(output, Array.filter(isChunk))));
11299
+ const keptIn = Effect.fn("keptIn")(function* keptIn(scope, input, effectful) {
11300
+ const chunks = yield* generate(optionsFor(scope, input, effectful));
11301
+ return keptBy(chunks);
11302
+ });
11303
+ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope, entry) {
11304
+ const chunks = yield* generate(optionsFor(scope, {
11305
+ kind: "program",
11306
+ file: entry
11307
+ }, always));
11308
+ return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
11309
+ });
11310
+ // src/features/check-tree-shaking/model/manifest.ts
11311
+ const Manifest$5 = Schema.Struct({
11312
+ name: Schema.optional(Schema.String),
11313
+ exports: Schema.optional(Schema.Unknown),
11314
+ bin: Schema.optional(Schema.Unknown),
11315
+ sideEffects: Schema.optional(Schema.Unknown),
11316
+ dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String))
11317
+ });
11318
+ const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$5));
11319
+ const manifestOf$1 = (text) => decode(text);
11320
+ const dependencyNames = (manifest) => pipe(Option.fromUndefinedOr(manifest.dependencies), Option.map(Record.keys), Option.getOrElse(() => []));
11321
+ const isFileList = Schema.is(Schema.Array(Schema.String));
11322
+ const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
11323
+ const listedSources = (declared, { workspace, join }) => new Set(pipe(declared, Array.flatMap((target) => Array.append(sourcesOf$1(workspace, target), join(target)))));
11324
+ const declaredBy$1 = ({ declared, locator }) => {
11325
+ if (declared === false) return {
11326
+ effectful: never,
11327
+ entries: /* @__PURE__ */ new Set(),
11328
+ complete: true,
11329
+ claimed: true
11330
+ };
11331
+ if (!isFileList(declared)) return {
11332
+ effectful: always,
11333
+ entries: /* @__PURE__ */ new Set(),
11334
+ complete: false,
11335
+ claimed: false
11336
+ };
11337
+ const sources = listedSources(declared, locator);
11338
+ return {
11339
+ effectful: (id) => sources.has(id),
11340
+ entries: sources,
11341
+ complete: false,
11342
+ claimed: true
11343
+ };
11344
+ };
11345
+ // src/features/check-tree-shaking/model/optional-peers.ts
11346
+ const RULE$37 = "optional-peer";
11347
+ const START$20 = 0;
11348
+ const SINGLE = 1;
11349
+ const DEPENDENCIES_KEY = "\"dependencies\"";
11350
+ const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
11351
+ const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
11352
+ const problemFor$3 = (located, name, importers) => {
11353
+ const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$20);
11354
+ const rest = String$1.slice(section)(located.source);
11355
+ return {
11356
+ file: located.file,
11357
+ ...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
11358
+ rule: RULE$37,
11359
+ message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
11360
+ };
11361
+ };
11362
+ const optionalPeerProblems = ({ located, dependencies, used }) => {
11363
+ const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
11364
+ const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
11365
+ if (libraries.length <= SINGLE) return [];
11366
+ return pipe(dependencies, Array.flatMap((name) => {
11367
+ const importers = pipe(libraries, Array.filter(importsPackage(name)));
11368
+ const neededByBin = pipe(bins, Array.some(importsPackage(name)));
11369
+ if (!(importers.length > START$20 && importers.length < libraries.length) || neededByBin) return [];
11370
+ return [problemFor$3(located, name, importers)];
11371
+ }));
11372
+ };
11373
+ // src/features/check-tree-shaking/model/side-effects.ts
11374
+ const RULE$36 = "side-effects";
11375
+ const BUNDLE_CONCURRENCY$2 = 4;
11376
+ const START$19 = 0;
11377
+ const FIRST$8 = 1;
11378
+ const LISTED_PACKAGES = 4;
11379
+ const SIDE_EFFECTS_KEY = "\"sideEffects\"";
11380
+ const EXPORTS_KEY = "\"exports\"";
11381
+ const beyond = (kept, ideal) => ({
11382
+ modules: Array.difference(kept.modules, ideal.modules).length,
11383
+ packages: Array.difference(kept.packages, ideal.packages)
11384
+ });
11385
+ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, effectful, entry }, member) {
11386
+ const input = {
11387
+ kind: "consumer",
11388
+ consumer: {
11389
+ entry: entry.source,
11390
+ member: Option.some(member)
11391
+ }
11392
+ };
11393
+ const kept = yield* keptIn(scope, input, effectful);
11394
+ const ideal = yield* keptIn(scope, input, never);
11395
+ const extra = beyond(kept, ideal);
11396
+ return Option.liftPredicate({
11397
+ label: entry.label,
11398
+ member,
11399
+ ...extra
11400
+ }, ({ modules }) => modules > START$19);
11401
+ });
11402
+ const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
11403
+ const names = yield* exportNamesOf(subject.scope, subject.entry.source);
11404
+ const found = yield* Effect.forEach(names, (name) => memberExcess(subject, name), { concurrency: BUNDLE_CONCURRENCY$2 });
11405
+ return Array.getSomes(found);
11406
+ });
11407
+ const listed = (names) => {
11408
+ const shown = pipe(names, Array.take(LISTED_PACKAGES), Array.join(", "));
11409
+ if (names.length > LISTED_PACKAGES) return `${shown} and more`;
11410
+ return shown;
11411
+ };
11412
+ const importsOf = (packages) => Array.match(packages, {
11413
+ onEmpty: () => "",
11414
+ onNonEmpty: (names) => ` and imports ${listed(names)}`
11415
+ });
11416
+ const othersOf = (total) => {
11417
+ if (total <= FIRST$8) return "";
11418
+ return ` The same happens for ${String(total - FIRST$8)} other exports.`;
11419
+ };
11420
+ const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
11421
+ const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
11422
+ const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$19));
11423
+ const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
11424
+ file,
11425
+ ...positionOf(source)(keyIndex$1(source)),
11426
+ rule: RULE$36,
11427
+ message: messageOf$4(worst, excesses.length)
11428
+ })), Option.toArray);
11429
+ // src/features/check-tree-shaking/model/top-level-effects.ts
11430
+ const RULE$35 = "top-level-effect";
11431
+ const CODE$1 = /\.[cm]?[jt]sx?$/u;
11432
+ const READ_CONCURRENCY$12 = 16;
11433
+ const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
11434
+ const STATEMENT_MESSAGE = "runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.";
11435
+ const isEffect = (statement) => {
11436
+ if (isExpressionStatement(statement)) return !isStringLiteral(statement.expression);
11437
+ return isImportDeclaration(statement) && Predicate.isUndefined(statement.importClause);
11438
+ };
11439
+ const messageOf$3 = (statement) => {
11440
+ if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
11441
+ return STATEMENT_MESSAGE;
11442
+ };
11443
+ const problemsIn$13 = (api) => (file) => (source) => {
11444
+ const retained = api.createSourceFile(file, source);
11445
+ const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$8({
11446
+ rule: RULE$35,
11447
+ message: messageOf$3(statement)
11448
+ })(statement)));
11449
+ retained.dispose();
11450
+ return problems;
11451
+ };
11452
+ /** @internal */
11453
+ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(root, modules) {
11454
+ const files = yield* RepositoryFiles;
11455
+ const compiler = yield* typeScriptCompiler;
11456
+ const names = yield* files.ownedFiles(root);
11457
+ const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
11458
+ const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
11459
+ const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$13(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
11460
+ return Array.flatten(found);
11461
+ }, Effect.scoped);
11462
+ // src/features/check-tree-shaking/model/usage.ts
11463
+ const inputOf = (entry) => {
11464
+ if (isBinEntry(entry)) return {
11465
+ kind: "program",
11466
+ file: entry.source
11467
+ };
11468
+ return {
11469
+ kind: "consumer",
11470
+ consumer: {
11471
+ entry: entry.source,
11472
+ member: Option.none()
11473
+ }
11474
+ };
11475
+ };
11476
+ const usedBy = Effect.fn("usedBy")(function* usedBy(scope, entry) {
11477
+ const kept = yield* keptIn(scope, inputOf(entry), always);
11478
+ return {
11479
+ entry,
11480
+ packages: kept.packages,
11481
+ modules: kept.modules
11482
+ };
11483
+ });
11484
+ const modulesToScan = ({ used, declared }) => pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)), Array.flatMap(({ modules }) => modules), Array.dedupe, Array.filter((module) => !declared.entries.has(module)));
11485
+ // src/features/check-tree-shaking/model/tree-shaking.ts
11486
+ const BUNDLE = "tree-shake-bundle";
11487
+ const BUNDLE_CONCURRENCY$1 = 4;
11488
+ const shapeOf = Effect.fn("shapeOf")(function* shapeOf({ workspace, manifest }) {
11489
+ const files = yield* RepositoryFiles;
11490
+ const join = (target) => files.join(workspace.directory, target);
11491
+ const entries = pipe(publicEntriesOf({
11492
+ manifest,
11493
+ join,
11494
+ packEntries: workspace.packEntries
11495
+ }), Array.dedupeWith((left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right)));
11496
+ return {
11497
+ scope: { bundled: workspace.alwaysBundle },
11498
+ declared: declaredBy$1({
11499
+ declared: manifest.sideEffects,
11500
+ locator: {
11501
+ workspace,
11502
+ join
11503
+ }
11504
+ }),
11505
+ entries
11506
+ };
11507
+ });
11508
+ const excessesOf = Effect.fn("excessesOf")(function* excessesOf({ scope, declared, entries }) {
11509
+ if (declared.complete) return [];
11510
+ const shaken = pipe(entries, Array.filter((entry) => !isBinEntry(entry) && !declared.entries.has(entry.source)));
11511
+ const found = yield* Effect.forEach(shaken, (entry) => excessOf({
11512
+ scope,
11513
+ effectful: declared.effectful,
11514
+ entry
11515
+ }), { concurrency: BUNDLE_CONCURRENCY$1 });
11516
+ return Array.flatten(found);
11517
+ });
11518
+ const effectsOf = Effect.fn("effectsOf")(function* effectsOf(root, declared, used) {
11519
+ if (!declared.claimed) return [];
11520
+ return yield* topLevelEffects(root, modulesToScan({
11521
+ used,
11522
+ declared
11523
+ }));
11524
+ });
11525
+ const analyse = Effect.fn("analyse")(function* analyse(pack) {
11526
+ const { root, located, manifest } = pack;
11527
+ const shape = yield* shapeOf(pack);
11528
+ const excesses = yield* excessesOf(shape);
11529
+ const used = yield* Effect.forEach(shape.entries, (entry) => usedBy(shape.scope, entry), { concurrency: BUNDLE_CONCURRENCY$1 });
11530
+ const effects = yield* effectsOf(root, shape.declared, used);
11531
+ return [
11532
+ ...sideEffectProblems({
11533
+ file: located.file,
11534
+ source: located.source,
11535
+ excesses
11536
+ }),
11537
+ ...effects,
11538
+ ...optionalPeerProblems({
11539
+ located,
11540
+ dependencies: dependencyNames(manifest),
11541
+ used
11542
+ })
11543
+ ];
11544
+ });
11545
+ const bundleProblem$1 = (file, error) => [problemInFile(BUNDLE)(file, `does not bundle for the tree-shaking check. ${error.detail}`)];
11546
+ const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(root, workspace) {
11547
+ const files = yield* RepositoryFiles;
11548
+ const file = files.join(workspace.directory, MANIFEST_FILE$3);
11549
+ const source = yield* files.readFile(file);
11550
+ const manifest = pipe(source, Option.flatMap(manifestOf$1));
11551
+ if (Option.isNone(source) || Option.isNone(manifest)) return [];
11552
+ const located = {
11553
+ file,
11554
+ source: source.value
11555
+ };
11556
+ return yield* analyse({
11557
+ root,
11558
+ workspace,
11559
+ located,
11560
+ manifest: manifest.value
11561
+ }).pipe(Effect.catchTag("BundleFailed", (error) => Effect.succeed(bundleProblem$1(file, error))));
11562
+ });
11563
+ /** @internal */
11564
+ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShaking(root) {
11565
+ const workspaces = yield* packedWorkspaces(root);
11566
+ const found = yield* Effect.forEach(workspaces, (workspace) => workspaceProblems(root, workspace), { concurrency: 1 });
11567
+ return Array.flatten(found);
11568
+ });
11569
+ // src/features/check-typescript-generation/model/typescript-generation.ts
11570
+ const RULE$34 = "legacy-typescript";
11571
+ const LOCKFILE = "pnpm-lock.yaml";
11572
+ const COMPILER = "typescript";
11573
+ const CURRENT_MAJOR = 7;
11574
+ const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
11575
+ const FIRST$7 = 1;
11576
+ const legacyOf = (id) => {
11577
+ const { name, version } = parse$1(id);
11578
+ const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
11579
+ return pipe(Option.fromNullishOr(name), Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? "")), Option.map((found) => ({
11580
+ id,
11581
+ name: found
11582
+ })));
11583
+ };
11584
+ const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
11585
+ const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
11586
+ onNone: () => FIRST$7,
11587
+ onSome: (index) => index + FIRST$7
11588
+ }));
11589
+ const messageOf$2 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array.join(dependents, ", ")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;
11590
+ /** @internal */
11591
+ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(function* checkTypescriptGeneration(root) {
11592
+ const files = yield* RepositoryFiles;
11593
+ const file = files.join(root, LOCKFILE);
11594
+ const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));
11595
+ const read = yield* files.readFile(file);
11596
+ const source = Option.getOrElse(read, () => "");
11597
+ return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
11598
+ file,
11599
+ line: lineOf$2(source)(legacy.id),
11600
+ column: FIRST$7,
11601
+ rule: RULE$34,
11602
+ message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
11603
+ })));
11604
+ });
11605
+ // src/features/check-worker-bundles/model/worker-bundles.ts
11606
+ const RULE$33 = "worker-bundle";
11607
+ const BUNDLE_CONCURRENCY = 4;
11608
+ const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
11609
+ const CONDITIONS = [
11610
+ "workerd",
11611
+ "worker",
11612
+ "browser",
11613
+ "import",
11614
+ "module",
11615
+ "default"
11616
+ ];
11617
+ const problemFor$2 = problemInFile(RULE$33);
11618
+ const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
11619
+ const bundleProblem = (file) => Effect.gen(function* bundle() {
11620
+ const built = yield* Effect.tryPromise({
11621
+ try: () => rolldown({
11622
+ input: file,
11623
+ platform: "neutral",
11624
+ external: PLATFORM_MODULES,
11625
+ resolve: { conditionNames: CONDITIONS },
11626
+ logLevel: "silent"
11627
+ }),
11628
+ catch: bundleErrorDetail
11629
+ });
11630
+ yield* Effect.tryPromise({
11631
+ try: () => built.generate({ format: "esm" }),
11632
+ catch: bundleErrorDetail
11633
+ });
11634
+ yield* Effect.promise(() => built.close());
11635
+ }).pipe(Effect.match({
11636
+ onSuccess: () => Option.none(),
11637
+ onFailure: (detail) => Option.some(problemOf$7(file, detail))
11638
+ }));
11639
+ /** @internal */
11640
+ const checkWorkerBundles = Effect.fn("checkWorkerBundles")(function* checkWorkerBundles(root) {
11641
+ const files = yield* RepositoryFiles;
11642
+ const entries = yield* bundledEntries(root);
11643
+ const found = yield* Effect.forEach(entries, (entry) => bundleProblem(files.join(root, entry)), { concurrency: BUNDLE_CONCURRENCY });
11644
+ return Array.getSomes(found);
11645
+ });
11646
+ // src/app/build-checks.ts
11647
+ /** @internal */
11648
+ const checkBuilds = Effect.fn("checkBuilds")(function* checkBuilds(root) {
11649
+ const found = yield* Effect.all([
11650
+ checkTypescriptGeneration(root),
11651
+ checkWorkerBundles(root),
11652
+ checkTreeShaking(root)
11653
+ ], { concurrency: "unbounded" });
11654
+ return Array.flatten(found);
11655
+ });
11656
+ // src/features/check-value-owners/model/slots.ts
11657
+ const ANNOTATED_KINDS = /* @__PURE__ */ new Set([
11658
+ SyntaxKind.Parameter,
11659
+ SyntaxKind.VariableDeclaration,
11660
+ SyntaxKind.PropertySignature,
11661
+ SyntaxKind.PropertyDeclaration
11662
+ ]);
11663
+ const isAnnotated = (declaration) => ANNOTATED_KINDS.has(declaration.kind);
11664
+ const annotationOf = (declaration) => Option.liftPredicate(declaration, isAnnotated).pipe(Option.flatMap((annotated) => Option.fromUndefinedOr(annotated.type)));
11665
+ const argumentSlot = (checker) => (expression) => {
11666
+ const call = expression.parent;
11667
+ if (!isCallExpression(call) && !isNewExpression(call)) return Option.none();
11668
+ const { arguments: listed } = call;
11669
+ const index = (listed ?? []).indexOf(expression);
11670
+ return Option.fromUndefinedOr(checker.getResolvedSignature(call).declaration).pipe(Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())), Option.filter(isSignatureDeclaration), Option.flatMap((declaration) => Array.get(declaration.parameters, index)));
11671
+ };
11672
+ const propertySlot = (checker) => (expression) => {
11673
+ const assignment = expression.parent;
11093
11674
  if (!isPropertyAssignment(assignment) || !isObjectLiteralExpression(assignment.parent)) return Option.none();
11094
11675
  return Option.fromUndefinedOr(checker.getContextualType(assignment.parent)).pipe(Option.flatMap((objectType) => Option.fromUndefinedOr(objectType.getProperty(assignment.name.getText()))), Option.flatMap((property) => Array.head(declarationsOf(property))));
11095
11676
  };
@@ -11154,6 +11735,63 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
11154
11735
  values: freeLiteralsIn(checker)(sourceFile, excluded),
11155
11736
  imports: importedFilesOf(checker)(sourceFile)
11156
11737
  })), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
11738
+ // src/features/check-value-owners/model/name-lists.ts
11739
+ const RULE$32 = "hand-written-names";
11740
+ const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
11741
+ const nameListOf = (site) => {
11742
+ if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
11743
+ const names = pipe(site.values, Array.filter(Predicate.isString));
11744
+ return Option.liftPredicate({
11745
+ site,
11746
+ names
11747
+ }, (list) => list.names.length === site.values.length);
11748
+ };
11749
+ const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
11750
+ const listedProblem = ({ file, line, column, names, reason }) => ({
11751
+ file,
11752
+ line,
11753
+ column,
11754
+ rule: RULE$32,
11755
+ message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
11756
+ });
11757
+ const problemOf$6 = ({ list, reason }) => listedProblem({
11758
+ file: list.site.file,
11759
+ line: list.site.line,
11760
+ column: list.site.column,
11761
+ names: list.names,
11762
+ reason
11763
+ });
11764
+ // src/features/check-value-owners/model/outside-names.ts
11765
+ const IDENTIFIER = /^[A-Za-z_$][\w$]*$/u;
11766
+ const HALF = 2;
11767
+ const outsideTypeIn = (project) => {
11768
+ const exported = HashSet.fromIterable(project.library.typeNames);
11769
+ const values = HashSet.fromIterable([...project.library.tagNames, ...pipe(project.library.vocabularies, Array.flatMap(({ vocabulary }) => vocabulary.values))]);
11770
+ const known = /* @__PURE__ */ new Map();
11771
+ const isOutside = isOutsideDeclaration(project.program);
11772
+ const isGlobalType = (name) => pipe(Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)), Option.map(declarationsOf), Option.exists((declarations) => declaresAType(declarations) && !carriesTag(name)(declarations) && pipe(declarations, Array.every(isOutside))));
11773
+ return (name) => known.getOrInsertComputed(name, () => IDENTIFIER.test(name) && !HashSet.has(values, name) && (HashSet.has(exported, name) || isGlobalType(name)));
11774
+ };
11775
+ const namesIn = (list) => pipe(list.elements, Array.filter(isStringLiteral), Array.map((element) => element.text));
11776
+ const problemIn$1 = (isOutsideType) => (list) => {
11777
+ const names = namesIn(list);
11778
+ const outside = pipe(names, Array.filter(isOutsideType));
11779
+ if (outside.length < Math.max(2, names.length / HALF)) return Option.none();
11780
+ return Option.some(listedProblem({
11781
+ file: list.getSourceFile().fileName,
11782
+ line: lineOf$3(list),
11783
+ column: columnOf(list),
11784
+ names,
11785
+ reason: `${formatValues(outside)} are types that the language or a package declares. Let the code that reads this list decide by where each type is declared, so that a new type does not mean a new entry.`
11786
+ }));
11787
+ };
11788
+ const outsideNameProblemsIn = (project) => {
11789
+ const problemOfList = problemIn$1(outsideTypeIn(project));
11790
+ return (sourceFile) => {
11791
+ if (TEST_FILE.test(sourceFile.fileName)) return [];
11792
+ return pipe(descendantsOf(sourceFile), Array.filter(isArrayLiteralExpression), Array.map(problemOfList), Array.getSomes);
11793
+ };
11794
+ };
11157
11795
  // src/features/check-value-owners/model/owners.ts
11158
11796
  const OWNER_TAG = "msch";
11159
11797
  const FIRST_OWNER_COUNT = 1;
@@ -11497,6 +12135,15 @@ const ownedLiteralProblems = (context) => (sourceFile, excluded) => Array.getSom
11497
12135
  // src/features/check-value-owners/model/analysis.ts
11498
12136
  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));
11499
12137
  const nodesOf = (sites) => pipe(sites, Array.map((site) => site.node));
12138
+ const fileChecksOf = (project, sourceChecks) => [
12139
+ shapeProblemsIn({
12140
+ checker: project.checker,
12141
+ program: project.program,
12142
+ shapes: project.library.shapes
12143
+ }),
12144
+ outsideNameProblemsIn(project),
12145
+ ...pipe(sourceChecks, Array.map((check) => check(project.checker)))
12146
+ ];
11500
12147
  const analyzeProject = ({ owners, sourceChecks }) => (project) => {
11501
12148
  const { checker } = project;
11502
12149
  const ownerDeclarations = ownerDeclarationsIn(owners)(project);
@@ -11514,17 +12161,9 @@ const analyzeProject = ({ owners, sourceChecks }) => (project) => {
11514
12161
  };
11515
12162
  const verdicts = pipe(sites, Array.map((site) => siteVerdict(context)(site)));
11516
12163
  const excluded = [...ownerDeclarations, ...nodesOf(sites)];
11517
- const shapeContext = {
11518
- checker,
11519
- program: project.program,
11520
- shapes: project.library.shapes
11521
- };
12164
+ const fileChecks = fileChecksOf(project, sourceChecks);
11522
12165
  return {
11523
- problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [
11524
- ...ownedLiteralProblems(context)(sourceFile, excluded),
11525
- ...shapeProblemsIn(shapeContext)(sourceFile),
11526
- ...pipe(sourceChecks, Array.flatMap((check) => check(checker)(sourceFile)))
11527
- ]))],
12166
+ problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [...ownedLiteralProblems(context)(sourceFile, excluded), ...pipe(fileChecks, Array.flatMap((check) => check(sourceFile)))]))],
11528
12167
  unowned: pipe(verdicts, Array.flatMap((found) => found.unowned)),
11529
12168
  literals: fileFactsIn(checker)(project.sourceFiles, excluded)
11530
12169
  };
@@ -11565,7 +12204,6 @@ const AnalysisSchema = Schema.Struct({
11565
12204
  unowned: Schema.Array(UnownedSiteSchema),
11566
12205
  literals: Schema.Array(FileLiteralsSchema)
11567
12206
  });
11568
- const AnalysisJson = Schema.fromJsonString(AnalysisSchema);
11569
12207
  const hasher = Effect.gen(function* currentHasher() {
11570
12208
  return (yield* RepositoryFiles).hash;
11571
12209
  });
@@ -11626,19 +12264,28 @@ const moved = (move) => (analysis) => ({
11626
12264
  })))
11627
12265
  });
11628
12266
  const entryFile = (cache, key) => `${cache.directory}/${key}${CACHE_SUFFIX}`;
12267
+ const portableOf = (cache, files) => SchemaTransformation.transform({
12268
+ decode: moved((file) => files.resolve(cache.root, file)),
12269
+ encode: moved((file) => files.relative(cache.root, file))
12270
+ });
12271
+ const codecOf = (cache) => Effect.gen(function* buildCodec() {
12272
+ const files = yield* RepositoryFiles;
12273
+ const portable = AnalysisSchema.pipe(Schema.decodeTo(AnalysisSchema, portableOf(cache, files)));
12274
+ return Schema.fromJsonString(portable);
12275
+ });
11629
12276
  const readAnalysis = (cache) => (key) => Effect.gen(function* readCached() {
11630
12277
  const files = yield* RepositoryFiles;
12278
+ const codec = yield* codecOf(cache);
11631
12279
  const text = yield* files.readFile(entryFile(cache, key));
11632
- const restored = moved((file) => files.resolve(cache.root, file));
11633
12280
  return yield* Option.match(text, {
11634
12281
  onNone: () => Effect.succeedNone,
11635
- onSome: (found) => Schema.decodeEffect(AnalysisJson)(found).pipe(Effect.option)
11636
- }).pipe(Effect.map(Option.map(restored)));
12282
+ onSome: (found) => Schema.decodeEffect(codec)(found).pipe(Effect.option)
12283
+ });
11637
12284
  });
11638
12285
  const writeAnalysis = (cache) => (key, analysis) => Effect.gen(function* writeCached() {
11639
12286
  const files = yield* RepositoryFiles;
11640
- const portable = moved((file) => files.relative(cache.root, file))(analysis);
11641
- const text = yield* Schema.encodeEffect(AnalysisJson)(portable).pipe(Effect.option);
12287
+ const codec = yield* codecOf(cache);
12288
+ const text = yield* Schema.encodeEffect(codec)(analysis).pipe(Effect.option);
11642
12289
  yield* Option.match(text, {
11643
12290
  onNone: () => Effect.void,
11644
12291
  onSome: (found) => files.writeFile(entryFile(cache, key), found)
@@ -11682,25 +12329,6 @@ const duplicateProblems = (relative) => (sites) => {
11682
12329
  }];
11683
12330
  }))));
11684
12331
  };
11685
- // src/features/check-value-owners/model/name-lists.ts
11686
- const RULE$31 = "hand-written-names";
11687
- const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
11688
- const nameListOf = (site) => {
11689
- if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
11690
- const names = pipe(site.values, Array.filter(Predicate.isString));
11691
- return Option.liftPredicate({
11692
- site,
11693
- names
11694
- }, (list) => list.names.length === site.values.length);
11695
- };
11696
- const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
11697
- const problemOf$6 = ({ list, reason }) => ({
11698
- file: list.site.file,
11699
- line: list.site.line,
11700
- column: list.site.column,
11701
- rule: RULE$31,
11702
- message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
11703
- });
11704
12332
  // src/features/check-value-owners/model/declared-names.ts
11705
12333
  const MOST_DEFINING_FILES = 2;
11706
12334
  const SINGLE_NAME = 1;
@@ -11739,7 +12367,7 @@ const declaredNameProblem = ({ literals, relative }) => {
11739
12367
  const PATH_PREFIX = /^(?:!|\.\/)+/u;
11740
12368
  const GLOB = /[*?{[]/u;
11741
12369
  const EXTENSION$1 = /\.[^./]+$/u;
11742
- const SEPARATOR$7 = "/";
12370
+ const SEPARATOR$6 = "/";
11743
12371
  const ROOT$1 = ".";
11744
12372
  const namedPath = (repository, file) => (name) => {
11745
12373
  const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
@@ -11748,12 +12376,12 @@ const namedPath = (repository, file) => (name) => {
11748
12376
  return pipe([fromFile, bare], Array.findFirst((path) => HashSet.has(repository.paths, path)));
11749
12377
  };
11750
12378
  const kindOf = (repository) => (path) => {
11751
- if (HashSet.has(repository.directories, path)) return SEPARATOR$7;
12379
+ if (HashSet.has(repository.directories, path)) return SEPARATOR$6;
11752
12380
  return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array.head), Option.getOrElse(() => path));
11753
12381
  };
11754
12382
  const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
11755
12383
  const coversDirectory = (repository) => (group) => pipe(Array.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
11756
- const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$7}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
12384
+ const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$6}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
11757
12385
  const directoryLabel = (directory) => {
11758
12386
  if (directory === ROOT$1) return "the repository root";
11759
12387
  return directory;
@@ -11803,21 +12431,21 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
11803
12431
  return pipe(lists, Array.map((list) => listedPath(list).pipe(Option.orElse(() => declared(list)), Option.orElse(() => subset(list)))), Array.getSomes);
11804
12432
  };
11805
12433
  // src/features/check-value-owners/model/repository-names.ts
11806
- const MANIFEST$2 = "package.json";
11807
- const SEPARATOR$6 = "/";
12434
+ const MANIFEST$3 = "package.json";
12435
+ const SEPARATOR$5 = "/";
11808
12436
  const FIRST_SEGMENT = 1;
11809
12437
  const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
11810
- const decodeManifest$6 = Schema.decodeUnknownOption(ManifestJson);
12438
+ const decodeManifest$7 = Schema.decodeUnknownOption(ManifestJson);
11811
12439
  const prefixesOf = (file) => {
11812
- const segments = pipe(file, String$1.split(SEPARATOR$6));
11813
- return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$6))));
12440
+ const segments = pipe(file, String$1.split(SEPARATOR$5));
12441
+ return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
11814
12442
  };
11815
12443
  const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
11816
- const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
12444
+ const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$7), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
11817
12445
  const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
11818
12446
  const files = yield* RepositoryFiles;
11819
12447
  const listed = yield* files.listedFiles(root);
11820
- const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === MANIFEST$2), (items) => Effect.forEach(items, (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)), { concurrency: 1 }));
12448
+ const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === MANIFEST$3), (items) => Effect.forEach(items, (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)), { concurrency: 1 }));
11821
12449
  const paths = pipe(listed, Array.flatMap(prefixesOf), Array.dedupe);
11822
12450
  return {
11823
12451
  root,
@@ -11925,7 +12553,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
11925
12553
  return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
11926
12554
  }, Effect.scoped);
11927
12555
  // src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
11928
- const RULE$30 = "namespace-destructuring";
12556
+ const RULE$31 = "namespace-destructuring";
11929
12557
  const LOCAL = /^[.#/]/u;
11930
12558
  const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
11931
12559
  const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
@@ -11941,7 +12569,7 @@ const destructuredName = (declaration) => {
11941
12569
  return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
11942
12570
  };
11943
12571
  const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
11944
- rule: RULE$30,
12572
+ rule: RULE$31,
11945
12573
  message: messageOf$1(name)
11946
12574
  })), Option.map((report) => report(declaration)));
11947
12575
  const namespaceDestructuringIn = () => (sourceFile) => {
@@ -11949,7 +12577,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
11949
12577
  return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
11950
12578
  };
11951
12579
  // src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
11952
- const RULE$29 = "pass-through-wrapper";
12580
+ const RULE$30 = "pass-through-wrapper";
11953
12581
  const SINGLE_STATEMENT = 1;
11954
12582
  const SINGLE_DECLARATION = 1;
11955
12583
  const THIS_PARAMETER = "this";
@@ -12046,7 +12674,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
12046
12674
  const problemOf$4 = (checker) => (candidate) => {
12047
12675
  if (changesTheCall(candidate.wrapper)) return Option.none();
12048
12676
  return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
12049
- rule: RULE$29,
12677
+ rule: RULE$30,
12050
12678
  message: messageOf(forward.callee.getText())
12051
12679
  })(candidate.name)));
12052
12680
  };
@@ -12054,7 +12682,7 @@ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(so
12054
12682
  // src/app/source-checks.ts
12055
12683
  /** @internal */
12056
12684
  const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
12057
- // ../../.claude-plugin/marketplace.json
12685
+ // src/shared/config/masseater-marketplace.json
12058
12686
  var name = "masseater-dev";
12059
12687
  var plugins = [{
12060
12688
  "name": "kogane",
@@ -12071,17 +12699,10 @@ var plugins = [{
12071
12699
  },
12072
12700
  "description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
12073
12701
  }];
12074
- // package.json
12075
- var repository = {
12076
- "type": "git",
12077
- "url": "git+https://github.com/masseater/masseater.dev.git",
12078
- "directory": "libs/msch"
12079
- };
12080
12702
  // src/features/check-agent-settings/model/known-plugins.ts
12081
- const RULE$28 = "known-plugins";
12703
+ const RULE$29 = "known-plugins";
12082
12704
  const SETTINGS_FILE$2 = ".claude/settings.json";
12083
12705
  const GITHUB$2 = "github";
12084
- const REPOSITORY = /github\.com\/(?<repository>[\w.-]+\/[\w.-]+?)(?:\.git)?$/u;
12085
12706
  const Source$1 = Schema.Struct({
12086
12707
  source: Schema.String,
12087
12708
  repo: Schema.optionalKey(Schema.String)
@@ -12094,11 +12715,10 @@ const SettingsSchema$1 = Schema.Struct({
12094
12715
  enabledPlugins: Schema.optionalKey(Plugins$1)
12095
12716
  });
12096
12717
  const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(SettingsSchema$1));
12097
- const repositoryOf = (url) => pipe(String$1.match(REPOSITORY)(url), Option.flatMapNullishOr((found) => found.groups), Option.flatMap(Record.get("repository")), Option.getOrElse(() => url));
12098
- const REPOSITORY_NAME = repositoryOf(repository.url);
12718
+ const REPOSITORY_NAME = "masseater/masseater.dev";
12099
12719
  const MARKETPLACE = name;
12100
12720
  const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
12101
- const problem$1 = problemInFile(RULE$28);
12721
+ const problem$1 = problemInFile(RULE$29);
12102
12722
  const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
12103
12723
  const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
12104
12724
  const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
@@ -12119,20 +12739,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
12119
12739
  return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
12120
12740
  });
12121
12741
  // src/features/check-agent-settings/model/missing-hooks.ts
12122
- const RULE$27 = "missing-hook";
12742
+ const RULE$28 = "missing-hook";
12123
12743
  const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
12124
12744
  const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
12125
12745
  const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
12126
12746
  const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
12127
12747
  const PLUGIN_ROOT = "..";
12128
12748
  const READ_CONCURRENCY$11 = 16;
12129
- const START$17 = 0;
12749
+ const START$18 = 0;
12130
12750
  const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
12131
12751
  path,
12132
- index: found.index ?? START$17
12752
+ index: found.index ?? START$18
12133
12753
  })), Option.toArray);
12134
12754
  const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
12135
- const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
12755
+ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
12136
12756
  const files = yield* RepositoryFiles;
12137
12757
  const text = yield* files.readFile(file);
12138
12758
  if (Option.isNone(text)) return [];
@@ -12144,7 +12764,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
12144
12764
  return pipe(missing, Array.map(({ path, index }) => ({
12145
12765
  file,
12146
12766
  ...positionOf(source)(index),
12147
- rule: RULE$27,
12767
+ rule: RULE$28,
12148
12768
  message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
12149
12769
  })));
12150
12770
  });
@@ -12168,7 +12788,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
12168
12788
  }];
12169
12789
  return [];
12170
12790
  }));
12171
- const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$11 });
12791
+ const found = yield* Effect.forEach(hookFiles, problemsIn$12, { concurrency: READ_CONCURRENCY$11 });
12172
12792
  return Array.flatten(found);
12173
12793
  });
12174
12794
  // src/features/check-documented-commands/model/task-graph.ts
@@ -12197,7 +12817,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
12197
12817
  }, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
12198
12818
  const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
12199
12819
  // src/features/check-documented-commands/model/commands.ts
12200
- const RULE$26 = "documented-commands";
12820
+ const RULE$27 = "documented-commands";
12201
12821
  const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
12202
12822
  const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
12203
12823
  const COMMAND = /`vp run (?<args>[^`]+)`/gu;
@@ -12206,7 +12826,7 @@ const ARGS = "args";
12206
12826
  const PLACEHOLDER = /[<>*{}$]/u;
12207
12827
  const WHITESPACE = /\s+/u;
12208
12828
  const ROOT = ".";
12209
- const SEPARATOR$5 = "/";
12829
+ const SEPARATOR$4 = "/";
12210
12830
  const END_OF_OPTIONS = "--";
12211
12831
  const FLAG = "-";
12212
12832
  const TASK_SEPARATOR$1 = "#";
@@ -12216,7 +12836,7 @@ const FILTER_ASSIGNMENT = "--filter=";
12216
12836
  const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
12217
12837
  const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
12218
12838
  const ONE$1 = 1;
12219
- const START$16 = 0;
12839
+ const START$17 = 0;
12220
12840
  const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
12221
12841
  const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
12222
12842
  const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
@@ -12253,8 +12873,8 @@ const parsed = (args) => {
12253
12873
  return pipe(specifierOf(tokens), Option.filter(() => !pipe(tokens, Array.some((token) => PLACEHOLDER.test(token)))), Option.map(invocationOf(tokens)));
12254
12874
  };
12255
12875
  const ancestorsOf$1 = (file) => {
12256
- const parts = pipe(String$1.split(file, SEPARATOR$5), Array.dropRight(ONE$1));
12257
- return [...Array.makeBy(parts.length, (index) => pipe(parts, Array.take(parts.length - index), Array.join(SEPARATOR$5))), ROOT];
12876
+ const parts = pipe(String$1.split(file, SEPARATOR$4), Array.dropRight(ONE$1));
12877
+ return [...Array.makeBy(parts.length, (index) => pipe(parts, Array.take(parts.length - index), Array.join(SEPARATOR$4))), ROOT];
12258
12878
  };
12259
12879
  const named = (graph, name) => (directory) => directory === String$1.replace(LOCAL_PREFIX$1, "")(name) || pipe(Record.get(graph.packages, directory), Option.exists((found) => found.name === name));
12260
12880
  const packagesOf = (graph, file) => (scope) => {
@@ -12272,13 +12892,13 @@ const whereOf = (scope, file) => {
12272
12892
  return `the package that holds ${file}`;
12273
12893
  };
12274
12894
  const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
12275
- const problemsIn$10 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
12895
+ const problemsIn$11 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
12276
12896
  file: absolute(file),
12277
- ...positionOf(text)(match.index ?? START$16),
12278
- rule: RULE$26,
12279
- message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
12897
+ ...positionOf(text)(match.index ?? START$17),
12898
+ rule: RULE$27,
12899
+ message: `${match[START$17]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
12280
12900
  })), Option.toArray)));
12281
- const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$5), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
12901
+ const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
12282
12902
  /** @internal */
12283
12903
  const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* checkDocumentedCommands(root) {
12284
12904
  const files = yield* RepositoryFiles;
@@ -12300,14 +12920,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
12300
12920
  file: absolute(Array.headNonEmpty(commanded).file),
12301
12921
  line: ONE$1,
12302
12922
  column: ONE$1,
12303
- rule: RULE$26,
12923
+ rule: RULE$27,
12304
12924
  message: "msch could not list the tasks with `vp run --json`"
12305
12925
  }],
12306
- onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
12926
+ onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$11(found, absolute, document)))
12307
12927
  });
12308
12928
  });
12309
12929
  // src/features/check-legacy-web/model/legacy-web.ts
12310
- const RULE$25 = "legacy-web";
12930
+ const RULE$26 = "legacy-web";
12311
12931
  const FIRST_COLUMN$3 = 1;
12312
12932
  const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
12313
12933
  const Finding = Schema.Struct({
@@ -12346,7 +12966,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
12346
12966
  file: files.join(root, file),
12347
12967
  line,
12348
12968
  column: FIRST_COLUMN$3,
12349
- rule: RULE$25,
12969
+ rule: RULE$26,
12350
12970
  message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
12351
12971
  });
12352
12972
  return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
@@ -12417,14 +13037,14 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
12417
13037
  const EXTENSION = /\.[^./]+$/u;
12418
13038
  const SETTINGS_FILE = ".claude/settings.json";
12419
13039
  const READ_CONCURRENCY$10 = 64;
12420
- const RULE$24 = "shell-script";
13040
+ const RULE$25 = "shell-script";
12421
13041
  const MESSAGE$10 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
12422
13042
  const HookSchema = Schema.Struct({
12423
13043
  command: Schema.optional(Schema.String),
12424
- args: Schema.optional(Schema.Array(Schema.String))
13044
+ args: Schema.String.pipe(Schema.Array, Schema.optional)
12425
13045
  });
12426
13046
  const MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });
12427
- const HooksSchema = Schema.Struct({ SessionStart: Schema.optional(Schema.Array(MatcherSchema)) });
13047
+ const HooksSchema = Schema.Struct({ SessionStart: MatcherSchema.pipe(Schema.Array, Schema.optional) });
12428
13048
  const SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });
12429
13049
  const decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));
12430
13050
  const NO_TEXT = [];
@@ -12434,7 +13054,6 @@ const sessionStartCommands = (source) => {
12434
13054
  const matchers = pipe(decodeSettings(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)));
12435
13055
  return pipe(matchers, Option.map(Array.flatMap((matcher) => matcherText(matcher))), Option.getOrElse(() => NO_TEXT));
12436
13056
  };
12437
- const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.getOrElse(() => name));
12438
13057
  const hasExtension = (name) => EXTENSION.test(baseName(name));
12439
13058
  /** @internal */
12440
13059
  const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
@@ -12451,7 +13070,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
12451
13070
  };
12452
13071
  const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
12453
13072
  const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
12454
- return pipe(shell, Array.map((name) => problemInFile(RULE$24)(files.join(root, name), MESSAGE$10)));
13073
+ return pipe(shell, Array.map((name) => problemInFile(RULE$25)(files.join(root, name), MESSAGE$10)));
12455
13074
  });
12456
13075
  // src/shared/lib/workflow-files.ts
12457
13076
  const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
@@ -12470,8 +13089,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
12470
13089
  });
12471
13090
  // src/shared/lib/workflow-run.ts
12472
13091
  const RUN_KEY = "run";
12473
- const START$15 = 0;
12474
- const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
13092
+ const START$16 = 0;
13093
+ const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$16));
12475
13094
  const runScriptsOf = (source) => {
12476
13095
  const found = [];
12477
13096
  visit(parseDocument(source), { Pair: (_key, pair) => {
@@ -12486,7 +13105,7 @@ const runScriptsOf = (source) => {
12486
13105
  const COMMAND_CHAIN = /&&|\|\||;|\|/u;
12487
13106
  const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
12488
13107
  const COMMENT = "#";
12489
- const RULE$23 = "workflow-script";
13108
+ const RULE$24 = "workflow-script";
12490
13109
  const ONE_COMMAND = 1;
12491
13110
  const MESSAGE$9 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
12492
13111
  const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
@@ -12495,19 +13114,14 @@ const runsMoreThanOneCommand = ({ text }) => {
12495
13114
  const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
12496
13115
  return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
12497
13116
  };
12498
- const problemsIn$9 = (file) => (source) => {
13117
+ const problemsIn$10 = (file) => (source) => {
12499
13118
  const at = positionOf(source);
12500
- return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
12501
- file,
12502
- ...at(start),
12503
- rule: RULE$23,
12504
- message: MESSAGE$9
12505
- })));
13119
+ return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$24)(file, at(start), MESSAGE$9)));
12506
13120
  };
12507
13121
  /** @internal */
12508
13122
  const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
12509
13123
  const workflows = yield* readWorkflows(root);
12510
- return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$9(file)(source)));
13124
+ return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$10(file)(source)));
12511
13125
  });
12512
13126
  // src/features/check-scripts/model/script-checks.ts
12513
13127
  /** @internal */
@@ -12527,12 +13141,12 @@ const checkStructure = checkSection({
12527
13141
  // src/features/check-vite-plus/model/command-words.ts
12528
13142
  const CONTINUATION = /\\\n/gu;
12529
13143
  const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
12530
- const SEPARATOR$4 = /&&|\|\||[;|\n`]|\$\(/u;
13144
+ const SEPARATOR$3 = /&&|\|\||[;|\n`]|\$\(/u;
12531
13145
  const BLANK$1 = /\s+/u;
12532
13146
  const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
12533
13147
  const QUOTE = "\"\"";
12534
13148
  const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
12535
- const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$4), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
13149
+ const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$3), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
12536
13150
  // src/features/check-vite-plus/model/command-problems.ts
12537
13151
  const PACKAGE_MANAGERS = [
12538
13152
  "pnpm",
@@ -12630,7 +13244,7 @@ const AGENT_DOCS = [
12630
13244
  ...EXCLUDED$5
12631
13245
  ];
12632
13246
  const READ_CONCURRENCY$8 = 16;
12633
- const START$14 = 0;
13247
+ const START$15 = 0;
12634
13248
  const FIRST$5 = 1;
12635
13249
  const LINE = "\n";
12636
13250
  const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
@@ -12640,7 +13254,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
12640
13254
  const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
12641
13255
  const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
12642
13256
  const NO_SOURCES = [];
12643
- const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
13257
+ const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$15));
12644
13258
  const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
12645
13259
  const offset = offsetOf$2(source, `"${name}"`);
12646
13260
  return {
@@ -12736,7 +13350,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
12736
13350
  return Array.flatten(found);
12737
13351
  });
12738
13352
  // src/features/check-vite-plus/model/package-scripts.ts
12739
- const RULE$22 = "package-script";
13353
+ const RULE$23 = "package-script";
12740
13354
  const LIFECYCLE = [
12741
13355
  "preinstall",
12742
13356
  "install",
@@ -12759,12 +13373,12 @@ const LIFECYCLE = [
12759
13373
  const problemOf$3 = ({ file, position, name }) => ({
12760
13374
  file,
12761
13375
  ...position,
12762
- rule: RULE$22,
13376
+ rule: RULE$23,
12763
13377
  message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
12764
13378
  });
12765
13379
  const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
12766
13380
  // src/features/check-vite-plus/model/vite-plus-block.ts
12767
- const RULE$21 = "vite-plus-block";
13381
+ const RULE$22 = "vite-plus-block";
12768
13382
  const MARKER = Array.join([
12769
13383
  "<!--",
12770
13384
  "VITE PLUS START",
@@ -12777,7 +13391,7 @@ const problemIn = (file) => (source) => {
12777
13391
  return Option.some({
12778
13392
  file,
12779
13393
  ...positionOf(source)(index.value),
12780
- rule: RULE$21,
13394
+ rule: RULE$22,
12781
13395
  message: MESSAGE$8
12782
13396
  });
12783
13397
  };
@@ -12833,11 +13447,11 @@ const checkFullHistoryCheckout = workflowCheck({
12833
13447
  })
12834
13448
  });
12835
13449
  // src/features/check-workflows/model/publish-trigger.ts
12836
- const RULE$19 = "publish-trigger";
12837
- const PUBLISH = /\bmsch-publish\b/u;
13450
+ const RULE$20 = "publish-trigger";
13451
+ const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
12838
13452
  const MANUAL = "workflow_dispatch";
12839
13453
  const TRIGGER_KEY = "on";
12840
- const MESSAGE$6 = "publishes with `msch-publish` from a trigger other than `workflow_dispatch`. Publishing is manual: bump the version in a PR, then dispatch the workflow for the workspace.";
13454
+ const MESSAGE$6 = "publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Publishing is manual: bump the version in a PR, then dispatch the workflow for the workspace.";
12841
13455
  const triggersOf = (node) => {
12842
13456
  if (isScalar(node)) return [String(node.value)];
12843
13457
  if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
@@ -12853,18 +13467,18 @@ const publishTriggerOffsetsOf = (source) => {
12853
13467
  };
12854
13468
  /** @internal */
12855
13469
  const checkPublishTrigger = workflowCheck({
12856
- rule: RULE$19,
13470
+ rule: RULE$20,
12857
13471
  message: MESSAGE$6,
12858
13472
  offsetsOf: publishTriggerOffsetsOf
12859
13473
  });
12860
13474
  // src/features/check-workflows/model/release-please.ts
12861
- const RULE$18 = "release-please";
13475
+ const RULE$19 = "release-please";
12862
13476
  const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
12863
13477
  const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
12864
13478
  const FIRST$4 = 1;
12865
13479
  const MESSAGE$5 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
12866
13480
  const checkReleasePleaseSteps = workflowCheck({
12867
- rule: RULE$18,
13481
+ rule: RULE$19,
12868
13482
  message: MESSAGE$5,
12869
13483
  offsetsOf: scalarKeyOffsets({
12870
13484
  name: "uses",
@@ -12878,7 +13492,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
12878
13492
  file: files.join(root, name),
12879
13493
  line: FIRST$4,
12880
13494
  column: FIRST$4,
12881
- rule: RULE$18,
13495
+ rule: RULE$19,
12882
13496
  message: MESSAGE$5
12883
13497
  })));
12884
13498
  });
@@ -12890,17 +13504,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
12890
13504
  // src/features/check-workflows/model/workflow-queue.ts
12891
13505
  const CONCURRENCY_KEY = "concurrency";
12892
13506
  const QUEUE_KEY = "queue";
12893
- const RULE$17 = "workflow-queue";
13507
+ const RULE$18 = "workflow-queue";
12894
13508
  const MESSAGE$4 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
12895
13509
  const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
12896
13510
  /** @internal */
12897
13511
  const checkWorkflowQueues = workflowCheck({
12898
- rule: RULE$17,
13512
+ rule: RULE$18,
12899
13513
  message: MESSAGE$4,
12900
13514
  offsetsOf: queueOffsetsOf
12901
13515
  });
12902
13516
  // src/features/check-workflows/model/workflow-commits.ts
12903
- const RULE$16 = "workflow-commit";
13517
+ const RULE$17 = "workflow-commit";
12904
13518
  const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
12905
13519
  const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
12906
13520
  const MESSAGE$3 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
@@ -12908,7 +13522,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
12908
13522
  const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
12909
13523
  /** @internal */
12910
13524
  const checkWorkflowCommits = workflowCheck({
12911
- rule: RULE$16,
13525
+ rule: RULE$17,
12912
13526
  message: MESSAGE$3,
12913
13527
  offsetsOf: commitOffsetsOf
12914
13528
  });
@@ -12935,6 +13549,7 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
12935
13549
  checkReleasePlease(root),
12936
13550
  checkPublishTrigger(root),
12937
13551
  checkRestrictedRules(root),
13552
+ checkTypeExemptions(root),
12938
13553
  checkMarkdown(root),
12939
13554
  checkLegacyWeb(root),
12940
13555
  checkDocumentedCommands(root),
@@ -12957,42 +13572,34 @@ const trimmed = ({ index, text }) => ({
12957
13572
  index,
12958
13573
  text: String$1.trimEnd(text)
12959
13574
  });
13575
+ const commentsFrom = (reader) => (read) => (source) => Effect.try({
13576
+ try: () => pipe(read(source), Array.map(trimmed)),
13577
+ catch: unreadable(reader)
13578
+ });
12960
13579
  // src/features/ban-comments/model/config-comments.ts
12961
13580
  const NEXT$1 = 1;
12962
- const yamlComments = (source) => Effect.try({
12963
- try: () => pipe(yamlSourceComments(source), Array.map(trimmed)),
12964
- catch: unreadable("yaml")
12965
- });
12966
- const tomlComments = (source) => Effect.try({
12967
- try: () => pipe(tomlSourceComments(source), Array.map(trimmed)),
12968
- catch: unreadable("toml")
12969
- });
13581
+ const yamlComments = commentsFrom("yaml")(yamlSourceComments);
13582
+ const tomlComments = commentsFrom("toml")(tomlSourceComments);
12970
13583
  const isSqlComment = (value) => isRecord(value) && (value["type"] === "line_comment" || value["type"] === "block_comment") && typeof value["text"] === "string" && Array.isArray(value["range"]);
12971
- const sqlComments = (source) => Effect.try({
12972
- try: () => {
12973
- const program = parse$3(source, {
12974
- dialect: "sqlite",
12975
- includeComments: true,
12976
- includeRange: true,
12977
- paramTypes: []
12978
- });
12979
- return pipe(collectNodes(isSqlComment)(program), Array.map(({ range: [start], text }) => trimmed({
12980
- index: start,
12981
- text
12982
- })));
12983
- },
12984
- catch: unreadable("sql")
13584
+ const sqlComments = commentsFrom("sql")((source) => {
13585
+ const program = parse$3(source, {
13586
+ dialect: "sqlite",
13587
+ includeComments: true,
13588
+ includeRange: true,
13589
+ paramTypes: []
13590
+ });
13591
+ return pipe(collectNodes(isSqlComment)(program), Array.map(({ range: [start], text }) => ({
13592
+ index: start,
13593
+ text
13594
+ })));
12985
13595
  });
12986
13596
  const offsetAt = (lines) => ({ line, character }) => character + pipe(lines, Array.take(line), Array.map((text) => text.length + NEXT$1), Number$1.sumAll);
12987
- const dockerfileComments = (source) => Effect.try({
12988
- try: () => {
12989
- const lines = String$1.split(source, "\n");
12990
- return pipe(DockerfileParser.parse(source).getComments(), Array.map((comment) => trimmed({
12991
- index: offsetAt(lines)(comment.getRange().start),
12992
- text: comment.toString()
12993
- })));
12994
- },
12995
- catch: unreadable("dockerfile")
13597
+ const dockerfileComments = commentsFrom("dockerfile")((source) => {
13598
+ const lines = String$1.split(source, "\n");
13599
+ return pipe(DockerfileParser.parse(source).getComments(), Array.map((comment) => ({
13600
+ index: offsetAt(lines)(comment.getRange().start),
13601
+ text: comment.toString()
13602
+ })));
12996
13603
  });
12997
13604
  // src/features/ban-comments/model/comment-readers.ts
12998
13605
  const GRAMMARS = [
@@ -13016,7 +13623,7 @@ const COMMENT_NODES = [
13016
13623
  "block_comment",
13017
13624
  "multiline_comment"
13018
13625
  ];
13019
- const START$13 = 0;
13626
+ const START$14 = 0;
13020
13627
  const NEXT = 1;
13021
13628
  const NONE$1 = [];
13022
13629
  const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
@@ -13032,17 +13639,14 @@ const loadGrammars = Effect.fn("loadGrammars")(function* loadGrammars() {
13032
13639
  const commentNodesIn = (language, source) => pipe(readTree({
13033
13640
  language,
13034
13641
  source,
13035
- read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) => trimmed({
13642
+ read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) => ({
13036
13643
  index: node.startIndex,
13037
13644
  text: node.text
13038
13645
  })))
13039
13646
  }), Option.getOrElse(() => NONE$1));
13040
13647
  const syntaxComments = (grammars, grammar) => (source) => Option.match(grammars(grammar), {
13041
13648
  onNone: () => Effect.fail(unreadable(grammar)("the grammar is not loaded")),
13042
- onSome: (language) => Effect.try({
13043
- try: () => commentNodesIn(language, source),
13044
- catch: unreadable(grammar)
13045
- })
13649
+ onSome: (language) => commentsFrom(grammar)((text) => commentNodesIn(language, text))(source)
13046
13650
  });
13047
13651
  const SCRIPT_TYPE = /^(?:|module|text\/javascript|application\/javascript)$/iu;
13048
13652
  const SHADER_TYPE = /shader|glsl/iu;
@@ -13069,7 +13673,7 @@ const markupComment = (source) => (node) => {
13069
13673
  }];
13070
13674
  };
13071
13675
  const textComments = (grammars, grammar) => (text) => {
13072
- const shift = shifted(text.startIndex ?? START$13);
13676
+ const shift = shifted(text.startIndex ?? START$14);
13073
13677
  return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
13074
13678
  };
13075
13679
  const embeddedComments = (grammars) => (node) => {
@@ -13105,11 +13709,11 @@ const commentsWith = (grammars) => (reader, source) => {
13105
13709
  }[reader](source);
13106
13710
  };
13107
13711
  // src/features/ban-comments/model/comments.ts
13108
- const RULE$15 = "comment";
13712
+ const RULE$16 = "comment";
13109
13713
  const CONFIG_FILE$2 = "vite.config.ts";
13110
13714
  const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
13111
13715
  const READ_CONCURRENCY$7 = 64;
13112
- const START$12 = 0;
13716
+ const START$13 = 0;
13113
13717
  const READERS$1 = [
13114
13718
  [/\.(?:[cm]?jsx?)$/u, "javascript"],
13115
13719
  [/\.(?:[cm]?ts)$/u, "typescript"],
@@ -13164,16 +13768,16 @@ const shebangReader = (source) => {
13164
13768
  const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
13165
13769
  const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
13166
13770
  const lineBefore = (source, index) => {
13167
- const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
13771
+ const lines = pipe(source, String$1.slice(START$13, index), String$1.split("\n"));
13168
13772
  return Option.getOrElse(Array.last(lines), () => "");
13169
13773
  };
13170
13774
  const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
13171
- const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
13775
+ const isShebang = ({ index, text }) => index === START$13 && String$1.startsWith(SHEBANG)(text);
13172
13776
  const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
13173
13777
  const problemOf$2 = (file, source) => ({ index }) => ({
13174
13778
  file,
13175
13779
  ...positionOf(source)(index),
13176
- rule: RULE$15,
13780
+ rule: RULE$16,
13177
13781
  message: MESSAGE$2
13178
13782
  });
13179
13783
  const settingsOf = ({ msch, lint }) => ({
@@ -13197,14 +13801,14 @@ const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
13197
13801
  }));
13198
13802
  });
13199
13803
  const directivePattern = (directives) => new RegExp(String.raw`^\s?(?:${Array.join(directives, "|")})`, "u");
13200
- const isIgnored = (patterns) => (name) => pipe(patterns, Array.some((pattern) => path.matchesGlob(name, pattern)));
13201
13804
  const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, settings) {
13202
13805
  const files = yield* RepositoryFiles;
13203
13806
  const listed = yield* files.listedFiles(root);
13204
13807
  const generated = yield* files.generatedFiles(root);
13205
13808
  const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);
13809
+ const isIgnored = matcher(settings.ignorePatterns);
13206
13810
  const skipped = HashSet.fromIterable([...generated, ...pipe(vendored, Array.map((name) => files.join(root, name)))]);
13207
- return pipe(listed, Array.filter((name) => !isIgnored(settings.ignorePatterns)(name)), Array.map((name) => ({
13811
+ return pipe(listed, Array.filter((name) => !isIgnored(name)), Array.map((name) => ({
13208
13812
  name,
13209
13813
  file: files.join(root, name)
13210
13814
  })), Array.filter(({ file }) => !HashSet.has(skipped, file)));
@@ -13222,7 +13826,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
13222
13826
  const toProblem = problemOf$2(file, source);
13223
13827
  return Option.match(readerOf(name, source), {
13224
13828
  onNone: () => Effect.succeed(NONE),
13225
- onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$15)(file, `msch could not read the comments in this file: ${message}`)])))
13829
+ onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$16)(file, `msch could not read the comments in this file: ${message}`)])))
13226
13830
  });
13227
13831
  };
13228
13832
  const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
@@ -13235,6 +13839,11 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
13235
13839
  const PROGRAM_SOURCE = /\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;
13236
13840
  const CONFIG_SOURCE = /(?:^|\/)[^/]*\.config\.[cm]?[jt]s$/u;
13237
13841
  const isProgramSource = ({ name }) => PROGRAM_SOURCE.test(name) && !CONFIG_SOURCE.test(name);
13842
+ const patternsBy = ({ spawn, command, toolVersions = [] }) => (entry) => {
13843
+ if (isProgramSource(entry)) return spawn;
13844
+ if (isToolVersions(entry)) return [...command, ...toolVersions];
13845
+ return command;
13846
+ };
13238
13847
  const spawnPattern = (program) => new RegExp(String.raw`(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make)\(\s*|\$\(\s*|\$\s*(?=\x60))["'\x60](?:${program})(?=["'\x60\s])`, "gu");
13239
13848
  const FIRST_LINE$3 = 1;
13240
13849
  const FIRST_COLUMN$2 = 1;
@@ -13274,16 +13883,15 @@ const COMMAND_PATTERNS$1 = [
13274
13883
  ...SPAWN_PATTERNS$1,
13275
13884
  /\buses:\s*["']?docker(?:\/[\w.-]+|:\/\/)/gu
13276
13885
  ];
13277
- const patternsFor$1 = (entry) => {
13278
- if (isProgramSource(entry)) return SPAWN_PATTERNS$1;
13279
- return COMMAND_PATTERNS$1;
13280
- };
13281
13886
  const renameOf = ({ name }) => pipe(RENAMES, Array.findFirst(([pattern]) => pattern.test(name)), Option.map(([, renamed]) => renamed));
13282
13887
  const DOCKER = {
13283
13888
  fileRule: "docker-file",
13284
13889
  commandRule: "docker-command",
13285
13890
  isFile: (entry) => Option.isSome(renameOf(entry)),
13286
- patternsFor: patternsFor$1,
13891
+ patternsFor: patternsBy({
13892
+ spawn: SPAWN_PATTERNS$1,
13893
+ command: COMMAND_PATTERNS$1
13894
+ }),
13287
13895
  fileMessage: (entry) => `Docker is not used in this repository: podman builds and runs containers. Name this file ${Option.getOrElse(renameOf(entry), () => "for podman")}, the name podman reads.`,
13288
13896
  commandMessage: (command) => `Docker is not used in this repository. Replace \`${command}\` with podman, which takes the same arguments.`
13289
13897
  };
@@ -13292,27 +13900,24 @@ const checkDocker = (root) => checkBannedTool(root, DOCKER);
13292
13900
  // src/features/ban-tools/model/python.ts
13293
13901
  const PYTHON_FILE = /(?:\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\/)(?:pyproject\.toml|uv\.lock|uv\.toml|poetry\.lock|Pipfile|Pipfile\.lock|setup\.cfg|tox\.ini|pytest\.ini|\.python-version|requirements[^/]*\.txt))$/u;
13294
13902
  const SPAWN_PATTERNS = [spawnPattern(String.raw`python[\d.]*|pip3?|pipx|uvx?|poetry`)];
13295
- const COMMAND_PATTERNS = [
13296
- /(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
13297
- /(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
13298
- /(?<![\w./@-])pipx[ \t]+(?:run|install|inject|upgrade)\b/gu,
13299
- /(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
13300
- /(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
13301
- /(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
13302
- ...SPAWN_PATTERNS,
13303
- /\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
13304
- ];
13305
- const TOOL_PATTERNS$1 = [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
13306
- const patternsFor = (entry) => {
13307
- if (isProgramSource(entry)) return SPAWN_PATTERNS;
13308
- if (isToolVersions(entry)) return [...COMMAND_PATTERNS, ...TOOL_PATTERNS$1];
13309
- return COMMAND_PATTERNS;
13310
- };
13311
13903
  const PYTHON = {
13312
13904
  fileRule: "python-file",
13313
13905
  commandRule: "python-command",
13314
13906
  isFile: ({ name }) => PYTHON_FILE.test(name),
13315
- patternsFor,
13907
+ patternsFor: patternsBy({
13908
+ spawn: SPAWN_PATTERNS,
13909
+ command: [
13910
+ /(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
13911
+ /(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
13912
+ /(?<![\w./@-])pipx[ \t]+(?:run|install|inject|upgrade)\b/gu,
13913
+ /(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
13914
+ /(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
13915
+ /(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
13916
+ ...SPAWN_PATTERNS,
13917
+ /\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
13918
+ ],
13919
+ toolVersions: [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu]
13920
+ }),
13316
13921
  fileMessage: () => "Python is not used in this repository. Replace this file with TypeScript or Rust.",
13317
13922
  commandMessage: (command) => `Python is not used in this repository. Remove \`${command}\` and do the work in TypeScript or Rust.`
13318
13923
  };
@@ -13320,7 +13925,7 @@ const PYTHON = {
13320
13925
  const checkPython = (root) => checkBannedTool(root, PYTHON);
13321
13926
  // src/features/check-catalog-entries/model/catalog-entries.ts
13322
13927
  const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
13323
- const MANIFEST$1 = /(?:^|\/)package\.json$/u;
13928
+ const MANIFEST$2 = /(?:^|\/)package\.json$/u;
13324
13929
  const CATALOG_PROTOCOL = "catalog:";
13325
13930
  const DEFAULT_CATALOG = "default";
13326
13931
  const VERSION_SEPARATOR = "||";
@@ -13334,7 +13939,7 @@ const UNUSED_RULE = "unused-catalog-entry";
13334
13939
  const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
13335
13940
  const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
13336
13941
  const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
13337
- const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
13942
+ const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
13338
13943
  const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
13339
13944
  const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
13340
13945
  const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
@@ -13362,8 +13967,8 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
13362
13967
  const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
13363
13968
  const files = yield* RepositoryFiles;
13364
13969
  const listed = yield* files.listedFiles(root);
13365
- const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
13366
- const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$5(text))), Array.flatMap(referencesIn));
13970
+ const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
13971
+ const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$6(text))), Array.flatMap(referencesIn));
13367
13972
  const fromOverrides = pipe(fieldsOf$2(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
13368
13973
  return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
13369
13974
  });
@@ -13374,17 +13979,17 @@ const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Arra
13374
13979
  const quoted$1 = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
13375
13980
  const entryLine = (name) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "u");
13376
13981
  const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted$1(entry)}["']?\\s*$`, "u");
13377
- const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
13982
+ const problemAt$5 = ({ file, at }, rule, message) => (name, needle) => ({
13378
13983
  file,
13379
13984
  line: at(needle),
13380
13985
  column: FIRST_COLUMN$1,
13381
13986
  rule,
13382
13987
  message: `\`${name}\` ${message}`
13383
13988
  });
13384
- const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$4(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))));
13989
+ const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$5(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))));
13385
13990
  const staleIn = (located, settings, keys) => {
13386
13991
  const excludes = Option.getOrElse(decodeStrings(settings["minimumReleaseAgeExclude"]), () => []);
13387
- return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$4(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))));
13992
+ return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$5(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))));
13388
13993
  };
13389
13994
  const findingsIn = Effect.fn("findingsIn")(function* findingsIn(root, file, settings) {
13390
13995
  const read = yield* (yield* RepositoryFiles).readFile(file);
@@ -13411,8 +14016,8 @@ const VISIBLE_RULE = "skill-source-visible";
13411
14016
  const CONFIG_FILE$1 = "vite.config.ts";
13412
14017
  const RENOVATE_FILE$1 = "renovate.json";
13413
14018
  const SOURCE = "masseater/skills";
13414
- const PRESET$1 = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
13415
- const START$11 = 0;
14019
+ const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
14020
+ const START$12 = 0;
13416
14021
  const LOCAL_PREFIX = "./";
13417
14022
  const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
13418
14023
  const Source = Schema.Struct({
@@ -13423,9 +14028,9 @@ const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source
13423
14028
  const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
13424
14029
  const taggedError$1 = Schema.TaggedError;
13425
14030
  var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
13426
- const problemAt$3 = (rule, file, text) => (anchor, message) => ({
14031
+ const problemAt$4 = (rule, file, text) => (anchor, message) => ({
13427
14032
  file,
13428
- ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
14033
+ ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$12))),
13429
14034
  rule,
13430
14035
  message
13431
14036
  });
@@ -13445,20 +14050,20 @@ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root
13445
14050
  })));
13446
14051
  });
13447
14052
  const entryProblems = ({ file, text, sources }) => {
13448
- const at = problemAt$3(ENTRY_RULE, file, text);
14053
+ const at = problemAt$4(ENTRY_RULE, file, text);
13449
14054
  return pipe(Record.get(sources, SOURCE), Option.match({
13450
14055
  onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
13451
14056
  onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
13452
14057
  }));
13453
14058
  };
13454
14059
  const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
13455
- const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$3(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
14060
+ const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$4(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
13456
14061
  const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
13457
14062
  const files = yield* RepositoryFiles;
13458
14063
  const file = files.join(root, RENOVATE_FILE$1);
13459
14064
  const text = yield* files.readFile(file);
13460
14065
  if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
13461
- return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
14066
+ return [problemAt$4(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
13462
14067
  });
13463
14068
  /** @internal */
13464
14069
  const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
@@ -13472,20 +14077,19 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
13472
14077
  ];
13473
14078
  });
13474
14079
  // src/features/check-skills/model/published-skills.ts
13475
- const RULE$14 = "published-skills";
14080
+ const RULE$15 = "published-skills";
13476
14081
  const KEYWORD = "tanstack-intent";
13477
14082
  const SKILLS = "skills";
13478
14083
  const MANIFEST_FILE = "package.json";
13479
14084
  const SKILL_FILE$1 = "SKILL.md";
13480
14085
  const SUCCEEDED = 0;
13481
- const SYNC = "Run vp exec intent maintainer sync in the repository root.";
13482
14086
  const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
13483
- const problemAt$2 = problemInFile(RULE$14);
14087
+ const problemAt$3 = problemInFile(RULE$15);
13484
14088
  const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
13485
14089
  const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
13486
14090
  const packagingMessages = ({ keywords, files }, skills) => {
13487
- const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. ${SYNC}`));
13488
- const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. ${SYNC}`));
14091
+ const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
14092
+ const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
13489
14093
  return Array.getSomes([keyword, unshipped]);
13490
14094
  };
13491
14095
  const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
@@ -13501,23 +14105,23 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
13501
14105
  const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
13502
14106
  return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
13503
14107
  }, Effect.scoped);
13504
- const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14108
+ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
13505
14109
  const files = yield* RepositoryFiles;
13506
14110
  const directory = files.join(root, project.directory);
13507
14111
  const manifest = files.join(directory, MANIFEST_FILE);
13508
14112
  const skills = skillDirectoriesIn(files, directory);
13509
- if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without TanStack Intent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1} with vp exec intent maintainer add, so agents in the repositories that install it load guidance for the installed version.`)];
14113
+ if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$3(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
13510
14114
  const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
13511
- return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
14115
+ return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$3(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$3(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
13512
14116
  });
13513
14117
  /** @internal */
13514
14118
  const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
13515
14119
  const projects = yield* publishedProjects(root);
13516
- const problems = yield* Effect.forEach(projects, (project) => problemsIn$8(root, project), { concurrency: 1 });
14120
+ const problems = yield* Effect.forEach(projects, (project) => problemsIn$9(root, project), { concurrency: 1 });
13517
14121
  return Array.flatten(problems);
13518
14122
  });
13519
14123
  // src/features/check-skills/model/skill-files.ts
13520
- const RULE$13 = "skill-file";
14124
+ const RULE$14 = "skill-file";
13521
14125
  const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
13522
14126
  const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
13523
14127
  const MARKDOWN = ".md";
@@ -13533,8 +14137,8 @@ const FRAGMENT = /#.*$/u;
13533
14137
  const GITHUB = "https://github.com/";
13534
14138
  const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
13535
14139
  const BLANK = /\s+/u;
13536
- const SEPARATOR$3 = "/";
13537
- const START$10 = 0;
14140
+ const SEPARATOR$2 = "/";
14141
+ const START$11 = 0;
13538
14142
  const FIRST$3 = 1;
13539
14143
  const READ_CONCURRENCY$5 = 16;
13540
14144
  const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
@@ -13544,9 +14148,9 @@ const Frontmatter = Schema.Struct({
13544
14148
  metadata: Schema.optional(Metadata)
13545
14149
  });
13546
14150
  const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
13547
- const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
14151
+ const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$11));
13548
14152
  const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
13549
- const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
14153
+ const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$11].length), Option.getOrElse(() => START$11));
13550
14154
  const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
13551
14155
  const nameProblems = ({ source, directory }, name, folder) => {
13552
14156
  const bodyStart = bodyStartOf(source);
@@ -13574,16 +14178,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
13574
14178
  ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
13575
14179
  file: skill.file,
13576
14180
  ...positionOf(skill.source)(index),
13577
- rule: RULE$13,
14181
+ rule: RULE$14,
13578
14182
  message
13579
14183
  })));
13580
14184
  const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
13581
14185
  target,
13582
- index: found.index ?? START$10
14186
+ index: found.index ?? START$11
13583
14187
  })), Option.toArray);
13584
14188
  const rangeOf$1 = (found) => {
13585
- const start = found.index ?? START$10;
13586
- return [start, start + found[START$10].length];
14189
+ const start = found.index ?? START$11;
14190
+ return [start, start + found[START$11].length];
13587
14191
  };
13588
14192
  const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
13589
14193
  const linksIn = (source) => {
@@ -13601,15 +14205,15 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
13601
14205
  return pipe(missing, Array.map(({ target, index }) => ({
13602
14206
  file,
13603
14207
  ...positionOf(source)(index),
13604
- rule: RULE$13,
14208
+ rule: RULE$14,
13605
14209
  message: `links to ${target}, which does not exist. Fix the path or remove the link.`
13606
14210
  })));
13607
14211
  });
13608
- const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
14212
+ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
13609
14213
  const files = yield* RepositoryFiles;
13610
14214
  const file = files.join(root, name);
13611
14215
  const directory = files.dirname(name);
13612
- const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$3}`)));
14216
+ const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
13613
14217
  const text = yield* files.readFile(file);
13614
14218
  const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
13615
14219
  const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
@@ -13617,7 +14221,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
13617
14221
  file: files.join(root, entry),
13618
14222
  line: FIRST$3,
13619
14223
  column: FIRST$3,
13620
- rule: RULE$13,
14224
+ rule: RULE$14,
13621
14225
  message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
13622
14226
  })));
13623
14227
  return [
@@ -13634,7 +14238,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
13634
14238
  const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
13635
14239
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
13636
14240
  const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
13637
- const found = yield* Effect.forEach(skills, (name) => problemsIn$7(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
14241
+ const found = yield* Effect.forEach(skills, (name) => problemsIn$8(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
13638
14242
  return Array.flatten(found);
13639
14243
  });
13640
14244
  // src/features/check-version-downgrades/model/version-entries.ts
@@ -13673,12 +14277,12 @@ const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map
13673
14277
  };
13674
14278
  }), Option.toArray);
13675
14279
  const manifestEntries = (text) => {
13676
- const manifest = fieldsOf$1(Option.getOrUndefined(decodeJson(text)));
14280
+ const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf$1);
13677
14281
  return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
13678
14282
  };
13679
14283
  const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf$1(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
13680
14284
  const workspaceEntries = (text) => {
13681
- const settings = fieldsOf$1(Option.getOrUndefined(Option.liftThrowable(() => parse$2(text))()));
14285
+ const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf$1);
13682
14286
  return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings["catalogs"])];
13683
14287
  };
13684
14288
  const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf$1), Option.getOrElse(() => ({})));
@@ -13697,7 +14301,7 @@ const cargoEntries = (text) => {
13697
14301
  };
13698
14302
  const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
13699
14303
  // src/features/check-version-downgrades/model/version-downgrade.ts
13700
- const RULE$12 = "version-downgrade";
14304
+ const RULE$13 = "version-downgrade";
13701
14305
  const DEFAULT_BASE = "origin/main";
13702
14306
  const READ_CONCURRENCY$4 = 16;
13703
14307
  const READERS = [
@@ -13723,7 +14327,7 @@ const downgradesIn = ({ file, text, before, after }) => {
13723
14327
  file,
13724
14328
  line: lineOf(text, entry),
13725
14329
  column: FIRST_LINE$1,
13726
- rule: RULE$12,
14330
+ rule: RULE$13,
13727
14331
  message: message(old, entry)
13728
14332
  })), Option.toArray)));
13729
14333
  };
@@ -13759,14 +14363,14 @@ const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)
13759
14363
  const AUTOMERGE_RULE = "renovate-platform-automerge";
13760
14364
  const CAP_RULE = "renovate-version-cap";
13761
14365
  const PRESET_RULE = "renovate-msch-preset";
13762
- const PRESET = "github>masseater/masseater.dev//libs/msch/renovate";
13763
- const START$9 = 0;
14366
+ const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
14367
+ const START$10 = 0;
13764
14368
  const READ_CONCURRENCY$3 = 16;
13765
14369
  const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
13766
14370
  const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
13767
14371
  const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
13768
14372
  const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
13769
- const problemsIn$6 = (file, source) => {
14373
+ const problemsIn$7 = (file, source) => {
13770
14374
  const at = positionOf(source);
13771
14375
  const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
13772
14376
  file,
@@ -13779,7 +14383,7 @@ const problemsIn$6 = (file, source) => {
13779
14383
  ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
13780
14384
  ...pipe([{
13781
14385
  file,
13782
- ...at(START$9),
14386
+ ...at(START$10),
13783
14387
  rule: PRESET_RULE,
13784
14388
  message: PRESET_MESSAGE
13785
14389
  }], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
@@ -13793,7 +14397,7 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
13793
14397
  const file = files.join(root, name);
13794
14398
  return files.readFile(file).pipe(Effect.map(Option.match({
13795
14399
  onNone: () => [],
13796
- onSome: (source) => problemsIn$6(file, source)
14400
+ onSome: (source) => problemsIn$7(file, source)
13797
14401
  })));
13798
14402
  }, { concurrency: READ_CONCURRENCY$3 });
13799
14403
  return Array.flatten(found);
@@ -13801,22 +14405,22 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
13801
14405
  // src/features/find-invisible-characters/model/hidden-unicode.ts
13802
14406
  const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
13803
14407
  const NUL = "\0";
13804
- const START$8 = 0;
14408
+ const START$9 = 0;
13805
14409
  const HEX = 16;
13806
14410
  const CODE_POINT_WIDTH = 4;
13807
14411
  const READ_CONCURRENCY$2 = 64;
13808
- const RULE$11 = "hidden-unicode";
13809
- const hexOf = (character) => pipe(String$1.codePointAt(START$8)(character), Option.getOrElse(() => START$8), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
14412
+ const RULE$12 = "hidden-unicode";
14413
+ const hexOf = (character) => pipe(String$1.codePointAt(START$9)(character), Option.getOrElse(() => START$9), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
13810
14414
  const problemOf$1 = (file, source) => (found) => {
13811
- const hex = hexOf(found[START$8]);
14415
+ const hex = hexOf(found[START$9]);
13812
14416
  return {
13813
14417
  file,
13814
- ...positionOf(source)(found.index ?? START$8),
13815
- rule: RULE$11,
14418
+ ...positionOf(source)(found.index ?? START$9),
14419
+ rule: RULE$12,
13816
14420
  message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
13817
14421
  };
13818
14422
  };
13819
- const problemsIn$5 = (file, source) => {
14423
+ const problemsIn$6 = (file, source) => {
13820
14424
  if (String$1.includes(NUL)(source)) return [];
13821
14425
  return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
13822
14426
  };
@@ -13828,25 +14432,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
13828
14432
  const file = files.join(root, name);
13829
14433
  return files.readFile(file).pipe(Effect.map(Option.match({
13830
14434
  onNone: () => [],
13831
- onSome: (source) => problemsIn$5(file, source)
14435
+ onSome: (source) => problemsIn$6(file, source)
13832
14436
  })));
13833
14437
  }, { concurrency: READ_CONCURRENCY$2 });
13834
14438
  return Array.flatten(found);
13835
14439
  });
13836
14440
  // src/features/find-unneeded-files/model/alchemy-patch.ts
13837
- const RULE$10 = "alchemy-patch";
14441
+ const RULE$11 = "alchemy-patch";
13838
14442
  const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
13839
14443
  const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
13840
- const START$7 = 0;
14444
+ const START$8 = 0;
13841
14445
  const problemOf = (file, position, name) => ({
13842
14446
  file,
13843
14447
  ...position,
13844
- rule: RULE$10,
14448
+ rule: RULE$11,
13845
14449
  message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
13846
14450
  });
13847
- const problemsIn$4 = (file, patched) => (source) => {
14451
+ const problemsIn$5 = (file, patched) => (source) => {
13848
14452
  const at = positionOf(source);
13849
- const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$7));
14453
+ const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$8));
13850
14454
  return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
13851
14455
  };
13852
14456
  /** @internal */
@@ -13856,15 +14460,15 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
13856
14460
  const text = yield* files.readFile(file);
13857
14461
  const manifest = yield* workspaceManifest(root);
13858
14462
  const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
13859
- return pipe(text, Option.map(problemsIn$4(file, patched)), Option.getOrElse(() => []));
14463
+ return pipe(text, Option.map(problemsIn$5(file, patched)), Option.getOrElse(() => []));
13860
14464
  });
13861
14465
  // src/features/find-unneeded-files/model/applied-packages.ts
13862
14466
  const MSCH = "@r_masseater/msch";
13863
14467
  const SCOPE$1 = "@r_masseater/";
13864
- const RULE$9 = "applied-package";
14468
+ const RULE$10 = "applied-package";
13865
14469
  const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
13866
14470
  const NOT_FOUND = -1;
13867
- const SEPARATOR$2 = "/";
14471
+ const SEPARATOR$1 = "/";
13868
14472
  const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
13869
14473
  const BinMap = Schema.Record(Schema.String, Schema.String);
13870
14474
  const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
@@ -13878,7 +14482,7 @@ const declaredNames = (manifest) => pipe([
13878
14482
  const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
13879
14483
  onNone: () => [],
13880
14484
  onSome: (bin) => {
13881
- if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$2), Array.lastNonEmpty)];
14485
+ if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
13882
14486
  return Record.keys(bin);
13883
14487
  }
13884
14488
  }));
@@ -13903,16 +14507,16 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
13903
14507
  const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
13904
14508
  return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
13905
14509
  });
13906
- const problemAt$1 = (file, source) => (index, name) => ({
14510
+ const problemAt$2 = (file, source) => (index, name) => ({
13907
14511
  file,
13908
14512
  ...positionOf(source)(index),
13909
- rule: RULE$9,
14513
+ rule: RULE$10,
13910
14514
  message: `msch applies ${name}. Remove this use and let msch apply it.`
13911
14515
  });
13912
14516
  const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
13913
14517
  const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
13914
- const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$1(file, source)(found.index ?? NOT_FOUND, entry.name)))));
13915
- const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$2}`)(name)), Array.match({
14518
+ const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$2(file, source)(found.index ?? NOT_FOUND, entry.name)))));
14519
+ const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
13916
14520
  onEmpty: () => "",
13917
14521
  onNonEmpty: Array.max(BY_LENGTH)
13918
14522
  }));
@@ -13931,7 +14535,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
13931
14535
  declared: manifest
13932
14536
  }), Option.match({
13933
14537
  onNone: () => [],
13934
- onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$1(file, source)(index, name)), Option.toArray)))
14538
+ onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$2(file, source)(index, name)), Option.toArray)))
13935
14539
  }));
13936
14540
  });
13937
14541
  const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
@@ -13961,7 +14565,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
13961
14565
  return yield* appliedPackageProblems(root, applied);
13962
14566
  });
13963
14567
  // src/features/find-unneeded-files/model/replaced-tools.ts
13964
- const RULE$8 = "replaced-tool";
14568
+ const RULE$9 = "replaced-tool";
13965
14569
  const FIRST$2 = 1;
13966
14570
  const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
13967
14571
  const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
@@ -14042,7 +14646,7 @@ const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ patte
14042
14646
  file,
14043
14647
  line: FIRST$2,
14044
14648
  column: FIRST$2,
14045
- rule: RULE$8,
14649
+ rule: RULE$9,
14046
14650
  message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
14047
14651
  })));
14048
14652
  /** @internal */
@@ -14054,7 +14658,7 @@ const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplac
14054
14658
  // src/features/find-unneeded-files/model/unneeded-files.ts
14055
14659
  const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
14056
14660
  const PNPM_DIRECTORY = ".pnpm/";
14057
- const SEPARATOR$1 = "/";
14661
+ const SEPARATOR = "/";
14058
14662
  const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
14059
14663
  const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
14060
14664
  const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
@@ -14071,7 +14675,7 @@ const SETUP_PATTERNS = [
14071
14675
  ];
14072
14676
  const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
14073
14677
  const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
14074
- const START$6 = 0;
14678
+ const START$7 = 0;
14075
14679
  const LAST_SEGMENT = 1;
14076
14680
  const FIRST_LINE = 1;
14077
14681
  const FIRST_COLUMN = 1;
@@ -14124,10 +14728,10 @@ const isCargoManifest = matches(CARGO_MANIFEST_FILE);
14124
14728
  const isForeignLockfile = matches(FOREIGN_LOCKFILE);
14125
14729
  const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
14126
14730
  const isPnpmOutput = matches(PNPM_OUTPUT);
14127
- const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
14731
+ const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
14128
14732
  const ancestorsOf = (directory) => {
14129
- const parts = String$1.split(directory, SEPARATOR$1);
14130
- return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR$1)), Array.filter((ancestor) => ancestor !== directory));
14733
+ const parts = String$1.split(directory, SEPARATOR);
14734
+ return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
14131
14735
  };
14132
14736
  const readsCargoLock = (manifests, workspaces) => ({ name }) => {
14133
14737
  const directory = directoryOf(name);
@@ -14141,7 +14745,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
14141
14745
  const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
14142
14746
  return directoriesOf(roots);
14143
14747
  });
14144
- const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
14748
+ const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$7), (end) => String$1.slice(START$7, end)(name));
14145
14749
  const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
14146
14750
  const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
14147
14751
  const cargoProblems = (present, enabled) => {
@@ -14177,11 +14781,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
14177
14781
  return yield* unneededIn(root, cargoEnabled(workspace.value));
14178
14782
  });
14179
14783
  // src/features/check-effect-diagnostics/model/effect-diagnostics.ts
14180
- const RULE$7 = "effect-diagnostics-once";
14784
+ const RULE$8 = "effect-diagnostics-once";
14181
14785
  const PLUGIN = "@effect/language-service";
14182
14786
  const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
14183
14787
  const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14184
- const START$5 = 0;
14788
+ const START$6 = 0;
14185
14789
  const Plugin = Schema.Struct({
14186
14790
  name: Schema.optional(Schema.String),
14187
14791
  diagnostics: Schema.optional(Schema.Unknown)
@@ -14192,10 +14796,10 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
14192
14796
  const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
14193
14797
  const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
14194
14798
  const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
14195
- const problemsIn$3 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
14799
+ const problemsIn$4 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
14196
14800
  file: entry.file,
14197
- ...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$5))),
14198
- rule: RULE$7,
14801
+ ...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$6))),
14802
+ rule: RULE$8,
14199
14803
  message: MESSAGE$1
14200
14804
  })), Option.toArray);
14201
14805
  /** @internal */
@@ -14205,15 +14809,15 @@ const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* che
14205
14809
  return yield* scanText(pipe(configs, Array.map((name) => ({
14206
14810
  name,
14207
14811
  file: files.join(root, name)
14208
- }))), problemsIn$3);
14812
+ }))), problemsIn$4);
14209
14813
  });
14210
14814
  // src/features/check-exact-versions/model/exact-versions.ts
14211
- const RULE$6 = "version-range";
14815
+ const RULE$7 = "version-range";
14212
14816
  const WORKSPACE_FILE = "pnpm-workspace.yaml";
14213
14817
  const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
14214
14818
  const PROTOCOL = /^[a-z+]+:/u;
14215
14819
  const PATH_LIKE = "/";
14216
- const START$4 = 0;
14820
+ const START$5 = 0;
14217
14821
  const SECTIONS = [
14218
14822
  "dependencies",
14219
14823
  "devDependencies",
@@ -14223,7 +14827,7 @@ const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguis
14223
14827
  const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
14224
14828
  const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
14225
14829
  const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
14226
- const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
14830
+ const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
14227
14831
  const decodeString = Schema.decodeUnknownOption(Schema.String);
14228
14832
  const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
14229
14833
  const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
@@ -14237,16 +14841,16 @@ const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatM
14237
14841
  specifier
14238
14842
  })), Option.toArray)));
14239
14843
  const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
14240
- const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$4));
14844
+ const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$5));
14241
14845
  const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
14242
14846
  file,
14243
14847
  ...positionOf(source)(offsetIn(source)(pattern(range))),
14244
- rule: RULE$6,
14848
+ rule: RULE$7,
14245
14849
  message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
14246
14850
  })));
14247
14851
  const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted(name)}"\\s*:\\s*"${quoted(specifier)}"`, "u");
14248
14852
  const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "mu");
14249
- const manifestProblems$1 = (entry, source) => pipe(decodeManifest$4(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
14853
+ const manifestProblems$2 = (entry, source) => pipe(decodeManifest$5(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
14250
14854
  const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
14251
14855
  const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
14252
14856
  const files = yield* RepositoryFiles;
@@ -14266,22 +14870,22 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
14266
14870
  name,
14267
14871
  file: files.join(root, name)
14268
14872
  })));
14269
- const fromManifests = yield* scanText(listed, manifestProblems$1);
14873
+ const fromManifests = yield* scanText(listed, manifestProblems$2);
14270
14874
  const fromCatalogs = yield* catalogProblems(root);
14271
14875
  return [...fromManifests, ...fromCatalogs];
14272
14876
  });
14273
14877
  // src/features/check-pack-settings/model/pack-settings.ts
14274
- const RULE$5 = "pack-publint";
14878
+ const RULE$6 = "pack-publint";
14275
14879
  const CONFIG_FILE = "vite.config.ts";
14276
14880
  const PACK_KEY = "pack:";
14277
- const START$3 = 0;
14881
+ const START$4 = 0;
14278
14882
  const READ_CONCURRENCY$1 = 16;
14279
14883
  const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14280
- const Manifest$3 = Schema.Struct({
14884
+ const Manifest$4 = Schema.Struct({
14281
14885
  private: Schema.optional(Schema.Boolean),
14282
14886
  publishConfig: Schema.optional(Schema.Unknown)
14283
14887
  });
14284
- const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
14888
+ const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
14285
14889
  const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
14286
14890
  const isStrict = Schema.is(StrictPack);
14287
14891
  const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
@@ -14292,11 +14896,11 @@ const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNot
14292
14896
  const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
14293
14897
  const problemFor = (file, source) => ({
14294
14898
  file,
14295
- ...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$3)),
14296
- rule: RULE$5,
14899
+ ...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$4)),
14900
+ rule: RULE$6,
14297
14901
  message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
14298
14902
  });
14299
- const isPublishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$3), Option.exists(isPublished$2));
14903
+ const isPublishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.exists(isPublished$2));
14300
14904
  const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
14301
14905
  const config = yield* Effect.tryPromise({
14302
14906
  try: () => resolveConfigFromFile(configFile),
@@ -14310,7 +14914,7 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
14310
14914
  if (yield* strictPublintIn(configFile)) return [];
14311
14915
  return [problemFor(configFile, source.value)];
14312
14916
  });
14313
- const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
14917
+ const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
14314
14918
  const files = yield* RepositoryFiles;
14315
14919
  const manifest = yield* files.readFile(files.join(root, manifestName));
14316
14920
  if (!isPublishedManifest(manifest)) return [];
@@ -14319,27 +14923,27 @@ const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifest
14319
14923
  /** @internal */
14320
14924
  const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
14321
14925
  const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
14322
- const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
14926
+ const found = yield* Effect.forEach(manifests, (name) => problemsIn$3(root, name), { concurrency: READ_CONCURRENCY$1 });
14323
14927
  return Array.flatten(found);
14324
14928
  });
14325
14929
  // src/features/check-package-scope/model/package-scope.ts
14326
- const RULE$4 = "package-scope";
14930
+ const RULE$5 = "package-scope";
14327
14931
  const SCOPE = "@r_masseater/";
14328
14932
  const NAME_KEY = "\"name\"";
14329
- const START$2 = 0;
14933
+ const START$3 = 0;
14330
14934
  const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14331
- const Manifest$2 = Schema.Struct({
14935
+ const Manifest$3 = Schema.Struct({
14332
14936
  name: Schema.optional(Schema.String),
14333
14937
  private: Schema.optional(Schema.Boolean),
14334
14938
  publishConfig: Schema.optional(Schema.Unknown)
14335
14939
  });
14336
- const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
14940
+ const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
14337
14941
  const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
14338
14942
  const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
14339
- const problemsIn$1 = (entry, source) => pipe(decodeManifest$2(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
14943
+ const problemsIn$2 = (entry, source) => pipe(decodeManifest$3(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
14340
14944
  file: entry.file,
14341
- ...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$2))),
14342
- rule: RULE$4,
14945
+ ...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3))),
14946
+ rule: RULE$5,
14343
14947
  message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
14344
14948
  })), Option.toArray);
14345
14949
  /** @internal */
@@ -14349,10 +14953,10 @@ const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageS
14349
14953
  return yield* scanText(pipe(manifests, Array.map((name) => ({
14350
14954
  name,
14351
14955
  file: files.join(root, name)
14352
- }))), problemsIn$1);
14956
+ }))), problemsIn$2);
14353
14957
  });
14354
14958
  // src/features/check-plugin-marketplace/model/plugin-marketplace.ts
14355
- const RULE$3 = "plugin-marketplace";
14959
+ const RULE$4 = "plugin-marketplace";
14356
14960
  const PLUGIN_DIRECTORY = ".claude-plugin";
14357
14961
  const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
14358
14962
  const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
@@ -14408,7 +15012,7 @@ const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
14408
15012
  description: Option.getOrElse(project.description, () => "")
14409
15013
  })));
14410
15014
  });
14411
- const problem = problemInFile(RULE$3);
15015
+ const problem = problemInFile(RULE$4);
14412
15016
  const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
14413
15017
  const projects = yield* workspaceProjects(root);
14414
15018
  const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
@@ -14453,10 +15057,10 @@ const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* che
14453
15057
  return yield* rewrite(file, `${text}\n`);
14454
15058
  });
14455
15059
  // src/features/check-runtime-version/model/node-version.ts
14456
- const RULE$2 = "node-version";
15060
+ const RULE$3 = "node-version";
14457
15061
  const MINIMUM = 26;
14458
15062
  const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
14459
- const MANIFEST = /(?:^|\/)package\.json$/u;
15063
+ const MANIFEST$1 = /(?:^|\/)package\.json$/u;
14460
15064
  const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
14461
15065
  const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
14462
15066
  const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
@@ -14467,15 +15071,15 @@ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t
14467
15071
  const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
14468
15072
  const ALTERNATIVE = "||";
14469
15073
  const ENGINES_KEY = "\"engines\"";
14470
- const START$1 = 0;
15074
+ const START$2 = 0;
14471
15075
  const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14472
15076
  const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
14473
- const Manifest$1 = Schema.Struct({
15077
+ const Manifest$2 = Schema.Struct({
14474
15078
  private: Schema.optional(Schema.Boolean),
14475
15079
  publishConfig: Schema.optional(Schema.Unknown),
14476
15080
  engines: Schema.optional(Engines)
14477
15081
  });
14478
- const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
15082
+ const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
14479
15083
  const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
14480
15084
  const isOld = (major) => major < MINIMUM;
14481
15085
  const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
@@ -14484,44 +15088,44 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
14484
15088
  onSome: isOld
14485
15089
  }));
14486
15090
  const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
14487
- const problemAt = ({ entry, source, index }, message) => ({
15091
+ const problemAt$1 = ({ entry, source, index }, message) => ({
14488
15092
  file: entry.file,
14489
15093
  ...positionOf(source)(index),
14490
- rule: RULE$2,
15094
+ rule: RULE$3,
14491
15095
  message
14492
15096
  });
14493
- const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$1));
14494
- const unstatedProblem = (entry, source) => problemAt({
15097
+ const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$2));
15098
+ const unstatedProblem = (entry, source) => problemAt$1({
14495
15099
  entry,
14496
15100
  source,
14497
- index: START$1
15101
+ index: START$2
14498
15102
  }, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
14499
- const rangeProblem = (entry, source) => (range) => problemAt({
15103
+ const rangeProblem = (entry, source) => (range) => problemAt$1({
14500
15104
  entry,
14501
15105
  source,
14502
15106
  index: offsetOf(source, ENGINES_KEY)
14503
15107
  }, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
14504
15108
  const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
14505
15109
  const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
14506
- const manifestProblems = (entry, source) => {
14507
- const manifest = decodeManifest$1(source);
15110
+ const manifestProblems$1 = (entry, source) => {
15111
+ const manifest = decodeManifest$2(source);
14508
15112
  if (Option.isNone(manifest)) return [];
14509
15113
  const range = rangeOf(manifest.value);
14510
15114
  if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
14511
15115
  return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
14512
15116
  };
14513
- const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
15117
+ const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt$1({
14514
15118
  entry,
14515
15119
  source,
14516
- index: found.index ?? START$1
14517
- }, `${SUPPORTED} \`${String$1.trim(found[START$1])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
14518
- const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
15120
+ index: found.index ?? START$2
15121
+ }, `${SUPPORTED} \`${String$1.trim(found[START$2])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
15122
+ const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$1({
14519
15123
  entry,
14520
15124
  source,
14521
- index: START$1
15125
+ index: START$2
14522
15126
  }, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
14523
- const problemsIn = (entry, source) => {
14524
- if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
15127
+ const problemsIn$1 = (entry, source) => {
15128
+ if (MANIFEST$1.test(entry.name)) return manifestProblems$1(entry, source);
14525
15129
  if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
14526
15130
  if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
14527
15131
  if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
@@ -14537,15 +15141,14 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
14537
15141
  name,
14538
15142
  file: files.join(root, name)
14539
15143
  })))];
14540
- return yield* scanText(sources, problemsIn);
15144
+ return yield* scanText(sources, problemsIn$1);
14541
15145
  });
14542
15146
  // src/features/check-unused-workspaces/model/unused-workspaces.ts
14543
- const RULE$1 = "unused-workspace";
15147
+ const RULE$2 = "unused-workspace";
14544
15148
  const CARGO_FILE = "Cargo.toml";
14545
15149
  const ROOT_DIRECTORY = "";
14546
15150
  const TASK_SEPARATOR = "#";
14547
- const SEPARATOR = "/";
14548
- const START = 0;
15151
+ const START$1 = 0;
14549
15152
  const FIRST$1 = 1;
14550
15153
  const READ_CONCURRENCY = 8;
14551
15154
  const LIBRARY_KINDS = [
@@ -14559,14 +15162,14 @@ const PROGRAM_KINDS = [
14559
15162
  "staticlib",
14560
15163
  "dylib"
14561
15164
  ];
14562
- const Manifest = Schema.Struct({
15165
+ const Manifest$1 = Schema.Struct({
14563
15166
  name: Schema.optional(Schema.String),
14564
15167
  private: Schema.optional(Schema.Boolean),
14565
15168
  exports: Schema.optional(Schema.Unknown),
14566
15169
  main: Schema.optional(Schema.Unknown),
14567
15170
  bin: Schema.optional(Schema.Unknown)
14568
15171
  });
14569
- const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
15172
+ const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
14570
15173
  const isDependedOn = (links) => ({ directory }) => pipe(links, Array.some(({ from, to }) => to === directory && from !== directory));
14571
15174
  const isKind = (kinds) => (kind) => Array.contains(kinds, kind);
14572
15175
  const isLibraryCrate = ({ kinds }) => pipe(kinds, Array.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Array.some(isKind(PROGRAM_KINDS)));
@@ -14592,21 +15195,20 @@ const cargoFacts = Effect.fn("cargoFacts")(function* cargoFacts(root, directorie
14592
15195
  links: pipe(crates, Array.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)))
14593
15196
  };
14594
15197
  });
14595
- const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START, at)(text)), Option.filter(String$1.isNonEmpty));
15198
+ const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START$1, at)(text)), Option.filter(String$1.isNonEmpty));
14596
15199
  const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directory) {
14597
15200
  const config = yield* workspaceConfigOf(root, directory);
14598
15201
  return pipe(config, Option.map(({ program }) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))))), Option.getOrElse(() => []));
14599
15202
  });
14600
- const isWithin = (directory) => (file) => String$1.startsWith(`${directory}${SEPARATOR}`)(file);
14601
15203
  const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
14602
15204
  const { root, directory, crateLibraries, deployed } = request;
14603
15205
  const files = yield* RepositoryFiles;
14604
15206
  const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
14605
- return pipe(text, Option.flatMap(decodeManifest), Option.map((manifest) => ({
15207
+ return pipe(text, Option.flatMap(decodeManifest$1), Option.map((manifest) => ({
14606
15208
  directory,
14607
15209
  name: Option.fromUndefinedOr(manifest.name),
14608
15210
  library: Predicate.isNotUndefined(manifest.exports) || Predicate.isNotUndefined(manifest.main) || Array.contains(crateLibraries, directory),
14609
- entry: manifest.private !== true || Predicate.isNotUndefined(manifest.bin) || pipe(deployed, Array.some(isWithin(directory)))
15211
+ entry: manifest.private !== true || Predicate.isNotUndefined(manifest.bin) || pipe(deployed, Array.some(isInside(directory)))
14610
15212
  })));
14611
15213
  });
14612
15214
  const linksTo = (members, from) => (name) => pipe(members, Array.filter((member) => Option.contains(member.name, name)), Array.map(({ directory }) => ({
@@ -14647,10 +15249,62 @@ const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* check
14647
15249
  file: files.join(root, directory, MANIFEST_FILE$3),
14648
15250
  line: FIRST$1,
14649
15251
  column: FIRST$1,
14650
- rule: RULE$1,
15252
+ rule: RULE$2,
14651
15253
  message: `${directory} is a private library, and no other workspace depends on it through package.json, a Cargo path dependency or a task. Delete it, or depend on it from the code that uses it.`
14652
15254
  })));
14653
15255
  });
15256
+ // src/features/check-upstream-exits/model/scattered-deviations.ts
15257
+ const RULE$1 = "upstream-deviation-place";
15258
+ const MANIFEST = "package.json";
15259
+ const NESTED_WORKSPACE = "/pnpm-workspace.yaml";
15260
+ const NESTED_CARGO = "/Cargo.toml";
15261
+ const CARGO_CONFIG = /(?:^|\/)\.cargo\/config(?:\.toml)?$/u;
15262
+ const MANAGER_FIELDS = ["overrides", "resolutions"];
15263
+ const START = 0;
15264
+ const PLACE = "Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.";
15265
+ const Fields = Schema.Record(Schema.String, Schema.Unknown);
15266
+ const Manifest = Schema.fromJsonString(Schema.Struct({
15267
+ pnpm: Schema.optional(Fields),
15268
+ overrides: Schema.optional(Schema.Unknown),
15269
+ resolutions: Schema.optional(Schema.Unknown)
15270
+ }));
15271
+ const decodeManifest = Schema.decodeUnknownOption(Manifest);
15272
+ const isManifest = (name) => name === MANIFEST || String$1.endsWith(`/${MANIFEST}`)(name);
15273
+ const problemAt = (entry, source) => (index, message) => ({
15274
+ file: entry.file,
15275
+ ...positionOf(source)(index),
15276
+ rule: RULE$1,
15277
+ message
15278
+ });
15279
+ const keyIndex = (source, key) => Option.getOrElse(String$1.indexOf(`"${key}"`)(source), () => START);
15280
+ const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
15281
+ onNone: () => [],
15282
+ onSome: (manifest) => {
15283
+ const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));
15284
+ const pnpmFields = pipe(WORKSPACE_SECTIONS, Array.filter((key) => Record.has(pnpm, key)), Array.map((key) => ({
15285
+ name: `pnpm.${key}`,
15286
+ key
15287
+ })));
15288
+ const managerFields = pipe(MANAGER_FIELDS, Array.filter((key) => Option.isSome(Option.fromUndefinedOr(manifest[key]))), Array.map((key) => ({
15289
+ name: key,
15290
+ key
15291
+ })));
15292
+ return [...pnpmFields, ...managerFields];
15293
+ }
15294
+ }));
15295
+ const manifestProblems = (entry, source) => pipe(fieldsIn(source), Array.map(({ name, key }) => problemAt(entry, source)(keyIndex(source, key), `${name} in package.json is not allowed. ${PLACE} Move it there.`)));
15296
+ const firstEntryProblem = (entry, source, deviations) => pipe(Array.head(deviations.entries), Option.map(({ index }) => problemAt(entry, source)(index, `This file is not read for upstream deviations. ${PLACE}`)), Option.toArray);
15297
+ const problemsIn = (entry, source) => {
15298
+ if (isManifest(entry.name)) return manifestProblems(entry, source);
15299
+ if (String$1.endsWith(NESTED_WORKSPACE)(entry.name)) return firstEntryProblem(entry, source, workspaceDeviations(source));
15300
+ return firstEntryProblem(entry, source, cargoDeviations(source));
15301
+ };
15302
+ const isScanned = ({ name }) => isManifest(name) || String$1.endsWith(NESTED_WORKSPACE)(name) || String$1.endsWith(NESTED_CARGO)(name) || CARGO_CONFIG.test(name);
15303
+ /** @internal */
15304
+ const checkScatteredDeviations = Effect.fn("checkScatteredDeviations")(function* checkScatteredDeviations(root) {
15305
+ const listed = yield* listedFiles(root);
15306
+ return yield* scanText(pipe(listed, Array.filter(isScanned)), problemsIn);
15307
+ });
14654
15308
  // src/features/check-workspace-descriptions/model/workspace-descriptions.ts
14655
15309
  const RULE = "workspace-description";
14656
15310
  const FIRST = 1;
@@ -14718,7 +15372,7 @@ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
14718
15372
  checkPublishedPackages(root),
14719
15373
  checkWorkspaces(root),
14720
15374
  checkToolUse(root),
14721
- checkTypescriptGeneration(root)
15375
+ checkBuilds(root)
14722
15376
  ], { concurrency: "unbounded" });
14723
15377
  return Array.flatten(found);
14724
15378
  });