@r_masseater/msch 0.38.1 → 0.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -1,19 +1,20 @@
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-DnxpBVTG.mjs";
3
- import { a as groupOf$2, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-R0NW0NE9.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 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";
4
4
  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-mzluqQvf.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";
6
6
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
7
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";
8
8
  import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
9
9
  import { ChildProcess } from "effect/process";
10
10
  import { parse, resolveConfigFromFile } from "vite-plus";
11
11
  import { parse as parse$1 } from "@pnpm/deps.path";
12
+ import { fileURLToPath } from "node:url";
13
+ import treeSitter from "@vscode/tree-sitter-wasm";
12
14
  import { Parser, isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
13
15
  import semver from "semver";
16
+ import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
14
17
  import path from "node:path";
15
- import { fileURLToPath } from "node:url";
16
- import treeSitter from "@vscode/tree-sitter-wasm";
17
18
  import { isComment, isTag, isText } from "domhandler";
18
19
  import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
19
20
  import { DockerfileParser } from "dockerfile-ast";
@@ -49,10 +50,10 @@ const overrideProblem = (located) => (report) => {
49
50
  return Option.none();
50
51
  };
51
52
  // src/shared/lib/text-position.ts
52
- const START$14 = 0;
53
+ const START$16 = 0;
53
54
  const FIRST_COLUMN$4 = 1;
54
55
  const positionOf = (source) => (index) => {
55
- const before = pipe(source, String$1.slice(START$14, index), String$1.split("\n"));
56
+ const before = pipe(source, String$1.slice(START$16, index), String$1.split("\n"));
56
57
  return {
57
58
  line: before.length,
58
59
  column: pipe(Array.last(before), Option.match({
@@ -197,18 +198,18 @@ const withBaselineProbe = (overrides) => ({
197
198
  [BASELINE_PROBE]: REMOVED_DEPENDENCY
198
199
  });
199
200
  // src/features/check-overrides/model/overrides.ts
200
- const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
201
+ const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
201
202
  const RESOLUTION_FILES = [
202
203
  "*package.json",
203
- WORKSPACE_FILE$4,
204
+ WORKSPACE_FILE$5,
204
205
  "pnpm-lock.yaml",
205
206
  ".npmrc",
206
207
  "patches/*"
207
208
  ];
208
209
  const RESOLUTION_CONCURRENCY = 4;
209
210
  const SUCCEEDED$1 = 0;
210
- const taggedError$5 = Schema.TaggedError;
211
- var OverrideResolutionFailed = class extends taggedError$5()("OverrideResolutionFailed", {
211
+ const taggedError$7 = Schema.TaggedError;
212
+ var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
212
213
  override: Schema.String,
213
214
  output: Schema.String
214
215
  }) {};
@@ -260,9 +261,11 @@ const copyFiles = Effect.fn("copyFiles")(function* copyFiles(workspace, director
260
261
  const fs = yield* FileSystem.FileSystem;
261
262
  const path = yield* Path.Path;
262
263
  const copyOne = (file) => {
264
+ const source = path.join(workspace.root, file);
263
265
  const target = path.join(directory, file);
264
- const copy = fs.copyFile(path.join(workspace.root, file), target);
265
- return fs.makeDirectory(path.dirname(target), { recursive: true }).pipe(Effect.andThen(copy));
266
+ const copy = fs.copyFile(source, target);
267
+ const write = fs.makeDirectory(path.dirname(target), { recursive: true }).pipe(Effect.andThen(copy));
268
+ return Effect.when(write, fs.exists(source));
266
269
  };
267
270
  yield* Effect.forEach(workspace.files, copyOne, {
268
271
  concurrency: 1,
@@ -304,7 +307,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, overrid
304
307
  };
305
308
  const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));
306
309
  const judgeAgainstBaseline = judge(baseline);
307
- const file = path.join(root, WORKSPACE_FILE$4);
310
+ const file = path.join(root, WORKSPACE_FILE$5);
308
311
  const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(Effect.map((candidate) => overrideProblem({
309
312
  ...located,
310
313
  file
@@ -316,7 +319,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, overrid
316
319
  const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
317
320
  const fs = yield* FileSystem.FileSystem;
318
321
  const path = yield* Path.Path;
319
- const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$4)).pipe(Effect.option);
322
+ const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$5)).pipe(Effect.option);
320
323
  const manifest = yield* workspaceManifest(root);
321
324
  const overrides = pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)), Option.getOrElse(() => ({})));
322
325
  const keys = pipe(source, Option.map((text) => overrideKeysOf(text)(overrides)), Option.getOrElse(() => []));
@@ -327,7 +330,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
327
330
  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;
328
331
  const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
329
332
  const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
330
- const READ_CONCURRENCY$26 = 64;
333
+ const READ_CONCURRENCY$27 = 64;
331
334
  const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
332
335
  const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
333
336
  /** @internal */
@@ -350,73 +353,119 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
350
353
  const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
351
354
  onNone: () => [],
352
355
  onSome: (source) => problemsIn(entry, source)
353
- }))), { concurrency: READ_CONCURRENCY$26 });
356
+ }))), { concurrency: READ_CONCURRENCY$27 });
354
357
  return Array.flatten(found);
355
358
  });
356
359
  // src/features/check-overrides/model/git-subpath.ts
357
360
  const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
358
361
  const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
359
- const RULE$40 = "git-subpath-dependency";
362
+ const RULE$43 = "git-subpath-dependency";
360
363
  const WHOLE_MATCH$3 = 0;
361
364
  const problemAt$8 = ({ file }, source) => (found) => ({
362
365
  file,
363
366
  ...positionOf(source)(found.index ?? WHOLE_MATCH$3),
364
- rule: RULE$40,
367
+ rule: RULE$43,
365
368
  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])}\`.`
366
369
  });
367
- const problemsIn$15 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$8(entry, source)));
370
+ const problemsIn$16 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$8(entry, source)));
368
371
  const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
369
372
  /** @internal */
370
373
  const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
371
374
  const listed = yield* listedFiles(root);
372
- return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$15);
375
+ return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$16);
373
376
  });
374
377
  // src/features/check-overrides/model/restricted-rules.ts
375
- const RULE$39 = "unnamed-restriction";
378
+ const RULE$42 = "unnamed-restriction";
376
379
  const WHOLE_MATCH$2 = 0;
377
380
  const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
378
- const problemsIn$14 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
381
+ const problemsIn$15 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
379
382
  file: entry.file,
380
383
  ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
381
- rule: RULE$39,
384
+ rule: RULE$42,
382
385
  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.`
383
386
  })));
384
387
  /** @internal */
385
388
  const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
386
389
  const listed = yield* listedFiles(root);
387
- return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$14);
390
+ return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$15);
391
+ });
392
+ // src/features/check-overrides/model/package-registry.ts
393
+ const RULE$41 = "package-registry";
394
+ const REGISTRY = "https://npm.flatt.tech/";
395
+ const TRAILING_SLASH = /\/$/u;
396
+ const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
397
+ const NPMRC = /(?:^|\/)\.npmrc$/u;
398
+ const WORKSPACE_REGISTRY = /^registry:/mu;
399
+ const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
400
+ const START$15 = 0;
401
+ const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
402
+ const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
403
+ const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
404
+ const withoutSlash = String$1.replace(TRAILING_SLASH, "");
405
+ const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
406
+ const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$15));
407
+ const workspaceProblem = (file, source, registry) => ({
408
+ file,
409
+ ...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
410
+ rule: RULE$41,
411
+ message: Option.match(registry, {
412
+ onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$4}.`,
413
+ onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
414
+ })
415
+ });
416
+ 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
+ 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.`
421
+ })));
422
+ const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
423
+ const files = yield* RepositoryFiles;
424
+ const manifest = yield* workspaceManifest(root);
425
+ if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) return [];
426
+ const registry = registryOf(manifest.value);
427
+ const file = files.join(root, WORKSPACE_FILE$4);
428
+ const read = yield* files.readFile(file);
429
+ const source = Option.getOrElse(read, () => "");
430
+ return [workspaceProblem(file, source, registry)];
431
+ });
432
+ /** @internal */
433
+ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPackageRegistry(root) {
434
+ const listed = yield* listedFiles(root);
435
+ const overrides = yield* scanText(pipe(listed, Array.filter(({ name }) => NPMRC.test(name))), npmrcProblems);
436
+ return [...yield* checkWorkspace(root), ...overrides];
388
437
  });
389
438
  // src/features/check-placement/model/colocated-git-patterns.ts
390
- const RULE$38 = "colocated-git-patterns";
439
+ const RULE$40 = "colocated-git-patterns";
391
440
  const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
392
441
  const ROOT$2 = ".";
393
- const SEPARATOR$21 = "/";
442
+ const SEPARATOR$22 = "/";
394
443
  const NEGATION$1 = "!";
395
444
  const COMMENT$1 = "#";
396
445
  const ANY_DEPTH = "**";
397
- const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$21}`;
446
+ const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$22}`;
398
447
  const LEADING_SLASHES = /^\/+/u;
399
448
  const TRAILING_SLASHES = /\/+$/u;
400
449
  const SPACES = /\s+/u;
401
- const FIRST$19 = 1;
402
- const READ_CONCURRENCY$25 = 16;
403
- const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$21}`)(inner));
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));
404
453
  const withoutPrefix = (prefix, text) => {
405
454
  if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
406
455
  return text;
407
456
  };
408
457
  const isAnchored = (pattern) => {
409
458
  const body = withoutPrefix(NEGATION$1, pattern);
410
- return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$21));
459
+ return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$22));
411
460
  };
412
- const segmentsOf = ({ directory, pattern }) => {
461
+ const segmentsOf$1 = ({ directory, pattern }) => {
413
462
  const body = withoutPrefix(NEGATION$1, pattern);
414
463
  const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
415
- const own = String$1.split(SEPARATOR$21)(trimmed);
464
+ const own = String$1.split(SEPARATOR$22)(trimmed);
416
465
  if (directory === ROOT$2) return own;
417
- return [...String$1.split(SEPARATOR$21)(directory), ...own];
466
+ return [...String$1.split(SEPARATOR$22)(directory), ...own];
418
467
  };
419
- const depthOf = (directory) => String$1.split(SEPARATOR$21)(directory).length;
468
+ const depthOf = (directory) => String$1.split(SEPARATOR$22)(directory).length;
420
469
  const entryOf$1 = (file, kind, directory) => (line, index) => {
421
470
  const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
422
471
  if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT$1)(pattern)) return Option.none();
@@ -424,7 +473,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
424
473
  file,
425
474
  kind,
426
475
  directory,
427
- line: index + FIRST$19,
476
+ line: index + FIRST$20,
428
477
  pattern,
429
478
  values: Array.join(values, " ")
430
479
  });
@@ -439,12 +488,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
439
488
  const problemAt$7 = (entry, message) => ({
440
489
  file: entry.file,
441
490
  line: entry.line,
442
- column: FIRST$19,
443
- rule: RULE$38,
491
+ column: FIRST$20,
492
+ rule: RULE$40,
444
493
  message
445
494
  });
446
495
  const misplacedMessage = (kind, workspaces) => {
447
- if (workspaces.length === FIRST$19) {
496
+ if (workspaces.length === FIRST$20) {
448
497
  const workspace = Array.join(workspaces, "");
449
498
  return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
450
499
  }
@@ -454,12 +503,12 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
454
503
  const files = yield* RepositoryFiles;
455
504
  const leading = Array.take(segments, depth);
456
505
  if (Array.contains(leading, ANY_DEPTH)) return [];
457
- const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$21)}${SEPARATOR$21}${MANIFEST_FILE$1}`]);
506
+ const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$22)}${SEPARATOR$22}${MANIFEST_FILE$1}`]);
458
507
  return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
459
508
  });
460
509
  const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
461
510
  const matchedWorkspaces = Effect.fn("matchedWorkspaces")(function* matchedWorkspaces(root, workspaces, entry) {
462
- const segments = segmentsOf(entry);
511
+ const segments = segmentsOf$1(entry);
463
512
  const candidates = pipe(workspaces, Array.filter(isInside(entry.directory)), Array.filter((workspace) => depthOf(workspace) < segments.length));
464
513
  const depths = pipe(candidates, Array.map(depthOf), Array.dedupe);
465
514
  const matched = yield* Effect.forEach(depths, (depth) => matchedAtDepth(root, segments, depth), { concurrency: 1 });
@@ -475,12 +524,12 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
475
524
  const isFloating = (pattern) => !String$1.startsWith(NEGATION$1)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
476
525
  const ownLevelName = (pattern) => {
477
526
  if (isFloating(pattern)) return Option.some(pattern);
478
- const name = withoutPrefix(SEPARATOR$21, pattern);
527
+ const name = withoutPrefix(SEPARATOR$22, pattern);
479
528
  return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));
480
529
  };
481
530
  const sameName = (outer, name) => {
482
531
  if (outer === name) return true;
483
- return String$1.endsWith(SEPARATOR$21)(name) && `${outer}${SEPARATOR$21}` === name;
532
+ return String$1.endsWith(SEPARATOR$22)(name) && `${outer}${SEPARATOR$22}` === name;
484
533
  };
485
534
  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);
486
535
  const outerName = ({ directory, kind }) => {
@@ -494,21 +543,21 @@ const repeated = (entries) => (entry) => {
494
543
  /** @internal */
495
544
  const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
496
545
  const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
497
- const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$25 });
546
+ const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$26 });
498
547
  const entries = Array.flatten(read);
499
548
  const workspaces = yield* workspaceDirectories(root);
500
- const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$25 });
549
+ const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$26 });
501
550
  const repeatedFound = pipe(entries, Array.map(repeated(entries)));
502
551
  return Array.getSomes([...misplacedFound, ...repeatedFound]);
503
552
  });
504
553
  // src/features/check-placement/model/colocated-tests.ts
505
- const RULE$37 = "colocated-test";
506
- const FIRST$18 = 1;
507
- const READ_CONCURRENCY$24 = 64;
554
+ const RULE$39 = "colocated-test";
555
+ const FIRST$19 = 1;
556
+ const READ_CONCURRENCY$25 = 64;
508
557
  const ROOT_SUBPATH = ".";
509
558
  const NAME_GROUP = "name";
510
559
  const SPECIFIER_GROUP = "specifier";
511
- const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
560
+ const SCRIPT$3 = /\.[cm]?[jt]sx?$/u;
512
561
  const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
513
562
  const MANIFEST_NAME = /package\.json$/u;
514
563
  const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
@@ -517,27 +566,27 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
517
566
  const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
518
567
  const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
519
568
  const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
520
- const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
569
+ const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
521
570
  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.";
522
571
  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>.";
523
- const Manifest$3 = Schema.Struct({
572
+ const Manifest$4 = Schema.Struct({
524
573
  name: Schema.optional(Schema.String),
525
574
  exports: Schema.optional(Schema.Unknown)
526
575
  });
527
- const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
528
- const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
576
+ const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
577
+ const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
529
578
  const problemFor$6 = (test, message) => ({
530
579
  file: test.file,
531
- line: FIRST$18,
532
- column: FIRST$18,
533
- rule: RULE$37,
580
+ line: FIRST$19,
581
+ column: FIRST$19,
582
+ rule: RULE$39,
534
583
  message: `${test.base} ${message}`
535
584
  });
536
585
  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);
537
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)));
538
587
  const ownerOf$4 = (packages, name) => {
539
588
  const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
540
- return Array.last(Array.sort(owners, byLength$1));
589
+ return Array.last(Array.sort(owners, byLength$2));
541
590
  };
