@r_masseater/msch 0.41.0 → 0.47.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +16 -8
  2. package/dist/cargo-inputs.d.mts +15 -0
  3. package/dist/cargo-inputs.mjs +281 -0
  4. package/dist/cargo-inputs.mjs.map +1 -0
  5. package/dist/changed.d.mts +1 -0
  6. package/dist/changed.mjs +178 -0
  7. package/dist/changed.mjs.map +1 -0
  8. package/dist/cli-contract-BY7vwgKc.mjs +41 -0
  9. package/dist/cli-contract-BY7vwgKc.mjs.map +1 -0
  10. package/dist/cli.mjs +1038 -1206
  11. package/dist/cli.mjs.map +1 -1
  12. package/dist/config.d.mts +4 -2
  13. package/dist/config.mjs +26 -13
  14. package/dist/config.mjs.map +1 -1
  15. package/dist/decision-rules.d.mts +1 -1
  16. package/dist/decision-rules.mjs +1 -1
  17. package/dist/{define-lint-preset-BYMl7wof.mjs → define-lint-preset-CxzPzVuB.mjs} +110 -80
  18. package/dist/define-lint-preset-CxzPzVuB.mjs.map +1 -0
  19. package/dist/{package-A62qq8pE.mjs → dependencies-v59cxwTD.mjs} +186 -165
  20. package/dist/dependencies-v59cxwTD.mjs.map +1 -0
  21. package/dist/ignored-directories-thSB0IAT.mjs +57 -0
  22. package/dist/ignored-directories-thSB0IAT.mjs.map +1 -0
  23. package/dist/{index-lM4Pphgz.d.mts → index-DL7PSp7j.d.mts} +21 -16
  24. package/dist/{index-CcVKuHBw.d.mts → index-DdJXnW1q.d.mts} +2 -2
  25. package/dist/lint.d.mts +2 -2
  26. package/dist/lint.mjs +1 -1
  27. package/dist/locked-closure-paths-Dtqs8uBU.mjs +7 -0
  28. package/dist/locked-closure-paths-Dtqs8uBU.mjs.map +1 -0
  29. package/dist/locked-inputs.d.mts +12 -0
  30. package/dist/locked-inputs.mjs +20 -0
  31. package/dist/locked-inputs.mjs.map +1 -0
  32. package/dist/oxlint.mjs +2 -1
  33. package/dist/oxlint.mjs.map +1 -1
  34. package/dist/package-Bdv6W97F.mjs +144 -0
  35. package/dist/package-Bdv6W97F.mjs.map +1 -0
  36. package/dist/project-DeQcAglt.mjs +464 -0
  37. package/dist/project-DeQcAglt.mjs.map +1 -0
  38. package/dist/publish.d.mts +1 -0
  39. package/dist/publish.mjs +822 -0
  40. package/dist/publish.mjs.map +1 -0
  41. package/dist/reachable-Cc-255L3.mjs +13 -0
  42. package/dist/reachable-Cc-255L3.mjs.map +1 -0
  43. package/dist/{repository-files-CorshdqY.mjs → repository-files-aXwrITdF.mjs} +9 -2
  44. package/dist/repository-files-aXwrITdF.mjs.map +1 -0
  45. package/dist/runtime-GbrDfB8K.mjs +29 -0
  46. package/dist/runtime-GbrDfB8K.mjs.map +1 -0
  47. package/dist/started-once-CkTooI_o.mjs +13 -0
  48. package/dist/started-once-CkTooI_o.mjs.map +1 -0
  49. package/dist/{cli-contract-8SnKqhGw.mjs → syntax-ct2fFLtv.mjs} +9 -45
  50. package/dist/syntax-ct2fFLtv.mjs.map +1 -0
  51. package/dist/workspace-settings.d.mts +1 -1
  52. package/dist/workspace-settings.mjs +11 -92
  53. package/dist/workspace-settings.mjs.map +1 -1
  54. package/package.json +52 -34
  55. package/skills/msch-checks/SKILL.md +1 -6
  56. package/skills/publishing/SKILL.md +46 -0
  57. package/skills/repository-config/SKILL.md +21 -15
  58. package/skills/workspace-settings/SKILL.md +33 -3
  59. package/src/app/vite.d.ts +6 -0
  60. package/dist/cli-contract-8SnKqhGw.mjs.map +0 -1
  61. package/dist/define-lint-preset-BYMl7wof.mjs.map +0 -1
  62. package/dist/package-A62qq8pE.mjs.map +0 -1
  63. package/dist/repository-files-CorshdqY.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,10 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { B as stringsIn, E as hasVerifyTask, F as childrenOf$2, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as definesTask, _ as publishedProjects, a as publicEntriesOf, b as runTasksOf, c as readManifest, d as lockedPackages, f as deployEntries, i as EntryManifestJson, l as workspaceDependencies, m as patternOf$1, o as MANIFEST_FILE$1, p as namedWorkspaces, r as publishedWorkspaces, s as dependencyEntries, u as lockedGraph, v as workspaceDirectories, w as VERIFY_TASK, y as workspaceManifest, z as propertyValue } from "./package-A62qq8pE.mjs";
3
- import { a as groupOf$2, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-CorshdqY.mjs";
2
+ import { B as stringsIn, E as hasVerifyTask, F as childrenOf$2, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as definesTask, _ as publishedProjects, a as cratesIn, b as runTasksOf, 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, y as workspaceManifest, z as propertyValue } from "./dependencies-v59cxwTD.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-DeQcAglt.mjs";
4
+ import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-aXwrITdF.mjs";
5
+ import { a as publicEntriesOf, i as EntryManifestJson, r as publishedWorkspaces } from "./package-Bdv6W97F.mjs";
4
6
  import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-5-f_qs1E.mjs";
5
- import { $ as isPropertyAccessExpression, A as getLeadingCommentRanges, B as isEnumDeclaration, C as uniqueByReference, D as SignatureKind, E as InternalSymbolName, F as isBinaryExpression, G as isImportDeclaration, H as isFunctionDeclaration, I as isBlock, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isCallExpression, M as getTextOfJSDocComment, N as isArrayLiteralExpression, O as SyntaxKind, P as isArrowFunction, Q as isParenthesizedExpression, R as isClassDeclaration, S as symbolAt, T as IndexKind, U as isFunctionExpression, V as isExportDeclaration, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as lineOf$3, a as problemAt$9, at as isSpreadElement, b as referencedSymbols, c as columnOf, ct as isTypeLiteralNode, d as descendantsOf, dt as isVariableDeclaration, et as isPropertyAssignment, f as importedModulesOf, ft as isVariableDeclarationList, g as isTypeDeclaration, h as isInsideAny, i as formatProblem, it as isSourceFile, j as getNameOfDeclaration, k as getJSDocTags, l as contains, lt as isTypeReferenceNode, m as isGenericDeclaration, n as ProblemList, nt as isSatisfiesExpression, o as sortProblems, ot as isStringLiteral, p as isExternalDeclaration, pt as isVariableStatement, q as isModuleBlock, rt as isSignatureDeclaration, s as childrenOf$3, st as isTypeAliasDeclaration, tt as isReturnStatement, u as declarationsOf, ut as isUnionTypeNode, v as packageOf$1, w as API, x as resolvedSymbol, y as propertyNamesOf, z as isElementAccessExpression } from "./cli-contract-8SnKqhGw.mjs";
7
+ import { t as startedOnce } from "./started-once-CkTooI_o.mjs";
8
+ 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$3, tt as isTypeAliasDeclaration, u as isTypeDeclaration, x as SignatureKind, z as isImportDeclaration } from "./syntax-ct2fFLtv.mjs";
9
+ import { a as problemAt$9, i as formatProblem, n as ProblemList, o as sortProblems } from "./cli-contract-BY7vwgKc.mjs";
10
+ import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-GbrDfB8K.mjs";
6
11
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
7
- import { Array, Cause, Config, Effect, FileSystem, Function, HashMap, HashSet, Layer, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
12
+ import { Array, Config, Effect, FileSystem, HashMap, HashSet, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
8
13
  import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
9
14
  import { ChildProcess } from "effect/process";
10
15
  import { parse, resolveConfigFromFile } from "vite-plus";
@@ -14,6 +19,8 @@ import treeSitter from "@vscode/tree-sitter-wasm";
14
19
  import { Parser, isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
15
20
  import semver from "semver";
16
21
  import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
22
+ import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
23
+ import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4";
17
24
  import path from "node:path";
18
25
  import { isComment, isTag, isText } from "domhandler";
19
26
  import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
@@ -21,9 +28,6 @@ import { DockerfileParser } from "dockerfile-ast";
21
28
  import { parse as parse$3 } from "sql-parser-cst";
22
29
  import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
23
30
  import { findSkillFiles } from "@tanstack/intent";
24
- import { runMain } from "@effect/platform-node-shared/NodeRuntime";
25
- import { FetchHttpClient } from "effect/http";
26
- import { Otlp, OtlpSerialization } from "effect/observability";
27
31
  // src/features/check-overrides/model/override-findings.ts
28
32
  const describeVersions = (versions) => Option.getOrElse(Option.liftPredicate(Array.join(versions, ","), (joined) => joined !== ""), () => "-");
29
33
  const describeChanges = (report) => {
@@ -49,11 +53,36 @@ const overrideProblem = (located) => (report) => {
49
53
  });
50
54
  return Option.none();
51
55
  };
56
+ // src/features/check-overrides/model/override-records.ts
57
+ const RECORDS = [
58
+ NODE_MODULES,
59
+ ".cache",
60
+ "msch",
61
+ "overrides"
62
+ ];
63
+ const NO_PROBLEMS$1 = [];
64
+ const keyOf$1 = Effect.fn("keyOf")(function* keyOf(root, inputs) {
65
+ const files = yield* RepositoryFiles;
66
+ const implementation = yield* implementationFingerprint(import.meta.dirname);
67
+ return yield* contentKey([implementation], pipe(inputs, Array.map((file) => [file, files.join(root, file)])));
68
+ });
69
+ const unlessPassed = Effect.fn("unlessPassed")(function* unlessPassed(root, inputs, check) {
70
+ const files = yield* RepositoryFiles;
71
+ const key = yield* keyOf$1(root, inputs);
72
+ const records = yield* recordsIn(files.join(root, ...RECORDS));
73
+ if (Array.contains(records.passed, key)) {
74
+ yield* Effect.annotateCurrentSpan({ "msch.overrides.recorded": true });
75
+ return NO_PROBLEMS$1;
76
+ }
77
+ const problems = yield* check;
78
+ if (Array.isReadonlyArrayEmpty(problems)) yield* keepOnly(records, [key]);
79
+ return problems;
80
+ });
52
81
  // src/shared/lib/text-position.ts
53
- const START$16 = 0;
82
+ const START$19 = 0;
54
83
  const FIRST_COLUMN$4 = 1;
55
84
  const positionOf = (source) => (index) => {
56
- const before = pipe(source, String$1.slice(START$16, index), String$1.split("\n"));
85
+ const before = pipe(source, String$1.slice(START$19, index), String$1.split("\n"));
57
86
  return {
58
87
  line: before.length,
59
88
  column: pipe(Array.last(before), Option.match({
@@ -104,7 +133,7 @@ const AdvisorySchema = Schema.Struct({
104
133
  github_advisory_id: Schema.String
105
134
  });
106
135
  const AuditReport = Schema.fromJsonString(Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }));
107
- const SCOPE_PREFIX$1 = "@";
136
+ const SCOPE_PREFIX = "@";
108
137
  const NAME_START = 0;
109
138
  const SEPARATOR_LENGTH = 1;
110
139
  const PEER_CONTEXT_START = "(";
@@ -128,8 +157,8 @@ const advisoriesIn = (output) => Option.match(Schema.decodeOption(AuditReport)(o
128
157
  onSome: (report) => sorted(pipe(Record.values(report.advisories), Array.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`)))
129
158
  });
130
159
  const separatorOf = (key) => {
131
- if (!String$1.startsWith(SCOPE_PREFIX$1)(key)) return String$1.indexOf(SCOPE_PREFIX$1)(key);
132
- return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX$1), Option.map((index) => index + SEPARATOR_LENGTH));
160
+ if (!String$1.startsWith(SCOPE_PREFIX)(key)) return String$1.indexOf(SCOPE_PREFIX)(key);
161
+ return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX), Option.map((index) => index + SEPARATOR_LENGTH));
133
162
  };
134
163
  const withoutPeerContext = (version) => Option.match(String$1.indexOf(PEER_CONTEXT_START)(version), {
135
164
  onNone: () => version,
@@ -198,22 +227,22 @@ const withBaselineProbe = (overrides) => ({
198
227
  [BASELINE_PROBE]: REMOVED_DEPENDENCY
199
228
  });
200
229
  // src/features/check-overrides/model/overrides.ts
201
- const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
230
+ const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
202
231
  const RESOLUTION_FILES = [
203
232
  "*package.json",
204
- WORKSPACE_FILE$5,
233
+ WORKSPACE_FILE$6,
205
234
  "pnpm-lock.yaml",
206
235
  ".npmrc",
207
236
  "patches/*"
208
237
  ];
209
238
  const RESOLUTION_CONCURRENCY = 4;
210
239
  const SUCCEEDED$1 = 0;
211
- const taggedError$7 = Schema.TaggedError;
212
- var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
240
+ const taggedError$6 = Schema.TaggedError;
241
+ var OverrideResolutionFailed = class extends taggedError$6()("OverrideResolutionFailed", {
213
242
  override: Schema.String,
214
243
  output: Schema.String
215
244
  }) {};
216
- const textOf$1 = (stream) => stream.pipe(Stream.decodeText(), Stream.mkString);
245
+ const textOf = (stream) => stream.pipe(Stream.decodeText(), Stream.mkString);
217
246
  const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override) {
218
247
  const handle = yield* ChildProcess.make("vp", [
219
248
  "install",
@@ -227,7 +256,7 @@ const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override
227
256
  extendEnv: true,
228
257
  stdin: "ignore"
229
258
  });
230
- const [output, status] = yield* Effect.all([textOf$1(handle.all), handle.exitCode], { concurrency: "unbounded" });
259
+ const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], { concurrency: "unbounded" });
231
260
  if (Number(status) !== SUCCEEDED$1) return yield* OverrideResolutionFailed.make({
232
261
  override,
233
262
  output
@@ -244,7 +273,7 @@ const auditIn = Effect.fn("auditIn")(function* auditIn(directory) {
244
273
  extendEnv: true,
245
274
  stdin: "ignore"
246
275
  });
247
- const [report] = yield* Effect.all([textOf$1(handle.stdout), handle.exitCode], { concurrency: "unbounded" });
276
+ const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], { concurrency: "unbounded" });
248
277
  return advisoriesIn(report);
249
278
  }, Effect.scoped);
250
279
  const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* trackedFiles(root) {
@@ -254,7 +283,7 @@ const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* tra
254
283
  "--",
255
284
  ...RESOLUTION_FILES
256
285
  ], { cwd: root });
257
- const listed = yield* textOf$1(handle.stdout);
286
+ const listed = yield* textOf(handle.stdout);
258
287
  return pipe(String$1.split(listed, "\0"), Array.filter(String$1.isNonEmpty));
259
288
  }, Effect.scoped);
260
289
  const copyFiles = Effect.fn("copyFiles")(function* copyFiles(workspace, directory) {
@@ -298,16 +327,12 @@ const resolutionWith = Effect.fn("resolutionWith")(function* resolutionWith(work
298
327
  advisories
299
328
  })(depPaths);
300
329
  }, Effect.scoped);
301
- const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, overrides, keys) {
330
+ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace, keys) {
302
331
  const path = yield* Path.Path;
303
- const workspace = {
304
- root,
305
- files: yield* trackedResolutionFiles(root),
306
- overrides
307
- };
332
+ const { root, overrides } = workspace;
308
333
  const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));
309
334
  const judgeAgainstBaseline = judge(baseline);
310
- const file = path.join(root, WORKSPACE_FILE$5);
335
+ const file = path.join(root, WORKSPACE_FILE$6);
311
336
  const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(Effect.map((candidate) => overrideProblem({
312
337
  ...located,
313
338
  file
@@ -319,24 +344,29 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, overrid
319
344
  const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
320
345
  const fs = yield* FileSystem.FileSystem;
321
346
  const path = yield* Path.Path;
322
- const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$5)).pipe(Effect.option);
347
+ const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$6)).pipe(Effect.option);
323
348
  const manifest = yield* workspaceManifest(root);
324
349
  const overrides = pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)), Option.getOrElse(() => ({})));
325
350
  const keys = pipe(source, Option.map((text) => overrideKeysOf(text)(overrides)), Option.getOrElse(() => []));
326
351
  if (!Array.isReadonlyArrayNonEmpty(keys)) return [];
327
- return yield* problemsFor(root, overrides, keys);
352
+ const files = yield* trackedResolutionFiles(root);
353
+ return yield* unlessPassed(root, files, problemsFor$1({
354
+ root,
355
+ files,
356
+ overrides
357
+ }, keys));
328
358
  });
329
359
  // src/shared/lib/scanned-files.ts
330
360
  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;
331
361
  const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
332
362
  const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
333
- const READ_CONCURRENCY$27 = 64;
363
+ const READ_CONCURRENCY$30 = 64;
334
364
  const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
335
365
  const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
336
366
  /** @internal */
337
367
  const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
338
368
  const files = yield* RepositoryFiles;
339
- const names = yield* files.listedFiles(root);
369
+ const names = yield* files.ownedFiles(root);
340
370
  return pipe(names, Array.map((name) => ({
341
371
  name,
342
372
  file: files.join(root, name)
@@ -353,18 +383,18 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
353
383
  const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
354
384
  onNone: () => [],
355
385
  onSome: (source) => problemsIn(entry, source)
356
- }))), { concurrency: READ_CONCURRENCY$27 });
386
+ }))), { concurrency: READ_CONCURRENCY$30 });
357
387
  return Array.flatten(found);
358
388
  });
359
389
  // src/features/check-overrides/model/git-subpath.ts
360
390
  const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
361
391
  const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
362
- const RULE$43 = "git-subpath-dependency";
392
+ const RULE$49 = "git-subpath-dependency";
363
393
  const WHOLE_MATCH$3 = 0;
364
394
  const problemAt$8 = ({ file }, source) => (found) => ({
365
395
  file,
366
396
  ...positionOf(source)(found.index ?? WHOLE_MATCH$3),
367
- rule: RULE$43,
397
+ rule: RULE$49,
368
398
  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])}\`.`
369
399
  });
370
400
  const problemsIn$16 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$8(entry, source)));
@@ -375,13 +405,13 @@ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(r
375
405
  return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$16);
376
406
  });
377
407
  // src/features/check-overrides/model/restricted-rules.ts
378
- const RULE$42 = "unnamed-restriction";
408
+ const RULE$48 = "unnamed-restriction";
379
409
  const WHOLE_MATCH$2 = 0;
380
410
  const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
381
411
  const problemsIn$15 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
382
412
  file: entry.file,
383
413
  ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
384
- rule: RULE$42,
414
+ rule: RULE$48,
385
415
  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.`
386
416
  })));
387
417
  /** @internal */
@@ -390,41 +420,41 @@ const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRe
390
420
  return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$15);
391
421
  });
392
422
  // src/features/check-overrides/model/package-registry.ts
393
- const RULE$41 = "package-registry";
423
+ const RULE$47 = "package-registry";
394
424
  const REGISTRY = "https://npm.flatt.tech/";
395
425
  const TRAILING_SLASH = /\/$/u;
396
- const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
426
+ const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
397
427
  const NPMRC = /(?:^|\/)\.npmrc$/u;
398
428
  const WORKSPACE_REGISTRY = /^registry:/mu;
399
429
  const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
400
- const START$15 = 0;
430
+ const START$18 = 0;
401
431
  const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
402
432
  const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
403
433
  const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
404
434
  const withoutSlash = String$1.replace(TRAILING_SLASH, "");
405
435
  const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
406
- const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$15));
436
+ const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$18));
407
437
  const workspaceProblem = (file, source, registry) => ({
408
438
  file,
409
- ...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
410
- rule: RULE$41,
439
+ ...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
440
+ rule: RULE$47,
411
441
  message: Option.match(registry, {
412
- onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$4}.`,
442
+ onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
413
443
  onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
414
444
  })
415
445
  });
416
446
  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) => ({
417
447
  file: entry.file,
418
- ...positionOf(source)(found.index ?? START$15),
419
- rule: RULE$41,
420
- message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$15])}\`. Remove the line.`
448
+ ...positionOf(source)(found.index ?? START$18),
449
+ rule: RULE$47,
450
+ message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$18])}\`. Remove the line.`
421
451
  })));
422
452
  const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
423
453
  const files = yield* RepositoryFiles;
424
454
  const manifest = yield* workspaceManifest(root);
425
455
  if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) return [];
426
456
  const registry = registryOf(manifest.value);
427
- const file = files.join(root, WORKSPACE_FILE$4);
457
+ const file = files.join(root, WORKSPACE_FILE$5);
428
458
  const read = yield* files.readFile(file);
429
459
  const source = Option.getOrElse(read, () => "");
430
460
  return [workspaceProblem(file, source, registry)];
@@ -436,36 +466,36 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
436
466
  return [...yield* checkWorkspace(root), ...overrides];
437
467
  });
438
468
  // src/features/check-placement/model/colocated-git-patterns.ts
439
- const RULE$40 = "colocated-git-patterns";
469
+ const RULE$46 = "colocated-git-patterns";
440
470
  const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
441
471
  const ROOT$2 = ".";
442
- const SEPARATOR$22 = "/";
472
+ const SEPARATOR$21 = "/";
443
473
  const NEGATION$1 = "!";
444
474
  const COMMENT$1 = "#";
445
475
  const ANY_DEPTH = "**";
446
- const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$22}`;
476
+ const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$21}`;
447
477
  const LEADING_SLASHES = /^\/+/u;
448
478
  const TRAILING_SLASHES = /\/+$/u;
449
479
  const SPACES = /\s+/u;
450
- const FIRST$20 = 1;
451
- const READ_CONCURRENCY$26 = 16;
452
- const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$22}`)(inner));
480
+ const FIRST$24 = 1;
481
+ const READ_CONCURRENCY$29 = 16;
482
+ const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$21}`)(inner));
453
483
  const withoutPrefix = (prefix, text) => {
454
484
  if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
455
485
  return text;
456
486
  };
457
487
  const isAnchored = (pattern) => {
458
488
  const body = withoutPrefix(NEGATION$1, pattern);
459
- return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$22));
489
+ return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$21));
460
490
  };
461
- const segmentsOf$1 = ({ directory, pattern }) => {
491
+ const segmentsOf = ({ directory, pattern }) => {
462
492
  const body = withoutPrefix(NEGATION$1, pattern);
463
493
  const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
464
- const own = String$1.split(SEPARATOR$22)(trimmed);
494
+ const own = String$1.split(SEPARATOR$21)(trimmed);
465
495
  if (directory === ROOT$2) return own;
466
- return [...String$1.split(SEPARATOR$22)(directory), ...own];
496
+ return [...String$1.split(SEPARATOR$21)(directory), ...own];
467
497
  };
468
- const depthOf = (directory) => String$1.split(SEPARATOR$22)(directory).length;
498
+ const depthOf = (directory) => String$1.split(SEPARATOR$21)(directory).length;
469
499
  const entryOf$1 = (file, kind, directory) => (line, index) => {
470
500
  const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
471
501
  if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT$1)(pattern)) return Option.none();
@@ -473,7 +503,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
473
503
  file,
474
504
  kind,
475
505
  directory,
476
- line: index + FIRST$20,
506
+ line: index + FIRST$24,
477
507
  pattern,
478
508
  values: Array.join(values, " ")
479
509
  });
@@ -488,12 +518,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
488
518
  const problemAt$7 = (entry, message) => ({
489
519
  file: entry.file,
490
520
  line: entry.line,
491
- column: FIRST$20,
492
- rule: RULE$40,
521
+ column: FIRST$24,
522
+ rule: RULE$46,
493
523
  message
494
524
  });
495
525
  const misplacedMessage = (kind, workspaces) => {
496
- if (workspaces.length === FIRST$20) {
526
+ if (workspaces.length === FIRST$24) {
497
527
  const workspace = Array.join(workspaces, "");
498
528
  return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
499
529
  }
@@ -503,12 +533,12 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
503
533
  const files = yield* RepositoryFiles;
504
534
  const leading = Array.take(segments, depth);
505
535
  if (Array.contains(leading, ANY_DEPTH)) return [];
506
- const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$22)}${SEPARATOR$22}${MANIFEST_FILE$1}`]);
536
+ const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$21)}${SEPARATOR$21}${MANIFEST_FILE$3}`]);
507
537
  return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
508
538
  });
509
539
  const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
510
540
  const matchedWorkspaces = Effect.fn("matchedWorkspaces")(function* matchedWorkspaces(root, workspaces, entry) {
511
- const segments = segmentsOf$1(entry);
541
+ const segments = segmentsOf(entry);
512
542
  const candidates = pipe(workspaces, Array.filter(isInside(entry.directory)), Array.filter((workspace) => depthOf(workspace) < segments.length));
513
543
  const depths = pipe(candidates, Array.map(depthOf), Array.dedupe);
514
544
  const matched = yield* Effect.forEach(depths, (depth) => matchedAtDepth(root, segments, depth), { concurrency: 1 });
@@ -524,12 +554,12 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
524
554
  const isFloating = (pattern) => !String$1.startsWith(NEGATION$1)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
525
555
  const ownLevelName = (pattern) => {
526
556
  if (isFloating(pattern)) return Option.some(pattern);
527
- const name = withoutPrefix(SEPARATOR$22, pattern);
557
+ const name = withoutPrefix(SEPARATOR$21, pattern);
528
558
  return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));
529
559
  };
530
560
  const sameName = (outer, name) => {
531
561
  if (outer === name) return true;
532
- return String$1.endsWith(SEPARATOR$22)(name) && `${outer}${SEPARATOR$22}` === name;
562
+ return String$1.endsWith(SEPARATOR$21)(name) && `${outer}${SEPARATOR$21}` === name;
533
563
  };
534
564
  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);
535
565
  const outerName = ({ directory, kind }) => {
@@ -543,22 +573,22 @@ const repeated = (entries) => (entry) => {
543
573
  /** @internal */
544
574
  const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
545
575
  const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
546
- const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$26 });
576
+ const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$29 });
547
577
  const entries = Array.flatten(read);
548
578
  const workspaces = yield* workspaceDirectories(root);
549
- const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$26 });
579
+ const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$29 });
550
580
  const repeatedFound = pipe(entries, Array.map(repeated(entries)));
551
581
  return Array.getSomes([...misplacedFound, ...repeatedFound]);
552
582
  });
