@r_masseater/msch 0.65.0 → 0.65.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/dist/cargo-inputs.mjs +2 -2
  2. package/dist/changed.mjs +4 -4
  3. package/dist/cli.mjs +363 -388
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/config.d.mts +1 -1
  6. package/dist/config.mjs +5 -1
  7. package/dist/config.mjs.map +1 -1
  8. package/dist/{dependencies-B6p7x90y.mjs → dependencies-BDQ7XSwU.mjs} +7 -30
  9. package/dist/dependencies-BDQ7XSwU.mjs.map +1 -0
  10. package/dist/exits.mjs +4 -4
  11. package/dist/export-subpaths-D6ZLYZGy.mjs +17 -0
  12. package/dist/export-subpaths-D6ZLYZGy.mjs.map +1 -0
  13. package/dist/{ignored-directories-BgUqwuc4.mjs → ignored-directories-DurTKTTN.mjs} +2 -2
  14. package/dist/{ignored-directories-BgUqwuc4.mjs.map → ignored-directories-DurTKTTN.mjs.map} +1 -1
  15. package/dist/{index-BZIBqvmt.d.mts → index-MUn1dolO.d.mts} +2 -1
  16. package/dist/{lookup-DmifnzVb.mjs → lookup-DjQU0W6q.mjs} +3 -16
  17. package/dist/lookup-DjQU0W6q.mjs.map +1 -0
  18. package/dist/{lookup-report-ARfHc4ey.mjs → lookup-report-CPR_cj8F.mjs} +3 -3
  19. package/dist/lookup-report-CPR_cj8F.mjs.map +1 -0
  20. package/dist/oxlint.mjs +2 -2
  21. package/dist/{pass-records-CFIrQmB5.mjs → pass-records-DdiDtl_g.mjs} +5 -5
  22. package/dist/pass-records-DdiDtl_g.mjs.map +1 -0
  23. package/dist/{problem-D2HKNIVq.mjs → problem-glqVxx3h.mjs} +2 -2
  24. package/dist/{problem-D2HKNIVq.mjs.map → problem-glqVxx3h.mjs.map} +1 -1
  25. package/dist/publish.mjs +7 -18
  26. package/dist/publish.mjs.map +1 -1
  27. package/dist/{published-BIexKvdJ.mjs → published-DnkuW2Tw.mjs} +10 -15
  28. package/dist/published-DnkuW2Tw.mjs.map +1 -0
  29. package/dist/refs.mjs +53 -25
  30. package/dist/refs.mjs.map +1 -1
  31. package/dist/{repository-files-B5sRbxlz.mjs → repository-files-mOPItI5o.mjs} +3 -3
  32. package/dist/repository-files-mOPItI5o.mjs.map +1 -0
  33. package/dist/{runtime-A2p57njU.mjs → runtime-mDBC8Yey.mjs} +2 -2
  34. package/dist/{runtime-A2p57njU.mjs.map → runtime-mDBC8Yey.mjs.map} +1 -1
  35. package/dist/{syntax-C0ddqOHc.mjs → syntax-A3ga4Ksb.mjs} +2 -2
  36. package/dist/{syntax-C0ddqOHc.mjs.map → syntax-A3ga4Ksb.mjs.map} +1 -1
  37. package/dist/tree-sitter-BfzHNwTR.mjs +41 -0
  38. package/dist/tree-sitter-BfzHNwTR.mjs.map +1 -0
  39. package/dist/{upstream-exits-Dp0EeI5D.mjs → upstream-exits-Bv2E-QO6.mjs} +21 -12
  40. package/dist/upstream-exits-Bv2E-QO6.mjs.map +1 -0
  41. package/dist/wake.mjs +1 -1
  42. package/dist/workspace-settings.d.mts +1 -1
  43. package/dist/workspace-settings.mjs +18 -5
  44. package/dist/workspace-settings.mjs.map +1 -1
  45. package/package.json +3 -6
  46. package/skills/msch-checks/SKILL.md +2 -2
  47. package/skills/msch-publishing/SKILL.md +2 -0
  48. package/dist/dependencies-B6p7x90y.mjs.map +0 -1
  49. package/dist/lookup-DmifnzVb.mjs.map +0 -1
  50. package/dist/lookup-report-ARfHc4ey.mjs.map +0 -1
  51. package/dist/pass-records-CFIrQmB5.mjs.map +0 -1
  52. package/dist/published-BIexKvdJ.mjs.map +0 -1
  53. package/dist/reference-links-B9NZUUF8.mjs +0 -172
  54. package/dist/reference-links-B9NZUUF8.mjs.map +0 -1
  55. package/dist/repository-files-B5sRbxlz.mjs.map +0 -1
  56. package/dist/upstream-exits-Dp0EeI5D.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,16 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-BIexKvdJ.mjs";