542
591
  const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.map((name) => pipe(publicEntriesOf({
543
592
  manifest,
@@ -550,7 +599,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
550
599
  if (Option.isNone(owner)) return [];
551
600
  const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$1));
552
601
  const join = (target) => files.join(context.root, owner.value, target);
553
- return pipe(text, Option.flatMap(decodeManifest$6), Option.map(specifiersBeside({
602
+ return pipe(text, Option.flatMap(decodeManifest$7), Option.map(specifiersBeside({
554
603
  join,
555
604
  dirname: files.dirname,
556
605
  directory: test.directory
@@ -578,13 +627,13 @@ const problemIn$6 = Effect.fn("problemIn")(function* problemIn(context, test) {
578
627
  /** @internal */
579
628
  const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
580
629
  const files = yield* RepositoryFiles;
581
- const listed = yield* files.matchingFiles(root, EXCLUDED$3);
630
+ const listed = yield* files.matchingFiles(root, EXCLUDED$5);
582
631
  const names = pipe(listed, Array.filter(String$1.isNonEmpty));
583
632
  const context = {
584
633
  root,
585
634
  packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE$1), Array.map(String$1.replace(MANIFEST_NAME, "")))
586
635
  };
587
- const tests = pipe(names, Array.filter((name) => SCRIPT$2.test(name)), Array.map((name) => {
636
+ const tests = pipe(names, Array.filter((name) => SCRIPT$3.test(name)), Array.map((name) => {
588
637
  const file = files.join(root, name);
589
638
  return {
590
639
  name,
@@ -593,12 +642,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
593
642
  directory: files.dirname(file)
594
643
  };
595
644
  }));
596
- const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$24 });
645
+ const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$25 });
597
646
  return Array.getSomes(found);
598
647
  });
599
648
  // src/shared/lib/agent-docs.ts
600
649
  const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
601
- const READ_CONCURRENCY$23 = 16;
650
+ const READ_CONCURRENCY$24 = 16;
602
651
  const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
603
652
  const files = yield* RepositoryFiles;
604
653
  const listed = yield* files.listedFiles(root);
@@ -607,32 +656,32 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
607
656
  const file = files.join(root, name);
608
657
  const problemOf = Option.flatMap(problemIn(file));
609
658
  return files.readFile(file).pipe(Effect.map(problemOf));
610
- }, { concurrency: READ_CONCURRENCY$23 });
659
+ }, { concurrency: READ_CONCURRENCY$24 });
611
660
  return Array.getSomes(found);
612
661
  });
613
662
  // src/features/check-placement/model/agent-docs-length.ts
614
663
  const RECOMMENDED_LINES = 200;
615
- const FIRST$17 = 1;
616
- const RULE$36 = "agent-docs-length";
664
+ const FIRST$18 = 1;
665
+ const RULE$38 = "agent-docs-length";
617
666
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
618
667
  const problemFor$5 = (file) => (lines) => {
619
668
  if (lines <= RECOMMENDED_LINES) return Option.none();
620
669
  return Option.some({
621
670
  file,
622
671
  line: 201,
623
- column: FIRST$17,
624
- rule: RULE$36,
672
+ column: FIRST$18,
673
+ rule: RULE$38,
625
674
  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.`
626
675
  });
627
676
  };
628
677
  /** @internal */
629
678
  const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
630
679
  // src/features/check-placement/model/dangling-links.ts
631
- const RULE$35 = "dangling-link";
632
- const SEPARATOR$20 = "/";
633
- const FIRST$16 = 1;
634
- const READ_CONCURRENCY$22 = 16;
635
- const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
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);
636
685
  /** @internal */
637
686
  const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
638
687
  const files = yield* RepositoryFiles;
@@ -642,33 +691,33 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
642
691
  const link = yield* files.readLink(file);
643
692
  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) => ({
644
693
  file,
645
- line: FIRST$16,
646
- column: FIRST$16,
647
- rule: RULE$35,
694
+ line: FIRST$17,
695
+ column: FIRST$17,
696
+ rule: RULE$37,
648
697
  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.`
649
698
  })));
650
699
  });
651
- const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$22 });
700
+ const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$23 });
652
701
  return Array.getSomes(found);
653
702
  });
654
703
  // src/features/check-placement/model/nested-docs.ts
655
- const RULE$34 = "nested-docs";
656
- const CONFIG_FILE$5 = "vite.config.ts";
657
- const SEPARATOR$19 = "/";
658
- const FIRST$15 = 1;
659
- const READ_CONCURRENCY$21 = 64;
704
+ const RULE$36 = "nested-docs";
705
+ const CONFIG_FILE$6 = "vite.config.ts";
706
+ const SEPARATOR$20 = "/";
707
+ const FIRST$16 = 1;
708
+ const READ_CONCURRENCY$22 = 64;
660
709
  const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
661
710
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
662
711
  const README = /^README(?:\.[^/]+)?$/iu;
663
712
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
664
- const taggedError$4 = Schema.TaggedError;
665
- var RootConfigUnreadable = class extends taggedError$4()("RootConfigUnreadable", { file: Schema.String }) {};
666
- const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
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);
667
716
  const problemFor$4 = (file, message) => ({
668
717
  file,
669
- line: FIRST$15,
670
- column: FIRST$15,
671
- rule: RULE$34,
718
+ line: FIRST$16,
719
+ column: FIRST$16,
720
+ rule: RULE$36,
672
721
  message
673
722
  });
674
723
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
@@ -696,7 +745,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, na
696
745
  });
697
746
  const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
698
747
  const files = yield* RepositoryFiles;
699
- const file = files.join(root, CONFIG_FILE$5);
748
+ const file = files.join(root, CONFIG_FILE$6);
700
749
  if (!(yield* files.exists(file))) return false;
701
750
  const config = yield* Effect.tryPromise({
702
751
  try: () => resolveConfigFromFile(file),
@@ -715,13 +764,13 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
715
764
  workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
716
765
  workspaceAgentDocs
717
766
  };
718
- const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$21 });
767
+ const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$22 });
719
768
  return Array.getSomes(found);
720
769
  });
721
770
  // src/features/check-placement/model/published-readme.ts
722
- const RULE$33 = "published-readme";
771
+ const RULE$35 = "published-readme";
723
772
  const README_FILE = "README.md";
724
- const READ_CONCURRENCY$20 = 16;
773
+ const READ_CONCURRENCY$21 = 16;
725
774
  const MESSAGE$11 = "contains Japanese. This package is published to npm, so write its README in English.";
726
775
  const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
727
776
  const files = yield* RepositoryFiles;
@@ -733,7 +782,7 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
733
782
  file,
734
783
  line,
735
784
  column,
736
- rule: RULE$33,
785
+ rule: RULE$35,
737
786
  message: MESSAGE$11
738
787
  };
739
788
  }))));
@@ -741,38 +790,38 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
741
790
  /** @internal */
742
791
  const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
743
792
  const projects = yield* publishedProjects(root);
744
- const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$20 });
793
+ const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$21 });
745
794
  return Array.getSomes(found);
746
795
  });
747
796
  // src/features/check-placement/model/root-docs.ts
748
- const RULE$32 = "root-docs";
749
- const SEPARATOR$18 = "/";
750
- const FIRST$14 = 1;
797
+ const RULE$34 = "root-docs";
798
+ const SEPARATOR$19 = "/";
799
+ const FIRST$15 = 1;
751
800
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
752
801
  const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
753
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.";
754
- const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
803
+ const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$19)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
755
804
  /** @internal */
756
805
  const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
757
806
  const files = yield* RepositoryFiles;
758
807
  const names = yield* files.listedFiles(root);
759
808
  return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
760
809
  file: files.join(root, name),
761
- line: FIRST$14,
762
- column: FIRST$14,
763
- rule: RULE$32,
810
+ line: FIRST$15,
811
+ column: FIRST$15,
812
+ rule: RULE$34,
764
813
  message: `${name} ${MESSAGE$10}`
765
814
  })));
766
815
  });
767
816
  // src/features/check-placement/model/root-readme.ts
768
- const RULE$31 = "root-readme";
817
+ const RULE$33 = "root-readme";
769
818
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
770
- const READ_CONCURRENCY$19 = 16;
771
- const START$13 = 0;
819
+ const READ_CONCURRENCY$20 = 16;
820
+ const START$14 = 0;
772
821
  const CHECK_POLICY = "@r_masseater/msch";
773
822
  const MARKETPLACE = ".claude-plugin/marketplace.json";
774
823
  const RELATIVE$1 = /^\.\//u;
775
- const SEPARATOR$17 = "/";
824
+ const SEPARATOR$18 = "/";
776
825
  const MarketplacePlugin = Schema.Struct({
777
826
  name: Schema.optional(Schema.String),
778
827
  source: Schema.Unknown
@@ -784,7 +833,7 @@ const NO_PLUGINS = {
784
833
  };
785
834
  const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
786
835
  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.`;
787
- const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$17)(directory), Array.last, Option.getOrElse(() => directory));
836
+ const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$18)(directory), Array.last, Option.getOrElse(() => directory));
788
837
  const pluginsOf = (plugins) => {
789
838
  const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
790
839
  const segments = pipe(directories, Array.map(lastSegment));
@@ -807,14 +856,14 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
807
856
  onNone: () => ownNames(plugins, names),
808
857
  onSome: () => [directory]
809
858
  }));
810
- const problemsIn$13 = (file, source, plugins) => (workspace) => {
859
+ const problemsIn$14 = (file, source, plugins) => (workspace) => {
811
860
  const message = messageFor(workspace.directory);
812
861
  const at = positionOf(source);
813
862
  const pattern = patternFor(plugins)(workspace);
814
863
  return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
815
864
  file,
816
- ...at(found.index ?? START$13),
817
- rule: RULE$31,
865
+ ...at(found.index ?? START$14),
866
+ rule: RULE$33,
818
867
  message
819
868
  })));
820
869
  };
@@ -822,7 +871,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
822
871
  const text = yield* (yield* RepositoryFiles).readFile(file);
823
872
  return pipe(text, Option.match({
824
873
  onNone: () => [],
825
- onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$13(file, source, plugins)))
874
+ onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$14(file, source, plugins)))
826
875
  }));
827
876
  });
828
877
  /** @internal */
@@ -833,7 +882,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
833
882
  const named = yield* namedWorkspaces(root);
834
883
  const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
835
884
  const plugins = yield* marketplacePlugins(root);
836
- const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$19 });
885
+ const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$20 });
837
886
  return Array.flatten(found);
838
887
  });
839
888
  // src/features/check-placement/model/doc-placement.ts
@@ -850,10 +899,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
850
899
  return Array.flatten(found);
851
900
  });
852
901
  // src/features/check-placement/model/docs-mirror.ts
853
- const RULE$30 = "docs-mirror";
902
+ const RULE$32 = "docs-mirror";
854
903
  const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
855
904
  const MIRROR_LIMIT = 3;
856
- const READ_CONCURRENCY$18 = 16;
905
+ const READ_CONCURRENCY$19 = 16;
857
906
  const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
858
907
  const BEFORE = String.raw`(?<![\w@/.-])`;
859
908
  const AFTER = String.raw`(?![\w@.-])`;
@@ -875,7 +924,7 @@ const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Opti
875
924
  file,
876
925
  line,
877
926
  column,
878
- rule: RULE$30,
927
+ rule: RULE$32,
879
928
  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.`
880
929
  };
881
930
  }), Option.toArray);
@@ -890,7 +939,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
890
939
  return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
891
940
  directory,
892
941
  names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
893
- }))), { concurrency: READ_CONCURRENCY$18 });
942
+ }))), { concurrency: READ_CONCURRENCY$19 });
894
943
  });
895
944
  /** @internal */
896
945
  const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
@@ -903,13 +952,13 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
903
952
  onNone: () => [],
904
953
  onSome: (text) => problemIn$3(workspaces)(doc, file, text)
905
954
  })));
906
- }, { concurrency: READ_CONCURRENCY$18 });
955
+ }, { concurrency: READ_CONCURRENCY$19 });
907
956
  return Array.flatten(found);
908
957
  });
909
958
  // src/features/check-placement/model/ignored-sources.ts
910
- const RULE$29 = "ignored-sources";
959
+ const RULE$31 = "ignored-sources";
911
960
  const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
912
- const FIRST$13 = 1;
961
+ const FIRST$14 = 1;
913
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.";
914
963
  /** @internal */
915
964
  const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
@@ -917,17 +966,17 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
917
966
  const ignored = yield* files.ignoredFiles(root, SOURCES);
918
967
  return pipe(ignored, Array.map((file) => ({
919
968
  file: files.join(root, file),
920
- line: FIRST$13,
921
- column: FIRST$13,
922
- rule: RULE$29,
969
+ line: FIRST$14,
970
+ column: FIRST$14,
971
+ rule: RULE$31,
923
972
  message: MESSAGE$9
924
973
  })));
925
974
  });
926
975
  // src/features/check-placement/model/member-sources.ts
927
976
  const ROOT_WORKSPACE$1 = ".";
928
- const FIRST$12 = 1;
929
- const SEPARATOR$16 = "/";
930
- const EXCLUDED$2 = [
977
+ const FIRST$13 = 1;
978
+ const SEPARATOR$17 = "/";
979
+ const EXCLUDED$4 = [
931
980
  ":(exclude,attr:linguist-vendored)",
932
981
  ":(exclude,attr:linguist-generated)",
933
982
  ":(exclude,attr:linguist-documentation)"
@@ -940,28 +989,28 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
940
989
  const files = yield* RepositoryFiles;
941
990
  return {
942
991
  workspaces: yield* memberWorkspaces(root),
943
- listed: yield* files.matchingFiles(root, EXCLUDED$2)
992
+ listed: yield* files.matchingFiles(root, EXCLUDED$4)
944
993
  };
945
994
  });
946
- const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
995
+ const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
947
996
  const fileProblem$1 = ({ file, rule, message }) => ({
948
997
  file,
949
- line: FIRST$12,
950
- column: FIRST$12,
998
+ line: FIRST$13,
999
+ column: FIRST$13,
951
1000
  rule,
952
1001
  message
953
1002
  });
