@r_masseater/msch 0.63.0 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +1 -0
  2. package/dist/cli.mjs +661 -690
  3. package/dist/cli.mjs.map +1 -1
  4. package/dist/config-CvPuqi4L.mjs +5 -0
  5. package/dist/config-CvPuqi4L.mjs.map +1 -0
  6. package/dist/config.d.mts +1 -1
  7. package/dist/config.mjs +3 -2
  8. package/dist/config.mjs.map +1 -1
  9. package/dist/decision-rules.d.mts +1 -1
  10. package/dist/decision-rules.mjs +1 -1
  11. package/dist/{define-lint-preset-DAhPB3gc.mjs → define-lint-preset-DpGK82kj.mjs} +2 -7
  12. package/dist/define-lint-preset-DpGK82kj.mjs.map +1 -0
  13. package/dist/exits.mjs +12 -29
  14. package/dist/exits.mjs.map +1 -1
  15. package/dist/{index-DbHT4Cyx.d.mts → index-lKj9OQdX.d.mts} +1 -4
  16. package/dist/lint-rules.mjs +37 -380
  17. package/dist/lint-rules.mjs.map +1 -1
  18. package/dist/lint.d.mts +1 -1
  19. package/dist/lint.mjs +1 -1
  20. package/dist/lookup-DmifnzVb.mjs +46 -0
  21. package/dist/lookup-DmifnzVb.mjs.map +1 -0
  22. package/dist/lookup-report-ARfHc4ey.mjs +29 -0
  23. package/dist/lookup-report-ARfHc4ey.mjs.map +1 -0
  24. package/dist/publish.mjs +18 -32
  25. package/dist/publish.mjs.map +1 -1
  26. package/dist/reference-links-B9NZUUF8.mjs +172 -0
  27. package/dist/reference-links-B9NZUUF8.mjs.map +1 -0
  28. package/dist/refs.d.mts +1 -0
  29. package/dist/refs.mjs +209 -0
  30. package/dist/refs.mjs.map +1 -0
  31. package/dist/{upstream-exits-DitN-yYH.mjs → upstream-exits-Dp0EeI5D.mjs} +8 -33
  32. package/dist/upstream-exits-Dp0EeI5D.mjs.map +1 -0
  33. package/package.json +9 -6
  34. package/skills/msch-checks/SKILL.md +6 -1
  35. package/skills/msch-publishing/SKILL.md +1 -2
  36. package/skills/msch-repository-config/SKILL.md +0 -1
  37. package/skills/msch-workspace-settings/SKILL.md +0 -1
  38. package/dist/comment-directives-BD6WGsC7.mjs +0 -27
  39. package/dist/comment-directives-BD6WGsC7.mjs.map +0 -1
  40. package/dist/define-lint-preset-DAhPB3gc.mjs.map +0 -1
  41. package/dist/upstream-exits-DitN-yYH.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -3,12 +3,13 @@ import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as
3
3
  import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-B6p7x90y.mjs";
4
4
  import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-CFIrQmB5.mjs";
5
5
  import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
6
- import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-DitN-yYH.mjs";
6
+ import { o as positionOf } from "./lookup-DmifnzVb.mjs";
7
7
  import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
8
8
  import { a as problemAtPosition, i as problemAt$8, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-D2HKNIVq.mjs";
9
- import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-BD6WGsC7.mjs";
10
- import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
9
+ import { t as JAPANESE } from "./config-CvPuqi4L.mjs";
10
+ import { o as loadLanguage, s as readTree, t as checkReferenceLinks } from "./reference-links-B9NZUUF8.mjs";
11
11
  import { $ as isPropertyAccessExpression, A as getNameOfDeclaration, B as isExportDeclaration, D as SyntaxKind, E as SymbolFlags, F as isBlock, G as isImportDeclaration, H as isFunctionDeclaration, I as isCallExpression, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isParenthesizedExpression, R as isElementAccessExpression, T as SignatureKind, U as isFunctionExpression, V as isExpressionStatement, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as referencedSymbols, a as declarationsOf, at as isSpreadElement, b as symbolAtLocation, c as importedModulesOf, ct as isTypeLiteralNode, d as isInsideAny, dt as isVariableDeclaration, et as isPropertyAssignment, f as isOutsideDeclaration, ft as isVariableDeclarationList, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSourceFile, j as getTextOfJSDocComment, l as isExternalDeclaration, lt as isTypeReferenceNode, m as lineOf$3, n as childrenOf$2, nt as isSatisfiesExpression, o as declaresAType, ot as isStringLiteral, p as isTypeDeclaration, pt as isVariableStatement, q as isModuleBlock, r as columnOf, rt as isSignatureDeclaration, s as descendantsOf, st as isTypeAliasDeclaration, t as carriesTag, tt as isReturnStatement, u as isGenericDeclaration, ut as isUnionTypeNode, x as uniqueByReference, y as symbolAt, z as isEnumDeclaration } from "./syntax-C0ddqOHc.mjs";
12
+ import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits } from "./upstream-exits-Dp0EeI5D.mjs";
12
13
  import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-A2p57njU.mjs";
13
14
  import "./cli-contract-D7btWrEu.mjs";
14
15
  import { builtinModules } from "node:module";
@@ -19,7 +20,6 @@ import { ChildProcess } from "effect/process";
19
20
  import { parse, resolveConfigFromFile } from "vite-plus";
20
21
  import { parse as parse$1 } from "@pnpm/deps.path";
21
22
  import { fileURLToPath } from "node:url";
22
- import treeSitter from "@vscode/tree-sitter-wasm";
23
23
  import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
24
24
  import { rolldown } from "vite/rolldown";
25
25
  import { stripVTControlCharacters } from "node:util";
@@ -361,18 +361,18 @@ const withBaselineProbe = (overrides) => ({
361
361
  [BASELINE_PROBE]: REMOVED_DEPENDENCY
362
362
  });
363
363
  // src/features/check-overrides/model/overrides.ts
364
- const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
364
+ const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
365
365
  const RESOLUTION_FILES = [
366
366
  "*package.json",
367
- WORKSPACE_FILE$6,
367
+ WORKSPACE_FILE$5,
368
368
  "pnpm-lock.yaml",
369
369
  ".npmrc",
370
370
  "patches/*"
371
371
  ];
372
372
  const RESOLUTION_CONCURRENCY = 2;
373
373
  const SUCCEEDED$1 = 0;
374
- const taggedError$8 = Schema.TaggedError;
375
- var OverrideResolutionFailed = class extends taggedError$8()("OverrideResolutionFailed", {
374
+ const taggedError$7 = Schema.TaggedError;
375
+ var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
376
376
  override: Schema.String,
377
377
  output: Schema.String
378
378
  }) {};
@@ -466,7 +466,7 @@ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace,
466
466
  const { root, overrides } = workspace;
467
467
  const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));
468
468
  const judgeAgainstBaseline = judge(baseline);
469
- const file = path.join(root, WORKSPACE_FILE$6);
469
+ const file = path.join(root, WORKSPACE_FILE$5);
470
470
  const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(Effect.map((candidate) => overrideProblem({
471
471
  ...located,
472
472
  file
@@ -478,7 +478,7 @@ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace,
478
478
  const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
479
479
  const fs = yield* FileSystem.FileSystem;
480
480
  const path = yield* Path.Path;
481
- const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$6)).pipe(Effect.option);
481
+ const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$5)).pipe(Effect.option);
482
482
  const manifest = yield* workspaceManifest(root);
483
483
  const overrides = pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)), Option.getOrElse(() => ({})));
484
484
  const keys = pipe(source, Option.map((text) => overrideKeysOf(text)(overrides)), Option.getOrElse(() => []));
@@ -523,87 +523,87 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
523
523
  // src/features/check-overrides/model/git-subpath.ts
524
524
  const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
525
525
  const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
526
- const RULE$64 = "git-subpath-dependency";
526
+ const RULE$63 = "git-subpath-dependency";
527
527
  const WHOLE_MATCH$4 = 0;
528
528
  const problemAt$7 = ({ file }, source) => (found) => ({
529
529
  file,
530
530
  ...positionOf(source)(found.index ?? WHOLE_MATCH$4),
531
- rule: RULE$64,
531
+ rule: RULE$63,
532
532
  message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
533
533
  });
534
- const problemsIn$23 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
534
+ const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
535
535
  const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
536
536
  /** @internal */
537
537
  const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
538
538
  const listed = yield* listedFiles(root);
539
- return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$23);
539
+ return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$22);
540
540
  });
541
541
  // src/features/check-overrides/model/restricted-rules.ts
542
- const RULE$63 = "unnamed-restriction";
542
+ const RULE$62 = "unnamed-restriction";
543
543
  const WHOLE_MATCH$3 = 0;
544
544
  const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
545
- const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
545
+ const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
546
546
  file: entry.file,
547
547
  ...positionOf(source)(found.index ?? WHOLE_MATCH$3),
548
- rule: RULE$63,
548
+ rule: RULE$62,
549
549
  message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
550
550
  })));
551
551
  /** @internal */
552
552
  const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
553
553
  const listed = yield* listedFiles(root);
554
- return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$22);
554
+ return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
555
555
  });
556
556
  // src/features/check-overrides/model/type-exemptions.ts
557
- const RULE$62 = "named-type-exemption";
557
+ const RULE$61 = "named-type-exemption";
558
558
  const WHOLE_MATCH$2 = 0;
559
559
  const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
560
- const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
560
+ const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
561
561
  file: entry.file,
562
562
  ...positionOf(source)(found.index ?? WHOLE_MATCH$2),
563
- rule: RULE$62,
563
+ rule: RULE$61,
564
564
  message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
565
565
  })));
566
566
  /** @internal */
567
567
  const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
568
568
  const listed = yield* listedFiles(root);
569
- return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
569
+ return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
570
570
  });
571
571
  // src/features/check-overrides/model/package-registry.ts
572
- const RULE$61 = "package-registry";
572
+ const RULE$60 = "package-registry";
573
573
  const REGISTRY = "https://npm.flatt.tech/";
574
574
  const TRAILING_SLASH = /\/$/u;
575
- const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
575
+ const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
576
576
  const NPMRC = /(?:^|\/)\.npmrc$/u;
577
577
  const WORKSPACE_REGISTRY = /^registry:/mu;
578
578
  const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
579
- const START$24 = 0;
579
+ const START$23 = 0;
580
580
  const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
581
581
  const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
582
582
  const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
583
583
  const withoutSlash = String$1.replace(TRAILING_SLASH, "");
584
584
  const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
585
- const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$24));
585
+ const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
586
586
  const workspaceProblem = (file, source, registry) => ({
587
587
  file,
588
588
  ...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
589
- rule: RULE$61,
589
+ rule: RULE$60,
590
590
  message: Option.match(registry, {
591
- onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
591
+ onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$4}.`,
592
592
  onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
593
593
  })
594
594
  });
595
595
  const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
596
596
  file: entry.file,
597
- ...positionOf(source)(found.index ?? START$24),
598
- rule: RULE$61,
599
- message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
597
+ ...positionOf(source)(found.index ?? START$23),
598
+ rule: RULE$60,
599
+ message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$23])}\`. Remove the line.`
600
600
  })));
601
601
  const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
602
602
  const files = yield* RepositoryFiles;
603
603
  const manifest = yield* workspaceManifest(root);
604
604
  if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) return [];
605
605
  const registry = registryOf(manifest.value);
606
- const file = files.join(root, WORKSPACE_FILE$5);
606
+ const file = files.join(root, WORKSPACE_FILE$4);
607
607
  const read = yield* files.readFile(file);
608
608
  const source = Option.getOrElse(read, () => "");
609
609
  return [workspaceProblem(file, source, registry)];
@@ -615,7 +615,7 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
615
615
  return [...yield* checkWorkspace(root), ...overrides];
616
616
  });
617
617
  // src/entities/package/model/specifiers.ts
618
- const START$23 = 0;
618
+ const START$22 = 0;
619
619
  const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
620
620
  const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
621
621
  const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
@@ -636,7 +636,7 @@ const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.ra
636
636
  /** @internal */
637
637
  const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
638
638
  /** @internal */
639
- const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
639
+ const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$22));
640
640
  const SECTIONS = [
641
641
  "dependencies",
642
642
  "devDependencies",
@@ -645,7 +645,7 @@ const SECTIONS = [
645
645
  /** @internal */
646
646
  const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
647
647
  // src/features/check-placement/model/colocated-git-patterns.ts
648
- const RULE$60 = "colocated-git-patterns";
648
+ const RULE$59 = "colocated-git-patterns";
649
649
  const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
650
650
  const ROOT$3 = ".";
651
651
  const NEGATION$1 = "!";
@@ -692,7 +692,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
692
692
  const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
693
693
  return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
694
694
  });
695
- const patternProblem = (entry, message) => problemAtPosition(RULE$60)(entry.file, {
695
+ const patternProblem = (entry, message) => problemAtPosition(RULE$59)(entry.file, {
696
696
  line: entry.line,
697
697
  column: FIRST$22
698
698
  }, message);
@@ -755,7 +755,7 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
755
755
  return Array.getSomes([...misplacedFound, ...repeatedFound]);
756
756
  });
757
757
  // src/features/check-placement/model/colocated-tests.ts
758
- const RULE$59 = "colocated-test";
758
+ const RULE$58 = "colocated-test";
759
759
  const FIRST$21 = 1;
760
760
  const READ_CONCURRENCY$31 = 64;
761
761
  const ROOT_SUBPATH = ".";
@@ -783,7 +783,7 @@ const problemFor$9 = (test, message) => ({
783
783
  file: test.file,
784
784
  line: FIRST$21,
785
785
  column: FIRST$21,
786
- rule: RULE$59,
786
+ rule: RULE$58,
787
787
  message: `${test.base} ${message}`
788
788
  });
789
789
  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);
@@ -866,7 +866,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
866
866
  // src/features/check-placement/model/agent-docs-length.ts
867
867
  const RECOMMENDED_LINES = 200;
868
868
  const FIRST$20 = 1;
869
- const RULE$58 = "agent-docs-length";
869
+ const RULE$57 = "agent-docs-length";
870
870
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
871
871
  const problemFor$8 = (file) => (lines) => {
872
872
  if (lines <= RECOMMENDED_LINES) return Option.none();
@@ -874,14 +874,14 @@ const problemFor$8 = (file) => (lines) => {
874
874
  file,
875
875
  line: 201,
876
876
  column: FIRST$20,
877
- rule: RULE$58,
877
+ rule: RULE$57,
878
878
  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.`
879
879
  });
880
880
  };
881
881
  /** @internal */
882
882
  const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
883
883
  // src/features/check-placement/model/claude-link.ts
884
- const RULE$57 = "claude-md-link";
884
+ const RULE$56 = "claude-md-link";
885
885
  const CLAUDE = "CLAUDE.md";
886
886
  const AGENTS = "AGENTS.md";
887
887
  const FIRST$19 = 1;
@@ -900,7 +900,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
900
900
  file: path,
901
901
  line: FIRST$19,
902
902
  column: FIRST$19,
903
- rule: RULE$57,
903
+ rule: RULE$56,
904
904
  message: MESSAGE$17
905
905
  })));
906
906
  });
@@ -909,7 +909,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
909
909
  return Array.getSomes(found);
910
910
  });
911
911
  // src/features/check-placement/model/dangling-links.ts
912
- const RULE$56 = "dangling-link";
912
+ const RULE$55 = "dangling-link";
913
913
  const SEPARATOR$19 = "/";
914
914
  const FIRST$18 = 1;
915
915
  const READ_CONCURRENCY$28 = 16;
@@ -925,7 +925,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
925
925
  file,
926
926
  line: FIRST$18,
927
927
  column: FIRST$18,
928
- rule: RULE$56,
928
+ rule: RULE$55,
929
929
  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.`
930
930
  })));