553
583
  // src/features/check-placement/model/colocated-tests.ts
554
- const RULE$39 = "colocated-test";
555
- const FIRST$19 = 1;
556
- const READ_CONCURRENCY$25 = 64;
584
+ const RULE$45 = "colocated-test";
585
+ const FIRST$23 = 1;
586
+ const READ_CONCURRENCY$28 = 64;
557
587
  const ROOT_SUBPATH = ".";
558
588
  const NAME_GROUP = "name";
559
589
  const SPECIFIER_GROUP = "specifier";
560
- const SCRIPT$3 = /\.[cm]?[jt]sx?$/u;
561
- const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
590
+ const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
591
+ const TEST_FILE$2 = /\.test\.[cm]?[jt]sx?$/u;
562
592
  const MANIFEST_NAME = /package\.json$/u;
563
593
  const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
564
594
  const SPEC_DIRECTORY = /(?:^|\/)specs?\//u;
@@ -566,24 +596,24 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
566
596
  const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
567
597
  const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
568
598
  const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
569
- const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
599
+ const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
570
600
  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.";
571
601
  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>.";
572
- const Manifest$4 = Schema.Struct({
602
+ const Manifest$5 = Schema.Struct({
573
603
  name: Schema.optional(Schema.String),
574
604
  exports: Schema.optional(Schema.Unknown)
575
605
  });
576
- const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
606
+ const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
577
607
  const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
578
- const problemFor$6 = (test, message) => ({
608
+ const problemFor$7 = (test, message) => ({
579
609
  file: test.file,
580
- line: FIRST$19,
581
- column: FIRST$19,
582
- rule: RULE$39,
610
+ line: FIRST$23,
611
+ column: FIRST$23,
612
+ rule: RULE$45,
583
613
  message: `${test.base} ${message}`
584
614
  });
585
615
  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);
586
- const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE$1.test(name)));
616
+ const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE$2.test(name)));
587
617
  const ownerOf$4 = (packages, name) => {
588
618
  const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
589
619
  return Array.last(Array.sort(owners, byLength$2));
@@ -597,9 +627,9 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
597
627
  const files = yield* RepositoryFiles;
598
628
  const owner = ownerOf$4(context.packages, test.name);
599
629
  if (Option.isNone(owner)) return [];
600
- const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$1));
630
+ const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
601
631
  const join = (target) => files.join(context.root, owner.value, target);
602
- return pipe(text, Option.flatMap(decodeManifest$7), Option.map(specifiersBeside({
632
+ return pipe(text, Option.flatMap(decodeManifest$9), Option.map(specifiersBeside({
603
633
  join,
604
634
  dirname: files.dirname,
605
635
  directory: test.directory
@@ -619,21 +649,21 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
619
649
  });
620
650
  const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
621
651
  const problemIn$6 = Effect.fn("problemIn")(function* problemIn(context, test) {
622
- if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$6(test, DIRECTORY_MESSAGE));
623
- if (!TEST_FILE$1.test(test.name)) return Option.none();
652
+ if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$7(test, DIRECTORY_MESSAGE));
653
+ if (!TEST_FILE$2.test(test.name)) return Option.none();
624
654
  if (yield* refersIn(context, test)) return Option.none();
625
- return Option.some(problemFor$6(test, SIBLING_MESSAGE));
655
+ return Option.some(problemFor$7(test, SIBLING_MESSAGE));
626
656
  });
627
657
  /** @internal */
628
658
  const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
629
659
  const files = yield* RepositoryFiles;
630
- const listed = yield* files.matchingFiles(root, EXCLUDED$5);
660
+ const listed = yield* files.matchingFiles(root, EXCLUDED$6);
631
661
  const names = pipe(listed, Array.filter(String$1.isNonEmpty));
632
662
  const context = {
633
663
  root,
634
- packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE$1), Array.map(String$1.replace(MANIFEST_NAME, "")))
664
+ packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE$3), Array.map(String$1.replace(MANIFEST_NAME, "")))
635
665
  };
636
- const tests = pipe(names, Array.filter((name) => SCRIPT$3.test(name)), Array.map((name) => {
666
+ const tests = pipe(names, Array.filter((name) => SCRIPT$2.test(name)), Array.map((name) => {
637
667
  const file = files.join(root, name);
638
668
  return {
639
669
  name,
@@ -642,12 +672,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
642
672
  directory: files.dirname(file)
643
673
  };
644
674
  }));
645
- const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$25 });
675
+ const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$28 });
646
676
  return Array.getSomes(found);
647
677
  });
648
678
  // src/shared/lib/agent-docs.ts
649
679
  const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
650
- const READ_CONCURRENCY$24 = 16;
680
+ const READ_CONCURRENCY$27 = 16;
651
681
  const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
652
682
  const files = yield* RepositoryFiles;
653
683
  const listed = yield* files.listedFiles(root);
@@ -656,32 +686,60 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
656
686
  const file = files.join(root, name);
657
687
  const problemOf = Option.flatMap(problemIn(file));
658
688
  return files.readFile(file).pipe(Effect.map(problemOf));
659
- }, { concurrency: READ_CONCURRENCY$24 });
689
+ }, { concurrency: READ_CONCURRENCY$27 });
660
690
  return Array.getSomes(found);
661
691
  });
662
692
  // src/features/check-placement/model/agent-docs-length.ts
663
693
  const RECOMMENDED_LINES = 200;
664
- const FIRST$18 = 1;
665
- const RULE$38 = "agent-docs-length";
694
+ const FIRST$22 = 1;
695
+ const RULE$44 = "agent-docs-length";
666
696
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
667
- const problemFor$5 = (file) => (lines) => {
697
+ const problemFor$6 = (file) => (lines) => {
668
698
  if (lines <= RECOMMENDED_LINES) return Option.none();
669
699
  return Option.some({
670
700
  file,
671
701
  line: 201,
672
- column: FIRST$18,
673
- rule: RULE$38,
702
+ column: FIRST$22,
703
+ rule: RULE$44,
674
704
  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.`
675
705
  });
676
706
  };
677
707
  /** @internal */
678
- const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
708
+ const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$6(file)(lineCount(source)));
709
+ // src/features/check-placement/model/claude-link.ts
710
+ const RULE$43 = "claude-md-link";
711
+ const CLAUDE = "CLAUDE.md";
712
+ const AGENTS = "AGENTS.md";
713
+ const FIRST$21 = 1;
714
+ const READ_CONCURRENCY$26 = 16;
715
+ const MESSAGE$15 = "CLAUDE.md must be a symbolic link to AGENTS.md";
716
+ /** @internal */
717
+ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
718
+ const files = yield* RepositoryFiles;
719
+ const [listed, links] = yield* Effect.all([files.listedFiles(root), files.linkedFiles(root)], { concurrency: "unbounded" });
720
+ const problemOf = Effect.fn("problemOf")(function* problemOf(name) {
721
+ const file = files.join(root, name);
722
+ const target = yield* files.readLink(file);
723
+ const isLink = pipe(links, Array.contains(name));
724
+ const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
725
+ return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
726
+ file: path,
727
+ line: FIRST$21,
728
+ column: FIRST$21,
729
+ rule: RULE$43,
730
+ message: MESSAGE$15
731
+ })));
732
+ });
733
+ const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
734
+ const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$26 });
735
+ return Array.getSomes(found);
736
+ });
679
737
  // src/features/check-placement/model/dangling-links.ts
680
- const RULE$37 = "dangling-link";
681
- const SEPARATOR$21 = "/";
682
- const FIRST$17 = 1;
683
- const READ_CONCURRENCY$23 = 16;
684
- const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$21}`)(name);
738
+ const RULE$42 = "dangling-link";
739
+ const SEPARATOR$20 = "/";
740
+ const FIRST$20 = 1;
741
+ const READ_CONCURRENCY$25 = 16;
742
+ const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
685
743
  /** @internal */
686
744
  const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
687
745
  const files = yield* RepositoryFiles;
@@ -691,46 +749,46 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
691
749
  const link = yield* files.readLink(file);
692
750
  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) => ({
693
751
  file,
694
- line: FIRST$17,
695
- column: FIRST$17,
696
- rule: RULE$37,
752
+ line: FIRST$20,
753
+ column: FIRST$20,
754
+ rule: RULE$42,
697
755
  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.`
698
756
  })));
699
757
  });
700
- const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$23 });
758
+ const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$25 });
701
759
  return Array.getSomes(found);
702
760
  });
703
761
  // src/features/check-placement/model/nested-docs.ts
704
- const RULE$36 = "nested-docs";
762
+ const RULE$41 = "nested-docs";
705
763
  const CONFIG_FILE$6 = "vite.config.ts";
706
- const SEPARATOR$20 = "/";
707
- const FIRST$16 = 1;
708
- const READ_CONCURRENCY$22 = 64;
764
+ const SEPARATOR$19 = "/";
765
+ const FIRST$19 = 1;
766
+ const READ_CONCURRENCY$24 = 64;
709
767
  const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
710
768
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
711
769
  const README = /^README(?:\.[^/]+)?$/iu;
712
770
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
713
- const taggedError$6 = Schema.TaggedError;
714
- var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
715
- const isNested = (name) => String$1.includes(SEPARATOR$20)(name);
716
- const problemFor$4 = (file, message) => ({
771
+ const taggedError$5 = Schema.TaggedError;
772
+ var RootConfigUnreadable = class extends taggedError$5()("RootConfigUnreadable", { file: Schema.String }) {};
773
+ const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
774
+ const problemFor$5 = (file, message) => ({
717
775
  file,
718
- line: FIRST$16,
719
- column: FIRST$16,
720
- rule: RULE$36,
776
+ line: FIRST$19,
777
+ column: FIRST$19,
778
+ rule: RULE$41,
721
779
  message
722
780
  });
723
781
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
724
782
  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.";
725
783
  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.";
726
784
  const agentDocProblem = ({ file, base, directory }, allowed) => {
727
- if (!allowed.workspaceAgentDocs) return Option.some(problemFor$4(file, `${base} ${AGENT_DOCS_MESSAGE}`));
785
+ if (!allowed.workspaceAgentDocs) return Option.some(problemFor$5(file, `${base} ${AGENT_DOCS_MESSAGE}`));
728
786
  if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
729
- return Option.some(problemFor$4(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
787
+ return Option.some(problemFor$5(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
730
788
  };
731
789
  const readmeProblem = ({ file, base, directory }, allowed) => {
732
790
  if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
733
- return Option.some(problemFor$4(file, `${base} ${README_MESSAGE}`));
791
+ return Option.some(problemFor$5(file, `${base} ${README_MESSAGE}`));
734
792
  };
735
793
  const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
736
794
  const files = yield* RepositoryFiles;
@@ -756,7 +814,7 @@ const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function*
756
814
  /** @internal */
757
815
  const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(root) {
758
816
  const files = yield* RepositoryFiles;
759
- const names = yield* files.listedFiles(root);
817
+ const names = yield* files.ownedFiles(root);
760
818
  const nested = pipe(names, Array.filter(isNested));
761
819
  const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);
762
820
  const directories = yield* workspaceDirectories(root);
@@ -764,64 +822,102 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
764
822
  workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
765
823
  workspaceAgentDocs
766
824
  };
767
- const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$22 });
825
+ const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$24 });
768
826
  return Array.getSomes(found);
769
827
  });
770
828
  // src/features/check-placement/model/published-readme.ts
771
- const RULE$35 = "published-readme";
829
+ const RULE$40 = "published-readme";
772
830
  const README_FILE = "README.md";
773
- const READ_CONCURRENCY$21 = 16;
774
- const MESSAGE$11 = "contains Japanese. This package is published to npm, so write its README in English.";
831
+ const READ_CONCURRENCY$23 = 16;
832
+ const MESSAGE$14 = "contains Japanese. This package is published to npm, so write its README in English.";
833
+ const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
834
+ const FILE_START$1 = 1;
775
835
  const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
776
836
  const files = yield* RepositoryFiles;
777
837
  const file = files.join(root, directory, README_FILE);
778
838
  const text = yield* files.readFile(file);
839
+ if (Option.isNone(text)) return Option.some({
840
+ file,
841
+ line: FILE_START$1,
842
+ column: FILE_START$1,
843
+ rule: RULE$40,
844
+ message: MISSING_MESSAGE
845
+ });
779
846
  return pipe(text, Option.flatMap((source) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
780
847
  const { line, column } = positionOf(source)(found.index);
781
848
  return {
782
849
  file,
783
850
  line,
784
851
  column,
785
- rule: RULE$35,
786
- message: MESSAGE$11
852
+ rule: RULE$40,
853
+ message: MESSAGE$14
787
854
  };
788
855
  }))));
789
856
  });
790
857
  /** @internal */
791
858
  const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
792
859
  const projects = yield* publishedProjects(root);
793
- const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$21 });
860
+ const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$23 });
861
+ return Array.getSomes(found);
862
+ });
863
+ // src/features/check-placement/model/published-tests.ts
864
+ const RULE$39 = "published-tests";
865
+ const MANIFEST_FILE$2 = "package.json";
866
+ const FILE_START = 1;
867
+ const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
868
+ const MESSAGE$13 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
869
+ const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
870
+ const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
871
+ const files = yield* RepositoryFiles;
872
+ const absolute = files.join(root, directory);
873
+ const prefix = `${absolute}/`;
874
+ if (testedIn(listed)(prefix)) return Option.none();
875
+ return Option.some({
876
+ file: files.join(absolute, MANIFEST_FILE$2),
877
+ line: FILE_START,
878
+ column: FILE_START,
879
+ rule: RULE$39,
880
+ message: MESSAGE$13
881
+ });
882
+ });
883
+ /** @internal */
884
+ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPublishedTests(root) {
885
+ const files = yield* RepositoryFiles;
886
+ const projects = yield* publishedProjects(root);
887
+ const listed = yield* files.listedFiles(root);
888
+ const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
889
+ const found = yield* Effect.forEach(projects, (project) => problemFor$4(root, absolute, project), { concurrency: 1 });
794
890
  return Array.getSomes(found);
795
891
  });
796
892
  // src/features/check-placement/model/root-docs.ts
797
- const RULE$34 = "root-docs";
798
- const SEPARATOR$19 = "/";
799
- const FIRST$15 = 1;
893
+ const RULE$38 = "root-docs";
894
+ const SEPARATOR$18 = "/";
895
+ const FIRST$18 = 1;
800
896
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
801
897
  const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
802
- const MESSAGE$10 = "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.";
803
- const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$19)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
898
+ const MESSAGE$12 = "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.";
899
+ const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
804
900
  /** @internal */
805
901
  const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
806
902
  const files = yield* RepositoryFiles;
807
903
  const names = yield* files.listedFiles(root);
808
904
  return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
809
905
  file: files.join(root, name),
810
- line: FIRST$15,
811
- column: FIRST$15,
812
- rule: RULE$34,
813
- message: `${name} ${MESSAGE$10}`
906
+ line: FIRST$18,
907
+ column: FIRST$18,
908
+ rule: RULE$38,
909
+ message: `${name} ${MESSAGE$12}`
814
910
  })));
815
911
  });
816
912
  // src/features/check-placement/model/root-readme.ts
817
- const RULE$33 = "root-readme";
913
+ const RULE$37 = "root-readme";
818
914
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
819
- const READ_CONCURRENCY$20 = 16;
820
- const START$14 = 0;
915
+ const READ_CONCURRENCY$22 = 16;
916
+ const START$17 = 0;
821
917
  const CHECK_POLICY = "@r_masseater/msch";
822
918
  const MARKETPLACE = ".claude-plugin/marketplace.json";
823
919
  const RELATIVE$1 = /^\.\//u;
824
- const SEPARATOR$18 = "/";
920
+ const SEPARATOR$17 = "/";
825
921
  const MarketplacePlugin = Schema.Struct({
826
922
  name: Schema.optional(Schema.String),
827
923
  source: Schema.Unknown
@@ -833,7 +929,7 @@ const NO_PLUGINS = {
833
929
  };
834
930
  const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
835
931
  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.`;
836
- const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$18)(directory), Array.last, Option.getOrElse(() => directory));
932
+ const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$17)(directory), Array.last, Option.getOrElse(() => directory));
837
933
  const pluginsOf = (plugins) => {
838
934
  const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
839
935
  const segments = pipe(directories, Array.map(lastSegment));
@@ -862,8 +958,8 @@ const problemsIn$14 = (file, source, plugins) => (workspace) => {
862
958
  const pattern = patternFor(plugins)(workspace);
863
959
  return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
864
960
  file,
865
- ...at(found.index ?? START$14),
866
- rule: RULE$33,
961
+ ...at(found.index ?? START$17),
962
+ rule: RULE$37,
867
963
  message
868
964
  })));
869
965
  };
@@ -882,7 +978,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
882
978
  const named = yield* namedWorkspaces(root);
883
979
  const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
884
980
  const plugins = yield* marketplacePlugins(root);
885
- const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$20 });
981
+ const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$22 });
886
982
  return Array.flatten(found);
887
983
  });
888
984
  // src/features/check-placement/model/doc-placement.ts
@@ -890,19 +986,21 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
890
986
  const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlacement(root) {
891
987
  const found = yield* Effect.all([
892
988
  checkNestedDocs(root),
989
+ checkClaudeLinks(root),
893
990
  checkRootReadme(root),
894
991
  checkRootDocs(root),
895
992
  checkAgentDocsLength(root),
896
993
  checkDanglingLinks(root),
897
- checkPublishedReadme(root)
994
+ checkPublishedReadme(root),
995
+ checkPublishedTests(root)
898
996
  ], { concurrency: "unbounded" });
899
997
  return Array.flatten(found);
900
998
  });
901
999
  // src/features/check-placement/model/docs-mirror.ts
902
- const RULE$32 = "docs-mirror";
1000
+ const RULE$36 = "docs-mirror";
903
1001
  const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
904
1002
  const MIRROR_LIMIT = 3;
905
- const READ_CONCURRENCY$19 = 16;
1003
+ const READ_CONCURRENCY$21 = 16;
906
1004
  const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
907
1005
  const BEFORE = String.raw`(?<![\w@/.-])`;
908
1006
  const AFTER = String.raw`(?![\w@.-])`;
@@ -924,7 +1022,7 @@ const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Opti
924
1022
  file,
925
1023
  line,
926
1024
  column,