954
- const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$16}`)(name)), (owners) => Array.last(Array.sort(owners, byLength)), Option.map((workspace) => ({
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) => ({
955
1004
  workspace,
956
1005
  inner: String$1.slice(workspace.length + 1)(name)
957
1006
  })));
958
1007
  // src/features/check-placement/model/layered-source.ts
959
- const LAYERED_RULE = "layered-source";
960
- const ENTRY_RULE$2 = "public-entry";
961
- const SOURCE_DIRECTORY = "src";
962
- const SEPARATOR$15 = "/";
1008
+ const LAYERED_RULE$1 = "layered-source";
1009
+ const ENTRY_RULE$3 = "public-entry";
1010
+ const SOURCE_DIRECTORY$1 = "src";
1011
+ const SEPARATOR$16 = "/";
963
1012
  const LOOSE_DEPTH = 2;
964
- const LAYERS = [
1013
+ const LAYERS$1 = [
965
1014
  "app",
966
1015
  "pages",
967
1016
  "widgets",
@@ -969,22 +1018,22 @@ const LAYERS = [
969
1018
  "entities",
970
1019
  "shared"
971
1020
  ];
972
- const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
1021
+ const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
973
1022
  const ROOT_ALLOWED = /^(?:[^/]+\.config\.[cm]?[jt]s|alchemy\.[^/]+\.ts|[^/]+\.d\.[cm]?ts|bin\/.+)$/u;
974
1023
  const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
975
- const OUTSIDE_MESSAGE = "sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root.";
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.";
976
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.";
977
- const LAYER_MESSAGE = `is not an FSD layer. src/ holds only ${Array.join(LAYERS, ", ")}.`;
978
- const ENTRY_MESSAGE$1 = "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.";
1026
+ const LAYER_MESSAGE$1 = `is not an FSD layer. src/ holds only ${Array.join(LAYERS$1, ", ")}.`;
1027
+ 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.";
979
1028
  const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
980
1029
  const layerProblemOf = (owned) => {
981
- const parts = String$1.split(owned.inner, SEPARATOR$15);
1030
+ const parts = String$1.split(owned.inner, SEPARATOR$16);
982
1031
  const [top, layer] = parts;
983
- if (top !== SOURCE_DIRECTORY) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$15}${owned.inner}`, OUTSIDE_MESSAGE], () => !ROOT_ALLOWED.test(owned.inner));
984
- if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$15}${owned.inner}`, LOOSE_MESSAGE]);
985
- return Option.liftPredicate([`${owned.workspace}${SEPARATOR$15}${SOURCE_DIRECTORY}${SEPARATOR$15}${layer}`, LAYER_MESSAGE], () => !pipe(LAYERS, Array.contains(layer ?? "")));
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 ?? "")));
986
1035
  };
987
- const entryProblems$1 = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
1036
+ const entryProblems$2 = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
988
1037
  const files = yield* RepositoryFiles;
989
1038
  const directory = files.join(root, workspace);
990
1039
  const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$1));
@@ -995,55 +1044,257 @@ const entryProblems$1 = Effect.fn("entryProblems")(function* entryProblems(root,
995
1044
  packEntries: []
996
1045
  })), Option.getOrElse(() => []), Array.filter(({ source }) => !PUBLIC_ENTRY.test(files.relative(directory, source))), Array.map(({ label, source }) => fileProblem$1({
997
1046
  file: source,
998
- rule: ENTRY_RULE$2,
999
- message: `${label} ${ENTRY_MESSAGE$1}`
1047
+ rule: ENTRY_RULE$3,
1048
+ message: `${label} ${ENTRY_MESSAGE$2}`
1000
1049
  })));
1001
1050
  });
1002
1051
  /** @internal */
1003
1052
  const checkLayeredSource = Effect.fn("checkLayeredSource")(function* checkLayeredSource(root) {
1004
1053
  const files = yield* RepositoryFiles;
1005
1054
  const { workspaces, listed } = yield* memberSources(root);
1006
- const layered = pipe(listed, Array.filter((name) => SCRIPT$1.test(name)), Array.map(ownerOf$2(workspaces)), Array.getSomes, Array.map(layerProblemOf), Array.getSomes, Array.dedupeWith(([left], [right]) => left === right), Array.map(([file, message]) => fileProblem$1({
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({
1007
1056
  file: files.join(root, file),
1008
- rule: LAYERED_RULE,
1057
+ rule: LAYERED_RULE$1,
1009
1058
  message
1010
1059
  })));
1011
- const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems$1(root, workspace), { concurrency: 1 });
1060
+ const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems$2(root, workspace), { concurrency: 1 });
1012
1061
  return [...layered, ...Array.flatten(entries)];
1013
1062
  });
1014
- // src/features/check-placement/model/source-aliases.ts
1015
- const ALIAS_RULE = "source-alias";
1016
- const FIRST$11 = 1;
1017
- const SOURCE_ALIAS = "#/*";
1018
- const SOURCE_TARGET = "./src/*";
1019
- const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
1020
- 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.`;
1021
- const Manifest$2 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
1022
- const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
1023
- const problemAt$6 = (file, rule, message) => ({
1024
- file,
1025
- line: FIRST$11,
1026
- column: FIRST$11,
1027
- rule,
1028
- message
1029
- });
1030
- const targetsOf = (target) => {
1031
- if (Predicate.isString(target)) return [target];
1032
- if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
1033
- return [];
1063
+ // src/shared/lib/tree-sitter.ts
1064
+ const taggedError$5 = Schema.TaggedError;
1065
+ var GrammarUnreadable = class extends taggedError$5()("GrammarUnreadable", {
1066
+ grammar: Schema.String,
1067
+ message: Schema.String
1068
+ }) {};
1069
+ 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
+ });
1034
1077
  };
1035
- 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)));
1036
- const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
1037
- const files = yield* RepositoryFiles;
1038
- const manifest = files.join(root, workspace, MANIFEST_FILE$1);
1039
- const text = yield* files.readFile(manifest);
1040
- return pipe(text, Option.flatMap(decodeManifest$5), 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}`)));
1041
- });
1042
- /** @internal */
1043
- const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
1044
- const workspaces = yield* memberWorkspaces(root);
1045
- const aliases = yield* Effect.forEach(workspaces, (workspace) => aliasProblems(root, workspace), { concurrency: 1 });
1046
- return Array.flatten(aliases);
1078
+ const initParser = cache();
1079
+ const loadOnce = cache();
1080
+ const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
1081
+ const loadLanguage = (grammar) => {
1082
+ const unreadable = (cause) => GrammarUnreadable.make({
1083
+ grammar,
1084
+ message: String(cause)
1085
+ });
1086
+ return Effect.tryPromise({
1087
+ try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),
1088
+ catch: unreadable
1089
+ }).pipe(Effect.andThen(Effect.tryPromise({
1090
+ try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),
1091
+ catch: unreadable
1092
+ })));
1093
+ };
1094
+ const readTree = ({ language, source, read }) => {
1095
+ const parser = new treeSitter.Parser();
1096
+ parser.setLanguage(language);
1097
+ const tree = parser.parse(source);
1098
+ parser.delete();
1099
+ return Option.map(Option.fromNullishOr(tree), (parsed) => {
1100
+ const result = read(parsed.rootNode);
1101
+ parsed.delete();
1102
+ return result;
1103
+ });
1104
+ };
1105
+ // src/features/check-placement/model/rust-layout.ts
1106
+ const LAYERS = [
1107
+ "app",
1108
+ "pages",
1109
+ "widgets",
1110
+ "features",
1111
+ "entities",
1112
+ "shared"
1113
+ ];
1114
+ const RUST_FILE = /\.rs$/u;
1115
+ const BINARY = /^src\/bin\/[^/]+\.rs$/u;
1116
+ const MANIFEST$3 = /(?:^|\/)Cargo\.toml$/u;
1117
+ const MODULE_INDEX = "mod";
1118
+ const CRATE_ROOTS = ["src/lib.rs", "src/main.rs"];
1119
+ const OUTSIDE_ALLOWED = /^(?:build\.rs|benches\/.+)$/u;
1120
+ const SEPARATE_TEST = /^tests\/.+$/u;
1121
+ const SHARED_SLICES = ["app", "shared"];
1122
+ const SLICED_LAYERS = [
1123
+ "pages",
1124
+ "widgets",
1125
+ "features",
1126
+ "entities",
1127
+ "shared"
1128
+ ];
1129
+ const LAYER_DEPTH = 1;
1130
+ const SOURCE_PREFIX$1 = `src/`;
1131
+ 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
+ const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
1138
+ const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$3.test(name)), Array.map((name) => String$1.replace(MANIFEST$3, "")(name)));
1139
+ const ownedBy = (crate, name) => {
1140
+ if (crate === ROOT_CRATE) return {
1141
+ crate,
1142
+ inner: name
1143
+ };
1144
+ return {
1145
+ crate,
1146
+ inner: String$1.slice(crate.length + 1)(name)
1147
+ };
1148
+ };
1149
+ const crateOf = (crates) => (name) => pipe(crates, Array.filter((crate) => crate === ROOT_CRATE || String$1.startsWith(`${crate}/`)(name)), Array.match({
1150
+ onEmpty: () => Option.none(),
1151
+ onNonEmpty: (owners) => Option.some(Array.max(owners, byLength))
1152
+ }), Option.map((crate) => ownedBy(crate, name)));
1153
+ const modulePathOf = (inner) => {
1154
+ const parts = String$1.split(String$1.replace(RUST_FILE, "")(String$1.slice(SOURCE_PREFIX$1.length)(inner)), "/");
1155
+ if (Option.contains(Array.last(parts), MODULE_INDEX)) return Array.dropRight(parts, 1);
1156
+ return parts;
1157
+ };
1158
+ const sourceKindOf = (inner) => {
1159
+ const path = modulePathOf(inner);
1160
+ if (!Option.exists(Array.head(path), (layer) => Array.contains(LAYERS, layer))) return "misplaced";
1161
+ if (path.length === LAYER_DEPTH) return "layer";
1162
+ return "module";
1163
+ };
1164
+ const kindOf$1 = (inner) => {
1165
+ if (Array.contains(CRATE_ROOTS, inner) || BINARY.test(inner)) return "root";
1166
+ if (SEPARATE_TEST.test(inner)) return "test";
1167
+ if (OUTSIDE_ALLOWED.test(inner)) return "skipped";
1168
+ if (!String$1.startsWith(SOURCE_PREFIX$1)(inner)) return "misplaced";
1169
+ return sourceKindOf(inner);
1170
+ };
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
+ const isSliceIndex = (modulePath) => modulePath.length === 2 && Option.exists(Array.head(modulePath), (layer) => Array.contains(SLICED_LAYERS, layer));
1197
+ // 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
+ const IGNORED_ITEMS = ["line_comment", "block_comment"];
1205
+ const PATH_SEPARATOR = "::";
1206
+ const SELF = "self";
1207
+ const NEXT$4 = 1;
1208
+ const ALLOCATOR = "global_allocator";
1209
+ const field = (node, name) => Option.fromNullishOr(node.childForFieldName(name));
1210
+ 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
+ const itemOf = (node) => ({
1286
+ kind: node.type,
1287
+ name: Option.map(field(node, "name"), (name) => name.text),
1288
+ inline: Option.isSome(field(node, "body")),
1289
+ visible: Array.some(namedChildren(node), (child) => child.type === "visibility_modifier"),
1290
+ line: node.startPosition.row + NEXT$4,
1291
+ column: node.startPosition.column + NEXT$4
1292
+ });
1293
+ 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
+ const readRustFile = (root) => ({
1295
+ paths: [...importedPaths(root), ...anchoredPaths(root)],
1296
+ items: pipe(namedChildren(root), Array.filter((node) => !Array.contains(IGNORED_ITEMS, node.type)), Array.map(itemOf)),
1297
+ replacesAllocator: replacesAllocator(root)
1047
1298
  });
1048
1299
  // src/features/check-placement/model/english-verbs.json
1049
1300
  var english_verbs_default = [
@@ -9480,23 +9731,25 @@ var english_verbs_default = [
9480
9731
  "zoom"
9481
9732
  ];
9482
9733
  // src/features/check-placement/model/source-names.ts
9483
- const SLICE_RULE = "feature-slice-name";
9484
- const ENTRY_RULE$1 = "deploy-entry-name";
9734
+ const SLICE_RULE$1 = "feature-slice-name";
9735
+ const ENTRY_RULE$2 = "deploy-entry-name";
9485
9736
  const SEPARATOR$14 = "/";
9486
9737
  const NEXT$3 = 1;
9487
- const WORD_SEPARATOR = "-";
9738
+ const WORD_SEPARATOR$1 = "-";
9488
9739
  const MINIMUM_WORDS = 2;
9489
- const FEATURES = "src/features/";
9740
+ const FEATURES$1 = "src/features/";
9490
9741
  const SOURCE$1 = "src/";
9491
9742
  const DEPLOY_MARKER = /(?:^|[.-])entrypoints?(?=[.-]|$)|\.worker(?=\.)/iu;
9743
+ const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
9492
9744
  const VERBS = new Set(english_verbs_default);
9493
- 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).";
9494
- const ENTRY_MESSAGE = "is named after where it is deployed. Name it after what the code does; the Alchemy resource that deploys it decides which file is the entry.";
9495
- const isVerbObject = (slice) => {
9496
- const words = String$1.split(slice, WORD_SEPARATOR);
9745
+ const SLICE_MESSAGE$1 = "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).";
9746
+ const ENTRY_MESSAGE$1 = "is named after where it is deployed. Name it after what the code does; the Alchemy resource that deploys it decides which file is the entry.";
9747
+ const isVerbObjectBy = (separator) => (slice) => {
9748
+ const words = String$1.split(slice, separator);
9497
9749
  return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
9498
9750
  };
9499
- const misnamedSlice = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, String$1.startsWith(FEATURES)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$14))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$14}${FEATURES}${slice}`));
9751
+ const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
9752
+ const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$14))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$14}${FEATURES$1}${slice}`));
9500
9753
  const deployNamed = ({ workspace, inner }) => {
9501
9754
  if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
9502
9755
  const segments = String$1.split(inner, SEPARATOR$14);
@@ -9512,7 +9765,178 @@ const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceName
9512
9765
  rule,
9513
9766
  message
9514
9767
  })));
9515
- return [...report(SLICE_RULE, SLICE_MESSAGE)(pipe(owned, Array.map(misnamedSlice), Array.getSomes)), ...report(ENTRY_RULE$1, ENTRY_MESSAGE)(pipe(owned, Array.map(deployNamed), Array.getSomes))];
9768
+ return [...report(SLICE_RULE$1, SLICE_MESSAGE$1)(pipe(owned, Array.map(misnamedSlice$1), Array.getSomes)), ...report(ENTRY_RULE$2, ENTRY_MESSAGE$1)(pipe(owned, Array.map(deployNamed), Array.getSomes))];
9769
+ });
9770
+ // src/features/check-placement/model/rust-modules.ts
9771
+ const LAYERED_RULE = "layered-source";
9772
+ const ENTRY_RULE$1 = "public-entry";
9773
+ const TEST_RULE = "colocated-test";
9774
+ const SLICE_RULE = "feature-slice-name";
9775
+ const IMPORT_RULE = "layer-import";
9776
+ const GRAMMAR = "rust";
9777
+ const WORD_SEPARATOR = "_";
9778
+ const FEATURES = "features";
9779
+ const MAIN = "main";
9780
+ const MAIN_FILE = "src/main.rs";
9781
+ const ROOT_ITEMS = [
9782
+ "use_declaration",
9783
+ "attribute_item",
9784
+ "inner_attribute_item",
9785
+ "extern_crate_declaration"
9786
+ ];
9787
+ const LAYER_ITEMS = [
9788
+ "use_declaration",
9789
+ "attribute_item",
9790
+ "inner_attribute_item"
9791
+ ];
9792
+ const READ_CONCURRENCY$18 = 64;
9793
+ const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
9794
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ 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
+ const itemProblem = (file, rule, message) => ({ line, column }) => ({
9817
+ file,
9818
+ line,
9819
+ column,
9820
+ rule,
9821
+ message
9822
+ });
9823
+ const isRootItem = (inner) => (item) => {
9824
+ if (Array.contains(ROOT_ITEMS, item.kind)) return true;
9825
+ if (item.kind === "mod_item") return !item.inline && Option.exists(item.name, (name) => Array.contains(LAYERS, name));
9826
+ return item.kind === "function_item" && (inner === MAIN_FILE || BINARY.test(inner)) && Option.contains(item.name, MAIN);
9827
+ };
9828
+ 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
+ const entryProblems$1 = (file, modulePath, parsed) => {
9837
+ if (!isSliceIndex(modulePath)) return NONE$2;
9838
+ return pipe(parsed.items, Array.filter((item) => item.kind === "mod_item" && item.visible), Array.map(itemProblem(file, ENTRY_RULE$1, ENTRY_MESSAGE)));
9839
+ };
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
+ };
9844
+ const testProblems = ({ source, parsed }) => {
9845
+ if (parsed.replacesAllocator) return NONE$2;
9846
+ return [fileProblem$1({
9847
+ file: source.file,
9848
+ rule: TEST_RULE,
9849
+ message: TEST_MESSAGE
9850
+ })];
9851
+ };
9852
+ const strayItems = ({ source, parsed }, allowed, message) => pipe(parsed.items, Array.filter((item) => !allowed(item)), Array.map(itemProblem(source.file, LAYERED_RULE, message)));
9853
+ const PROBLEMS = {
9854
+ root: (read) => strayItems(read, isRootItem(read.source.inner), ROOT_MESSAGE),
9855
+ layer: (read) => strayItems(read, isLayerItem, LAYER_INDEX_MESSAGE),
9856
+ test: testProblems,
9857
+ module: moduleProblems,
9858
+ skipped: () => NONE$2,
9859
+ misplaced: () => NONE$2
9860
+ };
9861
+ const problemsOf$3 = (read) => PROBLEMS[kindOf$1(read.source.inner)](read);
9862
+ const misnamedSlice = ({ crate, inner }, root, join) => {
9863
+ const modulePath = modulePathOf(inner);
9864
+ 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)));
9865
+ };
9866
+ const sliceNameProblems = (root, join, sources) => pipe(sources, Array.filter(({ inner }) => kindOf$1(inner) === "module"), Array.flatMap((source) => Option.toArray(misnamedSlice(source, root, join))), Array.dedupe, Array.map((file) => fileProblem$1({
9867
+ file,
9868
+ rule: SLICE_RULE,
9869
+ message: SLICE_MESSAGE
9870
+ })));
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
+ const parsedWith = (language) => (source, text) => Option.map(readTree({
9873
+ language,
9874
+ source: text,
9875
+ read: readRustFile
9876
+ }), (parsed) => ({
9877
+ source,
9878
+ parsed
9879
+ }));
9880
+ const isRead = ({ inner }) => {
9881
+ const kind = kindOf$1(inner);
9882
+ return kind !== "misplaced" && kind !== "skipped";
9883
+ };
9884
+ const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
9885
+ const files = yield* RepositoryFiles;
9886
+ const listed = yield* files.matchingFiles(root, EXCLUDED$3);
9887
+ const owner = crateOf(crateDirectories(listed));
9888
+ return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
9889
+ ...owned,
9890
+ file: files.join(root, name)
9891
+ })))));
9892
+ });
9893
+ /** @internal */
9894
+ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModules(root) {
9895
+ const files = yield* RepositoryFiles;
9896
+ const sources = yield* rustSources(root);
9897
+ if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
9898
+ const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
9899
+ 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
+ ];
9906
+ });
9907
+ // src/features/check-placement/model/source-aliases.ts
9908
+ const ALIAS_RULE = "source-alias";
9909
+ const FIRST$12 = 1;
9910
+ const SOURCE_ALIAS = "#/*";
9911
+ const SOURCE_TARGET = "./src/*";
9912
+ const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
9913
+ 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));
9916
+ const problemAt$6 = (file, rule, message) => ({
9917
+ file,
9918
+ line: FIRST$12,
9919
+ column: FIRST$12,
9920
+ rule,
9921
+ message
9922
+ });
9923
+ const targetsOf = (target) => {
9924
+ if (Predicate.isString(target)) return [target];
9925
+ if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
9926
+ return [];
9927
+ };
9928
+ 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
+ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
9930
+ const files = yield* RepositoryFiles;
9931
+ const manifest = files.join(root, workspace, MANIFEST_FILE$1);
9932
+ 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}`)));
9934
+ });
9935
+ /** @internal */
9936
+ const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
9937
+ const workspaces = yield* memberWorkspaces(root);
9938
+ const aliases = yield* Effect.forEach(workspaces, (workspace) => aliasProblems(root, workspace), { concurrency: 1 });
9939
+ return Array.flatten(aliases);
9516
9940
  });