3
- import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-B6p7x90y.mjs";
4
- import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-CFIrQmB5.mjs";
5
- import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
6
- import { o as positionOf } from "./lookup-DmifnzVb.mjs";
2
+ import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-DnkuW2Tw.mjs";
3
+ import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-BDQ7XSwU.mjs";
4
+ import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-DdiDtl_g.mjs";
5
+ import { a as groupOf, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-mOPItI5o.mjs";
6
+ import { a as workspaceDeviations, c as tomlSourceComments, d as problemAtIndex, 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-Bv2E-QO6.mjs";
7
7
  import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
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";
8
+ import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-glqVxx3h.mjs";
9
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
- 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";
13
- import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-A2p57njU.mjs";
10
+ import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
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-A3ga4Ksb.mjs";
12
+ import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-mDBC8Yey.mjs";
14
13
  import "./cli-contract-D7btWrEu.mjs";
15
14
  import { builtinModules } from "node:module";
16
15
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
@@ -525,13 +524,13 @@ const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
525
524
  const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
526
525
  const RULE$63 = "git-subpath-dependency";
527
526
  const WHOLE_MATCH$4 = 0;
528
- const problemAt$7 = ({ file }, source) => (found) => ({
527
+ const problemAt$6 = ({ file }, source) => (found) => ({
529
528
  file,
530
529
  ...positionOf(source)(found.index ?? WHOLE_MATCH$4),
531
530
  rule: RULE$63,
532
531
  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
532
  });
534
- const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
533
+ const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
535
534
  const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
536
535
  /** @internal */
537
536
  const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
@@ -592,7 +591,7 @@ const workspaceProblem = (file, source, registry) => ({
592
591
  onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
593
592
  })
594
593
  });
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) => ({
594
+ const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf("value")(found), isGuarded)), Array.map((found) => ({
596
595
  file: entry.file,
597
596
  ...positionOf(source)(found.index ?? START$23),
598
597
  rule: RULE$60,
@@ -10820,7 +10819,7 @@ const SPACE = " ";
10820
10819
  const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
10821
10820
  const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
10822
10821
  const keysOf$1 = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
10823
- const problemAt$6 = ({ file, source }, rule, message) => (offset) => ({
10822
+ const problemAt$5 = ({ file, source }, rule, message) => (offset) => ({
10824
10823
  file,
10825
10824
  ...positionOf(source)(offset),
10826
10825
  rule,
@@ -10830,7 +10829,7 @@ const pathFiltersIn = (file, source) => {
10830
10829
  const root = parseDocument(source).contents;
10831
10830
  const triggers = pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf$1(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
10832
10831
  const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
10833
- return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$6({
10832
+ return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$5({
10834
10833
  file,
10835
10834
  source
10836
10835
  }, PATH_FILTER, FILTER_MESSAGE)(offset)));
@@ -10853,7 +10852,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, off
10853
10852
  text: value,
10854
10853
  offset
10855
10854
  })))));
10856
- const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$6(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
10855
+ const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$5(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
10857
10856
  const packagesIn = (workspaces, { file, name, source }) => {
10858
10857
  const where = {
10859
10858
  file,
@@ -10875,13 +10874,12 @@ const actionProblems = (workspaces, file, name) => pipe(named$1(workspaces, name
10875
10874
  rule: PACKAGE,
10876
10875
  message: packageMessage(`The action ${name}`, directory)
10877
10876
  })), Option.toArray);
10878
- const groupOf$1 = (pattern, name) => pipe(String$1.match(pattern)(name), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups["name"])));
10879
10877
  /** @internal */
10880
10878
  const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkflowScale(root) {
10881
10879
  const files = yield* RepositoryFiles;
10882
10880
  const listed = yield* files.listedFiles(root);
10883
10881
  const workspaces = yield* namedWorkspaces(root);
10884
- const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(WORKFLOW, name), Option.map((stem) => ({
10882
+ const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf("name")(WORKFLOW.exec(name)), Option.map((stem) => ({
10885
10883
  name,
10886
10884
  stem
10887
10885
  })), Option.toArray)));
@@ -10894,7 +10892,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
10894
10892
  source: text
10895
10893
  })]), Option.getOrElse(() => []));
10896
10894
  }), { concurrency: READ_CONCURRENCY$13 });
10897
- const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
10895
+ const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf("name")(ACTION.exec(name)), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
10898
10896
  return [...Array.flatten(found), ...actions];
10899
10897
  });
10900
10898
  // src/features/check-repository-layout/model/workspace-checks.ts
@@ -10912,6 +10910,9 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
10912
10910
  ], { concurrency: "unbounded" });
10913
10911
  return Array.flatten(found);
10914
10912
  });
10913
+ // src/shared/lib/keys.ts
10914
+ /** @internal */
10915
+ const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
10915
10916
  // src/shared/lib/package-name.ts
10916
10917
  const SCOPE$2 = "@";
10917
10918
  const SEPARATOR$7 = "/";
@@ -10969,7 +10970,7 @@ const localFile = Effect.fn("localFile")(function* localFile({ directory, import
10969
10970
  if (Option.isNone(target)) return Option.none();
10970
10971
  return yield* existingSource(files.resolve(directory, target.value));
10971
10972
  });
10972
- const referenceOf$2 = (graph, from, specifier) => {
10973
+ const referenceOf$3 = (graph, from, specifier) => {
10973
10974
  if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT$1)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
10974
10975
  const name = packageNameOf(specifier);
10975
10976
  return Effect.succeedSome(Result.fail(name));
@@ -10980,7 +10981,7 @@ const referencesIn$2 = Effect.fn("referencesIn")(function* referencesIn(graph, f
10980
10981
  onNone: () => [],
10981
10982
  onSome: (source) => specifiersIn(graph.api, file, source)
10982
10983
  });
10983
- const references = yield* Effect.forEach(specifiers, (specifier) => referenceOf$2(graph, file, specifier), { concurrency: 1 });
10984
+ const references = yield* Effect.forEach(specifiers, (specifier) => referenceOf$3(graph, file, specifier), { concurrency: 1 });
10984
10985
  const found = Array.getSomes(references);
10985
10986
  return {
10986
10987
  packages: Array.getFailures(found),
@@ -11028,7 +11029,6 @@ const InstalledManifest = Schema.Struct({
11028
11029
  peerDependenciesMeta: PeerMeta
11029
11030
  });
11030
11031
  const decodeManifest$6 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
11031
- const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
11032
11032
  const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
11033
11033
  const installedNames = (manifest) => [
11034
11034
  ...keysOf(manifest.dependencies),
@@ -11311,7 +11311,6 @@ const Manifest$5 = Schema.Struct({
11311
11311
  });
11312
11312
  const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$5));
11313
11313
  const manifestOf$1 = (text) => decode(text);
11314
- const dependencyNames = (manifest) => pipe(Option.fromUndefinedOr(manifest.dependencies), Option.map(Record.keys), Option.getOrElse(() => []));
11315
11314
  const isFileList = Schema.is(Schema.Array(Schema.String));
11316
11315
  const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
11317
11316
  const listedSources = (declared, { workspace, join }) => new Set(pipe(declared, Array.flatMap((target) => Array.append(sourcesOf$1(workspace, target), join(target)))));
@@ -11357,7 +11356,7 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
11357
11356
  const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
11358
11357
  const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
11359
11358
  if (libraries.length <= SINGLE) return [];
11360
- return pipe(dependencies, Array.flatMap((name) => {
11359
+ return pipe(keysOf(dependencies), Array.flatMap((name) => {
11361
11360
  const importers = pipe(libraries, Array.filter(importsPackage(name)));
11362
11361
  const neededByBin = pipe(bins, Array.some(importsPackage(name)));
11363
11362
  if (!(importers.length > START$18 && importers.length < libraries.length) || neededByBin) return [];
@@ -11436,7 +11435,7 @@ const messageOf$3 = (statement) => {
11436
11435
  };
11437
11436
  const problemsIn$13 = (api) => (file) => (source) => {
11438
11437
  const retained = api.createSourceFile(file, source);
11439
- const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$8({
11438
+ const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$7({
11440
11439
  rule: RULE$35,
11441
11440
  message: messageOf$3(statement)
11442
11441
  })(statement)));
@@ -11531,7 +11530,7 @@ const analyse = Effect.fn("analyse")(function* analyse(pack) {
11531
11530
  ...effects,
11532
11531
  ...optionalPeerProblems({
11533
11532
  located,
11534
- dependencies: dependencyNames(manifest),
11533
+ dependencies: manifest.dependencies,
11535
11534
  used
11536
11535
  })
11537
11536
  ];
@@ -11690,8 +11689,10 @@ const slotTarget = (context) => (expression) => slotOf(context.checker)(expressi
11690
11689
  }));
11691
11690
  const libraryTargetOf = (context) => (expression, contextual) => aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));
11692
11691
  const siteWithin = (context) => (node) => Array.findFirst(context.sites, (site) => contains(node)(site.node));
11693
- const aliasSite = (context) => (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => Array.findFirst(declarationsOf(alias), isTypeAliasDeclaration)), Option.flatMap(siteWithin(context)));
11694
- const annotationSite = (context) => (expression) => symbolAt(context.checker)(expression).pipe(Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)), Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())), Option.flatMap(annotationOf), Option.flatMap((annotation) => siteWithin(context)(annotation).pipe(Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))))));
11692
+ const aliasDeclarationOf = (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => Array.findFirst(declarationsOf(alias), isTypeAliasDeclaration)));
11693
+ const aliasSite = (context) => (type) => Option.flatMap(aliasDeclarationOf(type), siteWithin(context));
11694
+ const annotationAt = (checker) => (expression) => symbolAt(checker)(expression).pipe(Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)), Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())), Option.flatMap(annotationOf));
11695
+ const annotationSite = (context) => (expression) => annotationAt(context.checker)(expression).pipe(Option.flatMap((annotation) => siteWithin(context)(annotation).pipe(Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))))));
11695
11696
  const siteBehind = (context) => (expression) => aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(Option.orElse(() => annotationSite(context)(expression)));
