@r_masseater/msch 0.71.0 → 0.73.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/changed.mjs +5 -4
  2. package/dist/changed.mjs.map +1 -1
  3. package/dist/cli.mjs +163 -267
  4. package/dist/cli.mjs.map +1 -1
  5. package/dist/config.d.mts +2 -2
  6. package/dist/config.mjs +1 -1
  7. package/dist/decision-rules.d.mts +1 -1
  8. package/dist/decision-rules.mjs +1 -1
  9. package/dist/{define-lint-preset-TN74hRYq.mjs → define-lint-preset-Bawe3IU5.mjs} +6 -1
  10. package/dist/define-lint-preset-Bawe3IU5.mjs.map +1 -0
  11. package/dist/{dependencies-C3kCe35Q.mjs → dependencies-BAjtDvY4.mjs} +27 -55
  12. package/dist/dependencies-BAjtDvY4.mjs.map +1 -0
  13. package/dist/exits.mjs +3 -3
  14. package/dist/exits.mjs.map +1 -1
  15. package/dist/{index-CWZNFtdG.d.mts → index-CHxAqDok.d.mts} +3 -6
  16. package/dist/{index-BvxWopv8.d.mts → index-DEuWKkok.d.mts} +2 -1
  17. package/dist/lint-rules.mjs +18 -2
  18. package/dist/lint-rules.mjs.map +1 -1
  19. package/dist/lint.d.mts +1 -1
  20. package/dist/lint.mjs +1 -1
  21. package/dist/{lookup-report-D1VTEK5k.mjs → lookup-report-Dp36RBaW.mjs} +2 -2
  22. package/dist/{lookup-report-D1VTEK5k.mjs.map → lookup-report-Dp36RBaW.mjs.map} +1 -1
  23. package/dist/{manifest-texts-K650kDy8.mjs → manifest-texts-CfnH7ifu.mjs} +4 -6
  24. package/dist/manifest-texts-CfnH7ifu.mjs.map +1 -0
  25. package/dist/output-DrM4OsOJ.mjs +14 -0
  26. package/dist/output-DrM4OsOJ.mjs.map +1 -0
  27. package/dist/{pass-records-kbx5VgwI.mjs → pass-records-DylVXWk1.mjs} +5 -4
  28. package/dist/pass-records-DylVXWk1.mjs.map +1 -0
  29. package/dist/publish.mjs +81 -151
  30. package/dist/publish.mjs.map +1 -1
  31. package/dist/{published-CpfXkChq.mjs → published-Bj0gR5IF.mjs} +27 -91
  32. package/dist/published-Bj0gR5IF.mjs.map +1 -0
  33. package/dist/published.mjs +11 -11
  34. package/dist/published.mjs.map +1 -1
  35. package/dist/refs.mjs +3 -3
  36. package/dist/refs.mjs.map +1 -1
  37. package/dist/runtime-Q9CzisOt.mjs +40 -0
  38. package/dist/runtime-Q9CzisOt.mjs.map +1 -0
  39. package/dist/wake.mjs +2 -2
  40. package/dist/wake.mjs.map +1 -1
  41. package/dist/workspace-manifest-CAVYfp66.mjs +8 -0
  42. package/dist/workspace-manifest-CAVYfp66.mjs.map +1 -0
  43. package/dist/workspace-settings.d.mts +1 -1
  44. package/dist/workspace-settings.mjs +8 -6
  45. package/dist/workspace-settings.mjs.map +1 -1
  46. package/package.json +9 -6
  47. package/dist/define-lint-preset-TN74hRYq.mjs.map +0 -1
  48. package/dist/dependencies-C3kCe35Q.mjs.map +0 -1
  49. package/dist/export-subpaths-D6ZLYZGy.mjs +0 -17
  50. package/dist/export-subpaths-D6ZLYZGy.mjs.map +0 -1
  51. package/dist/manifest-texts-K650kDy8.mjs.map +0 -1
  52. package/dist/pass-records-kbx5VgwI.mjs.map +0 -1
  53. package/dist/published-CpfXkChq.mjs.map +0 -1
  54. package/dist/runtime-1exMm81b.mjs +0 -45
  55. package/dist/runtime-1exMm81b.mjs.map +0 -1
  56. package/dist/workspace-manifest-BC-1cRIJ.mjs +0 -20
  57. package/dist/workspace-manifest-BC-1cRIJ.mjs.map +0 -1