9517
9941
  // src/features/check-placement/model/placement-checks.ts
9518
9942
  /** @internal */
@@ -9521,6 +9945,7 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
9521
9945
  checkDocPlacement(root),
9522
9946
  checkColocatedTests(root),
9523
9947
  checkLayeredSource(root),
9948
+ checkRustModules(root),
9524
9949
  checkSourceAliases(root),
9525
9950
  checkSourceNames(root),
9526
9951
  checkColocatedGitPatterns(root),
@@ -9539,17 +9964,17 @@ const WORKFLOW_DIRECTORY$1 = ".github/";
9539
9964
  const SEPARATOR$13 = "/";
9540
9965
  const CURRENT = "./";
9541
9966
  const READ_CONCURRENCY$17 = 8;
9542
- const FIRST$10 = 1;
9967
+ const FIRST$11 = 1;
9543
9968
  const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
9544
9969
  const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
9545
9970
  const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
9546
- const Manifest$1 = Schema.Struct({
9971
+ const Manifest$2 = Schema.Struct({
9547
9972
  bin: Schema.optional(Schema.Unknown),
9548
9973
  main: Schema.optional(Schema.Unknown),
9549
9974
  exports: Schema.optional(Schema.Unknown)
9550
9975
  });
9551
9976
  const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
9552
- const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
9977
+ const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
9553
9978
  const decodeTarget = Schema.decodeUnknownOption(Schema.String);
9554
9979
  const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
9555
9980
  const NO_ENTRIES = {
@@ -9576,7 +10001,7 @@ const entriesOf$2 = (manifest) => {
9576
10001
  const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
9577
10002
  const files = yield* RepositoryFiles;
9578
10003
  const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$1));
9579
- return pipe(text, Option.flatMap(decodeManifest$4), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
10004
+ return pipe(text, Option.flatMap(decodeManifest$5), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
9580
10005
  });
9581
10006
  const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
9582
10007
  const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
@@ -9599,7 +10024,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
9599
10024
  message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
9600
10025
  })));
9601
10026
  const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
9602
- const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
10027
+ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
9603
10028
  const files = yield* RepositoryFiles;
9604
10029
  const config = yield* workspaceConfigOf(root, directory);
9605
10030
  const entries = yield* declaredEntries(root, directory);
@@ -9615,8 +10040,8 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, directo
9615
10040
  const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
9616
10041
  const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
9617
10042
  file: files.join(root, directory, path),
9618
- line: FIRST$10,
9619
- column: FIRST$10,
10043
+ line: FIRST$11,
10044
+ column: FIRST$11,
9620
10045
  rule: UNRUN,
9621
10046
  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.`
9622
10047
  })));
@@ -9628,8 +10053,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
9628
10053
  const isDirectory = yield* files.isDirectory(file);
9629
10054
  return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
9630
10055
  file,
9631
- line: FIRST$10,
9632
- column: FIRST$10,
10056
+ line: FIRST$11,
10057
+ column: FIRST$11,
9633
10058
  rule: SCRIPTS,
9634
10059
  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.`
9635
10060
  })));
@@ -9638,16 +10063,16 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
9638
10063
  const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
9639
10064
  const all = ["", ...yield* workspaceDirectories(root)];
9640
10065
  const workflows = yield* workflowText(root);
9641
- const found = yield* Effect.forEach(all, (directory) => problemsIn$12(root, directory, workflows), { concurrency: READ_CONCURRENCY$17 });
10066
+ const found = yield* Effect.forEach(all, (directory) => problemsIn$13(root, directory, workflows), { concurrency: READ_CONCURRENCY$17 });
9642
10067
  const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$17 });
9643
10068
  return [...Array.flatten(found), ...Array.getSomes(scripts)];
9644
10069
  });
9645
10070
  // src/features/check-repository-layout/model/crates.ts
9646
- const RULE$28 = "unverified-crate";
10071
+ const RULE$30 = "unverified-crate";
9647
10072
  const CARGO_FILE = "Cargo.toml";
9648
- const CONFIG_FILE$4 = "vite.config.ts";
10073
+ const CONFIG_FILE$5 = "vite.config.ts";
9649
10074
  const SEPARATOR$12 = "/";
9650
- const FIRST$9 = 1;
10075
+ const FIRST$10 = 1;
9651
10076
  const READ_CONCURRENCY$16 = 8;
9652
10077
  const CrateEntry = Schema.Struct({
9653
10078
  name: Schema.String,
@@ -9679,17 +10104,17 @@ const owningWorkspace = (directories) => (directory) => {
9679
10104
  };
9680
10105
  const problemFor$2 = (crate, message) => ({
9681
10106
  file: crate.manifest,
9682
- line: FIRST$9,
9683
- column: FIRST$9,
9684
- rule: RULE$28,
10107
+ line: FIRST$10,
10108
+ column: FIRST$10,
10109
+ rule: RULE$30,
9685
10110
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
9686
10111
  });
9687
10112
  const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
9688
10113
  const files = yield* RepositoryFiles;
9689
10114
  const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
9690
10115
  if (Option.isNone(workspace)) return Option.some(problemFor$2(crate, "is outside every workspace package"));
9691
- if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$4))) return Option.none();
9692
- return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$4} has no verify task`));
10116
+ if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$5))) return Option.none();
10117
+ return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$5} has no verify task`));
9693
10118
  });
9694
10119
  /** @internal */
9695
10120
  const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
@@ -9701,7 +10126,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
9701
10126
  return Array.getSomes(found);
9702
10127
  });
9703
10128
  // src/features/check-repository-layout/model/deploy-entry-patterns.ts
9704
- const RULE$27 = "deploy-entry-pattern";
10129
+ const RULE$29 = "deploy-entry-pattern";
9705
10130
  const FALLOW_KEYS = [
9706
10131
  "entry",
9707
10132
  "entryPoints",
@@ -9756,7 +10181,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
9756
10181
  const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
9757
10182
  return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
9758
10183
  });
9759
- const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(request) {
10184
+ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(request) {
9760
10185
  const { root, file, kind, workspaces, entries } = request;
9761
10186
  const files = yield* RepositoryFiles;
9762
10187
  const path = files.join(root, file);
@@ -9772,7 +10197,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(request) {
9772
10197
  return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
9773
10198
  file: path,
9774
10199
  ...positionOf(text.value)(start - kind.offset),
9775
- rule: RULE$27,
10200
+ rule: RULE$29,
9776
10201
  message: `${pattern} ${MESSAGE$8}`
9777
10202
  })));
9778
10203
  });
@@ -9795,7 +10220,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
9795
10220
  }];
9796
10221
  return [];
9797
10222
  }));
9798
- const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$11({
10223
+ const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$12({
9799
10224
  root,
9800
10225
  file,
9801
10226
  kind,
@@ -9805,7 +10230,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
9805
10230
  return Array.flatten(found);
9806
10231
  });
9807
10232
  // src/features/check-repository-layout/model/fallow-entries.ts
9808
- const RULE$26 = "listed-entry";
10233
+ const RULE$28 = "listed-entry";
9809
10234
  const ENTRY_KEYS = [
9810
10235
  "entry",
9811
10236
  "entryPoints",
@@ -9826,7 +10251,7 @@ const entryPatternsIn = (node) => {
9826
10251
  return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
9827
10252
  };
9828
10253
  const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
9829
- const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
10254
+ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
9830
10255
  const files = yield* RepositoryFiles;
9831
10256
  const path = files.join(root, file);
9832
10257
  const text = yield* files.readFile(path);
@@ -9835,7 +10260,7 @@ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
9835
10260
  return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
9836
10261
  file: path,
9837
10262
  ...positionOf(text.value)(start),
9838
- rule: RULE$26,
10263
+ rule: RULE$28,
9839
10264
  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.`
9840
10265
  })));
9841
10266
  });
@@ -9843,13 +10268,13 @@ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
9843
10268
  const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
9844
10269
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
9845
10270
  const directories = yield* workspaceDirectories(root);
9846
- const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$10(root, file, directories), { concurrency: READ_CONCURRENCY$14 });
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 });
9847
10272
  return Array.flatten(found);
9848
10273
  });
9849
10274
  // src/features/check-repository-layout/model/hidden-verify.ts
9850
- const RULE$25 = "hidden-verify";
9851
- const CONFIG_FILE$3 = "vite.config.ts";
9852
- const FIRST$8 = 1;
10275
+ const RULE$27 = "hidden-verify";
10276
+ const CONFIG_FILE$4 = "vite.config.ts";
10277
+ const FIRST$9 = 1;
9853
10278
  const READ_CONCURRENCY$13 = 8;
9854
10279
  const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
9855
10280
  const config = yield* workspaceConfigOf(root, directory);
@@ -9859,10 +10284,10 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
9859
10284
  const verified = yield* hasVerifyTask(file);
9860
10285
  return Option.some({
9861
10286
  file,
9862
- line: FIRST$8,
9863
- column: FIRST$8,
9864
- rule: RULE$25,
9865
- 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}.`
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}.`
9866
10291
  }).pipe(Option.filter(() => verified));
9867
10292
  });
9868
10293
  /** @internal */
@@ -9872,11 +10297,11 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
9872
10297
  return Array.getSomes(found);
9873
10298
  });
9874
10299
  // src/features/check-repository-layout/model/root-workspace-paths.ts
9875
- const RULE$24 = "root-workspace-path";
9876
- const CONFIG_FILE$2 = "vite.config.ts";
10300
+ const RULE$26 = "root-workspace-path";
10301
+ const CONFIG_FILE$3 = "vite.config.ts";
9877
10302
  const PATH_CHARACTER = /[\w.@/-]/u;
9878
10303
  const NAME_CHARACTER = /[\w.@-]/u;
9879
- const FIRST$7 = 0;
10304
+ const FIRST$8 = 0;
9880
10305
  const NEXT$2 = 1;
9881
10306
  const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
9882
10307
  const mentions$1 = (directory) => (text) => {
@@ -9884,28 +10309,28 @@ const mentions$1 = (directory) => (text) => {
9884
10309
  return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
9885
10310
  const before = parts[index] ?? "";
9886
10311
  const previous = String$1.slice(before.length - NEXT$2)(before);
9887
- const following = String$1.slice(FIRST$7, NEXT$2)(after);
10312
+ const following = String$1.slice(FIRST$8, NEXT$2)(after);
9888
10313
  return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
9889
10314
  }));
9890
10315
  };
9891
- const problemsIn$9 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions$1(directory)(found.text)), Array.map((directory) => ({
10316
+ const problemsIn$10 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions$1(directory)(found.text)), Array.map((directory) => ({
9892
10317
  file,
9893
10318
  ...positionOf(source)(found.start),
9894
- rule: RULE$24,
9895
- message: `${directory} is a workspace. The root ${CONFIG_FILE$2} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$2}: msch.lint, msch.devDependencies or its verify task.`
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.`
9896
10321
  })));