11696
11697
  const isFlowSource = (node) => isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);
11697
11698
  const flowOf = (context) => (expression) => Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(Option.flatMap((contextual) => Option.all([vocabularyOf(context.checker)(contextual), libraryTargetOf(context)(expression, contextual)])), Option.flatMap(([vocabulary, target]) => siteBehind(context)(expression).pipe(Option.filter((site) => isSubsetOf(site.values, vocabulary.values)), Option.map((site) => ({
@@ -11818,7 +11819,7 @@ const ownerValuesOf = (checker) => (declaration) => {
11818
11819
  const type = checker.getTypeAtLocation(declaration.name);
11819
11820
  return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
11820
11821
  };
11821
- const annotationProblem = (message) => problemAt$8({
11822
+ const annotationProblem = (message) => problemAt$7({
11822
11823
  rule: "owner-annotation",
11823
11824
  message
11824
11825
  });
@@ -11954,7 +11955,7 @@ const shapeProblem = (site, matches) => {
11954
11955
  onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
11955
11956
  onSome: () => "Use the library type instead of copying it."
11956
11957
  });
11957
- return problemAt$8({
11958
+ return problemAt$7({
11958
11959
  rule: "library-shape",
11959
11960
  message: `This shape copies ${shown}. ${advice}`
11960
11961
  })(site.node);
@@ -12002,14 +12003,10 @@ const selectsKeys = (checker) => (node, values) => {
12002
12003
  return pipe(typeArguments, Array.filter((argument) => argument !== node), Array.some((argument) => isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument)))));
12003
12004
  };
12004
12005
  const FILTERED_TYPE = 0;
12005
- const isConditionalAlias = (checker) => (reference) => isTypeReferenceNode(reference) && symbolAtLocation(checker)(reference.typeName).pipe(Option.map(declarationsOf), Option.exists(Array.some((declaration) => isTypeAliasDeclaration(declaration) && declaration.type.kind === SyntaxKind.ConditionalType)));
12006
+ const isConditionalAlias = (declaration) => isTypeAliasDeclaration(declaration) && declaration.type.kind === SyntaxKind.ConditionalType;
12006
12007
  const filtersBy = (checker) => (node) => {
12007
12008
  const { parent } = node;
12008
- if (isTypeReferenceNode(parent)) {
12009
- const typeArguments = parent.typeArguments ?? [];
12010
- if (Array.findFirstIndex(typeArguments, (argument) => argument === node).pipe(Option.exists((position) => position > FILTERED_TYPE)) && isConditionalAlias(checker)(parent)) return true;
12011
- }
12012
- return parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent);
12009
+ return isTypeReferenceNode(parent) && Array.findFirstIndex(parent.typeArguments ?? [], (argument) => argument === node).pipe(Option.exists((position) => position > FILTERED_TYPE)) && symbolAtLocation(checker)(parent.typeName).pipe(Option.map(declarationsOf), Option.exists(Array.some(isConditionalAlias))) || parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent);
12013
12010
  };
12014
12011
  const unionValuesOf = (checker) => (node) => literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(Option.filter((values) => !selectsKeys(checker)(node, values) && !filtersBy(checker)(node)));
12015
12012
  const isExpressionSite = (node) => isArrayLiteralExpression(node) || isCallExpression(node);
@@ -12059,7 +12056,7 @@ const derivedVerdict = (context) => (site) => {
12059
12056
  const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
12060
12057
  if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
12061
12058
  const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;
12062
- return verdict([problemAt$8({
12059
+ return verdict([problemAt$7({
12063
12060
  rule: "owner-extension",
12064
12061
  message
12065
12062
  })(site.node)], []);
@@ -12081,7 +12078,7 @@ const originalVerdict = (context) => (site) => {
12081
12078
  const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
12082
12079
  if (Array.isReadonlyArrayNonEmpty(owners)) {
12083
12080
  const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
12084
- return verdict([problemAt$8({
12081
+ return verdict([problemAt$7({
12085
12082
  rule: "owner-value-set",
12086
12083
  message
12087
12084
  })(site.node)], []);
@@ -12089,7 +12086,7 @@ const originalVerdict = (context) => (site) => {
12089
12086
  const candidates = libraryCandidates(context)(site);
12090
12087
  if (Array.isReadonlyArrayNonEmpty(candidates)) {
12091
12088
  const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
12092
- return verdict([problemAt$8({
12089
+ return verdict([problemAt$7({
12093
12090
  rule: "library-value-set",
12094
12091
  message
12095
12092
  })(site.node)], []);
@@ -12120,7 +12117,7 @@ const isValuePosition = (node) => {
12120
12117
  const { parent } = node;
12121
12118
  return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
12122
12119
  };
12123
- const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$8({
12120
+ const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$7({
12124
12121
  rule: "owned-literal",
12125
12122
  message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
12126
12123
  })(literal)));
@@ -12411,17 +12408,19 @@ const subsetListProblem = ({ lists, literals, relative }) => {
12411
12408
  const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
12412
12409
  const lists = pipe(sites, Array.dedupeWith((left, right) => left.file === right.file && left.start === right.start), Array.map(nameListOf), Array.getSomes);
12413
12410
  const { relative } = repository;
12414
- const listedPath = listedPathProblem(repository);
12415
- const declared = declaredNameProblem({
12416
- literals,
12417
- relative
12418
- });
12419
- const subset = subsetListProblem({
12420
- lists,
12421
- literals,
12422
- relative
12423
- });
12424
- return pipe(lists, Array.map((list) => listedPath(list).pipe(Option.orElse(() => declared(list)), Option.orElse(() => subset(list)))), Array.getSomes);
12411
+ const checks = [
12412
+ listedPathProblem(repository),
12413
+ declaredNameProblem({
12414
+ literals,
12415
+ relative
12416
+ }),
12417
+ subsetListProblem({
12418
+ lists,
12419
+ literals,
12420
+ relative
12421
+ })
12422
+ ];
12423
+ return pipe(lists, Array.map((list) => Array.findFirst(checks, (check) => check(list))), Array.getSomes);
12425
12424
  };
12426
12425
  // src/features/check-value-owners/model/repository-names.ts
12427
12426
  const MANIFEST$3 = "package.json";
@@ -12561,7 +12560,7 @@ const destructuredName = (declaration) => {
12561
12560
  if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
12562
12561
  return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
12563
12562
  };
12564
- const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
12563
+ const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
12565
12564
  rule: RULE$31,
12566
12565
  message: messageOf$1(name)
12567
12566
  })), Option.map((report) => report(declaration)));
@@ -12666,7 +12665,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
12666
12665
  };
12667
12666
  const problemOf$3 = (checker) => (candidate) => {
12668
12667
  if (changesTheCall(candidate.wrapper)) return Option.none();
12669
- return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
12668
+ return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
12670
12669
  rule: RULE$30,
12671
12670
  message: messageOf(forward.callee.getText())
12672
12671
  })(candidate.name)));
@@ -12740,11 +12739,11 @@ const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\
12740
12739
  const PLUGIN_ROOT = "..";
12741
12740
  const READ_CONCURRENCY$11 = 16;
12742
12741
  const START$16 = 0;
12743
- const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
12742
+ const referenceOf$2 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
12744
12743
  path,
12745
12744
  index: found.index ?? START$16
12746
12745
  })), Option.toArray);
12747
- const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
12746
+ const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$2));
12748
12747
  const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
12749
12748
  const files = yield* RepositoryFiles;
12750
12749
  const text = yield* files.readFile(file);
@@ -13197,20 +13196,16 @@ const commandProblems$1 = (sources) => pipe(sources, Array.flatMap(problemsOf));
13197
13196
  // src/features/check-vite-plus/model/doc-sources.ts
13198
13197
  const FENCE = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \t]*\n)(?<body>[\s\S]*?)^```[ \t]*$/gmu;
13199
13198
  const INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\n]+)`(?!`)/gu;
13200
- const groupOf = (match) => (name) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap(Record.get(name)));
13201
- const codeIn = (pattern) => (source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => {
13202
- const group = groupOf(match);
13203
- return pipe(Option.all({
13204
- open: group("open"),
13205
- text: group("body"),
13206
- whole: Array.head(match),
13207
- index: Option.fromUndefinedOr(match.index)
13208
- }), Option.map(({ open, text, whole, index }) => ({
13209
- text,
13210
- start: index + open.length,
13211
- end: index + whole.length
13212
- })), Option.toArray);
13213
- }));
13199
+ const codeIn = (pattern) => (source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => pipe(Option.all({
13200
+ open: groupOf("open")(match),
13201
+ text: groupOf("body")(match),
13202
+ whole: Array.head(match),
13203
+ index: Option.fromUndefinedOr(match.index)
13204
+ }), Option.map(({ open, text, whole, index }) => ({
13205
+ text,
13206
+ start: index + open.length,
13207
+ end: index + whole.length
13208
+ })), Option.toArray)));
13214
13209
  const outside = (fences) => (span) => !pipe(fences, Array.some((fence) => span.start >= fence.start && span.start < fence.end));
13215
13210
  const docSources = (file) => (source) => {
13216
13211
  const fences = codeIn(FENCE)(source);
@@ -13649,7 +13644,7 @@ const loadGrammars = Effect.fn("loadGrammars")(function* loadGrammars() {
13649
13644
  const commentNodesIn = (language, source) => pipe(readTree({
13650
13645
  language,
13651
13646
  source,
13652
- read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) => ({
13647
+ read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.filter(Predicate.isNotNullish), Array.map((node) => ({
13653
13648
  index: node.startIndex,
13654
13649
  text: node.text
13655
13650
  })))
@@ -13666,11 +13661,11 @@ const scriptGrammar = (attribs) => {
13666
13661
  if (SHADER_TYPE.test(type)) return Option.some("cpp");
13667
13662
  return Option.liftPredicate("javascript", () => SCRIPT_TYPE.test(type));
13668
13663
  };
13669
- const embeddedGrammar = ({ name, attribs }) => {
13670
- if (name === "style") return Option.some("css");
13671
- if (name === "script") return scriptGrammar(attribs);
13672
- return Option.none();
13664
+ const EMBEDDED_GRAMMARS = {
13665
+ style: () => Option.some("css"),
13666
+ script: scriptGrammar
13673
13667
  };
13668
+ const embeddedGrammar = ({ name, attribs }) => Record.get(EMBEDDED_GRAMMARS, name).pipe(Option.flatMap((grammarOf) => grammarOf(attribs)));
13674
13669
  const shifted = (offset) => ({ index, text }) => ({
13675
13670
  index: index + offset,
13676
13671
  text
@@ -14016,8 +14011,8 @@ const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf(held)), Array
14016
14011
  })));
14017
14012
  const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(namedCatalogsOf(settings), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
14018
14013
  const catalogOf = (specifier) => pipe(Option.liftPredicate(specifier, String$1.startsWith(CATALOG_PROTOCOL)), Option.map(String$1.slice(8)), Option.map((name) => Option.getOrElse(Option.liftPredicate(name, String$1.isNonEmpty), () => DEFAULT_CATALOG)));
14019
- const referenceOf = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
14020
- const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf(section), Record.toEntries, Array.flatMap(referenceOf))));
14014
+ const referenceOf$1 = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
14015
+ const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf(section), Record.toEntries, Array.flatMap(referenceOf$1))));
14021
14016
  const versionsOf = (raw) => pipe(Option.fromUndefinedOr(raw), Option.map((listed) => pipe(String$1.split(listed, VERSION_SEPARATOR), Array.map(String$1.trim))), Option.getOrElse(() => []));
14022
14017
  const hasKeyWith = (keys) => (prefix) => pipe(keys, Array.some(String$1.startsWith(prefix)));
14023
14018
  const isLocked = (keys) => (resolved) => Array.contains(keys, resolved) || hasKeyWith(keys)(`${resolved}(`);
@@ -14036,7 +14031,7 @@ const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root
14036
14031
  const listed = yield* files.listedFiles(root);
14037
14032
  const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
14038
14033
  const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$10(text))), Array.flatMap(referencesIn));
14039
- const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
14034
+ const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
14040
14035
  return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
14041
14036
  });
14042
14037
  const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
@@ -14046,17 +14041,17 @@ const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Arra
14046
14041
  const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
14047
14042
  const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
14048
14043
  const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\\s*$`, "u");
14049
- const problemAt$5 = ({ file, at }, rule, message) => (name, needle) => ({
14044
+ const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
14050
14045
  file,
14051
14046
  line: at(needle),
14052
14047
  column: FIRST_COLUMN$1,
14053
14048
  rule,
14054
14049
  message: `\`${name}\` ${message}`
14055
14050
  });
14056
- const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$5(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))));
14051
+ const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$4(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))));
14057
14052
  const staleIn = (located, settings, keys) => {
14058
14053
  const excludes = Option.getOrElse(decodeStrings(settings["minimumReleaseAgeExclude"]), () => []);
14059
- return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$5(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))));
14054
+ return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$4(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))));
14060
14055
  };