927
- rule: RULE$32,
1025
+ rule: RULE$36,
928
1026
  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.`
929
1027
  };
930
1028
  }), Option.toArray);
@@ -939,7 +1037,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
939
1037
  return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
940
1038
  directory,
941
1039
  names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
942
- }))), { concurrency: READ_CONCURRENCY$19 });
1040
+ }))), { concurrency: READ_CONCURRENCY$21 });
943
1041
  });
944
1042
  /** @internal */
945
1043
  const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
@@ -952,31 +1050,31 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
952
1050
  onNone: () => [],
953
1051
  onSome: (text) => problemIn$3(workspaces)(doc, file, text)
954
1052
  })));
955
- }, { concurrency: READ_CONCURRENCY$19 });
1053
+ }, { concurrency: READ_CONCURRENCY$21 });
956
1054
  return Array.flatten(found);
957
1055
  });
958
1056
  // src/features/check-placement/model/ignored-sources.ts
959
- const RULE$31 = "ignored-sources";
1057
+ const RULE$35 = "ignored-sources";
960
1058
  const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
961
- const FIRST$14 = 1;
962
- const MESSAGE$9 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
1059
+ const FIRST$17 = 1;
1060
+ const MESSAGE$11 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
963
1061
  /** @internal */
964
1062
  const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
965
1063
  const files = yield* RepositoryFiles;
966
1064
  const ignored = yield* files.ignoredFiles(root, SOURCES);
967
1065
  return pipe(ignored, Array.map((file) => ({
968
1066
  file: files.join(root, file),
969
- line: FIRST$14,
970
- column: FIRST$14,
971
- rule: RULE$31,
972
- message: MESSAGE$9
1067
+ line: FIRST$17,
1068
+ column: FIRST$17,
1069
+ rule: RULE$35,
1070
+ message: MESSAGE$11
973
1071
  })));
974
1072
  });
975
1073
  // src/features/check-placement/model/member-sources.ts
976
1074
  const ROOT_WORKSPACE$1 = ".";
977
- const FIRST$13 = 1;
978
- const SEPARATOR$17 = "/";
979
- const EXCLUDED$4 = [
1075
+ const FIRST$16 = 1;
1076
+ const SEPARATOR$16 = "/";
1077
+ const EXCLUDED$5 = [
980
1078
  ":(exclude,attr:linguist-vendored)",
981
1079
  ":(exclude,attr:linguist-generated)",
982
1080
  ":(exclude,attr:linguist-documentation)"
@@ -989,54 +1087,30 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
989
1087
  const files = yield* RepositoryFiles;
990
1088
  return {
991
1089
  workspaces: yield* memberWorkspaces(root),
992
- listed: yield* files.matchingFiles(root, EXCLUDED$4)
1090
+ listed: yield* files.matchingFiles(root, EXCLUDED$5)
993
1091
  };
994
1092
  });
995
1093
  const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
996
1094
  const fileProblem$1 = ({ file, rule, message }) => ({
997
1095
  file,
998
- line: FIRST$13,
999
- column: FIRST$13,
1096
+ line: FIRST$16,
1097
+ column: FIRST$16,
1000
1098
  rule,
1001
1099
  message
1002
1100
  });
1003
- const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$17}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
1101
+ const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$16}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
1004
1102
  workspace,
1005
1103
  inner: String$1.slice(workspace.length + 1)(name)
1006
1104
  })));
1007
- // src/features/check-placement/model/layered-source.ts
1008
- const LAYERED_RULE$1 = "layered-source";
1105
+ // src/features/check-placement/model/public-entries.ts
1009
1106
  const ENTRY_RULE$3 = "public-entry";
1010
- const SOURCE_DIRECTORY$1 = "src";
1011
- const SEPARATOR$16 = "/";
1012
- const LOOSE_DEPTH = 2;
1013
- const LAYERS$1 = [
1014
- "app",
1015
- "pages",
1016
- "widgets",
1017
- "features",
1018
- "entities",
1019
- "shared"
1020
- ];
1021
- const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
1022
- const ROOT_ALLOWED = /^(?:[^/]+\.config\.[cm]?[jt]s|alchemy\.[^/]+\.ts|[^/]+\.d\.[cm]?ts|bin\/.+)$/u;
1023
1107
  const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
1024
- const OUTSIDE_MESSAGE$1 = "sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root.";
1025
- const LOOSE_MESSAGE = "sits directly in src/. Put it in a layer: app/ for entry points and wiring, features/<verb>-<object>/ for one operation, entities/<noun>/ for a shared domain object, or shared/<segment>/ for code without domain rules.";
1026
- const LAYER_MESSAGE$1 = `is not an FSD layer. src/ holds only ${Array.join(LAYERS$1, ", ")}.`;
1027
1108
  const ENTRY_MESSAGE$2 = "is a package entry that points inside a slice. Point exports and bin at bin/<name>.ts, src/app/<entry>.ts or a slice's index.ts.";
1028
1109
  const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
1029
- const layerProblemOf = (owned) => {
1030
- const parts = String$1.split(owned.inner, SEPARATOR$16);
1031
- const [top, layer] = parts;
1032
- if (top !== SOURCE_DIRECTORY$1) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$16}${owned.inner}`, OUTSIDE_MESSAGE$1], () => !ROOT_ALLOWED.test(owned.inner));
1033
- if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$16}${owned.inner}`, LOOSE_MESSAGE]);
1034
- return Option.liftPredicate([`${owned.workspace}${SEPARATOR$16}${SOURCE_DIRECTORY$1}${SEPARATOR$16}${layer}`, LAYER_MESSAGE$1], () => !pipe(LAYERS$1, Array.contains(layer ?? "")));
1035
- };
1036
1110
  const entryProblems$2 = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
1037
1111
  const files = yield* RepositoryFiles;
1038
1112
  const directory = files.join(root, workspace);
1039
- const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$1));
1113
+ const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
1040
1114
  const join = (target) => files.join(directory, target);
1041
1115
  return pipe(text, Option.flatMap(decodeEntryManifest), Option.map((manifest) => publicEntriesOf({
1042
1116
  manifest,
@@ -1049,34 +1123,20 @@ const entryProblems$2 = Effect.fn("entryProblems")(function* entryProblems(root,
1049
1123
  })));
1050
1124
  });
1051
1125
  /** @internal */
1052
- const checkLayeredSource = Effect.fn("checkLayeredSource")(function* checkLayeredSource(root) {
1053
- const files = yield* RepositoryFiles;
1054
- const { workspaces, listed } = yield* memberSources(root);
1055
- const layered = pipe(listed, Array.filter((name) => SCRIPT$2.test(name)), Array.map(ownerOf$2(workspaces)), Array.getSomes, Array.map(layerProblemOf), Array.getSomes, Array.dedupeWith(([left], [right]) => left === right), Array.map(([file, message]) => fileProblem$1({
1056
- file: files.join(root, file),
1057
- rule: LAYERED_RULE$1,
1058
- message
1059
- })));
1126
+ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublicEntries(root) {
1127
+ const workspaces = yield* memberWorkspaces(root);
1060
1128
  const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems$2(root, workspace), { concurrency: 1 });
1061
- return [...layered, ...Array.flatten(entries)];
1129
+ return Array.flatten(entries);
1062
1130
  });
1063
1131
  // src/shared/lib/tree-sitter.ts
1064
- const taggedError$5 = Schema.TaggedError;
1065
- var GrammarUnreadable = class extends taggedError$5()("GrammarUnreadable", {
1132
+ const taggedError$4 = Schema.TaggedError;
1133
+ var GrammarUnreadable = class extends taggedError$4()("GrammarUnreadable", {
1066
1134
  grammar: Schema.String,
1067
1135
  message: Schema.String
1068
1136
  }) {};
1069
1137
  const PARSER_KEY = "parser";
1070
- const cache = () => {
1071
- const started = /* @__PURE__ */ new Map();
1072
- return (key, start) => Option.getOrElse(Option.fromNullishOr(started.get(key)), () => {
1073
- const promise = start();
1074
- started.set(key, promise);
1075
- return promise;
1076
- });
1077
- };
1078
- const initParser = cache();
1079
- const loadOnce = cache();
1138
+ const initParser = startedOnce();
1139
+ const loadOnce = startedOnce();
1080
1140
  const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
1081
1141
  const loadLanguage = (grammar) => {
1082
1142
  const unreadable = (cause) => GrammarUnreadable.make({
@@ -1118,7 +1178,6 @@ const MODULE_INDEX = "mod";
1118
1178
  const CRATE_ROOTS = ["src/lib.rs", "src/main.rs"];
1119
1179
  const OUTSIDE_ALLOWED = /^(?:build\.rs|benches\/.+)$/u;
1120
1180
  const SEPARATE_TEST = /^tests\/.+$/u;
1121
- const SHARED_SLICES = ["app", "shared"];
1122
1181
  const SLICED_LAYERS = [
1123
1182
  "pages",
1124
1183
  "widgets",
@@ -1129,11 +1188,6 @@ const SLICED_LAYERS = [
1129
1188
  const LAYER_DEPTH = 1;
1130
1189
  const SOURCE_PREFIX$1 = `src/`;
1131
1190
  const ROOT_CRATE = "";
1132
- const NO_RANK = -1;
1133
- const LAYER_INDEX = 0;
1134
- const SLICE_INDEX = 1;
1135
- const upwardMessage = (target, source) => `uses the ${target} layer from the ${source} layer. A layer may only use the layers below it (${Array.join(LAYERS, ", ")}).`;
1136
- const crossMessage = (layer, target, source) => `uses the ${layer} slice ${target} from the slice ${source}. Slices of one layer must not use each other; move what they share down a layer.`;
1137
1191
  const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
1138
1192
  const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$3.test(name)), Array.map((name) => String$1.replace(MANIFEST$3, "")(name)));
1139
1193
  const ownedBy = (crate, name) => {
@@ -1168,120 +1222,13 @@ const kindOf$1 = (inner) => {
1168
1222
  if (!String$1.startsWith(SOURCE_PREFIX$1)(inner)) return "misplaced";
1169
1223
  return sourceKindOf(inner);
1170
1224
  };
1171
- const isInsideSource = (inner) => String$1.startsWith(SOURCE_PREFIX$1)(inner);
1172
- const resolvedFrom = ({ segments, current }) => {
1173
- const first = Array.head(segments);
1174
- const rest = Array.drop(segments, 1);
1175
- if (Option.contains(first, "crate")) return Option.some(rest);
1176
- if (Option.contains(first, "self")) return resolvedFrom({
1177
- segments: rest,
1178
- current
1179
- });
1180
- if (Option.contains(first, "super")) return pipe(Option.liftPredicate(current, Array.isReadonlyArrayNonEmpty), Option.flatMap((parent) => resolvedFrom({
1181
- segments: rest,
1182
- current: Array.dropRight(parent, 1)
1183
- })));
1184
- return Option.some([...current, ...segments]);
1185
- };
1186
- const rankOf = (layer) => pipe(Array.findFirstIndex(LAYERS, (name) => name === layer), Option.getOrElse(() => NO_RANK));
1187
- const partOf = (path, index) => Option.getOrElse(Array.get(path, index), () => "");
1188
- const importMessage = ({ source, target }) => {
1189
- const [sourceLayer, sourceSlice] = [partOf(source, LAYER_INDEX), partOf(source, SLICE_INDEX)];
1190
- const [targetLayer, targetSlice] = [partOf(target, LAYER_INDEX), partOf(target, SLICE_INDEX)];
1191
- if (!Array.contains(LAYERS, targetLayer) || target.length < 2) return Option.none();
1192
- if (rankOf(targetLayer) < rankOf(sourceLayer)) return Option.some(upwardMessage(targetLayer, sourceLayer));
1193
- if (targetLayer === sourceLayer && targetSlice !== sourceSlice && !Array.contains(SHARED_SLICES, targetLayer)) return Option.some(crossMessage(targetLayer, targetSlice, sourceSlice));
1194
- return Option.none();
1195
- };
1196
1225
  const isSliceIndex = (modulePath) => modulePath.length === 2 && Option.exists(Array.head(modulePath), (layer) => Array.contains(SLICED_LAYERS, layer));
1197
1226
  // src/features/check-placement/model/rust-syntax.ts
1198
- const ANCHORS = [
1199
- "crate",
1200
- "super",
1201
- "self"
1202
- ];
1203
- const SCOPED = ["scoped_identifier", "scoped_type_identifier"];
1204
1227
  const IGNORED_ITEMS = ["line_comment", "block_comment"];
1205
- const PATH_SEPARATOR = "::";
1206
- const SELF = "self";
1207
1228
  const NEXT$4 = 1;
1208
1229
  const ALLOCATOR = "global_allocator";
1209
1230
  const field = (node, name) => Option.fromNullishOr(node.childForFieldName(name));
1210
1231
  const namedChildren = (node) => pipe(node.namedChildren, Array.flatMap((child) => Option.toArray(Option.fromNullishOr(child))));
1211
- const sameNode = (left, right) => Option.exists(left, (node) => node.id === right.id);
1212
- const segmentsOf = (node) => {
1213
- if (Array.contains(SCOPED, node.type)) return [...Option.match(field(node, "path"), {
1214
- onNone: () => [],
1215
- onSome: segmentsOf
1216
- }), ...Option.match(field(node, "name"), {
1217
- onNone: () => [],
1218
- onSome: (name) => [name.text]
1219
- })];
1220
- if (node.type === "generic_type") return Option.match(field(node, "type"), {
1221
- onNone: () => [],
1222
- onSome: segmentsOf
1223
- });
1224
- return [node.text];
1225
- };
1226
- const extendsPath = (parent, node) => Array.contains(SCOPED, parent.type) && sameNode(field(parent, "path"), node) || parent.type === "generic_type" && sameNode(field(parent, "type"), node);
1227
- const outermostPath = (node) => pipe(Option.fromNullishOr(node.parent), Option.filter((parent) => extendsPath(parent, node)), Option.match({
1228
- onNone: () => node,
1229
- onSome: outermostPath
1230
- }));
1231
- const tokenSegments = (node) => pipe(Option.fromNullishOr(node.nextSibling), Option.filter((separator) => separator.type === PATH_SEPARATOR), Option.flatMap((separator) => Option.fromNullishOr(separator.nextSibling)), Option.filter((next) => next.type === "identifier" || Array.contains(ANCHORS, next.type)), Option.match({
1232
- onNone: () => [node.text],
1233
- onSome: (next) => [node.text, ...tokenSegments(next)]
1234
- }));
1235
- const ancestors = (node) => pipe(Option.fromNullishOr(node.parent), Option.match({
1236
- onNone: () => [],
1237
- onSome: (parent) => [parent, ...ancestors(parent)]
1238
- }));
1239
- const scopeOf$1 = (node) => pipe(ancestors(node), Array.filter((ancestor) => ancestor.type === "mod_item"), Array.flatMap((module) => Option.toArray(field(module, "name"))), Array.map((name) => name.text), Array.reverse);
1240
- const pathAt = (node, segments) => ({
1241
- segments,
1242
- scope: scopeOf$1(node),
1243
- line: node.startPosition.row + NEXT$4,
1244
- column: node.startPosition.column + NEXT$4
1245
- });
1246
- const insideAny = (node, kinds) => Array.some(ancestors(node), (ancestor) => Array.contains(kinds, ancestor.type));
1247
- const anchoredPaths = (root) => pipe(root.descendantsOfType([...ANCHORS]), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.filter((node) => !insideAny(node, ["use_declaration", "visibility_modifier"])), Array.map((node) => {
1248
- if (Option.exists(Option.fromNullishOr(node.parent), (parent) => parent.type === "token_tree")) return pathAt(node, tokenSegments(node));
1249
- const outer = outermostPath(node);
1250
- return pathAt(node, segmentsOf(outer));
1251
- }));
1252
- const joined = (prefix, node) => {
1253
- const own = segmentsOf(node);
1254
- if (own.length === NEXT$4 && Option.contains(Array.head(own), SELF) && Array.isReadonlyArrayNonEmpty(prefix)) return prefix;
1255
- return [...prefix, ...own];
1256
- };
1257
- const treesOfUse = (prefix, node) => {
1258
- switch (node.type) {
1259
- case "scoped_use_list": {
1260
- const base = Option.match(field(node, "path"), {
1261
- onNone: () => prefix,
1262
- onSome: (path) => joined(prefix, path)
1263
- });
1264
- return Option.match(field(node, "list"), {
1265
- onNone: () => [base],
1266
- onSome: (list) => treesOfUse(base, list)
1267
- });
1268
- }
1269
- case "use_list": return Array.flatMap(namedChildren(node), (child) => treesOfUse(prefix, child));
1270
- case "use_as_clause": return Option.match(field(node, "path"), {
1271
- onNone: () => [],
1272
- onSome: (path) => [joined(prefix, path)]
1273
- });
1274
- case "use_wildcard": return pipe(Array.head(namedChildren(node)), Option.match({
1275
- onNone: () => [prefix],
1276
- onSome: (path) => [joined(prefix, path)]
1277
- }));
1278
- default: return [joined(prefix, node)];
1279
- }
1280
- };
1281
- const importedPaths = (root) => pipe(root.descendantsOfType("use_declaration"), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.flatMap((declaration) => pipe(field(declaration, "argument"), Option.match({
1282
- onNone: () => [],
1283
- onSome: (argument) => Array.map(treesOfUse([], argument), (segments) => pathAt(declaration, segments))
1284
- }))), Array.filter(({ segments }) => Option.exists(Array.head(segments), (first) => Array.contains(ANCHORS, first))));
1285
1232
  const itemOf = (node) => ({
1286
1233
  kind: node.type,
1287
1234
  name: Option.map(field(node, "name"), (name) => name.text),
@@ -1292,7 +1239,6 @@ const itemOf = (node) => ({
1292
1239
  });
1293
1240
  const replacesAllocator = (root) => pipe(root.descendantsOfType("attribute"), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.some((attribute) => Option.exists(Array.head(namedChildren(attribute)), (name) => name.text === ALLOCATOR)));
1294
1241
  const readRustFile = (root) => ({
1295
- paths: [...importedPaths(root), ...anchoredPaths(root)],
1296
1242
  items: pipe(namedChildren(root), Array.filter((node) => !Array.contains(IGNORED_ITEMS, node.type)), Array.map(itemOf)),
1297
1243
  replacesAllocator: replacesAllocator(root)
1298
1244
  });
@@ -9772,7 +9718,6 @@ const LAYERED_RULE = "layered-source";
9772
9718
  const ENTRY_RULE$1 = "public-entry";
9773
9719
  const TEST_RULE = "colocated-test";
9774
9720
  const SLICE_RULE = "feature-slice-name";
9775
- const IMPORT_RULE = "layer-import";
9776
9721
  const GRAMMAR = "rust";
9777
9722
  const WORD_SEPARATOR = "_";
9778
9723
  const FEATURES = "features";
@@ -9789,30 +9734,15 @@ const LAYER_ITEMS = [
9789
9734
  "attribute_item",
9790
9735
  "inner_attribute_item"
9791
9736
  ];
9792
- const READ_CONCURRENCY$18 = 64;
9793
- const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
9737
+ const READ_CONCURRENCY$20 = 64;
9738
+ const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
9794
9739
  const NONE$2 = [];
9795
- const OUTSIDE_MESSAGE = "sits outside src/. Put every module of a crate under src/ in an FSD layer; only build.rs and benches/ may stay outside.";
9796
- const LAYER_MESSAGE = `is not an FSD layer. A crate's src/ holds only lib.rs, main.rs, bin/ and the layers ${Array.join(LAYERS, ", ")}.`;
9797
9740
  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.";
9798
9741
  const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
9799
9742
  const ENTRY_MESSAGE = "makes an inner module of a slice public. Declare it with plain mod and re-export what other slices use with pub use from the slice module.";
9800
9743
  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/.";
9801
9744
  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).";
9802
9745
  const isFeatureName = isVerbObjectBy(WORD_SEPARATOR);
9803
- const placementProblem = ({ crate, inner, file }, root, join) => {
9804
- if (!isInsideSource(inner)) return fileProblem$1({
9805
- file,
9806
- rule: LAYERED_RULE,
9807
- message: OUTSIDE_MESSAGE
9808
- });
9809
- const top = Option.getOrElse(Array.head(modulePathOf(inner)), () => "");
9810
- return fileProblem$1({
9811
- file: join(root, crate, "src", top),
9812
- rule: LAYERED_RULE,
9813
- message: LAYER_MESSAGE
9814
- });
9815
- };
9816
9746
  const itemProblem = (file, rule, message) => ({ line, column }) => ({
9817
9747
  file,
9818
9748
  line,
@@ -9826,21 +9756,11 @@ const isRootItem = (inner) => (item) => {
9826
9756
  return item.kind === "function_item" && (inner === MAIN_FILE || BINARY.test(inner)) && Option.contains(item.name, MAIN);
9827
9757
  };
9828
9758
  const isLayerItem = (item) => Array.contains(LAYER_ITEMS, item.kind) || item.kind === "mod_item" && !item.inline;
9829
- const importProblems = (file, modulePath, paths) => pipe(paths, Array.flatMap((path) => pipe(resolvedFrom({
9830
- segments: path.segments,
9831
- current: [...modulePath, ...path.scope]
9832
- }), Option.flatMap((target) => importMessage({
9833
- source: modulePath,
9834
- target
9835
- })), Option.map((message) => itemProblem(file, IMPORT_RULE, message)(path)), Option.toArray)), Array.dedupeWith((left, right) => left.line === right.line && left.column === right.column && left.message === right.message));
9836
9759
  const entryProblems$1 = (file, modulePath, parsed) => {
9837
9760
  if (!isSliceIndex(modulePath)) return NONE$2;
9838
9761
  return pipe(parsed.items, Array.filter((item) => item.kind === "mod_item" && item.visible), Array.map(itemProblem(file, ENTRY_RULE$1, ENTRY_MESSAGE)));
9839
9762
  };
9840
- const moduleProblems = ({ source, parsed }) => {
9841
- const modulePath = modulePathOf(source.inner);
9842
- return [...entryProblems$1(source.file, modulePath, parsed), ...importProblems(source.file, modulePath, parsed.paths)];
9843
- };
9763
+ const moduleProblems = ({ source, parsed }) => entryProblems$1(source.file, modulePathOf(source.inner), parsed);
9844
9764
  const testProblems = ({ source, parsed }) => {
9845
9765
  if (parsed.replacesAllocator) return NONE$2;
9846
9766
  return [fileProblem$1({
@@ -9858,7 +9778,7 @@ const PROBLEMS = {
9858
9778
  skipped: () => NONE$2,
9859
9779
  misplaced: () => NONE$2
9860
9780
  };
9861
- const problemsOf$3 = (read) => PROBLEMS[kindOf$1(read.source.inner)](read);
9781
+ const problemsOf$4 = (read) => PROBLEMS[kindOf$1(read.source.inner)](read);
9862
9782
  const misnamedSlice = ({ crate, inner }, root, join) => {
9863
9783
  const modulePath = modulePathOf(inner);
9864
9784
  return pipe(Option.liftPredicate(modulePath, (path) => path.length >= 2), Option.filter((path) => Option.contains(Array.head(path), FEATURES)), Option.flatMap((path) => Array.last(Array.take(path, 2))), Option.filter((slice) => !isFeatureName(slice)), Option.map((slice) => join(root, crate, "src", FEATURES, slice)));
@@ -9868,7 +9788,6 @@ const sliceNameProblems = (root, join, sources) => pipe(sources, Array.filter(({
9868
9788
  rule: SLICE_RULE,
9869
9789
  message: SLICE_MESSAGE
9870
9790
  })));
9871
- const misplacedProblems = (root, join, sources) => pipe(sources, Array.filter(({ inner }) => kindOf$1(inner) === "misplaced"), Array.map((source) => placementProblem(source, root, join)), Array.dedupeWith((left, right) => left.file === right.file));
9872
9791
  const parsedWith = (language) => (source, text) => Option.map(readTree({
9873
9792
  language,
9874
9793
  source: text,
@@ -9883,7 +9802,7 @@ const isRead = ({ inner }) => {
9883
9802
  };
9884
9803
  const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
9885
9804
  const files = yield* RepositoryFiles;
9886
- const listed = yield* files.matchingFiles(root, EXCLUDED$3);
9805
+ const listed = yield* files.matchingFiles(root, EXCLUDED$4);
9887
9806
  const owner = crateOf(crateDirectories(listed));
9888
9807
  return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
9889
9808
  ...owned,
@@ -9897,26 +9816,43 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
9897
9816
  if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
9898
9817
  const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
9899
9818
  const parse = parsedWith(language);
9900
- 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$18 });
9901
- return [
9902
- ...misplacedProblems(root, files.join, sources),
9903
- ...sliceNameProblems(root, files.join, sources),
9904
- ...Array.flatMap(Array.getSomes(read), problemsOf$3)
9905
- ];
9819
+ 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$20 });
9820
+ return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
9821
+ });
9822
+ // src/features/check-placement/model/shadcn-ui-alias.ts
9823
+ const RULE$34 = "shadcn-ui-alias";
9824
+ const FIRST$15 = 1;
9825
+ const problemOf$8 = (directory, { file, alias }) => ({
9826
+ file,
9827
+ line: FIRST$15,
9828
+ column: FIRST$15,
9829
+ rule: RULE$34,
9830
+ 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/*".`
9831
+ });
9832
+ /** @internal */
9833
+ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAliasProblems(root, directory) {
9834
+ const files = yield* RepositoryFiles;
9835
+ const found = yield* shadcnUiOf(root, directory);
9836
+ if (Option.isNone(found)) return Array.empty();
9837
+ if (yield* Option.match(found.value.target, {
9838
+ onNone: () => Effect.succeed(false),
9839
+ onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
9840
+ })) return Array.empty();
9841
+ return [problemOf$8(directory, found.value)];
9906
9842
  });
9907
9843
  // src/features/check-placement/model/source-aliases.ts
9908
9844
  const ALIAS_RULE = "source-alias";
9909
- const FIRST$12 = 1;
9845
+ const FIRST$14 = 1;
9910
9846
  const SOURCE_ALIAS = "#/*";
9911
9847
  const SOURCE_TARGET = "./src/*";
9912
9848
  const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
9913
9849
  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.`;
9914
- const Manifest$3 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
9915
- const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
9850
+ const Manifest$4 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
9851
+ const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
9916
9852
  const problemAt$6 = (file, rule, message) => ({
9917
9853
  file,
9918
- line: FIRST$12,
9919
- column: FIRST$12,
9854
+ line: FIRST$14,
9855
+ column: FIRST$14,
9920
9856
  rule,
9921
9857
  message
9922
9858
  });
@@ -9928,15 +9864,15 @@ const targetsOf = (target) => {
9928
9864
  const intoSource = ([key, target]) => !(key === SOURCE_ALIAS && pipe(targetsOf(target), Array.every((path) => path === SOURCE_TARGET))) && pipe(targetsOf(target), Array.some((path) => SOURCE_PREFIX.test(path)));
9929
9865
  const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
9930
9866
  const files = yield* RepositoryFiles;
9931
- const manifest = files.join(root, workspace, MANIFEST_FILE$1);
9867
+ const manifest = files.join(root, workspace, MANIFEST_FILE$3);
9932
9868
  const text = yield* files.readFile(manifest);
9933
- return pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemAt$6(manifest, ALIAS_RULE, `"${key}" ${ALIAS_MESSAGE}`)));
9869
+ return pipe(text, Option.flatMap(decodeManifest$8), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemAt$6(manifest, ALIAS_RULE, `"${key}" ${ALIAS_MESSAGE}`)));
9934
9870
  });
9935
9871
  /** @internal */
9936
9872
  const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
9937
9873
  const workspaces = yield* memberWorkspaces(root);
9938
- const aliases = yield* Effect.forEach(workspaces, (workspace) => aliasProblems(root, workspace), { concurrency: 1 });
9939
- return Array.flatten(aliases);
9874
+ const found = yield* Effect.forEach(workspaces, (workspace) => Effect.all([aliasProblems(root, workspace), shadcnAliasProblems(root, workspace)], { concurrency: 1 }), { concurrency: 1 });
9875
+ return pipe(found, Array.flatten, Array.flatten);
9940
9876
  });
9941
9877
  // src/features/check-placement/model/placement-checks.ts
9942
9878
  /** @internal */
@@ -9944,7 +9880,7 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
9944
9880
  const found = yield* Effect.all([
9945
9881
  checkDocPlacement(root),
9946
9882
  checkColocatedTests(root),
9947
- checkLayeredSource(root),
9883
+ checkPublicEntries(root),
9948
9884
  checkRustModules(root),
9949
9885
  checkSourceAliases(root),
9950
9886
  checkSourceNames(root),
@@ -9963,18 +9899,18 @@ const SCRIPTS_DIRECTORY = "scripts";
9963
9899
  const WORKFLOW_DIRECTORY$1 = ".github/";
9964
9900
  const SEPARATOR$13 = "/";
9965
9901
  const CURRENT = "./";
9966
- const READ_CONCURRENCY$17 = 8;
9967
- const FIRST$11 = 1;
9902
+ const READ_CONCURRENCY$19 = 8;
9903
+ const FIRST$13 = 1;
9968
9904
  const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
9969
9905
  const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
9970
9906
  const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
9971
- const Manifest$2 = Schema.Struct({
9907
+ const Manifest$3 = Schema.Struct({
9972
9908
  bin: Schema.optional(Schema.Unknown),
9973
9909
  main: Schema.optional(Schema.Unknown),
9974
9910
  exports: Schema.optional(Schema.Unknown)
9975
9911
  });
9976
9912
  const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
9977
- const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
9913
+ const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
9978
9914
  const decodeTarget = Schema.decodeUnknownOption(Schema.String);
9979
9915
  const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
9980
9916
  const NO_ENTRIES = {
@@ -10000,8 +9936,8 @@ const entriesOf$2 = (manifest) => {
10000
9936
  };
10001
9937
  const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
10002
9938
  const files = yield* RepositoryFiles;
10003
- const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$1));
10004
- return pipe(text, Option.flatMap(decodeManifest$5), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
9939
+ const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
9940
+ return pipe(text, Option.flatMap(decodeManifest$7), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
10005
9941
  });
10006
9942
  const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
10007
9943
  const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
@@ -10013,7 +9949,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
10013
9949
  const files = yield* RepositoryFiles;
10014
9950
  const listed = yield* files.listedFiles(root);
10015
9951
  const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
10016
- const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$17 });
9952
+ const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$19 });
10017
9953
  return pipe(Array.getSomes(texts), Array.join("\n"));
10018
9954
  });
10019
9955
  const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13));
@@ -10040,8 +9976,8 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, directo
10040
9976
  const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
10041
9977
  const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
10042
9978
  file: files.join(root, directory, path),
10043
- line: FIRST$11,
10044
- column: FIRST$11,
9979
+ line: FIRST$13,
9980
+ column: FIRST$13,
10045
9981
  rule: UNRUN,
10046
9982
  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.`
10047
9983
  })));
@@ -10053,8 +9989,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
10053
9989
  const isDirectory = yield* files.isDirectory(file);
10054
9990
  return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
10055
9991
  file,
10056
- line: FIRST$11,
10057
- column: FIRST$11,
9992
+ line: FIRST$13,
9993
+ column: FIRST$13,
10058
9994
  rule: SCRIPTS,
10059
9995
  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.`
10060
9996
  })));
@@ -10063,50 +9999,26 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
10063
9999
  const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
10064
10000
  const all = ["", ...yield* workspaceDirectories(root)];
10065
10001
  const workflows = yield* workflowText(root);
10066
- const found = yield* Effect.forEach(all, (directory) => problemsIn$13(root, directory, workflows), { concurrency: READ_CONCURRENCY$17 });
10067
- const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$17 });
10002
+ const found = yield* Effect.forEach(all, (directory) => problemsIn$13(root, directory, workflows), { concurrency: READ_CONCURRENCY$19 });
10003
+ const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$19 });
10068
10004
  return [...Array.flatten(found), ...Array.getSomes(scripts)];
10069
10005
  });
10070
10006
  // src/features/check-repository-layout/model/crates.ts
10071
- const RULE$30 = "unverified-crate";
10072
- const CARGO_FILE = "Cargo.toml";
10007
+ const RULE$33 = "unverified-crate";
10008
+ const VERSION_RULE = "release-version";
10009
+ const MANIFEST_FILE$1 = "package.json";
10010
+ const APP_DIRECTORIES = ["", "src-tauri"];
10011
+ const CARGO_FILE$1 = "Cargo.toml";
10073
10012
  const CONFIG_FILE$5 = "vite.config.ts";
10074
10013
  const SEPARATOR$12 = "/";
10075
- const FIRST$10 = 1;
10076
- const READ_CONCURRENCY$16 = 8;
10077
- const CrateEntry = Schema.Struct({
10078
- name: Schema.String,
10079
- manifest_path: Schema.String
10080
- });
10081
- const CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));
10082
- const decodeCrateList = Schema.decodeUnknownEffect(CrateList);
10083
- const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
10084
- const output = yield* (yield* ChildProcess.make("cargo", [
10085
- "metadata",
10086
- "--no-deps",
10087
- "--format-version",
10088
- "1",
10089
- "--offline"
10090
- ], {
10091
- cwd: root,
10092
- extendEnv: true,
10093
- stdin: "ignore"
10094
- })).stdout.pipe(Stream.decodeText(), Stream.mkString);
10095
- const list = yield* decodeCrateList(output);
10096
- return pipe(list.packages, Array.map((crate) => ({
10097
- name: crate.name,
10098
- manifest: crate.manifest_path
10099
- })));
10100
- }, Effect.scoped);
10101
- const owningWorkspace = (directories) => (directory) => {
10102
- const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$12}`)(directory)));
10103
- return Array.last(Array.sort(owners, String$1.Order));
10104
- };
10014
+ const FIRST$12 = 1;
10015
+ const READ_CONCURRENCY$18 = 8;
10016
+ const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
10105
10017
  const problemFor$2 = (crate, message) => ({
10106
10018
  file: crate.manifest,
10107
- line: FIRST$10,
10108
- column: FIRST$10,
10109
- rule: RULE$30,
10019
+ line: FIRST$12,
10020
+ column: FIRST$12,
10021
+ rule: RULE$33,
10110
10022
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
10111
10023
  });
10112
10024
  const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
@@ -10116,17 +10028,33 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories
10116
10028
  if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$5))) return Option.none();
10117
10029
  return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$5} has no verify task`));
10118
10030
  });
10031
+ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
10032
+ const files = yield* RepositoryFiles;
10033
+ const directory = files.relative(root, files.dirname(crate.manifest));
10034
+ 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))));
10035
+ if (Option.isNone(workspace)) return Option.none();
10036
+ const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE$1));
10037
+ const version = pipe(text, Option.flatMap(Schema.decodeOption(PackageVersion)), Option.map((manifest) => manifest.version));
10038
+ if (Option.isNone(version) || version.value === crate.version) return Option.none();
10039
+ return Option.some({
10040
+ file: crate.manifest,
10041
+ line: FIRST$12,
10042
+ column: FIRST$12,
10043
+ rule: VERSION_RULE,
10044
+ 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.`
10045
+ });
10046
+ });
10119
10047
  /** @internal */
10120
10048
  const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
10121
10049
  const files = yield* RepositoryFiles;