931
931
  });
@@ -983,7 +983,7 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
983
983
  }));
984
984
  });
985
985
  // src/features/check-placement/model/deployed-readme.ts
986
- const RULE$55 = "deployed-readme";
986
+ const RULE$54 = "deployed-readme";
987
987
  const ROOT_DIRECTORY$3 = "";
988
988
  const READ_CONCURRENCY$27 = 16;
989
989
  const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
@@ -1023,14 +1023,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
1023
1023
  const readme = yield* readReadme({
1024
1024
  root,
1025
1025
  directory,
1026
- rule: RULE$55,
1026
+ rule: RULE$54,
1027
1027
  missingMessage: MISSING_MESSAGE$2
1028
1028
  });
1029
1029
  return Result.match(readme, {
1030
1030
  onFailure: Option.some,
1031
1031
  onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
1032
1032
  file,
1033
- rule: RULE$55,
1033
+ rule: RULE$54,
1034
1034
  message: NO_URL_MESSAGE
1035
1035
  })))
1036
1036
  });
@@ -1047,7 +1047,7 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
1047
1047
  return Array.getSomes(found);
1048
1048
  });
1049
1049
  // src/features/check-placement/model/nested-docs.ts
1050
- const RULE$54 = "nested-docs";
1050
+ const RULE$53 = "nested-docs";
1051
1051
  const CONFIG_FILE$7 = "vite.config.ts";
1052
1052
  const SEPARATOR$17 = "/";
1053
1053
  const READ_CONCURRENCY$26 = 64;
@@ -1057,10 +1057,10 @@ const README = /^README(?:\.[^/]+)?$/iu;
1057
1057
  const MANIFEST$5 = "package.json";
1058
1058
  const MISSING_RULE = "workspace-agents-md";
1059
1059
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
1060
- const taggedError$7 = Schema.TaggedError;
1061
- var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
1060
+ const taggedError$6 = Schema.TaggedError;
1061
+ var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
1062
1062
  const isNested = (name) => String$1.includes(SEPARATOR$17)(name);
1063
- const problemFor$7 = problemInFile(RULE$54);
1063
+ const problemFor$7 = problemInFile(RULE$53);
1064
1064
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
1065
1065
  const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
1066
1066
  const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
@@ -1117,7 +1117,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
1117
1117
  return [...Array.getSomes(found), ...missing];
1118
1118
  });
1119
1119
  // src/features/check-placement/model/published-readme.ts
1120
- const RULE$53 = "published-readme";
1120
+ const RULE$52 = "published-readme";
1121
1121
  const READ_CONCURRENCY$25 = 16;
1122
1122
  const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
1123
1123
  const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
@@ -1125,7 +1125,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
1125
1125
  const readme = yield* readReadme({
1126
1126
  root,
1127
1127
  directory,
1128
- rule: RULE$53,
1128
+ rule: RULE$52,
1129
1129
  missingMessage: MISSING_MESSAGE
1130
1130
  });
1131
1131
  return Result.match(readme, {
@@ -1136,7 +1136,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
1136
1136
  file,
1137
1137
  line,
1138
1138
  column,
1139
- rule: RULE$53,
1139
+ rule: RULE$52,
1140
1140
  message: MESSAGE$16
1141
1141
  };
1142
1142
  }))
@@ -1149,7 +1149,7 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
1149
1149
  return Array.getSomes(found);
1150
1150
  });
1151
1151
  // src/features/check-placement/model/published-tests.ts
1152
- const RULE$52 = "published-tests";
1152
+ const RULE$51 = "published-tests";
1153
1153
  const MANIFEST_FILE$2 = "package.json";
1154
1154
  const FILE_START = 1;
1155
1155
  const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
@@ -1164,7 +1164,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
1164
1164
  file: files.join(absolute, MANIFEST_FILE$2),
1165
1165
  line: FILE_START,
1166
1166
  column: FILE_START,
1167
- rule: RULE$52,
1167
+ rule: RULE$51,
1168
1168
  message: MESSAGE$15
1169
1169
  });
1170
1170
  });
@@ -1178,7 +1178,7 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
1178
1178
  return Array.getSomes(found);
1179
1179
  });
1180
1180
  // src/features/check-placement/model/root-docs.ts
1181
- const RULE$51 = "root-docs";
1181
+ const RULE$50 = "root-docs";
1182
1182
  const SEPARATOR$16 = "/";
1183
1183
  const FIRST$16 = 1;
1184
1184
  const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
@@ -1193,15 +1193,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
1193
1193
  file: files.join(root, name),
1194
1194
  line: FIRST$16,
1195
1195
  column: FIRST$16,
1196
- rule: RULE$51,
1196
+ rule: RULE$50,
1197
1197
  message: `${name} ${MESSAGE$14}`
1198
1198
  })));
1199
1199
  });
1200
1200
  // src/features/check-placement/model/root-readme.ts
1201
- const RULE$50 = "root-readme";
1201
+ const RULE$49 = "root-readme";
1202
1202
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
1203
1203
  const READ_CONCURRENCY$24 = 16;
1204
- const START$22 = 0;
1204
+ const START$21 = 0;
1205
1205
  const CHECK_POLICY = "@r_masseater/msch";
1206
1206
  const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
1207
1207
  const RELATIVE$1 = /^\.\//u;
@@ -1238,17 +1238,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
1238
1238
  onNone: () => ownNames(plugins, names),
1239
1239
  onSome: () => [directory]
1240
1240
  }));
1241
- const problemsIn$20 = (file, source, plugins) => (workspace) => {
1241
+ const problemsIn$19 = (file, source, plugins) => (workspace) => {
1242
1242
  const message = messageFor(workspace.directory);
1243
1243
  const at = positionOf(source);
1244
1244
  const pattern = patternFor(plugins)(workspace);
1245
- return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$50)(file, at(found.index ?? START$22), message)));
1245
+ return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$49)(file, at(found.index ?? START$21), message)));
1246
1246
  };
1247
1247
  const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
1248
1248
  const text = yield* (yield* RepositoryFiles).readFile(file);
1249
1249
  return pipe(text, Option.match({
1250
1250
  onNone: () => [],
1251
- onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$20(file, source, plugins)))
1251
+ onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$19(file, source, plugins)))
1252
1252
  }));
1253
1253
  });
1254
1254
  /** @internal */
@@ -1279,7 +1279,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
1279
1279
  return Array.flatten(found);
1280
1280
  });
1281
1281
  // src/features/check-placement/model/docs-mirror.ts
1282
- const RULE$49 = "docs-mirror";
1282
+ const RULE$48 = "docs-mirror";
1283
1283
  const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
1284
1284
  const MIRROR_LIMIT = 3;
1285
1285
  const READ_CONCURRENCY$23 = 16;
@@ -1304,7 +1304,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
1304
1304
  file,
1305
1305
  line,
1306
1306
  column,
1307
- rule: RULE$49,
1307
+ rule: RULE$48,
1308
1308
  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.`
1309
1309
  };
1310
1310
  }), Option.toArray);
@@ -1336,7 +1336,7 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
1336
1336
  return Array.flatten(found);
1337
1337
  });
1338
1338
  // src/features/check-placement/model/ignored-sources.ts
1339
- const RULE$48 = "ignored-sources";
1339
+ const RULE$47 = "ignored-sources";
1340
1340
  const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
1341
1341
  const FIRST$15 = 1;
1342
1342
  const MESSAGE$13 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
@@ -1348,7 +1348,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
1348
1348
  file: files.join(root, file),
1349
1349
  line: FIRST$15,
1350
1350
  column: FIRST$15,
1351
- rule: RULE$48,
1351
+ rule: RULE$47,
1352
1352
  message: MESSAGE$13
1353
1353
  })));
1354
1354
  });
@@ -1378,40 +1378,6 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
1378
1378
  const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems$2(root, workspace), { concurrency: 1 });
1379
1379
  return Array.flatten(entries);
1380
1380
  });
1381
- // src/shared/lib/tree-sitter.ts
1382
- const taggedError$6 = Schema.TaggedError;
1383
- var GrammarUnreadable = class extends taggedError$6()("GrammarUnreadable", {
1384
- grammar: Schema.String,
1385
- message: Schema.String
1386
- }) {};
1387
- const PARSER_KEY = "parser";
1388
- const initParser = startedOnce();
1389
- const loadOnce = startedOnce();
1390
- const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
1391
- const loadLanguage = (grammar) => {
1392
- const unreadable = (cause) => GrammarUnreadable.make({
1393
- grammar,
1394
- message: String(cause)
1395
- });
1396
- return Effect.tryPromise({
1397
- try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),
1398
- catch: unreadable
1399
- }).pipe(Effect.andThen(Effect.tryPromise({
1400
- try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),
1401
- catch: unreadable
1402
- })));
1403
- };
1404
- const readTree = ({ language, source, read }) => {
1405
- const parser = new treeSitter.Parser();
1406
- parser.setLanguage(language);
1407
- const tree = parser.parse(source);
1408
- parser.delete();
1409
- return Option.map(Option.fromNullishOr(tree), (parsed) => {
1410
- const result = read(parsed.rootNode);
1411
- parsed.delete();
1412
- return result;
1413
- });
1414
- };
1415
1381
  // src/features/check-placement/model/rust-layout.ts
1416
1382
  const LAYERS = [
1417
1383
  "app",
@@ -10028,7 +9994,7 @@ const LAYER_ITEMS = [
10028
9994
  ];
10029
9995
  const READ_CONCURRENCY$22 = 64;
10030
9996
  const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
10031
- const NONE$2 = [];
9997
+ const NONE$1 = [];
10032
9998
  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.";
10033
9999
  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.";
10034
10000
  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.";
@@ -10043,12 +10009,12 @@ const isRootItem = (inner) => (item) => {
10043
10009
  };
10044
10010
  const isLayerItem = (item) => Array.contains(LAYER_ITEMS, item.kind) || item.kind === "mod_item" && !item.inline;
10045
10011
  const entryProblems$1 = (file, modulePath, parsed) => {
10046
- if (!isSliceIndex(modulePath)) return NONE$2;
10012
+ if (!isSliceIndex(modulePath)) return NONE$1;
10047
10013
  return pipe(parsed.items, Array.filter((item) => item.kind === "mod_item" && item.visible), Array.map(itemProblem(file, ENTRY_RULE$1, ENTRY_MESSAGE)));
10048
10014
  };
10049
10015
  const moduleProblems = ({ source, parsed }) => entryProblems$1(source.file, modulePathOf(source.inner), parsed);
10050
10016
  const testProblems = ({ source, parsed }) => {
10051
- if (parsed.replacesAllocator) return NONE$2;
10017
+ if (parsed.replacesAllocator) return NONE$1;
10052
10018
  return [fileProblem$1({
10053
10019
  file: source.file,
10054
10020
  rule: TEST_RULE,
@@ -10061,8 +10027,8 @@ const PROBLEMS = {
10061
10027
  layer: (read) => strayItems(read, isLayerItem, LAYER_INDEX_MESSAGE),
10062
10028
  test: testProblems,
10063
10029
  module: moduleProblems,
10064
- skipped: () => NONE$2,
10065
- misplaced: () => NONE$2
10030
+ skipped: () => NONE$1,
10031
+ misplaced: () => NONE$1
10066
10032
  };
10067
10033
  const problemsOf$4 = (read) => PROBLEMS[kindOf$1(read.source.inner)](read);
10068
10034
  const misnamedSlice = ({ crate, inner }, root, join) => {
@@ -10099,20 +10065,20 @@ const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
10099
10065
  const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModules(root) {
10100
10066
  const files = yield* RepositoryFiles;
10101
10067
  const sources = yield* rustSources(root);
10102
- if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
10068
+ if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$1;
10103
10069
  const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
10104
10070
  const parse = parsedWith(language);
10105
10071
  const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$22 });
10106
10072
  return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
10107
10073
  });
10108
10074
  // src/features/check-placement/model/shadcn-ui-alias.ts
10109
- const RULE$47 = "shadcn-ui-alias";
10075
+ const RULE$46 = "shadcn-ui-alias";
10110
10076
  const FIRST$14 = 1;
10111
- const problemOf$9 = (directory, { file, alias }) => ({
10077
+ const problemOf$8 = (directory, { file, alias }) => ({
10112
10078
  file,
10113
10079
  line: FIRST$14,
10114
10080
  column: FIRST$14,
10115
- rule: RULE$47,
10081
+ rule: RULE$46,
10116
10082
  message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
10117
10083
  });
10118
10084
  /** @internal */
@@ -10124,7 +10090,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
10124
10090
  onNone: () => Effect.succeed(false),
10125
10091
  onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
10126
10092
  })) return Array.empty();
10127
- return [problemOf$9(directory, found.value)];
10093
+ return [problemOf$8(directory, found.value)];
10128
10094
  });
10129
10095
  // src/features/check-placement/model/source-aliases.ts
10130
10096
  const ALIAS_RULE = "source-alias";
@@ -10235,7 +10201,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
10235
10201
  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.`
10236
10202
  })));
10237
10203
  const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
10238
- const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
10204
+ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
10239
10205
  const files = yield* RepositoryFiles;
10240
10206
  const config = yield* workspaceConfigOf(root, directory);
10241
10207
  const entries = yield* declaredEntries(root, directory);
@@ -10274,12 +10240,12 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
10274
10240
  const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
10275
10241
  const all = ["", ...yield* workspaceDirectories(root)];
10276
10242
  const workflows = yield* workflowText(root);
10277
- const found = yield* Effect.forEach(all, (directory) => problemsIn$19(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
10243
+ const found = yield* Effect.forEach(all, (directory) => problemsIn$18(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
10278
10244
  const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
10279
10245
  return [...Array.flatten(found), ...Array.getSomes(scripts)];
10280
10246
  });
10281
10247
  // src/features/check-repository-layout/model/crates.ts
10282
- const RULE$46 = "unverified-crate";
10248
+ const RULE$45 = "unverified-crate";
10283
10249
  const VERSION_RULE = "release-version";
10284
10250
  const MANIFEST_FILE$1 = "package.json";
10285
10251
  const APP_DIRECTORIES = ["", "src-tauri"];
@@ -10293,7 +10259,7 @@ const problemFor$4 = (crate, message) => ({
10293
10259
  file: crate.manifest,
10294
10260
  line: FIRST$12,
10295
10261
  column: FIRST$12,
10296
- rule: RULE$46,
10262
+ rule: RULE$45,
10297
10263
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
10298
10264
  });
10299
10265
  const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
@@ -10329,7 +10295,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
10329
10295
  return Array.getSomes(Array.flatten(found));
10330
10296
  });