9897
10322
  /** @internal */
9898
10323
  const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
9899
10324
  const files = yield* RepositoryFiles;
9900
- const file = files.join(root, CONFIG_FILE$2);
10325
+ const file = files.join(root, CONFIG_FILE$3);
9901
10326
  const source = yield* files.readFile(file);
9902
10327
  if (Option.isNone(source)) return [];
9903
10328
  const directories = yield* workspaceDirectories(root);
9904
10329
  const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
9905
- return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$9(file, source.value, directories)));
10330
+ return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$10(file, source.value, directories)));
9906
10331
  });
9907
10332
  // src/features/check-repository-layout/model/shared-uncached-tasks.ts
9908
- const RULE$23 = "shared-uncached-task";
10333
+ const RULE$25 = "shared-uncached-task";
9909
10334
  const READ_CONCURRENCY$12 = 8;
9910
10335
  const SHARED = 2;
9911
10336
  const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
@@ -9948,7 +10373,7 @@ const problemsOf$2 = (definitions) => {
9948
10373
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
9949
10374
  file,
9950
10375
  ...position,
9951
- rule: RULE$23,
10376
+ rule: RULE$25,
9952
10377
  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.`
9953
10378
  })));
9954
10379
  };
@@ -10094,13 +10519,13 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
10094
10519
  /** @internal */
10095
10520
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
10096
10521
  // src/features/check-repository-layout/model/workflow-paths.ts
10097
- const RULE$22 = "workflow-path";
10522
+ const RULE$24 = "workflow-path";
10098
10523
  const WORKFLOW_DIRECTORY = ".github/workflows/";
10099
10524
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
10100
10525
  const READ_CONCURRENCY$11 = 8;
10101
10526
  const WILDCARD$2 = /[*?[]/u;
10102
10527
  const SEPARATOR$9 = "/";
10103
- const FIRST$6 = 0;
10528
+ const FIRST$7 = 0;
10104
10529
  const EXPECTED = {
10105
10530
  action: "a directory with action.yml",
10106
10531
  directory: "a directory",
@@ -10141,7 +10566,7 @@ const RESOLVERS = {
10141
10566
  };
10142
10567
  const staticPrefix = (path) => {
10143
10568
  const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
10144
- if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$6, -1)(prefix);
10569
+ if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$7, -1)(prefix);
10145
10570
  return prefix;
10146
10571
  };
10147
10572
  const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
@@ -10157,25 +10582,25 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
10157
10582
  if (yield* RESOLVERS[found.kind](root, found.path)) return false;
10158
10583
  return !(yield* isIgnored$1(root, found.path));
10159
10584
  });
10160
- const problemOf$7 = (file, source) => (found) => ({
10585
+ const problemOf$8 = (file, source) => (found) => ({
10161
10586
  file,
10162
10587
  ...positionOf(source)(found.offset),
10163
- rule: RULE$22,
10588
+ rule: RULE$24,
10164
10589
  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.`
10165
10590
  });
10166
- const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
10591
+ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
10167
10592
  const files = yield* RepositoryFiles;
10168
10593
  const file = files.join(root, workflow);
10169
10594
  const source = yield* files.readFile(file);
10170
10595
  if (Option.isNone(source)) return [];
10171
10596
  const produced = producedPaths(source.value);
10172
10597
  const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
10173
- return pipe(missing, Array.map(problemOf$7(file, source.value)));
10598
+ return pipe(missing, Array.map(problemOf$8(file, source.value)));
10174
10599
  });
10175
10600
  /** @internal */
10176
10601
  const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
10177
10602
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10178
- const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$8(root, workflow), { concurrency: READ_CONCURRENCY$11 });
10603
+ const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$9(root, workflow), { concurrency: READ_CONCURRENCY$11 });
10179
10604
  return Array.flatten(found);
10180
10605
  });
10181
10606
  // src/features/check-repository-layout/model/workflow-scale.ts
@@ -10186,7 +10611,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
10186
10611
  const FILTER_KEYS = ["paths", "paths-ignore"];
10187
10612
  const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
10188
10613
  const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
10189
- const START$12 = 0;
10614
+ const START$13 = 0;
10190
10615
  const READ_CONCURRENCY$10 = 8;
10191
10616
  const SEPARATOR$8 = "/";
10192
10617
  const WORD_SEPARATORS = /[-_]/gu;
@@ -10217,7 +10642,7 @@ const namesIn = (name, source) => {
10217
10642
  return [
10218
10643
  {
10219
10644
  text: name,
10220
- offset: START$12
10645
+ offset: START$13
10221
10646
  },
10222
10647
  ...Option.toArray(stringOf(childOf("name")(root))),
10223
10648
  ...keysOf$1(childOf("jobs")(root))
@@ -10288,12 +10713,12 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
10288
10713
  return Array.flatten(found);
10289
10714
  });
10290
10715
  // src/features/check-typescript-generation/model/typescript-generation.ts
10291
- const RULE$21 = "legacy-typescript";
10716
+ const RULE$23 = "legacy-typescript";
10292
10717
  const LOCKFILE = "pnpm-lock.yaml";
10293
10718
  const COMPILER = "typescript";
10294
10719
  const CURRENT_MAJOR = 7;
10295
10720
  const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
10296
- const FIRST$5 = 1;
10721
+ const FIRST$6 = 1;
10297
10722
  const legacyOf = (id) => {
10298
10723
  const { name, version } = parse$1(id);
10299
10724
  const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
@@ -10304,8 +10729,8 @@ const legacyOf = (id) => {
10304
10729
  };
10305
10730
  const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
10306
10731
  const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
10307
- onNone: () => FIRST$5,
10308
- onSome: (index) => index + FIRST$5
10732
+ onNone: () => FIRST$6,
10733
+ onSome: (index) => index + FIRST$6
10309
10734
  }));
10310
10735
  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)}.`;
10311
10736
  /** @internal */
@@ -10318,8 +10743,8 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
10318
10743
  return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
10319
10744
  file,
10320
10745
  line: lineOf$2(source)(legacy.id),
10321
- column: FIRST$5,
10322
- rule: RULE$21,
10746
+ column: FIRST$6,
10747
+ rule: RULE$23,
10323
10748
  message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
10324
10749
  })));
10325
10750
  });
@@ -10706,7 +11131,7 @@ const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath
10706
11131
  const RELATIVE = /^\.\.?(?:\/|$)/u;
10707
11132
  const SUBPATH_IMPORT = "#";
10708
11133
  const WILDCARD$1 = "*";
10709
- const SCOPE$1 = "@";
11134
+ const SCOPE$2 = "@";
10710
11135
  const SEPARATOR$6 = "/";
10711
11136
  const SOURCE_SUFFIXES = [
10712
11137
  "",
@@ -10720,7 +11145,7 @@ const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Sche
10720
11145
  const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
10721
11146
  const packageNameOf = (specifier) => {
10722
11147
  const segments = String$1.split(specifier, SEPARATOR$6);
10723
- if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$6));
11148
+ if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$6));
10724
11149
  return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$6));
10725
11150
  };
10726
11151
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
@@ -10816,7 +11241,7 @@ const InstalledManifest = Schema.Struct({
10816
11241
  peerDependencies: DependencyMap,
10817
11242
  peerDependenciesMeta: PeerMeta
10818
11243
  });
10819
- const decodeManifest$3 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
11244
+ const decodeManifest$4 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
10820
11245
  const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
10821
11246
  const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
10822
11247
  const installedNames = (manifest) => [
@@ -10827,7 +11252,7 @@ const installedNames = (manifest) => [
10827
11252
  const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
10828
11253
  const files = yield* RepositoryFiles;
10829
11254
  const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$1));
10830
- return pipe(text, Option.flatMap(decodeManifest$3), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
11255
+ return pipe(text, Option.flatMap(decodeManifest$4), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
10831
11256
  });
10832
11257
  const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
10833
11258
  const files = yield* RepositoryFiles;
@@ -10889,11 +11314,11 @@ const LISTED_LARGEST = 5;
10889
11314
  const SIZE_CONCURRENCY = 32;
10890
11315
  const MEGABYTE = 1e6;
10891
11316
  const MEGABYTE_DIGITS = 1;
10892
- const START$11 = 0;
11317
+ const START$12 = 0;
10893
11318
  const SINGLE_ENTRY = 1;
10894
11319
  const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
10895
11320
  const usageHint = (dependency, entryCount) => {
10896
- if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$11 && dependency.entries.length < entryCount)) return "";
11321
+ if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$12 && dependency.entries.length < entryCount)) return "";
10897
11322
  return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
10898
11323
  };
10899
11324
  const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
@@ -10902,7 +11327,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
10902
11327
  const { workspace, total } = overrun;
10903
11328
  const config = yield* files.readFile(workspace.configFile);
10904
11329
  const source = Option.getOrElse(config, () => "");
10905
- const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$11);
11330
+ const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$12);
10906
11331
  return {
10907
11332
  file: workspace.configFile,
10908
11333
  ...positionOf(source)(index),
@@ -10919,7 +11344,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
10919
11344
  const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
10920
11345
  const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
10921
11346
  const sizes = HashMap.fromIterable(measured);
10922
- const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$11))));
11347
+ const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$12))));
10923
11348
  return {
10924
11349
  closures,
10925
11350
  sizeOf,
@@ -10952,11 +11377,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
10952
11377
  })];
10953
11378
  });
10954
11379
  const stackProblems = (file, source, dependencies) => {
10955
- const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$11);
11380
+ const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$12);
10956
11381
  const rest = String$1.slice(section)(source);
10957
11382
  return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
10958
11383
  file,
10959
- ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$11)),
11384
+ ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$12)),
10960
11385
  rule: STACK_DEPENDENCY,
10961
11386
  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.`
10962
11387
  })));
@@ -11610,7 +12035,7 @@ const duplicateProblems = (relative) => (sites) => {
11610
12035
  }))));
11611
12036
  };
11612
12037
  // src/features/check-value-owners/model/name-lists.ts
11613
- const RULE$20 = "hand-written-names";
12038
+ const RULE$22 = "hand-written-names";
11614
12039
  const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
11615
12040
  const nameListOf = (site) => {
11616
12041
  if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
@@ -11621,11 +12046,11 @@ const nameListOf = (site) => {
11621
12046
  }, (list) => list.names.length === site.values.length);
11622
12047
  };
11623
12048
  const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
11624
- const problemOf$6 = ({ list, reason }) => ({
12049
+ const problemOf$7 = ({ list, reason }) => ({
11625
12050
  file: list.site.file,
11626
12051
  line: list.site.line,
11627
12052
  column: list.site.column,
11628
- rule: RULE$20,
12053
+ rule: RULE$22,
11629
12054
  message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
11630
12055
  });
11631
12056
  // src/features/check-value-owners/model/declared-names.ts
@@ -11656,7 +12081,7 @@ const declaredNameProblem = ({ literals, relative }) => {
11656
12081
  if (defined.length < mostNamesOf(list) || files.length < 2) return Option.none();
11657
12082
  const names = pipe(defined, Array.map(([name]) => name));
11658
12083
  const shown = pipe(files, Array.take(SHOWN_FILES), Array.map(relative), Array.join(", "));
11659
- return Option.some(problemOf$6({
12084
+ return Option.some(problemOf$7({
11660
12085
  list,
11661
12086
  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.`
11662
12087
  }));
@@ -11689,11 +12114,11 @@ const listedPathProblem = (repository) => (list) => {
11689
12114
  const paths = pipe(list.names, Array.map(namedPath(repository, list.site.file)), Array.getSomes);
11690
12115
  const packages = pipe(list.names, Array.filter((name) => HashSet.has(repository.packages, name)));
11691
12116
  const directory = enumeratedDirectory(repository)(paths);
11692
- if (Option.isSome(directory)) return Option.some(problemOf$6({
12117
+ if (Option.isSome(directory)) return Option.some(problemOf$7({
11693
12118
  list,
11694
12119
  reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`
11695
12120
  }));
11696
- if (packages.length >= 2) return Option.some(problemOf$6({
12121
+ if (packages.length >= 2) return Option.some(problemOf$7({
11697
12122
  list,
11698
12123
  reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`
11699
12124
  }));
@@ -11708,7 +12133,7 @@ const connected = (index) => (left, right) => left === right || imports(index)(l
11708
12133
  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);
11709
12134
  const subsetListProblem = ({ lists, literals, relative }) => {
11710
12135
  const index = importIndexOf(literals);
11711
- return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$6({
12136
+ return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$7({
11712
12137
  list,
11713
12138
  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.`
11714
12139
  })));
@@ -11734,13 +12159,13 @@ const MANIFEST$2 = "package.json";
11734
12159
  const SEPARATOR$4 = "/";
11735
12160
  const FIRST_SEGMENT = 1;
11736
12161
  const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
11737
- const decodeManifest$2 = Schema.decodeUnknownOption(ManifestJson);
12162
+ const decodeManifest$3 = Schema.decodeUnknownOption(ManifestJson);
11738
12163
  const prefixesOf = (file) => {
11739
12164
  const segments = pipe(file, String$1.split(SEPARATOR$4));
11740
12165
  return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$4))));
11741
12166
  };
11742
12167
  const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
11743
- const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$2), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
12168
+ const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$3), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
11744
12169
  const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
11745
12170
  const files = yield* RepositoryFiles;
11746
12171
  const listed = yield* files.listedFiles(root);
@@ -11852,7 +12277,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
11852
12277
  return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
11853
12278
  }, Effect.scoped);
11854
12279
  // src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