10122
- if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
10050
+ if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
10123
10051
  const directories = yield* workspaceDirectories(root);
10124
10052
  const crates = yield* cratesIn(root);
10125
- const found = yield* Effect.forEach(crates, (crate) => problemIn$2(root, directories, crate), { concurrency: READ_CONCURRENCY$16 });
10126
- return Array.getSomes(found);
10053
+ const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$18 });
10054
+ return Array.getSomes(Array.flatten(found));
10127
10055
  });
10128
10056
  // src/features/check-repository-layout/model/deploy-entry-patterns.ts
10129
- const RULE$29 = "deploy-entry-pattern";
10057
+ const RULE$32 = "deploy-entry-pattern";
10130
10058
  const FALLOW_KEYS = [
10131
10059
  "entry",
10132
10060
  "entryPoints",
@@ -10144,8 +10072,8 @@ const NEGATED = "!";
10144
10072
  const ROOT_WORKSPACE = ".";
10145
10073
  const WRAP_OFFSET$1 = 1;
10146
10074
  const NO_OFFSET = 0;
10147
- const READ_CONCURRENCY$15 = 8;
10148
- const MESSAGE$8 = "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.";
10075
+ const READ_CONCURRENCY$17 = 8;
10076
+ const MESSAGE$10 = "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.";
10149
10077
  const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
10150
10078
  const FALLOW = {
10151
10079
  keys: FALLOW_KEYS,
@@ -10197,8 +10125,8 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(request) {
10197
10125
  return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
10198
10126
  file: path,
10199
10127
  ...positionOf(text.value)(start - kind.offset),
10200
- rule: RULE$29,
10201
- message: `${pattern} ${MESSAGE$8}`
10128
+ rule: RULE$32,
10129
+ message: `${pattern} ${MESSAGE$10}`
10202
10130
  })));
10203
10131
  });
10204
10132
  /** @internal */
@@ -10226,11 +10154,11 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
10226
10154
  kind,
10227
10155
  workspaces,
10228
10156
  entries
10229
- }), { concurrency: READ_CONCURRENCY$15 });
10157
+ }), { concurrency: READ_CONCURRENCY$17 });
10230
10158
  return Array.flatten(found);
10231
10159
  });
10232
10160
  // src/features/check-repository-layout/model/fallow-entries.ts
10233
- const RULE$28 = "listed-entry";
10161
+ const RULE$31 = "listed-entry";
10234
10162
  const ENTRY_KEYS = [
10235
10163
  "entry",
10236
10164
  "entryPoints",
@@ -10240,7 +10168,7 @@ const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?
10240
10168
  const WILDCARD$3 = /[*?{[]/u;
10241
10169
  const SEPARATOR$11 = "/";
10242
10170
  const WRAP_OFFSET = 1;
10243
- const READ_CONCURRENCY$14 = 8;
10171
+ const READ_CONCURRENCY$16 = 8;
10244
10172
  const decodeKey = Schema.decodeUnknownOption(KeySchema);
10245
10173
  const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
10246
10174
  const entryPatternsIn = (node) => {
@@ -10260,7 +10188,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
10260
10188
  return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
10261
10189
  file: path,
10262
10190
  ...positionOf(text.value)(start),
10263
- rule: RULE$28,
10191
+ rule: RULE$31,
10264
10192
  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.`
10265
10193
  })));
10266
10194
  });
@@ -10268,70 +10196,70 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
10268
10196
  const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
10269
10197
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10270
10198
  const directories = yield* workspaceDirectories(root);
10271
- const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$11(root, file, directories), { concurrency: READ_CONCURRENCY$14 });
10199
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$11(root, file, directories), { concurrency: READ_CONCURRENCY$16 });
10272
10200
  return Array.flatten(found);
10273
10201
  });
10274
- // src/features/check-repository-layout/model/hidden-verify.ts
10275
- const RULE$27 = "hidden-verify";
10276
- const CONFIG_FILE$4 = "vite.config.ts";
10277
- const FIRST$9 = 1;
10278
- const READ_CONCURRENCY$13 = 8;
10279
- const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
10280
- const config = yield* workspaceConfigOf(root, directory);
10281
- if (Option.isNone(config)) return Option.none();
10282
- const { file, program } = config.value;
10283
- if (definesTask(VERIFY_TASK)(program)) return Option.none();
10284
- const verified = yield* hasVerifyTask(file);
10285
- return Option.some({
10286
- file,
10287
- line: FIRST$9,
10288
- column: FIRST$9,
10289
- rule: RULE$27,
10290
- 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}.`
10291
- }).pipe(Option.filter(() => verified));
10292
- });
10293
- /** @internal */
10294
- const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
10295
- const directories = yield* workspaceDirectories(root);
10296
- const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$13 });
10297
- return Array.getSomes(found);
10298
- });
10299
10202
  // src/features/check-repository-layout/model/root-workspace-paths.ts
10300
- const RULE$26 = "root-workspace-path";
10301
- const CONFIG_FILE$3 = "vite.config.ts";
10203
+ const RULE$30 = "root-workspace-path";
10204
+ const CONFIG_FILE$4 = "vite.config.ts";
10302
10205
  const PATH_CHARACTER = /[\w.@/-]/u;
10303
10206
  const NAME_CHARACTER = /[\w.@-]/u;
10304
- const FIRST$8 = 0;
10207
+ const FIRST$11 = 0;
10305
10208
  const NEXT$2 = 1;
10306
10209
  const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
10307
- const mentions$1 = (directory) => (text) => {
10210
+ const mentions = (directory) => (text) => {
10308
10211
  const parts = String$1.split(text, directory);
10309
10212
  return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
10310
10213
  const before = parts[index] ?? "";
10311
10214
  const previous = String$1.slice(before.length - NEXT$2)(before);
10312
- const following = String$1.slice(FIRST$8, NEXT$2)(after);
10215
+ const following = String$1.slice(FIRST$11, NEXT$2)(after);
10313
10216
  return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
10314
10217
  }));
10315
10218
  };
10316
- const problemsIn$10 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions$1(directory)(found.text)), Array.map((directory) => ({
10219
+ const problemsIn$10 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
10317
10220
  file,
10318
10221
  ...positionOf(source)(found.start),
10319
- rule: RULE$26,
10320
- message: `${directory} is a workspace. The root ${CONFIG_FILE$3} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$3}: msch.lint, msch.devDependencies or its verify task.`
10222
+ rule: RULE$30,
10223
+ message: `${directory} is a workspace. The root ${CONFIG_FILE$4} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$4}: msch.lint, msch.devDependencies or its verify task.`
10321
10224
  })));
10322
10225
  /** @internal */
10323
10226
  const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
10324
10227
  const files = yield* RepositoryFiles;
10325
- const file = files.join(root, CONFIG_FILE$3);
10228
+ const file = files.join(root, CONFIG_FILE$4);
10326
10229
  const source = yield* files.readFile(file);
10327
10230
  if (Option.isNone(source)) return [];
10328
10231
  const directories = yield* workspaceDirectories(root);
10329
10232
  const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
10330
10233
  return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$10(file, source.value, directories)));
10331
10234
  });
10235
+ // src/features/check-repository-layout/model/hidden-verify.ts
10236
+ const RULE$29 = "hidden-verify";
10237
+ const CONFIG_FILE$3 = "vite.config.ts";
10238
+ const FIRST$10 = 1;
10239
+ const READ_CONCURRENCY$15 = 8;
10240
+ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
10241
+ const config = yield* workspaceConfigOf(root, directory);
10242
+ if (Option.isNone(config)) return Option.none();
10243
+ const { file, program } = config.value;
10244
+ if (definesTask(VERIFY_TASK)(program)) return Option.none();
10245
+ const verified = yield* hasVerifyTask(file);
10246
+ return Option.some({
10247
+ file,
10248
+ line: FIRST$10,
10249
+ column: FIRST$10,
10250
+ rule: RULE$29,
10251
+ message: `${directory} gets its verify task from code outside ${CONFIG_FILE$3}. The root verify reads ${CONFIG_FILE$3} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$3}.`
10252
+ }).pipe(Option.filter(() => verified));
10253
+ });
10254
+ /** @internal */
10255
+ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
10256
+ const directories = yield* workspaceDirectories(root);
10257
+ const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$15 });
10258
+ return Array.getSomes(found);
10259
+ });
10332
10260
  // src/features/check-repository-layout/model/shared-uncached-tasks.ts
10333
- const RULE$25 = "shared-uncached-task";
10334
- const READ_CONCURRENCY$12 = 8;
10261
+ const RULE$28 = "shared-uncached-task";
10262
+ const READ_CONCURRENCY$14 = 8;
10335
10263
  const SHARED = 2;
10336
10264
  const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
10337
10265
  const UncachedTask = Schema.Struct({
@@ -10367,21 +10295,53 @@ const definitionsIn = Effect.fn("definitionsIn")(function* definitionsIn(root, d
10367
10295
  source
10368
10296
  })(task))));
10369
10297
  });
10370
- const problemsOf$2 = (definitions) => {
10298
+ const problemsOf$3 = (definitions) => {
10371
10299
  const directories = pipe(definitions, Array.map(({ directory }) => directory), Array.dedupe);
10372
10300
  if (directories.length < SHARED) return [];
10373
10301
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
10374
10302
  file,
10375
10303
  ...position,
10376
- rule: RULE$25,
10304
+ rule: RULE$28,
10377
10305
  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.`
10378
10306
  })));
10379
10307
  };
10380
10308
  /** @internal */
10381
10309
  const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
10382
10310
  const directories = yield* workspaceDirectories(root);
10383
- const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$12 });
10384
- return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$2));
10311
+ const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$14 });
10312
+ return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
10313
+ });
10314
+ // src/features/check-repository-layout/model/unlocked-tasks.ts
10315
+ const RULE$27 = "unlocked-task";
10316
+ const READ_CONCURRENCY$13 = 8;
10317
+ const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
10318
+ const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
10319
+ 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))));
10320
+ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Option.flatMap(literalOf), Option.match({
10321
+ onNone: () => Option.isNone(propertyValue("cache")(task.value)),
10322
+ onSome: (cache) => cache !== false
10323
+ }));
10324
+ const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
10325
+ file,
10326
+ ...positionOf(source)(task.start),
10327
+ rule: RULE$27,
10328
+ 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.`
10329
+ })), Option.toArray)));
10330
+ /** @internal */
10331
+ const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
10332
+ const directories = yield* workspaceDirectories(root);
10333
+ const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$13 });
10334
+ return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
10335
+ });
10336
+ // src/features/check-repository-layout/model/task-checks.ts
10337
+ /** @internal */
10338
+ const checkTasks = Effect.fn("checkTasks")(function* checkTasks(root) {
10339
+ const found = yield* Effect.all([
10340
+ checkHiddenVerify(root),
10341
+ checkSharedUncachedTasks(root),
10342
+ checkUnlockedTasks(root)
10343
+ ], { concurrency: "unbounded" });
10344
+ return Array.flatten(found);
10385
10345
  });
10386
10346
  // src/features/check-repository-layout/model/workflow-nodes.ts
10387
10347
  const MISSING_OFFSET = 0;
@@ -10519,13 +10479,13 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
10519
10479
  /** @internal */
10520
10480
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
10521
10481
  // src/features/check-repository-layout/model/workflow-paths.ts
10522
- const RULE$24 = "workflow-path";
10482
+ const RULE$26 = "workflow-path";
10523
10483
  const WORKFLOW_DIRECTORY = ".github/workflows/";
10524
10484
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
10525
- const READ_CONCURRENCY$11 = 8;
10485
+ const READ_CONCURRENCY$12 = 8;
10526
10486
  const WILDCARD$2 = /[*?[]/u;
10527
10487
  const SEPARATOR$9 = "/";
10528
- const FIRST$7 = 0;
10488
+ const FIRST$9 = 0;
10529
10489
  const EXPECTED = {
10530
10490
  action: "a directory with action.yml",
10531
10491
  directory: "a directory",
@@ -10566,7 +10526,7 @@ const RESOLVERS = {
10566
10526
  };
10567
10527
  const staticPrefix = (path) => {
10568
10528
  const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
10569
- if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$7, -1)(prefix);
10529
+ if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
10570
10530
  return prefix;
10571
10531
  };
10572
10532
  const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
@@ -10582,10 +10542,10 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
10582
10542
  if (yield* RESOLVERS[found.kind](root, found.path)) return false;
10583
10543
  return !(yield* isIgnored$1(root, found.path));
10584
10544
  });
10585
- const problemOf$8 = (file, source) => (found) => ({
10545
+ const problemOf$7 = (file, source) => (found) => ({
10586
10546
  file,
10587
10547
  ...positionOf(source)(found.offset),
10588
- rule: RULE$24,
10548
+ rule: RULE$26,
10589
10549
  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.`
10590
10550
  });
10591
10551
  const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
@@ -10595,12 +10555,12 @@ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, workflow
10595
10555
  if (Option.isNone(source)) return [];
10596
10556
  const produced = producedPaths(source.value);
10597
10557
  const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
10598
- return pipe(missing, Array.map(problemOf$8(file, source.value)));
10558
+ return pipe(missing, Array.map(problemOf$7(file, source.value)));
10599
10559
  });
10600
10560
  /** @internal */
10601
10561
  const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
10602
10562
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10603
- const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$9(root, workflow), { concurrency: READ_CONCURRENCY$11 });
10563
+ const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$9(root, workflow), { concurrency: READ_CONCURRENCY$12 });
10604
10564
  return Array.flatten(found);
10605
10565
  });
10606
10566
  // src/features/check-repository-layout/model/workflow-scale.ts
@@ -10611,8 +10571,8 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
10611
10571
  const FILTER_KEYS = ["paths", "paths-ignore"];
10612
10572
  const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
10613
10573
  const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
10614
- const START$13 = 0;
10615
- const READ_CONCURRENCY$10 = 8;
10574
+ const START$16 = 0;
10575
+ const READ_CONCURRENCY$11 = 8;
10616
10576
  const SEPARATOR$8 = "/";
10617
10577
  const WORD_SEPARATORS = /[-_]/gu;
10618
10578
  const SPACE = " ";
@@ -10642,7 +10602,7 @@ const namesIn = (name, source) => {
10642
10602
  return [
10643
10603
  {
10644
10604
  text: name,
10645
- offset: START$13
10605
+ offset: START$16
10646
10606
  },
10647
10607
  ...Option.toArray(stringOf(childOf("name")(root))),
10648
10608
  ...keysOf$1(childOf("jobs")(root))
@@ -10692,7 +10652,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
10692
10652
  name: stem,
10693
10653
  source: text
10694
10654
  })]), Option.getOrElse(() => []));
10695
- }), { concurrency: READ_CONCURRENCY$10 });
10655
+ }), { concurrency: READ_CONCURRENCY$11 });
10696
10656
  const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
10697
10657
  return [...Array.flatten(found), ...actions];
10698
10658
  });
@@ -10704,21 +10664,20 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
10704
10664
  checkCrates(root),
10705
10665
  checkDeployEntryPatterns(root),
10706
10666
  checkFallowEntries(root),
10707
- checkHiddenVerify(root),
10708
10667
  checkRootWorkspacePaths(root),
10709
- checkSharedUncachedTasks(root),
10668
+ checkTasks(root),
10710
10669
  checkWorkflowPaths(root),
10711
10670
  checkWorkflowScale(root)
10712
10671
  ], { concurrency: "unbounded" });
10713
10672
  return Array.flatten(found);
10714
10673
  });
10715
10674
  // src/features/check-typescript-generation/model/typescript-generation.ts
10716
- const RULE$23 = "legacy-typescript";
10675
+ const RULE$25 = "legacy-typescript";
10717
10676
  const LOCKFILE = "pnpm-lock.yaml";
10718
10677
  const COMPILER = "typescript";
10719
10678
  const CURRENT_MAJOR = 7;
10720
10679
  const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
10721
- const FIRST$6 = 1;
10680
+ const FIRST$8 = 1;
10722
10681
  const legacyOf = (id) => {
10723
10682
  const { name, version } = parse$1(id);
10724
10683
  const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
@@ -10729,8 +10688,8 @@ const legacyOf = (id) => {
10729
10688
  };
10730
10689
  const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
10731
10690
  const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
10732
- onNone: () => FIRST$6,
10733
- onSome: (index) => index + FIRST$6
10691
+ onNone: () => FIRST$8,
10692
+ onSome: (index) => index + FIRST$8
10734
10693
  }));
10735
10694
  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)}.`;
10736
10695
  /** @internal */
@@ -10743,396 +10702,17 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
10743
10702
  return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
10744
10703
  file,
10745
10704
  line: lineOf$2(source)(legacy.id),
10746
- column: FIRST$6,
10747
- rule: RULE$23,
10705
+ column: FIRST$8,
10706
+ rule: RULE$25,
10748
10707
  message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
10749
10708
  })));
10750
10709
  });
