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