package/dist/cli.mjs CHANGED
@@ -1,29 +1,31 @@
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-CpfXkChq.mjs";
3
- import { t as workspaceManifest } from "./workspace-manifest-BC-1cRIJ.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-kbx5VgwI.mjs";
2
+ import { t as workspaceManifest } from "./workspace-manifest-CAVYfp66.mjs";
3
+ 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-DylVXWk1.mjs";
5
4
  import { a as groupOf, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-C2gVviac.mjs";
6
5
  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-Clnl4-G5.mjs";
7
6
  import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
8
- import { a as publishedProjects, c as workspaceProjects, o as unmatchedWorkspacePatterns, r as readManifest, s as workspaceDirectories, t as MANIFEST_FILE$3 } from "./dependencies-C3kCe35Q.mjs";
7
+ import { a as unmatchedWorkspacePatterns, i as publishedProjects, n as readManifest, o as workspaceDirectories, s as workspaceProjects } from "./dependencies-BAjtDvY4.mjs";
9
8
  import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-Ciud2WGj.mjs";
9
+ import { A as keyName, D as workspaceConfigOf, M as nestedValues, N as propertyValue, O as KeySchema, P as stringsIn, _ as VERIFY_TASK, a as entryNameOf, d as deployEntries, g as RUN_TASKS, i as publishedWorkspaces, j as literalOf, k as childrenOf$1, l as workspaceLinks, o as isBinEntry, p as shadcnUiOf, r as packedWorkspaces, s as publicEntriesOf, u as bundledEntries, v as definesTask, y as hasVerifyTask } from "./published-Bj0gR5IF.mjs";
10
10
  import { t as JAPANESE } from "./config-CvPuqi4L.mjs";
11
11
  import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
12
12
  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-Dx4HQIK-.mjs";
13
- import { a as fieldsOf, c as namedCatalogsOf, d as specifiedIn, i as decodeManifest$9, l as offsetIn$1, n as baseName$1, o as manifestPattern, r as baseRevision, s as manifestSpecifiers, t as manifestTexts, u as quoted$2 } from "./manifest-texts-K650kDy8.mjs";
14
- import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-1exMm81b.mjs";
13
+ import { a as manifestPattern, c as offsetIn$1, i as fieldsOf, l as quoted$2, n as baseName$1, o as manifestSpecifiers, r as baseRevision, s as namedCatalogsOf, t as manifestTexts, u as specifiedIn } from "./manifest-texts-CfnH7ifu.mjs";
14
+ import { n as writeStdout, t as ProblemsFound } from "./output-DrM4OsOJ.mjs";
15
+ import { t as runCli } from "./runtime-Q9CzisOt.mjs";
15
16
  import "./cli-contract-D7btWrEu.mjs";
16
17
  import { builtinModules } from "node:module";
17
18
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
18
19
  import { Array, Boolean as Boolean$1, Context, Effect, FileSystem, HashMap, HashSet, Match, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
19
- import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
20
+ import { lockedGraph, lockedPackageIds, parseDependencyPath, updateWorkspaceManifest } from "@r_masseater/kestrion/pnpm";
20
21
  import { ChildProcess } from "effect/process";
21
22
  import { parse, resolveConfigFromFile } from "vite-plus";
22
- import { parse as parse$1 } from "@pnpm/deps.path";
23
+ import { DEPENDENCY_SECTIONS, PACKAGE_JSON_FILE, binEntriesOf, namesIn, optionalPeerNames, runtimeDependencyNames, targetsIn } from "@r_masseater/kestrion";
24
+ import { decodePackageJson, decodeVersionedPackageJson } from "@r_masseater/kestrion/npm";
23
25
  import { fileURLToPath } from "node:url";
24
26
  import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
25
- import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
26
- import { rolldown } from "vite/rolldown";
27
+ import { isMap, isPair, isScalar, isSeq, parse as parse$1, parseDocument, visit } from "yaml";
28
+ import { rolldown } from "rolldown";
27
29
  import { stripVTControlCharacters } from "node:util";
28
30
  import semver from "semver";
29
31
  import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
@@ -32,8 +34,9 @@ import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4"
32
34
  import { isComment, isTag, isText } from "domhandler";
33
35
  import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
34
36
  import { DockerfileParser } from "dockerfile-ast";
35
- import { parse as parse$3 } from "sql-parser-cst";
37
+ import { parse as parse$2 } from "sql-parser-cst";
36
38
  import { findSkillFiles } from "@tanstack/intent";
39
+ import { findPackageJson } from "@r_masseater/kestrion/node";
37
40
  // src/entities/workspace/model/run-tasks.ts
38
41
  const TaskProperty = Schema.Struct({
39
42
  type: Schema.Literal("Property"),
@@ -439,7 +442,7 @@ const copyFiles = Effect.fn("copyFiles")(function* copyFiles(workspace, director
439
442
  discard: true
440
443
  });
441
444
  });
442
- const depPathsIn = (directory, override) => lockedPackages(directory).pipe(Effect.mapBoth({
445
+ const depPathsIn = (directory, override) => lockedPackageIds(directory).pipe(Effect.mapBoth({
443
446
  onSuccess: Option.getOrElse(() => []),
444
447
  onFailure: ({ reason }) => OverrideResolutionFailed.make({
445
448
  override,
@@ -449,13 +452,10 @@ const depPathsIn = (directory, override) => lockedPackages(directory).pipe(Effec
449
452
  const resolutionWith = Effect.fn("resolutionWith")(function* resolutionWith(workspace, override, overrides) {
450
453
  const directory = yield* (yield* FileSystem.FileSystem).makeTempDirectoryScoped({ prefix: "msch-overrides-" });
451
454
  yield* copyFiles(workspace, directory);
452
- yield* Effect.tryPromise({
453
- try: () => updateWorkspaceManifest(directory, { updatedFields: { overrides: { ...overrides } } }),
454
- catch: (cause) => OverrideResolutionFailed.make({
455
- override,
456
- output: String(cause)
457
- })
458
- });
455
+ yield* updateWorkspaceManifest(directory, { overrides: { ...overrides } }).pipe(Effect.mapError(({ reason }) => OverrideResolutionFailed.make({
456
+ override,
457
+ output: reason
458
+ })));
459
459
  const output = yield* resolveIn(directory, override);
460
460
  const depPaths = yield* depPathsIn(directory, override);
461
461
  yield* Effect.annotateCurrentSpan({ "msch.override": override });
@@ -618,33 +618,6 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
618
618
  const overrides = yield* scanText(pipe(listed, Array.filter(({ name }) => NPMRC.test(name))), npmrcProblems);
619
619
  return [...yield* checkWorkspace(root), ...overrides];
620
620
  });
621
- // src/entities/package/model/stack-catalog.ts
622
- const STACK_CATALOG = "catalog:stack";
623
- // src/entities/package/model/published-manifest.ts
624
- const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
625
- const PublishedManifestSchema = Schema.Struct({
626
- name: Schema.optional(Schema.String),
627
- private: Schema.optional(Schema.Boolean),
628
- publishConfig: Schema.optional(Schema.Unknown),
629
- homepage: Schema.optional(Schema.Unknown),
630
- repository: Schema.optional(Schema.Unknown)
631
- });
632
- const decodePublishedManifest = Schema.decodeUnknownOption(Schema.fromJsonString(PublishedManifestSchema));
633
- const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
634
- const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePublishedManifest), Option.filter(isPublished$1));
635
- /** @internal */
636
- const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
637
- const files = yield* RepositoryFiles;
638
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$8]);
639
- return yield* scanText(pipe(manifests, Array.map((name) => ({
640
- name,
641
- file: files.join(root, name)
642
- }))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
643
- entry,
644
- source,
645
- manifest
646
- })), Option.getOrElse(() => [])));
647
- });
648
621
  // src/features/check-placement/model/colocated-git-patterns.ts
649
622
  const RULE$63 = "colocated-git-patterns";
650
623
  const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
@@ -708,7 +681,7 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
708
681
  const files = yield* RepositoryFiles;
709
682
  const leading = Array.take(segments, depth);
710
683
  if (Array.contains(leading, ANY_DEPTH)) return [];
711
- const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, "/")}/${MANIFEST_FILE$3}`]);
684
+ const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, "/")}/${PACKAGE_JSON_FILE}`]);
712
685
  return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
713
686
  });
714
687
  const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
@@ -755,11 +728,30 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
755
728
  const repeatedFound = pipe(entries, Array.map(repeated(entries)));
756
729
  return Array.getSomes([...misplacedFound, ...repeatedFound]);
757
730
  });
731
+ // src/entities/package/model/stack-catalog.ts
732
+ const STACK_CATALOG = "catalog:stack";
733
+ // src/entities/package/model/published-manifest.ts
734
+ const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
735
+ const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
736
+ const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePackageJson), Option.filter(isPublished$1));
737
+ /** @internal */
738
+ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
739
+ const files = yield* RepositoryFiles;
740
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$8]);
741
+ return yield* scanText(pipe(manifests, Array.map((name) => ({
742
+ name,
743
+ file: files.join(root, name)
744
+ }))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
745
+ entry,
746
+ source,
747
+ manifest
748
+ })), Option.getOrElse(() => [])));
749
+ });
758
750
  // src/features/check-placement/model/colocated-tests.ts
759
751
  const RULE$62 = "colocated-test";
760
752
  const FIRST$21 = 1;
761
753
  const READ_CONCURRENCY$33 = 64;
762
- const ROOT_SUBPATH = ".";
754
+ const ROOT_SUBPATH$1 = ".";
763
755
  const NAME_GROUP = "name";
764
756
  const SPECIFIER_GROUP = "specifier";
765
757
  const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
@@ -774,11 +766,6 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
774
766
  const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
775
767
  const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
776
768
  const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
777
- const Manifest$7 = Schema.Struct({
778
- name: Schema.optional(Schema.String),
779
- exports: Schema.optional(Schema.Unknown)
780
- });
781
- const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
782
769
  const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
783
770
  const problemFor$9 = (test, message) => ({
784
771
  file: test.file,
@@ -797,14 +784,14 @@ const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Op
797
784
  manifest,
798
785
  join,
799
786
  packEntries: []
800
- }), Array.filter(({ source }) => dirname(source) === directory), Array.map(({ label }) => String$1.replace(ROOT_SUBPATH, name)(label)))), Option.getOrElse(() => []));
787
+ }), Array.filter(({ source }) => dirname(source) === directory), Array.map(({ label }) => String$1.replace(ROOT_SUBPATH$1, name)(label)))), Option.getOrElse(() => []));
801
788
  const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context, test) {
802
789
  const files = yield* RepositoryFiles;
803
790
  const owner = ownerOf$5(context.packages, test.name);
804
791
  if (Option.isNone(owner)) return [];
805
- const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
792
+ const text = yield* files.readFile(files.join(context.root, owner.value, PACKAGE_JSON_FILE));
806
793
  const join = (target) => files.join(context.root, owner.value, target);
807
- return pipe(text, Option.flatMap(decodeManifest$8), Option.map(specifiersBeside({
794
+ return pipe(text, Option.flatMap(decodePackageJson), Option.map(specifiersBeside({
808
795
  join,
809
796
  dirname: files.dirname,
810
797
  directory: test.directory
@@ -836,7 +823,7 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
836
823
  const names = pipe(listed, Array.filter(String$1.isNonEmpty));
837
824
  const context = {
838
825
  root,
839
- packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE$3), Array.map(String$1.replace(MANIFEST_NAME, "")))
826
+ packages: pipe(names, Array.filter((name) => files.basename(name) === PACKAGE_JSON_FILE), Array.map(String$1.replace(MANIFEST_NAME, "")))
840
827
  };
841
828
  const tests = pipe(names, Array.filter((name) => SCRIPT$2.test(name)), Array.map((name) => {
842
829
  const file = files.join(root, name);
@@ -1055,7 +1042,7 @@ const READ_CONCURRENCY$28 = 64;
1055
1042
  const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
1056
1043
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
1057
1044
  const README = /^README(?:\.[^/]+)?$/iu;
1058
- const MANIFEST$5 = "package.json";
1045
+ const MANIFEST$3 = "package.json";
1059
1046
  const MISSING_RULE = "workspace-agents-md";
1060
1047
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
1061
1048
  const taggedError$6 = Schema.TaggedError;
@@ -1075,7 +1062,7 @@ const readmeProblem = ({ file, base, directory }, allowed) => {
1075
1062
  if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
1076
1063
  return Option.some(problemFor$7(file, `${base} ${README_MESSAGE}`));
1077
1064
  };
1078
- const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$5), MISSING_MESSAGE$1)));
1065
+ const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$3), MISSING_MESSAGE$1)));
1079
1066
  const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
1080
1067
  const files = yield* RepositoryFiles;
1081
1068
  const file = files.join(root, name);
@@ -1151,7 +1138,6 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
1151
1138
  });