10751
- // src/shared/lib/values.ts
10752
- const SCHEMA_TYPE_PROPERTIES = ["Type", "_output"];
10753
- const MINIMUM_SET_SIZE = 2;
10754
- const DATA_FIRST_ARITY = 2;
10755
- const valueKey = (value) => `${typeof value}:${String(value)}`;
10756
- const literalValueOf = (type) => {
10757
- if (type.isStringLiteralType() || type.isNumberLiteralType()) return Option.some(type.value);
10758
- return Option.none();
10759
- };
10760
- const literalValuesOf = (types) => {
10761
- const values = pipe(types, Array.map((member) => literalValueOf(member)), Array.getSomes, Array.dedupeWith((left, right) => valueKey(left) === valueKey(right)));
10762
- if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) return Option.none();
10763
- return Option.some(values);
10764
- };
10765
- const literalUnionOf = (type) => {
10766
- if (!type.isUnionType()) return Option.none();
10767
- return literalValuesOf(type.getTypes());
10768
- };
10769
- const elementTypeOf = (checker, type) => {
10770
- if (!checker.isArrayLikeType(type)) return Option.none();
10771
- return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));
10772
- };
10773
- const schemaTypeOf = (checker) => (type) => Array.findFirst(SCHEMA_TYPE_PROPERTIES, (name) => Option.fromUndefinedOr(checker.getPropertyOfType(type, name))).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));
10774
- const finiteValuesOf = (checker) => (type) => literalUnionOf(type).pipe(Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))), Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))));
10775
- const vocabularyOf = (checker) => (type) => {
10776
- if (!type.isUnionType()) return Option.none();
10777
- const optionalIds = /* @__PURE__ */ new Set([checker.getUndefinedType().id, checker.getNullType().id]);
10778
- const members = pipe(type.getTypes(), Array.filter((member) => !optionalIds.has(member.id)));
10779
- const values = Array.getSomes(pipe(members, Array.map((member) => literalValueOf(member))));
10780
- if (values.length < MINIMUM_SET_SIZE) return Option.none();
10781
- return Option.some({
10782
- values,
10783
- admitsUnnamedValues: values.length !== members.length
10784
- });
10785
- };
10786
- const isSubsetOf = Function.dual(DATA_FIRST_ARITY, (subset, superset) => {
10787
- const held = new Set(pipe(superset, Array.map((value) => valueKey(value))));
10788
- return pipe(subset, Array.every((value) => held.has(valueKey(value))));
10789
- });
10790
- const sameValues = Function.dual(DATA_FIRST_ARITY, (left, right) => left.length === right.length && isSubsetOf(left, right));
10791
- const valueText = (value) => {
10792
- if (typeof value === "string") return `"${value}"`;
10793
- return String(value);
10794
- };
10795
- const formatValues = (values) => pipe(values, Array.map(valueText), Array.join(" | "));
10796
- // src/entities/project/model/library.ts
10797
- const NAMESPACE_DEPTH_LIMIT = 8;
10798
- const EMPTY_INDEX = {
10799
- vocabularies: [],
10800
- shapes: []
10801
- };
10802
- const isObjectType = (checker) => (type) => !type.isUnionType() && !type.isLiteralType() && checker.getApparentType(type).id === type.id && Array.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));
10803
- const describeLibraryType = (type) => `${type.typeName} from ${type.specifier}`;
10804
- const locationOf = (declaration) => ({
10805
- file: declaration.getSourceFile().fileName,
10806
- pos: declaration.pos,
10807
- kind: declaration.kind
10808
- });
10809
- const declarationKey = (location) => `${location.file}#${String(location.pos)}#${String(location.kind)}`;
10810
- const shapeOf = (checker) => (source, declaration, type) => Array.filter([{
10811
- ...source,
10812
- declaration: locationOf(declaration),
10813
- propertyNames: propertyNamesOf(checker)(type)
10814
- }], () => isObjectType(checker)(type));
10815
- const declaredTypeIndex = (walk, exported) => {
10816
- const declaration = Array.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);
10817
- if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) return EMPTY_INDEX;
10818
- const located = {
10819
- specifier: walk.entry.specifier,
10820
- typeName: exported.typeName
10821
- };
10822
- const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);
10823
- return {
10824
- vocabularies: vocabularyOf(walk.checker)(type).pipe(Option.map((vocabulary) => ({
10825
- ...located,
10826
- vocabulary
10827
- })), Option.toArray),
10828
- shapes: shapeOf(walk.checker)({
10829
- ...located,
10830
- form: "declared"
10831
- }, declaration.value, type)
10832
- };
10833
- };
10834
- const schemaTypeIndex = (walk, located) => (declaration, schemaType) => ({
10835
- vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(Option.map((vocabulary) => ({
10836
- ...located,
10837
- vocabulary
10838
- })), Option.toArray),
10839
- shapes: shapeOf(walk.checker)({
10840
- ...located,
10841
- form: "schema"
10842
- }, declaration, schemaType)
10843
- });
10844
- const schemaValueIndex = (walk, exported) => {
10845
- const declaration = Array.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);
10846
- if (Option.isNone(declaration)) return EMPTY_INDEX;
10847
- const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);
10848
- const located = {
10849
- specifier: walk.entry.specifier,
10850
- typeName: `(typeof ${exported.typeName})["Type"]`
10851
- };
10852
- return Option.match(schemaTypeOf(walk.checker)(valueType), {
10853
- onNone: () => EMPTY_INDEX,
10854
- onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType)
10855
- });
10856
- };
10857
- const mergeIndexes = (indexes) => ({
10858
- vocabularies: pipe(indexes, Array.flatMap((index) => index.vocabularies)),
10859
- shapes: pipe(indexes, Array.flatMap((index) => index.shapes))
10860
- });
10861
- const isNamespace = (symbol) => pipe(declarationsOf(symbol), Array.some((declaration) => isModuleDeclaration(declaration)));
10862
- const indexUnder = (walk, visit) => {
10863
- const symbol = resolvedSymbol(walk.checker)(visit.exported);
10864
- const named = {
10865
- symbol,
10866
- typeName: `${visit.qualifier}${visit.exported.name}`
10867
- };
10868
- const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);
10869
- if (!isNamespace(symbol) || visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT || visit.ancestors.includes(symbol)) return own;
10870
- const nested = pipe(walk.checker.getExportsOfModule(symbol), Array.map((member) => indexUnder(walk, {
10871
- exported: member,
10872
- qualifier: `${named.typeName}.`,
10873
- ancestors: [...visit.ancestors, symbol]
10874
- })));
10875
- return mergeIndexes([own, ...nested]);
10876
- };
10877
- const exportAssignmentOf = (moduleSymbol) => Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));
10878
- const indexOfEntry = (checker) => (entry) => {
10879
- const moduleSymbol = Option.fromUndefinedOr(checker.getSymbolOfSourceFile(entry.declarationsPath));
10880
- if (Option.isNone(moduleSymbol)) return EMPTY_INDEX;
10881
- const walk = {
10882
- checker,
10883
- entry
10884
- };
10885
- const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {
10886
- onNone: () => checker.getExportsOfModule(moduleSymbol.value),
10887
- onSome: (assigned) => [resolvedSymbol(checker)(assigned)]
10888
- });
10889
- return mergeIndexes(pipe(roots, Array.map((exported) => indexUnder(walk, {
10890
- exported,
10891
- qualifier: "",
10892
- ancestors: []
10893
- }))));
10894
- };
10895
- const libraryCache = () => {
10896
- const indexes = /* @__PURE__ */ new Map();
10897
- return { indexOf: (entry, compute) => Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {
10898
- onSome: (index) => ({
10899
- index,
10900
- cached: true
10901
- }),
10902
- onNone: () => {
10903
- const index = compute();
10904
- indexes.set(entry.declarationsPath, index);
10905
- return {
10906
- index,
10907
- cached: false
10908
- };
10909
- }
10910
- }) };
10911
- };
10912
- const indexEntry = (cache) => (checker) => (entry) => Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(Effect.tap(({ index, cached }) => Effect.annotateCurrentSpan({
10913
- "msch.library.cached": cached,
10914
- "msch.library.vocabularies": index.vocabularies.length,
10915
- "msch.library.shapes": index.shapes.length
10916
- })), Effect.map(({ index }) => index), Effect.withSpan("indexLibraryEntry", { attributes: { "msch.library.specifier": entry.specifier } }));
10917
- const libraryIndex = (cache) => (checker) => (entries) => pipe(entries, (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }), Effect.map(mergeIndexes), Effect.withSpan("libraryIndex"));
10918
- // src/entities/project/model/telemetry.ts
10919
- const RSS_LINE = /^VmRSS:\s+(?<kib>\d+) kB$/mu;
10920
- const BYTES_PER_KIB = 1024;
10921
- const UNKNOWN_RSS = 0;
10922
- const kibibytesIn = (status) => Option.fromNullishOr(RSS_LINE.exec(status)).pipe(Option.flatMap((match) => Option.fromUndefinedOr(match.groups)), Option.flatMap((groups) => Option.fromUndefinedOr(groups["kib"])));
10923
- const residentBytesOf = (pid) => Effect.gen(function* residentBytes() {
10924
- const status = yield* (yield* RepositoryFiles).readFile(`/proc/${pid}/status`);
10925
- return pipe(status, Option.flatMap(kibibytesIn), Option.flatMap(Number$1.parse), Option.map((kib) => kib * BYTES_PER_KIB), Option.getOrElse(() => UNKNOWN_RSS));
10926
- });
10927
- const childPids = Effect.gen(function* childPids() {
10928
- const files = yield* RepositoryFiles;
10929
- const pid = String(process.pid);
10930
- const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);
10931
- return pipe(children, Option.map((text) => pipe(String$1.trim(text), String$1.split(" "), Array.filter(String$1.isNonEmpty))), Option.getOrElse(() => []));
10932
- });
10933
- const annotateMemory = Effect.gen(function* annotateMemory() {
10934
- const own = yield* residentBytesOf(String(process.pid));
10935
- const pids = yield* childPids;
10936
- const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });
10937
- const { heapUsed } = process.memoryUsage();
10938
- yield* Effect.annotateCurrentSpan({
10939
- "process.memory.rss": own,
10940
- "process.memory.heap_used": heapUsed,
10941
- "msch.compiler.memory.rss": Number$1.sumAll(children)
10942
- });
10943
- });
10944
- const annotateResources = (api) => Effect.gen(function* annotateCompiler() {
10945
- yield* annotateMemory;
10946
- const { totals } = api.getTimingInfo();
10947
- yield* Effect.annotateCurrentSpan({
10948
- "msch.compiler.requests": totals.requestCount,
10949
- "msch.compiler.round_trip_ms": totals.roundTripMs,
10950
- "msch.compiler.server_ms": totals.serverTimeMs
10951
- });
10952
- });
10953
- // src/entities/project/model/project.ts
10954
- const CONFIG_PATHSPEC = `:(glob)**/tsconfig.json`;
10955
- const HIDDEN_PREFIX$1 = ".";
10956
- const SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([
10957
- NODE_MODULES,
10958
- "dist",
10959
- "coverage"
10960
- ]);
10961
- const isVisible = (file) => pipe(String$1.split(file, "/"), Array.every((segment) => !String$1.startsWith(HIDDEN_PREFIX$1)(segment) && !SKIPPED_DIRECTORIES.has(segment)));
10962
- const listConfigFiles = (root) => Effect.gen(function* configFilesUnder() {
10963
- const files = yield* RepositoryFiles;
10964
- const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);
10965
- const visible = pipe(listed, Array.filter(isVisible), Array.map((file) => files.join(root, file)));
10966
- return Array.sort(visible, Order.String);
10967
- });
10968
- const parseConfig = (api) => (configPath) => Option.some(api.parseConfigFile(configPath)).pipe(Option.filter((parsed) => Array.isReadonlyArrayNonEmpty(parsed.fileNames)));
10969
- const nearestPackageDirectory = (directory, root) => Effect.gen(function* nearestPackage() {
10970
- const files = yield* RepositoryFiles;
10971
- const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE$1));
10972
- const parent = files.dirname(directory);
10973
- if (hasManifest || directory === root || parent === directory) return directory;
10974
- return yield* nearestPackageDirectory(parent, root);
10975
- });
10976
- const packageDirectoryOf = (root) => (directory) => nearestPackageDirectory(directory, root);
10977
- const packageInfoOf = Effect.fn("packageInfoOf")(function* packageInfoOf(configPath, root) {
10978
- const files = yield* RepositoryFiles;
10979
- const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);
10980
- const manifest = yield* readManifest(directory);
10981
- return {
10982
- directory,
10983
- name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),
10984
- workspaceDependencies: manifest.pipe(Option.map(workspaceDependencies), Option.getOrElse(() => []))
10985
- };
10986
- });
10987
- const NO_CHECK_PRAGMA = /^\/\/\s*@ts-nocheck/u;
10988
- const FILE_START = 0;
10989
- const skipsTypeChecking = (sourceFile) => pipe(getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [], Array.some((range) => NO_CHECK_PRAGMA.test(String$1.slice(range.pos, range.end)(sourceFile.text))));
10990
- const buildProject = Effect.fn("buildProject")(function* buildProject({ compiler: { api, libraries }, generated }, parsed, info) {
10991
- const entries = yield* dependencyEntries(info.directory);
10992
- const program = yield* Effect.sync(() => api.createProgram([...parsed.fileNames, ...pipe(entries, Array.map((entry) => entry.declarationsPath))], {
10993
- ...parsed.options,
10994
- noEmit: true
10995
- })).pipe(Effect.withSpan("createProgram"));
10996
- const { checker } = program.getProject();
10997
- const library = yield* libraryIndex(libraries)(checker)(entries);
10998
- const projectFiles = new Set(pipe(parsed.fileNames, Array.filter((fileName) => !generated.includes(fileName))));
10999
- return {
11000
- packageName: info.name,
11001
- workspaceDependencies: info.workspaceDependencies,
11002
- program,
11003
- checker,
11004
- sourceFiles: pipe(program.getSourceFileNames(), Array.filter((fileName) => projectFiles.has(fileName)), Array.flatMap((fileName) => Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName)))), Array.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile))),
11005
- library
11006
- };
11007
- });
11008
- const typeScriptCompiler = Effect.acquireRelease(Effect.sync(() => ({
11009
- api: new API({ collectTiming: true }),
11010
- libraries: libraryCache()
11011
- })), ({ api }) => Effect.sync(() => {
11012
- api.close();
11013
- }));
11014
- const loadProject = Effect.fn("loadProject")(function* loadProject(workspace, configPath) {
11015
- const { compiler, root } = workspace;
11016
- const parsed = parseConfig(compiler.api)(configPath);
11017
- if (Option.isNone(parsed)) return Option.none();
11018
- const info = yield* packageInfoOf(configPath, root);
11019
- const project = yield* buildProject(workspace, parsed.value, info);
11020
- yield* Effect.annotateCurrentSpan({
11021
- "msch.project.config": configPath,
11022
- "msch.project.program_files": project.program.getSourceFileNames().length,
11023
- "msch.project.source_files": project.sourceFiles.length
11024
- });
11025
- yield* annotateResources(compiler.api);
11026
- return Option.some(project);
11027
- });
11028
- const releaseProject = (project) => Effect.sync(() => {
11029
- project.program.dispose();
11030
- });
11031
- const withProject = (workspace) => (configPath) => (work) => Effect.acquireUseRelease(loadProject(workspace, configPath), (loaded) => Option.match(loaded, {
11032
- onNone: () => Effect.succeedNone,
11033
- onSome: (project) => work(project).pipe(Effect.asSome)
11034
- }), (loaded) => Option.match(loaded, {
11035
- onNone: () => Effect.void,
11036
- onSome: releaseProject
11037
- }));
11038
- const mentions = (needle) => ({ api }) => (configPath) => Effect.gen(function* mentionsNeedle() {
11039
- const files = yield* RepositoryFiles;
11040
- const fileNames = Option.match(parseConfig(api)(configPath), {
11041
- onNone: () => [],
11042
- onSome: (parsed) => parsed.fileNames
11043
- });
11044
- const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), { concurrency: 1 });
11045
- const includesNeedle = String$1.includes(needle);
11046
- return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
11047
- });
11048
- // src/entities/project/model/inputs.ts
11049
- const SEPARATOR$7 = "/";
11050
- const SCOPE_PREFIX = "@";
11051
- const HIDDEN_PREFIX = ".";
11052
- const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
11053
- const nearestManifestDirectory = Effect.fn("nearestManifestDirectory")(function* nearestManifestDirectory(start) {
11054
- const files = yield* RepositoryFiles;
11055
- let directory = start;
11056
- let parent = files.dirname(directory);
11057
- while (parent !== directory && !(yield* files.exists(files.join(directory, "package.json")))) {
11058
- directory = parent;
11059
- parent = files.dirname(directory);
11060
- }
11061
- return directory;
11062
- });
11063
- const dependenciesOf = Effect.fn("dependenciesOf")(function* dependenciesOf(directory) {
11064
- const files = yield* RepositoryFiles;
11065
- const manifest = yield* readManifest(directory);
11066
- const names = Option.match(manifest, {
11067
- onNone: () => [],
11068
- onSome: workspaceDependencies
11069
- });
11070
- return yield* Effect.forEach(names, (name) => files.realPath(files.join(directory, NODE_MODULES, name)), { concurrency: 1 });
11071
- });
11072
- const workspaceClosure = Effect.fn("workspaceClosure")(function* workspaceClosure(start) {
11073
- const seen = /* @__PURE__ */ new Set([start]);
11074
- const queue = [start];
11075
- for (const directory of queue) {
11076
- const next = yield* dependenciesOf(directory);
11077
- for (const dependency of next) if (!seen.has(dependency)) {
11078
- seen.add(dependency);
11079
- queue.push(dependency);
11080
- }
11081
- }
11082
- return [...seen];
11083
- });
11084
- const isUnder = (prefixes) => (file) => pipe(prefixes, Array.some((prefix) => String$1.startsWith(prefix)(file)));
11085
- const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath) {
11086
- const files = yield* RepositoryFiles;
11087
- const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));
11088
- const directories = yield* workspaceClosure(directory);
11089
- return {
11090
- directories,
11091
- prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$7}`))
11092
- };
11093
- });
11094
- const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
11095
- const files = yield* RepositoryFiles;
11096
- if (!String$1.startsWith(SCOPE_PREFIX)(name)) return [name];
11097
- const scoped = yield* files.readDirectory(files.join(modules, name));
11098
- return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$7}${entry}`));
11099
- });
11100
- const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
11101
- const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
11102
- const nested = yield* pipe(listed, Array.filter((name) => !String$1.startsWith(HIDDEN_PREFIX)(name)), (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }));
11103
- return Array.flatten(nested);
11104
- });
11105
- const installedPackages = Effect.fn("installedPackages")(function* installedPackages(root, directory) {
11106
- const files = yield* RepositoryFiles;
11107
- const modules = files.join(directory, NODE_MODULES);
11108
- const names = yield* installedNames$1(modules);
11109
- return yield* Effect.forEach(names, (name) => files.realPath(files.join(modules, name)).pipe(Effect.map((found) => files.relative(root, found))), { concurrency: 1 });
11110
- });
11111
- const dependencyVersions = Effect.fn("dependencyVersions")(function* dependencyVersions(root, directories) {
11112
- const installed = yield* Effect.forEach(Array.dedupe([root, ...directories]), (directory) => installedPackages(root, directory), { concurrency: 1 });
11113
- return Array.sort(Array.dedupe(Array.flatten(installed)), Order.String);
11114
- });
11115
- const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath) => Effect.gen(function* collectInputs() {
11116
- const files = yield* RepositoryFiles;
11117
- const parsed = parseConfig(compiler.api)(configPath);
11118
- if (Option.isNone(parsed)) return Option.none();
11119
- const closure = yield* closureOf$1(root, configPath);
11120
- const dependencies = yield* dependencyVersions(root, closure.directories);
11121
- const options = yield* encodeOptions(parsed.value.options).pipe(Effect.orElseSucceed(() => ""));
11122
- const sources = pipe(parsed.value.fileNames, Array.map((fileName) => files.relative(root, fileName)));
11123
- const shared = pipe(listed, Array.filter(isUnder(closure.prefixes)));
11124
- return Option.some({
11125
- options,
11126
- files: Array.sort(Array.dedupe([...sources, ...shared]), Order.String),
11127
- dependencies
11128
- });
11129
- });
11130
10710
  // src/features/measure-install-size/model/import-graph.ts
11131
10711
  const RELATIVE = /^\.\.?(?:\/|$)/u;
11132
10712
  const SUBPATH_IMPORT = "#";
11133
10713
  const WILDCARD$1 = "*";
11134
10714
  const SCOPE$2 = "@";
11135
- const SEPARATOR$6 = "/";
10715
+ const SEPARATOR$7 = "/";
11136
10716
  const SOURCE_SUFFIXES = [
11137
10717
  "",
11138
10718
  ".ts",
@@ -11144,9 +10724,9 @@ const PLAIN_SEGMENTS = 1;
11144
10724
  const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
11145
10725
  const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
11146
10726
  const packageNameOf = (specifier) => {
11147
- const segments = String$1.split(specifier, SEPARATOR$6);
11148
- if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$6));
11149
- return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$6));
10727
+ const segments = String$1.split(specifier, SEPARATOR$7);
10728
+ if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$7));
10729
+ return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$7));
11150
10730
  };
11151
10731
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
11152
10732
  const runtimeSpecifierOf = (statement) => {
@@ -11218,7 +10798,7 @@ const packagesFrom = (graph, walk) => Array.match(walk.pending, {
11218
10798
  /** @internal */
11219
10799
  const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(api, directory, entries) {
11220
10800
  const files = yield* RepositoryFiles;
11221
- const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE$1));
10801
+ const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
11222
10802
  const graph = {
11223
10803
  api,
11224
10804
  directory,
@@ -11241,7 +10821,7 @@ const InstalledManifest = Schema.Struct({
11241
10821
  peerDependencies: DependencyMap,
11242
10822
  peerDependenciesMeta: PeerMeta
11243
10823
  });
11244
- const decodeManifest$4 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
10824
+ const decodeManifest$6 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
11245
10825
  const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
11246
10826
  const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
11247
10827
  const installedNames = (manifest) => [
@@ -11251,8 +10831,8 @@ const installedNames = (manifest) => [
11251
10831
  ];
11252
10832
  const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
11253
10833
  const files = yield* RepositoryFiles;
11254
- const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$1));
11255
- return pipe(text, Option.flatMap(decodeManifest$4), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
10834
+ const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
10835
+ return pipe(text, Option.flatMap(decodeManifest$6), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
11256
10836
  });
11257
10837
  const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
11258
10838
  const files = yield* RepositoryFiles;
@@ -11314,11 +10894,11 @@ const LISTED_LARGEST = 5;
11314
10894
  const SIZE_CONCURRENCY = 32;
11315
10895
  const MEGABYTE = 1e6;
11316
10896
  const MEGABYTE_DIGITS = 1;
11317
- const START$12 = 0;
10897
+ const START$15 = 0;
11318
10898
  const SINGLE_ENTRY = 1;
11319
10899
  const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
11320
10900
  const usageHint = (dependency, entryCount) => {
11321
- if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$12 && dependency.entries.length < entryCount)) return "";
10901
+ if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$15 && dependency.entries.length < entryCount)) return "";
11322
10902
  return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
11323
10903
  };
11324
10904
  const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
@@ -11327,7 +10907,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
11327
10907
  const { workspace, total } = overrun;
11328
10908
  const config = yield* files.readFile(workspace.configFile);
11329
10909
  const source = Option.getOrElse(config, () => "");
11330
- const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$12);
10910
+ const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$15);
11331
10911
  return {
11332
10912
  file: workspace.configFile,
11333
10913
  ...positionOf(source)(index),
@@ -11344,7 +10924,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
11344
10924
  const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
11345
10925
  const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
11346
10926
  const sizes = HashMap.fromIterable(measured);
11347
- const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$12))));
10927
+ const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$15))));
11348
10928
  return {
11349
10929
  closures,
11350
10930
  sizeOf,
@@ -11377,11 +10957,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
11377
10957
  })];
11378
10958
  });
11379
10959
  const stackProblems = (file, source, dependencies) => {
11380
- const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$12);
10960
+ const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$15);
11381
10961
  const rest = String$1.slice(section)(source);
11382
10962
  return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
11383
10963
  file,
11384
- ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$12)),
10964
+ ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$15)),
11385
10965
  rule: STACK_DEPENDENCY,
11386
10966
  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.`
11387
10967
  })));
@@ -11413,7 +10993,7 @@ const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
11413
10993
  });
11414
10994
  const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
11415
10995
  const files = yield* RepositoryFiles;
11416
- const file = files.join(workspace.directory, MANIFEST_FILE$1);
10996
+ const file = files.join(workspace.directory, MANIFEST_FILE$3);
11417
10997
  const source = yield* files.readFile(file);
11418
10998
  return yield* Option.match(source, {
11419
10999
  onNone: () => Effect.succeed([]),
@@ -11891,8 +11471,6 @@ const CACHE_DIRECTORY = [
11891
11471
  "value-owners"
11892
11472
  ];
11893
11473
  const CACHE_SUFFIX = ".json";
11894
- const MANIFEST_ENTRY = "package.json";
11895
- const FINGERPRINTED = ["src", "dist"];
11896
11474
  const EMPTY = "";
11897
11475
  const FIELD_SEPARATOR = "\0";
11898
11476
  const LINE_SEPARATOR = "\n";
@@ -11939,25 +11517,11 @@ const fileDigest = (hash) => {
11939
11517
  });
11940
11518
  };
11941
11519
  const digestEntries = (digestFile) => (named) => Effect.forEach(named, ([name, file]) => digestFile(file).pipe(Effect.map((found) => entryOf(name, found))), { concurrency: 1 });
11942
- const fingerprintedFiles = Effect.fn("fingerprintedFiles")(function* fingerprintedFiles(root) {
11943
- const files = yield* RepositoryFiles;
11944
- const nested = yield* Effect.forEach(FINGERPRINTED, (entry) => {
11945
- const base = files.join(root, entry);
11946
- return files.walkDirectory(base).pipe(Effect.map(Array.map((file) => files.join(base, file))));
11947
- }, { concurrency: 1 });
11948
- return Array.sort([files.join(root, MANIFEST_ENTRY), ...Array.flatten(nested)], String$1.Order);
11949
- });
11950
- const fingerprintOf = Effect.fn("fingerprintOf")(function* fingerprintOf(hash) {
11951
- const root = yield* nearestManifestDirectory(import.meta.dirname);
11952
- const listed = yield* fingerprintedFiles(root);
11953
- const entries = yield* digestEntries(fileDigest(hash))(pipe(listed, Array.map((file) => [file, file])));
11954
- return yield* hash(Array.join(entries, LINE_SEPARATOR));
11955
- });
11956
11520
  const analysisCache = Effect.fn("analysisCache")(function* analysisCache(root, owners) {
11957
11521
  const files = yield* RepositoryFiles;
11958
11522
  const hash = yield* hasher;
11959
- const fingerprint = yield* fingerprintOf(hash);
11960
- const salt = yield* hash(Array.join([fingerprint, owners], FIELD_SEPARATOR));
11523
+ const fingerprint = yield* implementationFingerprint(import.meta.dirname);
11524
+ const salt = yield* hash(Array.join([fingerprint, String$1.replaceAll(root, EMPTY)(owners)], FIELD_SEPARATOR));
11961
11525
  return {
11962
11526
  root,
11963
11527
  directory: files.join(root, ...CACHE_DIRECTORY),
@@ -11972,7 +11536,7 @@ const keyOf = (cache) => (configPath, inputs) => Effect.gen(function* deriveKey(
11972
11536
  const header = [
11973
11537
  cache.salt,
11974
11538
  files.relative(cache.root, configPath),
11975
- inputs.options
11539
+ String$1.replaceAll(cache.root, EMPTY)(inputs.options)
11976
11540
  ];
11977
11541
  return yield* cache.hash(Array.join([
11978
11542
  ...header,
@@ -11980,17 +11544,35 @@ const keyOf = (cache) => (configPath, inputs) => Effect.gen(function* deriveKey(
11980
11544
  ...entries
11981
11545
  ], LINE_SEPARATOR));
11982
11546
  });
11547
+ const moved = (move) => (analysis) => ({
11548
+ problems: pipe(analysis.problems, Array.map((problem) => ({
11549
+ ...problem,
11550
+ file: move(problem.file)
11551
+ }))),
11552
+ unowned: pipe(analysis.unowned, Array.map((site) => ({
11553
+ ...site,
11554
+ file: move(site.file)
11555
+ }))),
11556
+ literals: pipe(analysis.literals, Array.map((found) => ({
11557
+ ...found,
11558
+ file: move(found.file),
11559
+ imports: pipe(found.imports, Array.map(move))
11560
+ })))
11561
+ });
11983
11562
  const entryFile = (cache, key) => `${cache.directory}/${key}${CACHE_SUFFIX}`;
11984
11563
  const readAnalysis = (cache) => (key) => Effect.gen(function* readCached() {
11985
- const text = yield* (yield* RepositoryFiles).readFile(entryFile(cache, key));
11564
+ const files = yield* RepositoryFiles;
11565
+ const text = yield* files.readFile(entryFile(cache, key));
11566
+ const restored = moved((file) => files.resolve(cache.root, file));
11986
11567
  return yield* Option.match(text, {
11987
11568
  onNone: () => Effect.succeedNone,
11988
11569
  onSome: (found) => Schema.decodeEffect(AnalysisJson)(found).pipe(Effect.option)
11989
- });
11570
+ }).pipe(Effect.map(Option.map(restored)));
11990
11571
  });
11991
11572
  const writeAnalysis = (cache) => (key, analysis) => Effect.gen(function* writeCached() {
11992
11573
  const files = yield* RepositoryFiles;
11993
- const text = yield* Schema.encodeEffect(AnalysisJson)(analysis).pipe(Effect.option);
11574
+ const portable = moved((file) => files.relative(cache.root, file))(analysis);
11575
+ const text = yield* Schema.encodeEffect(AnalysisJson)(portable).pipe(Effect.option);
11994
11576
  yield* Option.match(text, {
11995
11577
  onNone: () => Effect.void,
11996
11578
  onSome: (found) => files.writeFile(entryFile(cache, key), found)
@@ -12035,7 +11617,7 @@ const duplicateProblems = (relative) => (sites) => {
12035
11617
  }))));
12036
11618
  };
12037
11619
  // src/features/check-value-owners/model/name-lists.ts
12038
- const RULE$22 = "hand-written-names";
11620
+ const RULE$24 = "hand-written-names";
12039
11621
  const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
12040
11622
  const nameListOf = (site) => {
12041
11623
  if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
@@ -12046,11 +11628,11 @@ const nameListOf = (site) => {
12046
11628
  }, (list) => list.names.length === site.values.length);
12047
11629
  };
12048
11630
  const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
12049
- const problemOf$7 = ({ list, reason }) => ({
11631
+ const problemOf$6 = ({ list, reason }) => ({
12050
11632
  file: list.site.file,
12051
11633
  line: list.site.line,
12052
11634
  column: list.site.column,
12053
- rule: RULE$22,
11635
+ rule: RULE$24,
12054
11636
  message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
12055
11637
  });
12056
11638
  // src/features/check-value-owners/model/declared-names.ts
@@ -12081,7 +11663,7 @@ const declaredNameProblem = ({ literals, relative }) => {
12081
11663
  if (defined.length < mostNamesOf(list) || files.length < 2) return Option.none();
12082
11664
  const names = pipe(defined, Array.map(([name]) => name));
12083
11665
  const shown = pipe(files, Array.take(SHOWN_FILES), Array.map(relative), Array.join(", "));
12084
- return Option.some(problemOf$7({
11666
+ return Option.some(problemOf$6({
12085
11667
  list,
12086
11668
  reason: `${formatValues(names)} are each written in another module (${shown}). Type those values with this list, or build this list from them, so that adding one does not mean editing two places.`
12087
11669
  }));
@@ -12091,7 +11673,7 @@ const declaredNameProblem = ({ literals, relative }) => {
12091
11673
  const PATH_PREFIX = /^(?:!|\.\/)+/u;
12092
11674
  const GLOB = /[*?{[]/u;
12093
11675
  const EXTENSION$1 = /\.[^./]+$/u;
12094
- const SEPARATOR$5 = "/";
11676
+ const SEPARATOR$6 = "/";
12095
11677
  const ROOT = ".";
12096
11678
  const namedPath = (repository, file) => (name) => {
12097
11679
  const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
@@ -12100,12 +11682,12 @@ const namedPath = (repository, file) => (name) => {
12100
11682
  return pipe([fromFile, bare], Array.findFirst((path) => HashSet.has(repository.paths, path)));
12101
11683
  };
12102
11684
  const kindOf = (repository) => (path) => {
12103
- if (HashSet.has(repository.directories, path)) return SEPARATOR$5;
11685
+ if (HashSet.has(repository.directories, path)) return SEPARATOR$6;
12104
11686
  return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array.head), Option.getOrElse(() => path));
12105
11687
  };
12106
11688
  const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
12107
11689
  const coversDirectory = (repository) => (group) => pipe(Array.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
12108
- const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$5}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
11690
+ 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));
12109
11691
  const directoryLabel = (directory) => {
12110
11692
  if (directory === ROOT) return "the repository root";
12111
11693
  return directory;
@@ -12114,11 +11696,11 @@ const listedPathProblem = (repository) => (list) => {
12114
11696
  const paths = pipe(list.names, Array.map(namedPath(repository, list.site.file)), Array.getSomes);
12115
11697
  const packages = pipe(list.names, Array.filter((name) => HashSet.has(repository.packages, name)));
12116
11698
  const directory = enumeratedDirectory(repository)(paths);
12117
- if (Option.isSome(directory)) return Option.some(problemOf$7({
11699
+ if (Option.isSome(directory)) return Option.some(problemOf$6({
12118
11700
  list,
12119
11701
  reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`
12120
11702
  }));
12121
- if (packages.length >= 2) return Option.some(problemOf$7({
11703
+ if (packages.length >= 2) return Option.some(problemOf$6({
12122
11704
  list,
12123
11705
  reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`
12124
11706
  }));
@@ -12133,7 +11715,7 @@ const connected = (index) => (left, right) => left === right || imports(index)(l
12133
11715
  const isPartOf = (index, list) => (other) => other !== list && canImport(list.site.scope, other.site.scope) && connected(index)(list.site.file, other.site.file) && isSubsetOf(list.names, other.names) && list.names.length * SUBSET_SHARE >= other.names.length && !sameValues(list.names, other.names);
12134
11716
  const subsetListProblem = ({ lists, literals, relative }) => {
12135
11717
  const index = importIndexOf(literals);
12136
- return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$7({
11718
+ return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$6({
12137
11719
  list,
12138
11720
  reason: `they are a part of ${formatValues(other.names)} at ${relative(other.site.file)}:${String(other.site.line)}. Name that list once and select from it with Extract or Exclude.`
12139
11721
  })));
@@ -12156,16 +11738,16 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
12156
11738
  };
12157
11739
  // src/features/check-value-owners/model/repository-names.ts
12158
11740
  const MANIFEST$2 = "package.json";
12159
- const SEPARATOR$4 = "/";
11741
+ const SEPARATOR$5 = "/";
12160
11742
  const FIRST_SEGMENT = 1;
12161
11743
  const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
12162
- const decodeManifest$3 = Schema.decodeUnknownOption(ManifestJson);
11744
+ const decodeManifest$5 = Schema.decodeUnknownOption(ManifestJson);
12163
11745
  const prefixesOf = (file) => {
12164
- const segments = pipe(file, String$1.split(SEPARATOR$4));
12165
- return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$4))));
11746
+ const segments = pipe(file, String$1.split(SEPARATOR$5));
11747
+ return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
12166
11748
  };
12167
11749
  const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
12168
- const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$3), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
11750
+ const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$5), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
12169
11751
  const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
12170
11752
  const files = yield* RepositoryFiles;
12171
11753
  const listed = yield* files.listedFiles(root);
@@ -12184,7 +11766,7 @@ const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNam
12184
11766
  });
12185
11767
  // src/features/check-value-owners/model/check.ts
12186
11768
  const scanOwners = Effect.fn("scanOwners")(function* scanOwners(workspace, configPaths) {
12187
- const ownerConfigs = yield* pipe(configPaths, Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)));
11769
+ const ownerConfigs = yield* pipe(configPaths, Effect.filter(mentions$1(`@${OWNER_TAG}`)(workspace.compiler)));
12188
11770
  const scans = yield* Effect.forEach(ownerConfigs, (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))), { concurrency: 1 });
12189
11771
  return combineOwnerScans(Array.getSomes(scans));
12190
11772
  });
@@ -12277,7 +11859,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
12277
11859
  return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
12278
11860
  }, Effect.scoped);
12279
11861
  // src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
12280
- const RULE$21 = "namespace-destructuring";
11862
+ const RULE$23 = "namespace-destructuring";
12281
11863
  const LOCAL = /^[.#/]/u;
12282
11864
  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.`;
12283
11865
  const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
@@ -12292,16 +11874,16 @@ const destructuredName = (declaration) => {
12292
11874
  if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
12293
11875
  return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
12294
11876
  };
12295
- const problemOf$6 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
12296
- rule: RULE$21,
11877
+ const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
11878
+ rule: RULE$23,
12297
11879
  message: messageOf$1(name)
12298
11880
  })), Option.map((report) => report(declaration)));
12299
11881
  const namespaceDestructuringIn = () => (sourceFile) => {
12300
11882
  const names = importedNames(sourceFile);
12301
- return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$6(names)), Array.getSomes);
11883
+ return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
12302
11884
  };