14061
14056
  const findingsIn = Effect.fn("findingsIn")(function* findingsIn(root, file, settings) {
14062
14057
  const read = yield* (yield* RepositoryFiles).readFile(file);
@@ -14082,6 +14077,238 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
14082
14077
  });
14083
14078
  return [...catalogs, ...uncataloged];
14084
14079
  });
14080
+ // src/features/check-skills/model/skill-entry.ts
14081
+ const ENTRY_RULE = "unlocked-skill";
14082
+ const VISIBLE_RULE = "skill-source-visible";
14083
+ const CONFIG_FILE$1 = "vite.config.ts";
14084
+ const RENOVATE_FILE$1 = "renovate.json";
14085
+ const SOURCE = "masseater/skills";
14086
+ const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
14087
+ const START$10 = 0;
14088
+ const LOCAL_PREFIX = "./";
14089
+ const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
14090
+ const Source = Schema.Struct({
14091
+ commit: Schema.optional(Schema.String),
14092
+ skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
14093
+ });
14094
+ const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
14095
+ const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
14096
+ const taggedError$1 = Schema.TaggedError;
14097
+ var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
14098
+ const problemAt$3 = (rule, file, text) => (anchor, message) => ({
14099
+ file,
14100
+ ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$10))),
14101
+ rule,
14102
+ message
14103
+ });
14104
+ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
14105
+ const files = yield* RepositoryFiles;
14106
+ const file = files.join(root, CONFIG_FILE$1);
14107
+ const text = yield* files.readFile(file);
14108
+ if (Option.isNone(text)) return Option.none();
14109
+ const config = yield* Effect.tryPromise({
14110
+ try: () => resolveConfigFromFile(file),
14111
+ catch: () => SkillsConfigUnreadable.make({ file })
14112
+ }).pipe(Effect.option);
14113
+ return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
14114
+ file,
14115
+ text: text.value,
14116
+ sources: skills
14117
+ })));
14118
+ });
14119
+ const entryProblems = ({ file, text, sources }) => {
14120
+ const at = problemAt$3(ENTRY_RULE, file, text);
14121
+ return pipe(Record.get(sources, SOURCE), Option.match({
14122
+ onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
14123
+ 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)
14124
+ }));
14125
+ };
14126
+ const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
14127
+ 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.`)));
14128
+ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
14129
+ const files = yield* RepositoryFiles;
14130
+ const file = files.join(root, RENOVATE_FILE$1);
14131
+ const text = yield* files.readFile(file);
14132
+ if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
14133
+ return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
14134
+ });
14135
+ /** @internal */
14136
+ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
14137
+ const declared = yield* declaredSkills(root);
14138
+ if (Option.isNone(declared)) return [];
14139
+ const preset = yield* presetProblems(root);
14140
+ return [
14141
+ ...entryProblems(declared.value),
14142
+ ...visibleProblems(declared.value),
14143
+ ...preset
14144
+ ];
14145
+ });
14146
+ // src/features/check-skills/model/published-skills.ts
14147
+ const RULE$14 = "published-skills";
14148
+ const KEYWORD = "tanstack-intent";
14149
+ const SKILLS = "skills";
14150
+ const MANIFEST_FILE = "package.json";
14151
+ const SKILL_FILE$1 = "SKILL.md";
14152
+ const SUCCEEDED = 0;
14153
+ const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
14154
+ const problemAt$2 = problemInFile(RULE$14);
14155
+ 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))));
14156
+ const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
14157
+ const packagingMessages = ({ keywords, files }, skills) => {
14158
+ 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.`));
14159
+ 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.`));
14160
+ return Array.getSomes([keyword, unshipped]);
14161
+ };
14162
+ const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
14163
+ const handle = yield* ChildProcess.make("node", [
14164
+ INTENT_CLI,
14165
+ "validate",
14166
+ SKILLS
14167
+ ], {
14168
+ cwd: directory,
14169
+ extendEnv: true,
14170
+ stdin: "ignore"
14171
+ });
14172
+ const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
14173
+ return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
14174
+ }, Effect.scoped);
14175
+ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14176
+ const files = yield* RepositoryFiles;
14177
+ const directory = files.join(root, project.directory);
14178
+ const manifest = files.join(directory, MANIFEST_FILE);
14179
+ const skills = skillDirectoriesIn(files, directory);
14180
+ 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.`)];
14181
+ const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
14182
+ 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)];
14183
+ });
14184
+ /** @internal */
14185
+ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
14186
+ const projects = yield* publishedProjects(root);
14187
+ const problems = yield* Effect.forEach(projects, (project) => problemsIn$8(root, project), { concurrency: 1 });
14188
+ return Array.flatten(problems);
14189
+ });
14190
+ // src/features/check-skills/model/skill-files.ts
14191
+ const RULE$13 = "skill-file";
14192
+ const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
14193
+ const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
14194
+ const FIXTURE = /(?:^|\/)fixtures\//u;
14195
+ const MARKDOWN = ".md";
14196
+ const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
14197
+ const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
14198
+ const HEADING = /^# (?<title>.+)$/mu;
14199
+ const NAME_KEY$1 = /^name:/mu;
14200
+ const LICENSE_KEY = /^license:/mu;
14201
+ const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
14202
+ const LINK = /\]\((?<target>[^)\s]+)\)/gu;
14203
+ const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
14204
+ const FRAGMENT = /#.*$/u;
14205
+ const GITHUB = "https://github.com/";
14206
+ const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
14207
+ const BLANK = /\s+/u;
14208
+ const SEPARATOR$2 = "/";
14209
+ const START$9 = 0;
14210
+ const FIRST$3 = 1;
14211
+ const READ_CONCURRENCY$5 = 16;
14212
+ const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
14213
+ const Frontmatter = Schema.Struct({
14214
+ name: Schema.optional(Schema.String),
14215
+ license: Schema.optional(Schema.Unknown),
14216
+ metadata: Schema.optional(Metadata)
14217
+ });
14218
+ const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
14219
+ const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$9));
14220
+ const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
14221
+ const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$9].length), Option.getOrElse(() => START$9));
14222
+ const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
14223
+ const nameProblems = ({ source, directory }, name, folder) => {
14224
+ const bodyStart = bodyStartOf(source);
14225
+ const body = String$1.slice(bodyStart)(source);
14226
+ const heading = groupOf("title")(HEADING.exec(body));
14227
+ return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
14228
+ index: offsetOf$1(source, NAME_KEY$1),
14229
+ message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
14230
+ })), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
14231
+ index: bodyStart + offsetOf$1(body, HEADING),
14232
+ message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
14233
+ })), Option.toArray)];
14234
+ };
14235
+ 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) => ({
14236
+ index: offsetOf$1(source, url),
14237
+ 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>.`
14238
+ })));
14239
+ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
14240
+ ...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
14241
+ ...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
14242
+ index: offsetOf$1(skill.source, LICENSE_KEY),
14243
+ message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
14244
+ })), Option.toArray),
14245
+ ...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
14246
+ ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
14247
+ file: skill.file,
14248
+ ...positionOf(skill.source)(index),
14249
+ rule: RULE$13,
14250
+ message
14251
+ })));
14252
+ const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
14253
+ target,
14254
+ index: found.index ?? START$9
14255
+ })), Option.toArray);
14256
+ const rangeOf$1 = (found) => {
14257
+ const start = found.index ?? START$9;
14258
+ return [start, start + found[START$9].length];
14259
+ };
14260
+ const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
14261
+ const linksIn$1 = (source) => {
14262
+ const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
14263
+ return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
14264
+ };
14265
+ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
14266
+ const files = yield* RepositoryFiles;
14267
+ const text = yield* files.readFile(file);
14268
+ if (Option.isNone(text)) return [];
14269
+ const source = text.value;
14270
+ const directory = files.dirname(file);
14271
+ const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
14272
+ const missing = yield* Effect.filter(linksIn$1(source), isMissing);
14273
+ return pipe(missing, Array.map(({ target, index }) => ({
14274
+ file,
14275
+ ...positionOf(source)(index),
14276
+ rule: RULE$13,
14277
+ message: `links to ${target}, which does not exist. Fix the path or remove the link.`
14278
+ })));
14279
+ });
14280
+ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
14281
+ const files = yield* RepositoryFiles;
14282
+ const file = files.join(root, name);
14283
+ const directory = files.dirname(name);
14284
+ const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
14285
+ const text = yield* files.readFile(file);
14286
+ const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
14287
+ const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
14288
+ const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
14289
+ file: files.join(root, entry),
14290
+ line: FIRST$3,
14291
+ column: FIRST$3,
14292
+ rule: RULE$13,
14293
+ message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
14294
+ })));
14295
+ return [
14296
+ ...pipe(text, Option.map((source) => frontmatterProblems({
14297
+ file,
14298
+ directory,
14299
+ source
14300
+ }, files.basename(directory))), Option.getOrElse(() => [])),
14301
+ ...licenses,
14302
+ ...Array.flatten(links)
14303
+ ];
14304
+ });
14305
+ /** @internal */
14306
+ const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
14307
+ const listed = yield* (yield* RepositoryFiles).listedFiles(root);
14308
+ const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
14309
+ const found = yield* Effect.forEach(skills, (name) => problemsIn$7(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
14310
+ return Array.flatten(found);
14311
+ });
14085
14312
  // src/features/check-version-downgrades/model/version-entries.ts
14086
14313
  const MANIFEST_SECTIONS = [
14087
14314
  "dependencies",
@@ -14140,9 +14367,9 @@ const cargoEntries = (text) => {
14140
14367
  };
14141
14368
  const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
14142
14369
  // src/features/check-version-downgrades/model/version-downgrade.ts
14143
- const RULE$14 = "version-downgrade";
14370
+ const RULE$12 = "version-downgrade";
14144
14371
  const DEFAULT_BASE = "origin/main";
14145
- const READ_CONCURRENCY$5 = 16;
14372
+ const READ_CONCURRENCY$4 = 16;
14146
14373
  const READERS = [
14147
14374
  [/(?:^|\/)package\.json$/u, manifestEntries],
14148
14375
  [/^pnpm-workspace\.yaml$/u, workspaceEntries],
@@ -14166,7 +14393,7 @@ const downgradesIn = ({ file, text, before, after }) => {
14166
14393
  file,
14167
14394
  line: lineOf(text, entry),
14168
14395
  column: FIRST_LINE$1,
14169
- rule: RULE$14,
14396
+ rule: RULE$12,
14170
14397
  message: message(old, entry)
14171
14398
  })), Option.toArray)));
14172
14399
  };
@@ -14192,24 +14419,24 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
14192
14419
  before: read(before),
14193
14420
  after: read(after)
14194
14421
  })), Option.getOrElse(() => []));
14195
- }), { concurrency: READ_CONCURRENCY$5 });
14422
+ }), { concurrency: READ_CONCURRENCY$4 });
14196
14423
  return Array.flatten(found);
14197
14424
  });
14198
14425
  // src/features/check-version-downgrades/model/renovate-settings.ts
14199
- const RENOVATE_FILE$1 = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
14426
+ const RENOVATE_FILE = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
14200
14427
  const AUTOMERGE_OFF = /["']?platformAutomerge["']?\s*:\s*false/gu;
14201
14428
  const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)["']/gu;
14202
14429
  const AUTOMERGE_RULE = "renovate-platform-automerge";
14203
14430
  const CAP_RULE = "renovate-version-cap";
14204
14431
  const PRESET_RULE = "renovate-msch-preset";
14205
- const PRESET$1 = "github>masseater/ecosystems//libs/msch/renovate";
14206
- const START$10 = 0;
14207
- const READ_CONCURRENCY$4 = 16;
14432
+ const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
14433
+ const START$8 = 0;
14434
+ const READ_CONCURRENCY$3 = 16;
14208
14435
  const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
14209
14436
  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.";
14210
- const PRESET_MESSAGE = `does not extend \`${PRESET$1}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
14437
+ const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
14211
14438
  const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
14212
- const problemsIn$8 = (file, source) => {
14439
+ const problemsIn$6 = (file, source) => {
14213
14440
  const at = positionOf(source);
14214
14441
  const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
14215
14442
  file,
@@ -14222,44 +14449,44 @@ const problemsIn$8 = (file, source) => {
14222
14449
  ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
14223
14450
  ...pipe([{
14224
14451
  file,
14225
- ...at(START$10),
14452
+ ...at(START$8),
14226
14453
  rule: PRESET_RULE,
14227
14454
  message: PRESET_MESSAGE
14228
- }], Array.filter(() => !String$1.includes(`"${PRESET$1}"`)(source)))
14455
+ }], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
14229
14456
  ];
14230
14457
  };
14231
14458
  /** @internal */
14232
14459
  const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* checkRenovateSettings(root) {
14233
14460
  const files = yield* RepositoryFiles;
14234
14461
  const listed = yield* files.listedFiles(root);
14235
- const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE$1.test(name))), (name) => {
14462
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE.test(name))), (name) => {
14236
14463
  const file = files.join(root, name);
14237
14464
  return files.readFile(file).pipe(Effect.map(Option.match({
14238
14465
  onNone: () => [],
14239
- onSome: (source) => problemsIn$8(file, source)
14466
+ onSome: (source) => problemsIn$6(file, source)
14240
14467
  })));
14241
- }, { concurrency: READ_CONCURRENCY$4 });
14468
+ }, { concurrency: READ_CONCURRENCY$3 });
14242
14469
  return Array.flatten(found);
14243
14470
  });
14244
14471
  // src/features/find-invisible-characters/model/hidden-unicode.ts
14245
14472
  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;
14246
14473
  const NUL = "\0";
14247
- const START$9 = 0;
14474
+ const START$7 = 0;
14248
14475
  const HEX = 16;
14249
14476
  const CODE_POINT_WIDTH = 4;
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"));
14477
+ const READ_CONCURRENCY$2 = 64;
14478
+ const RULE$11 = "hidden-unicode";
14479
+ const hexOf = (character) => pipe(String$1.codePointAt(START$7)(character), Option.getOrElse(() => START$7), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
14253
14480
  const problemOf = (file, source) => (found) => {
14254
- const hex = hexOf(found[START$9]);
14481
+ const hex = hexOf(found[START$7]);
14255
14482
  return {
14256
14483
  file,
14257
- ...positionOf(source)(found.index ?? START$9),
14258
- rule: RULE$13,
14484
+ ...positionOf(source)(found.index ?? START$7),
14485
+ rule: RULE$11,
14259
14486
  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}.`
14260
14487
  };
14261
14488
  };