10331
10297
  // src/features/check-repository-layout/model/deploy-entry-patterns.ts
10332
- const RULE$45 = "deploy-entry-pattern";
10298
+ const RULE$44 = "deploy-entry-pattern";
10333
10299
  const FALLOW_KEYS = [
10334
10300
  "entry",
10335
10301
  "entryPoints",
@@ -10384,7 +10350,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
10384
10350
  const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
10385
10351
  return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
10386
10352
  });
10387
- const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(request) {
10353
+ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
10388
10354
  const { root, file, kind, workspaces, entries } = request;
10389
10355
  const files = yield* RepositoryFiles;
10390
10356
  const path = files.join(root, file);
@@ -10400,7 +10366,7 @@ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(request) {
10400
10366
  return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
10401
10367
  file: path,
10402
10368
  ...positionOf(text.value)(start - kind.offset),
10403
- rule: RULE$45,
10369
+ rule: RULE$44,
10404
10370
  message: `${pattern} ${MESSAGE$12}`
10405
10371
  })));
10406
10372
  });
@@ -10423,7 +10389,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
10423
10389
  }];
10424
10390
  return [];
10425
10391
  }));
10426
- const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$18({
10392
+ const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$17({
10427
10393
  root,
10428
10394
  file,
10429
10395
  kind,
@@ -10433,7 +10399,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
10433
10399
  return Array.flatten(found);
10434
10400
  });
10435
10401
  // src/features/check-repository-layout/model/fallow-entries.ts
10436
- const RULE$44 = "listed-entry";
10402
+ const RULE$43 = "listed-entry";
10437
10403
  const ENTRY_KEYS = [
10438
10404
  "entry",
10439
10405
  "entryPoints",
@@ -10454,7 +10420,7 @@ const entryPatternsIn = (node) => {
10454
10420
  return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
10455
10421
  };
10456
10422
  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);
10457
- const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
10423
+ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
10458
10424
  const files = yield* RepositoryFiles;
10459
10425
  const path = files.join(root, file);
10460
10426
  const text = yield* files.readFile(path);
@@ -10463,7 +10429,7 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
10463
10429
  return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
10464
10430
  file: path,
10465
10431
  ...positionOf(text.value)(start),
10466
- rule: RULE$44,
10432
+ rule: RULE$43,
10467
10433
  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.`
10468
10434
  })));
10469
10435
  });
@@ -10471,11 +10437,11 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
10471
10437
  const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
10472
10438
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10473
10439
  const directories = yield* workspaceDirectories(root);
10474
- const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$17(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
10440
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$16(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
10475
10441
  return Array.flatten(found);
10476
10442
  });
10477
10443
  // src/features/check-repository-layout/model/root-workspace-paths.ts
10478
- const RULE$43 = "root-workspace-path";
10444
+ const RULE$42 = "root-workspace-path";
10479
10445
  const CONFIG_FILE$5 = "vite.config.ts";
10480
10446
  const PATH_CHARACTER = /[\w.@/-]/u;
10481
10447
  const NAME_CHARACTER = /[\w.@-]/u;
@@ -10491,10 +10457,10 @@ const mentions = (directory) => (text) => {
10491
10457
  return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
10492
10458
  }));
10493
10459
  };
10494
- const problemsIn$16 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
10460
+ const problemsIn$15 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
10495
10461
  file,
10496
10462
  ...positionOf(source)(found.start),
10497
- rule: RULE$43,
10463
+ rule: RULE$42,
10498
10464
  message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
10499
10465
  })));
10500
10466
  /** @internal */
@@ -10505,10 +10471,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
10505
10471
  if (Option.isNone(source)) return [];
10506
10472
  const directories = yield* workspaceDirectories(root);
10507
10473
  const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
10508
- return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$16(file, source.value, directories)));
10474
+ return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$15(file, source.value, directories)));
10509
10475
  });
10510
10476
  // src/features/check-repository-layout/model/hidden-verify.ts
10511
- const RULE$42 = "hidden-verify";
10477
+ const RULE$41 = "hidden-verify";
10512
10478
  const CONFIG_FILE$4 = "vite.config.ts";
10513
10479
  const FIRST$10 = 1;
10514
10480
  const READ_CONCURRENCY$17 = 8;
@@ -10522,7 +10488,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
10522
10488
  file,
10523
10489
  line: FIRST$10,
10524
10490
  column: FIRST$10,
10525
- rule: RULE$42,
10491
+ rule: RULE$41,
10526
10492
  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}.`
10527
10493
  }).pipe(Option.filter(() => verified));
10528
10494
  });
@@ -10533,7 +10499,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
10533
10499
  return Array.getSomes(found);
10534
10500
  });
10535
10501
  // src/features/check-repository-layout/model/shared-uncached-tasks.ts
10536
- const RULE$41 = "shared-uncached-task";
10502
+ const RULE$40 = "shared-uncached-task";
10537
10503
  const READ_CONCURRENCY$16 = 8;
10538
10504
  const SHARED = 2;
10539
10505
  const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
@@ -10576,7 +10542,7 @@ const problemsOf$3 = (definitions) => {
10576
10542
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
10577
10543
  file,
10578
10544
  ...position,
10579
- rule: RULE$41,
10545
+ rule: RULE$40,
10580
10546
  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.`
10581
10547
  })));
10582
10548
  };
@@ -10587,7 +10553,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
10587
10553
  return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
10588
10554
  });
10589
10555
  // src/features/check-repository-layout/model/unlocked-tasks.ts
10590
- const RULE$40 = "unlocked-task";
10556
+ const RULE$39 = "unlocked-task";
10591
10557
  const READ_CONCURRENCY$15 = 8;
10592
10558
  const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
10593
10559
  const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
@@ -10599,7 +10565,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
10599
10565
  const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
10600
10566
  file,
10601
10567
  ...positionOf(source)(task.start),
10602
- rule: RULE$40,
10568
+ rule: RULE$39,
10603
10569
  message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
10604
10570
  })), Option.toArray)));
10605
10571
  /** @internal */
@@ -10754,7 +10720,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
10754
10720
  /** @internal */
10755
10721
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
10756
10722
  // src/features/check-repository-layout/model/workflow-paths.ts
10757
- const RULE$39 = "workflow-path";
10723
+ const RULE$38 = "workflow-path";
10758
10724
  const WORKFLOW_DIRECTORY = ".github/workflows/";
10759
10725
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
10760
10726
  const READ_CONCURRENCY$14 = 8;
@@ -10817,25 +10783,25 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
10817
10783
  if (yield* RESOLVERS[found.kind](root, found.path)) return false;
10818
10784
  return !(yield* isIgnored(root, found.path));
10819
10785
  });
10820
- const problemOf$8 = (file, source) => (found) => ({
10786
+ const problemOf$7 = (file, source) => (found) => ({
10821
10787
  file,
10822
10788
  ...positionOf(source)(found.offset),
10823
- rule: RULE$39,
10789
+ rule: RULE$38,
10824
10790
  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.`
10825
10791
  });
10826
- const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
10792
+ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
10827
10793
  const files = yield* RepositoryFiles;
10828
10794
  const file = files.join(root, workflow);
10829
10795
  const source = yield* files.readFile(file);
10830
10796
  if (Option.isNone(source)) return [];
10831
10797
  const produced = producedPaths(source.value);
10832
10798
  const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing$1(root, produced, found));
10833
- return pipe(missing, Array.map(problemOf$8(file, source.value)));
10799
+ return pipe(missing, Array.map(problemOf$7(file, source.value)));
10834
10800
  });
10835
10801
  /** @internal */
10836
10802
  const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
10837
10803
  const listed = yield* (yield* RepositoryFiles).listedFiles(root);
10838
- const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$15(root, workflow), { concurrency: READ_CONCURRENCY$14 });
10804
+ const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$14(root, workflow), { concurrency: READ_CONCURRENCY$14 });
10839
10805
  return Array.flatten(found);
10840
10806
  });
10841
10807
  // src/features/check-repository-layout/model/workflow-scale.ts
@@ -10846,7 +10812,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
10846
10812
  const FILTER_KEYS = ["paths", "paths-ignore"];
10847
10813
  const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
10848
10814
  const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
10849
- const START$21 = 0;
10815
+ const START$20 = 0;
10850
10816
  const READ_CONCURRENCY$13 = 8;
10851
10817
  const SEPARATOR$8 = "/";
10852
10818
  const WORD_SEPARATORS = /[-_]/gu;
@@ -10877,7 +10843,7 @@ const namesIn$1 = (name, source) => {
10877
10843
  return [
10878
10844
  {
10879
10845
  text: name,
10880
- offset: START$21
10846
+ offset: START$20
10881
10847
  },
10882
10848
  ...Option.toArray(stringOf(childOf("name")(root))),
10883
10849
  ...keysOf$1(childOf("jobs")(root))
@@ -11134,11 +11100,11 @@ const LISTED_LARGEST = 5;
11134
11100
  const SIZE_CONCURRENCY = 32;
11135
11101
  const MEGABYTE = 1e6;
11136
11102
  const MEGABYTE_DIGITS = 1;
11137
- const START$20 = 0;
11103
+ const START$19 = 0;
11138
11104
  const SINGLE_ENTRY = 1;
11139
11105
  const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
11140
11106
  const usageHint = (dependency, entryCount) => {
11141
- if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$20 && dependency.entries.length < entryCount)) return "";
11107
+ if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$19 && dependency.entries.length < entryCount)) return "";
11142
11108
  return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
11143
11109
  };
11144
11110
  const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
@@ -11147,7 +11113,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
11147
11113
  const { workspace, total } = overrun;
11148
11114
  const config = yield* files.readFile(workspace.configFile);
11149
11115
  const source = Option.getOrElse(config, () => "");
11150
- const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$20);
11116
+ const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$19);
11151
11117
  return {
11152
11118
  file: workspace.configFile,
11153
11119
  ...positionOf(source)(index),
@@ -11164,7 +11130,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
11164
11130
  const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
11165
11131
  const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
11166
11132
  const sizes = HashMap.fromIterable(measured);
11167
- const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$20)), Number$1.sumAll);
11133
+ const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$19)), Number$1.sumAll);
11168
11134
  return {
11169
11135
  closures,
11170
11136
  sizeOf,
@@ -11197,11 +11163,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
11197
11163
  })];
11198
11164
  });
11199
11165
  const stackProblems = (file, source, dependencies) => {
11200
- const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$20);
11166
+ const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$19);
11201
11167
  const rest = String$1.slice(section)(source);
11202
11168
  return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
11203
11169
  file,
11204
- ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
11170
+ ...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
11205
11171
  rule: STACK_DEPENDENCY,
11206
11172
  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.`
11207
11173
  })));
@@ -11371,19 +11337,19 @@ const declaredBy$1 = ({ declared, locator }) => {
11371
11337
  };
11372
11338
  };
11373
11339
  // src/features/check-tree-shaking/model/optional-peers.ts
11374
- const RULE$38 = "optional-peer";
11375
- const START$19 = 0;
11340
+ const RULE$37 = "optional-peer";
11341
+ const START$18 = 0;
11376
11342
  const SINGLE = 1;
11377
11343
  const DEPENDENCIES_KEY = "\"dependencies\"";
11378
11344
  const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
11379
11345
  const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
11380
11346
  const problemFor$3 = (located, name, importers) => {
11381
- const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$19);
11347
+ const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$18);
11382
11348
  const rest = String$1.slice(section)(located.source);
11383
11349
  return {
11384
11350
  file: located.file,
11385
- ...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
11386
- rule: RULE$38,
11351
+ ...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$18)),
11352
+ rule: RULE$37,
11387
11353
  message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
11388
11354
  };
11389
11355
  };
@@ -11394,14 +11360,14 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
11394
11360
  return pipe(dependencies, Array.flatMap((name) => {
11395
11361
  const importers = pipe(libraries, Array.filter(importsPackage(name)));
11396
11362
  const neededByBin = pipe(bins, Array.some(importsPackage(name)));
11397
- if (!(importers.length > START$19 && importers.length < libraries.length) || neededByBin) return [];
11363
+ if (!(importers.length > START$18 && importers.length < libraries.length) || neededByBin) return [];
11398
11364
  return [problemFor$3(located, name, importers)];
11399
11365
  }));
11400
11366
  };
11401
11367
  // src/features/check-tree-shaking/model/side-effects.ts
11402
- const RULE$37 = "side-effects";
11368
+ const RULE$36 = "side-effects";
11403
11369
  const BUNDLE_CONCURRENCY$2 = 4;
11404
- const START$18 = 0;
11370
+ const START$17 = 0;
11405
11371
  const FIRST$8 = 1;
11406
11372
  const LISTED_PACKAGES = 4;
11407
11373
  const SIDE_EFFECTS_KEY = "\"sideEffects\"";
@@ -11425,7 +11391,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
11425
11391
  label: entry.label,
11426
11392
  member,
11427
11393
  ...extra
11428
- }, ({ modules }) => modules > START$18);
11394
+ }, ({ modules }) => modules > START$17);
11429
11395
  });
11430
11396
  const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
11431
11397
  const names = yield* exportNamesOf(subject.scope, subject.entry.source);
@@ -11447,15 +11413,15 @@ const othersOf = (total) => {
11447
11413
  };
11448
11414
  const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
11449
11415
  const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
11450
- const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$18));
11416
+ const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$17));
11451
11417
  const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
11452
11418
  file,
11453
11419
  ...positionOf(source)(keyIndex$1(source)),
11454
- rule: RULE$37,
11420
+ rule: RULE$36,
11455
11421
  message: messageOf$4(worst, excesses.length)
11456
11422
  })), Option.toArray);
11457
11423
  // src/features/check-tree-shaking/model/top-level-effects.ts
11458
- const RULE$36 = "top-level-effect";
11424
+ const RULE$35 = "top-level-effect";
11459
11425
  const CODE$1 = /\.[cm]?[jt]sx?$/u;
11460
11426
  const READ_CONCURRENCY$12 = 16;
11461
11427
  const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
@@ -11468,10 +11434,10 @@ const messageOf$3 = (statement) => {
11468
11434
  if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
11469
11435
  return STATEMENT_MESSAGE;
11470
11436
  };
11471
- const problemsIn$14 = (api) => (file) => (source) => {
11437
+ const problemsIn$13 = (api) => (file) => (source) => {
11472
11438
  const retained = api.createSourceFile(file, source);
11473
11439
  const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$8({
11474
- rule: RULE$36,
11440
+ rule: RULE$35,
11475
11441
  message: messageOf$3(statement)
11476
11442
  })(statement)));
11477
11443
  retained.dispose();
@@ -11484,7 +11450,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
11484
11450
  const names = yield* files.ownedFiles(root);
11485
11451
  const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
11486
11452
  const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
11487
- const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$14(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
11453
+ const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$13(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
11488
11454
  return Array.flatten(found);
11489
11455
  }, Effect.scoped);
11490
11456
  // src/features/check-tree-shaking/model/usage.ts
@@ -11595,7 +11561,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
11595
11561
  return Array.flatten(found);
11596
11562
  });
11597
11563
  // src/features/check-typescript-generation/model/typescript-generation.ts
11598
- const RULE$35 = "legacy-typescript";
11564
+ const RULE$34 = "legacy-typescript";
11599
11565
  const LOCKFILE = "pnpm-lock.yaml";
11600
11566
  const COMPILER = "typescript";
11601
11567
  const CURRENT_MAJOR = 7;
@@ -11626,12 +11592,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
11626
11592
  file,
11627
11593
  line: lineOf$2(source)(legacy.id),
11628
11594
  column: FIRST$7,
11629
- rule: RULE$35,
11595
+ rule: RULE$34,
11630
11596
  message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
11631
11597
  })));
11632
11598
  });
11633
11599
  // src/features/check-worker-bundles/model/worker-bundles.ts
11634
- const RULE$34 = "worker-bundle";
11600
+ const RULE$33 = "worker-bundle";
11635
11601
  const BUNDLE_CONCURRENCY = 4;
11636
11602
  const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
11637
11603
  const CONDITIONS = [
@@ -11642,8 +11608,8 @@ const CONDITIONS = [
11642
11608
  "module",
11643
11609
  "default"
11644
11610
  ];
11645
- const problemFor$2 = problemInFile(RULE$34);
11646
- const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
11611
+ const problemFor$2 = problemInFile(RULE$33);
11612
+ const problemOf$6 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
11647
11613
  const bundleProblem = (file) => Effect.gen(function* bundle() {
11648
11614
  const built = yield* Effect.tryPromise({
11649
11615
  try: () => rolldown({
@@ -11662,7 +11628,7 @@ const bundleProblem = (file) => Effect.gen(function* bundle() {
11662
11628
  yield* Effect.promise(() => built.close());
11663
11629
  }).pipe(Effect.match({
11664
11630
  onSuccess: () => Option.none(),
11665
- onFailure: (detail) => Option.some(problemOf$7(file, detail))
11631
+ onFailure: (detail) => Option.some(problemOf$6(file, detail))
11666
11632
  }));
11667
11633
  /** @internal */
11668
11634
  const checkWorkerBundles = Effect.fn("checkWorkerBundles")(function* checkWorkerBundles(root) {
@@ -11764,7 +11730,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
11764
11730
  imports: importedFilesOf(checker)(sourceFile)
11765
11731
  })), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
11766
11732
  // src/features/check-value-owners/model/name-lists.ts
11767
- const RULE$33 = "hand-written-names";
11733
+ const RULE$32 = "hand-written-names";
11768
11734
  const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
11769
11735
  const nameListOf = (site) => {
11770
11736
  if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
@@ -11779,10 +11745,10 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
11779
11745
  file,
11780
11746
  line,
11781
11747
  column,
11782
- rule: RULE$33,
11748
+ rule: RULE$32,
11783
11749
  message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
11784
11750
  });
11785
- const problemOf$6 = ({ list, reason }) => listedProblem({
11751
+ const problemOf$5 = ({ list, reason }) => listedProblem({
11786
11752
  file: list.site.file,
11787
11753
  line: list.site.line,
11788
11754
  column: list.site.column,
@@ -12384,7 +12350,7 @@ const declaredNameProblem = ({ literals, relative }) => {
12384
12350
  if (defined.length < mostNamesOf(list) || files.length < 2) return Option.none();
12385
12351
  const names = pipe(defined, Array.map(([name]) => name));
12386
12352
  const shown = pipe(files, Array.take(SHOWN_FILES), Array.map(relative), Array.join(", "));
12387
- return Option.some(problemOf$6({
12353
+ return Option.some(problemOf$5({
12388
12354
  list,
12389
12355
  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.`