12303
11885
  // src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
12304
- const RULE$20 = "pass-through-wrapper";
11886
+ const RULE$22 = "pass-through-wrapper";
12305
11887
  const SINGLE_STATEMENT = 1;
12306
11888
  const SINGLE_DECLARATION = 1;
12307
11889
  const THIS_PARAMETER = "this";
@@ -12395,29 +11977,29 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
12395
11977
  const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
12396
11978
  return Option.exists(forwardedNames(wrapper, forward), (names) => callsAnotherFunction(candidate, forward, names)) && (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) && keepsTheReturnType(checker)(wrapper, forward) && !isOverloaded(checker)(name);
12397
11979
  };
12398
- const problemOf$5 = (checker) => (candidate) => {
11980
+ const problemOf$4 = (checker) => (candidate) => {
12399
11981
  if (changesTheCall(candidate.wrapper)) return Option.none();
12400
11982
  return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$9({
12401
- rule: RULE$20,
11983
+ rule: RULE$22,
12402
11984
  message: messageOf(forward.callee.getText())
12403
11985
  })(candidate.name)));
12404
11986
  };
12405
- const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$5(checker)), Array.getSomes);
11987
+ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$4(checker)), Array.getSomes);
12406
11988
  // src/app/source-checks.ts
12407
11989
  /** @internal */
12408
11990
  const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
12409
11991
  // src/features/check-agent-settings/model/missing-hooks.ts
12410
- const RULE$19 = "missing-hook";
11992
+ const RULE$21 = "missing-hook";
12411
11993
  const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
12412
11994
  const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
12413
11995
  const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
12414
11996
  const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
12415
11997
  const PLUGIN_ROOT = "..";
12416
- const READ_CONCURRENCY$9 = 16;
12417
- const START$11 = 0;
11998
+ const READ_CONCURRENCY$10 = 16;
11999
+ const START$14 = 0;
12418
12000
  const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
12419
12001
  path,
12420
- index: found.index ?? START$11
12002
+ index: found.index ?? START$14
12421
12003
  })), Option.toArray);
12422
12004
  const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
12423
12005
  const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
@@ -12432,7 +12014,7 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
12432
12014
  return pipe(missing, Array.map(({ path, index }) => ({
12433
12015
  file,
12434
12016
  ...positionOf(source)(index),
12435
- rule: RULE$19,
12017
+ rule: RULE$21,
12436
12018
  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.`
12437
12019
  })));
12438
12020
  });
@@ -12456,59 +12038,71 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
12456
12038
  }];
12457
12039
  return [];
12458
12040
  }));
12459
- const found = yield* Effect.forEach(hookFiles, problemsIn$8, { concurrency: READ_CONCURRENCY$9 });
12041
+ const found = yield* Effect.forEach(hookFiles, problemsIn$8, { concurrency: READ_CONCURRENCY$10 });
12460
12042
  return Array.flatten(found);
12461
12043
  });
12462
- // src/features/check-markdown/model/markdown.ts
12463
- const taggedError$4 = Schema.TaggedError;
12464
- var MarkdownConfigUnreadable = class extends taggedError$4()("MarkdownConfigUnreadable", { file: Schema.String }) {};
12044
+ // src/shared/lib/section-check.ts
12045
+ const taggedError$3 = Schema.TaggedError;
12046
+ var SectionConfigUnreadable = class extends taggedError$3()("SectionConfigUnreadable", { file: Schema.String }) {};
12465
12047
  const CONFIG_FILE$2 = "vite.config.ts";
12466
- const RULE$18 = "markdown";
12467
- const FIRST$5 = 1;
12468
- const sectionAt = Effect.fn("markdownSection")(function* sectionAt(file) {
12048
+ const FIRST$7 = 1;
12049
+ const sectionAt = (file, pick) => Effect.gen(function* readSection() {
12469
12050
  if (!(yield* (yield* RepositoryFiles).exists(file))) return Option.none();
12470
12051
  const config = yield* Effect.tryPromise({
12471
12052
  try: () => resolveConfigFromFile(file),
12472
- catch: () => MarkdownConfigUnreadable.make({ file })
12053
+ catch: () => SectionConfigUnreadable.make({ file })
12473
12054
  }).pipe(Effect.option);
12474
- return pipe(config, Option.map(y8Section));
12475
- });
12476
- const problemOf$4 = (root, join) => (diagnostic) => ({
12477
- file: join(root, diagnostic.path),
12478
- line: diagnostic.line,
12479
- column: diagnostic.column ?? FIRST$5,
12480
- rule: RULE$18,
12481
- message: `${diagnostic.rule} ${diagnostic.message}${diagnosticDetail(diagnostic)}`
12055
+ return pipe(config, Option.map(pick));
12482
12056
  });
12483
- const failureAt = (file, message) => [{
12057
+ const failureAt = (file, rule, message) => [{
12484
12058
  file,
12485
- line: FIRST$5,
12486
- column: FIRST$5,
12487
- rule: RULE$18,
12059
+ line: FIRST$7,
12060
+ column: FIRST$7,
12061
+ rule,
12488
12062
  message
12489
12063
  }];
12490
- const checkMarkdown = Effect.fn("checkMarkdown")(function* checkMarkdown(root) {
12064
+ const checkSection = (check) => (root) => Effect.gen(function* runSection() {
12491
12065
  const files = yield* RepositoryFiles;
12492
12066
  const configFile = files.join(root, CONFIG_FILE$2);
12493
- const section = yield* sectionAt(configFile);
12067
+ const section = yield* sectionAt(configFile, check.pick);
12494
12068
  if (Option.isNone(section)) return [];
12495
12069
  const config = section.value;
12496
- const listed = yield* files.matchingFiles(root, markdownPathspecs({ config }));
12497
- return yield* lint({
12070
+ const [listed, projectFiles] = yield* Effect.all([files.matchingFiles(root, check.pathspecs(config)), files.listedFiles(root)], { concurrency: "unbounded" });
12071
+ const linted = yield* Effect.result(check.lint({
12498
12072
  root,
12499
12073
  files: listed,
12074
+ projectFiles,
12500
12075
  config
12501
- }).pipe(Effect.map((diagnostics) => pipe(diagnostics, Array.filter(({ severity }) => severity === "error"), Array.map(problemOf$4(root, files.join)))), Effect.catchTag("Y8Error", (failure) => Effect.succeed(failureAt(configFile, failure.message))));
12076
+ }));
12077
+ return Result.match(linted, {
12078
+ onFailure: (failure) => failureAt(configFile, check.rule, failure.message),
12079
+ onSuccess: (found) => pipe(found, Array.filter(({ severity }) => severity === "error"), Array.map((diagnostic) => ({
12080
+ file: files.join(root, diagnostic.path),
12081
+ line: diagnostic.line,
12082
+ column: diagnostic.column ?? FIRST$7,
12083
+ rule: check.rule,
12084
+ message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`
12085
+ })))
12086
+ });
12087
+ }).pipe(Effect.withSpan(check.name));
12088
+ // src/features/check-markdown/model/markdown.ts
12089
+ const checkMarkdown = checkSection({
12090
+ name: "checkMarkdown",
12091
+ rule: "markdown",
12092
+ pick: y8Section,
12093
+ pathspecs: (config) => markdownPathspecs({ config }),
12094
+ lint,
12095
+ detail: diagnosticDetail
12502
12096
  });
12503
12097
  // src/features/check-scripts/model/shell-scripts.ts
12504
12098
  const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
12505
12099
  const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
12506
12100
  const EXTENSION = /\.[^./]+$/u;
12507
12101
  const SETTINGS_FILE = ".claude/settings.json";
12508
- const READ_CONCURRENCY$8 = 64;
12509
- const FIRST$4 = 1;
12510
- const RULE$17 = "shell-script";
12511
- const MESSAGE$7 = "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.";
12102
+ const READ_CONCURRENCY$9 = 64;
12103
+ const FIRST$6 = 1;
12104
+ const RULE$20 = "shell-script";
12105
+ const MESSAGE$9 = "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.";
12512
12106
  const HookSchema = Schema.Struct({
12513
12107
  command: Schema.optional(Schema.String),
12514
12108
  args: Schema.optional(Schema.Array(Schema.String))
@@ -12528,15 +12122,15 @@ const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.ge
12528
12122
  const hasExtension = (name) => EXTENSION.test(baseName(name));
12529
12123
  const problemFor$1 = (file) => ({
12530
12124
  file,
12531
- line: FIRST$4,
12532
- column: FIRST$4,
12533
- rule: RULE$17,
12534
- message: MESSAGE$7
12125
+ line: FIRST$6,
12126
+ column: FIRST$6,
12127
+ rule: RULE$20,
12128
+ message: MESSAGE$9
12535
12129
  });
12536
12130
  /** @internal */
12537
12131
  const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
12538
12132
  const files = yield* RepositoryFiles;
12539
- const names = yield* files.listedFiles(root);
12133
+ const names = yield* files.ownedFiles(root);
12540
12134
  const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));
12541
12135
  const commands = pipe(settings, Option.map(sessionStartCommands), Option.getOrElse(() => NO_TEXT));
12542
12136
  const isSessionStartHook = (name) => pipe(commands, Array.some(String$1.includes(name)));
@@ -12547,12 +12141,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
12547
12141
  return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
12548
12142
  };
12549
12143
  const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
12550
- const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$8 });
12144
+ const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$9 });
12551
12145
  return pipe(shell, Array.map((name) => problemFor$1(files.join(root, name))));
12552
12146
  });
12553
12147
  // src/shared/lib/workflow-files.ts
12554
12148
  const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
12555
- const READ_CONCURRENCY$7 = 16;
12149
+ const READ_CONCURRENCY$8 = 16;
12556
12150
  const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
12557
12151
  const files = yield* RepositoryFiles;
12558
12152
  const names = yield* files.listedFiles(root);
@@ -12562,13 +12156,13 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
12562
12156
  file,
12563
12157
  source
12564
12158
  }))));
12565
- }, { concurrency: READ_CONCURRENCY$7 });
12159
+ }, { concurrency: READ_CONCURRENCY$8 });
12566
12160
  return Array.getSomes(found);
12567
12161
  });
12568
12162
  // src/shared/lib/workflow-run.ts
12569
12163
  const RUN_KEY = "run";
12570
- const START$10 = 0;
12571
- const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$10));
12164
+ const START$13 = 0;
12165
+ const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$13));
12572
12166
  const runScriptsOf = (source) => {
12573
12167
  const found = [];
12574
12168
  visit(parseDocument(source), { Pair: (_key, pair) => {
@@ -12583,9 +12177,9 @@ const runScriptsOf = (source) => {
12583
12177
  const COMMAND_CHAIN = /&&|\|\||;|\|/u;
12584
12178
  const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
12585
12179
  const COMMENT = "#";
12586
- const RULE$16 = "workflow-script";
12180
+ const RULE$19 = "workflow-script";
12587
12181
  const ONE_COMMAND = 1;
12588
- const MESSAGE$6 = "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.";
12182
+ const MESSAGE$8 = "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.";
12589
12183
  const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
12590
12184
  const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
12591
12185
  const runsMoreThanOneCommand = ({ text }) => {
@@ -12597,8 +12191,8 @@ const problemsIn$7 = (file) => (source) => {
12597
12191
  return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
12598
12192
  file,
12599
12193
  ...at(start),
12600
- rule: RULE$16,
12601
- message: MESSAGE$6
12194
+ rule: RULE$19,
12195
+ message: MESSAGE$8
12602
12196
  })));
12603
12197
  };
12604
12198
  /** @internal */
@@ -12612,15 +12206,24 @@ const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
12612
12206
  const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], { concurrency: "unbounded" });
12613
12207
  return Array.flatten(found);
12614
12208
  });
12209
+ // src/features/check-structure/model/structure.ts
12210
+ const checkStructure = checkSection({
12211
+ name: "checkStructure",
12212
+ rule: "structure",
12213
+ pick: wismSection,
12214
+ pathspecs: (config) => wismPathspecs({ config }),
12215
+ lint: lint$1,
12216
+ detail: () => ""
12217
+ });
12615
12218
  // src/features/check-vite-plus/model/command-words.ts
12616
12219
  const CONTINUATION = /\\\n/gu;
12617
12220
  const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
12618
- const SEPARATOR$3 = /&&|\|\||[;|\n`]|\$\(/u;
12221
+ const SEPARATOR$4 = /&&|\|\||[;|\n`]|\$\(/u;
12619
12222
  const BLANK$1 = /\s+/u;
12620
12223
  const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
12621
12224
  const QUOTE = "\"\"";
12622
12225
  const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
12623
- 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));
12226
+ 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));
12624
12227
  // src/features/check-vite-plus/model/command-problems.ts
12625
12228
  const PACKAGE_MANAGERS = [
12626
12229
  "pnpm",
@@ -12698,28 +12301,28 @@ const docSources = (file) => (source) => {
12698
12301
  })));
12699
12302
  };
12700
12303
  // src/features/check-vite-plus/model/command-sources.ts
12701
- const ROOT_DIRECTORY = ".";
12304
+ const ROOT_DIRECTORY$1 = ".";
12702
12305
  const COMMAND_KEY = "command";
12703
12306
  const ARGUMENTS_KEY = "args";
12704
- const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
12705
- const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED$2];
12307
+ const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
12308
+ const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$3];
12706
12309
  const STEP_FILES = [
12707
12310
  ":(glob).github/workflows/*.yml",
12708
12311
  ":(glob).github/workflows/*.yaml",
12709
12312
  ":(glob)**/action.yml",
12710
12313
  ":(glob)**/action.yaml",
12711
- ...EXCLUDED$2
12314
+ ...EXCLUDED$3
12712
12315
  ];
12713
12316
  const HOOK_FILES = [":(glob).vite-hooks/*"];
12714
12317
  const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
12715
12318
  const AGENT_DOCS = [
12716
12319
  ":(glob)**/AGENTS.md",
12717
12320
  ":(glob)**/CLAUDE.md",
12718
- ...EXCLUDED$2
12321
+ ...EXCLUDED$3
12719
12322
  ];
12720
- const READ_CONCURRENCY$6 = 16;
12721
- const START$9 = 0;
12722
- const FIRST$3 = 1;
12323
+ const READ_CONCURRENCY$7 = 16;
12324
+ const START$12 = 0;
12325
+ const FIRST$5 = 1;
12723
12326
  const LINE = "\n";
12724
12327
  const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
12725
12328
  const decodeCommandText = Schema.decodeUnknownOption(CommandText);
@@ -12728,7 +12331,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
12728
12331
  const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
12729
12332
  const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
12730
12333
  const NO_SOURCES = [];
12731
- const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$9));
12334
+ const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$12));
12732
12335
  const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
12733
12336
  const offset = offsetOf$2(source, `"${name}"`);
12734
12337
  return {
@@ -12750,8 +12353,8 @@ const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE
12750
12353
  kind: "hook",
12751
12354
  file,
12752
12355
  position: {
12753
- line: index + FIRST$3,
12754
- column: FIRST$3
12356
+ line: index + FIRST$5,
12357
+ column: FIRST$5
12755
12358
  },
12756
12359
  name,
12757
12360
  text
@@ -12788,7 +12391,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
12788
12391
  return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
12789
12392
  });
12790
12393
  const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
12791
- const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$6 });
12394
+ const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$7 });
12792
12395
  return Array.flatten(found);
12793
12396
  });
12794
12397
  const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
@@ -12800,7 +12403,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
12800
12403
  onSome: sourcesOf(file, name)
12801
12404
  });
12802
12405
  return files.readFile(file).pipe(Effect.map(sourcesIn));
12803
- }, { concurrency: READ_CONCURRENCY$6 });
12406
+ }, { concurrency: READ_CONCURRENCY$7 });
12804
12407
  return Array.flatten(found);
12805
12408
  });
12806
12409
  /** @internal */
@@ -12819,12 +12422,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
12819
12422
  readSources(root, hooks, hookSources),
12820
12423
  readSources(root, AGENT_FILES, agentSources),
12821
12424
  readSources(root, docs, docSources),
12822
- workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY, ...workspaces]))
12425
+ workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$1, ...workspaces]))
12823
12426
  ], { concurrency: "unbounded" });
12824
12427
  return Array.flatten(found);
12825
12428
  });
12826
12429
  // src/features/check-vite-plus/model/package-scripts.ts