14262
- const problemsIn$7 = (file, source) => {
14489
+ const problemsIn$5 = (file, source) => {
14263
14490
  if (String$1.includes(NUL)(source)) return [];
14264
14491
  return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
14265
14492
  };
@@ -14271,18 +14498,18 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
14271
14498
  const file = files.join(root, name);
14272
14499
  return files.readFile(file).pipe(Effect.map(Option.match({
14273
14500
  onNone: () => [],
14274
- onSome: (source) => problemsIn$7(file, source)
14501
+ onSome: (source) => problemsIn$5(file, source)
14275
14502
  })));
14276
- }, { concurrency: READ_CONCURRENCY$3 });
14503
+ }, { concurrency: READ_CONCURRENCY$2 });
14277
14504
  return Array.flatten(found);
14278
14505
  });
14279
14506
  // src/features/find-unneeded-files/model/applied-packages.ts
14280
14507
  const MSCH = "@r_masseater/msch";
14281
14508
  const SCOPE$1 = "@r_masseater/";
14282
- const RULE$12 = "applied-package";
14509
+ const RULE$10 = "applied-package";
14283
14510
  const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
14284
14511
  const NOT_FOUND = -1;
14285
- const SEPARATOR$2 = "/";
14512
+ const SEPARATOR$1 = "/";
14286
14513
  const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