12390
12356
  }));
@@ -12417,11 +12383,11 @@ const listedPathProblem = (repository) => (list) => {
12417
12383
  const paths = pipe(list.names, Array.map(namedPath(repository, list.site.file)), Array.getSomes);
12418
12384
  const packages = pipe(list.names, Array.filter((name) => HashSet.has(repository.packages, name)));
12419
12385
  const directory = enumeratedDirectory(repository)(paths);
12420
- if (Option.isSome(directory)) return Option.some(problemOf$6({
12386
+ if (Option.isSome(directory)) return Option.some(problemOf$5({
12421
12387
  list,
12422
12388
  reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`
12423
12389
  }));
12424
- if (packages.length >= 2) return Option.some(problemOf$6({
12390
+ if (packages.length >= 2) return Option.some(problemOf$5({
12425
12391
  list,
12426
12392
  reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`
12427
12393
  }));
@@ -12436,7 +12402,7 @@ const connected = (index) => (left, right) => left === right || imports(index)(l
12436
12402
  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);
12437
12403
  const subsetListProblem = ({ lists, literals, relative }) => {
12438
12404
  const index = importIndexOf(literals);
12439
- return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$6({
12405
+ return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$5({
12440
12406
  list,
12441
12407
  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.`
12442
12408
  })));
@@ -12580,7 +12546,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
12580
12546
  return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
12581
12547
  }, Effect.scoped);
12582
12548
  // src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
12583
- const RULE$32 = "namespace-destructuring";
12549
+ const RULE$31 = "namespace-destructuring";
12584
12550
  const LOCAL = /^[.#/]/u;
12585
12551
  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.`;
12586
12552
  const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
@@ -12595,16 +12561,16 @@ const destructuredName = (declaration) => {
12595
12561
  if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
12596
12562
  return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
12597
12563
  };
12598
- const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
12599
- rule: RULE$32,
12564
+ const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
12565
+ rule: RULE$31,
12600
12566
  message: messageOf$1(name)
12601
12567
  })), Option.map((report) => report(declaration)));
12602
12568
  const namespaceDestructuringIn = () => (sourceFile) => {
12603
12569
  const names = importedNames(sourceFile);
12604
- return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
12570
+ return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$4(names)), Array.getSomes);
12605
12571
  };
12606
12572
  // src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
12607
- const RULE$31 = "pass-through-wrapper";
12573
+ const RULE$30 = "pass-through-wrapper";
12608
12574
  const SINGLE_STATEMENT = 1;
12609
12575
  const SINGLE_DECLARATION = 1;
12610
12576
  const THIS_PARAMETER = "this";
@@ -12698,14 +12664,14 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
12698
12664
  const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
12699
12665
  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);
12700
12666
  };
12701
- const problemOf$4 = (checker) => (candidate) => {
12667
+ const problemOf$3 = (checker) => (candidate) => {
12702
12668
  if (changesTheCall(candidate.wrapper)) return Option.none();
12703
12669
  return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
12704
- rule: RULE$31,
12670
+ rule: RULE$30,
12705
12671
  message: messageOf(forward.callee.getText())
12706
12672
  })(candidate.name)));
12707
12673
  };
12708
- const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$4(checker)), Array.getSomes);
12674
+ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$3(checker)), Array.getSomes);
12709
12675
  // src/app/source-checks.ts
12710
12676
  /** @internal */
12711
12677
  const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
@@ -12727,7 +12693,7 @@ var plugins = [{
12727
12693
  "description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
12728
12694
  }];
12729
12695
  // src/features/check-agent-settings/model/known-plugins.ts
12730
- const RULE$30 = "known-plugins";
12696
+ const RULE$29 = "known-plugins";
12731
12697
  const SETTINGS_FILE$2 = ".claude/settings.json";
12732
12698
  const GITHUB$2 = "github";
12733
12699
  const Source$1 = Schema.Struct({
@@ -12745,7 +12711,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
12745
12711
  const REPOSITORY_NAME = "masseater/masseater.dev";
12746
12712
  const MARKETPLACE = name;
12747
12713
  const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
12748
- const problem$1 = problemInFile(RULE$30);
12714
+ const problem$1 = problemInFile(RULE$29);
12749
12715
  const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
12750
12716
  const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
12751
12717
  const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
@@ -12766,20 +12732,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
12766
12732
  return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
12767
12733
  });
12768
12734
  // src/features/check-agent-settings/model/missing-hooks.ts
12769
- const RULE$29 = "missing-hook";
12735
+ const RULE$28 = "missing-hook";
12770
12736
  const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
12771
12737
  const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
12772
12738
  const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
12773
12739
  const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
12774
12740
  const PLUGIN_ROOT = "..";
12775
12741
  const READ_CONCURRENCY$11 = 16;
12776
- const START$17 = 0;
12742
+ const START$16 = 0;
12777
12743
  const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
12778
12744
  path,
12779
- index: found.index ?? START$17
12745
+ index: found.index ?? START$16
12780
12746
  })), Option.toArray);
12781
12747
  const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
12782
- const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
12748
+ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
12783
12749
  const files = yield* RepositoryFiles;
12784
12750
  const text = yield* files.readFile(file);
12785
12751
  if (Option.isNone(text)) return [];