11855
- const RULE$19 = "namespace-destructuring";
12280
+ const RULE$21 = "namespace-destructuring";
11856
12281
  const LOCAL = /^[.#/]/u;
11857
12282
  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.`;
11858
12283
  const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
@@ -11867,16 +12292,16 @@ const destructuredName = (declaration) => {
11867
12292
  if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
11868
12293
  return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
11869
12294
  };
11870
- const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
11871
- rule: RULE$19,
12295
+ const problemOf$6 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
12296
+ rule: RULE$21,
11872
12297
  message: messageOf$1(name)
11873
12298
  })), Option.map((report) => report(declaration)));
11874
12299
  const namespaceDestructuringIn = () => (sourceFile) => {
11875
12300
  const names = importedNames(sourceFile);
11876
- return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
12301
+ return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$6(names)), Array.getSomes);
11877
12302
  };
11878
12303
  // src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
11879
- const RULE$18 = "pass-through-wrapper";
12304
+ const RULE$20 = "pass-through-wrapper";
11880
12305
  const SINGLE_STATEMENT = 1;
11881
12306
  const SINGLE_DECLARATION = 1;
11882
12307
  const THIS_PARAMETER = "this";
@@ -11970,32 +12395,32 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
11970
12395
  const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
11971
12396
  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);
11972
12397
  };
11973
- const problemOf$4 = (checker) => (candidate) => {
12398
+ const problemOf$5 = (checker) => (candidate) => {
11974
12399
  if (changesTheCall(candidate.wrapper)) return Option.none();
11975
12400
  return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$9({
11976
- rule: RULE$18,
12401
+ rule: RULE$20,
11977
12402
  message: messageOf(forward.callee.getText())
11978
12403
  })(candidate.name)));
11979
12404
  };
11980
- const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$4(checker)), Array.getSomes);
12405
+ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$5(checker)), Array.getSomes);
11981
12406
  // src/app/source-checks.ts
11982
12407
  /** @internal */
11983
12408
  const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
11984
12409
  // src/features/check-agent-settings/model/missing-hooks.ts
11985
- const RULE$17 = "missing-hook";
12410
+ const RULE$19 = "missing-hook";
11986
12411
  const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
11987
12412
  const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
11988
12413
  const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
11989
12414
  const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
11990
12415
  const PLUGIN_ROOT = "..";
11991
12416
  const READ_CONCURRENCY$9 = 16;
11992
- const START$10 = 0;
12417
+ const START$11 = 0;
11993
12418
  const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
11994
12419
  path,
11995
- index: found.index ?? START$10
12420
+ index: found.index ?? START$11
11996
12421
  })), Option.toArray);
11997
12422
  const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
11998
- const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
12423
+ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
11999
12424
  const files = yield* RepositoryFiles;
12000
12425
  const text = yield* files.readFile(file);
12001
12426
  if (Option.isNone(text)) return [];
@@ -12007,7 +12432,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
12007
12432
  return pipe(missing, Array.map(({ path, index }) => ({
12008
12433
  file,
12009
12434
  ...positionOf(source)(index),
12010
- rule: RULE$17,
12435
+ rule: RULE$19,
12011
12436
  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.`
12012
12437
  })));
12013
12438
  });
@@ -12031,9 +12456,50 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
12031
12456
  }];
12032
12457
  return [];
12033
12458
  }));
12034
- const found = yield* Effect.forEach(hookFiles, problemsIn$7, { concurrency: READ_CONCURRENCY$9 });
12459
+ const found = yield* Effect.forEach(hookFiles, problemsIn$8, { concurrency: READ_CONCURRENCY$9 });
12035
12460
  return Array.flatten(found);
12036
12461
  });
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 }) {};
12465
+ 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) {
12469
+ if (!(yield* (yield* RepositoryFiles).exists(file))) return Option.none();
12470
+ const config = yield* Effect.tryPromise({
12471
+ try: () => resolveConfigFromFile(file),
12472
+ catch: () => MarkdownConfigUnreadable.make({ file })
12473
+ }).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)}`
12482
+ });
12483
+ const failureAt = (file, message) => [{
12484
+ file,
12485
+ line: FIRST$5,
12486
+ column: FIRST$5,
12487
+ rule: RULE$18,
12488
+ message
12489
+ }];
12490
+ const checkMarkdown = Effect.fn("checkMarkdown")(function* checkMarkdown(root) {
12491
+ const files = yield* RepositoryFiles;
12492
+ const configFile = files.join(root, CONFIG_FILE$2);
12493
+ const section = yield* sectionAt(configFile);
12494
+ if (Option.isNone(section)) return [];
12495
+ const config = section.value;
12496
+ const listed = yield* files.matchingFiles(root, markdownPathspecs({ config }));
12497
+ return yield* lint({
12498
+ root,
12499
+ files: listed,
12500
+ 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))));
12502
+ });
12037
12503
  // src/features/check-scripts/model/shell-scripts.ts
12038
12504
  const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
12039
12505
  const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
@@ -12041,7 +12507,7 @@ const EXTENSION = /\.[^./]+$/u;
12041
12507
  const SETTINGS_FILE = ".claude/settings.json";
12042
12508
  const READ_CONCURRENCY$8 = 64;
12043
12509
  const FIRST$4 = 1;
12044
- const RULE$16 = "shell-script";
12510
+ const RULE$17 = "shell-script";
12045
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.";
12046
12512
  const HookSchema = Schema.Struct({
12047
12513
  command: Schema.optional(Schema.String),
@@ -12064,7 +12530,7 @@ const problemFor$1 = (file) => ({
12064
12530
  file,
12065
12531
  line: FIRST$4,
12066
12532
  column: FIRST$4,
12067
- rule: RULE$16,
12533
+ rule: RULE$17,
12068
12534
  message: MESSAGE$7
12069
12535
  });
12070
12536
  /** @internal */
@@ -12101,8 +12567,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
12101
12567
  });
12102
12568
  // src/shared/lib/workflow-run.ts
12103
12569
  const RUN_KEY = "run";
12104
- const START$9 = 0;
12105
- const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$9));
12570
+ const START$10 = 0;
12571
+ const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$10));
12106
12572
  const runScriptsOf = (source) => {
12107
12573
  const found = [];
12108
12574
  visit(parseDocument(source), { Pair: (_key, pair) => {
@@ -12117,7 +12583,7 @@ const runScriptsOf = (source) => {
12117
12583
  const COMMAND_CHAIN = /&&|\|\||;|\|/u;
12118
12584
  const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
12119
12585
  const COMMENT = "#";
12120
- const RULE$15 = "workflow-script";
12586
+ const RULE$16 = "workflow-script";
12121
12587
  const ONE_COMMAND = 1;
12122
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.";
12123
12589
  const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
@@ -12126,19 +12592,19 @@ const runsMoreThanOneCommand = ({ text }) => {
12126
12592
  const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
12127
12593
  return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
12128
12594
  };
12129
- const problemsIn$6 = (file) => (source) => {
12595
+ const problemsIn$7 = (file) => (source) => {
12130
12596
  const at = positionOf(source);
12131
12597
  return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
12132
12598
  file,
12133
12599
  ...at(start),
12134
- rule: RULE$15,
12600
+ rule: RULE$16,
12135
12601
  message: MESSAGE$6
12136
12602
  })));
12137
12603
  };
12138
12604
  /** @internal */
12139
12605
  const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
12140
12606
  const workflows = yield* readWorkflows(root);
12141
- return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$6(file)(source)));
12607
+ return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$7(file)(source)));
12142
12608
  });
12143
12609
  // src/features/check-scripts/model/script-checks.ts
12144
12610
  /** @internal */
@@ -12235,24 +12701,24 @@ const docSources = (file) => (source) => {
12235
12701
  const ROOT_DIRECTORY = ".";
12236
12702
  const COMMAND_KEY = "command";
12237
12703
  const ARGUMENTS_KEY = "args";
12238
- const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
12239
- const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED$1];
12704
+ const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
12705
+ const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED$2];
12240
12706
  const STEP_FILES = [
12241
12707
  ":(glob).github/workflows/*.yml",
12242
12708
  ":(glob).github/workflows/*.yaml",
12243
12709
  ":(glob)**/action.yml",
12244
12710
  ":(glob)**/action.yaml",
12245
- ...EXCLUDED$1
12711
+ ...EXCLUDED$2
12246
12712
  ];
12247
12713
  const HOOK_FILES = [":(glob).vite-hooks/*"];
12248
12714
  const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
12249
12715
  const AGENT_DOCS = [
12250
12716
  ":(glob)**/AGENTS.md",
12251
12717
  ":(glob)**/CLAUDE.md",
12252
- ...EXCLUDED$1
12718
+ ...EXCLUDED$2
12253
12719
  ];
12254
12720
  const READ_CONCURRENCY$6 = 16;
12255
- const START$8 = 0;
12721
+ const START$9 = 0;
12256
12722
  const FIRST$3 = 1;
12257
12723
  const LINE = "\n";
12258
12724
  const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
@@ -12262,7 +12728,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
12262
12728
  const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
12263
12729
  const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
12264
12730
  const NO_SOURCES = [];
12265
- const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$8));
12731
+ const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$9));
12266
12732
  const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
12267
12733
  const offset = offsetOf$2(source, `"${name}"`);
12268
12734
  return {
@@ -12358,7 +12824,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
12358
12824
  return Array.flatten(found);
12359
12825
  });
12360
12826
  // src/features/check-vite-plus/model/package-scripts.ts
12361
- const RULE$14 = "package-script";
12827
+ const RULE$15 = "package-script";
12362
12828
  const LIFECYCLE = [
12363
12829
  "preinstall",
12364
12830
  "install",
@@ -12381,12 +12847,12 @@ const LIFECYCLE = [
12381
12847
  const problemOf$3 = ({ file, position, name }) => ({
12382
12848
  file,
12383
12849
  ...position,
12384
- rule: RULE$14,
12850
+ rule: RULE$15,
12385
12851
  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.`
12386
12852
  });
12387
12853
  const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
12388
12854
  // src/features/check-vite-plus/model/vite-plus-block.ts
12389
- const RULE$13 = "vite-plus-block";
12855
+ const RULE$14 = "vite-plus-block";
12390
12856
  const MARKER = Array.join([
12391
12857
  "<!--",
12392
12858
  "VITE PLUS START",
@@ -12399,7 +12865,7 @@ const problemIn = (file) => (source) => {
12399
12865
  return Option.some({
12400
12866
  file,
12401
12867
  ...positionOf(source)(index.value),
12402
- rule: RULE$13,
12868
+ rule: RULE$14,
12403
12869
  message: MESSAGE$5
12404
12870
  });
12405
12871
  };
@@ -12444,17 +12910,17 @@ const workflowCheck = ({ rule, message, offsetsOf }) => Effect.fn(rule)(function
12444
12910
  // src/features/check-workflows/model/full-history-checkout.ts
12445
12911
  const DEPTH_KEY = "fetch-depth";
12446
12912
  const WHOLE_HISTORY = "0";
12447
- const RULE$12 = "full-history-checkout";
12913
+ const RULE$13 = "full-history-checkout";
12448
12914
  const MESSAGE$4 = "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.";
12449
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)));
12450
12916
  /** @internal */
12451
12917
  const checkFullHistoryCheckout = workflowCheck({
12452
- rule: RULE$12,
12918
+ rule: RULE$13,
12453
12919
  message: MESSAGE$4,
12454
12920
  offsetsOf: fullHistoryOffsetsOf
12455
12921
  });
12456
12922
  // src/features/check-workflows/model/release-pr-auto-merge.ts
12457
- const RULE$11 = "release-pr-auto-merge";
12923
+ const RULE$12 = "release-pr-auto-merge";
12458
12924
  const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
12459
12925
  const AUTO_MERGE = /\bgh\s+pr\s+merge\b[^\n]*--auto\b/u;
12460
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.";
@@ -12472,24 +12938,24 @@ const unqueuedOffsetsOf = (steps) => pipe(steps, Array.flatMap((step, index) =>
12472
12938
  const releasePrOffsetsOf = (source) => pipe(pairsNamed("steps")(source), Array.flatMap(({ value }) => unqueuedOffsetsOf(stepsOf(value))));
12473
12939
  /** @internal */
12474
12940
  const checkReleasePrAutoMerge = workflowCheck({
12475
- rule: RULE$11,
12941
+ rule: RULE$12,
12476
12942
  message: MESSAGE$3,
12477
12943
  offsetsOf: releasePrOffsetsOf
12478
12944
  });
12479
12945
  // src/features/check-workflows/model/workflow-queue.ts
12480
12946
  const CONCURRENCY_KEY = "concurrency";
12481
12947
  const QUEUE_KEY = "queue";
12482
- const RULE$10 = "workflow-queue";
12948
+ const RULE$11 = "workflow-queue";
12483
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.";
12484
12950
  const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
12485
12951
  /** @internal */
12486
12952
  const checkWorkflowQueues = workflowCheck({
12487
- rule: RULE$10,
12953
+ rule: RULE$11,
12488
12954
  message: MESSAGE$2,
12489
12955
  offsetsOf: queueOffsetsOf
12490
12956
  });
12491
12957
  // src/features/check-workflows/model/workflow-commits.ts
12492
- const RULE$9 = "workflow-commit";
12958
+ const RULE$10 = "workflow-commit";
12493
12959
  const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
12494
12960
  const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
12495
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.";
@@ -12497,7 +12963,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
12497
12963
  const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
12498
12964
  /** @internal */
12499
12965
  const checkWorkflowCommits = workflowCheck({
12500
- rule: RULE$9,
12966
+ rule: RULE$10,
12501
12967
  message: MESSAGE$1,
12502
12968
  offsetsOf: commitOffsetsOf
12503
12969
  });
@@ -12512,7 +12978,8 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
12512
12978
  checkWorkflowCommits(root),
12513
12979
  checkFullHistoryCheckout(root),
12514
12980
  checkReleasePrAutoMerge(root),
12515
- checkRestrictedRules(root)
12981
+ checkRestrictedRules(root),
12982
+ checkMarkdown(root)
12516
12983
  ], { concurrency: "unbounded" });
12517
12984
  return Array.flatten(found);
12518
12985
  });
@@ -12606,37 +13073,27 @@ const COMMENT_NODES = [
12606
13073
  "block_comment",
12607
13074
  "multiline_comment"
12608
13075
  ];
12609
- const START$7 = 0;
13076
+ const START$8 = 0;
12610
13077
  const NEXT = 1;
12611
13078
  const NONE$1 = [];
12612
- const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
12613
- const loadGrammar = (grammar) => Effect.tryPromise({
12614
- try: () => treeSitter.Language.load(grammarFile(grammar)),
12615
- catch: unreadable(grammar)
12616
- }).pipe(Effect.map((language) => [grammar, language]));
13079
+ const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
13080
+ onFailure: ({ message }) => unreadable(grammar)(message),
13081
+ onSuccess: (language) => [grammar, language]
13082
+ }));
12617
13083
  const loadGrammars = Effect.fn("loadGrammars")(function* loadGrammars() {
12618
- yield* Effect.tryPromise({
12619
- try: () => treeSitter.Parser.init(),
12620
- catch: unreadable("javascript")
12621
- });
12622
13084
  const loaded = yield* Effect.forEach(GRAMMARS, (grammar) => loadGrammar(grammar), { concurrency: 1 });
12623
13085
  const languages = Record.fromEntries(loaded);
12624
13086
  const grammars = (grammar) => Record.get(languages, grammar);
12625
13087
  return grammars;
12626
13088
  });