14287
14514
  const BinMap = Schema.Record(Schema.String, Schema.String);
14288
14515
  const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
@@ -14296,7 +14523,7 @@ const declaredNames = (manifest) => pipe([
14296
14523
  const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
14297
14524
  onNone: () => [],
14298
14525
  onSome: (bin) => {
14299
- if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$2), Array.lastNonEmpty)];
14526
+ if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
14300
14527
  return Record.keys(bin);
14301
14528
  }
14302
14529
  }));
@@ -14321,16 +14548,16 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
14321
14548
  const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
14322
14549
  return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
14323
14550
  });
14324
- const problemAt$4 = (file, source) => (index, name) => ({
14551
+ const problemAt$1 = (file, source) => (index, name) => ({
14325
14552
  file,
14326
14553
  ...positionOf(source)(index),
14327
- rule: RULE$12,
14554
+ rule: RULE$10,
14328
14555
  message: `msch applies ${name}. Remove this use and let msch apply it.`
14329
14556
  });
14330
14557
  const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
14331
14558
  const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
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({
14559
+ const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$1(file, source)(found.index ?? NOT_FOUND, entry.name)))));
14560
+ const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
14334
14561
  onEmpty: () => "",
14335
14562
  onNonEmpty: Array.max(BY_LENGTH)