@@ -12791,7 +12757,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
12791
12757
  return pipe(missing, Array.map(({ path, index }) => ({
12792
12758
  file,
12793
12759
  ...positionOf(source)(index),
12794
- rule: RULE$29,
12760
+ rule: RULE$28,
12795
12761
  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.`
12796
12762
  })));
12797
12763
  });
@@ -12815,7 +12781,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
12815
12781
  }];
12816
12782
  return [];
12817
12783
  }));
12818
- const found = yield* Effect.forEach(hookFiles, problemsIn$13, { concurrency: READ_CONCURRENCY$11 });
12784
+ const found = yield* Effect.forEach(hookFiles, problemsIn$12, { concurrency: READ_CONCURRENCY$11 });
12819
12785
  return Array.flatten(found);
12820
12786
  });
12821
12787
  // src/features/check-documented-commands/model/task-graph.ts
@@ -12844,7 +12810,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
12844
12810
  }, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
12845
12811
  const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
12846
12812
  // src/features/check-documented-commands/model/commands.ts
12847
- const RULE$28 = "documented-commands";
12813
+ const RULE$27 = "documented-commands";
12848
12814
  const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
12849
12815
  const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
12850
12816
  const COMMAND = /`vp run (?<args>[^`]+)`/gu;
@@ -12863,7 +12829,7 @@ const FILTER_ASSIGNMENT = "--filter=";
12863
12829
  const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
12864
12830
  const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
12865
12831
  const ONE$1 = 1;
12866
- const START$16 = 0;
12832
+ const START$15 = 0;
12867
12833
  const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
12868
12834
  const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
12869
12835
  const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
@@ -12919,11 +12885,11 @@ const whereOf = (scope, file) => {
12919
12885
  return `the package that holds ${file}`;
12920
12886
  };
12921
12887
  const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
12922
- const problemsIn$12 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
12888
+ const problemsIn$11 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
12923
12889
  file: absolute(file),
12924
- ...positionOf(text)(match.index ?? START$16),
12925
- rule: RULE$28,
12926
- message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
12890
+ ...positionOf(text)(match.index ?? START$15),
12891
+ rule: RULE$27,
12892
+ message: `${match[START$15]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
12927
12893
  })), Option.toArray)));
12928
12894
  const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
12929
12895
  /** @internal */
@@ -12947,14 +12913,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
12947
12913
  file: absolute(Array.headNonEmpty(commanded).file),
12948
12914
  line: ONE$1,
12949
12915
  column: ONE$1,
12950
- rule: RULE$28,
12916
+ rule: RULE$27,
12951
12917
  message: "msch could not list the tasks with `vp run --json`"
12952
12918
  }],
12953
- onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$12(found, absolute, document)))
12919
+ onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$11(found, absolute, document)))
12954
12920
  });
12955
12921
  });
12956
12922
  // src/features/check-legacy-web/model/legacy-web.ts
12957
- const RULE$27 = "legacy-web";
12923
+ const RULE$26 = "legacy-web";
12958
12924
  const FIRST_COLUMN$3 = 1;
12959
12925
  const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
12960
12926
  const Finding = Schema.Struct({
@@ -12993,7 +12959,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
12993
12959
  file: files.join(root, file),
12994
12960
  line,
12995
12961
  column: FIRST_COLUMN$3,
12996
- rule: RULE$27,
12962
+ rule: RULE$26,
12997
12963
  message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
12998
12964
  });
12999
12965
  return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
@@ -13064,7 +13030,7 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
13064
13030
  const EXTENSION = /\.[^./]+$/u;
13065
13031
  const SETTINGS_FILE = ".claude/settings.json";
13066
13032
  const READ_CONCURRENCY$10 = 64;
13067
- const RULE$26 = "shell-script";
13033
+ const RULE$25 = "shell-script";
13068
13034
  const MESSAGE$11 = "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.";
13069
13035
  const HookSchema = Schema.Struct({
13070
13036
  command: Schema.optional(Schema.String),
@@ -13097,7 +13063,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
13097
13063
  };
13098
13064
  const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
13099
13065
  const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
13100
- return pipe(shell, Array.map((name) => problemInFile(RULE$26)(files.join(root, name), MESSAGE$11)));
13066
+ return pipe(shell, Array.map((name) => problemInFile(RULE$25)(files.join(root, name), MESSAGE$11)));
13101
13067
  });
13102
13068
  // src/shared/lib/workflow-files.ts
13103
13069
  const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
@@ -13116,8 +13082,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
13116
13082
  });
13117
13083
  // src/shared/lib/workflow-run.ts
13118
13084
  const RUN_KEY = "run";
13119
- const START$15 = 0;
13120
- const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
13085
+ const START$14 = 0;
13086
+ const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$14));
13121
13087
  const runScriptsOf = (source) => {
13122
13088
  const found = [];
13123
13089
  visit(parseDocument(source), { Pair: (_key, pair) => {
@@ -13132,7 +13098,7 @@ const runScriptsOf = (source) => {
13132
13098
  const COMMAND_CHAIN = /&&|\|\||;|\|/u;
13133
13099
  const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
13134
13100
  const COMMENT = "#";
13135
- const RULE$25 = "workflow-script";
13101
+ const RULE$24 = "workflow-script";
13136
13102
  const ONE_COMMAND = 1;
13137
13103
  const MESSAGE$10 = "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.";
13138
13104
  const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
@@ -13141,14 +13107,14 @@ const runsMoreThanOneCommand = ({ text }) => {
13141
13107
  const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
13142
13108
  return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
13143
13109
  };
13144
- const problemsIn$11 = (file) => (source) => {
13110
+ const problemsIn$10 = (file) => (source) => {
13145
13111
  const at = positionOf(source);
13146
- return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$25)(file, at(start), MESSAGE$10)));
13112
+ return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$24)(file, at(start), MESSAGE$10)));
13147
13113
  };
13148
13114
  /** @internal */
13149
13115
  const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
13150
13116
  const workflows = yield* readWorkflows(root);
13151
- return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$11(file)(source)));
13117
+ return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$10(file)(source)));
13152
13118
  });
13153
13119
  // src/features/check-scripts/model/script-checks.ts
13154
13120
  /** @internal */
@@ -13278,7 +13244,7 @@ const AGENT_DOCS = [
13278
13244
  ...EXCLUDED$5
13279
13245
  ];
13280
13246
  const READ_CONCURRENCY$8 = 16;
13281
- const START$14 = 0;
13247
+ const START$13 = 0;
13282
13248
  const FIRST$5 = 1;
13283
13249
  const LINE = "\n";
13284
13250
  const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
@@ -13288,7 +13254,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
13288
13254
  const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
13289
13255
  const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
13290
13256
  const NO_SOURCES = [];
13291
- const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
13257
+ const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$13));
13292
13258
  const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
13293
13259
  const offset = offsetOf$2(source, `"${name}"`);
13294
13260
  return {
@@ -13384,7 +13350,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
13384
13350
  return Array.flatten(found);
13385
13351
  });
13386
13352
  // src/features/check-vite-plus/model/package-scripts.ts
13387
- const RULE$24 = "package-script";
13353
+ const RULE$23 = "package-script";
13388
13354
  const LIFECYCLE = [
13389
13355
  "preinstall",
13390
13356
  "install",
@@ -13404,15 +13370,15 @@ const LIFECYCLE = [
13404
13370
  "dependencies",
13405
13371
  "pnpm:devPreinstall"
13406
13372
  ];
13407
- const problemOf$3 = ({ file, position, name }) => ({
13373
+ const problemOf$2 = ({ file, position, name }) => ({
13408
13374
  file,
13409
13375
  ...position,
13410
- rule: RULE$24,
13376
+ rule: RULE$23,
13411
13377
  message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
13412
13378
  });
13413
- const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
13379
+ const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$2));
13414
13380
  // src/features/check-vite-plus/model/vite-plus-block.ts
13415
- const RULE$23 = "vite-plus-block";
13381
+ const RULE$22 = "vite-plus-block";
13416
13382
  const MARKER = Array.join([
13417
13383
  "<!--",
13418
13384
  "VITE PLUS START",
@@ -13425,7 +13391,7 @@ const problemIn = (file) => (source) => {
13425
13391
  return Option.some({
13426
13392
  file,
13427
13393
  ...positionOf(source)(index.value),
13428
- rule: RULE$23,
13394
+ rule: RULE$22,
13429
13395
  message: MESSAGE$9
13430
13396
  });
13431
13397
  };
@@ -13481,7 +13447,7 @@ const checkFullHistoryCheckout = workflowCheck({
13481
13447
  })
13482
13448
  });
13483
13449
  // src/features/check-workflows/model/publish-trigger.ts
13484
- const RULE$21 = "publish-trigger";
13450
+ const RULE$20 = "publish-trigger";
13485
13451
  const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
13486
13452
  const MANUAL = "workflow_dispatch";
13487
13453
  const TRIGGER_KEY = "on";
@@ -13501,18 +13467,18 @@ const publishTriggerOffsetsOf = (source) => {
13501
13467
  };
13502
13468
  /** @internal */
13503
13469
  const checkPublishTrigger = workflowCheck({
13504
- rule: RULE$21,
13470
+ rule: RULE$20,
13505
13471
  message: MESSAGE$7,
13506
13472
  offsetsOf: publishTriggerOffsetsOf
13507
13473
  });
13508
13474
  // src/features/check-workflows/model/release-please.ts
13509
- const RULE$20 = "release-please";
13475
+ const RULE$19 = "release-please";
13510
13476
  const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
13511
13477
  const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
13512
13478
  const FIRST$4 = 1;
13513
13479
  const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
13514
13480
  const checkReleasePleaseSteps = workflowCheck({
13515
- rule: RULE$20,
13481
+ rule: RULE$19,
13516
13482
  message: MESSAGE$6,
13517
13483
  offsetsOf: scalarKeyOffsets({
13518
13484
  name: "uses",
@@ -13526,7 +13492,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
13526
13492
  file: files.join(root, name),
13527
13493
  line: FIRST$4,
13528
13494
  column: FIRST$4,
13529
- rule: RULE$20,
13495
+ rule: RULE$19,
13530
13496
  message: MESSAGE$6
13531
13497
  })));
13532
13498
  });
@@ -13538,17 +13504,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
13538
13504
  // src/features/check-workflows/model/workflow-queue.ts
13539
13505
  const CONCURRENCY_KEY = "concurrency";
13540
13506
  const QUEUE_KEY = "queue";
13541
- const RULE$19 = "workflow-queue";
13507
+ const RULE$18 = "workflow-queue";
13542
13508
  const MESSAGE$5 = "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.";
13543
13509
  const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
13544
13510
  /** @internal */
13545
13511
  const checkWorkflowQueues = workflowCheck({
13546
- rule: RULE$19,
13512
+ rule: RULE$18,
13547
13513
  message: MESSAGE$5,
13548
13514
  offsetsOf: queueOffsetsOf
13549
13515
  });
13550
13516
  // src/features/check-workflows/model/workflow-commits.ts
13551
- const RULE$18 = "workflow-commit";
13517
+ const RULE$17 = "workflow-commit";
13552
13518
  const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
13553
13519
  const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
13554
13520
  const MESSAGE$4 = "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.";
@@ -13556,7 +13522,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
13556
13522
  const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
13557
13523
  /** @internal */
13558
13524
  const checkWorkflowCommits = workflowCheck({
13559
- rule: RULE$18,
13525
+ rule: RULE$17,
13560
13526
  message: MESSAGE$4,
13561
13527
  offsetsOf: commitOffsetsOf
13562
13528
  });
@@ -13592,6 +13558,20 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
13592
13558
  ], { concurrency: "unbounded" });
13593
13559
  return Array.flatten(found);
13594
13560
  });
13561
+ // src/shared/lib/comment-directives.ts
13562
+ const COMMENT_DIRECTIVES = [
13563
+ "oxlint-disable",
13564
+ "textlint-disable",
13565
+ "textlint-enable",
13566
+ String.raw`\* @internal \*?$`,
13567
+ String.raw`\* @msch \S+ \*?$`,
13568
+ String.raw`\* @stability (?:experimental|unstable) \*?$`,
13569
+ String.raw`shellcheck \w`,
13570
+ String.raw`zizmor: ignore\[`,
13571
+ String.raw`exit: \S`,
13572
+ "> statement-breakpoint$",
13573
+ "/ <reference (?:types|path|lib)="
13574
+ ];
13595
13575
  // src/features/ban-comments/model/found-comment.ts
13596
13576
  const taggedError$3 = Schema.TaggedError;
13597
13577
  var CommentsUnreadable = class extends taggedError$3()("CommentsUnreadable", {
@@ -13641,12 +13621,8 @@ const GRAMMARS = [
13641
13621
  "c-sharp",
13642
13622
  "cpp",
13643
13623
  "css",
13644
- "go",
13645
- "java",
13646
13624
  "javascript",
13647
- "php",
13648
13625
  "powershell",
13649
- "ruby",
13650
13626
  "rust",
13651
13627
  "tsx",
13652
13628
  "typescript"
@@ -13657,9 +13633,9 @@ const COMMENT_NODES = [
13657
13633
  "block_comment",
13658
13634
  "multiline_comment"
13659
13635
  ];
13660
- const START$13 = 0;
13636
+ const START$12 = 0;
13661
13637
  const NEXT = 1;
13662
- const NONE$1 = [];
13638
+ const NONE = [];
13663
13639
  const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
13664
13640
  onFailure: ({ message }) => unreadable(grammar)(message),
13665
13641
  onSuccess: (language) => [grammar, language]
@@ -13677,7 +13653,7 @@ const commentNodesIn = (language, source) => pipe(readTree({
13677
13653
  index: node.startIndex,
13678
13654
  text: node.text
13679
13655
  })))
13680
- }), Option.getOrElse(() => NONE$1));
13656
+ }), Option.getOrElse(() => NONE));
13681
13657
  const syntaxComments = (grammars, grammar) => (source) => Option.match(grammars(grammar), {
13682
13658
  onNone: () => Effect.fail(unreadable(grammar)("the grammar is not loaded")),
13683
13659
  onSome: (language) => commentsFrom(grammar)((text) => commentNodesIn(language, text))(source)
@@ -13700,21 +13676,21 @@ const shifted = (offset) => ({ index, text }) => ({
13700
13676
  text
13701
13677
  });
13702
13678
  const markupComment = (source) => (node) => {
13703
- if (!isComment(node) || node.startIndex === null || node.endIndex === null) return NONE$1;
13679
+ if (!isComment(node) || node.startIndex === null || node.endIndex === null) return NONE;
13704
13680
  return [{
13705
13681
  index: node.startIndex,
13706
13682
  text: String$1.slice(node.startIndex, node.endIndex + NEXT)(source)
13707
13683
  }];
13708
13684
  };
13709
13685
  const textComments = (grammars, grammar) => (text) => {
13710
- const shift = shifted(text.startIndex ?? START$13);
13686
+ const shift = shifted(text.startIndex ?? START$12);
13711
13687
  return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
13712
13688
  };
13713
13689
  const embeddedComments = (grammars) => (node) => {
13714
- if (!isTag(node)) return Effect.succeed(NONE$1);
13690
+ if (!isTag(node)) return Effect.succeed(NONE);
13715
13691
  const texts = pipe(node.children, Array.filter(isText));
13716
13692
  return Option.match(embeddedGrammar(node), {
13717
- onNone: () => Effect.succeed(NONE$1),
13693
+ onNone: () => Effect.succeed(NONE),
13718
13694
  onSome: (grammar) => pipe(texts, (items) => Effect.forEach(items, textComments(grammars, grammar), { concurrency: 1 }), Effect.map(Array.flatten))
13719
13695
  });
13720
13696
  };
@@ -13742,12 +13718,8 @@ const commentsWith = (grammars) => (reader, source) => {
13742
13718
  dockerfile: dockerfileComments
13743
13719
  }[reader](source);
13744
13720
  };
13745
- // src/features/ban-comments/model/comments.ts
13746
- const RULE$17 = "comment";
13747
- const CONFIG_FILE$2 = "vite.config.ts";
13748
- const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
13749
- const READ_CONCURRENCY$7 = 64;
13750
- const START$12 = 0;
13721
+ // src/features/ban-comments/model/reader-of.ts
13722
+ const SHEBANG$1 = "#!";
13751
13723
  const READERS$1 = [
13752
13724
  [/\.(?:[cm]?jsx?)$/u, "javascript"],
13753
13725
  [/\.(?:[cm]?ts)$/u, "typescript"],
@@ -13757,10 +13729,6 @@ const READERS$1 = [
13757
13729
  [/\.(?:sh|bash|zsh|ksh)$/u, "bash"],
13758
13730
  [/(?:^|\/)\.(?:vite-hooks|husky|githooks)\/[^./][^/]*$/u, "bash"],
13759
13731
  [/\.(?:ps1|psm1|psd1)$/u, "powershell"],
13760
- [/\.go$/u, "go"],
13761
- [/\.(?:java|kt|kts)$/u, "java"],
13762
- [/\.(?:rb|rake)$/u, "ruby"],
13763
- [/\.php$/u, "php"],
13764
13732
  [/\.(?:c|h|cc|cpp|cxx|hpp|hh|m|mm|glsl|frag|vert|comp|wgsl|hlsl|metal)$/u, "cpp"],
13765
13733
  [/\.(?:css|pcss)$/u, "css"],
13766
13734
  [/\.(?:html?|vue|svelte|astro)$/u, "html"],
@@ -13775,6 +13743,18 @@ const SHEBANG_READERS = [
13775
13743
  [/^#!.*\b(?:node|bun|deno|tsx)\b/u, "javascript"],
13776
13744
  [/^#!.*\bpwsh\b/u, "powershell"]
13777
13745
  ];
13746
+ const shebangReader = (source) => {
13747
+ if (!String$1.startsWith(SHEBANG$1)(source)) return Option.none();
13748
+ return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
13749
+ };
13750
+ const readerOf = (name) => (source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
13751
+ // src/features/ban-comments/model/comments.ts
13752
+ const RULE$16 = "comment";
13753
+ const UNUSED_RULE$1 = "unused-comment-allowance";
13754
+ const CONFIG_FILE$2 = "vite.config.ts";
13755
+ const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
13756
+ const READ_CONCURRENCY$7 = 64;
13757
+ const START$11 = 0;
13778
13758
  const SHEBANG = "#!";
13779
13759
  const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
13780
13760
  const VERSION = /^\s?v?\d[\w.+-]*$/u;
@@ -13792,26 +13772,25 @@ const NO_SETTINGS = {
13792
13772
  allow: [],
13793
13773
  ignorePatterns: []
13794
13774
  };
13795
- const NONE = [];
13796
13775
  const taggedError$2 = Schema.TaggedError;
13797
13776
  var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
13798
- const shebangReader = (source) => {
13799
- if (!String$1.startsWith(SHEBANG)(source)) return Option.none();
13800
- return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
13801
- };
13802
- const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
13803
13777
  const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
13804
13778
  const lineBefore = (source, index) => {
13805
- const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
13779
+ const lines = pipe(source, String$1.slice(START$11, index), String$1.split("\n"));
13806
13780
  return Option.getOrElse(Array.last(lines), () => "");
13807
13781
  };
13808
13782
  const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
13809
- const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
13783
+ const isShebang = ({ index, text }) => index === START$11 && String$1.startsWith(SHEBANG)(text);
13810
13784
  const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
13811
- const problemOf$2 = (file, source) => ({ index }) => ({
13785
+ const NOTHING = {
13786
+ problems: [],
13787
+ used: []
13788
+ };
13789
+ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but no comment in the repository matches it. Delete the entry and add it back when a comment needs it.`;
13790
+ const problemOf$1 = (file, source) => ({ index }) => ({
13812
13791
  file,
13813
13792
  ...positionOf(source)(index),
13814
- rule: RULE$17,
13793
+ rule: RULE$16,
13815
13794
  message: MESSAGE$3
13816
13795
  });
13817
13796
  const settingsOf = ({ msch, lint }) => ({
@@ -13847,27 +13826,52 @@ const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, sett
13847
13826
  file: files.join(root, name)
13848
13827
  })), Array.filter(({ file }) => !HashSet.has(skipped, file)));
13849
13828
  });
13829
+ const usedAllowances = (allowances, found) => pipe(allowances, Array.map((pattern, index) => [pattern, index]), Array.filter(([pattern]) => pipe(found, Array.some((comment) => pattern.test(valueOf(comment.text))))), Array.map(([, index]) => index));
13830
+ const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$11));
13831
+ const unusedAllowances = Effect.fn("unusedAllowances")(function* unusedAllowances(root, settings, used) {
13832
+ const files = yield* RepositoryFiles;
13833
+ const file = files.join(root, CONFIG_FILE$2);
13834
+ const text = yield* files.readFile(file);
13835
+ const source = Option.getOrElse(text, () => "");
13836
+ return pipe(settings.allow, Array.filter((_entry, index) => !HashSet.has(used, index)), Array.map((entry) => ({
13837
+ file,
13838
+ ...positionOf(source)(entryOffset(source, entry)),
13839
+ rule: UNUSED_RULE$1,
13840
+ message: unusedMessage(entry)
13841
+ })));
13842
+ });
13843
+ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, source) => {
13844
+ const kept = Predicate.not(isAllowed(source, directives));
13845
+ const toProblem = problemOf$1(file, source);
13846
+ return Option.match(readerOf(name)(source), {
13847
+ onNone: () => Effect.succeed(NOTHING),
13848
+ onSome: (reader) => comments(reader, source).pipe(Effect.map((found) => ({
13849
+ problems: pipe(found, Array.filter(kept), Array.map(toProblem)),
13850
+ used: usedAllowances(allowances, found)
13851
+ })), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
13852
+ problems: [problemInFile(RULE$16)(file, `msch could not read the comments in this file: ${message}`)],
13853
+ used: []
13854
+ })))
13855
+ });
13856
+ };
13850
13857
  /** @internal */