1152
1139
  // src/features/check-placement/model/published-tests.ts
1153
1140
  const RULE$55 = "published-tests";
1154
- const MANIFEST_FILE$2 = "package.json";
1155
1141
  const FILE_START = 1;
1156
1142
  const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
1157
1143
  const MESSAGE$16 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
@@ -1162,7 +1148,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
1162
1148
  const prefix = `${absolute}/`;
1163
1149
  if (testedIn(listed)(prefix)) return Option.none();
1164
1150
  return Option.some({
1165
- file: files.join(absolute, MANIFEST_FILE$2),
1151
+ file: files.join(absolute, PACKAGE_JSON_FILE),
1166
1152
  line: FILE_START,
1167
1153
  column: FILE_START,
1168
1154
  rule: RULE$55,
@@ -1357,13 +1343,12 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
1357
1343
  const ENTRY_RULE$3 = "public-entry";
1358
1344
  const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
1359
1345
  const ENTRY_MESSAGE$2 = "is a package entry that points inside a slice. Point exports and bin at bin/<name>.ts, src/app/<entry>.ts or a slice's index.ts.";
1360
- const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
1361
1346
  const entryProblems$2 = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
1362
1347
  const files = yield* RepositoryFiles;
1363
1348
  const directory = files.join(root, workspace);
1364
- const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
1349
+ const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
1365
1350
  const join = (target) => files.join(directory, target);
1366
- return pipe(text, Option.flatMap(decodeEntryManifest), Option.map((manifest) => publicEntriesOf({
1351
+ return pipe(text, Option.flatMap(decodePackageJson), Option.map((manifest) => publicEntriesOf({
1367
1352
  manifest,
1368
1353
  join,
1369
1354
  packEntries: []
@@ -1390,7 +1375,7 @@ const LAYERS = [
1390
1375
  ];
1391
1376
  const RUST_FILE = /\.rs$/u;
1392
1377
  const BINARY = /^src\/bin\/[^/]+\.rs$/u;
1393
- const MANIFEST$4 = /(?:^|\/)Cargo\.toml$/u;
1378
+ const MANIFEST$2 = /(?:^|\/)Cargo\.toml$/u;
1394
1379
  const MODULE_INDEX = "mod";
1395
1380
  const CRATE_ROOTS = ["src/lib.rs", "src/main.rs"];
1396
1381
  const OUTSIDE_ALLOWED = /^(?:build\.rs|benches\/.+)$/u;
@@ -1406,7 +1391,7 @@ const LAYER_DEPTH = 1;
1406
1391
  const SOURCE_PREFIX$1 = `src/`;
1407
1392
  const ROOT_CRATE = "";
1408
1393
  const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
1409
- const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$4.test(name)), Array.map((name) => String$1.replace(MANIFEST$4, "")(name)));
1394
+ const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$2.test(name)), Array.map((name) => String$1.replace(MANIFEST$2, "")(name)));
1410
1395
  const ownedBy = (crate, name) => {
1411
1396
  if (crate === ROOT_CRATE) return {
1412
1397
  crate,
@@ -10099,8 +10084,6 @@ const SOURCE_ALIAS = "#/*";
10099
10084
  const SOURCE_TARGET = "./src/*";
10100
10085
  const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
10101
10086
  const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
10102
- const Manifest$6 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
10103
- const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
10104
10087
  const targetsOf = (target) => {
10105
10088
  if (Predicate.isString(target)) return [target];
10106
10089
  if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
@@ -10109,9 +10092,9 @@ const targetsOf = (target) => {
10109
10092
  const intoSource = ([key, target]) => !(key === SOURCE_ALIAS && pipe(targetsOf(target), Array.every((path) => path === SOURCE_TARGET))) && pipe(targetsOf(target), Array.some((path) => SOURCE_PREFIX.test(path)));
10110
10093
  const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
10111
10094
  const files = yield* RepositoryFiles;
10112
- const manifest = files.join(root, workspace, MANIFEST_FILE$3);
10095
+ const manifest = files.join(root, workspace, PACKAGE_JSON_FILE);
10113
10096
  const text = yield* files.readFile(manifest);
10114
- return pipe(text, Option.flatMap(decodeManifest$7), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
10097
+ return pipe(text, Option.flatMap(decodePackageJson), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
10115
10098
  });
10116
10099
  /** @internal */
10117
10100
  const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
@@ -10149,12 +10132,6 @@ const FIRST$13 = 1;
10149
10132
  const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
10150
10133
  const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
10151
10134
  const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
10152
- const Manifest$5 = Schema.Struct({
10153
- bin: Schema.optional(Schema.Unknown),
10154
- main: Schema.optional(Schema.Unknown),
10155
- exports: Schema.optional(Schema.Unknown)
10156
- });
10157
- const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
10158
10135
  const NO_ENTRIES = {
10159
10136
  all: [],
10160
10137
  bins: []
@@ -10178,8 +10155,8 @@ const entriesOf$2 = (manifest) => {
10178
10155
  };
10179
10156
  const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
10180
10157
  const files = yield* RepositoryFiles;
10181
- const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
10182
- return pipe(text, Option.flatMap(decodeManifest$6), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
10158
+ const text = yield* files.readFile(files.join(root, directory, PACKAGE_JSON_FILE));
10159
+ return pipe(text, Option.flatMap(decodePackageJson), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
10183
10160
  });
10184
10161
  const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
10185
10162
  const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
@@ -10421,14 +10398,12 @@ const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPath
10421
10398
  // src/features/check-repository-layout/model/crates.ts
10422
10399
  const RULE$48 = "unverified-crate";
10423
10400
  const VERSION_RULE = "release-version";
10424
- const MANIFEST_FILE$1 = "package.json";
10425
10401
  const APP_DIRECTORIES = ["", "src-tauri"];
10426
10402
  const CARGO_FILE$1 = "Cargo.toml";
10427
10403
  const CONFIG_FILE$6 = "vite.config.ts";
10428
10404
  const SEPARATOR$12 = "/";
10429
10405
  const FIRST$11 = 1;
10430
10406
  const READ_CONCURRENCY$21 = 8;
10431
- const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
10432
10407
  const problemFor$4 = (crate, message) => ({
10433
10408
  file: crate.manifest,
10434
10409
  line: FIRST$11,
@@ -10448,15 +10423,15 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
10448
10423
  const directory = files.relative(root, files.dirname(crate.manifest));
10449
10424
  const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$12))), Array.contains(directory))));
10450
10425
  if (Option.isNone(workspace)) return Option.none();
10451
- const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE$1));
10452
- const version = pipe(text, Option.flatMap(Schema.decodeOption(PackageVersion)), Option.map((manifest) => manifest.version));
10426
+ const text = yield* files.readFile(files.join(root, workspace.value, PACKAGE_JSON_FILE));
10427
+ const version = pipe(text, Option.flatMap(decodePackageJson), Option.flatMap(({ version: own }) => Option.fromUndefinedOr(own)));
10453
10428
  if (Option.isNone(version) || version.value === crate.version) return Option.none();
10454
10429
  return Option.some({
10455
10430
  file: crate.manifest,
10456
10431
  line: FIRST$11,
10457
10432
  column: FIRST$11,
10458
10433
  rule: VERSION_RULE,
10459
- message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE$1} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
10434
+ message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${PACKAGE_JSON_FILE} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
10460
10435
  });
10461
10436
  });
10462
10437
  /** @internal */
@@ -10971,7 +10946,7 @@ const WORD_SEPARATORS = /[-_]/gu;
10971
10946
  const SPACE = " ";
10972
10947
  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.";
10973
10948
  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.`;
10974
- 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))));
10949
+ const keysOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
10975
10950
  const problemAt$5 = ({ file, source }, rule, message) => (offset) => ({
10976
10951
  file,
10977
10952
  ...positionOf(source)(offset),
@@ -10980,7 +10955,7 @@ const problemAt$5 = ({ file, source }, rule, message) => (offset) => ({
10980
10955
  });
10981
10956
  const pathFiltersIn = (file, source) => {
10982
10957
  const root = parseDocument(source).contents;
10983
- const triggers = pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf$1(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
10958
+ const triggers = pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
10984
10959
  const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
10985
10960
  return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$5({
10986
10961
  file,
@@ -10990,7 +10965,7 @@ const pathFiltersIn = (file, source) => {
10990
10965
  const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ names }) => Array.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf$1(names))(text))), Option.map(({ directory }) => directory));
10991
10966
  const named$1 = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
10992
10967
  const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$8}`)(path)), Option.map(({ directory }) => directory));