12827
- const RULE$15 = "package-script";
12430
+ const RULE$18 = "package-script";
12828
12431
  const LIFECYCLE = [
12829
12432
  "preinstall",
12830
12433
  "install",
@@ -12847,26 +12450,26 @@ const LIFECYCLE = [
12847
12450
  const problemOf$3 = ({ file, position, name }) => ({
12848
12451
  file,
12849
12452
  ...position,
12850
- rule: RULE$15,
12453
+ rule: RULE$18,
12851
12454
  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.`
12852
12455
  });
12853
12456
  const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
12854
12457
  // src/features/check-vite-plus/model/vite-plus-block.ts
12855
- const RULE$14 = "vite-plus-block";
12458
+ const RULE$17 = "vite-plus-block";
12856
12459
  const MARKER = Array.join([
12857
12460
  "<!--",
12858
12461
  "VITE PLUS START",
12859
12462
  "-->"
12860
12463
  ], "");
12861
- const MESSAGE$5 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
12464
+ const MESSAGE$7 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
12862
12465
  const problemIn = (file) => (source) => {
12863
12466
  const index = String$1.indexOf(MARKER)(source);
12864
12467
  if (Option.isNone(index)) return Option.none();
12865
12468
  return Option.some({
12866
12469
  file,
12867
12470
  ...positionOf(source)(index.value),
12868
- rule: RULE$14,
12869
- message: MESSAGE$5
12471
+ rule: RULE$17,
12472
+ message: MESSAGE$7
12870
12473
  });
12871
12474
  };
12872
12475
  /** @internal */
@@ -12907,66 +12510,108 @@ const workflowCheck = ({ rule, message, offsetsOf }) => Effect.fn(rule)(function
12907
12510
  }));
12908
12511
  }));
12909
12512
  });
12513
+ const scalarKeyOffsets = ({ name, matches }) => (source) => pipe(pairsNamed(name)(source), Array.filter(({ value }) => isScalar(value) && matches(String(value.value))), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)), Option.map(([start]) => start), Option.toArray)));
12910
12514
  // src/features/check-workflows/model/full-history-checkout.ts
12911
12515
  const DEPTH_KEY = "fetch-depth";
12912
12516
  const WHOLE_HISTORY = "0";
12913
- const RULE$13 = "full-history-checkout";
12914
- const MESSAGE$4 = "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.";
12915
- const fullHistoryOffsetsOf = (source) => pipe(pairsNamed(DEPTH_KEY)(source), Array.filter(({ value }) => isScalar(value) && String(value.value) === WHOLE_HISTORY), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)), Option.map(([start]) => start), Option.toArray)));
12916
12517
  /** @internal */
12917
12518
  const checkFullHistoryCheckout = workflowCheck({
12918
- rule: RULE$13,
12919
- message: MESSAGE$4,
12920
- offsetsOf: fullHistoryOffsetsOf
12519
+ rule: "full-history-checkout",
12520
+ message: "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.",
12521
+ offsetsOf: scalarKeyOffsets({
12522
+ name: DEPTH_KEY,
12523
+ matches: (value) => value === WHOLE_HISTORY
12524
+ })
12921
12525
  });
12922
- // src/features/check-workflows/model/release-pr-auto-merge.ts
12923
- const RULE$12 = "release-pr-auto-merge";
12924
- const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
12925
- const AUTO_MERGE = /\bgh\s+pr\s+merge\b[^\n]*--auto\b/u;
12926
- const MESSAGE$3 = "opens a release PR with release-please but no later step in the job turns on its auto-merge. The merge queue only moves PRs with auto-merge, so the release PR falls behind main and waits for someone. Add a step after it that runs `gh pr merge --auto --squash` on the PR from the action's `pr` output with the token that opened it.";
12927
- const textOf = (node, name) => pipe(pairIn(name)(node), Option.flatMap(({ value }) => Option.liftPredicate(value, isScalar)), Option.map((scalar) => String(scalar.value)), Option.getOrElse(() => ""));
12928
- const stepOf = (node) => {
12929
- const inputs = Option.getOrUndefined(Option.map(pairIn("with")(node), ({ value }) => value));
12930
- return {
12931
- opensReleasePr: RELEASE_PLEASE.test(textOf(node, "uses")) && textOf(inputs, "skip-github-pull-request") !== "true",
12932
- turnsOnAutoMerge: AUTO_MERGE.test(textOf(node, "run")),
12933
- offset: keyOffsetIn("uses")(node)
12934
- };
12526
+ // src/features/check-workflows/model/publish-trigger.ts
12527
+ const RULE$15 = "publish-trigger";
12528
+ const PUBLISH = /\bmsch-publish\b/u;
12529
+ const MANUAL = "workflow_dispatch";
12530
+ const TRIGGER_KEY = "on";
12531
+ const MESSAGE$5 = "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.";
12532
+ const triggersOf = (node) => {
12533
+ if (isScalar(node)) return [String(node.value)];
12534
+ if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
12535
+ if (isMap(node)) return pipe(node.items, Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.map((scalar) => String(scalar.value)), Option.toArray)));
12536
+ return [];
12537
+ };
12538
+ const publishTriggerOffsetsOf = (source) => {
12539
+ if (!pipe(runScriptsOf(source), Array.some(({ text }) => PUBLISH.test(text)))) return [];
12540
+ const { contents } = parseDocument(source);
12541
+ const triggers = pipe(pairIn(TRIGGER_KEY)(contents), Option.map(({ value }) => triggersOf(value)), Option.getOrElse(() => []));
12542
+ if (pipe(triggers, Array.every((trigger) => trigger === MANUAL))) return [];
12543
+ return Option.toArray(keyOffsetIn(TRIGGER_KEY)(contents));
12935
12544
  };
12936
- const stepsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map((seq) => pipe(seq.items, Array.map(stepOf))), Option.getOrElse(() => []));
12937
- const unqueuedOffsetsOf = (steps) => pipe(steps, Array.flatMap((step, index) => pipe(step.offset, Option.filter(() => step.opensReleasePr && !Array.some(Array.drop(steps, index), (later) => later.turnsOnAutoMerge)), Option.toArray)));
12938
- const releasePrOffsetsOf = (source) => pipe(pairsNamed("steps")(source), Array.flatMap(({ value }) => unqueuedOffsetsOf(stepsOf(value))));
12939
12545
  /** @internal */
12940
- const checkReleasePrAutoMerge = workflowCheck({
12941
- rule: RULE$12,
12942
- message: MESSAGE$3,
12943
- offsetsOf: releasePrOffsetsOf
12546
+ const checkPublishTrigger = workflowCheck({
12547
+ rule: RULE$15,
12548
+ message: MESSAGE$5,
12549
+ offsetsOf: publishTriggerOffsetsOf
12550
+ });
12551
+ // src/features/check-workflows/model/release-please.ts
12552
+ const RULE$14 = "release-please";
12553
+ const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
12554
+ const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
12555
+ const FIRST$4 = 1;
12556
+ const MESSAGE$4 = "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.";
12557
+ const checkReleasePleaseSteps = workflowCheck({
12558
+ rule: RULE$14,
12559
+ message: MESSAGE$4,
12560
+ offsetsOf: scalarKeyOffsets({
12561
+ name: "uses",
12562
+ matches: (value) => RELEASE_PLEASE.test(value)
12563
+ })
12564
+ });
12565
+ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* checkReleasePleaseFiles(root) {
12566
+ const files = yield* RepositoryFiles;
12567
+ const names = yield* files.listedFiles(root);
12568
+ return pipe(names, Array.filter((name) => RELEASE_PLEASE_FILE.test(name)), Array.map((name) => ({
12569
+ file: files.join(root, name),
12570
+ line: FIRST$4,
12571
+ column: FIRST$4,
12572
+ rule: RULE$14,
12573
+ message: MESSAGE$4
12574
+ })));
12575
+ });
12576
+ /** @internal */
12577
+ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleasePlease(root) {
12578
+ const found = yield* Effect.all([checkReleasePleaseSteps(root), checkReleasePleaseFiles(root)], { concurrency: "unbounded" });
12579
+ return Array.flatten(found);
12944
12580
  });
12945
12581
  // src/features/check-workflows/model/workflow-queue.ts
12946
12582
  const CONCURRENCY_KEY = "concurrency";
12947
12583
  const QUEUE_KEY = "queue";
12948
- const RULE$11 = "workflow-queue";
12949
- const MESSAGE$2 = "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.";
12584
+ const RULE$13 = "workflow-queue";
12585
+ const MESSAGE$3 = "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.";
12950
12586
  const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
12951
12587
  /** @internal */
12952
12588
  const checkWorkflowQueues = workflowCheck({
12953
- rule: RULE$11,
12954
- message: MESSAGE$2,
12589
+ rule: RULE$13,
12590
+ message: MESSAGE$3,
12955
12591
  offsetsOf: queueOffsetsOf
12956
12592
  });
12957
12593
  // src/features/check-workflows/model/workflow-commits.ts
12958
- const RULE$10 = "workflow-commit";
12594
+ const RULE$12 = "workflow-commit";
12959
12595
  const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
12960
12596
  const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
12961
- const MESSAGE$1 = "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.";
12597
+ const MESSAGE$2 = "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.";
12962
12598
  const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source), Array.filter(({ value }) => isScalar(value) && typeof value.value === "string" && pattern.test(value.value)), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap(({ range }) => Option.fromNullishOr(range)), Option.map(([start]) => start), Option.toArray)));
12963
12599
  const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
12964
12600
  /** @internal */
12965
12601
  const checkWorkflowCommits = workflowCheck({
12966
- rule: RULE$10,
12967
- message: MESSAGE$1,
12602
+ rule: RULE$12,
12603
+ message: MESSAGE$2,
12968
12604
  offsetsOf: commitOffsetsOf
12969
12605
  });
12606
+ // src/features/check-workflows/model/workflow-lint.ts
12607
+ const checkWorkflowLint = checkSection({
12608
+ name: "checkWorkflowLint",
12609
+ rule: "workflow-lint",
12610
+ pick: fu4Section,
12611
+ pathspecs: (config) => workflowPathspecs({ config }),
12612
+ lint: lint$2,
12613
+ detail: () => ""
12614
+ });
12970
12615
  // src/app/tool-use.ts
12971
12616
  /** @internal */
12972
12617
  const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
@@ -12977,15 +12622,18 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
12977
12622
  checkWorkflowQueues(root),
12978
12623
  checkWorkflowCommits(root),
12979
12624
  checkFullHistoryCheckout(root),
12980
- checkReleasePrAutoMerge(root),
12625
+ checkReleasePlease(root),
12626
+ checkPublishTrigger(root),
12981
12627
  checkRestrictedRules(root),
12982
- checkMarkdown(root)
12628
+ checkMarkdown(root),
12629
+ checkStructure(root),
12630
+ checkWorkflowLint(root)
12983
12631
  ], { concurrency: "unbounded" });
12984
12632
  return Array.flatten(found);
12985
12633
  });
12986
12634
  // src/features/ban-comments/model/found-comment.ts
12987
- const taggedError$3 = Schema.TaggedError;
12988
- var CommentsUnreadable = class extends taggedError$3()("CommentsUnreadable", {
12635
+ const taggedError$2 = Schema.TaggedError;
12636
+ var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
12989
12637
  reader: Schema.String,
12990
12638
  message: Schema.String
12991
12639
  }) {};
@@ -13073,7 +12721,7 @@ const COMMENT_NODES = [
13073
12721
  "block_comment",
13074
12722
  "multiline_comment"
13075
12723
  ];
13076
- const START$8 = 0;
12724
+ const START$11 = 0;
13077
12725
  const NEXT = 1;
13078
12726
  const NONE$1 = [];
13079
12727
  const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
@@ -13126,7 +12774,7 @@ const markupComment = (source) => (node) => {
13126
12774
  }];
13127
12775
  };
13128
12776
  const textComments = (grammars, grammar) => (text) => {
13129
- const shift = shifted(text.startIndex ?? START$8);
12777
+ const shift = shifted(text.startIndex ?? START$11);
13130
12778
  return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
13131
12779
  };
13132
12780
  const embeddedComments = (grammars) => (node) => {
@@ -13162,11 +12810,11 @@ const commentsWith = (grammars) => (reader, source) => {
13162
12810
  }[reader](source);
13163
12811
  };
13164
12812
  // src/features/ban-comments/model/comments.ts
13165
- const RULE$9 = "comment";
12813
+ const RULE$11 = "comment";
13166
12814
  const CONFIG_FILE$1 = "vite.config.ts";
13167
12815
  const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
13168
- const READ_CONCURRENCY$5 = 64;
13169
- const START$7 = 0;
12816
+ const READ_CONCURRENCY$6 = 64;
12817
+ const START$10 = 0;
13170
12818
  const FIRST_LINE$4 = 1;
13171
12819
  const FIRST_COLUMN$3 = 1;
13172
12820
  const READERS$1 = [
@@ -13200,7 +12848,7 @@ const SHEBANG = "#!";
13200
12848
  const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
13201
12849
  const VERSION = /^\s?v?\d[\w.+-]*$/u;
13202
12850
  const DELIMITERS = /^(?:\/\/|\/\*|<!--|<#|#|--)|(?:\*\/|-->|#>)$/gu;
13203
- const MESSAGE = "Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.";
12851
+ const MESSAGE$1 = "Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.";
13204
12852
  const Patterns = Schema.Array(Schema.String);
13205
12853
  const CommentSettings = Schema.Struct({ allow: Patterns });
13206
12854
  const MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });
@@ -13214,8 +12862,8 @@ const NO_SETTINGS = {
13214
12862
  ignorePatterns: []
13215
12863
  };
13216
12864
  const NONE = [];
13217
- const taggedError$2 = Schema.TaggedError;
13218
- var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
12865
+ const taggedError$1 = Schema.TaggedError;
12866
+ var CommentConfigUnreadable = class extends taggedError$1()("CommentConfigUnreadable", { file: Schema.String }) {};
13219
12867
  const shebangReader = (source) => {
13220
12868
  if (!String$1.startsWith(SHEBANG)(source)) return Option.none();
13221
12869
  return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
@@ -13223,23 +12871,23 @@ const shebangReader = (source) => {
13223
12871
  const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
13224
12872
  const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
13225
12873
  const lineBefore = (source, index) => {
13226
- const lines = pipe(source, String$1.slice(START$7, index), String$1.split("\n"));
12874
+ const lines = pipe(source, String$1.slice(START$10, index), String$1.split("\n"));
13227
12875
  return Option.getOrElse(Array.last(lines), () => "");
13228
12876
  };
13229
12877
  const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
13230
- const isShebang = ({ index, text }) => index === START$7 && String$1.startsWith(SHEBANG)(text);
12878
+ const isShebang = ({ index, text }) => index === START$10 && String$1.startsWith(SHEBANG)(text);
13231
12879
  const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
13232
12880
  const problemOf$2 = (file, source) => ({ index }) => ({
13233
12881
  file,
13234
12882
  ...positionOf(source)(index),
13235
- rule: RULE$9,
13236
- message: MESSAGE
12883
+ rule: RULE$11,
12884
+ message: MESSAGE$1
13237
12885
  });
13238
12886
  const unreadableProblem = (file, message) => ({
13239
12887
  file,
13240
12888
  line: FIRST_LINE$4,
13241
12889
  column: FIRST_COLUMN$3,
13242
- rule: RULE$9,
12890
+ rule: RULE$11,
13243
12891
  message: `msch could not read the comments in this file: ${message}`
13244
12892
  });
13245
12893
  const settingsOf = ({ msch, lint }) => ({
@@ -13294,10 +12942,14 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
13294
12942
  const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
13295
12943
  onNone: () => Effect.succeed(NONE),
13296
12944
  onSome: (source) => problemsIn(entry, source)
13297
- }))), { concurrency: READ_CONCURRENCY$5 });
12945
+ }))), { concurrency: READ_CONCURRENCY$6 });
13298
12946
  return Array.flatten(found);
13299
12947
  });
13300
12948
  // src/features/ban-tools/model/banned-tool.ts
12949
+ const PROGRAM_SOURCE = /\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;
12950
+ const CONFIG_SOURCE = /(?:^|\/)[^/]*\.config\.[cm]?[jt]s$/u;
12951
+ const isProgramSource = ({ name }) => PROGRAM_SOURCE.test(name) && !CONFIG_SOURCE.test(name);
12952
+ 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");
13301
12953
  const FIRST_LINE$3 = 1;
13302
12954
  const FIRST_COLUMN$2 = 1;
13303
12955
  const WHOLE_MATCH$1 = 0;
@@ -13329,18 +12981,23 @@ const RENAMES = [
13329
12981
  [/(?:^|\/)(?:[^/]+)?\.dockerignore$/u, ".containerignore"],
13330
12982
  [/(?:^|\/)docker-compose(?:\.[^/]+)?\.ya?ml$/u, "compose.yaml"]
13331
12983
  ];
12984
+ const SPAWN_PATTERNS$1 = [spawnPattern("docker(?:-compose)?")];
13332
12985
  const COMMAND_PATTERNS$1 = [
13333
12986
  /(?<![\w./@-])docker[ \t]+(?:build|buildx|compose|run|push|pull|login|logout|exec|tag|image|images|ps|rm|rmi|stop|start|kill|save|load|create|cp|inspect|logs|network|volume|system|manifest|context|container)\b/gu,
13334
12987
  /(?<![\w./@-])docker-compose[ \t]+(?:up|down|build|run|exec|pull|push|ps|logs|stop|start|restart|config)\b/gu,
13335
- /(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make|\$)\(\s*)["'`]docker(?:-compose)?["'`]/gu,
12988
+ ...SPAWN_PATTERNS$1,
13336
12989
  /\buses:\s*["']?docker(?:\/[\w.-]+|:\/\/)/gu
13337
12990
  ];
12991
+ const patternsFor$1 = (entry) => {
12992
+ if (isProgramSource(entry)) return SPAWN_PATTERNS$1;
12993
+ return COMMAND_PATTERNS$1;
12994
+ };
13338
12995
  const renameOf = ({ name }) => pipe(RENAMES, Array.findFirst(([pattern]) => pattern.test(name)), Option.map(([, renamed]) => renamed));
13339
12996
  const DOCKER = {
13340
12997
  fileRule: "docker-file",
13341
12998
  commandRule: "docker-command",
13342
12999
  isFile: (entry) => Option.isSome(renameOf(entry)),
13343
- patternsFor: () => COMMAND_PATTERNS$1,
13000
+ patternsFor: patternsFor$1,
13344
13001
  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.`,
13345
13002
  commandMessage: (command) => `Docker is not used in this repository. Replace \`${command}\` with podman, which takes the same arguments.`
13346
13003
  };
@@ -13348,6 +13005,7 @@ const DOCKER = {
13348
13005
  const checkDocker = (root) => checkBannedTool(root, DOCKER);
13349
13006
  // src/features/ban-tools/model/python.ts
13350
13007
  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;
13008
+ const SPAWN_PATTERNS = [spawnPattern(String.raw`python[\d.]*|pip3?|pipx|uvx?|poetry`)];
13351
13009
  const COMMAND_PATTERNS = [
13352
13010
  /(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
13353
13011
  /(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
@@ -13355,11 +13013,12 @@ const COMMAND_PATTERNS = [
13355
13013
  /(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
13356
13014
  /(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
13357
13015
  /(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
13358
- /(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make|\$)\(\s*)["'`](?:python[\d.]*|pip3?|pipx|uvx?|poetry)["'`]/gu,
13016
+ ...SPAWN_PATTERNS,
13359
13017
  /\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
13360
13018
  ];
13361
13019
  const TOOL_PATTERNS$1 = [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
13362
13020
  const patternsFor = (entry) => {
13021
+ if (isProgramSource(entry)) return SPAWN_PATTERNS;
13363
13022
  if (isToolVersions(entry)) return [...COMMAND_PATTERNS, ...TOOL_PATTERNS$1];
13364
13023
  return COMMAND_PATTERNS;
13365
13024
  };
@@ -13374,7 +13033,7 @@ const PYTHON = {
13374
13033
  /** @internal */
13375
13034
  const checkPython = (root) => checkBannedTool(root, PYTHON);
13376
13035
  // src/features/check-catalog-entries/model/catalog-entries.ts
13377
- const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
13036
+ const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
13378
13037
  const MANIFEST$1 = /(?:^|\/)package\.json$/u;
13379
13038
  const CATALOG_PROTOCOL = "catalog:";
13380
13039
  const DEFAULT_CATALOG = "default";
@@ -13383,25 +13042,25 @@ const WILDCARD = "*";
13383
13042
  const FIRST_LINE$2 = 1;
13384
13043
  const FIRST_COLUMN$1 = 1;
13385
13044
  const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
13386
- const READ_CONCURRENCY$4 = 16;
13045
+ const READ_CONCURRENCY$5 = 16;
13387
13046
  const STALE_RULE = "stale-release-age-exclude";
13388
13047
  const UNUSED_RULE = "unused-catalog-entry";
13389
13048
  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.";
13390
13049
  const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
13391
- const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
13392
- const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
13393
- const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
13394
- const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
13050
+ const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
13051
+ const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
13052
+ const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
13053
+ const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
13395
13054
  const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
13396
- const fieldsOf$1 = (value) => Option.getOrElse(decodeFields$1(value), () => ({}));
13397
- const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf$1(held)), Array.map((name) => ({
13055
+ const fieldsOf$2 = (value) => Option.getOrElse(decodeFields$2(value), () => ({}));
13056
+ const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf$2(held)), Array.map((name) => ({
13398
13057
  catalog,
13399
13058
  name
13400
13059
  })));
13401
- const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(Record.toEntries(fieldsOf$1(settings["catalogs"])), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
13060
+ const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(Record.toEntries(fieldsOf$2(settings["catalogs"])), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
13402
13061
  const catalogOf = (specifier) => pipe(Option.liftPredicate(specifier, String$1.startsWith(CATALOG_PROTOCOL)), Option.map(String$1.slice(8)), Option.map((name) => Option.getOrElse(Option.liftPredicate(name, String$1.isNonEmpty), () => DEFAULT_CATALOG)));
13403
- const referenceOf = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
13404
- const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf$1(section), Record.toEntries, Array.flatMap(referenceOf))));
13062
+ const referenceOf = ([name, specifier]) => pipe(decodeString$2(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
13063
+ const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf$2(section), Record.toEntries, Array.flatMap(referenceOf))));
13405
13064
  const versionsOf = (raw) => pipe(Option.fromUndefinedOr(raw), Option.map((listed) => pipe(String$1.split(listed, VERSION_SEPARATOR), Array.map(String$1.trim))), Option.getOrElse(() => []));
13406
13065
  const isLocked = (keys) => (resolved) => pipe(keys, Array.some((key) => key === resolved || String$1.startsWith(`${resolved}(`)(key)));
13407
13066
  const hasPackage = (keys) => (name) => pipe(keys, Array.some(String$1.startsWith(`${name}@`)));
@@ -13417,18 +13076,18 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
13417
13076
  const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
13418
13077
  const files = yield* RepositoryFiles;
13419
13078
  const listed = yield* files.listedFiles(root);
13420
- const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$4 });
13421
- const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$2(text))), Array.flatMap(referencesIn));
13422
- const fromOverrides = pipe(fieldsOf$1(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
13079
+ const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$5 });
13080
+ const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$4(text))), Array.flatMap(referencesIn));
13081
+ const fromOverrides = pipe(fieldsOf$2(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
13423
13082
  return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
13424
13083
  });
13425
13084
  const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
13426
13085
  onNone: () => FIRST_LINE$2,
13427
13086
  onSome: (index) => index + FIRST_LINE$2
13428
13087
  }));
13429
- const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
13430
- const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
13431
- const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\\s*$`, "u");
13088
+ const quoted$1 = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
13089
+ const entryLine = (name) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "u");
13090
+ const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted$1(entry)}["']?\\s*$`, "u");
13432
13091
  const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
13433
13092
  file,
13434
13093
  line: at(needle),
@@ -13457,7 +13116,7 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
13457
13116
  const manifest = yield* workspaceManifest(root);
13458
13117
  return yield* Option.match(manifest, {
13459
13118
  onNone: () => Effect.succeed([]),
13460
- onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$3), fieldsOf$1(settings))
13119
+ onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$4), fieldsOf$2(settings))
13461
13120
  });
13462
13121
  });
13463
13122
  // src/features/check-skills/model/skill-entry.ts
@@ -13466,8 +13125,8 @@ const VISIBLE_RULE = "skill-source-visible";
13466
13125
  const CONFIG_FILE = "vite.config.ts";
13467
13126
  const RENOVATE_FILE$1 = "renovate.json";
13468
13127
  const SOURCE = "masseater/skills";
13469
- const PRESET = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
13470
- const START$6 = 0;
13128
+ const PRESET$1 = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
13129
+ const START$9 = 0;
13471
13130
  const LOCAL_PREFIX = "./";
13472
13131
  const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
13473
13132
  const Source = Schema.Struct({
@@ -13476,11 +13135,11 @@ const Source = Schema.Struct({
13476
13135
  });
13477
13136
  const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
13478
13137
  const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
13479
- const taggedError$1 = Schema.TaggedError;
13480
- var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
13138
+ const taggedError = Schema.TaggedError;
13139
+ var SkillsConfigUnreadable = class extends taggedError()("SkillsConfigUnreadable", { file: Schema.String }) {};
13481
13140
  const problemAt$3 = (rule, file, text) => (anchor, message) => ({
13482
13141
  file,
13483
- ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$6))),
13142
+ ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$9))),
13484
13143
  rule,
13485
13144
  message
13486
13145
  });
@@ -13512,8 +13171,8 @@ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root
13512
13171
  const files = yield* RepositoryFiles;
13513
13172
  const file = files.join(root, RENOVATE_FILE$1);
13514
13173
  const text = yield* files.readFile(file);
13515
- if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
13516
- return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`)];
13174
+ if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
13175
+ 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}.`)];
13517
13176
  });
13518
13177
  /** @internal */
13519
13178
  const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
@@ -13527,20 +13186,20 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
13527
13186
  ];
13528
13187
  });
13529
13188
  // src/features/check-skills/model/published-skills.ts
13530
- const RULE$8 = "published-skills";
13189
+ const RULE$10 = "published-skills";
13531
13190
  const KEYWORD = "tanstack-intent";
13532
13191
  const SKILLS = "skills";
13533
13192
  const MANIFEST_FILE = "package.json";
13534
13193
  const SKILL_FILE$1 = "SKILL.md";
13535
- const FIRST$2 = 1;
13194
+ const FIRST$3 = 1;
13536
13195
  const SUCCEEDED = 0;
13537
13196
  const SYNC = "Run vp exec intent maintainer sync in the repository root.";
13538
13197
  const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
13539
13198
  const problemAt$2 = (file, message) => ({
13540
13199
  file,
13541
- line: FIRST$2,
13542
- column: FIRST$2,
13543
- rule: RULE$8,
13200
+ line: FIRST$3,
13201
+ column: FIRST$3,
13202
+ rule: RULE$10,
13544
13203
  message
13545
13204
  });
13546
13205
  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))));
@@ -13579,7 +13238,7 @@ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPu
13579
13238
  return Array.flatten(problems);
13580
13239
  });
13581
13240
  // src/features/check-skills/model/skill-files.ts
13582
- const RULE$7 = "skill-file";
13241
+ const RULE$9 = "skill-file";
13583
13242
  const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
13584
13243
  const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
13585
13244
  const MARKDOWN = ".md";
@@ -13595,10 +13254,10 @@ const FRAGMENT = /#.*$/u;
13595
13254
  const GITHUB = "https://github.com/";
13596
13255
  const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
13597
13256
  const BLANK = /\s+/u;
13598
- const SEPARATOR$2 = "/";
13599
- const START$5 = 0;
13600
- const FIRST$1 = 1;
13601
- const READ_CONCURRENCY$3 = 16;
13257
+ const SEPARATOR$3 = "/";
13258
+ const START$8 = 0;
13259
+ const FIRST$2 = 1;
13260
+ const READ_CONCURRENCY$4 = 16;
13602
13261
  const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
13603
13262
  const Frontmatter = Schema.Struct({
13604
13263
  name: Schema.optional(Schema.String),
@@ -13606,9 +13265,9 @@ const Frontmatter = Schema.Struct({
13606
13265
  metadata: Schema.optional(Metadata)
13607
13266
  });
13608
13267
  const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
13609
- const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$5));
13268
+ const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$8));
13610
13269
  const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
13611
- const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$5].length), Option.getOrElse(() => START$5));
13270
+ const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$8].length), Option.getOrElse(() => START$8));
13612
13271
  const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
13613
13272
  const nameProblems = ({ source, directory }, name, folder) => {
13614
13273
  const bodyStart = bodyStartOf(source);
@@ -13636,16 +13295,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
13636
13295
  ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
13637
13296
  file: skill.file,
13638
13297
  ...positionOf(skill.source)(index),
13639
- rule: RULE$7,
13298
+ rule: RULE$9,
13640
13299
  message
13641
13300
  })));
13642
13301
  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) => ({
13643
13302
  target,
13644
- index: found.index ?? START$5
13303
+ index: found.index ?? START$8
13645
13304
  })), Option.toArray);
13646
13305
  const rangeOf$1 = (found) => {
13647
- const start = found.index ?? START$5;
13648
- return [start, start + found[START$5].length];
13306
+ const start = found.index ?? START$8;
13307
+ return [start, start + found[START$8].length];
13649
13308
  };
13650
13309
  const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
13651
13310
  const linksIn = (source) => {
@@ -13663,7 +13322,7 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
13663
13322
  return pipe(missing, Array.map(({ target, index }) => ({
13664
13323
  file,
13665
13324
  ...positionOf(source)(index),
13666
- rule: RULE$7,
13325
+ rule: RULE$9,
13667
13326
  message: `links to ${target}, which does not exist. Fix the path or remove the link.`
13668
13327
  })));
13669
13328
  });
@@ -13671,15 +13330,15 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
13671
13330
  const files = yield* RepositoryFiles;
13672
13331
  const file = files.join(root, name);
13673
13332
  const directory = files.dirname(name);
13674
- const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
13333
+ const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$3}`)));
13675
13334
  const text = yield* files.readFile(file);
13676
13335
  const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
13677
- const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$3 });
13336
+ const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$4 });
13678
13337
  const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
13679
13338
  file: files.join(root, entry),
13680
- line: FIRST$1,
13681
- column: FIRST$1,
13682
- rule: RULE$7,
13339
+ line: FIRST$2,
13340
+ column: FIRST$2,
13341
+ rule: RULE$9,
13683
13342
  message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
13684
13343
  })));
13685
13344
  return [
@@ -13696,7 +13355,7 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
13696
13355
  const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
13697
13356
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
13698
13357
  const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
13699
- const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$3 });
13358
+ const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$4 });
13700
13359
  return Array.flatten(found);
13701
13360
  });
13702
13361
  // src/features/check-version-downgrades/model/version-entries.ts
@@ -13711,16 +13370,16 @@ const CARGO_SECTIONS = [
13711
13370
  "dev-dependencies",
13712
13371
  "build-dependencies"
13713
13372
  ];
13714
- const decodeFields = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
13373
+ const decodeFields$1 = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
13715
13374
  const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
13716
- const decodeString = Schema.decodeUnknownOption(Schema.String);
13375
+ const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
13717
13376
  const decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));
13718
- const decodeSpec = (value) => Option.orElse(decodeString(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
13377
+ const decodeSpec = (value) => Option.orElse(decodeString$1(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
13719
13378
  const PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));
13720
13379
  const decodePackageManager = Schema.decodeUnknownOption(PackageManager);
13721
- const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
13722
- const fieldOf = (name) => (value) => fieldsOf(value)[name];
13723
- const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
13380
+ const fieldsOf$1 = (value) => Option.getOrElse(decodeFields$1(value), () => ({}));
13381
+ const fieldOf = (name) => (value) => fieldsOf$1(value)[name];
13382
+ const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf$1(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
13724
13383
  key: `${section}:${name}`,
13725
13384
  name,
13726
13385
  spec
@@ -13735,15 +13394,15 @@ const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map
13735
13394
  };
13736
13395
  }), Option.toArray);
13737
13396
  const manifestEntries = (text) => {
13738
- const manifest = fieldsOf(Option.getOrUndefined(decodeJson(text)));
13397
+ const manifest = fieldsOf$1(Option.getOrUndefined(decodeJson(text)));
13739
13398
  return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
13740
13399
  };
13741
- const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
13400
+ const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf$1(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
13742
13401
  const workspaceEntries = (text) => {
13743
- const settings = fieldsOf(Option.getOrUndefined(Option.liftThrowable(() => parse$2(text))()));
13402
+ const settings = fieldsOf$1(Option.getOrUndefined(Option.liftThrowable(() => parse$2(text))()));
13744
13403
  return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings["catalogs"])];
13745
13404
  };
13746
- const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
13405
+ const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf$1), Option.getOrElse(() => ({})));
13747
13406
  const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
13748
13407
  key,
13749
13408
  name: key,
@@ -13759,9 +13418,9 @@ const cargoEntries = (text) => {
13759
13418
  };
13760
13419
  const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
13761
13420
  // src/features/check-version-downgrades/model/version-downgrade.ts
13762
- const RULE$6 = "version-downgrade";
13421
+ const RULE$8 = "version-downgrade";
13763
13422
  const DEFAULT_BASE = "origin/main";
13764
- const READ_CONCURRENCY$2 = 16;
13423
+ const READ_CONCURRENCY$3 = 16;
13765
13424
  const READERS = [
13766
13425
  [/(?:^|\/)package\.json$/u, manifestEntries],
13767
13426
  [/^pnpm-workspace\.yaml$/u, workspaceEntries],
@@ -13785,7 +13444,7 @@ const downgradesIn = ({ file, text, before, after }) => {
13785
13444
  file,
13786
13445
  line: lineOf(text, entry),
13787
13446
  column: FIRST_LINE$1,
13788
- rule: RULE$6,
13447
+ rule: RULE$8,
13789
13448
  message: message(old, entry)
13790
13449
  })), Option.toArray)));
13791
13450
  };
@@ -13811,7 +13470,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
13811
13470
  before: read(before),
13812
13471
  after: read(after)
13813
13472
  })), Option.getOrElse(() => []));
13814
- }), { concurrency: READ_CONCURRENCY$2 });
13473
+ }), { concurrency: READ_CONCURRENCY$3 });
13815
13474
  return Array.flatten(found);
13816
13475
  });
13817
13476
  // src/features/check-version-downgrades/model/renovate-settings.ts
@@ -13820,9 +13479,13 @@ const AUTOMERGE_OFF = /["']?platformAutomerge["']?\s*:\s*false/gu;
13820
13479
  const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)["']/gu;
13821
13480
  const AUTOMERGE_RULE = "renovate-platform-automerge";
13822
13481
  const CAP_RULE = "renovate-version-cap";
13823
- const READ_CONCURRENCY$1 = 16;
13482
+ const PRESET_RULE = "renovate-msch-preset";
13483
+ const PRESET = "github>masseater/masseater.dev//libs/msch/renovate";
13484
+ const START$7 = 0;
13485
+ const READ_CONCURRENCY$2 = 16;
13824
13486
  const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
13825
13487
  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.";
13488
+ const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
13826
13489
  const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
13827
13490
  const problemsIn$4 = (file, source) => {
13828
13491
  const at = positionOf(source);
@@ -13832,7 +13495,16 @@ const problemsIn$4 = (file, source) => {
13832
13495
  rule,
13833
13496
  message
13834
13497
  })));
13835
- return [...found(AUTOMERGE_OFF, AUTOMERGE_RULE, AUTOMERGE_MESSAGE), ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE)];
13498
+ return [
13499
+ ...found(AUTOMERGE_OFF, AUTOMERGE_RULE, AUTOMERGE_MESSAGE),
13500
+ ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
13501
+ ...pipe([{
13502
+ file,
13503
+ ...at(START$7),
13504
+ rule: PRESET_RULE,
13505
+ message: PRESET_MESSAGE
13506
+ }], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
13507
+ ];
13836
13508
  };
13837
13509
  /** @internal */
13838
13510
  const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* checkRenovateSettings(root) {
@@ -13844,24 +13516,24 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
13844
13516
  onNone: () => [],
13845
13517
  onSome: (source) => problemsIn$4(file, source)
13846
13518
  })));
13847
- }, { concurrency: READ_CONCURRENCY$1 });
13519
+ }, { concurrency: READ_CONCURRENCY$2 });
13848
13520
  return Array.flatten(found);
13849
13521
  });
13850
13522
  // src/features/find-invisible-characters/model/hidden-unicode.ts
13851
13523
  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;
13852
13524
  const NUL = "\0";
13853
- const START$4 = 0;
13525
+ const START$6 = 0;
13854
13526
  const HEX = 16;
13855
13527
  const CODE_POINT_WIDTH = 4;
13856
- const READ_CONCURRENCY = 64;
13857
- const RULE$5 = "hidden-unicode";
13858
- const hexOf = (character) => pipe(String$1.codePointAt(START$4)(character), Option.getOrElse(() => START$4), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
13528
+ const READ_CONCURRENCY$1 = 64;
13529
+ const RULE$7 = "hidden-unicode";
13530
+ const hexOf = (character) => pipe(String$1.codePointAt(START$6)(character), Option.getOrElse(() => START$6), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
13859
13531
  const problemOf$1 = (file, source) => (found) => {
13860
- const hex = hexOf(found[START$4]);
13532
+ const hex = hexOf(found[START$6]);
13861
13533
  return {
13862
13534
  file,
13863
- ...positionOf(source)(found.index ?? START$4),
13864
- rule: RULE$5,
13535
+ ...positionOf(source)(found.index ?? START$6),
13536
+ rule: RULE$7,
13865
13537
  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}.`