12627
- const commentNodesIn = (language, source) => {
12628
- const parser = new treeSitter.Parser();
12629
- parser.setLanguage(language);
12630
- const tree = parser.parse(source);
12631
- parser.delete();
12632
- if (tree === null) return NONE$1;
12633
- const found = pipe(tree.rootNode.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) => trimmed({
13089
+ const commentNodesIn = (language, source) => pipe(readTree({
13090
+ language,
13091
+ source,
13092
+ read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) => trimmed({
12634
13093
  index: node.startIndex,
12635
13094
  text: node.text
12636
- })));
12637
- tree.delete();
12638
- return found;
12639
- };
13095
+ })))
13096
+ }), Option.getOrElse(() => NONE$1));
12640
13097
  const syntaxComments = (grammars, grammar) => (source) => Option.match(grammars(grammar), {
12641
13098
  onNone: () => Effect.fail(unreadable(grammar)("the grammar is not loaded")),
12642
13099
  onSome: (language) => Effect.try({
@@ -12669,7 +13126,7 @@ const markupComment = (source) => (node) => {
12669
13126
  }];
12670
13127
  };
12671
13128
  const textComments = (grammars, grammar) => (text) => {
12672
- const shift = shifted(text.startIndex ?? START$7);
13129
+ const shift = shifted(text.startIndex ?? START$8);
12673
13130
  return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
12674
13131
  };
12675
13132
  const embeddedComments = (grammars) => (node) => {
@@ -12705,11 +13162,11 @@ const commentsWith = (grammars) => (reader, source) => {
12705
13162
  }[reader](source);
12706
13163
  };
12707
13164
  // src/features/ban-comments/model/comments.ts
12708
- const RULE$8 = "comment";
13165
+ const RULE$9 = "comment";
12709
13166
  const CONFIG_FILE$1 = "vite.config.ts";
12710
13167
  const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
12711
13168
  const READ_CONCURRENCY$5 = 64;
12712
- const START$6 = 0;
13169
+ const START$7 = 0;
12713
13170
  const FIRST_LINE$4 = 1;
12714
13171
  const FIRST_COLUMN$3 = 1;
12715
13172
  const READERS$1 = [
@@ -12766,23 +13223,23 @@ const shebangReader = (source) => {
12766
13223
  const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
12767
13224
  const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
12768
13225
  const lineBefore = (source, index) => {
12769
- const lines = pipe(source, String$1.slice(START$6, index), String$1.split("\n"));
13226
+ const lines = pipe(source, String$1.slice(START$7, index), String$1.split("\n"));
12770
13227
  return Option.getOrElse(Array.last(lines), () => "");
12771
13228
  };
12772
13229
  const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
12773
- const isShebang = ({ index, text }) => index === START$6 && String$1.startsWith(SHEBANG)(text);
13230
+ const isShebang = ({ index, text }) => index === START$7 && String$1.startsWith(SHEBANG)(text);
12774
13231
  const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
12775
13232
  const problemOf$2 = (file, source) => ({ index }) => ({
12776
13233
  file,
12777
13234
  ...positionOf(source)(index),
12778
- rule: RULE$8,
13235
+ rule: RULE$9,
12779
13236
  message: MESSAGE
12780
13237
  });
12781
13238
  const unreadableProblem = (file, message) => ({
12782
13239
  file,
12783
13240
  line: FIRST_LINE$4,
12784
13241
  column: FIRST_COLUMN$3,
12785
- rule: RULE$8,
13242
+ rule: RULE$9,
12786
13243
  message: `msch could not read the comments in this file: ${message}`
12787
13244
  });
12788
13245
  const settingsOf = ({ msch, lint }) => ({
@@ -12932,7 +13389,7 @@ const UNUSED_RULE = "unused-catalog-entry";
12932
13389
  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.";
12933
13390
  const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
12934
13391
  const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
12935
- const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
13392
+ const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
12936
13393
  const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
12937
13394
  const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
12938
13395
  const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
@@ -12961,7 +13418,7 @@ const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root
12961
13418
  const files = yield* RepositoryFiles;
12962
13419
  const listed = yield* files.listedFiles(root);
12963
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 });
12964
- const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$1(text))), Array.flatMap(referencesIn));
13421
+ const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$2(text))), Array.flatMap(referencesIn));
12965
13422
  const fromOverrides = pipe(fieldsOf$1(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
12966
13423
  return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
12967
13424
  });
@@ -13003,93 +13460,6 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
13003
13460
  onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$3), fieldsOf$1(settings))
13004
13461
  });
13005
13462
  });
13006
- // src/features/check-runtime-version/model/node-version.ts
13007
- const RULE$7 = "node-version";
13008
- const MINIMUM = 26;
13009
- const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
13010
- const MANIFEST = /(?:^|\/)package\.json$/u;
13011
- const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
13012
- const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
13013
- const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
13014
- const PINNED_VERSION = /^\s*v?(?<major>\d+)/u;
13015
- const BASE_IMAGE = /^FROM[ \t]+(?:--\S+[ \t]+)*(?:[\w.-]+(?::\d+)?\/)*node:(?<major>\d+)/gimu;
13016
- const SETUP_INPUT = /\bnode-version:[ \t]*["']?v?(?<major>\d+)/gu;
13017
- const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t]+)v?(?<major>\d+)/gmu;
13018
- const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
13019
- const ALTERNATIVE = "||";
13020
- const ENGINES_KEY = "\"engines\"";
13021
- const START$5 = 0;
13022
- const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
13023
- const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
13024
- const Manifest = Schema.Struct({
13025
- private: Schema.optional(Schema.Boolean),
13026
- publishConfig: Schema.optional(Schema.Unknown),
13027
- engines: Schema.optional(Engines)
13028
- });
13029
- const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
13030
- const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
13031
- const isOld = (major) => major < MINIMUM;
13032
- const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
13033
- const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
13034
- onNone: () => true,
13035
- onSome: isOld
13036
- }));
13037
- const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
13038
- const problemAt$3 = ({ entry, source, index }, message) => ({
13039
- file: entry.file,
13040
- ...positionOf(source)(index),
13041
- rule: RULE$7,
13042
- message
13043
- });
13044
- const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$5));
13045
- const unstatedProblem = (entry, source) => problemAt$3({
13046
- entry,
13047
- source,
13048
- index: START$5
13049
- }, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
13050
- const rangeProblem = (entry, source) => (range) => problemAt$3({
13051
- entry,
13052
- source,
13053
- index: offsetOf$1(source, ENGINES_KEY)
13054
- }, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
13055
- const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
13056
- const rangeOf$1 = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
13057
- const manifestProblems = (entry, source) => {
13058
- const manifest = decodeManifest(source);
13059
- if (Option.isNone(manifest)) return [];
13060
- const range = rangeOf$1(manifest.value);
13061
- if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
13062
- return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
13063
- };
13064
- 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$3({
13065
- entry,
13066
- source,
13067
- index: found.index ?? START$5
13068
- }, `${SUPPORTED} \`${String$1.trim(found[START$5])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
13069
- const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$3({
13070
- entry,
13071
- source,
13072
- index: START$5
13073
- }, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
13074
- const problemsIn$5 = (entry, source) => {
13075
- if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
13076
- if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
13077
- if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
13078
- if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
13079
- return pinnedProblems(SETUP_INPUT)(entry, source);
13080
- };
13081
- const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.test(entry.name) || STEP_FILE.test(entry.name) || isToolVersions(entry);
13082
- /** @internal */
13083
- const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
13084
- const files = yield* RepositoryFiles;
13085
- const listed = yield* listedFiles(root);
13086
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED]);
13087
- const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
13088
- name,
13089
- file: files.join(root, name)
13090
- })))];
13091
- return yield* scanText(sources, problemsIn$5);
13092
- });
13093
13463
  // src/features/check-skills/model/skill-entry.ts
13094
13464
  const ENTRY_RULE = "unlocked-skill";
13095
13465
  const VISIBLE_RULE = "skill-source-visible";
@@ -13097,7 +13467,7 @@ const CONFIG_FILE = "vite.config.ts";
13097
13467
  const RENOVATE_FILE$1 = "renovate.json";
13098
13468
  const SOURCE = "masseater/skills";
13099
13469
  const PRESET = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
13100
- const START$4 = 0;
13470
+ const START$6 = 0;
13101
13471
  const LOCAL_PREFIX = "./";
13102
13472
  const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
13103
13473
  const Source = Schema.Struct({
@@ -13108,9 +13478,9 @@ const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source
13108
13478
  const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
13109
13479
  const taggedError$1 = Schema.TaggedError;
13110
13480
  var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
13111
- const problemAt$2 = (rule, file, text) => (anchor, message) => ({
13481
+ const problemAt$3 = (rule, file, text) => (anchor, message) => ({
13112
13482
  file,
13113
- ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$4))),
13483
+ ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$6))),
13114
13484
  rule,
13115
13485
  message
13116
13486
  });
@@ -13130,20 +13500,20 @@ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root
13130
13500
  })));
13131
13501
  });
13132
13502
  const entryProblems = ({ file, text, sources }) => {
13133
- const at = problemAt$2(ENTRY_RULE, file, text);
13503
+ const at = problemAt$3(ENTRY_RULE, file, text);
13134
13504
  return pipe(Record.get(sources, SOURCE), Option.match({
13135
13505
  onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
13136
13506
  onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
13137
13507
  }));
13138
13508
  };
13139
13509
  const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
13140
- const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$2(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
13510
+ const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$3(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
13141
13511
  const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
13142
13512
  const files = yield* RepositoryFiles;
13143
13513
  const file = files.join(root, RENOVATE_FILE$1);
13144
13514
  const text = yield* files.readFile(file);
13145
13515
  if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
13146
- return [problemAt$2(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`)];
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}.`)];
13147
13517
  });
13148
13518
  /** @internal */
13149
13519
  const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
@@ -13157,7 +13527,7 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
13157
13527
  ];
13158
13528
  });
13159
13529
  // src/features/check-skills/model/published-skills.ts
13160
- const RULE$6 = "published-skills";
13530
+ const RULE$8 = "published-skills";
13161
13531
  const KEYWORD = "tanstack-intent";
13162
13532
  const SKILLS = "skills";
13163
13533
  const MANIFEST_FILE = "package.json";
@@ -13166,11 +13536,11 @@ const FIRST$2 = 1;
13166
13536
  const SUCCEEDED = 0;
13167
13537
  const SYNC = "Run vp exec intent maintainer sync in the repository root.";
13168
13538
  const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
13169
- const problemAt$1 = (file, message) => ({
13539
+ const problemAt$2 = (file, message) => ({
13170
13540
  file,
13171
13541
  line: FIRST$2,
13172
13542
  column: FIRST$2,
13173
- rule: RULE$6,
13543
+ rule: RULE$8,
13174
13544
  message
13175
13545
  });
13176
13546
  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))));
@@ -13193,30 +13563,30 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
13193
13563
  const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
13194
13564
  return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
13195
13565
  }, Effect.scoped);
13196
- const problemsIn$4 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
13566
+ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
13197
13567
  const files = yield* RepositoryFiles;
13198
13568
  const directory = files.join(root, project.directory);
13199
13569
  const manifest = files.join(directory, MANIFEST_FILE);
13200
13570
  const skills = skillDirectoriesIn(files, directory);
13201
- if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$1(manifest, `is published without TanStack Intent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1} with vp exec intent maintainer add, so agents in the repositories that install it load guidance for the installed version.`)];
13571
+ if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without TanStack Intent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1} with vp exec intent maintainer add, so agents in the repositories that install it load guidance for the installed version.`)];
13202
13572
  const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
13203
- return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$1(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$1(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
13573
+ return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
13204
13574
  });
13205
13575
  /** @internal */
13206
13576
  const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
13207
13577
  const projects = yield* publishedProjects(root);
13208
- const problems = yield* Effect.forEach(projects, (project) => problemsIn$4(root, project), { concurrency: 1 });
13578
+ const problems = yield* Effect.forEach(projects, (project) => problemsIn$6(root, project), { concurrency: 1 });
13209
13579
  return Array.flatten(problems);
13210
13580
  });
13211
13581
  // src/features/check-skills/model/skill-files.ts
13212
- const RULE$5 = "skill-file";
13582
+ const RULE$7 = "skill-file";
13213
13583
  const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
13214
13584
  const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
13215
13585
  const MARKDOWN = ".md";
13216
13586
  const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
13217
13587
  const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
13218
13588
  const HEADING = /^# (?<title>.+)$/mu;
13219
- const NAME_KEY = /^name:/mu;
13589
+ const NAME_KEY$1 = /^name:/mu;
13220
13590
  const LICENSE_KEY = /^license:/mu;
13221
13591
  const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
13222
13592
  const LINK = /\]\((?<target>[^)\s]+)\)/gu;
@@ -13226,7 +13596,7 @@ const GITHUB = "https://github.com/";
13226
13596
  const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
13227
13597
  const BLANK = /\s+/u;
13228
13598
  const SEPARATOR$2 = "/";
13229
- const START$3 = 0;
13599
+ const START$5 = 0;
13230
13600
  const FIRST$1 = 1;
13231
13601
  const READ_CONCURRENCY$3 = 16;
13232
13602
  const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
@@ -13236,50 +13606,50 @@ const Frontmatter = Schema.Struct({
13236
13606
  metadata: Schema.optional(Metadata)
13237
13607
  });
13238
13608
  const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
13239
- const offsetOf = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$3));
13609
+ const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$5));
13240
13610
  const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
13241
- const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$3].length), Option.getOrElse(() => START$3));
13611
+ const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$5].length), Option.getOrElse(() => START$5));
13242
13612
  const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
13243
13613
  const nameProblems = ({ source, directory }, name, folder) => {
13244
13614
  const bodyStart = bodyStartOf(source);
13245
13615
  const body = String$1.slice(bodyStart)(source);
13246
13616
  const heading = groupOf$2("title")(HEADING.exec(body));
13247
13617
  return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
13248
- index: offsetOf(source, NAME_KEY),
13618
+ index: offsetOf$1(source, NAME_KEY$1),
13249
13619
  message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
13250
13620
  })), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
13251
- index: bodyStart + offsetOf(body, HEADING),
13621
+ index: bodyStart + offsetOf$1(body, HEADING),
13252
13622
  message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
13253
13623
  })), Option.toArray)];
13254
13624
  };