10993
- const namesIn$1 = (name, source) => {
10968
+ const namesIn$2 = (name, source) => {
10994
10969
  const root = parseDocument(source).contents;
10995
10970
  return [
10996
10971
  {
@@ -10998,7 +10973,7 @@ const namesIn$1 = (name, source) => {
10998
10973
  offset: START$22
10999
10974
  },
11000
10975
  ...Option.toArray(stringOf(childOf("name")(root))),
11001
- ...keysOf$1(childOf("jobs")(root))
10976
+ ...keysOf(childOf("jobs")(root))
11002
10977
  ];
11003
10978
  };
11004
10979
  const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, offset }) => pipe(Array.fromIterable(String$1.matchAll(PACKAGE_FILTER)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap((groups) => Option.fromNullishOr(groups["value"])), Option.toArray)), Array.map((value) => ({
@@ -11011,7 +10986,7 @@ const packagesIn = (workspaces, { file, name, source }) => {
11011
10986
  file,
11012
10987
  source
11013
10988
  };
11014
- const fromNames = pipe(namesIn$1(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
10989
+ const fromNames = pipe(namesIn$2(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
11015
10990
  const referenced = pipe(workflowReferences(source), Array.filter(({ field }) => !String$1.startsWith("on.")(field)), Array.flatMap(({ field, path, offset }) => reported(where, offset, field)(containing(workspaces, path))));
11016
10991
  const filtered = pipe(filtersIn(source), Array.flatMap(({ text, offset }) => reported(where, offset, `--filter ${text}`)(matching(workspaces, text))));
11017
10992
  return [
@@ -11064,9 +11039,6 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
11064
11039
  ], { concurrency: "unbounded" });
11065
11040
  return Array.flatten(found);
11066
11041
  });
11067
- // src/shared/lib/keys.ts
11068
- /** @internal */
11069
- const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
11070
11042
  // src/shared/lib/package-name.ts
11071
11043
  const SCOPE$2 = "@";
11072
11044
  const SEPARATOR$7 = "/";
@@ -11087,8 +11059,7 @@ const SOURCE_SUFFIXES = [
11087
11059
  ".tsx",
11088
11060
  "/index.ts"
11089
11061
  ];
11090
- const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
11091
- const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
11062
+ const isImportMap = Schema.is(Schema.Record(Schema.String, Schema.String));
11092
11063
  const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
11093
11064
  const runtimeSpecifierOf = (statement) => {
11094
11065
  if (isImportDeclaration(statement)) {
@@ -11159,11 +11130,11 @@ const packagesFrom = (graph, walk) => Array.match(walk.pending, {
11159
11130
  /** @internal */
11160
11131
  const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(api, directory, entries) {
11161
11132
  const files = yield* RepositoryFiles;
11162
- const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
11133
+ const manifest = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
11163
11134
  const graph = {
11164
11135
  api,
11165
11136
  directory,
11166
- imports: pipe(manifest, Option.flatMap(decodeImports), Option.flatMap((field) => Option.fromUndefinedOr(field.imports)), Option.getOrElse(() => ({})))
11137
+ imports: pipe(manifest, Option.flatMap(decodePackageJson), Option.flatMap((found) => Option.liftPredicate(found.imports, isImportMap)), Option.getOrElse(() => ({})))
11167
11138
  };
11168
11139
  return yield* Effect.forEach(entries, (entry) => packagesFrom(graph, {
11169
11140
  pending: [entry],
@@ -11173,31 +11144,16 @@ const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(a
11173
11144
  });
11174
11145
  // src/features/measure-install-size/model/installed-closure.ts
11175
11146
  const EMPTY$1 = 0;
11176
- const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
11177
- const PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
11178
- const PeerMeta$1 = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
11179
- const InstalledManifest = Schema.Struct({
11180
- dependencies: DependencyMap,
11181
- optionalDependencies: DependencyMap,
11182
- peerDependencies: DependencyMap,
11183
- peerDependenciesMeta: PeerMeta$1
11184
- });
11185
- const decodeManifest$5 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
11186
- const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
11187
- const installedNames = (manifest) => [
11188
- ...keysOf(manifest.dependencies),
11189
- ...keysOf(manifest.optionalDependencies),
11190
- ...pipe(keysOf(manifest.peerDependencies), Array.filter((name) => !isOptionalPeer(manifest, name)))
11191
- ];
11147
+ const installedNames = (manifest) => [...namesIn(manifest, ["dependencies", "optionalDependencies"]), ...pipe(namesIn(manifest, ["peerDependencies"]), Array.difference(optionalPeerNames(manifest)))];
11192
11148
  const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
11193
11149
  const files = yield* RepositoryFiles;
11194
- const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
11195
- return pipe(text, Option.flatMap(decodeManifest$5), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
11150
+ const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
11151
+ return pipe(text, Option.flatMap(decodePackageJson), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
11196
11152
  });
11197
11153
  const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
11198
11154
  const files = yield* RepositoryFiles;
11199
11155
  const candidate = files.join(from, NODE_MODULES, name);
11200
- if (yield* files.exists(files.join(candidate, "package.json"))) {
11156
+ if (yield* files.exists(files.join(candidate, PACKAGE_JSON_FILE))) {
11201
11157
  const real = yield* files.realPath(candidate);
11202
11158
  return Option.some(real);
11203
11159
  }
@@ -11325,16 +11281,9 @@ const stackProblems = (file, source, dependencies) => {
11325
11281
  message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
11326
11282
  })));
11327
11283
  };
11328
- const PublishedManifest = Schema.Struct({
11329
- name: Schema.optional(Schema.String),
11330
- dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),
11331
- peerDependencies: Schema.optional(Schema.Record(Schema.String, Schema.String)),
11332
- exports: Schema.optional(Schema.Unknown),
11333
- bin: Schema.optional(Schema.Unknown)
11334
- });
11335
11284
  const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, file, source) {
11336
11285
  const files = yield* RepositoryFiles;
11337
- const manifest = Schema.decodeOption(Schema.fromJsonString(PublishedManifest))(source);
11286
+ const manifest = decodePackageJson(source);
11338
11287
  if (Option.isNone(manifest)) return [];
11339
11288
  const dependencies = Option.getOrElse(Option.fromUndefinedOr(manifest.value.dependencies), () => ({}));
11340
11289
  const entries = publicEntriesOf({
@@ -11342,7 +11291,7 @@ const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
11342
11291
  join: (target) => files.join(workspace.directory, target),
11343
11292
  packEntries: workspace.packEntries
11344
11293
  });
11345
- const provided = HashSet.fromIterable(keysOf(manifest.value.peerDependencies));
11294
+ const provided = HashSet.fromIterable(namesIn(manifest.value, ["peerDependencies"]));
11346
11295
  const sized = yield* sizeProblems({
11347
11296
  workspace,
11348
11297
  entries,
@@ -11352,7 +11301,7 @@ const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
11352
11301
  });
11353
11302
  const workspaceProblems$1 = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
11354
11303
  const files = yield* RepositoryFiles;
11355
- const file = files.join(workspace.directory, MANIFEST_FILE$3);
11304
+ const file = files.join(workspace.directory, PACKAGE_JSON_FILE);
11356
11305
  const source = yield* files.readFile(file);
11357
11306
  return yield* Option.match(source, {
11358
11307
  onNone: () => Effect.succeed([]),
@@ -11455,28 +11404,6 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
11455
11404
  return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
11456
11405
  });
11457
11406
  // src/features/check-tree-shaking/model/manifest.ts
11458
- const Versions = Schema.Record(Schema.String, Schema.String);
11459
- const PeerMeta = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
11460
- const Manifest$4 = Schema.Struct({
11461
- name: Schema.optional(Schema.String),
11462
- exports: Schema.optional(Schema.Unknown),
11463
- bin: Schema.optional(Schema.Unknown),
11464
- sideEffects: Schema.optional(Schema.Unknown),
11465
- dependencies: Schema.optional(Versions),
11466
- devDependencies: Schema.optional(Versions),
11467
- peerDependencies: Schema.optional(Versions),
11468
- optionalDependencies: Schema.optional(Versions),
11469
- peerDependenciesMeta: Schema.optional(Schema.Record(Schema.String, PeerMeta))
11470
- });
11471
- const runtimeDependenciesOf = ({ dependencies, peerDependencies, optionalDependencies }) => pipe([
11472
- dependencies,
11473
- peerDependencies,
11474
- optionalDependencies
11475
- ], Array.flatMap(keysOf), Array.dedupe);
11476
- const optionalPeersOf = ({ peerDependenciesMeta }) => pipe(Option.fromUndefinedOr(peerDependenciesMeta), Option.map(Record.filter(({ optional }) => optional === true)), Option.map(Record.keys), Option.getOrElse(() => []));
11477
- const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
11478
- const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$4));
11479
- const manifestOf$1 = (text) => decode(text);
11480
11407
  const isFileList = Schema.is(Schema.Array(Schema.String));
11481
11408
  const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
11482
11409
  const listedSources = (declared, { workspace, join }) => new Set(pipe(declared, Array.flatMap((target) => Array.append(sourcesOf$1(workspace, target), join(target)))));
@@ -11501,6 +11428,21 @@ const declaredBy$1 = ({ declared, locator }) => {
11501
11428
  claimed: true
11502
11429
  };
11503
11430
  };
11431
+ const locatedManifest = Effect.fn("locatedManifest")(function* locatedManifest(workspace) {
11432
+ const files = yield* RepositoryFiles;
11433
+ const file = files.join(workspace.directory, PACKAGE_JSON_FILE);
11434
+ const text = yield* files.readFile(file);
11435
+ return pipe(text, Option.flatMap((source) => pipe(decodePackageJson(source), Option.map((manifest) => ({
11436
+ file,
11437
+ source,
11438
+ manifest
11439
+ })))));
11440
+ });
11441
+ const bundleScopeOf = ({ manifest, workspace }) => ({
11442
+ declared: runtimeDependencyNames(manifest),
11443
+ bundled: workspace.alwaysBundle
11444
+ });
11445
+ const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
11504
11446
  // src/features/check-tree-shaking/model/optional-peers.ts
11505
11447
  const RULE$40 = "optional-peer";
11506
11448
  const REQUIRED_RULE = "required-peer";
@@ -11525,22 +11467,24 @@ const requiredPeerAdvice = (fromStack) => {
11525
11467
  if (fromStack) return "Make it a required peer by removing it from peerDependenciesMeta; it comes from the stack catalog, so every project that installs this package already has it.";
11526
11468
  return "Make it a required peer by removing it from peerDependenciesMeta when every project that installs this package already has it, or move it to dependencies, which count toward msch.publish.installSize.";
11527
11469
  };
11528
- const optionalPeerProblems = ({ located, dependencies, used }) => {
11529
- const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
11470
+ const librariesIn = (used) => pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
11471
+ const optionalPeerProblems = ({ located, manifest, used }) => {
11472
+ const libraries = librariesIn(used);
11530
11473
  const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
11531
11474
  if (libraries.length <= SINGLE) return [];
11532
- return pipe(keysOf(dependencies), Array.flatMap((name) => {
11475
+ return pipe(Record.keys(manifest.dependencies ?? {}), Array.flatMap((name) => {
11533
11476
  const importers = pipe(libraries, Array.filter(importsPackage(name)));
11534
11477
  const neededByBin = pipe(bins, Array.some(importsPackage(name)));
11535
11478
  if (!(importers.length > START$20 && importers.length < libraries.length) || neededByBin) return [];
11536
11479
  return [problemFor$3(located, name, importers)];
11537
11480
  }));
11538
11481
  };
11539
- const requiredPeerProblems = ({ located, optional, stack, used }) => {
11540
- const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
11541
- return pipe(optional, Array.flatMap((name) => {
11482
+ const requiredPeerProblems = ({ located, manifest, used }) => {
11483
+ const libraries = librariesIn(used);
11484
+ const stack = stackPackagesOf(manifest);
11485
+ return pipe(optionalPeerNames(manifest), Array.flatMap((name) => {
11542
11486
  const bins = pipe(used, Array.filter((entry) => isBinEntry(entry.entry) && importsPackage(name)(entry)));
11543
- const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array.isArrayNonEmpty(all) && pipe(all, Array.every(importsPackage(name)))), Option.getOrElse(() => []));
11487
+ const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array.isReadonlyArrayNonEmpty(all) && pipe(all, Array.every(importsPackage(name)))), Option.getOrElse(() => []));
11544
11488
  const importers = Array.appendAll(bins, everyLibrary);
11545
11489
  if (!Array.isArrayNonEmpty(importers)) return [];
11546
11490
  return [{
@@ -11675,10 +11619,10 @@ const shapeOf = Effect.fn("shapeOf")(function* shapeOf({ workspace, manifest })
11675
11619
  packEntries: workspace.packEntries
11676
11620
  }), Array.dedupeWith((left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right)));
11677
11621
  return {
11678
- scope: {
11679
- declared: runtimeDependenciesOf(manifest),
11680
- bundled: workspace.alwaysBundle
11681
- },
11622
+ scope: bundleScopeOf({
11623
+ manifest,
11624
+ workspace
11625
+ }),
11682
11626
  declared: declaredBy$1({
11683
11627
  declared: manifest.sideEffects,
11684
11628
  locator: {
@@ -11721,33 +11665,29 @@ const analyse = Effect.fn("analyse")(function* analyse(pack) {
11721
11665
  ...effects,
11722
11666
  ...optionalPeerProblems({
11723
11667
  located,
11724
- dependencies: manifest.dependencies,
11668
+ manifest,
11725
11669
  used
11726
11670
  }),
11727
11671
  ...requiredPeerProblems({
11728
11672
  located,
11729
- optional: optionalPeersOf(manifest),
11730
- stack: stackPackagesOf(manifest),
11673
+ manifest,
11731
11674
  used
11732
11675
  })
11733
11676
  ];
11734
11677
  });
11735
11678
  const bundleProblem$1 = (file, error) => [problemInFile(BUNDLE)(file, `does not bundle for the tree-shaking check. ${error.detail}`)];
11736
11679
  const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(root, workspace) {
11737
- const files = yield* RepositoryFiles;
11738
- const file = files.join(workspace.directory, MANIFEST_FILE$3);
11739
- const source = yield* files.readFile(file);
11740
- const manifest = pipe(source, Option.flatMap(manifestOf$1));
11741
- if (Option.isNone(source) || Option.isNone(manifest)) return [];
11742
- const located = {
11743
- file,
11744
- source: source.value
11745
- };
11680
+ const found = yield* locatedManifest(workspace);
11681
+ if (Option.isNone(found)) return [];
11682
+ const { file, source, manifest } = found.value;
11746
11683
  return yield* analyse({
11747
11684
  root,
11748
11685
  workspace,
11749
- located,
11750
- manifest: manifest.value
11686
+ located: {
11687
+ file,
11688
+ source
11689
+ },
11690
+ manifest
11751
11691
  }).pipe(Effect.catchTag("BundleFailed", (error) => Effect.succeed(bundleProblem$1(file, error))));
11752
11692
  });
11753
11693
  /** @internal */
@@ -11764,7 +11704,7 @@ const CURRENT_MAJOR = 7;
11764
11704
  const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
11765
11705
  const FIRST$7 = 1;
11766
11706
  const legacyOf = (id) => {
11767
- const { name, version } = parse$1(id);
11707
+ const { name, version } = parseDependencyPath(id);
11768
11708
  const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
11769
11709
  return pipe(Option.fromNullishOr(name), Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? "")), Option.map((found) => ({
11770
11710
  id,
@@ -11964,9 +11904,9 @@ const outsideTypeIn = (project) => {
11964
11904
  const isGlobalType = (name) => pipe(Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)), Option.map(declarationsOf), Option.exists((declarations) => declaresAType(declarations) && !carriesTag(name)(declarations) && pipe(declarations, Array.every(isOutside))));
11965
11905
  return (name) => known.getOrInsertComputed(name, () => IDENTIFIER.test(name) && !HashSet.has(values, name) && (HashSet.has(exported, name) || isGlobalType(name)));
11966
11906
  };
11967
- const namesIn = (list) => pipe(list.elements, Array.filter(isStringLiteral), Array.map((element) => element.text));
11907
+ const namesIn$1 = (list) => pipe(list.elements, Array.filter(isStringLiteral), Array.map((element) => element.text));
11968
11908
  const problemIn$1 = (isOutsideType) => (list) => {
11969
- const names = namesIn(list);
11909
+ const names = namesIn$1(list);
11970
11910
  const outside = pipe(names, Array.filter(isOutsideType));
11971
11911
  if (outside.length < Math.max(2, names.length / HALF)) return Option.none();
11972
11912
  return Option.some(listedProblem({
@@ -12620,21 +12560,18 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
12620
12560
  return pipe(lists, Array.map((list) => Array.findFirst(checks, (check) => check(list))), Array.getSomes);
12621
12561
  };
12622
12562
  // src/features/check-value-owners/model/repository-names.ts
12623
- const MANIFEST$3 = "package.json";
12624
12563
  const SEPARATOR$5 = "/";
12625
12564
  const FIRST_SEGMENT = 1;
12626
- const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
12627
- const decodeManifest$4 = Schema.decodeUnknownOption(ManifestJson);
12628
12565
  const prefixesOf = (file) => {
12629
12566
  const segments = pipe(file, String$1.split(SEPARATOR$5));
12630
12567
  return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
12631
12568
  };
12632
12569
  const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
12633
- const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$4), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
12570
+ const nameOf = (text) => pipe(text, Option.flatMap(decodePackageJson), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
12634
12571
  const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
12635
12572
  const files = yield* RepositoryFiles;
12636
12573
  const listed = yield* files.listedFiles(root);
12637
- const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === MANIFEST$3), (items) => Effect.forEach(items, (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)), { concurrency: 1 }));
12574
+ const names = yield* pipe(listed, Array.filter((file) => files.basename(file) === PACKAGE_JSON_FILE), (items) => Effect.forEach(items, (manifest) => files.readFile(files.join(root, manifest)).pipe(Effect.map(nameOf)), { concurrency: 1 }));
12638
12575
  const paths = pipe(listed, Array.flatMap(prefixesOf), Array.dedupe);
12639
12576
  return {
12640
12577
  root,
@@ -13420,7 +13357,7 @@ const ROOT_DIRECTORY$3 = ".";
13420
13357
  const COMMAND_KEY = "command";
13421
13358
  const ARGUMENTS_KEY = "args";
13422
13359
  const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
13423
- const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$4];
13360
+ const MANIFESTS = [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$4];
13424
13361
  const STEP_FILES = [
13425
13362
  ":(glob).github/workflows/*.yml",
13426
13363
  ":(glob).github/workflows/*.yaml",
@@ -13441,13 +13378,11 @@ const FIRST$5 = 1;
13441
13378
  const LINE = "\n";
13442
13379
  const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
13443
13380
  const decodeCommandText = Schema.decodeUnknownOption(CommandText);
13444
- const Scripts = Schema.Struct({ scripts: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
13445
- const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts));
13446
13381
  const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
13447
13382
  const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
13448
13383
  const NO_SOURCES = [];
13449
13384
  const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$15));
13450
- const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
13385
+ const scriptSources = (file) => (source) => pipe(decodePackageJson(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
13451
13386
  const offset = offsetOf$2(source, `"${name}"`);
13452
13387
  return {
13453
13388
  kind: "script",
@@ -13788,7 +13723,7 @@ const yamlComments = commentsFrom("yaml")(yamlSourceComments);
13788
13723
  const tomlComments = commentsFrom("toml")(tomlSourceComments);
13789
13724
  const isSqlComment = (value) => isRecord(value) && (value["type"] === "line_comment" || value["type"] === "block_comment") && typeof value["text"] === "string" && Array.isArray(value["range"]);
13790
13725
  const sqlComments = commentsFrom("sql")((source) => {
13791
- const program = parse$3(source, {
13726
+ const program = parse$2(source, {
13792
13727
  dialect: "sqlite",
13793
13728
  includeComments: true,
13794
13729
  includeRange: true,
@@ -14177,7 +14112,7 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
14177
14112
  const directories = yield* workspaceDirectories(root);
14178
14113
  const installed = yield* pipe(directories, Effect.filter((directory) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => !found))));
14179
14114
  const listed = pipe([ROOT_DIRECTORY$2, ...installed], Array.map((directory) => {
14180
- const name = files.join(directory, MANIFEST_FILE$3);
14115
+ const name = files.join(directory, PACKAGE_JSON_FILE);
14181
14116
  return {
14182
14117
  name,
14183
14118
  file: files.join(root, name)
@@ -14187,7 +14122,7 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
14187
14122
  });
14188
14123
  // src/features/check-catalog-entries/model/catalog-entries.ts
14189
14124
  const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
14190
- const MANIFEST$2 = /(?:^|\/)package\.json$/u;
14125
+ const MANIFEST$1 = /(?:^|\/)package\.json$/u;
14191
14126
  const CATALOG_PROTOCOL = "catalog:";
14192
14127
  const DEFAULT_CATALOG = "default";
14193
14128
  const VERSION_SEPARATOR = "||";
@@ -14209,7 +14144,7 @@ const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf(held)), Array
14209
14144
  const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(namedCatalogsOf(settings), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
14210
14145
  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)));
14211
14146
  const referenceOf$1 = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
14212
- const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf(section), Record.toEntries, Array.flatMap(referenceOf$1))));
14147
+ const referencesIn = (manifest) => pipe([...pipe(DEPENDENCY_SECTIONS, Array.map((section) => manifest[section])), manifest.overrides], Array.flatMap((section) => pipe(fieldsOf(section), Record.toEntries, Array.flatMap(referenceOf$1))));
14213
14148
  const versionsOf = (raw) => pipe(Option.fromUndefinedOr(raw), Option.map((listed) => pipe(String$1.split(listed, VERSION_SEPARATOR), Array.map(String$1.trim))), Option.getOrElse(() => []));
14214
14149
  const hasKeyWith = (keys) => (prefix) => pipe(keys, Array.some(String$1.startsWith(prefix)));
14215
14150
  const isLocked = (keys) => (resolved) => Array.contains(keys, resolved) || hasKeyWith(keys)(`${resolved}(`);
@@ -14222,12 +14157,12 @@ const resolvedIn = (keys) => (entry) => String$1.includes(WILDCARD)(entry) || pi
14222
14157
  onNonEmpty: Array.some(lockedVersion(keys, name))
14223
14158
  })
14224
14159
  }));
14225
- const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() => Option.none()));
14160
+ const lockedKeys = (root) => lockedPackageIds(root).pipe(Effect.orElseSucceed(() => Option.none()));
14226
14161
  const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
14227
14162
  const files = yield* RepositoryFiles;
14228
14163
  const listed = yield* files.listedFiles(root);
14229
- const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$7 });
14230
- const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$9(text))), Array.flatMap(referencesIn));
14164
+ const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$7 });
14165
+ const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodePackageJson(text))), Array.flatMap(referencesIn));
14231
14166
  const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