13866
13538
  };
13867
13539
  };
@@ -13879,29 +13551,29 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
13879
13551
  onNone: () => [],
13880
13552
  onSome: (source) => problemsIn$3(file, source)
13881
13553
  })));
13882
- }, { concurrency: READ_CONCURRENCY });
13554
+ }, { concurrency: READ_CONCURRENCY$1 });
13883
13555
  return Array.flatten(found);
13884
13556
  });
13885
13557
  // src/features/find-unneeded-files/model/alchemy-patch.ts
13886
- const RULE$4 = "alchemy-patch";
13887
- const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
13558
+ const RULE$6 = "alchemy-patch";
13559
+ const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
13888
13560
  const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
13889
- const START$3 = 0;
13561
+ const START$5 = 0;
13890
13562
  const problemOf = (file, position, name) => ({
13891
13563
  file,
13892
13564
  ...position,
13893
- rule: RULE$4,
13565
+ rule: RULE$6,
13894
13566
  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.`
13895
13567
  });
13896
13568
  const problemsIn$2 = (file, patched) => (source) => {
13897
13569
  const at = positionOf(source);
13898
- const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$3));
13570
+ const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$5));
13899
13571
  return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
13900
13572
  };
13901
13573
  /** @internal */
13902
13574
  const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyPatch(root) {
13903
13575
  const files = yield* RepositoryFiles;
13904
- const file = files.join(root, WORKSPACE_FILE$2);
13576
+ const file = files.join(root, WORKSPACE_FILE$3);
13905
13577
  const text = yield* files.readFile(file);
13906
13578
  const manifest = yield* workspaceManifest(root);
13907
13579
  const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
@@ -13910,10 +13582,10 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
13910
13582
  // src/features/find-unneeded-files/model/applied-packages.ts
13911
13583
  const MSCH = "@r_masseater/msch";
13912
13584
  const SCOPE$1 = "@r_masseater/";
13913
- const RULE$3 = "applied-package";
13914
- const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
13585
+ const RULE$5 = "applied-package";
13586
+ const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
13915
13587
  const NOT_FOUND = -1;
13916
- const SEPARATOR$1 = "/";
13588
+ const SEPARATOR$2 = "/";
13917
13589
  const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
13918
13590
  const BinMap = Schema.Record(Schema.String, Schema.String);
13919
13591
  const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
@@ -13927,11 +13599,11 @@ const declaredNames = (manifest) => pipe([
13927
13599
  const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
13928
13600
  onNone: () => [],
13929
13601
  onSome: (bin) => {
13930
- if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
13602
+ if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$2), Array.lastNonEmpty)];
13931
13603
  return Record.keys(bin);
13932
13604
  }
13933
13605
  }));
13934
- const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE$1}`)));
13606
+ const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE$3}`)));
13935
13607
  const installedPackage = Effect.fn("installedPackage")(function* installedPackage(name) {
13936
13608
  const files = yield* RepositoryFiles;
13937
13609
  const text = yield* pipe(manifestOf(name), Option.match({
@@ -13955,24 +13627,24 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
13955
13627
  const problemAt$1 = (file, source) => (index, name) => ({
13956
13628
  file,
13957
13629
  ...positionOf(source)(index),
13958
- rule: RULE$3,
13630
+ rule: RULE$5,
13959
13631
  message: `msch applies ${name}. Remove this use and let msch apply it.`
13960
13632
  });
13961
13633
  const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
13962
13634
  const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
13963
13635
  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)))));
13964
- const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
13636
+ const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$2}`)(name)), Array.match({
13965
13637
  onEmpty: () => "",
13966
13638
  onNonEmpty: Array.max(BY_LENGTH)
13967
13639
  }));
13968
- const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$1;
13640
+ const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$2;
13969
13641
  const consumersIn = Effect.fn("consumersIn")(function* consumersIn(root, directories) {
13970
13642
  const files = yield* RepositoryFiles;
13971
13643
  return yield* pipe(directories, Effect.filter((directory) => readManifest(files.join(root, directory)).pipe(Effect.map(Option.exists((manifest) => manifest.name !== MSCH && Array.contains(declaredNames(manifest), MSCH))))));
13972
13644
  });
13973
13645
  const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appliedNames, directory) {
13974
13646
  const files = yield* RepositoryFiles;
13975
- const file = files.join(root, directory, MANIFEST_FILE$1);
13647
+ const file = files.join(root, directory, MANIFEST_FILE$3);
13976
13648
  const text = yield* files.readFile(file);
13977
13649
  const manifest = yield* readManifest(files.join(root, directory));
13978
13650
  return pipe(Option.all({
@@ -14010,8 +13682,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
14010
13682
  return yield* appliedPackageProblems(root, applied);
14011
13683
  });
14012
13684
  // src/features/find-unneeded-files/model/replaced-tools.ts
14013
- const RULE$2 = "replaced-tool";
14014
- const FIRST = 1;
13685
+ const RULE$4 = "replaced-tool";
13686
+ const FIRST$1 = 1;
14015
13687
  const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
14016
13688
  const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
14017
13689
  const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
@@ -14089,9 +13761,9 @@ const REPLACED = [
14089
13761
  ];
14090
13762
  const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
14091
13763
  file,
14092
- line: FIRST,
14093
- column: FIRST,
14094
- rule: RULE$2,
13764
+ line: FIRST$1,
13765
+ column: FIRST$1,
13766
+ rule: RULE$4,
14095
13767
  message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
14096
13768
  })));
14097
13769
  /** @internal */
@@ -14101,9 +13773,9 @@ const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplac
14101
13773
  return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor(entry))));
14102
13774
  });
14103
13775
  // src/features/find-unneeded-files/model/unneeded-files.ts
14104
- const WORKSPACE_FILE = "pnpm-workspace.yaml";
13776
+ const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
14105
13777
  const PNPM_DIRECTORY = ".pnpm/";
14106
- const SEPARATOR = "/";
13778
+ const SEPARATOR$1 = "/";
14107
13779
  const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
14108
13780
  const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
14109
13781
  const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
@@ -14120,7 +13792,7 @@ const SETUP_PATTERNS = [
14120
13792
  ];
14121
13793
  const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
14122
13794
  const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
14123
- const START$2 = 0;
13795
+ const START$4 = 0;
14124
13796
  const LAST_SEGMENT = 1;
14125
13797
  const FIRST_LINE = 1;
14126
13798
  const FIRST_COLUMN = 1;
@@ -14149,7 +13821,7 @@ const generatedCargoConfig = (entry, source) => {
14149
13821
  if (String$1.isNonEmpty(String$1.trim(String$1.replaceAll(PNPM_CARGO_BLOCK, "")(source)))) return [];
14150
13822
  return [pnpmCargoConfig(entry)];
14151
13823
  };
14152
- const cargoOutsidePnpm = problemAtStart(CARGO_RULE, `pnpm does not manage these crates. Set \`cargo: { enabled: true }\` in ${WORKSPACE_FILE} so pnpm install fetches the crates and the Rust toolchain.`);
13824
+ const cargoOutsidePnpm = problemAtStart(CARGO_RULE, `pnpm does not manage these crates. Set \`cargo: { enabled: true }\` in ${WORKSPACE_FILE$1} so pnpm install fetches the crates and the Rust toolchain.`);
14153
13825
  const setupProblem = ({ file }, source, advice) => (found) => ({
14154
13826
  file,
14155
13827
  ...positionOf(source)(found.index ?? WHOLE_MATCH),
@@ -14173,10 +13845,10 @@ const isCargoManifest = matches(CARGO_MANIFEST_FILE);
14173
13845
  const isForeignLockfile = matches(FOREIGN_LOCKFILE);
14174
13846
  const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
14175
13847
  const isPnpmOutput = matches(PNPM_OUTPUT);
14176
- const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
13848
+ const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
14177
13849
  const ancestorsOf = (directory) => {
14178
- const parts = String$1.split(directory, SEPARATOR);
14179
- return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
13850
+ const parts = String$1.split(directory, SEPARATOR$1);
13851
+ return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR$1)), Array.filter((ancestor) => ancestor !== directory));
14180
13852
  };
14181
13853
  const readsCargoLock = (manifests, workspaces) => ({ name }) => {
14182
13854
  const directory = directoryOf(name);
@@ -14190,7 +13862,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
14190
13862
  const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
14191
13863
  return directoriesOf(roots);
14192
13864
  });
14193
- const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$2), (end) => String$1.slice(START$2, end)(name));
13865
+ const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$4), (end) => String$1.slice(START$4, end)(name));
14194
13866
  const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
14195
13867
  const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
14196
13868
  const cargoProblems = (present, enabled) => {
@@ -14225,37 +13897,100 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
14225
13897
  if (Option.isNone(workspace)) return [];
14226
13898
  return yield* unneededIn(root, cargoEnabled(workspace.value));
14227
13899
  });
13900
+ // src/features/check-exact-versions/model/exact-versions.ts
13901
+ const RULE$3 = "version-range";
13902
+ const WORKSPACE_FILE = "pnpm-workspace.yaml";
13903
+ const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
13904
+ const PROTOCOL = /^[a-z+]+:/u;
13905
+ const PATH_LIKE = "/";
13906
+ const START$3 = 0;
13907
+ const SECTIONS = [
13908
+ "dependencies",
13909
+ "devDependencies",
13910
+ "optionalDependencies"
13911
+ ];
13912
+ const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
13913
+ 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.";
13914
+ const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
13915
+ const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
13916
+ const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
13917
+ const decodeString = Schema.decodeUnknownOption(Schema.String);
13918
+ const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
13919
+ const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
13920
+ /** @internal */
13921
+ const isRange = (specifier) => {
13922
+ const version = versionOf(specifier);
13923
+ return !PROTOCOL.test(version) && !String$1.includes(PATH_LIKE)(version) && semver.valid(version) === null;
13924
+ };
13925
+ const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString(value), Option.map((specifier) => ({
13926
+ name,
13927
+ specifier
13928
+ })), Option.toArray)));
13929
+ const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
13930
+ const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$3));
13931
+ const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
13932
+ file,
13933
+ ...positionOf(source)(offsetIn(source)(pattern(range))),
13934
+ rule: RULE$3,
13935
+ message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
13936
+ })));
13937
+ const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted(name)}"\\s*:\\s*"${quoted(specifier)}"`, "u");
13938
+ const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "mu");
13939
+ const manifestProblems$1 = (entry, source) => pipe(decodeManifest$3(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
13940
+ const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
13941
+ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
13942
+ const files = yield* RepositoryFiles;
13943
+ const file = files.join(root, WORKSPACE_FILE);
13944
+ const settings = yield* workspaceManifest(root);
13945
+ const source = yield* files.readFile(file);
13946
+ return pipe(Option.all({
13947
+ settings,
13948
+ source
13949
+ }), Option.map(({ settings: held, source: text }) => problemsFor(file, text, catalogPattern)(catalogSpecifiers(fieldsOf(held)))), Option.getOrElse(() => []));
13950
+ });
13951
+ /** @internal */
13952
+ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
13953
+ const files = yield* RepositoryFiles;
13954
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
13955
+ const listed = pipe(manifests, Array.map((name) => ({
13956
+ name,
13957
+ file: files.join(root, name)
13958
+ })));
13959
+ const fromManifests = yield* scanText(listed, manifestProblems$1);
13960
+ const fromCatalogs = yield* catalogProblems(root);
13961
+ return [...fromManifests, ...fromCatalogs];
13962
+ });
14228
13963
  // src/features/check-package-scope/model/package-scope.ts
14229
- const RULE$1 = "package-scope";
13964
+ const RULE$2 = "package-scope";
14230
13965
  const SCOPE = "@r_masseater/";
14231
13966
  const NAME_KEY = "\"name\"";
14232
- const START$1 = 0;
13967
+ const START$2 = 0;
14233
13968
  const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14234
- const Manifest$1 = Schema.Struct({
13969
+ const Manifest$2 = Schema.Struct({
14235
13970
  name: Schema.optional(Schema.String),
14236
13971
  private: Schema.optional(Schema.Boolean),
14237
13972
  publishConfig: Schema.optional(Schema.Unknown)
14238
13973
  });
14239
- const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
13974
+ const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
14240
13975
  const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
14241
13976
  const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
14242
- const problemsIn$1 = (entry, source) => pipe(decodeManifest$1(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
13977
+ const problemsIn$1 = (entry, source) => pipe(decodeManifest$2(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
14243
13978
  file: entry.file,
14244
- ...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$1))),
14245
- rule: RULE$1,
13979
+ ...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$2))),
13980
+ rule: RULE$2,
14246
13981
  message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
14247
13982
  })), Option.toArray);
14248
13983
  /** @internal */
14249
13984
  const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageScope(root) {
14250
13985
  const files = yield* RepositoryFiles;
14251
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED$1]);
13986
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
14252
13987
  return yield* scanText(pipe(manifests, Array.map((name) => ({
14253
13988
  name,
14254
13989
  file: files.join(root, name)
14255
13990
  }))), problemsIn$1);
14256
13991
  });
14257
13992
  // src/features/check-runtime-version/model/node-version.ts
14258
- const RULE = "node-version";
13993
+ const RULE$1 = "node-version";
14259
13994
  const MINIMUM = 26;
14260
13995
  const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
14261
13996
  const MANIFEST = /(?:^|\/)package\.json$/u;
@@ -14269,15 +14004,15 @@ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t
14269
14004
  const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
14270
14005
  const ALTERNATIVE = "||";
14271
14006
  const ENGINES_KEY = "\"engines\"";
14272
- const START = 0;
14007
+ const START$1 = 0;
14273
14008
  const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14274
14009
  const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
14275
- const Manifest = Schema.Struct({
14010
+ const Manifest$1 = Schema.Struct({
14276
14011
  private: Schema.optional(Schema.Boolean),
14277
14012
  publishConfig: Schema.optional(Schema.Unknown),
14278
14013
  engines: Schema.optional(Engines)
14279
14014
  });
14280
- const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
14015
+ const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
14281
14016
  const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
14282
14017
  const isOld = (major) => major < MINIMUM;
14283
14018
  const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
@@ -14289,14 +14024,14 @@ const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some
14289
14024
  const problemAt = ({ entry, source, index }, message) => ({
14290
14025
  file: entry.file,
14291
14026
  ...positionOf(source)(index),
14292
- rule: RULE,
14027
+ rule: RULE$1,
14293
14028
  message
14294
14029
  });
14295
- const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START));
14030
+ const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$1));
14296
14031
  const unstatedProblem = (entry, source) => problemAt({
14297
14032
  entry,
14298
14033
  source,
14299
- index: START
14034
+ index: START$1
14300
14035
  }, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
14301
14036
  const rangeProblem = (entry, source) => (range) => problemAt({
14302
14037
  entry,
@@ -14306,7 +14041,7 @@ const rangeProblem = (entry, source) => (range) => problemAt({
14306
14041
  const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
14307
14042
  const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
14308
14043
  const manifestProblems = (entry, source) => {
14309
- const manifest = decodeManifest(source);
14044
+ const manifest = decodeManifest$1(source);
14310
14045
  if (Option.isNone(manifest)) return [];
14311
14046
  const range = rangeOf(manifest.value);
14312
14047
  if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
@@ -14315,12 +14050,12 @@ const manifestProblems = (entry, source) => {
14315
14050
  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({
14316
14051
  entry,
14317
14052
  source,
14318
- index: found.index ?? START
14319
- }, `${SUPPORTED} \`${String$1.trim(found[START])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
14053
+ index: found.index ?? START$1
14054
+ }, `${SUPPORTED} \`${String$1.trim(found[START$1])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
14320
14055
  const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
14321
14056
  entry,
14322
14057
  source,
14323
- index: START
14058
+ index: START$1
14324
14059
  }, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
14325
14060
  const problemsIn = (entry, source) => {
14326
14061
  if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
@@ -14334,17 +14069,134 @@ const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.t
14334
14069
  const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
14335
14070
  const files = yield* RepositoryFiles;
14336
14071
  const listed = yield* listedFiles(root);
14337
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED]);
14072
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED]);
14338
14073
  const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
14339
14074
  name,
14340
14075
  file: files.join(root, name)
14341
14076
  })))];
14342
14077
  return yield* scanText(sources, problemsIn);
14343
14078
  });
14079
+ // src/features/check-unused-workspaces/model/unused-workspaces.ts
14080
+ const RULE = "unused-workspace";
14081
+ const CARGO_FILE = "Cargo.toml";
14082
+ const ROOT_DIRECTORY = "";
14083
+ const TASK_SEPARATOR = "#";
14084
+ const SEPARATOR = "/";
14085
+ const START = 0;
14086
+ const FIRST = 1;
14087
+ const READ_CONCURRENCY = 8;
14088
+ const LIBRARY_KINDS = [
14089
+ "lib",
14090
+ "rlib",
14091
+ "proc-macro"
14092
+ ];
14093
+ const PROGRAM_KINDS = [
14094
+ "bin",
14095
+ "cdylib",
14096
+ "staticlib",
14097
+ "dylib"
14098
+ ];
14099
+ const Manifest = Schema.Struct({
14100
+ name: Schema.optional(Schema.String),
14101
+ private: Schema.optional(Schema.Boolean),
14102
+ exports: Schema.optional(Schema.Unknown),
14103
+ main: Schema.optional(Schema.Unknown),
14104
+ bin: Schema.optional(Schema.Unknown)
14105
+ });
14106
+ const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
14107
+ const isDependedOn = (links) => ({ directory }) => pipe(links, Array.some(({ from, to }) => to === directory && from !== directory));
14108
+ const isKind = (kinds) => (kind) => Array.contains(kinds, kind);
14109
+ const isLibraryCrate = ({ kinds }) => pipe(kinds, Array.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Array.some(isKind(PROGRAM_KINDS)));
14110
+ const NO_CARGO = {
14111
+ libraries: [],
14112
+ links: []
14113
+ };
14114
+ const cargoFacts = Effect.fn("cargoFacts")(function* cargoFacts(root, directories) {
14115
+ const files = yield* RepositoryFiles;
14116
+ if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return NO_CARGO;
14117
+ const crates = yield* cratesIn(root);
14118
+ const ownerOf = (path) => owningWorkspace(directories)(files.relative(root, path));
14119
+ const linksOf = (manifest, paths) => {
14120
+ const owner = ownerOf(files.dirname(manifest));
14121
+ const linkTo = (path) => Option.zipWith(owner, ownerOf(path), (from, to) => ({
14122
+ from,
14123
+ to
14124
+ }));
14125
+ return pipe(paths, Array.flatMap((path) => Option.toArray(linkTo(path))));
14126
+ };
14127
+ return {
14128
+ libraries: pipe(crates, Array.filter(isLibraryCrate), Array.flatMap(({ manifest }) => Option.toArray(ownerOf(files.dirname(manifest))))),
14129
+ links: pipe(crates, Array.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)))
14130
+ };
14131
+ });
14132
+ const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START, at)(text)), Option.filter(String$1.isNonEmpty));
14133
+ const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directory) {
14134
+ const config = yield* workspaceConfigOf(root, directory);
14135
+ return pipe(config, Option.map(({ program }) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))))), Option.getOrElse(() => []));
14136
+ });
14137
+ const isWithin = (directory) => (file) => String$1.startsWith(`${directory}${SEPARATOR}`)(file);
14138
+ const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
14139
+ const { root, directory, crateLibraries, deployed } = request;
14140
+ const files = yield* RepositoryFiles;
14141
+ const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
14142
+ return pipe(text, Option.flatMap(decodeManifest), Option.map((manifest) => ({
14143
+ directory,
14144
+ name: Option.fromUndefinedOr(manifest.name),
14145
+ library: Predicate.isNotUndefined(manifest.exports) || Predicate.isNotUndefined(manifest.main) || Array.contains(crateLibraries, directory),
14146
+ entry: manifest.private !== true || Predicate.isNotUndefined(manifest.bin) || pipe(deployed, Array.some(isWithin(directory)))
14147
+ })));
14148
+ });
14149
+ const linksTo = (members, from) => (name) => pipe(members, Array.filter((member) => Option.contains(member.name, name)), Array.map(({ directory }) => ({
14150
+ from,
14151
+ to: directory
14152
+ })));
14153
+ const taskLinks = Effect.fn("taskLinks")(function* taskLinks(root, members) {
14154
+ const sources = [ROOT_DIRECTORY, ...pipe(members, Array.map(({ directory }) => directory))];
14155
+ const found = yield* Effect.forEach(sources, (from) => {
14156
+ const toLinks = Array.flatMap(linksTo(members, from));
14157
+ return taskTargets(root, from).pipe(Effect.map(toLinks));
14158
+ }, { concurrency: READ_CONCURRENCY });
14159
+ return Array.flatten(found);
14160
+ });
14161
+ /** @internal */
14162
+ const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* checkUnusedWorkspaces(root) {
14163
+ const files = yield* RepositoryFiles;
14164
+ const directories = yield* workspaceDirectories(root);
14165
+ const [cargo, deployed, lockedLinks] = yield* Effect.all([
14166
+ cargoFacts(root, directories),
14167
+ deployEntries(root),
14168
+ workspaceLinks(root)
14169
+ ], { concurrency: "unbounded" });
14170
+ const found = yield* Effect.forEach(directories, (directory) => memberOf({
14171
+ root,
14172
+ directory,
14173
+ crateLibraries: cargo.libraries,
14174
+ deployed
14175
+ }), { concurrency: READ_CONCURRENCY });
14176
+ const members = Array.getSomes(found);
14177
+ const tasks = yield* taskLinks(root, members);
14178
+ const links = [
14179
+ ...lockedLinks,
14180
+ ...cargo.links,
14181
+ ...tasks
14182
+ ];
14183
+ return pipe(members, Array.filter(({ library, entry }) => library && !entry), Array.filter((member) => !isDependedOn(links)(member)), Array.map(({ directory }) => ({
14184
+ file: files.join(root, directory, MANIFEST_FILE$3),
14185
+ line: FIRST,
14186
+ column: FIRST,
14187
+ rule: RULE,
14188
+ 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.`
14189
+ })));
14190
+ });
14344
14191
  // src/app/manifest-checks.ts
14345
14192
  /** @internal */
14346
14193
  const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
14347
- const found = yield* Effect.all([checkNodeVersion(root), checkPackageScope(root)], { concurrency: "unbounded" });
14194
+ const found = yield* Effect.all([
14195
+ checkNodeVersion(root),
14196
+ checkPackageScope(root),
14197
+ checkUnusedWorkspaces(root),
14198
+ checkExactVersions(root)
14199
+ ], { concurrency: "unbounded" });
14348
14200
  return Array.flatten(found);
14349
14201
  });
14350
14202
  // src/app/tracked-text.ts
@@ -14386,27 +14238,6 @@ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
14386
14238
  ], { concurrency: "unbounded" });
14387
14239
  return Array.flatten(found);
14388
14240
  });
14389
- // src/app/output.ts
14390
- const taggedError = Schema.TaggedError;
14391
- var ProblemsFound = class extends taggedError()("ProblemsFound", { count: Schema.Finite }) {};
14392
- /** @internal */
14393
- const writeStdout = Effect.fn("writeStdout")(function* writeStdout(text) {
14394
- const stdio = yield* Stdio.Stdio;
14395
- yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);
14396
- });
14397
- // src/app/runtime.ts
14398
- const reportFailure = (cause) => Effect.gen(function* report() {
14399
- const stdio = yield* Stdio.Stdio;
14400
- if (Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)))) return;
14401
- yield* Stream.make(`${Cause.pretty(cause)}\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);
14402
- });
14403
- const tracing = Otlp.layerFromConfig({ resource: { serviceName: "msch" } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));
14404
- /** @internal */
14405
- const runCli = (program) => {
14406
- const services = Layer.mergeAll(nodeRepositoryFiles, tracing).pipe(Layer.provideMerge(nodeServicesLayer));
14407
- const main = Layer.build(services).pipe(Effect.flatMap((context) => Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context)), Effect.scoped);
14408
- runMain(main, { disableErrorReporting: true });
14409
- };
14410
14241
  // bin/msch.ts
14411
14242
  const NO_PROBLEMS = 0;
14412
14243
  const ONE_FAILURE = 1;
@@ -14441,7 +14272,7 @@ const checkEverything = Effect.fn("checkEverything")(function* checkEverything(r
14441
14272
  const toolFailures = yield* toolChecks(root, []);
14442
14273
  return yield* failWhenAny(problems.length + toolFailures);
14443
14274
  });
14444
- runCli(Effect.gen(function* msch() {
14275
+ const msch = Effect.gen(function* msch() {
14445
14276
  const stdio = yield* Stdio.Stdio;
14446
14277
  const files = yield* RepositoryFiles;
14447
14278
  const args = yield* stdio.args;
@@ -14449,7 +14280,8 @@ runCli(Effect.gen(function* msch() {
14449
14280
  if (args.includes("--json")) return yield* writeJson(root);
14450
14281
  if (Array.isReadonlyArrayNonEmpty(args)) return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));
14451
14282
  return yield* checkEverything(root);
14452
- }));
14283
+ });
14284
+ runCli(msch);
14453
14285
  export {};
14454
14286
 
14455
14287
  //# sourceMappingURL=cli.mjs.map