13851
13858
  const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
13852
13859
  const files = yield* RepositoryFiles;
13853
13860
  const settings = yield* rootSettings(root);
13854
13861
  const scanned = yield* scannedFiles(root, settings);
13855
- const directives = directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]);
13856
13862
  const grammars = yield* loadGrammars();
13857
- const comments = commentsWith(grammars);
13858
- const problemsIn = ({ name, file }, source) => {
13859
- const kept = Predicate.not(isAllowed(source, directives));
13860
- const toProblem = problemOf$2(file, source);
13861
- return Option.match(readerOf(name, source), {
13862
- onNone: () => Effect.succeed(NONE),
13863
- onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$17)(file, `msch could not read the comments in this file: ${message}`)])))
13864
- });
13865
- };
13863
+ const scan = scanFile({
13864
+ directives: directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]),
13865
+ allowances: pipe(settings.allow, Array.map((entry) => directivePattern([entry]))),
13866
+ comments: commentsWith(grammars)
13867
+ });
13866
13868
  const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
13867
- onNone: () => Effect.succeed(NONE),
13868
- onSome: (source) => problemsIn(entry, source)
13869
+ onNone: () => Effect.succeed(NOTHING),
13870
+ onSome: (source) => scan(entry, source)
13869
13871
  }))), { concurrency: READ_CONCURRENCY$7 });
13870
- return Array.flatten(found);
13872
+ const used = HashSet.fromIterable(pipe(found, Array.flatMap(({ used: indexes }) => indexes)));
13873
+ const unused = yield* unusedAllowances(root, settings, used);
13874
+ return [...pipe(found, Array.flatMap(({ problems }) => problems)), ...unused];
13871
13875
  });
13872
13876
  // src/features/ban-tools/model/banned-tool.ts
13873
13877
  const PROGRAM_SOURCE = /\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;
@@ -13958,7 +13962,7 @@ const PYTHON = {
13958
13962
  /** @internal */
13959
13963
  const checkPython = (root) => checkBannedTool(root, PYTHON);
13960
13964
  // src/features/check-catalog-entries/model/uncataloged-dependencies.ts
13961
- const RULE$16 = "uncataloged-dependency";
13965
+ const RULE$15 = "uncataloged-dependency";
13962
13966
  const OWNED_ELSEWHERE = [
13963
13967
  "catalog:",
13964
13968
  "workspace:",
@@ -13969,10 +13973,10 @@ const ROOT_DIRECTORY$1 = ".";
13969
13973
  const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
13970
13974
  const MESSAGE$2 = "is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.";
13971
13975
  const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
13972
- const problemsIn$10 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
13976
+ const problemsIn$9 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
13973
13977
  file: entry.file,
13974
13978
  ...positionOf(source)(offsetIn(source)(manifestPattern(found))),
13975
- rule: RULE$16,
13979
+ rule: RULE$15,
13976
13980
  message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
13977
13981
  })));
13978
13982
  /** @internal */
@@ -13987,10 +13991,10 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
13987
13991
  file: files.join(root, name)
13988
13992
  };
13989
13993
  }));
13990
- return yield* scanText(listed, problemsIn$10);
13994
+ return yield* scanText(listed, problemsIn$9);
13991
13995
  });
13992
13996
  // src/features/check-catalog-entries/model/catalog-entries.ts
13993
- const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
13997
+ const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
13994
13998
  const MANIFEST$2 = /(?:^|\/)package\.json$/u;
13995
13999
  const CATALOG_PROTOCOL = "catalog:";
13996
14000
  const DEFAULT_CATALOG = "default";
@@ -14070,7 +14074,7 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
14070
14074
  const manifest = yield* workspaceManifest(root);
14071
14075
  const catalogs = yield* Option.match(manifest, {
14072
14076
  onNone: () => Effect.succeed([]),
14073
- onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$4), fieldsOf(settings))
14077
+ onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$3), fieldsOf(settings))
14074
14078
  });
14075
14079
  const uncataloged = yield* Option.match(manifest, {
14076
14080
  onNone: () => Effect.succeed([]),
@@ -14078,331 +14082,99 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
14078
14082
  });
14079
14083
  return [...catalogs, ...uncataloged];
14080
14084
  });
14081
- // src/features/check-skills/model/skill-entry.ts
14082
- const ENTRY_RULE = "unlocked-skill";
14083
- const VISIBLE_RULE = "skill-source-visible";
14084
- const CONFIG_FILE$1 = "vite.config.ts";
14085
- const RENOVATE_FILE$1 = "renovate.json";
14086
- const SOURCE = "masseater/skills";
14087
- const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
14088
- const START$11 = 0;
14089
- const LOCAL_PREFIX = "./";
14090
- const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
14091
- const Source = Schema.Struct({
14092
- commit: Schema.optional(Schema.String),
14093
- skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
14094
- });
14095
- const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
14096
- const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
14097
- const taggedError$1 = Schema.TaggedError;
14098
- var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
14099
- const problemAt$4 = (rule, file, text) => (anchor, message) => ({
14100
- file,
14101
- ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
14102
- rule,
14103
- message
14104
- });
14105
- const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
14106
- const files = yield* RepositoryFiles;
14107
- const file = files.join(root, CONFIG_FILE$1);
14108
- const text = yield* files.readFile(file);
14109
- if (Option.isNone(text)) return Option.none();
14110
- const config = yield* Effect.tryPromise({
14111
- try: () => resolveConfigFromFile(file),
14112
- catch: () => SkillsConfigUnreadable.make({ file })
14113
- }).pipe(Effect.option);
14114
- return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
14085
+ // src/features/check-version-downgrades/model/version-entries.ts
14086
+ const MANIFEST_SECTIONS = [
14087
+ "dependencies",
14088
+ "devDependencies",
14089
+ "optionalDependencies",
14090
+ "engines"
14091
+ ];
14092
+ const CARGO_SECTIONS = [
14093
+ "dependencies",
14094
+ "dev-dependencies",
14095
+ "build-dependencies"
14096
+ ];
14097
+ const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
14098
+ const decodeString = Schema.decodeUnknownOption(Schema.String);
14099
+ const decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));
14100
+ const decodeSpec = (value) => Option.orElse(decodeString(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
14101
+ const PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));
14102
+ const decodePackageManager = Schema.decodeUnknownOption(PackageManager);
14103
+ const fieldOf = (name) => (value) => fieldsOf(value)[name];
14104
+ const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
14105
+ key: `${section}:${name}`,
14106
+ name,
14107
+ spec
14108
+ })), Option.toArray)));
14109
+ const sectionsIn = (sections) => (fields) => pipe(sections, Array.flatMap((section) => entriesIn(section)(fields[section])));
14110
+ const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map((raw) => {
14111
+ const [name, version = ""] = String$1.split(raw, "@");
14112
+ return {
14113
+ key: `packageManager:${name}`,
14114
+ name,
14115
+ spec: version
14116
+ };
14117
+ }), Option.toArray);
14118
+ const manifestEntries = (text) => {
14119
+ const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);
14120
+ return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
14121
+ };
14122
+ const catalogsIn = (settings) => pipe(namedCatalogsOf(settings), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
14123
+ const workspaceEntries = (text) => {
14124
+ const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf);
14125
+ return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings)];
14126
+ };
14127
+ const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
14128
+ const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
14129
+ key,
14130
+ name: key,
14131
+ spec
14132
+ })), Option.toArray);
14133
+ const cargoEntries = (text) => {
14134
+ const cargo = parseToml(text);
14135
+ return [
14136
+ ...sectionsIn(CARGO_SECTIONS)(cargo),
14137
+ ...entriesIn("workspace.dependencies")(fieldOf("dependencies")(cargo["workspace"])),
14138
+ ...singleEntry("rust-version", fieldOf("rust-version")(cargo["package"]))
14139
+ ];
14140
+ };
14141
+ const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
14142
+ // src/features/check-version-downgrades/model/version-downgrade.ts
14143
+ const RULE$14 = "version-downgrade";
14144
+ const DEFAULT_BASE = "origin/main";
14145
+ const READ_CONCURRENCY$5 = 16;
14146
+ const READERS = [
14147
+ [/(?:^|\/)package\.json$/u, manifestEntries],
14148
+ [/^pnpm-workspace\.yaml$/u, workspaceEntries],
14149
+ [/(?:^|\/)Cargo\.toml$/u, cargoEntries],
14150
+ [/(?:^|\/)rust-toolchain\.toml$/u, toolchainEntries]
14151
+ ];
14152
+ const lowestOf = (spec) => pipe(Option.liftThrowable(() => semver.minVersion(spec))(), Option.flatMap(Option.fromNullishOr), Option.orElse(() => Option.fromNullishOr(semver.coerce(spec))));
14153
+ const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(after)]), Option.match({
14154
+ onNone: () => false,
14155
+ onSome: ([old, current]) => semver.lt(current, old)
14156
+ }));
14157
+ const FIRST_LINE$1 = 1;
14158
+ const lineOf = (text, { name, spec }) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(name)(line) && String$1.includes(spec)(line)), Option.match({
14159
+ onNone: () => FIRST_LINE$1,
14160
+ onSome: (index) => index + FIRST_LINE$1
14161
+ }));
14162
+ const message = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
14163
+ const downgradesIn = ({ file, text, before, after }) => {
14164
+ const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
14165
+ return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
14115
14166
  file,
14116
- text: text.value,
14117
- sources: skills
14118
- })));
14119
- });
14120
- const entryProblems = ({ file, text, sources }) => {
14121
- const at = problemAt$4(ENTRY_RULE, file, text);
14122
- return pipe(Record.get(sources, SOURCE), Option.match({
14123
- onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
14124
- 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)
14125
- }));
14167
+ line: lineOf(text, entry),
14168
+ column: FIRST_LINE$1,
14169
+ rule: RULE$14,
14170
+ message: message(old, entry)
14171
+ })), Option.toArray)));
14126
14172
  };