14232
14167
  return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
14233
14168
  });
@@ -14344,7 +14279,6 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
14344
14279
  const RULE$17 = "published-skills";
14345
14280
  const KEYWORD = "tanstack-intent";
14346
14281
  const SKILLS = "skills";
14347
- const MANIFEST_FILE = "package.json";
14348
14282
  const SKILL_FILE$1 = "SKILL.md";
14349
14283
  const SUCCEEDED = 0;
14350
14284
  const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
@@ -14372,7 +14306,7 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
14372
14306
  const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14373
14307
  const files = yield* RepositoryFiles;
14374
14308
  const directory = files.join(root, project.directory);
14375
- const manifest = files.join(directory, MANIFEST_FILE);
14309
+ const manifest = files.join(directory, PACKAGE_JSON_FILE);
14376
14310
  const skills = skillDirectoriesIn(files, directory);
14377
14311
  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.`)];
14378
14312
  const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
@@ -14414,7 +14348,7 @@ const Frontmatter = Schema.Struct({
14414
14348
  });
14415
14349
  const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
14416
14350
  const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$11));
14417
- const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
14351
+ const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$1(yaml))), Option.flatMap(decodeFrontmatter));
14418
14352
  const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$11].length), Option.getOrElse(() => START$11));
14419
14353
  const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
14420
14354
  const nameProblems = ({ source, directory }, name, folder) => {
@@ -14545,7 +14479,7 @@ const manifestEntries = (text) => {
14545
14479
  };
14546
14480
  const catalogsIn = (settings) => pipe(namedCatalogsOf(settings), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
14547
14481
  const workspaceEntries = (text) => {
14548
- const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf);
14482
+ const settings = Option.liftThrowable(() => parse$1(text))().pipe(Option.getOrUndefined, fieldsOf);
14549
14483
  return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings)];
14550
14484
  };
14551
14485
  const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
@@ -14665,22 +14599,16 @@ const UNVERSIONED = "0.0.0";
14665
14599
  const FIRST_LINE$1 = 1;
14666
14600
  const FIRST_COLUMN$1 = 1;
14667
14601
  const READ_CONCURRENCY$3 = 16;
14668
- const Manifest$3 = Schema.fromJsonString(Schema.Struct({
14669
- name: Schema.String,
14670
- version: Schema.String,
14671
- private: Schema.optional(Schema.Boolean)
14672
- }));
14673
14602
  const LAST_SEGMENT$1 = /[^/]*$/u;
14674
14603
  const directoryOf$1 = (file) => String$1.replace(LAST_SEGMENT$1, "")(file);
14675
- const decodeManifest$3 = Schema.decodeUnknownOption(Manifest$3);
14676
- const packageAt = (file, text) => pipe(decodeManifest$3(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED), Option.map(({ name, version }) => ({
14604
+ const packageAt = (file, text) => pipe(decodeVersionedPackageJson(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED), Option.map(({ name, version }) => ({
14677
14605
  file,
14678
14606
  directory: directoryOf$1(file),
14679
14607
  name,
14680
14608
  version,
14681
14609
  text
14682
14610
  })));
14683
- const versionAt = (name, text) => pipe(text, Option.flatMap(decodeManifest$3), Option.filter((manifest) => manifest.name === name), Option.map(({ version }) => version), Option.filter((version) => semver.valid(version) !== null));
14611
+ const versionAt = (name, text) => pipe(text, Option.flatMap(decodeVersionedPackageJson), Option.filter((manifest) => manifest.name === name), Option.map(({ version }) => version), Option.filter((version) => semver.valid(version) !== null));
14684
14612
  const versionLine = (text) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes("\"version\"")(line)), Option.match({
14685
14613
  onNone: () => FIRST_LINE$1,
14686
14614
  onSome: (index) => index + FIRST_LINE$1
@@ -14730,40 +14658,31 @@ const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
14730
14658
  const NOT_FOUND = -1;
14731
14659
  const SEPARATOR$1 = "/";
14732
14660
  const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
14733
- const BinMap = Schema.Record(Schema.String, Schema.String);
14734
- const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
14735
- const decodeBinField = Schema.decodeUnknownOption(Schema.fromJsonString(BinField));
14736
14661
  const escaped = (text) => String$1.replaceAll(/[.*+?^${}()|[\]\\]/gu, String.raw`\$&`)(text);
14737
- const declaredNames = (manifest) => pipe([
14738
- manifest.dependencies,
14739
- manifest.devDependencies,
14740
- manifest.peerDependencies
14741
- ], Array.flatMap((field) => Record.keys(field ?? {})));
14742
- const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
14743
- onNone: () => [],
14744
- onSome: (bin) => {
14745
- if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
14746
- return Record.keys(bin);
14747
- }
14748
- }));
14749
- const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE$3}`)));
14750
- const installedPackage = Effect.fn("installedPackage")(function* installedPackage(name) {
14662
+ const declaredNames = (manifest) => namesIn(manifest, [
14663
+ "dependencies",
14664
+ "devDependencies",
14665
+ "peerDependencies"
14666
+ ]);
14667
+ const installedManifest = Effect.fn("installedManifest")(function* installedManifest(name) {
14751
14668
  const files = yield* RepositoryFiles;
14752
- const text = yield* pipe(manifestOf(name), Option.match({
14669
+ return yield* pipe(findPackageJson(name, import.meta.url), Option.match({
14753
14670
  onNone: () => Effect.succeed(Option.none()),
14754
- onSome: (file) => files.readFile(file)
14671
+ onSome: (file) => readManifest(files.dirname(file))
14755
14672
  }));
14673
+ });
14674
+ const installedPackage = Effect.fn("installedPackage")(function* installedPackage(name) {
14675
+ const manifest = yield* installedManifest(name);
14756
14676
  return {
14757
14677
  name,
14758
- bins: pipe(text, Option.map((source) => binsIn(name, source)), Option.getOrElse(() => []))
14678
+ bins: pipe(manifest, Option.map((found) => pipe(binEntriesOf({
14679
+ ...found,
14680
+ name
14681
+ }), Array.map(([command]) => command))), Option.getOrElse(() => []))
14759
14682
  };
14760
14683
  });
14761
14684
  const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
14762
- const files = yield* RepositoryFiles;
14763
- const manifest = yield* pipe(manifestOf(MSCH), Option.match({
14764
- onNone: () => Effect.succeed(Option.none()),
14765
- onSome: (file) => readManifest(files.dirname(file))
14766
- }));
14685
+ const manifest = yield* installedManifest(MSCH);
14767
14686
  const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
14768
14687
  return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
14769
14688
  });
@@ -14780,14 +14699,14 @@ const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((dir
14780
14699
  onEmpty: () => "",
14781
14700
  onNonEmpty: Array.max(BY_LENGTH)
14782
14701
  }));
14783
- const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$2;
14702
+ const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith(PACKAGE_JSON_FILE)(entry.name) && entry.name !== WORKSPACE_FILE$2;
14784
14703
  const consumersIn = Effect.fn("consumersIn")(function* consumersIn(root, directories) {
14785
14704
  const files = yield* RepositoryFiles;
14786
14705
  return yield* pipe(directories, Effect.filter((directory) => readManifest(files.join(root, directory)).pipe(Effect.map(Option.exists((manifest) => manifest.name !== MSCH && Array.contains(declaredNames(manifest), MSCH))))));
14787
14706
  });
14788
14707
  const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appliedNames, directory) {
14789
14708
  const files = yield* RepositoryFiles;
14790
- const file = files.join(root, directory, MANIFEST_FILE$3);
14709
+ const file = files.join(root, directory, PACKAGE_JSON_FILE);
14791
14710
  const text = yield* files.readFile(file);
14792
14711
  const manifest = yield* readManifest(files.join(root, directory));
14793
14712
  return pipe(Option.all({
@@ -15194,7 +15113,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
15194
15113
  /** @internal */
15195
15114
  const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
15196
15115
  const files = yield* RepositoryFiles;
15197
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
15116
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$2]);
15198
15117
  const listed = pipe(manifests, Array.map((name) => ({
15199
15118
  name,
15200
15119
  file: files.join(root, name)
@@ -15245,7 +15164,7 @@ const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifest
15245
15164
  });
15246
15165
  /** @internal */
15247
15166
  const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
15248
- const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
15167
+ const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$1]);
15249
15168
  const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
15250
15169
  return Array.flatten(found);
15251
15170
  });
@@ -15318,7 +15237,7 @@ const described = (description) => pipe(Option.fromUndefinedOr(description), Opt
15318
15237
  }));