14336
14563
  }));
@@ -14349,7 +14576,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
14349
14576
  declared: manifest
14350
14577
  }), Option.match({
14351
14578
  onNone: () => [],
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)))
14579
+ onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$1(file, source)(index, name)), Option.toArray)))
14353
14580
  }));
14354
14581
  });
14355
14582
  const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
@@ -14379,8 +14606,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
14379
14606
  return yield* appliedPackageProblems(root, applied);
14380
14607
  });
14381
14608
  // src/features/find-unneeded-files/model/replaced-tools.ts
14382
- const RULE$11 = "replaced-tool";
14383
- const FIRST$3 = 1;
14609
+ const RULE$9 = "replaced-tool";
14610
+ const FIRST$2 = 1;
14384
14611
  const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
14385
14612
  const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
14386
14613
  const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
@@ -14458,9 +14685,9 @@ const REPLACED = [
14458
14685
  ];
14459
14686
  const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
14460
14687
  file,
14461
- line: FIRST$3,
14462
- column: FIRST$3,
14463
- rule: RULE$11,
14688
+ line: FIRST$2,
14689
+ column: FIRST$2,
14690
+ rule: RULE$9,
14464
14691
  message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
14465
14692
  })));
14466
14693
  /** @internal */
@@ -14478,7 +14705,7 @@ const unneededLockfile = (present) => (entry) => FOREIGN_LOCKFILE.test(entry.nam
14478
14705
  // src/features/find-unneeded-files/model/unneeded-files.ts
14479
14706
  const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
14480
14707
  const PNPM_DIRECTORY = ".pnpm/";
14481
- const SEPARATOR$1 = "/";
14708
+ const SEPARATOR = "/";
14482
14709
  const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
14483
14710
  const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
14484
14711
  const PNPM_OUTPUT = /(?:^|\/)\.pnpm\//u;
@@ -14494,7 +14721,7 @@ const SETUP_PATTERNS = [
14494
14721
  ];
14495
14722
  const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
14496
14723
  const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
14497
- const START$8 = 0;
14724
+ const START$6 = 0;
14498
14725
  const LAST_SEGMENT = 1;
14499
14726
  const FIRST_LINE = 1;
14500
14727
  const FIRST_COLUMN = 1;
@@ -14546,10 +14773,10 @@ const matches = (pattern) => ({ name }) => pattern.test(name);
14546
14773
  const isCargoManifest = matches(CARGO_MANIFEST_FILE);
14547
14774
  const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
14548
14775
  const isPnpmOutput = matches(PNPM_OUTPUT);
14549
- const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
14776
+ const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
14550
14777
  const ancestorsOf = (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));