14127
- const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
14128
- const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$4(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
14129
- const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
14173
+ const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
14130
14174
  const files = yield* RepositoryFiles;
14131
- const file = files.join(root, RENOVATE_FILE$1);
14132
- const text = yield* files.readFile(file);
14133
- if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
14134
- return [problemAt$4(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
14135
- });
14136
- /** @internal */
14137
- const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
14138
- const declared = yield* declaredSkills(root);
14139
- if (Option.isNone(declared)) return [];
14140
- const preset = yield* presetProblems(root);
14141
- return [
14142
- ...entryProblems(declared.value),
14143
- ...visibleProblems(declared.value),
14144
- ...preset
14145
- ];
14146
- });
14147
- // src/features/check-skills/model/published-skills.ts
14148
- const RULE$15 = "published-skills";
14149
- const KEYWORD = "tanstack-intent";
14150
- const SKILLS = "skills";
14151
- const MANIFEST_FILE = "package.json";
14152
- const SKILL_FILE$1 = "SKILL.md";
14153
- const SUCCEEDED = 0;
14154
- const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
14155
- const problemAt$3 = problemInFile(RULE$15);
14156
- 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))));
14157
- const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
14158
- const packagingMessages = ({ keywords, files }, skills) => {
14159
- const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
14160
- const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
14161
- return Array.getSomes([keyword, unshipped]);
14162
- };
14163
- const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
14164
- const handle = yield* ChildProcess.make("node", [
14165
- INTENT_CLI,
14166
- "validate",
14167
- SKILLS
14168
- ], {
14169
- cwd: directory,
14170
- extendEnv: true,
14171
- stdin: "ignore"
14172
- });
14173
- const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
14174
- return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
14175
- }, Effect.scoped);
14176
- const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14177
- const files = yield* RepositoryFiles;
14178
- const directory = files.join(root, project.directory);
14179
- const manifest = files.join(directory, MANIFEST_FILE);
14180
- const skills = skillDirectoriesIn(files, directory);
14181
- if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$3(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
14182
- const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
14183
- return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$3(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$3(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
14184
- });
14185
- /** @internal */
14186
- const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
14187
- const projects = yield* publishedProjects(root);
14188
- const problems = yield* Effect.forEach(projects, (project) => problemsIn$9(root, project), { concurrency: 1 });
14189
- return Array.flatten(problems);
14190
- });
14191
- // src/features/check-skills/model/skill-files.ts
14192
- const RULE$14 = "skill-file";
14193
- const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
14194
- const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
14195
- const FIXTURE = /(?:^|\/)fixtures\//u;
14196
- const MARKDOWN = ".md";
14197
- const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
14198
- const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
14199
- const HEADING = /^# (?<title>.+)$/mu;
14200
- const NAME_KEY$1 = /^name:/mu;
14201
- const LICENSE_KEY = /^license:/mu;
14202
- const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
14203
- const LINK = /\]\((?<target>[^)\s]+)\)/gu;
14204
- const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
14205
- const FRAGMENT = /#.*$/u;
14206
- const GITHUB = "https://github.com/";
14207
- const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
14208
- const BLANK = /\s+/u;
14209
- const SEPARATOR$2 = "/";
14210
- const START$10 = 0;
14211
- const FIRST$3 = 1;
14212
- const READ_CONCURRENCY$5 = 16;
14213
- const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
14214
- const Frontmatter = Schema.Struct({
14215
- name: Schema.optional(Schema.String),
14216
- license: Schema.optional(Schema.Unknown),
14217
- metadata: Schema.optional(Metadata)
14218
- });
14219
- const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
14220
- const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
14221
- const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
14222
- const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
14223
- const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
14224
- const nameProblems = ({ source, directory }, name, folder) => {
14225
- const bodyStart = bodyStartOf(source);
14226
- const body = String$1.slice(bodyStart)(source);
14227
- const heading = groupOf$2("title")(HEADING.exec(body));
14228
- return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
14229
- index: offsetOf$1(source, NAME_KEY$1),
14230
- message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
14231
- })), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
14232
- index: bodyStart + offsetOf$1(body, HEADING),
14233
- message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
14234
- })), Option.toArray)];
14235
- };
14236
- 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) => ({
14237
- index: offsetOf$1(source, url),
14238
- 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>.`
14239
- })));
14240
- const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
14241
- ...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
14242
- ...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
14243
- index: offsetOf$1(skill.source, LICENSE_KEY),
14244
- message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
14245
- })), Option.toArray),
14246
- ...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
14247
- ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
14248
- file: skill.file,
14249
- ...positionOf(skill.source)(index),
14250
- rule: RULE$14,
14251
- message
14252
- })));
14253
- 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) => ({
14254
- target,
14255
- index: found.index ?? START$10
14256
- })), Option.toArray);
14257
- const rangeOf$1 = (found) => {
14258
- const start = found.index ?? START$10;
14259
- return [start, start + found[START$10].length];
14260
- };
14261
- const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
14262
- const linksIn = (source) => {
14263
- const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
14264
- return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
14265
- };
14266
- const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
14267
- const files = yield* RepositoryFiles;
14268
- const text = yield* files.readFile(file);
14269
- if (Option.isNone(text)) return [];
14270
- const source = text.value;
14271
- const directory = files.dirname(file);
14272
- const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
14273
- const missing = yield* Effect.filter(linksIn(source), isMissing);
14274
- return pipe(missing, Array.map(({ target, index }) => ({
14275
- file,
14276
- ...positionOf(source)(index),
14277
- rule: RULE$14,
14278
- message: `links to ${target}, which does not exist. Fix the path or remove the link.`
14279
- })));
14280
- });
14281
- const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
14282
- const files = yield* RepositoryFiles;
14283
- const file = files.join(root, name);
14284
- const directory = files.dirname(name);
14285
- const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
14286
- const text = yield* files.readFile(file);
14287
- const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
14288
- const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
14289
- const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
14290
- file: files.join(root, entry),
14291
- line: FIRST$3,
14292
- column: FIRST$3,
14293
- rule: RULE$14,
14294
- message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
14295
- })));
14296
- return [
14297
- ...pipe(text, Option.map((source) => frontmatterProblems({
14298
- file,
14299
- directory,
14300
- source
14301
- }, files.basename(directory))), Option.getOrElse(() => [])),
14302
- ...licenses,
14303
- ...Array.flatten(links)
14304
- ];
14305
- });
14306
- /** @internal */
14307
- const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
14308
- const listed = yield* (yield* RepositoryFiles).listedFiles(root);
14309
- const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
14310
- const found = yield* Effect.forEach(skills, (name) => problemsIn$8(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
14311
- return Array.flatten(found);
14312
- });
14313
- // src/features/check-version-downgrades/model/version-entries.ts
14314
- const MANIFEST_SECTIONS = [
14315
- "dependencies",
14316
- "devDependencies",
14317
- "optionalDependencies",
14318
- "engines"
14319
- ];
14320
- const CARGO_SECTIONS = [
14321
- "dependencies",
14322
- "dev-dependencies",
14323
- "build-dependencies"
14324
- ];
14325
- const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
14326
- const decodeString = Schema.decodeUnknownOption(Schema.String);
14327
- const decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));
14328
- const decodeSpec = (value) => Option.orElse(decodeString(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
14329
- const PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));
14330
- const decodePackageManager = Schema.decodeUnknownOption(PackageManager);
14331
- const fieldOf = (name) => (value) => fieldsOf(value)[name];
14332
- const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
14333
- key: `${section}:${name}`,
14334
- name,
14335
- spec
14336
- })), Option.toArray)));
14337
- const sectionsIn = (sections) => (fields) => pipe(sections, Array.flatMap((section) => entriesIn(section)(fields[section])));
14338
- const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map((raw) => {
14339
- const [name, version = ""] = String$1.split(raw, "@");
14340
- return {
14341
- key: `packageManager:${name}`,
14342
- name,
14343
- spec: version
14344
- };
14345
- }), Option.toArray);
14346
- const manifestEntries = (text) => {
14347
- const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);
14348
- return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
14349
- };
14350
- const catalogsIn = (settings) => pipe(namedCatalogsOf(settings), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
14351
- const workspaceEntries = (text) => {
14352
- const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf);
14353
- return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings)];
14354
- };
14355
- const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
14356
- const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
14357
- key,
14358
- name: key,
14359
- spec
14360
- })), Option.toArray);
14361
- const cargoEntries = (text) => {
14362
- const cargo = parseToml(text);
14363
- return [
14364
- ...sectionsIn(CARGO_SECTIONS)(cargo),
14365
- ...entriesIn("workspace.dependencies")(fieldOf("dependencies")(cargo["workspace"])),
14366
- ...singleEntry("rust-version", fieldOf("rust-version")(cargo["package"]))
14367
- ];
14368
- };
14369
- const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
14370
- // src/features/check-version-downgrades/model/version-downgrade.ts
14371
- const RULE$13 = "version-downgrade";
14372
- const DEFAULT_BASE = "origin/main";
14373
- const READ_CONCURRENCY$4 = 16;
14374
- const READERS = [
14375
- [/(?:^|\/)package\.json$/u, manifestEntries],
14376
- [/^pnpm-workspace\.yaml$/u, workspaceEntries],
14377
- [/(?:^|\/)Cargo\.toml$/u, cargoEntries],
14378
- [/(?:^|\/)rust-toolchain\.toml$/u, toolchainEntries]
14379
- ];
14380
- const lowestOf = (spec) => pipe(Option.liftThrowable(() => semver.minVersion(spec))(), Option.flatMap(Option.fromNullishOr), Option.orElse(() => Option.fromNullishOr(semver.coerce(spec))));
14381
- const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(after)]), Option.match({
14382
- onNone: () => false,
14383
- onSome: ([old, current]) => semver.lt(current, old)
14384
- }));
14385
- const FIRST_LINE$1 = 1;
14386
- const lineOf = (text, { name, spec }) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(name)(line) && String$1.includes(spec)(line)), Option.match({
14387
- onNone: () => FIRST_LINE$1,
14388
- onSome: (index) => index + FIRST_LINE$1
14389
- }));
14390
- const message = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
14391
- const downgradesIn = ({ file, text, before, after }) => {
14392
- const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
14393
- return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
14394
- file,
14395
- line: lineOf(text, entry),
14396
- column: FIRST_LINE$1,
14397
- rule: RULE$13,
14398
- message: message(old, entry)
14399
- })), Option.toArray)));
14400
- };
14401
- const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
14402
- const files = yield* RepositoryFiles;
14403
- const configured = yield* Config.option(Config.String("VPA_BASE")).pipe(Effect.orDie);
14404
- const base = Option.getOrElse(configured, () => DEFAULT_BASE);
14405
- return yield* files.mergeBase(root, base);
14175
+ const configured = yield* Config.option(Config.String("VPA_BASE")).pipe(Effect.orDie);
14176
+ const base = Option.getOrElse(configured, () => DEFAULT_BASE);
14177
+ return yield* files.mergeBase(root, base);
14406
14178
  });
14407
14179
  /** @internal */
14408
14180
  const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(root) {
@@ -14420,24 +14192,24 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
14420
14192
  before: read(before),
14421
14193
  after: read(after)
14422
14194
  })), Option.getOrElse(() => []));
14423
- }), { concurrency: READ_CONCURRENCY$4 });
14195
+ }), { concurrency: READ_CONCURRENCY$5 });
14424
14196
  return Array.flatten(found);
14425
14197
  });
14426
14198
  // src/features/check-version-downgrades/model/renovate-settings.ts
14427
- const RENOVATE_FILE = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
14199
+ const RENOVATE_FILE$1 = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
14428
14200
  const AUTOMERGE_OFF = /["']?platformAutomerge["']?\s*:\s*false/gu;
14429
14201
  const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)["']/gu;
14430
14202
  const AUTOMERGE_RULE = "renovate-platform-automerge";
14431
14203
  const CAP_RULE = "renovate-version-cap";
14432
14204
  const PRESET_RULE = "renovate-msch-preset";
14433
- const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
14434
- const START$9 = 0;
14435
- const READ_CONCURRENCY$3 = 16;
14205
+ const PRESET$1 = "github>masseater/ecosystems//libs/msch/renovate";
14206
+ const START$10 = 0;
14207
+ const READ_CONCURRENCY$4 = 16;
14436
14208
  const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
14437
14209
  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.";
14438
- const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
14210
+ const PRESET_MESSAGE = `does not extend \`${PRESET$1}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
14439
14211
  const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
14440
- const problemsIn$7 = (file, source) => {
14212
+ const problemsIn$8 = (file, source) => {
14441
14213
  const at = positionOf(source);
14442
14214
  const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
14443
14215
  file,
@@ -14450,46 +14222,46 @@ const problemsIn$7 = (file, source) => {
14450
14222
  ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
14451
14223
  ...pipe([{
14452
14224
  file,
14453
- ...at(START$9),
14225
+ ...at(START$10),
14454
14226
  rule: PRESET_RULE,
14455
14227
  message: PRESET_MESSAGE
14456
- }], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
14228
+ }], Array.filter(() => !String$1.includes(`"${PRESET$1}"`)(source)))
14457
14229
  ];
14458
14230
  };
14459
14231
  /** @internal */
14460
14232
  const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* checkRenovateSettings(root) {
14461
14233
  const files = yield* RepositoryFiles;
14462
14234
  const listed = yield* files.listedFiles(root);
14463
- const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE.test(name))), (name) => {
14235
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE$1.test(name))), (name) => {
14464
14236
  const file = files.join(root, name);
14465
14237
  return files.readFile(file).pipe(Effect.map(Option.match({
14466
14238
  onNone: () => [],
14467
- onSome: (source) => problemsIn$7(file, source)
14239
+ onSome: (source) => problemsIn$8(file, source)
14468
14240
  })));
14469
- }, { concurrency: READ_CONCURRENCY$3 });
14241
+ }, { concurrency: READ_CONCURRENCY$4 });
14470
14242
  return Array.flatten(found);
14471
14243
  });
14472
14244
  // src/features/find-invisible-characters/model/hidden-unicode.ts
14473
14245
  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;
14474
14246
  const NUL = "\0";
14475
- const START$8 = 0;
14247
+ const START$9 = 0;
14476
14248
  const HEX = 16;
14477
14249
  const CODE_POINT_WIDTH = 4;
14478
- const READ_CONCURRENCY$2 = 64;
14479
- const RULE$12 = "hidden-unicode";
14480
- const hexOf = (character) => pipe(String$1.codePointAt(START$8)(character), Option.getOrElse(() => START$8), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
14481
- const problemOf$1 = (file, source) => (found) => {
14482
- const hex = hexOf(found[START$8]);
14250
+ const READ_CONCURRENCY$3 = 64;
14251
+ const RULE$13 = "hidden-unicode";
14252
+ const hexOf = (character) => pipe(String$1.codePointAt(START$9)(character), Option.getOrElse(() => START$9), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
14253
+ const problemOf = (file, source) => (found) => {
14254
+ const hex = hexOf(found[START$9]);
14483
14255
  return {
14484
14256
  file,
14485
- ...positionOf(source)(found.index ?? START$8),
14486
- rule: RULE$12,
14257
+ ...positionOf(source)(found.index ?? START$9),
14258
+ rule: RULE$13,
14487
14259
  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}.`
14488
14260
  };
14489
14261
  };
14490
- const problemsIn$6 = (file, source) => {
14262
+ const problemsIn$7 = (file, source) => {
14491
14263
  if (String$1.includes(NUL)(source)) return [];
14492
- return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
14264
+ return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
14493
14265
  };
14494
14266
  /** @internal */
14495
14267
  const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHiddenUnicode(root) {
@@ -14499,43 +14271,18 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
14499
14271
  const file = files.join(root, name);
14500
14272
  return files.readFile(file).pipe(Effect.map(Option.match({
14501
14273
  onNone: () => [],
14502
- onSome: (source) => problemsIn$6(file, source)
14274
+ onSome: (source) => problemsIn$7(file, source)
14503
14275
  })));
14504
- }, { concurrency: READ_CONCURRENCY$2 });
14276
+ }, { concurrency: READ_CONCURRENCY$3 });
14505
14277
  return Array.flatten(found);
14506
14278
  });
14507
- // src/features/find-unneeded-files/model/alchemy-patch.ts
14508
- const RULE$11 = "alchemy-patch";
14509
- const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
14510
- const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
14511
- const START$7 = 0;
14512
- const problemOf = (file, position, name) => ({
14513
- file,
14514
- ...position,
14515
- rule: RULE$11,
14516
- 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.`
14517
- });
14518
- const problemsIn$5 = (file, patched) => (source) => {
14519
- const at = positionOf(source);
14520
- const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$7));
14521
- return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
14522
- };
14523
- /** @internal */
14524
- const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyPatch(root) {
14525
- const files = yield* RepositoryFiles;
14526
- const file = files.join(root, WORKSPACE_FILE$3);
14527
- const text = yield* files.readFile(file);
14528
- const manifest = yield* workspaceManifest(root);
14529
- const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
14530
- return pipe(text, Option.map(problemsIn$5(file, patched)), Option.getOrElse(() => []));
14531
- });
14532
14279
  // src/features/find-unneeded-files/model/applied-packages.ts
14533
14280
  const MSCH = "@r_masseater/msch";
14534
14281
  const SCOPE$1 = "@r_masseater/";
14535
- const RULE$10 = "applied-package";
14282
+ const RULE$12 = "applied-package";
14536
14283
  const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
14537
14284
  const NOT_FOUND = -1;
14538
- const SEPARATOR$1 = "/";
14285
+ const SEPARATOR$2 = "/";
14539
14286
  const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
14540
14287
  const BinMap = Schema.Record(Schema.String, Schema.String);
14541
14288
  const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
@@ -14549,7 +14296,7 @@ const declaredNames = (manifest) => pipe([
14549
14296
  const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
14550
14297
  onNone: () => [],
14551
14298
  onSome: (bin) => {
14552
- if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
14299
+ if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$2), Array.lastNonEmpty)];
14553
14300
  return Record.keys(bin);
14554
14301
  }
14555
14302
  }));
@@ -14574,16 +14321,16 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
14574
14321
  const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
14575
14322
  return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
14576
14323
  });
14577
- const problemAt$2 = (file, source) => (index, name) => ({
14324
+ const problemAt$4 = (file, source) => (index, name) => ({
14578
14325
  file,
14579
14326
  ...positionOf(source)(index),
14580
- rule: RULE$10,
14327
+ rule: RULE$12,
14581
14328
  message: `msch applies ${name}. Remove this use and let msch apply it.`
14582
14329
  });
14583
14330
  const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
14584
14331
  const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
14585
- const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$2(file, source)(found.index ?? NOT_FOUND, entry.name)))));
14586
- const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
14332
+ 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$4(file, source)(found.index ?? NOT_FOUND, entry.name)))));
14333
+ const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$2}`)(name)), Array.match({
14587
14334
  onEmpty: () => "",
14588
14335
  onNonEmpty: Array.max(BY_LENGTH)
14589
14336
  }));
@@ -14602,7 +14349,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
14602
14349
  declared: manifest
14603
14350
  }), Option.match({
14604
14351
  onNone: () => [],
14605
- onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$2(file, source)(index, name)), Option.toArray)))
14352
+ 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$4(file, source)(index, name)), Option.toArray)))
14606
14353
  }));
14607
14354
  });
14608
14355
  const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
@@ -14632,8 +14379,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
14632
14379
  return yield* appliedPackageProblems(root, applied);
14633
14380
  });
14634
14381
  // src/features/find-unneeded-files/model/replaced-tools.ts
14635
- const RULE$9 = "replaced-tool";
14636
- const FIRST$2 = 1;
14382
+ const RULE$11 = "replaced-tool";
14383
+ const FIRST$3 = 1;
14637
14384
  const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
14638
14385
  const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
14639
14386
  const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
@@ -14711,9 +14458,9 @@ const REPLACED = [
14711
14458
  ];
14712
14459
  const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
14713
14460
  file,
14714
- line: FIRST$2,
14715
- column: FIRST$2,
14716
- rule: RULE$9,
14461
+ line: FIRST$3,
14462
+ column: FIRST$3,
14463
+ rule: RULE$11,
14717
14464
  message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
14718
14465
  })));
14719
14466
  /** @internal */