15319
15238
  const ownerIn = Effect.fn("ownerIn")(function* ownerIn(root) {
15320
15239
  const files = yield* RepositoryFiles;
15321
- const text = yield* files.readFile(files.join(root, MANIFEST_FILE$3));
15240
+ const text = yield* files.readFile(files.join(root, PACKAGE_JSON_FILE));
15322
15241
  return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, description, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
15323
15242
  name: marketplaceName(name),
15324
15243
  owner: ownerOf(found),
@@ -15343,7 +15262,7 @@ const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* che
15343
15262
  const plugins = yield* pluginsIn(root);
15344
15263
  if (!Array.isReadonlyArrayNonEmpty(plugins)) return yield* withoutPlugins(file);
15345
15264
  const header = yield* ownerIn(root);
15346
- if (Option.isNone(header)) return [problem(files.join(root, MANIFEST_FILE$3), `Workspaces ship Claude Code plugins, so ${MARKETPLACE_FILE} lists them. Add "author" to the root ${MANIFEST_FILE$3}; it becomes the marketplace owner.`)];
15265
+ if (Option.isNone(header)) return [problem(files.join(root, PACKAGE_JSON_FILE), `Workspaces ship Claude Code plugins, so ${MARKETPLACE_FILE} lists them. Add "author" to the root ${PACKAGE_JSON_FILE}; it becomes the marketplace owner.`)];
15347
15266
  const text = yield* encodeMarketplace({
15348
15267
  ...header.value,
15349
15268
  plugins
@@ -15404,7 +15323,7 @@ const checkPublishedManifests = Effect.fn("checkPublishedManifests")(function* c
15404
15323
  const RULE$3 = "node-version";
15405
15324
  const MINIMUM = 26;
15406
15325
  const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
15407
- const MANIFEST$1 = /(?:^|\/)package\.json$/u;
15326
+ const MANIFEST = /(?:^|\/)package\.json$/u;
15408
15327
  const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
15409
15328
  const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
15410
15329
  const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
@@ -15417,13 +15336,6 @@ const ALTERNATIVE = "||";
15417
15336
  const ENGINES_KEY = "\"engines\"";
15418
15337
  const START$2 = 0;
15419
15338
  const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
15420
- const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
15421
- const Manifest$2 = Schema.Struct({
15422
- private: Schema.optional(Schema.Boolean),
15423
- publishConfig: Schema.optional(Schema.Unknown),
15424
- engines: Schema.optional(Engines)
15425
- });
15426
- const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
15427
15339
  const majorOf = (found) => pipe(groupOf("major")(found), Option.map(Number));
15428
15340
  const isOld = (major) => major < MINIMUM;
15429
15341
  const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
@@ -15447,7 +15359,7 @@ const rangeProblem = (entry, source) => (range) => problemAt({
15447
15359
  const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
15448
15360
  const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
15449
15361
  const manifestProblems$1 = (entry, source) => {
15450
- const manifest = decodeManifest$2(source);
15362
+ const manifest = decodePackageJson(source);
15451
15363
  if (Option.isNone(manifest)) return [];
15452
15364
  const range = rangeOf(manifest.value);
15453
15365
  if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
@@ -15464,7 +15376,7 @@ const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(
15464
15376
  index: START$2
15465
15377
  }, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
15466
15378
  const problemsIn$1 = (entry, source) => {
15467
- if (MANIFEST$1.test(entry.name)) return manifestProblems$1(entry, source);
15379
+ if (MANIFEST.test(entry.name)) return manifestProblems$1(entry, source);
15468
15380
  if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
15469
15381
  if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
15470
15382
  if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
@@ -15475,7 +15387,7 @@ const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.t
15475
15387
  const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
15476
15388
  const files = yield* RepositoryFiles;
15477
15389
  const listed = yield* listedFiles(root);
15478
- const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED]);
15390
+ const manifests = yield* files.matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED]);
15479
15391
  const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
15480
15392
  name,
15481
15393
  file: files.join(root, name)
@@ -15501,14 +15413,6 @@ const PROGRAM_KINDS = [
15501
15413
  "staticlib",
15502
15414
  "dylib"
15503
15415
  ];
15504
- const Manifest$1 = Schema.Struct({
15505
- name: Schema.optional(Schema.String),
15506
- private: Schema.optional(Schema.Boolean),
15507
- exports: Schema.optional(Schema.Unknown),
15508
- main: Schema.optional(Schema.Unknown),
15509
- bin: Schema.optional(Schema.Unknown)
15510
- });
15511
- const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
15512
15416
  const isDependedOn = (links) => ({ directory }) => pipe(links, Array.some(({ from, to }) => to === directory && from !== directory));
15513
15417
  const isKind = (kinds) => (kind) => Array.contains(kinds, kind);
15514
15418
  const isLibraryCrate = ({ kinds }) => pipe(kinds, Array.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Array.some(isKind(PROGRAM_KINDS)));
@@ -15542,8 +15446,8 @@ const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directo
15542
15446
  const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
15543
15447
  const { root, directory, crateLibraries, deployed } = request;
15544
15448
  const files = yield* RepositoryFiles;
15545
- const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
15546
- return pipe(text, Option.flatMap(decodeManifest$1), Option.map((manifest) => ({
15449
+ const text = yield* files.readFile(files.join(root, directory, PACKAGE_JSON_FILE));
15450
+ return pipe(text, Option.flatMap(decodePackageJson), Option.map((manifest) => ({
15547
15451
  directory,
15548
15452
  name: Option.fromUndefinedOr(manifest.name),
15549
15453
  library: Predicate.isNotUndefined(manifest.exports) || Predicate.isNotUndefined(manifest.main) || Array.contains(crateLibraries, directory),
@@ -15585,7 +15489,7 @@ const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* check
15585
15489
  ...tasks
15586
15490
  ];
15587
15491
  return pipe(members, Array.filter(({ library, entry }) => library && !entry), Array.filter((member) => !isDependedOn(links)(member)), Array.map(({ directory }) => ({
15588
- file: files.join(root, directory, MANIFEST_FILE$3),
15492
+ file: files.join(root, directory, PACKAGE_JSON_FILE),
15589
15493
  line: FIRST$1,
15590
15494
  column: FIRST$1,
15591
15495
  rule: RULE$2,
@@ -15594,23 +15498,15 @@ const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* check
15594
15498
  });
15595
15499
  // src/features/check-upstream-exits/model/scattered-deviations.ts
15596
15500
  const RULE$1 = "upstream-deviation-place";
15597
- const MANIFEST = "package.json";
15598
15501
  const NESTED_WORKSPACE = "/pnpm-workspace.yaml";
15599
15502
  const NESTED_CARGO = "/Cargo.toml";
15600
15503
  const CARGO_CONFIG = /(?:^|\/)\.cargo\/config(?:\.toml)?$/u;
15601
15504
  const MANAGER_FIELDS = ["overrides", "resolutions"];
15602
15505
  const START = 0;
15603
15506
  const PLACE = "Upstream deviations live only in the root pnpm-workspace.yaml (overrides, patchedDependencies, packageExtensions) and the root Cargo.toml ([patch]), each with an exit condition.";
15604
- const Fields = Schema.Record(Schema.String, Schema.Unknown);
15605
- const Manifest = Schema.fromJsonString(Schema.Struct({
15606
- pnpm: Schema.optional(Fields),
15607
- overrides: Schema.optional(Schema.Unknown),
15608
- resolutions: Schema.optional(Schema.Unknown)
15609
- }));
15610
- const decodeManifest = Schema.decodeUnknownOption(Manifest);
15611
- const isManifest = (name) => name === MANIFEST || String$1.endsWith(`/${MANIFEST}`)(name);
15507
+ const isManifest = (name) => name === PACKAGE_JSON_FILE || String$1.endsWith(`/${PACKAGE_JSON_FILE}`)(name);
15612
15508
  const keyIndex = (source, key) => Option.getOrElse(String$1.indexOf(`"${key}"`)(source), () => START);
15613
- const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
15509
+ const fieldsIn = (source) => pipe(decodePackageJson(source), Option.match({
15614
15510
  onNone: () => [],
15615
15511
  onSome: (manifest) => {
15616
15512
  const pnpm = Option.getOrElse(Option.fromUndefinedOr(manifest.pnpm), () => ({}));
@@ -15646,7 +15542,7 @@ const checkWorkspaceDescriptions = Effect.fn("checkWorkspaceDescriptions")(funct
15646
15542
  const files = yield* RepositoryFiles;
15647
15543
  const projects = yield* workspaceProjects(root);
15648
15544
  return pipe(projects, Array.filter(({ description }) => Option.isNone(description)), Array.map(({ directory }) => ({
15649
- file: files.join(root, directory, MANIFEST_FILE$3),
15545
+ file: files.join(root, directory, PACKAGE_JSON_FILE),
15650
15546
  line: FIRST,
15651
15547
  column: FIRST,
15652
15548
  rule: RULE,
@@ -15752,7 +15648,7 @@ const msch = Effect.gen(function* msch() {
15752
15648
  if (Array.isReadonlyArrayNonEmpty(args)) return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));
15753
15649
  return yield* checkEverything(root);
15754
15650
  });
15755
- runCli(msch);
15651
+ runCli("msch")(msch);
15756
15652
  export {};
15757
15653
 
15758
15654
  //# sourceMappingURL=cli.mjs.map