14778
+ const parts = String$1.split(directory, SEPARATOR);
14779
+ return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
14553
14780
  };
14554
14781
  const readsCargoLock = (manifests, workspaces) => ({ name }) => {
14555
14782
  const directory = directoryOf(name);
@@ -14563,7 +14790,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
14563
14790
  const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
14564
14791
  return directoriesOf(roots);
14565
14792
  });
14566
- const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$8), (end) => String$1.slice(START$8, end)(name));
14793
+ const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
14567
14794
  const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
14568
14795
  const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
14569
14796
  const cargoProblems = (present, enabled) => {
@@ -14598,249 +14825,6 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
14598
14825
  if (Option.isNone(workspace)) return [];
14599
14826
  return yield* unneededIn(root, cargoEnabled(workspace.value));
14600
14827
  });
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
- });
14844
14828
  // src/features/check-effect-diagnostics/model/effect-diagnostics.ts
14845
14829
  const RULE$8 = "effect-diagnostics-once";
14846
14830
  const PLUGIN = "@effect/language-service";
@@ -14880,7 +14864,7 @@ const PROTOCOL = /^[a-z+]+:/u;
14880
14864
  const PATH_LIKE = "/";
14881
14865
  const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
14882
14866
  const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
14883
- const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
14867
+ const versionOf = (specifier) => Option.getOrElse(groupOf("version")(ALIAS.exec(specifier)), () => specifier);
14884
14868
  /** @internal */
14885
14869
  const isRange = (specifier) => {
14886
14870
  const version = versionOf(specifier);
@@ -15124,7 +15108,7 @@ const Manifest$2 = Schema.Struct({
15124
15108
  engines: Schema.optional(Engines)
15125
15109
  });
15126
15110
  const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
15127
- const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
15111
+ const majorOf = (found) => pipe(groupOf("major")(found), Option.map(Number));
15128
15112
  const isOld = (major) => major < MINIMUM;
15129
15113
  const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
15130
15114
  const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
@@ -15132,19 +15116,14 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
15132
15116
  onSome: isOld
15133
15117
  }));
15134
15118
  const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
15135
- const problemAt$1 = ({ entry, source, index }, message) => ({
15136
- file: entry.file,
15137
- ...positionOf(source)(index),
15138
- rule: RULE$3,
15139
- message
15140
- });
15119
+ const problemAt = ({ entry, source, index }, message) => problemAtIndex(RULE$3)(entry.file, source)(index, message);
15141
15120
  const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$2));
15142
- const unstatedProblem = (entry, source) => problemAt$1({
15121
+ const unstatedProblem = (entry, source) => problemAt({
15143
15122
  entry,
15144
15123
  source,
15145
15124
  index: START$2
15146
15125
  }, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
15147
- const rangeProblem = (entry, source) => (range) => problemAt$1({
15126
+ const rangeProblem = (entry, source) => (range) => problemAt({
15148
15127
  entry,
15149
15128
  source,
15150
15129
  index: offsetOf(source, ENGINES_KEY)
@@ -15158,12 +15137,12 @@ const manifestProblems$1 = (entry, source) => {
15158
15137
  if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
15159
15138
  return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
15160
15139
  };
15161
- const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt$1({
15140
+ const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
15162
15141
  entry,
15163
15142
  source,
15164
15143
  index: found.index ?? START$2
15165
15144
  }, `${SUPPORTED} \`${String$1.trim(found[START$2])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
15166
- const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$1({
15145
+ const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
15167
15146
  entry,
15168
15147
  source,
15169
15148
  index: START$2
@@ -15314,12 +15293,6 @@ const Manifest = Schema.fromJsonString(Schema.Struct({
15314
15293
  }));
15315
15294
  const decodeManifest = Schema.decodeUnknownOption(Manifest);
15316
15295
  const isManifest = (name) => name === MANIFEST || String$1.endsWith(`/${MANIFEST}`)(name);
15317
- const problemAt = (entry, source) => (index, message) => ({
15318
- file: entry.file,
15319
- ...positionOf(source)(index),
15320
- rule: RULE$1,
15321
- message
15322
- });
15323
15296
  const keyIndex = (source, key) => Option.getOrElse(String$1.indexOf(`"${key}"`)(source), () => START);
15324
15297
  const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
15325
15298
  onNone: () => [],
@@ -15336,8 +15309,8 @@ const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
15336
15309
  return [...pnpmFields, ...managerFields];
15337
15310
  }
15338
15311
  }));
15339
- const manifestProblems = (entry, source) => pipe(fieldsIn(source), Array.map(({ name, key }) => problemAt(entry, source)(keyIndex(source, key), `${name} in package.json is not allowed. ${PLACE} Move it there.`)));
15340
- const firstEntryProblem = (entry, source, deviations) => pipe(Array.head(deviations.entries), Option.map(({ index }) => problemAt(entry, source)(index, `This file is not read for upstream deviations. ${PLACE}`)), Option.toArray);
15312
+ const manifestProblems = (entry, source) => pipe(fieldsIn(source), Array.map(({ name, key }) => problemAtIndex(RULE$1)(entry.file, source)(keyIndex(source, key), `${name} in package.json is not allowed. ${PLACE} Move it there.`)));
15313
+ const firstEntryProblem = (entry, source, deviations) => pipe(Array.head(deviations.entries), Option.map(({ index }) => problemAtIndex(RULE$1)(entry.file, source)(index, `This file is not read for upstream deviations. ${PLACE}`)), Option.toArray);
15341
15314
  const problemsIn = (entry, source) => {
15342
15315
  if (isManifest(entry.name)) return manifestProblems(entry, source);
15343
15316
  if (String$1.endsWith(NESTED_WORKSPACE)(entry.name)) return firstEntryProblem(entry, source, workspaceDeviations(source));
@@ -15391,7 +15364,9 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
15391
15364
  checkUnneededFiles(root),
15392
15365
  checkReplacedTools(root),
15393
15366
  checkManifests(root),
15394
- checkDocuments(root),
15367
+ checkSkillFiles(root),
15368
+ checkSkillEntry(root),
15369
+ checkPublishedSkills(root),
15395
15370
  checkComments(root),
15396
15371
  checkAppliedPackages(root),
15397
15372
  checkGitSubpath(root),