13255
13625
  const derivedProblems = (source, derived) => pipe(String$1.split(String$1.trim(derived), BLANK), Array.filter((url) => String$1.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)), Array.map((url) => ({
13256
- index: offsetOf(source, url),
13626
+ index: offsetOf$1(source, url),
13257
13627
  message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`
13258
13628
  })));
13259
13629
  const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
13260
13630
  ...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
13261
13631
  ...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
13262
- index: offsetOf(skill.source, LICENSE_KEY),
13632
+ index: offsetOf$1(skill.source, LICENSE_KEY),
13263
13633
  message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
13264
13634
  })), Option.toArray),
13265
13635
  ...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
13266
13636
  ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
13267
13637
  file: skill.file,
13268
13638
  ...positionOf(skill.source)(index),
13269
- rule: RULE$5,
13639
+ rule: RULE$7,
13270
13640
  message
13271
13641
  })));
13272
13642
  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) => ({
13273
13643
  target,
13274
- index: found.index ?? START$3
13644
+ index: found.index ?? START$5
13275
13645
  })), Option.toArray);
13276
- const rangeOf = (found) => {
13277
- const start = found.index ?? START$3;
13278
- return [start, start + found[START$3].length];
13646
+ const rangeOf$1 = (found) => {
13647
+ const start = found.index ?? START$5;
13648
+ return [start, start + found[START$5].length];
13279
13649
  };
13280
13650
  const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
13281
13651
  const linksIn = (source) => {
13282
- const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf));
13652
+ const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
13283
13653
  return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
13284
13654
  };
13285
13655
  const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
@@ -13293,11 +13663,11 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
13293
13663
  return pipe(missing, Array.map(({ target, index }) => ({
13294
13664
  file,
13295
13665
  ...positionOf(source)(index),
13296
- rule: RULE$5,
13666
+ rule: RULE$7,
13297
13667
  message: `links to ${target}, which does not exist. Fix the path or remove the link.`
13298
13668
  })));
13299
13669
  });
13300
- const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
13670
+ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
13301
13671
  const files = yield* RepositoryFiles;
13302
13672
  const file = files.join(root, name);
13303
13673
  const directory = files.dirname(name);
@@ -13309,7 +13679,7 @@ const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
13309
13679
  file: files.join(root, entry),
13310
13680
  line: FIRST$1,
13311
13681
  column: FIRST$1,
13312
- rule: RULE$5,
13682
+ rule: RULE$7,
13313
13683
  message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
13314
13684
  })));
13315
13685
  return [
@@ -13326,7 +13696,7 @@ const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
13326
13696
  const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
13327
13697
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
13328
13698
  const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
13329
- const found = yield* Effect.forEach(skills, (name) => problemsIn$3(root, listed, name), { concurrency: READ_CONCURRENCY$3 });
13699
+ const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$3 });
13330
13700
  return Array.flatten(found);
13331
13701
  });
13332
13702
  // src/features/check-version-downgrades/model/version-entries.ts
@@ -13389,7 +13759,7 @@ const cargoEntries = (text) => {
13389
13759
  };
13390
13760
  const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
13391
13761
  // src/features/check-version-downgrades/model/version-downgrade.ts
13392
- const RULE$4 = "version-downgrade";
13762
+ const RULE$6 = "version-downgrade";
13393
13763
  const DEFAULT_BASE = "origin/main";
13394
13764
  const READ_CONCURRENCY$2 = 16;
13395
13765
  const READERS = [
@@ -13415,7 +13785,7 @@ const downgradesIn = ({ file, text, before, after }) => {
13415
13785
  file,
13416
13786
  line: lineOf(text, entry),
13417
13787
  column: FIRST_LINE$1,
13418
- rule: RULE$4,
13788
+ rule: RULE$6,
13419
13789
  message: message(old, entry)
13420
13790
  })), Option.toArray)));
13421
13791
  };
@@ -13454,7 +13824,7 @@ const READ_CONCURRENCY$1 = 16;
13454
13824
  const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
13455
13825
  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.";
13456
13826
  const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
13457
- const problemsIn$2 = (file, source) => {
13827
+ const problemsIn$4 = (file, source) => {
13458
13828
  const at = positionOf(source);
13459
13829
  const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
13460
13830
  file,
@@ -13472,7 +13842,7 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
13472
13842
  const file = files.join(root, name);
13473
13843
  return files.readFile(file).pipe(Effect.map(Option.match({
13474
13844
  onNone: () => [],
13475
- onSome: (source) => problemsIn$2(file, source)
13845
+ onSome: (source) => problemsIn$4(file, source)
13476
13846
  })));
13477
13847
  }, { concurrency: READ_CONCURRENCY$1 });
13478
13848
  return Array.flatten(found);
@@ -13480,22 +13850,22 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
13480
13850
  // src/features/find-invisible-characters/model/hidden-unicode.ts
13481
13851
  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;
13482
13852
  const NUL = "\0";
13483
- const START$2 = 0;
13853
+ const START$4 = 0;
13484
13854
  const HEX = 16;
13485
13855
  const CODE_POINT_WIDTH = 4;
13486
13856
  const READ_CONCURRENCY = 64;
13487
- const RULE$3 = "hidden-unicode";
13488
- const hexOf = (character) => pipe(String$1.codePointAt(START$2)(character), Option.getOrElse(() => START$2), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
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"));
13489
13859
  const problemOf$1 = (file, source) => (found) => {
13490
- const hex = hexOf(found[START$2]);
13860
+ const hex = hexOf(found[START$4]);
13491
13861
  return {
13492
13862
  file,
13493
- ...positionOf(source)(found.index ?? START$2),
13494
- rule: RULE$3,
13863
+ ...positionOf(source)(found.index ?? START$4),
13864
+ rule: RULE$5,
13495
13865
  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}.`
13496
13866
  };
13497
13867
  };
13498
- const problemsIn$1 = (file, source) => {
13868
+ const problemsIn$3 = (file, source) => {
13499
13869
  if (String$1.includes(NUL)(source)) return [];
13500
13870
  return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
13501
13871
  };
@@ -13507,25 +13877,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
13507
13877
  const file = files.join(root, name);
13508
13878
  return files.readFile(file).pipe(Effect.map(Option.match({
13509
13879
  onNone: () => [],
13510
- onSome: (source) => problemsIn$1(file, source)
13880
+ onSome: (source) => problemsIn$3(file, source)
13511
13881
  })));
13512
13882
  }, { concurrency: READ_CONCURRENCY });
13513
13883
  return Array.flatten(found);
13514
13884
  });
13515
13885
  // src/features/find-unneeded-files/model/alchemy-patch.ts
13516
- const RULE$2 = "alchemy-patch";
13886
+ const RULE$4 = "alchemy-patch";
13517
13887
  const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
13518
13888
  const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
13519
- const START$1 = 0;
13889
+ const START$3 = 0;
13520
13890
  const problemOf = (file, position, name) => ({
13521
13891
  file,
13522
13892
  ...position,
13523
- rule: RULE$2,
13893
+ rule: RULE$4,
13524
13894
  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.`
13525
13895
  });
13526
- const problemsIn = (file, patched) => (source) => {
13896
+ const problemsIn$2 = (file, patched) => (source) => {
13527
13897
  const at = positionOf(source);
13528
- const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$1));
13898
+ const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$3));
13529
13899
  return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
13530
13900
  };
13531
13901
  /** @internal */
@@ -13535,12 +13905,12 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
13535
13905
  const text = yield* files.readFile(file);
13536
13906
  const manifest = yield* workspaceManifest(root);
13537
13907
  const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
13538
- return pipe(text, Option.map(problemsIn(file, patched)), Option.getOrElse(() => []));
13908
+ return pipe(text, Option.map(problemsIn$2(file, patched)), Option.getOrElse(() => []));
13539
13909
  });
13540
13910
  // src/features/find-unneeded-files/model/applied-packages.ts
13541
13911
  const MSCH = "@r_masseater/msch";
13542
- const SCOPE = "@r_masseater/";
13543
- const RULE$1 = "applied-package";
13912
+ const SCOPE$1 = "@r_masseater/";
13913
+ const RULE$3 = "applied-package";
13544
13914
  const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
13545
13915
  const NOT_FOUND = -1;
13546
13916
  const SEPARATOR$1 = "/";
@@ -13579,18 +13949,18 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
13579
13949
  onNone: () => Effect.succeed(Option.none()),
13580
13950
  onSome: (file) => readManifest(files.dirname(file))
13581
13951
  }));
13582
- const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE)));
13952
+ const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
13583
13953
  return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
13584
13954
  });
13585
- const problemAt = (file, source) => (index, name) => ({
13955
+ const problemAt$1 = (file, source) => (index, name) => ({
13586
13956
  file,
13587
13957
  ...positionOf(source)(index),
13588
- rule: RULE$1,
13958
+ rule: RULE$3,
13589
13959
  message: `msch applies ${name}. Remove this use and let msch apply it.`
13590
13960
  });
13591
13961
  const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
13592
13962
  const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
13593
- const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt(file, source)(found.index ?? NOT_FOUND, entry.name)))));
13963
+ 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)))));
13594
13964
  const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
13595
13965
  onEmpty: () => "",
13596
13966
  onNonEmpty: Array.max(BY_LENGTH)
@@ -13610,7 +13980,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
13610
13980
  declared: manifest
13611
13981
  }), Option.match({
13612
13982
  onNone: () => [],
13613
- onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt(file, source)(index, name)), Option.toArray)))
13983
+ onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$1(file, source)(index, name)), Option.toArray)))
13614
13984
  }));
13615
13985
  });
13616
13986
  const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
@@ -13640,7 +14010,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
13640
14010
  return yield* appliedPackageProblems(root, applied);
13641
14011
  });
13642
14012
  // src/features/find-unneeded-files/model/replaced-tools.ts
13643
- const RULE = "replaced-tool";
14013
+ const RULE$2 = "replaced-tool";
13644
14014
  const FIRST = 1;
13645
14015
  const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
13646
14016
  const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
@@ -13721,7 +14091,7 @@ const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern
13721
14091
  file,
13722
14092
  line: FIRST,
13723
14093
  column: FIRST,
13724
- rule: RULE,
14094
+ rule: RULE$2,
13725
14095
  message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
13726
14096
  })));
13727
14097
  /** @internal */
@@ -13750,7 +14120,7 @@ const SETUP_PATTERNS = [
13750
14120
  ];
13751
14121
  const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
13752
14122
  const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
13753
- const START = 0;
14123
+ const START$2 = 0;
13754
14124
  const LAST_SEGMENT = 1;
13755
14125
  const FIRST_LINE = 1;
13756
14126
  const FIRST_COLUMN = 1;
@@ -13820,7 +14190,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
13820
14190
  const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
13821
14191
  return directoriesOf(roots);
13822
14192
  });
13823
- const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START), (end) => String$1.slice(START, end)(name));
14193
+ const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$2), (end) => String$1.slice(START$2, end)(name));
13824
14194
  const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
13825
14195
  const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
13826
14196
  const cargoProblems = (present, enabled) => {
@@ -13855,6 +14225,128 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
13855
14225
  if (Option.isNone(workspace)) return [];
13856
14226
  return yield* unneededIn(root, cargoEnabled(workspace.value));
13857
14227
  });
14228
+ // src/features/check-package-scope/model/package-scope.ts
14229
+ const RULE$1 = "package-scope";
14230
+ const SCOPE = "@r_masseater/";
14231
+ const NAME_KEY = "\"name\"";
14232
+ const START$1 = 0;
14233
+ const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14234
+ const Manifest$1 = Schema.Struct({
14235
+ name: Schema.optional(Schema.String),
14236
+ private: Schema.optional(Schema.Boolean),
14237
+ publishConfig: Schema.optional(Schema.Unknown)
14238
+ });
14239
+ const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
14240
+ const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
14241
+ 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) => ({
14243
+ file: entry.file,
14244
+ ...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$1))),
14245
+ rule: RULE$1,
14246
+ message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
14247
+ })), Option.toArray);
14248
+ /** @internal */
14249
+ const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageScope(root) {
14250
+ const files = yield* RepositoryFiles;
14251
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED$1]);
14252
+ return yield* scanText(pipe(manifests, Array.map((name) => ({
14253
+ name,
14254
+ file: files.join(root, name)
14255
+ }))), problemsIn$1);
14256
+ });
14257
+ // src/features/check-runtime-version/model/node-version.ts
14258
+ const RULE = "node-version";
14259
+ const MINIMUM = 26;
14260
+ const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
14261
+ const MANIFEST = /(?:^|\/)package\.json$/u;
14262
+ const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
14263
+ const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
14264
+ const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
14265
+ const PINNED_VERSION = /^\s*v?(?<major>\d+)/u;
14266
+ const BASE_IMAGE = /^FROM[ \t]+(?:--\S+[ \t]+)*(?:[\w.-]+(?::\d+)?\/)*node:(?<major>\d+)/gimu;
14267
+ const SETUP_INPUT = /\bnode-version:[ \t]*["']?v?(?<major>\d+)/gu;
14268
+ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t]+)v?(?<major>\d+)/gmu;
14269
+ const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
14270
+ const ALTERNATIVE = "||";
14271
+ const ENGINES_KEY = "\"engines\"";
14272
+ const START = 0;
14273
+ const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14274
+ const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
14275
+ const Manifest = Schema.Struct({
14276
+ private: Schema.optional(Schema.Boolean),
14277
+ publishConfig: Schema.optional(Schema.Unknown),
14278
+ engines: Schema.optional(Engines)
14279
+ });
14280
+ const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
14281
+ const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
14282
+ const isOld = (major) => major < MINIMUM;
14283
+ const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
14284
+ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
14285
+ onNone: () => true,
14286
+ onSome: isOld
14287
+ }));
14288
+ const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
14289
+ const problemAt = ({ entry, source, index }, message) => ({
14290
+ file: entry.file,
14291
+ ...positionOf(source)(index),
14292
+ rule: RULE,
14293
+ message
14294
+ });
14295
+ const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START));
14296
+ const unstatedProblem = (entry, source) => problemAt({
14297
+ entry,
14298
+ source,
14299
+ index: START
14300
+ }, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
14301
+ const rangeProblem = (entry, source) => (range) => problemAt({
14302
+ entry,
14303
+ source,
14304
+ index: offsetOf(source, ENGINES_KEY)
14305
+ }, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
14306
+ const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
14307
+ const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
14308
+ const manifestProblems = (entry, source) => {
14309
+ const manifest = decodeManifest(source);
14310
+ if (Option.isNone(manifest)) return [];
14311
+ const range = rangeOf(manifest.value);
14312
+ if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
14313
+ return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
14314
+ };
14315
+ 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
+ entry,
14317
+ source,
14318
+ index: found.index ?? START
14319
+ }, `${SUPPORTED} \`${String$1.trim(found[START])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
14320
+ const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
14321
+ entry,
14322
+ source,
14323
+ index: START
14324
+ }, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
14325
+ const problemsIn = (entry, source) => {
14326
+ if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
14327
+ if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
14328
+ if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
14329
+ if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
14330
+ return pinnedProblems(SETUP_INPUT)(entry, source);
14331
+ };
14332
+ const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.test(entry.name) || STEP_FILE.test(entry.name) || isToolVersions(entry);
14333
+ /** @internal */
14334
+ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
14335
+ const files = yield* RepositoryFiles;
14336
+ const listed = yield* listedFiles(root);
14337
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED]);
14338
+ const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
14339
+ name,
14340
+ file: files.join(root, name)
14341
+ })))];
14342
+ return yield* scanText(sources, problemsIn);
14343
+ });
14344
+ // src/app/manifest-checks.ts
14345
+ /** @internal */
14346
+ const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
14347
+ const found = yield* Effect.all([checkNodeVersion(root), checkPackageScope(root)], { concurrency: "unbounded" });
14348
+ return Array.flatten(found);
14349
+ });
13858
14350
  // src/app/tracked-text.ts
13859
14351
  /** @internal */
13860
14352
  const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedText(root) {
@@ -13865,7 +14357,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
13865
14357
  checkUnneededFiles(root),
13866
14358
  checkReplacedTools(root),
13867
14359
  checkAlchemyPatch(root),
13868
- checkNodeVersion(root),
14360
+ checkManifests(root),
13869
14361
  checkSkillFiles(root),
13870
14362
  checkSkillEntry(root),
13871
14363
  checkPublishedSkills(root),
@@ -13874,7 +14366,8 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
13874
14366
  checkGitSubpath(root),
13875
14367
  checkDowngrades(root),
13876
14368
  checkRenovateSettings(root),
13877
- checkCatalogEntries(root)
14369
+ checkCatalogEntries(root),
14370
+ checkPackageRegistry(root)
13878
14371
  ], { concurrency: "unbounded" });
13879
14372
  return Array.flatten(found);
13880
14373
  });