@@ -14731,7 +14478,7 @@ const unneededLockfile = (present) => (entry) => FOREIGN_LOCKFILE.test(entry.nam
14731
14478
  // src/features/find-unneeded-files/model/unneeded-files.ts
14732
14479
  const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
14733
14480
  const PNPM_DIRECTORY = ".pnpm/";
14734
- const SEPARATOR = "/";
14481
+ const SEPARATOR$1 = "/";
14735
14482
  const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
14736
14483
  const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
14737
14484
  const PNPM_OUTPUT = /(?:^|\/)\.pnpm\//u;
@@ -14747,7 +14494,7 @@ const SETUP_PATTERNS = [
14747
14494
  ];
14748
14495
  const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
14749
14496
  const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
14750
- const START$6 = 0;
14497
+ const START$8 = 0;
14751
14498
  const LAST_SEGMENT = 1;
14752
14499
  const FIRST_LINE = 1;
14753
14500
  const FIRST_COLUMN = 1;
@@ -14799,10 +14546,10 @@ const matches = (pattern) => ({ name }) => pattern.test(name);
14799
14546
  const isCargoManifest = matches(CARGO_MANIFEST_FILE);
14800
14547
  const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
14801
14548
  const isPnpmOutput = matches(PNPM_OUTPUT);
14802
- const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
14549
+ const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
14803
14550
  const ancestorsOf = (directory) => {
14804
- const parts = String$1.split(directory, SEPARATOR);
14805
- return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
14551
+ const parts = String$1.split(directory, SEPARATOR$1);
14552
+ return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR$1)), Array.filter((ancestor) => ancestor !== directory));
14806
14553
  };
14807
14554
  const readsCargoLock = (manifests, workspaces) => ({ name }) => {
14808
14555
  const directory = directoryOf(name);
@@ -14816,7 +14563,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
14816
14563
  const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
14817
14564
  return directoriesOf(roots);
14818
14565
  });
14819
- const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
14566
+ const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$8), (end) => String$1.slice(START$8, end)(name));
14820
14567
  const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
14821
14568
  const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
14822
14569
  const cargoProblems = (present, enabled) => {
@@ -14851,6 +14598,249 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
14851
14598
  if (Option.isNone(workspace)) return [];
14852
14599
  return yield* unneededIn(root, cargoEnabled(workspace.value));
14853
14600
  });
14601
+ // src/features/check-skills/model/skill-entry.ts
14602
+ const ENTRY_RULE = "unlocked-skill";
14603
+ const VISIBLE_RULE = "skill-source-visible";
14604
+ const CONFIG_FILE$1 = "vite.config.ts";
14605
+ const RENOVATE_FILE = "renovate.json";
14606
+ const SOURCE = "masseater/skills";
14607
+ const PRESET = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
14608
+ const START$7 = 0;
14609
+ const LOCAL_PREFIX = "./";
14610
+ const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
14611
+ const Source = Schema.Struct({
14612
+ commit: Schema.optional(Schema.String),
14613
+ skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
14614
+ });
14615
+ const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
14616
+ const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
14617
+ const taggedError$1 = Schema.TaggedError;
14618
+ var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
14619
+ const problemAt$3 = (rule, file, text) => (anchor, message) => ({
14620
+ file,
14621
+ ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$7))),
14622
+ rule,
14623
+ message
14624
+ });
14625
+ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
14626
+ const files = yield* RepositoryFiles;
14627
+ const file = files.join(root, CONFIG_FILE$1);
14628
+ const text = yield* files.readFile(file);
14629
+ if (Option.isNone(text)) return Option.none();
14630
+ const config = yield* Effect.tryPromise({
14631
+ try: () => resolveConfigFromFile(file),
14632
+ catch: () => SkillsConfigUnreadable.make({ file })
14633
+ }).pipe(Effect.option);
14634
+ return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
14635
+ file,
14636
+ text: text.value,
14637
+ sources: skills
14638
+ })));
14639
+ });
14640
+ const entryProblems = ({ file, text, sources }) => {
14641
+ const at = problemAt$3(ENTRY_RULE, file, text);
14642
+ return pipe(Record.get(sources, SOURCE), Option.match({
14643
+ onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
14644
+ 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)
14645
+ }));
14646
+ };
14647
+ const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
14648
+ 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.`)));
14649
+ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
14650
+ const files = yield* RepositoryFiles;
14651
+ const file = files.join(root, RENOVATE_FILE);
14652
+ const text = yield* files.readFile(file);
14653
+ if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
14654
+ 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$1}.`)];
14655
+ });
14656
+ /** @internal */
14657
+ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
14658
+ const declared = yield* declaredSkills(root);
14659
+ if (Option.isNone(declared)) return [];
14660
+ const preset = yield* presetProblems(root);
14661
+ return [
14662
+ ...entryProblems(declared.value),
14663
+ ...visibleProblems(declared.value),
14664
+ ...preset
14665
+ ];
14666
+ });
14667
+ // src/features/check-skills/model/published-skills.ts
14668
+ const RULE$10 = "published-skills";
14669
+ const KEYWORD = "tanstack-intent";
14670
+ const SKILLS = "skills";
14671
+ const MANIFEST_FILE = "package.json";
14672
+ const SKILL_FILE$1 = "SKILL.md";
14673
+ const SUCCEEDED = 0;
14674
+ const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
14675
+ const problemAt$2 = problemInFile(RULE$10);
14676
+ 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))));
14677
+ const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
14678
+ const packagingMessages = ({ keywords, files }, skills) => {
14679
+ const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
14680
+ const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
14681
+ return Array.getSomes([keyword, unshipped]);
14682
+ };
14683
+ const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
14684
+ const handle = yield* ChildProcess.make("node", [
14685
+ INTENT_CLI,
14686
+ "validate",
14687
+ SKILLS
14688
+ ], {
14689
+ cwd: directory,
14690
+ extendEnv: true,
14691
+ stdin: "ignore"
14692
+ });
14693
+ const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
14694
+ return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
14695
+ }, Effect.scoped);
14696
+ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14697
+ const files = yield* RepositoryFiles;
14698
+ const directory = files.join(root, project.directory);
14699
+ const manifest = files.join(directory, MANIFEST_FILE);
14700
+ const skills = skillDirectoriesIn(files, directory);
14701
+ if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
14702
+ const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
14703
+ 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)];
14704
+ });
14705
+ /** @internal */
14706
+ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
14707
+ const projects = yield* publishedProjects(root);
14708
+ const problems = yield* Effect.forEach(projects, (project) => problemsIn$6(root, project), { concurrency: 1 });
14709
+ return Array.flatten(problems);
14710
+ });
14711
+ // src/features/check-skills/model/skill-files.ts
14712
+ const RULE$9 = "skill-file";
14713
+ const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
14714
+ const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
14715
+ const FIXTURE = /(?:^|\/)fixtures\//u;
14716
+ const MARKDOWN = ".md";
14717
+ const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
14718
+ const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
14719
+ const HEADING = /^# (?<title>.+)$/mu;
14720
+ const NAME_KEY$1 = /^name:/mu;
14721
+ const LICENSE_KEY = /^license:/mu;
14722
+ const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
14723
+ const LINK = /\]\((?<target>[^)\s]+)\)/gu;
14724
+ const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
14725
+ const FRAGMENT = /#.*$/u;
14726
+ const GITHUB = "https://github.com/";
14727
+ const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
14728
+ const BLANK = /\s+/u;
14729
+ const SEPARATOR = "/";
14730
+ const START$6 = 0;
14731
+ const FIRST$2 = 1;
14732
+ const READ_CONCURRENCY$2 = 16;
14733
+ const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
14734
+ const Frontmatter = Schema.Struct({
14735
+ name: Schema.optional(Schema.String),
14736
+ license: Schema.optional(Schema.Unknown),
14737
+ metadata: Schema.optional(Metadata)
14738
+ });
14739
+ const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
14740
+ const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$6));
14741
+ const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
14742
+ const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$6].length), Option.getOrElse(() => START$6));
14743
+ const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
14744
+ const nameProblems = ({ source, directory }, name, folder) => {
14745
+ const bodyStart = bodyStartOf(source);
14746
+ const body = String$1.slice(bodyStart)(source);
14747
+ const heading = groupOf$2("title")(HEADING.exec(body));
14748
+ return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
14749
+ index: offsetOf$1(source, NAME_KEY$1),
14750
+ message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
14751
+ })), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
14752
+ index: bodyStart + offsetOf$1(body, HEADING),
14753
+ message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
14754
+ })), Option.toArray)];
14755
+ };
14756
+ 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) => ({
14757
+ index: offsetOf$1(source, url),
14758
+ 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>.`
14759
+ })));
14760
+ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
14761
+ ...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
14762
+ ...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
14763
+ index: offsetOf$1(skill.source, LICENSE_KEY),
14764
+ message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
14765
+ })), Option.toArray),
14766
+ ...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
14767
+ ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
14768
+ file: skill.file,
14769
+ ...positionOf(skill.source)(index),
14770
+ rule: RULE$9,
14771
+ message
14772
+ })));
14773
+ 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) => ({
14774
+ target,
14775
+ index: found.index ?? START$6
14776
+ })), Option.toArray);
14777
+ const rangeOf$1 = (found) => {
14778
+ const start = found.index ?? START$6;
14779
+ return [start, start + found[START$6].length];
14780
+ };
14781
+ const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
14782
+ const linksIn = (source) => {
14783
+ const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
14784
+ return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
14785
+ };
14786
+ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
14787
+ const files = yield* RepositoryFiles;
14788
+ const text = yield* files.readFile(file);
14789
+ if (Option.isNone(text)) return [];
14790
+ const source = text.value;
14791
+ const directory = files.dirname(file);
14792
+ const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
14793
+ const missing = yield* Effect.filter(linksIn(source), isMissing);
14794
+ return pipe(missing, Array.map(({ target, index }) => ({
14795
+ file,
14796
+ ...positionOf(source)(index),
14797
+ rule: RULE$9,
14798
+ message: `links to ${target}, which does not exist. Fix the path or remove the link.`
14799
+ })));
14800
+ });
14801
+ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
14802
+ const files = yield* RepositoryFiles;
14803
+ const file = files.join(root, name);
14804
+ const directory = files.dirname(name);
14805
+ const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR}`)));
14806
+ const text = yield* files.readFile(file);
14807
+ const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
14808
+ const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$2 });
14809
+ const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
14810
+ file: files.join(root, entry),
14811
+ line: FIRST$2,
14812
+ column: FIRST$2,
14813
+ rule: RULE$9,
14814
+ message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
14815
+ })));
14816
+ return [
14817
+ ...pipe(text, Option.map((source) => frontmatterProblems({
14818
+ file,
14819
+ directory,
14820
+ source
14821
+ }, files.basename(directory))), Option.getOrElse(() => [])),
14822
+ ...licenses,
14823
+ ...Array.flatten(links)
14824
+ ];
14825
+ });
14826
+ /** @internal */
14827
+ const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
14828
+ const listed = yield* (yield* RepositoryFiles).listedFiles(root);
14829
+ const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
14830
+ const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$2 });
14831
+ return Array.flatten(found);
14832
+ });
14833
+ // src/app/document-checks.ts
14834
+ /** @internal */
14835
+ const checkDocuments = Effect.fn("checkDocuments")(function* checkDocuments(root) {
14836
+ const found = yield* Effect.all([
14837
+ checkSkillFiles(root),
14838
+ checkSkillEntry(root),
14839
+ checkPublishedSkills(root),
14840
+ checkReferenceLinks(root)
14841
+ ], { concurrency: "unbounded" });
14842
+ return Array.flatten(found);
14843
+ });
14854
14844
  // src/features/check-effect-diagnostics/model/effect-diagnostics.ts
14855
14845
  const RULE$8 = "effect-diagnostics-once";
14856
14846
  const PLUGIN = "@effect/language-service";
@@ -14929,9 +14919,6 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
14929
14919
  });
14930
14920
  // src/features/check-pack-settings/model/pack-settings.ts
14931
14921
  const RULE$6 = "pack-publint";
14932
- const PREPUBLISH_RULE = "prepublish-script";
14933
- const PREPUBLISH_SCRIPT = "prepublishOnly";
14934
- const PREPUBLISH_COMMAND = "vp exec msch-publish prepublish .";
14935
14922
  const CONFIG_FILE = "vite.config.ts";
14936
14923
  const PACK_KEY = "pack:";
14937
14924
  const START$4 = 0;
@@ -14939,8 +14926,7 @@ const READ_CONCURRENCY$1 = 16;
14939
14926
  const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14940
14927
  const Manifest$4 = Schema.Struct({
14941
14928
  private: Schema.optional(Schema.Boolean),
14942
- publishConfig: Schema.optional(Schema.Unknown),
14943
- scripts: Schema.optional(Schema.Record(Schema.String, Schema.String))
14929
+ publishConfig: Schema.optional(Schema.Unknown)
14944
14930
  });
14945
14931
  const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
14946
14932
  const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
@@ -14958,16 +14944,6 @@ const problemFor = (file, source) => ({
14958
14944
  message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
14959
14945
  });
14960
14946
  const publishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.filter(isPublished$2));
14961
- const prepublishProblems = (file, source, manifest) => {
14962
- const declared = pipe(Option.fromUndefinedOr(manifest.scripts), Option.flatMap(Record.get(PREPUBLISH_SCRIPT)));
14963
- if (Option.contains(declared, PREPUBLISH_COMMAND)) return [];
14964
- return [{
14965
- file,
14966
- ...positionOf(source)(Option.getOrElse(String$1.indexOf(`"${PREPUBLISH_SCRIPT}"`)(source), () => START$4)),
14967
- rule: PREPUBLISH_RULE,
14968
- message: `This package is published, so its ${PREPUBLISH_SCRIPT} script must be exactly \`${PREPUBLISH_COMMAND}\`. That one command refuses npm publish, which leaves catalog: in dependencies, and builds the package. Writing the guard in each package leaves some packages without it.`
14969
- }];
14970
- };
14971
14947
  const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
14972
14948
  const config = yield* Effect.tryPromise({
14973
14949
  try: () => resolveConfigFromFile(configFile),
@@ -14983,12 +14959,10 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
14983
14959
  });
14984
14960
  const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
14985
14961
  const files = yield* RepositoryFiles;
14986
- const manifestFile = files.join(root, manifestName);
14987
- const source = yield* files.readFile(manifestFile);
14962
+ const source = yield* files.readFile(files.join(root, manifestName));
14988
14963
  const manifest = publishedManifest(source);
14989
- if (Option.isNone(manifest) || Option.isNone(source)) return [];
14990
- const config = yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
14991
- return [...prepublishProblems(manifestFile, source.value, manifest.value), ...config];
14964
+ if (Option.isNone(manifest)) return [];
14965
+ return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
14992
14966
  });
14993
14967
  /** @internal */
14994
14968
  const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
@@ -15416,11 +15390,8 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
15416
15390
  checkDocker(root),
15417
15391
  checkUnneededFiles(root),
15418
15392
  checkReplacedTools(root),
15419
- checkAlchemyPatch(root),
15420
15393
  checkManifests(root),
15421
- checkSkillFiles(root),
15422
- checkSkillEntry(root),
15423
- checkPublishedSkills(root),
15394
+ checkDocuments(root),
15424
15395
  checkComments(root),
15425
15396
  checkAppliedPackages(root),
15426
15397
  checkGitSubpath(root),