@r_masseater/msch 0.60.0 → 0.60.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +339 -270
- package/dist/cli.mjs.map +1 -1
- package/dist/publish.mjs +27 -10
- package/dist/publish.mjs.map +1 -1
- package/package.json +1 -1
- package/skills/msch-publishing/SKILL.md +2 -0
package/dist/cli.mjs
CHANGED
|
@@ -523,53 +523,53 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
523
523
|
// src/features/check-overrides/model/git-subpath.ts
|
|
524
524
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
525
525
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
526
|
-
const RULE$
|
|
526
|
+
const RULE$64 = "git-subpath-dependency";
|
|
527
527
|
const WHOLE_MATCH$4 = 0;
|
|
528
528
|
const problemAt$7 = ({ file }, source) => (found) => ({
|
|
529
529
|
file,
|
|
530
530
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
531
|
-
rule: RULE$
|
|
531
|
+
rule: RULE$64,
|
|
532
532
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
533
533
|
});
|
|
534
|
-
const problemsIn$
|
|
534
|
+
const problemsIn$23 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
|
|
535
535
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
536
536
|
/** @internal */
|
|
537
537
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
538
538
|
const listed = yield* listedFiles(root);
|
|
539
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
539
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$23);
|
|
540
540
|
});
|
|
541
541
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
542
|
-
const RULE$
|
|
542
|
+
const RULE$63 = "unnamed-restriction";
|
|
543
543
|
const WHOLE_MATCH$3 = 0;
|
|
544
544
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
545
|
-
const problemsIn$
|
|
545
|
+
const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
546
546
|
file: entry.file,
|
|
547
547
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
548
|
-
rule: RULE$
|
|
548
|
+
rule: RULE$63,
|
|
549
549
|
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
550
550
|
})));
|
|
551
551
|
/** @internal */
|
|
552
552
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
553
553
|
const listed = yield* listedFiles(root);
|
|
554
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
554
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$22);
|
|
555
555
|
});
|
|
556
556
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
557
|
-
const RULE$
|
|
557
|
+
const RULE$62 = "named-type-exemption";
|
|
558
558
|
const WHOLE_MATCH$2 = 0;
|
|
559
559
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
560
|
-
const problemsIn$
|
|
560
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
561
561
|
file: entry.file,
|
|
562
562
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
563
|
-
rule: RULE$
|
|
563
|
+
rule: RULE$62,
|
|
564
564
|
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
565
565
|
})));
|
|
566
566
|
/** @internal */
|
|
567
567
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
568
568
|
const listed = yield* listedFiles(root);
|
|
569
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
569
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
|
|
570
570
|
});
|
|
571
571
|
// src/features/check-overrides/model/package-registry.ts
|
|
572
|
-
const RULE$
|
|
572
|
+
const RULE$61 = "package-registry";
|
|
573
573
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
574
574
|
const TRAILING_SLASH = /\/$/u;
|
|
575
575
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
@@ -586,7 +586,7 @@ const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ in
|
|
|
586
586
|
const workspaceProblem = (file, source, registry) => ({
|
|
587
587
|
file,
|
|
588
588
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
589
|
-
rule: RULE$
|
|
589
|
+
rule: RULE$61,
|
|
590
590
|
message: Option.match(registry, {
|
|
591
591
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
592
592
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -595,7 +595,7 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
595
595
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
|
|
596
596
|
file: entry.file,
|
|
597
597
|
...positionOf(source)(found.index ?? START$24),
|
|
598
|
-
rule: RULE$
|
|
598
|
+
rule: RULE$61,
|
|
599
599
|
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
|
|
600
600
|
})));
|
|
601
601
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
@@ -614,8 +614,34 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
614
614
|
const overrides = yield* scanText(pipe(listed, Array.filter(({ name }) => NPMRC.test(name))), npmrcProblems);
|
|
615
615
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
616
616
|
});
|
|
617
|
+
// src/entities/package/model/specifiers.ts
|
|
618
|
+
const START$23 = 0;
|
|
619
|
+
const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
|
|
620
|
+
const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
|
|
621
|
+
const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
|
|
622
|
+
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
623
|
+
/** @internal */
|
|
624
|
+
const fieldsOf$2 = (value) => Option.getOrElse(decodeFields$2(value), () => ({}));
|
|
625
|
+
/** @internal */
|
|
626
|
+
const specifiedIn = (held) => pipe(fieldsOf$2(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString$2(value), Option.map((specifier) => ({
|
|
627
|
+
name,
|
|
628
|
+
specifier
|
|
629
|
+
})), Option.toArray)));
|
|
630
|
+
/** @internal */
|
|
631
|
+
const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
632
|
+
/** @internal */
|
|
633
|
+
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
634
|
+
/** @internal */
|
|
635
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
|
|
636
|
+
const SECTIONS = [
|
|
637
|
+
"dependencies",
|
|
638
|
+
"devDependencies",
|
|
639
|
+
"optionalDependencies"
|
|
640
|
+
];
|
|
641
|
+
/** @internal */
|
|
642
|
+
const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
|
|
617
643
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
618
|
-
const RULE$
|
|
644
|
+
const RULE$60 = "colocated-git-patterns";
|
|
619
645
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
620
646
|
const ROOT$3 = ".";
|
|
621
647
|
const NEGATION$1 = "!";
|
|
@@ -662,7 +688,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
662
688
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
663
689
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
664
690
|
});
|
|
665
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
691
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$60)(entry.file, {
|
|
666
692
|
line: entry.line,
|
|
667
693
|
column: FIRST$22
|
|
668
694
|
}, message);
|
|
@@ -725,7 +751,7 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
725
751
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
726
752
|
});
|
|
727
753
|
// src/features/check-placement/model/colocated-tests.ts
|
|
728
|
-
const RULE$
|
|
754
|
+
const RULE$59 = "colocated-test";
|
|
729
755
|
const FIRST$21 = 1;
|
|
730
756
|
const READ_CONCURRENCY$31 = 64;
|
|
731
757
|
const ROOT_SUBPATH = ".";
|
|
@@ -747,13 +773,13 @@ const Manifest$8 = Schema.Struct({
|
|
|
747
773
|
name: Schema.optional(Schema.String),
|
|
748
774
|
exports: Schema.optional(Schema.Unknown)
|
|
749
775
|
});
|
|
750
|
-
const decodeManifest$
|
|
776
|
+
const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$8));
|
|
751
777
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
752
778
|
const problemFor$9 = (test, message) => ({
|
|
753
779
|
file: test.file,
|
|
754
780
|
line: FIRST$21,
|
|
755
781
|
column: FIRST$21,
|
|
756
|
-
rule: RULE$
|
|
782
|
+
rule: RULE$59,
|
|
757
783
|
message: `${test.base} ${message}`
|
|
758
784
|
});
|
|
759
785
|
const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
@@ -773,7 +799,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
773
799
|
if (Option.isNone(owner)) return [];
|
|
774
800
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
775
801
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
776
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
802
|
+
return pipe(text, Option.flatMap(decodeManifest$10), Option.map(specifiersBeside({
|
|
777
803
|
join,
|
|
778
804
|
dirname: files.dirname,
|
|
779
805
|
directory: test.directory
|
|
@@ -836,7 +862,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
836
862
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
837
863
|
const RECOMMENDED_LINES = 200;
|
|
838
864
|
const FIRST$20 = 1;
|
|
839
|
-
const RULE$
|
|
865
|
+
const RULE$58 = "agent-docs-length";
|
|
840
866
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
841
867
|
const problemFor$8 = (file) => (lines) => {
|
|
842
868
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -844,19 +870,19 @@ const problemFor$8 = (file) => (lines) => {
|
|
|
844
870
|
file,
|
|
845
871
|
line: 201,
|
|
846
872
|
column: FIRST$20,
|
|
847
|
-
rule: RULE$
|
|
873
|
+
rule: RULE$58,
|
|
848
874
|
message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`
|
|
849
875
|
});
|
|
850
876
|
};
|
|
851
877
|
/** @internal */
|
|
852
878
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
853
879
|
// src/features/check-placement/model/claude-link.ts
|
|
854
|
-
const RULE$
|
|
880
|
+
const RULE$57 = "claude-md-link";
|
|
855
881
|
const CLAUDE = "CLAUDE.md";
|
|
856
882
|
const AGENTS = "AGENTS.md";
|
|
857
883
|
const FIRST$19 = 1;
|
|
858
884
|
const READ_CONCURRENCY$29 = 16;
|
|
859
|
-
const MESSAGE$
|
|
885
|
+
const MESSAGE$17 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
860
886
|
/** @internal */
|
|
861
887
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
862
888
|
const files = yield* RepositoryFiles;
|
|
@@ -870,8 +896,8 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
870
896
|
file: path,
|
|
871
897
|
line: FIRST$19,
|
|
872
898
|
column: FIRST$19,
|
|
873
|
-
rule: RULE$
|
|
874
|
-
message: MESSAGE$
|
|
899
|
+
rule: RULE$57,
|
|
900
|
+
message: MESSAGE$17
|
|
875
901
|
})));
|
|
876
902
|
});
|
|
877
903
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
@@ -879,7 +905,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
879
905
|
return Array.getSomes(found);
|
|
880
906
|
});
|
|
881
907
|
// src/features/check-placement/model/dangling-links.ts
|
|
882
|
-
const RULE$
|
|
908
|
+
const RULE$56 = "dangling-link";
|
|
883
909
|
const SEPARATOR$20 = "/";
|
|
884
910
|
const FIRST$18 = 1;
|
|
885
911
|
const READ_CONCURRENCY$28 = 16;
|
|
@@ -895,7 +921,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
895
921
|
file,
|
|
896
922
|
line: FIRST$18,
|
|
897
923
|
column: FIRST$18,
|
|
898
|
-
rule: RULE$
|
|
924
|
+
rule: RULE$56,
|
|
899
925
|
message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
|
|
900
926
|
})));
|
|
901
927
|
});
|
|
@@ -953,8 +979,8 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
953
979
|
}));
|
|
954
980
|
});
|
|
955
981
|
// src/features/check-placement/model/deployed-readme.ts
|
|
956
|
-
const RULE$
|
|
957
|
-
const ROOT_DIRECTORY$
|
|
982
|
+
const RULE$55 = "deployed-readme";
|
|
983
|
+
const ROOT_DIRECTORY$3 = "";
|
|
958
984
|
const READ_CONCURRENCY$27 = 16;
|
|
959
985
|
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
960
986
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
@@ -993,14 +1019,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
993
1019
|
const readme = yield* readReadme({
|
|
994
1020
|
root,
|
|
995
1021
|
directory,
|
|
996
|
-
rule: RULE$
|
|
1022
|
+
rule: RULE$55,
|
|
997
1023
|
missingMessage: MISSING_MESSAGE$2
|
|
998
1024
|
});
|
|
999
1025
|
return Result.match(readme, {
|
|
1000
1026
|
onFailure: Option.some,
|
|
1001
1027
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
1002
1028
|
file,
|
|
1003
|
-
rule: RULE$
|
|
1029
|
+
rule: RULE$55,
|
|
1004
1030
|
message: NO_URL_MESSAGE
|
|
1005
1031
|
})))
|
|
1006
1032
|
});
|
|
@@ -1012,12 +1038,12 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
1012
1038
|
const directories = yield* workspaceDirectories(root);
|
|
1013
1039
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
1014
1040
|
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$27 });
|
|
1015
|
-
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$
|
|
1041
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$3))), Array.dedupe);
|
|
1016
1042
|
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$27 });
|
|
1017
1043
|
return Array.getSomes(found);
|
|
1018
1044
|
});
|
|
1019
1045
|
// src/features/check-placement/model/nested-docs.ts
|
|
1020
|
-
const RULE$
|
|
1046
|
+
const RULE$54 = "nested-docs";
|
|
1021
1047
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
1022
1048
|
const SEPARATOR$18 = "/";
|
|
1023
1049
|
const READ_CONCURRENCY$26 = 64;
|
|
@@ -1030,7 +1056,7 @@ const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Sc
|
|
|
1030
1056
|
const taggedError$7 = Schema.TaggedError;
|
|
1031
1057
|
var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1032
1058
|
const isNested = (name) => String$1.includes(SEPARATOR$18)(name);
|
|
1033
|
-
const problemFor$7 = problemInFile(RULE$
|
|
1059
|
+
const problemFor$7 = problemInFile(RULE$54);
|
|
1034
1060
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1035
1061
|
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
1036
1062
|
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
@@ -1087,15 +1113,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1087
1113
|
return [...Array.getSomes(found), ...missing];
|
|
1088
1114
|
});
|
|
1089
1115
|
// src/features/check-placement/model/published-readme.ts
|
|
1090
|
-
const RULE$
|
|
1116
|
+
const RULE$53 = "published-readme";
|
|
1091
1117
|
const READ_CONCURRENCY$25 = 16;
|
|
1092
|
-
const MESSAGE$
|
|
1118
|
+
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1093
1119
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
1094
1120
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
1095
1121
|
const readme = yield* readReadme({
|
|
1096
1122
|
root,
|
|
1097
1123
|
directory,
|
|
1098
|
-
rule: RULE$
|
|
1124
|
+
rule: RULE$53,
|
|
1099
1125
|
missingMessage: MISSING_MESSAGE
|
|
1100
1126
|
});
|
|
1101
1127
|
return Result.match(readme, {
|
|
@@ -1106,8 +1132,8 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1106
1132
|
file,
|
|
1107
1133
|
line,
|
|
1108
1134
|
column,
|
|
1109
|
-
rule: RULE$
|
|
1110
|
-
message: MESSAGE$
|
|
1135
|
+
rule: RULE$53,
|
|
1136
|
+
message: MESSAGE$16
|
|
1111
1137
|
};
|
|
1112
1138
|
}))
|
|
1113
1139
|
});
|
|
@@ -1119,11 +1145,11 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
1119
1145
|
return Array.getSomes(found);
|
|
1120
1146
|
});
|
|
1121
1147
|
// src/features/check-placement/model/published-tests.ts
|
|
1122
|
-
const RULE$
|
|
1148
|
+
const RULE$52 = "published-tests";
|
|
1123
1149
|
const MANIFEST_FILE$2 = "package.json";
|
|
1124
1150
|
const FILE_START = 1;
|
|
1125
1151
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
1126
|
-
const MESSAGE$
|
|
1152
|
+
const MESSAGE$15 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
1127
1153
|
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
1128
1154
|
const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
1129
1155
|
const files = yield* RepositoryFiles;
|
|
@@ -1134,8 +1160,8 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1134
1160
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1135
1161
|
line: FILE_START,
|
|
1136
1162
|
column: FILE_START,
|
|
1137
|
-
rule: RULE$
|
|
1138
|
-
message: MESSAGE$
|
|
1163
|
+
rule: RULE$52,
|
|
1164
|
+
message: MESSAGE$15
|
|
1139
1165
|
});
|
|
1140
1166
|
});
|
|
1141
1167
|
/** @internal */
|
|
@@ -1148,12 +1174,12 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1148
1174
|
return Array.getSomes(found);
|
|
1149
1175
|
});
|
|
1150
1176
|
// src/features/check-placement/model/root-docs.ts
|
|
1151
|
-
const RULE$
|
|
1177
|
+
const RULE$51 = "root-docs";
|
|
1152
1178
|
const SEPARATOR$17 = "/";
|
|
1153
1179
|
const FIRST$16 = 1;
|
|
1154
1180
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1155
1181
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1156
|
-
const MESSAGE$
|
|
1182
|
+
const MESSAGE$14 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
1157
1183
|
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$17)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1158
1184
|
/** @internal */
|
|
1159
1185
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
@@ -1163,15 +1189,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1163
1189
|
file: files.join(root, name),
|
|
1164
1190
|
line: FIRST$16,
|
|
1165
1191
|
column: FIRST$16,
|
|
1166
|
-
rule: RULE$
|
|
1167
|
-
message: `${name} ${MESSAGE$
|
|
1192
|
+
rule: RULE$51,
|
|
1193
|
+
message: `${name} ${MESSAGE$14}`
|
|
1168
1194
|
})));
|
|
1169
1195
|
});
|
|
1170
1196
|
// src/features/check-placement/model/root-readme.ts
|
|
1171
|
-
const RULE$
|
|
1197
|
+
const RULE$50 = "root-readme";
|
|
1172
1198
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1173
1199
|
const READ_CONCURRENCY$24 = 16;
|
|
1174
|
-
const START$
|
|
1200
|
+
const START$22 = 0;
|
|
1175
1201
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1176
1202
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1177
1203
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -1210,17 +1236,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1210
1236
|
onNone: () => ownNames(plugins, names),
|
|
1211
1237
|
onSome: () => [directory]
|
|
1212
1238
|
}));
|
|
1213
|
-
const problemsIn$
|
|
1239
|
+
const problemsIn$20 = (file, source, plugins) => (workspace) => {
|
|
1214
1240
|
const message = messageFor(workspace.directory);
|
|
1215
1241
|
const at = positionOf(source);
|
|
1216
1242
|
const pattern = patternFor(plugins)(workspace);
|
|
1217
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1243
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$50)(file, at(found.index ?? START$22), message)));
|
|
1218
1244
|
};
|
|
1219
1245
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1220
1246
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1221
1247
|
return pipe(text, Option.match({
|
|
1222
1248
|
onNone: () => [],
|
|
1223
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1249
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$20(file, source, plugins)))
|
|
1224
1250
|
}));
|
|
1225
1251
|
});
|
|
1226
1252
|
/** @internal */
|
|
@@ -1251,7 +1277,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1251
1277
|
return Array.flatten(found);
|
|
1252
1278
|
});
|
|
1253
1279
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1254
|
-
const RULE$
|
|
1280
|
+
const RULE$49 = "docs-mirror";
|
|
1255
1281
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1256
1282
|
const MIRROR_LIMIT = 3;
|
|
1257
1283
|
const READ_CONCURRENCY$23 = 16;
|
|
@@ -1276,7 +1302,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
1276
1302
|
file,
|
|
1277
1303
|
line,
|
|
1278
1304
|
column,
|
|
1279
|
-
rule: RULE$
|
|
1305
|
+
rule: RULE$49,
|
|
1280
1306
|
message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`
|
|
1281
1307
|
};
|
|
1282
1308
|
}), Option.toArray);
|
|
@@ -1308,10 +1334,10 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1308
1334
|
return Array.flatten(found);
|
|
1309
1335
|
});
|
|
1310
1336
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1311
|
-
const RULE$
|
|
1337
|
+
const RULE$48 = "ignored-sources";
|
|
1312
1338
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1313
1339
|
const FIRST$15 = 1;
|
|
1314
|
-
const MESSAGE$
|
|
1340
|
+
const MESSAGE$13 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
1315
1341
|
/** @internal */
|
|
1316
1342
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
1317
1343
|
const files = yield* RepositoryFiles;
|
|
@@ -1320,8 +1346,8 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1320
1346
|
file: files.join(root, file),
|
|
1321
1347
|
line: FIRST$15,
|
|
1322
1348
|
column: FIRST$15,
|
|
1323
|
-
rule: RULE$
|
|
1324
|
-
message: MESSAGE$
|
|
1349
|
+
rule: RULE$48,
|
|
1350
|
+
message: MESSAGE$13
|
|
1325
1351
|
})));
|
|
1326
1352
|
});
|
|
1327
1353
|
// src/features/check-placement/model/public-entries.ts
|
|
@@ -10078,13 +10104,13 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10078
10104
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10079
10105
|
});
|
|
10080
10106
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10081
|
-
const RULE$
|
|
10107
|
+
const RULE$47 = "shadcn-ui-alias";
|
|
10082
10108
|
const FIRST$14 = 1;
|
|
10083
10109
|
const problemOf$9 = (directory, { file, alias }) => ({
|
|
10084
10110
|
file,
|
|
10085
10111
|
line: FIRST$14,
|
|
10086
10112
|
column: FIRST$14,
|
|
10087
|
-
rule: RULE$
|
|
10113
|
+
rule: RULE$47,
|
|
10088
10114
|
message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
|
|
10089
10115
|
});
|
|
10090
10116
|
/** @internal */
|
|
@@ -10105,7 +10131,7 @@ const SOURCE_TARGET = "./src/*";
|
|
|
10105
10131
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10106
10132
|
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.`;
|
|
10107
10133
|
const Manifest$7 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10108
|
-
const decodeManifest$
|
|
10134
|
+
const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
|
|
10109
10135
|
const targetsOf = (target) => {
|
|
10110
10136
|
if (Predicate.isString(target)) return [target];
|
|
10111
10137
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10116,7 +10142,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10116
10142
|
const files = yield* RepositoryFiles;
|
|
10117
10143
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10118
10144
|
const text = yield* files.readFile(manifest);
|
|
10119
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10145
|
+
return pipe(text, Option.flatMap(decodeManifest$9), 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}`)));
|
|
10120
10146
|
});
|
|
10121
10147
|
/** @internal */
|
|
10122
10148
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10159,7 +10185,7 @@ const Manifest$6 = Schema.Struct({
|
|
|
10159
10185
|
main: Schema.optional(Schema.Unknown),
|
|
10160
10186
|
exports: Schema.optional(Schema.Unknown)
|
|
10161
10187
|
});
|
|
10162
|
-
const decodeManifest$
|
|
10188
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
10163
10189
|
const NO_ENTRIES = {
|
|
10164
10190
|
all: [],
|
|
10165
10191
|
bins: []
|
|
@@ -10184,7 +10210,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
10184
10210
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10185
10211
|
const files = yield* RepositoryFiles;
|
|
10186
10212
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10187
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10213
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10188
10214
|
});
|
|
10189
10215
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10190
10216
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -10207,7 +10233,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10207
10233
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
10208
10234
|
})));
|
|
10209
10235
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10210
|
-
const problemsIn$
|
|
10236
|
+
const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10211
10237
|
const files = yield* RepositoryFiles;
|
|
10212
10238
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10213
10239
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10246,12 +10272,12 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10246
10272
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10247
10273
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10248
10274
|
const workflows = yield* workflowText(root);
|
|
10249
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10275
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$19(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
|
|
10250
10276
|
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
10251
10277
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10252
10278
|
});
|
|
10253
10279
|
// src/features/check-repository-layout/model/crates.ts
|
|
10254
|
-
const RULE$
|
|
10280
|
+
const RULE$46 = "unverified-crate";
|
|
10255
10281
|
const VERSION_RULE = "release-version";
|
|
10256
10282
|
const MANIFEST_FILE$1 = "package.json";
|
|
10257
10283
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
@@ -10265,7 +10291,7 @@ const problemFor$4 = (crate, message) => ({
|
|
|
10265
10291
|
file: crate.manifest,
|
|
10266
10292
|
line: FIRST$12,
|
|
10267
10293
|
column: FIRST$12,
|
|
10268
|
-
rule: RULE$
|
|
10294
|
+
rule: RULE$46,
|
|
10269
10295
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10270
10296
|
});
|
|
10271
10297
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10301,7 +10327,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10301
10327
|
return Array.getSomes(Array.flatten(found));
|
|
10302
10328
|
});
|
|
10303
10329
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10304
|
-
const RULE$
|
|
10330
|
+
const RULE$45 = "deploy-entry-pattern";
|
|
10305
10331
|
const FALLOW_KEYS = [
|
|
10306
10332
|
"entry",
|
|
10307
10333
|
"entryPoints",
|
|
@@ -10320,7 +10346,7 @@ const ROOT_WORKSPACE = ".";
|
|
|
10320
10346
|
const WRAP_OFFSET$1 = 1;
|
|
10321
10347
|
const NO_OFFSET = 0;
|
|
10322
10348
|
const READ_CONCURRENCY$19 = 8;
|
|
10323
|
-
const MESSAGE$
|
|
10349
|
+
const MESSAGE$12 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10324
10350
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10325
10351
|
const FALLOW = {
|
|
10326
10352
|
keys: FALLOW_KEYS,
|
|
@@ -10356,7 +10382,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10356
10382
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10357
10383
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10358
10384
|
});
|
|
10359
|
-
const problemsIn$
|
|
10385
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10360
10386
|
const { root, file, kind, workspaces, entries } = request;
|
|
10361
10387
|
const files = yield* RepositoryFiles;
|
|
10362
10388
|
const path = files.join(root, file);
|
|
@@ -10372,8 +10398,8 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10372
10398
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10373
10399
|
file: path,
|
|
10374
10400
|
...positionOf(text.value)(start - kind.offset),
|
|
10375
|
-
rule: RULE$
|
|
10376
|
-
message: `${pattern} ${MESSAGE$
|
|
10401
|
+
rule: RULE$45,
|
|
10402
|
+
message: `${pattern} ${MESSAGE$12}`
|
|
10377
10403
|
})));
|
|
10378
10404
|
});
|
|
10379
10405
|
/** @internal */
|
|
@@ -10395,7 +10421,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10395
10421
|
}];
|
|
10396
10422
|
return [];
|
|
10397
10423
|
}));
|
|
10398
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10424
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$18({
|
|
10399
10425
|
root,
|
|
10400
10426
|
file,
|
|
10401
10427
|
kind,
|
|
@@ -10405,7 +10431,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10405
10431
|
return Array.flatten(found);
|
|
10406
10432
|
});
|
|
10407
10433
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10408
|
-
const RULE$
|
|
10434
|
+
const RULE$44 = "listed-entry";
|
|
10409
10435
|
const ENTRY_KEYS = [
|
|
10410
10436
|
"entry",
|
|
10411
10437
|
"entryPoints",
|
|
@@ -10426,7 +10452,7 @@ const entryPatternsIn = (node) => {
|
|
|
10426
10452
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10427
10453
|
};
|
|
10428
10454
|
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
|
|
10429
|
-
const problemsIn$
|
|
10455
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10430
10456
|
const files = yield* RepositoryFiles;
|
|
10431
10457
|
const path = files.join(root, file);
|
|
10432
10458
|
const text = yield* files.readFile(path);
|
|
@@ -10435,7 +10461,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10435
10461
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10436
10462
|
file: path,
|
|
10437
10463
|
...positionOf(text.value)(start),
|
|
10438
|
-
rule: RULE$
|
|
10464
|
+
rule: RULE$44,
|
|
10439
10465
|
message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`
|
|
10440
10466
|
})));
|
|
10441
10467
|
});
|
|
@@ -10443,11 +10469,11 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10443
10469
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10444
10470
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10445
10471
|
const directories = yield* workspaceDirectories(root);
|
|
10446
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10472
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$17(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
|
|
10447
10473
|
return Array.flatten(found);
|
|
10448
10474
|
});
|
|
10449
10475
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10450
|
-
const RULE$
|
|
10476
|
+
const RULE$43 = "root-workspace-path";
|
|
10451
10477
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10452
10478
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10453
10479
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -10463,10 +10489,10 @@ const mentions = (directory) => (text) => {
|
|
|
10463
10489
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10464
10490
|
}));
|
|
10465
10491
|
};
|
|
10466
|
-
const problemsIn$
|
|
10492
|
+
const problemsIn$16 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10467
10493
|
file,
|
|
10468
10494
|
...positionOf(source)(found.start),
|
|
10469
|
-
rule: RULE$
|
|
10495
|
+
rule: RULE$43,
|
|
10470
10496
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
10471
10497
|
})));
|
|
10472
10498
|
/** @internal */
|
|
@@ -10477,10 +10503,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10477
10503
|
if (Option.isNone(source)) return [];
|
|
10478
10504
|
const directories = yield* workspaceDirectories(root);
|
|
10479
10505
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10480
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10506
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$16(file, source.value, directories)));
|
|
10481
10507
|
});
|
|
10482
10508
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10483
|
-
const RULE$
|
|
10509
|
+
const RULE$42 = "hidden-verify";
|
|
10484
10510
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10485
10511
|
const FIRST$10 = 1;
|
|
10486
10512
|
const READ_CONCURRENCY$17 = 8;
|
|
@@ -10494,7 +10520,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10494
10520
|
file,
|
|
10495
10521
|
line: FIRST$10,
|
|
10496
10522
|
column: FIRST$10,
|
|
10497
|
-
rule: RULE$
|
|
10523
|
+
rule: RULE$42,
|
|
10498
10524
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
10499
10525
|
}).pipe(Option.filter(() => verified));
|
|
10500
10526
|
});
|
|
@@ -10505,7 +10531,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
10505
10531
|
return Array.getSomes(found);
|
|
10506
10532
|
});
|
|
10507
10533
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10508
|
-
const RULE$
|
|
10534
|
+
const RULE$41 = "shared-uncached-task";
|
|
10509
10535
|
const READ_CONCURRENCY$16 = 8;
|
|
10510
10536
|
const SHARED = 2;
|
|
10511
10537
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -10548,7 +10574,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
10548
10574
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10549
10575
|
file,
|
|
10550
10576
|
...position,
|
|
10551
|
-
rule: RULE$
|
|
10577
|
+
rule: RULE$41,
|
|
10552
10578
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
|
|
10553
10579
|
})));
|
|
10554
10580
|
};
|
|
@@ -10559,7 +10585,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
10559
10585
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10560
10586
|
});
|
|
10561
10587
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10562
|
-
const RULE$
|
|
10588
|
+
const RULE$40 = "unlocked-task";
|
|
10563
10589
|
const READ_CONCURRENCY$15 = 8;
|
|
10564
10590
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10565
10591
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -10571,7 +10597,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10571
10597
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10572
10598
|
file,
|
|
10573
10599
|
...positionOf(source)(task.start),
|
|
10574
|
-
rule: RULE$
|
|
10600
|
+
rule: RULE$40,
|
|
10575
10601
|
message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
|
|
10576
10602
|
})), Option.toArray)));
|
|
10577
10603
|
/** @internal */
|
|
@@ -10726,7 +10752,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10726
10752
|
/** @internal */
|
|
10727
10753
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10728
10754
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10729
|
-
const RULE$
|
|
10755
|
+
const RULE$39 = "workflow-path";
|
|
10730
10756
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10731
10757
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10732
10758
|
const READ_CONCURRENCY$14 = 8;
|
|
@@ -10792,10 +10818,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10792
10818
|
const problemOf$8 = (file, source) => (found) => ({
|
|
10793
10819
|
file,
|
|
10794
10820
|
...positionOf(source)(found.offset),
|
|
10795
|
-
rule: RULE$
|
|
10821
|
+
rule: RULE$39,
|
|
10796
10822
|
message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`
|
|
10797
10823
|
});
|
|
10798
|
-
const problemsIn$
|
|
10824
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10799
10825
|
const files = yield* RepositoryFiles;
|
|
10800
10826
|
const file = files.join(root, workflow);
|
|
10801
10827
|
const source = yield* files.readFile(file);
|
|
@@ -10807,7 +10833,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10807
10833
|
/** @internal */
|
|
10808
10834
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10809
10835
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10810
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10836
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$15(root, workflow), { concurrency: READ_CONCURRENCY$14 });
|
|
10811
10837
|
return Array.flatten(found);
|
|
10812
10838
|
});
|
|
10813
10839
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10818,7 +10844,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10818
10844
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10819
10845
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10820
10846
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10821
|
-
const START$
|
|
10847
|
+
const START$21 = 0;
|
|
10822
10848
|
const READ_CONCURRENCY$13 = 8;
|
|
10823
10849
|
const SEPARATOR$8 = "/";
|
|
10824
10850
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
@@ -10849,7 +10875,7 @@ const namesIn$1 = (name, source) => {
|
|
|
10849
10875
|
return [
|
|
10850
10876
|
{
|
|
10851
10877
|
text: name,
|
|
10852
|
-
offset: START$
|
|
10878
|
+
offset: START$21
|
|
10853
10879
|
},
|
|
10854
10880
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10855
10881
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -11033,7 +11059,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
11033
11059
|
peerDependencies: DependencyMap,
|
|
11034
11060
|
peerDependenciesMeta: PeerMeta
|
|
11035
11061
|
});
|
|
11036
|
-
const decodeManifest$
|
|
11062
|
+
const decodeManifest$7 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11037
11063
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11038
11064
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11039
11065
|
const installedNames = (manifest) => [
|
|
@@ -11044,7 +11070,7 @@ const installedNames = (manifest) => [
|
|
|
11044
11070
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11045
11071
|
const files = yield* RepositoryFiles;
|
|
11046
11072
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11047
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11073
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11048
11074
|
});
|
|
11049
11075
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11050
11076
|
const files = yield* RepositoryFiles;
|
|
@@ -11106,11 +11132,11 @@ const LISTED_LARGEST = 5;
|
|
|
11106
11132
|
const SIZE_CONCURRENCY = 32;
|
|
11107
11133
|
const MEGABYTE = 1e6;
|
|
11108
11134
|
const MEGABYTE_DIGITS = 1;
|
|
11109
|
-
const START$
|
|
11135
|
+
const START$20 = 0;
|
|
11110
11136
|
const SINGLE_ENTRY = 1;
|
|
11111
11137
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11112
11138
|
const usageHint = (dependency, entryCount) => {
|
|
11113
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11139
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$20 && dependency.entries.length < entryCount)) return "";
|
|
11114
11140
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11115
11141
|
};
|
|
11116
11142
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11119,7 +11145,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11119
11145
|
const { workspace, total } = overrun;
|
|
11120
11146
|
const config = yield* files.readFile(workspace.configFile);
|
|
11121
11147
|
const source = Option.getOrElse(config, () => "");
|
|
11122
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11148
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$20);
|
|
11123
11149
|
return {
|
|
11124
11150
|
file: workspace.configFile,
|
|
11125
11151
|
...positionOf(source)(index),
|
|
@@ -11136,7 +11162,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11136
11162
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11137
11163
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11138
11164
|
const sizes = HashMap.fromIterable(measured);
|
|
11139
|
-
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11165
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$20)), Number$1.sumAll);
|
|
11140
11166
|
return {
|
|
11141
11167
|
closures,
|
|
11142
11168
|
sizeOf,
|
|
@@ -11169,11 +11195,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11169
11195
|
})];
|
|
11170
11196
|
});
|
|
11171
11197
|
const stackProblems = (file, source, dependencies) => {
|
|
11172
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
11198
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$20);
|
|
11173
11199
|
const rest = String$1.slice(section)(source);
|
|
11174
11200
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11175
11201
|
file,
|
|
11176
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11202
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
|
|
11177
11203
|
rule: STACK_DEPENDENCY,
|
|
11178
11204
|
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.`
|
|
11179
11205
|
})));
|
|
@@ -11343,19 +11369,19 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11343
11369
|
};
|
|
11344
11370
|
};
|
|
11345
11371
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11346
|
-
const RULE$
|
|
11347
|
-
const START$
|
|
11372
|
+
const RULE$38 = "optional-peer";
|
|
11373
|
+
const START$19 = 0;
|
|
11348
11374
|
const SINGLE = 1;
|
|
11349
11375
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11350
11376
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11351
11377
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11352
11378
|
const problemFor$3 = (located, name, importers) => {
|
|
11353
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$
|
|
11379
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$19);
|
|
11354
11380
|
const rest = String$1.slice(section)(located.source);
|
|
11355
11381
|
return {
|
|
11356
11382
|
file: located.file,
|
|
11357
|
-
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11358
|
-
rule: RULE$
|
|
11383
|
+
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
|
|
11384
|
+
rule: RULE$38,
|
|
11359
11385
|
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
11360
11386
|
};
|
|
11361
11387
|
};
|
|
@@ -11366,14 +11392,14 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11366
11392
|
return pipe(dependencies, Array.flatMap((name) => {
|
|
11367
11393
|
const importers = pipe(libraries, Array.filter(importsPackage(name)));
|
|
11368
11394
|
const neededByBin = pipe(bins, Array.some(importsPackage(name)));
|
|
11369
|
-
if (!(importers.length > START$
|
|
11395
|
+
if (!(importers.length > START$19 && importers.length < libraries.length) || neededByBin) return [];
|
|
11370
11396
|
return [problemFor$3(located, name, importers)];
|
|
11371
11397
|
}));
|
|
11372
11398
|
};
|
|
11373
11399
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11374
|
-
const RULE$
|
|
11400
|
+
const RULE$37 = "side-effects";
|
|
11375
11401
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11376
|
-
const START$
|
|
11402
|
+
const START$18 = 0;
|
|
11377
11403
|
const FIRST$8 = 1;
|
|
11378
11404
|
const LISTED_PACKAGES = 4;
|
|
11379
11405
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
@@ -11397,7 +11423,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
11397
11423
|
label: entry.label,
|
|
11398
11424
|
member,
|
|
11399
11425
|
...extra
|
|
11400
|
-
}, ({ modules }) => modules > START$
|
|
11426
|
+
}, ({ modules }) => modules > START$18);
|
|
11401
11427
|
});
|
|
11402
11428
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
11403
11429
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -11419,15 +11445,15 @@ const othersOf = (total) => {
|
|
|
11419
11445
|
};
|
|
11420
11446
|
const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
11421
11447
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
11422
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
11448
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$18));
|
|
11423
11449
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11424
11450
|
file,
|
|
11425
11451
|
...positionOf(source)(keyIndex$1(source)),
|
|
11426
|
-
rule: RULE$
|
|
11452
|
+
rule: RULE$37,
|
|
11427
11453
|
message: messageOf$4(worst, excesses.length)
|
|
11428
11454
|
})), Option.toArray);
|
|
11429
11455
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11430
|
-
const RULE$
|
|
11456
|
+
const RULE$36 = "top-level-effect";
|
|
11431
11457
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11432
11458
|
const READ_CONCURRENCY$12 = 16;
|
|
11433
11459
|
const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
|
|
@@ -11440,10 +11466,10 @@ const messageOf$3 = (statement) => {
|
|
|
11440
11466
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
11441
11467
|
return STATEMENT_MESSAGE;
|
|
11442
11468
|
};
|
|
11443
|
-
const problemsIn$
|
|
11469
|
+
const problemsIn$14 = (api) => (file) => (source) => {
|
|
11444
11470
|
const retained = api.createSourceFile(file, source);
|
|
11445
11471
|
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$8({
|
|
11446
|
-
rule: RULE$
|
|
11472
|
+
rule: RULE$36,
|
|
11447
11473
|
message: messageOf$3(statement)
|
|
11448
11474
|
})(statement)));
|
|
11449
11475
|
retained.dispose();
|
|
@@ -11456,7 +11482,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11456
11482
|
const names = yield* files.ownedFiles(root);
|
|
11457
11483
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11458
11484
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11459
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
11485
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$14(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
|
|
11460
11486
|
return Array.flatten(found);
|
|
11461
11487
|
}, Effect.scoped);
|
|
11462
11488
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11567,7 +11593,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11567
11593
|
return Array.flatten(found);
|
|
11568
11594
|
});
|
|
11569
11595
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11570
|
-
const RULE$
|
|
11596
|
+
const RULE$35 = "legacy-typescript";
|
|
11571
11597
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11572
11598
|
const COMPILER = "typescript";
|
|
11573
11599
|
const CURRENT_MAJOR = 7;
|
|
@@ -11598,12 +11624,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11598
11624
|
file,
|
|
11599
11625
|
line: lineOf$2(source)(legacy.id),
|
|
11600
11626
|
column: FIRST$7,
|
|
11601
|
-
rule: RULE$
|
|
11627
|
+
rule: RULE$35,
|
|
11602
11628
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11603
11629
|
})));
|
|
11604
11630
|
});
|
|
11605
11631
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11606
|
-
const RULE$
|
|
11632
|
+
const RULE$34 = "worker-bundle";
|
|
11607
11633
|
const BUNDLE_CONCURRENCY = 4;
|
|
11608
11634
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11609
11635
|
const CONDITIONS = [
|
|
@@ -11614,7 +11640,7 @@ const CONDITIONS = [
|
|
|
11614
11640
|
"module",
|
|
11615
11641
|
"default"
|
|
11616
11642
|
];
|
|
11617
|
-
const problemFor$2 = problemInFile(RULE$
|
|
11643
|
+
const problemFor$2 = problemInFile(RULE$34);
|
|
11618
11644
|
const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11619
11645
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11620
11646
|
const built = yield* Effect.tryPromise({
|
|
@@ -11736,7 +11762,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11736
11762
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11737
11763
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11738
11764
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11739
|
-
const RULE$
|
|
11765
|
+
const RULE$33 = "hand-written-names";
|
|
11740
11766
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11741
11767
|
const nameListOf = (site) => {
|
|
11742
11768
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11751,7 +11777,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11751
11777
|
file,
|
|
11752
11778
|
line,
|
|
11753
11779
|
column,
|
|
11754
|
-
rule: RULE$
|
|
11780
|
+
rule: RULE$33,
|
|
11755
11781
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11756
11782
|
});
|
|
11757
11783
|
const problemOf$6 = ({ list, reason }) => listedProblem({
|
|
@@ -12435,13 +12461,13 @@ const MANIFEST$3 = "package.json";
|
|
|
12435
12461
|
const SEPARATOR$5 = "/";
|
|
12436
12462
|
const FIRST_SEGMENT = 1;
|
|
12437
12463
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12438
|
-
const decodeManifest$
|
|
12464
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(ManifestJson);
|
|
12439
12465
|
const prefixesOf = (file) => {
|
|
12440
12466
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12441
12467
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12442
12468
|
};
|
|
12443
12469
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12444
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12470
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12445
12471
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12446
12472
|
const files = yield* RepositoryFiles;
|
|
12447
12473
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12553,7 +12579,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12553
12579
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12554
12580
|
}, Effect.scoped);
|
|
12555
12581
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12556
|
-
const RULE$
|
|
12582
|
+
const RULE$32 = "namespace-destructuring";
|
|
12557
12583
|
const LOCAL = /^[.#/]/u;
|
|
12558
12584
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
12559
12585
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12569,7 +12595,7 @@ const destructuredName = (declaration) => {
|
|
|
12569
12595
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12570
12596
|
};
|
|
12571
12597
|
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
|
|
12572
|
-
rule: RULE$
|
|
12598
|
+
rule: RULE$32,
|
|
12573
12599
|
message: messageOf$1(name)
|
|
12574
12600
|
})), Option.map((report) => report(declaration)));
|
|
12575
12601
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12577,7 +12603,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12577
12603
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
12578
12604
|
};
|
|
12579
12605
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12580
|
-
const RULE$
|
|
12606
|
+
const RULE$31 = "pass-through-wrapper";
|
|
12581
12607
|
const SINGLE_STATEMENT = 1;
|
|
12582
12608
|
const SINGLE_DECLARATION = 1;
|
|
12583
12609
|
const THIS_PARAMETER = "this";
|
|
@@ -12674,7 +12700,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12674
12700
|
const problemOf$4 = (checker) => (candidate) => {
|
|
12675
12701
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12676
12702
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
|
|
12677
|
-
rule: RULE$
|
|
12703
|
+
rule: RULE$31,
|
|
12678
12704
|
message: messageOf(forward.callee.getText())
|
|
12679
12705
|
})(candidate.name)));
|
|
12680
12706
|
};
|
|
@@ -12700,7 +12726,7 @@ var plugins = [{
|
|
|
12700
12726
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12701
12727
|
}];
|
|
12702
12728
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12703
|
-
const RULE$
|
|
12729
|
+
const RULE$30 = "known-plugins";
|
|
12704
12730
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12705
12731
|
const GITHUB$2 = "github";
|
|
12706
12732
|
const Source$1 = Schema.Struct({
|
|
@@ -12718,7 +12744,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12718
12744
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12719
12745
|
const MARKETPLACE = name;
|
|
12720
12746
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12721
|
-
const problem$1 = problemInFile(RULE$
|
|
12747
|
+
const problem$1 = problemInFile(RULE$30);
|
|
12722
12748
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12723
12749
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12724
12750
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12739,20 +12765,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12739
12765
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12740
12766
|
});
|
|
12741
12767
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12742
|
-
const RULE$
|
|
12768
|
+
const RULE$29 = "missing-hook";
|
|
12743
12769
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12744
12770
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12745
12771
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12746
12772
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12747
12773
|
const PLUGIN_ROOT = "..";
|
|
12748
12774
|
const READ_CONCURRENCY$11 = 16;
|
|
12749
|
-
const START$
|
|
12775
|
+
const START$17 = 0;
|
|
12750
12776
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12751
12777
|
path,
|
|
12752
|
-
index: found.index ?? START$
|
|
12778
|
+
index: found.index ?? START$17
|
|
12753
12779
|
})), Option.toArray);
|
|
12754
12780
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12755
|
-
const problemsIn$
|
|
12781
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12756
12782
|
const files = yield* RepositoryFiles;
|
|
12757
12783
|
const text = yield* files.readFile(file);
|
|
12758
12784
|
if (Option.isNone(text)) return [];
|
|
@@ -12764,7 +12790,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12764
12790
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12765
12791
|
file,
|
|
12766
12792
|
...positionOf(source)(index),
|
|
12767
|
-
rule: RULE$
|
|
12793
|
+
rule: RULE$29,
|
|
12768
12794
|
message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
|
|
12769
12795
|
})));
|
|
12770
12796
|
});
|
|
@@ -12788,7 +12814,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12788
12814
|
}];
|
|
12789
12815
|
return [];
|
|
12790
12816
|
}));
|
|
12791
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12817
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$13, { concurrency: READ_CONCURRENCY$11 });
|
|
12792
12818
|
return Array.flatten(found);
|
|
12793
12819
|
});
|
|
12794
12820
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12817,7 +12843,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12817
12843
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12818
12844
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12819
12845
|
// src/features/check-documented-commands/model/commands.ts
|
|
12820
|
-
const RULE$
|
|
12846
|
+
const RULE$28 = "documented-commands";
|
|
12821
12847
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12822
12848
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12823
12849
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12836,7 +12862,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12836
12862
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12837
12863
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12838
12864
|
const ONE$1 = 1;
|
|
12839
|
-
const START$
|
|
12865
|
+
const START$16 = 0;
|
|
12840
12866
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12841
12867
|
const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
12842
12868
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12892,11 +12918,11 @@ const whereOf = (scope, file) => {
|
|
|
12892
12918
|
return `the package that holds ${file}`;
|
|
12893
12919
|
};
|
|
12894
12920
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12895
|
-
const problemsIn$
|
|
12921
|
+
const problemsIn$12 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12896
12922
|
file: absolute(file),
|
|
12897
|
-
...positionOf(text)(match.index ?? START$
|
|
12898
|
-
rule: RULE$
|
|
12899
|
-
message: `${match[START$
|
|
12923
|
+
...positionOf(text)(match.index ?? START$16),
|
|
12924
|
+
rule: RULE$28,
|
|
12925
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12900
12926
|
})), Option.toArray)));
|
|
12901
12927
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12902
12928
|
/** @internal */
|
|
@@ -12920,14 +12946,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12920
12946
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12921
12947
|
line: ONE$1,
|
|
12922
12948
|
column: ONE$1,
|
|
12923
|
-
rule: RULE$
|
|
12949
|
+
rule: RULE$28,
|
|
12924
12950
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12925
12951
|
}],
|
|
12926
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
12952
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$12(found, absolute, document)))
|
|
12927
12953
|
});
|
|
12928
12954
|
});
|
|
12929
12955
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12930
|
-
const RULE$
|
|
12956
|
+
const RULE$27 = "legacy-web";
|
|
12931
12957
|
const FIRST_COLUMN$3 = 1;
|
|
12932
12958
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12933
12959
|
const Finding = Schema.Struct({
|
|
@@ -12966,7 +12992,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12966
12992
|
file: files.join(root, file),
|
|
12967
12993
|
line,
|
|
12968
12994
|
column: FIRST_COLUMN$3,
|
|
12969
|
-
rule: RULE$
|
|
12995
|
+
rule: RULE$27,
|
|
12970
12996
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12971
12997
|
});
|
|
12972
12998
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -13037,8 +13063,8 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
|
|
|
13037
13063
|
const EXTENSION = /\.[^./]+$/u;
|
|
13038
13064
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13039
13065
|
const READ_CONCURRENCY$10 = 64;
|
|
13040
|
-
const RULE$
|
|
13041
|
-
const MESSAGE$
|
|
13066
|
+
const RULE$26 = "shell-script";
|
|
13067
|
+
const MESSAGE$11 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
13042
13068
|
const HookSchema = Schema.Struct({
|
|
13043
13069
|
command: Schema.optional(Schema.String),
|
|
13044
13070
|
args: Schema.String.pipe(Schema.Array, Schema.optional)
|
|
@@ -13070,7 +13096,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13070
13096
|
};
|
|
13071
13097
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13072
13098
|
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
13073
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13099
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$26)(files.join(root, name), MESSAGE$11)));
|
|
13074
13100
|
});
|
|
13075
13101
|
// src/shared/lib/workflow-files.ts
|
|
13076
13102
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
@@ -13089,8 +13115,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13089
13115
|
});
|
|
13090
13116
|
// src/shared/lib/workflow-run.ts
|
|
13091
13117
|
const RUN_KEY = "run";
|
|
13092
|
-
const START$
|
|
13093
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
13118
|
+
const START$15 = 0;
|
|
13119
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
13094
13120
|
const runScriptsOf = (source) => {
|
|
13095
13121
|
const found = [];
|
|
13096
13122
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -13105,23 +13131,23 @@ const runScriptsOf = (source) => {
|
|
|
13105
13131
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13106
13132
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13107
13133
|
const COMMENT = "#";
|
|
13108
|
-
const RULE$
|
|
13134
|
+
const RULE$25 = "workflow-script";
|
|
13109
13135
|
const ONE_COMMAND = 1;
|
|
13110
|
-
const MESSAGE$
|
|
13136
|
+
const MESSAGE$10 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
13111
13137
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
13112
13138
|
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
13113
13139
|
const runsMoreThanOneCommand = ({ text }) => {
|
|
13114
13140
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
13115
13141
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
13116
13142
|
};
|
|
13117
|
-
const problemsIn$
|
|
13143
|
+
const problemsIn$11 = (file) => (source) => {
|
|
13118
13144
|
const at = positionOf(source);
|
|
13119
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13145
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$25)(file, at(start), MESSAGE$10)));
|
|
13120
13146
|
};
|
|
13121
13147
|
/** @internal */
|
|
13122
13148
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
13123
13149
|
const workflows = yield* readWorkflows(root);
|
|
13124
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
13150
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$11(file)(source)));
|
|
13125
13151
|
});
|
|
13126
13152
|
// src/features/check-scripts/model/script-checks.ts
|
|
13127
13153
|
/** @internal */
|
|
@@ -13168,6 +13194,8 @@ const FILTER = /^(?:--filter(?:=.*)?|-F)$/u;
|
|
|
13168
13194
|
const TASK_KINDS = ["script", "task"];
|
|
13169
13195
|
const SECOND = 1;
|
|
13170
13196
|
const DOC_KIND = "doc";
|
|
13197
|
+
const NODE = "node";
|
|
13198
|
+
const INLINE_CODE$1 = /^(?:--eval(?:=.*)?|--print(?:=.*)?|-[a-z]*[ep][a-z]*)$/u;
|
|
13171
13199
|
const programOf = (words) => Array.headNonEmpty(words);
|
|
13172
13200
|
const subcommandOf = (words) => Array.get(words, SECOND);
|
|
13173
13201
|
const RULES = [
|
|
@@ -13185,6 +13213,11 @@ const RULES = [
|
|
|
13185
13213
|
rule: "filter-task",
|
|
13186
13214
|
applies: (source, words) => Array.contains(TASK_KINDS, source.kind) && programOf(words) === VITE_PLUS && Option.contains(subcommandOf(words), RUN) && pipe(words, Array.some((word) => FILTER.test(word))),
|
|
13187
13215
|
message: (command) => `\`${command}\` wraps one package's task in another task. Write <package>#<task> in dependsOn instead, so that Vite+ sees the dependency and caches it.`
|
|
13216
|
+
},
|
|
13217
|
+
{
|
|
13218
|
+
rule: "inline-script",
|
|
13219
|
+
applies: (source, words) => source.kind !== DOC_KIND && programOf(words) === NODE && pipe(Array.drop(words, SECOND), Array.some((word) => INLINE_CODE$1.test(word))),
|
|
13220
|
+
message: (command) => `\`${command}\` runs code written inside a command, which gets copied from package to package. Put the code in bin/<name>.ts of the package that owns it, or in a shared package, and run it with node bin/<name>.ts.`
|
|
13188
13221
|
}
|
|
13189
13222
|
];
|
|
13190
13223
|
const problemsOf = (source) => pipe(simpleCommands(source.text), Array.flatMap((words) => pipe(RULES, Array.filter(({ applies }) => applies(source, words)), Array.map(({ rule, message }) => ({
|
|
@@ -13224,7 +13257,7 @@ const docSources = (file) => (source) => {
|
|
|
13224
13257
|
})));
|
|
13225
13258
|
};
|
|
13226
13259
|
// src/features/check-vite-plus/model/command-sources.ts
|
|
13227
|
-
const ROOT_DIRECTORY$
|
|
13260
|
+
const ROOT_DIRECTORY$2 = ".";
|
|
13228
13261
|
const COMMAND_KEY = "command";
|
|
13229
13262
|
const ARGUMENTS_KEY = "args";
|
|
13230
13263
|
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
@@ -13244,7 +13277,7 @@ const AGENT_DOCS = [
|
|
|
13244
13277
|
...EXCLUDED$5
|
|
13245
13278
|
];
|
|
13246
13279
|
const READ_CONCURRENCY$8 = 16;
|
|
13247
|
-
const START$
|
|
13280
|
+
const START$14 = 0;
|
|
13248
13281
|
const FIRST$5 = 1;
|
|
13249
13282
|
const LINE = "\n";
|
|
13250
13283
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -13254,7 +13287,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
13254
13287
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
13255
13288
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13256
13289
|
const NO_SOURCES = [];
|
|
13257
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
13290
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
13258
13291
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
13259
13292
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
13260
13293
|
return {
|
|
@@ -13345,12 +13378,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13345
13378
|
readSources(root, hooks, hookSources),
|
|
13346
13379
|
readSources(root, AGENT_FILES, agentSources),
|
|
13347
13380
|
readSources(root, docs, docSources),
|
|
13348
|
-
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$
|
|
13381
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$2, ...workspaces]))
|
|
13349
13382
|
], { concurrency: "unbounded" });
|
|
13350
13383
|
return Array.flatten(found);
|
|
13351
13384
|
});
|
|
13352
13385
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13353
|
-
const RULE$
|
|
13386
|
+
const RULE$24 = "package-script";
|
|
13354
13387
|
const LIFECYCLE = [
|
|
13355
13388
|
"preinstall",
|
|
13356
13389
|
"install",
|
|
@@ -13373,26 +13406,26 @@ const LIFECYCLE = [
|
|
|
13373
13406
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
13374
13407
|
file,
|
|
13375
13408
|
...position,
|
|
13376
|
-
rule: RULE$
|
|
13409
|
+
rule: RULE$24,
|
|
13377
13410
|
message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
|
|
13378
13411
|
});
|
|
13379
13412
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
13380
13413
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13381
|
-
const RULE$
|
|
13414
|
+
const RULE$23 = "vite-plus-block";
|
|
13382
13415
|
const MARKER = Array.join([
|
|
13383
13416
|
"<!--",
|
|
13384
13417
|
"VITE PLUS START",
|
|
13385
13418
|
"-->"
|
|
13386
13419
|
], "");
|
|
13387
|
-
const MESSAGE$
|
|
13420
|
+
const MESSAGE$9 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
|
|
13388
13421
|
const problemIn = (file) => (source) => {
|
|
13389
13422
|
const index = String$1.indexOf(MARKER)(source);
|
|
13390
13423
|
if (Option.isNone(index)) return Option.none();
|
|
13391
13424
|
return Option.some({
|
|
13392
13425
|
file,
|
|
13393
13426
|
...positionOf(source)(index.value),
|
|
13394
|
-
rule: RULE$
|
|
13395
|
-
message: MESSAGE$
|
|
13427
|
+
rule: RULE$23,
|
|
13428
|
+
message: MESSAGE$9
|
|
13396
13429
|
});
|
|
13397
13430
|
};
|
|
13398
13431
|
/** @internal */
|
|
@@ -13447,11 +13480,11 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13447
13480
|
})
|
|
13448
13481
|
});
|
|
13449
13482
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13450
|
-
const RULE$
|
|
13483
|
+
const RULE$21 = "publish-trigger";
|
|
13451
13484
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13452
13485
|
const MANUAL = "workflow_dispatch";
|
|
13453
13486
|
const TRIGGER_KEY = "on";
|
|
13454
|
-
const MESSAGE$
|
|
13487
|
+
const MESSAGE$7 = "publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Publishing is manual: bump the version in a PR, then dispatch the workflow for the workspace.";
|
|
13455
13488
|
const triggersOf = (node) => {
|
|
13456
13489
|
if (isScalar(node)) return [String(node.value)];
|
|
13457
13490
|
if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
|
|
@@ -13467,19 +13500,19 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13467
13500
|
};
|
|
13468
13501
|
/** @internal */
|
|
13469
13502
|
const checkPublishTrigger = workflowCheck({
|
|
13470
|
-
rule: RULE$
|
|
13471
|
-
message: MESSAGE$
|
|
13503
|
+
rule: RULE$21,
|
|
13504
|
+
message: MESSAGE$7,
|
|
13472
13505
|
offsetsOf: publishTriggerOffsetsOf
|
|
13473
13506
|
});
|
|
13474
13507
|
// src/features/check-workflows/model/release-please.ts
|
|
13475
|
-
const RULE$
|
|
13508
|
+
const RULE$20 = "release-please";
|
|
13476
13509
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13477
13510
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13478
13511
|
const FIRST$4 = 1;
|
|
13479
|
-
const MESSAGE$
|
|
13512
|
+
const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
13480
13513
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13481
|
-
rule: RULE$
|
|
13482
|
-
message: MESSAGE$
|
|
13514
|
+
rule: RULE$20,
|
|
13515
|
+
message: MESSAGE$6,
|
|
13483
13516
|
offsetsOf: scalarKeyOffsets({
|
|
13484
13517
|
name: "uses",
|
|
13485
13518
|
matches: (value) => RELEASE_PLEASE.test(value)
|
|
@@ -13492,8 +13525,8 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13492
13525
|
file: files.join(root, name),
|
|
13493
13526
|
line: FIRST$4,
|
|
13494
13527
|
column: FIRST$4,
|
|
13495
|
-
rule: RULE$
|
|
13496
|
-
message: MESSAGE$
|
|
13528
|
+
rule: RULE$20,
|
|
13529
|
+
message: MESSAGE$6
|
|
13497
13530
|
})));
|
|
13498
13531
|
});
|
|
13499
13532
|
/** @internal */
|
|
@@ -13504,26 +13537,26 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13504
13537
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13505
13538
|
const CONCURRENCY_KEY = "concurrency";
|
|
13506
13539
|
const QUEUE_KEY = "queue";
|
|
13507
|
-
const RULE$
|
|
13508
|
-
const MESSAGE$
|
|
13540
|
+
const RULE$19 = "workflow-queue";
|
|
13541
|
+
const MESSAGE$5 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
13509
13542
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13510
13543
|
/** @internal */
|
|
13511
13544
|
const checkWorkflowQueues = workflowCheck({
|
|
13512
|
-
rule: RULE$
|
|
13513
|
-
message: MESSAGE$
|
|
13545
|
+
rule: RULE$19,
|
|
13546
|
+
message: MESSAGE$5,
|
|
13514
13547
|
offsetsOf: queueOffsetsOf
|
|
13515
13548
|
});
|
|
13516
13549
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13517
|
-
const RULE$
|
|
13550
|
+
const RULE$18 = "workflow-commit";
|
|
13518
13551
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13519
13552
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13520
|
-
const MESSAGE$
|
|
13553
|
+
const MESSAGE$4 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
13521
13554
|
const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source), Array.filter(({ value }) => isScalar(value) && typeof value.value === "string" && pattern.test(value.value)), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap(({ range }) => Option.fromNullishOr(range)), Option.map(([start]) => start), Option.toArray)));
|
|
13522
13555
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13523
13556
|
/** @internal */
|
|
13524
13557
|
const checkWorkflowCommits = workflowCheck({
|
|
13525
|
-
rule: RULE$
|
|
13526
|
-
message: MESSAGE$
|
|
13558
|
+
rule: RULE$18,
|
|
13559
|
+
message: MESSAGE$4,
|
|
13527
13560
|
offsetsOf: commitOffsetsOf
|
|
13528
13561
|
});
|
|
13529
13562
|
// src/features/check-workflows/model/workflow-lint.ts
|
|
@@ -13623,7 +13656,7 @@ const COMMENT_NODES = [
|
|
|
13623
13656
|
"block_comment",
|
|
13624
13657
|
"multiline_comment"
|
|
13625
13658
|
];
|
|
13626
|
-
const START$
|
|
13659
|
+
const START$13 = 0;
|
|
13627
13660
|
const NEXT = 1;
|
|
13628
13661
|
const NONE$1 = [];
|
|
13629
13662
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13673,7 +13706,7 @@ const markupComment = (source) => (node) => {
|
|
|
13673
13706
|
}];
|
|
13674
13707
|
};
|
|
13675
13708
|
const textComments = (grammars, grammar) => (text) => {
|
|
13676
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13709
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
13677
13710
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13678
13711
|
};
|
|
13679
13712
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13709,11 +13742,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
13709
13742
|
}[reader](source);
|
|
13710
13743
|
};
|
|
13711
13744
|
// src/features/ban-comments/model/comments.ts
|
|
13712
|
-
const RULE$
|
|
13745
|
+
const RULE$17 = "comment";
|
|
13713
13746
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13714
13747
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13715
13748
|
const READ_CONCURRENCY$7 = 64;
|
|
13716
|
-
const START$
|
|
13749
|
+
const START$12 = 0;
|
|
13717
13750
|
const READERS$1 = [
|
|
13718
13751
|
[/\.(?:[cm]?jsx?)$/u, "javascript"],
|
|
13719
13752
|
[/\.(?:[cm]?ts)$/u, "typescript"],
|
|
@@ -13745,7 +13778,7 @@ const SHEBANG = "#!";
|
|
|
13745
13778
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
13746
13779
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
13747
13780
|
const DELIMITERS = /^(?:\/\/|\/\*|<!--|<#|#|--)|(?:\*\/|-->|#>)$/gu;
|
|
13748
|
-
const MESSAGE$
|
|
13781
|
+
const MESSAGE$3 = "Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.";
|
|
13749
13782
|
const Patterns = Schema.Array(Schema.String);
|
|
13750
13783
|
const CommentSettings = Schema.Struct({ allow: Patterns });
|
|
13751
13784
|
const MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });
|
|
@@ -13768,17 +13801,17 @@ const shebangReader = (source) => {
|
|
|
13768
13801
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13769
13802
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13770
13803
|
const lineBefore = (source, index) => {
|
|
13771
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13804
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
13772
13805
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13773
13806
|
};
|
|
13774
13807
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13775
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13808
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
13776
13809
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13777
13810
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
13778
13811
|
file,
|
|
13779
13812
|
...positionOf(source)(index),
|
|
13780
|
-
rule: RULE$
|
|
13781
|
-
message: MESSAGE$
|
|
13813
|
+
rule: RULE$17,
|
|
13814
|
+
message: MESSAGE$3
|
|
13782
13815
|
});
|
|
13783
13816
|
const settingsOf = ({ msch, lint }) => ({
|
|
13784
13817
|
allow: pipe(Option.fromUndefinedOr(msch), Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)), Option.match({
|
|
@@ -13826,7 +13859,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13826
13859
|
const toProblem = problemOf$2(file, source);
|
|
13827
13860
|
return Option.match(readerOf(name, source), {
|
|
13828
13861
|
onNone: () => Effect.succeed(NONE),
|
|
13829
|
-
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$
|
|
13862
|
+
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$17)(file, `msch could not read the comments in this file: ${message}`)])))
|
|
13830
13863
|
});
|
|
13831
13864
|
};
|
|
13832
13865
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
@@ -13923,6 +13956,38 @@ const PYTHON = {
|
|
|
13923
13956
|
};
|
|
13924
13957
|
/** @internal */
|
|
13925
13958
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13959
|
+
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13960
|
+
const RULE$16 = "uncataloged-dependency";
|
|
13961
|
+
const OWNED_ELSEWHERE = [
|
|
13962
|
+
"catalog:",
|
|
13963
|
+
"workspace:",
|
|
13964
|
+
"link:",
|
|
13965
|
+
"file:"
|
|
13966
|
+
];
|
|
13967
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
13968
|
+
const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
|
|
13969
|
+
const MESSAGE$2 = "is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.";
|
|
13970
|
+
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13971
|
+
const problemsIn$10 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13972
|
+
file: entry.file,
|
|
13973
|
+
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13974
|
+
rule: RULE$16,
|
|
13975
|
+
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
13976
|
+
})));
|
|
13977
|
+
/** @internal */
|
|
13978
|
+
const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* uncatalogedDependencies(root) {
|
|
13979
|
+
const files = yield* RepositoryFiles;
|
|
13980
|
+
const directories = yield* workspaceDirectories(root);
|
|
13981
|
+
const installed = yield* pipe(directories, Effect.filter((directory) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => !found))));
|
|
13982
|
+
const listed = pipe([ROOT_DIRECTORY$1, ...installed], Array.map((directory) => {
|
|
13983
|
+
const name = files.join(directory, MANIFEST_FILE$3);
|
|
13984
|
+
return {
|
|
13985
|
+
name,
|
|
13986
|
+
file: files.join(root, name)
|
|
13987
|
+
};
|
|
13988
|
+
}));
|
|
13989
|
+
return yield* scanText(listed, problemsIn$10);
|
|
13990
|
+
});
|
|
13926
13991
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13927
13992
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
13928
13993
|
const MANIFEST$2 = /(?:^|\/)package\.json$/u;
|
|
@@ -13938,20 +14003,20 @@ const STALE_RULE = "stale-release-age-exclude";
|
|
|
13938
14003
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
13939
14004
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
13940
14005
|
const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
|
|
13941
|
-
const FieldsSchema
|
|
13942
|
-
const decodeManifest$
|
|
13943
|
-
const decodeFields$
|
|
13944
|
-
const decodeString$
|
|
14006
|
+
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
14007
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
14008
|
+
const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
|
|
14009
|
+
const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
|
|
13945
14010
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13946
|
-
const fieldsOf$
|
|
13947
|
-
const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf$
|
|
14011
|
+
const fieldsOf$1 = (value) => Option.getOrElse(decodeFields$1(value), () => ({}));
|
|
14012
|
+
const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf$1(held)), Array.map((name) => ({
|
|
13948
14013
|
catalog,
|
|
13949
14014
|
name
|
|
13950
14015
|
})));
|
|
13951
|
-
const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(Record.toEntries(fieldsOf$
|
|
14016
|
+
const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(Record.toEntries(fieldsOf$1(settings["catalogs"])), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
|
|
13952
14017
|
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)));
|
|
13953
|
-
const referenceOf = ([name, specifier]) => pipe(decodeString$
|
|
13954
|
-
const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf$
|
|
14018
|
+
const referenceOf = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
|
|
14019
|
+
const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf$1(section), Record.toEntries, Array.flatMap(referenceOf))));
|
|
13955
14020
|
const versionsOf = (raw) => pipe(Option.fromUndefinedOr(raw), Option.map((listed) => pipe(String$1.split(listed, VERSION_SEPARATOR), Array.map(String$1.trim))), Option.getOrElse(() => []));
|
|
13956
14021
|
const isLocked = (keys) => (resolved) => pipe(keys, Array.some((key) => key === resolved || String$1.startsWith(`${resolved}(`)(key)));
|
|
13957
14022
|
const hasPackage = (keys) => (name) => pipe(keys, Array.some(String$1.startsWith(`${name}@`)));
|
|
@@ -13968,17 +14033,17 @@ const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root
|
|
|
13968
14033
|
const files = yield* RepositoryFiles;
|
|
13969
14034
|
const listed = yield* files.listedFiles(root);
|
|
13970
14035
|
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
|
|
13971
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
13972
|
-
const fromOverrides = pipe(fieldsOf$
|
|
14036
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$5(text))), Array.flatMap(referencesIn));
|
|
14037
|
+
const fromOverrides = pipe(fieldsOf$1(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13973
14038
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13974
14039
|
});
|
|
13975
14040
|
const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
|
|
13976
14041
|
onNone: () => FIRST_LINE$2,
|
|
13977
14042
|
onSome: (index) => index + FIRST_LINE$2
|
|
13978
14043
|
}));
|
|
13979
|
-
const quoted
|
|
13980
|
-
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted
|
|
13981
|
-
const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted
|
|
14044
|
+
const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
14045
|
+
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
|
|
14046
|
+
const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\\s*$`, "u");
|
|
13982
14047
|
const problemAt$5 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
13983
14048
|
file,
|
|
13984
14049
|
line: at(needle),
|
|
@@ -14005,10 +14070,15 @@ const findingsIn = Effect.fn("findingsIn")(function* findingsIn(root, file, sett
|
|
|
14005
14070
|
const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCatalogEntries(root) {
|
|
14006
14071
|
const files = yield* RepositoryFiles;
|
|
14007
14072
|
const manifest = yield* workspaceManifest(root);
|
|
14008
|
-
|
|
14073
|
+
const catalogs = yield* Option.match(manifest, {
|
|
14074
|
+
onNone: () => Effect.succeed([]),
|
|
14075
|
+
onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$4), fieldsOf$1(settings))
|
|
14076
|
+
});
|
|
14077
|
+
const uncataloged = yield* Option.match(manifest, {
|
|
14009
14078
|
onNone: () => Effect.succeed([]),
|
|
14010
|
-
onSome: (
|
|
14079
|
+
onSome: () => uncatalogedDependencies(root)
|
|
14011
14080
|
});
|
|
14081
|
+
return [...catalogs, ...uncataloged];
|
|
14012
14082
|
});
|
|
14013
14083
|
// src/features/check-skills/model/skill-entry.ts
|
|
14014
14084
|
const ENTRY_RULE = "unlocked-skill";
|
|
@@ -14017,7 +14087,7 @@ const CONFIG_FILE$1 = "vite.config.ts";
|
|
|
14017
14087
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
14018
14088
|
const SOURCE = "masseater/skills";
|
|
14019
14089
|
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
14020
|
-
const START$
|
|
14090
|
+
const START$11 = 0;
|
|
14021
14091
|
const LOCAL_PREFIX = "./";
|
|
14022
14092
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
14023
14093
|
const Source = Schema.Struct({
|
|
@@ -14030,7 +14100,7 @@ const taggedError$1 = Schema.TaggedError;
|
|
|
14030
14100
|
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14031
14101
|
const problemAt$4 = (rule, file, text) => (anchor, message) => ({
|
|
14032
14102
|
file,
|
|
14033
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
14103
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
14034
14104
|
rule,
|
|
14035
14105
|
message
|
|
14036
14106
|
});
|
|
@@ -14138,7 +14208,7 @@ const GITHUB = "https://github.com/";
|
|
|
14138
14208
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
14139
14209
|
const BLANK = /\s+/u;
|
|
14140
14210
|
const SEPARATOR$2 = "/";
|
|
14141
|
-
const START$
|
|
14211
|
+
const START$10 = 0;
|
|
14142
14212
|
const FIRST$3 = 1;
|
|
14143
14213
|
const READ_CONCURRENCY$5 = 16;
|
|
14144
14214
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
@@ -14148,9 +14218,9 @@ const Frontmatter = Schema.Struct({
|
|
|
14148
14218
|
metadata: Schema.optional(Metadata)
|
|
14149
14219
|
});
|
|
14150
14220
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
14151
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
14221
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
14152
14222
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
14153
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
14223
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
14154
14224
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
14155
14225
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
14156
14226
|
const bodyStart = bodyStartOf(source);
|
|
@@ -14183,11 +14253,11 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
14183
14253
|
})));
|
|
14184
14254
|
const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
14185
14255
|
target,
|
|
14186
|
-
index: found.index ?? START$
|
|
14256
|
+
index: found.index ?? START$10
|
|
14187
14257
|
})), Option.toArray);
|
|
14188
14258
|
const rangeOf$1 = (found) => {
|
|
14189
|
-
const start = found.index ?? START$
|
|
14190
|
-
return [start, start + found[START$
|
|
14259
|
+
const start = found.index ?? START$10;
|
|
14260
|
+
return [start, start + found[START$10].length];
|
|
14191
14261
|
};
|
|
14192
14262
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
14193
14263
|
const linksIn = (source) => {
|
|
@@ -14253,16 +14323,16 @@ const CARGO_SECTIONS = [
|
|
|
14253
14323
|
"dev-dependencies",
|
|
14254
14324
|
"build-dependencies"
|
|
14255
14325
|
];
|
|
14256
|
-
const decodeFields
|
|
14326
|
+
const decodeFields = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
14257
14327
|
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
14258
|
-
const decodeString
|
|
14328
|
+
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
14259
14329
|
const decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));
|
|
14260
|
-
const decodeSpec = (value) => Option.orElse(decodeString
|
|
14330
|
+
const decodeSpec = (value) => Option.orElse(decodeString(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
|
|
14261
14331
|
const PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));
|
|
14262
14332
|
const decodePackageManager = Schema.decodeUnknownOption(PackageManager);
|
|
14263
|
-
const fieldsOf
|
|
14264
|
-
const fieldOf = (name) => (value) => fieldsOf
|
|
14265
|
-
const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf
|
|
14333
|
+
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
14334
|
+
const fieldOf = (name) => (value) => fieldsOf(value)[name];
|
|
14335
|
+
const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
14266
14336
|
key: `${section}:${name}`,
|
|
14267
14337
|
name,
|
|
14268
14338
|
spec
|
|
@@ -14277,15 +14347,15 @@ const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map
|
|
|
14277
14347
|
};
|
|
14278
14348
|
}), Option.toArray);
|
|
14279
14349
|
const manifestEntries = (text) => {
|
|
14280
|
-
const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf
|
|
14350
|
+
const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);
|
|
14281
14351
|
return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
|
|
14282
14352
|
};
|
|
14283
|
-
const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf
|
|
14353
|
+
const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
14284
14354
|
const workspaceEntries = (text) => {
|
|
14285
|
-
const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf
|
|
14355
|
+
const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf);
|
|
14286
14356
|
return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings["catalogs"])];
|
|
14287
14357
|
};
|
|
14288
|
-
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf
|
|
14358
|
+
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
|
|
14289
14359
|
const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
14290
14360
|
key,
|
|
14291
14361
|
name: key,
|
|
@@ -14364,7 +14434,7 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
14364
14434
|
const CAP_RULE = "renovate-version-cap";
|
|
14365
14435
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14366
14436
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14367
|
-
const START$
|
|
14437
|
+
const START$9 = 0;
|
|
14368
14438
|
const READ_CONCURRENCY$3 = 16;
|
|
14369
14439
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14370
14440
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
@@ -14383,7 +14453,7 @@ const problemsIn$7 = (file, source) => {
|
|
|
14383
14453
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
14384
14454
|
...pipe([{
|
|
14385
14455
|
file,
|
|
14386
|
-
...at(START$
|
|
14456
|
+
...at(START$9),
|
|
14387
14457
|
rule: PRESET_RULE,
|
|
14388
14458
|
message: PRESET_MESSAGE
|
|
14389
14459
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -14405,17 +14475,17 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14405
14475
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
14406
14476
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
14407
14477
|
const NUL = "\0";
|
|
14408
|
-
const START$
|
|
14478
|
+
const START$8 = 0;
|
|
14409
14479
|
const HEX = 16;
|
|
14410
14480
|
const CODE_POINT_WIDTH = 4;
|
|
14411
14481
|
const READ_CONCURRENCY$2 = 64;
|
|
14412
14482
|
const RULE$12 = "hidden-unicode";
|
|
14413
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
14483
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$8)(character), Option.getOrElse(() => START$8), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
14414
14484
|
const problemOf$1 = (file, source) => (found) => {
|
|
14415
|
-
const hex = hexOf(found[START$
|
|
14485
|
+
const hex = hexOf(found[START$8]);
|
|
14416
14486
|
return {
|
|
14417
14487
|
file,
|
|
14418
|
-
...positionOf(source)(found.index ?? START$
|
|
14488
|
+
...positionOf(source)(found.index ?? START$8),
|
|
14419
14489
|
rule: RULE$12,
|
|
14420
14490
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
14421
14491
|
};
|
|
@@ -14441,7 +14511,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14441
14511
|
const RULE$11 = "alchemy-patch";
|
|
14442
14512
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
14443
14513
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
14444
|
-
const START$
|
|
14514
|
+
const START$7 = 0;
|
|
14445
14515
|
const problemOf = (file, position, name) => ({
|
|
14446
14516
|
file,
|
|
14447
14517
|
...position,
|
|
@@ -14450,7 +14520,7 @@ const problemOf = (file, position, name) => ({
|
|
|
14450
14520
|
});
|
|
14451
14521
|
const problemsIn$5 = (file, patched) => (source) => {
|
|
14452
14522
|
const at = positionOf(source);
|
|
14453
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
14523
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$7));
|
|
14454
14524
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
14455
14525
|
};
|
|
14456
14526
|
/** @internal */
|
|
@@ -14680,7 +14750,7 @@ const SETUP_PATTERNS = [
|
|
|
14680
14750
|
];
|
|
14681
14751
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14682
14752
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14683
|
-
const START$
|
|
14753
|
+
const START$6 = 0;
|
|
14684
14754
|
const LAST_SEGMENT = 1;
|
|
14685
14755
|
const FIRST_LINE = 1;
|
|
14686
14756
|
const FIRST_COLUMN = 1;
|
|
@@ -14749,7 +14819,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14749
14819
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14750
14820
|
return directoriesOf(roots);
|
|
14751
14821
|
});
|
|
14752
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
14822
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
|
|
14753
14823
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14754
14824
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14755
14825
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14789,7 +14859,7 @@ const RULE$8 = "effect-diagnostics-once";
|
|
|
14789
14859
|
const PLUGIN = "@effect/language-service";
|
|
14790
14860
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14791
14861
|
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14792
|
-
const START$
|
|
14862
|
+
const START$5 = 0;
|
|
14793
14863
|
const Plugin = Schema.Struct({
|
|
14794
14864
|
name: Schema.optional(Schema.String),
|
|
14795
14865
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14802,7 +14872,7 @@ const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics durin
|
|
|
14802
14872
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14803
14873
|
const problemsIn$4 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
14804
14874
|
file: entry.file,
|
|
14805
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14875
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$5))),
|
|
14806
14876
|
rule: RULE$8,
|
|
14807
14877
|
message: MESSAGE$1
|
|
14808
14878
|
})), Option.toArray);
|
|
@@ -14821,41 +14891,23 @@ const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
|
14821
14891
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14822
14892
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14823
14893
|
const PATH_LIKE = "/";
|
|
14824
|
-
const START$5 = 0;
|
|
14825
|
-
const SECTIONS = [
|
|
14826
|
-
"dependencies",
|
|
14827
|
-
"devDependencies",
|
|
14828
|
-
"optionalDependencies"
|
|
14829
|
-
];
|
|
14830
14894
|
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14831
14895
|
const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
|
|
14832
|
-
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
14833
|
-
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
14834
|
-
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
14835
|
-
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
14836
|
-
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
14837
14896
|
const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
|
|
14838
14897
|
/** @internal */
|
|
14839
14898
|
const isRange = (specifier) => {
|
|
14840
14899
|
const version = versionOf(specifier);
|
|
14841
14900
|
return !PROTOCOL.test(version) && !String$1.includes(PATH_LIKE)(version) && semver.valid(version) === null;
|
|
14842
14901
|
};
|
|
14843
|
-
const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString(value), Option.map((specifier) => ({
|
|
14844
|
-
name,
|
|
14845
|
-
specifier
|
|
14846
|
-
})), Option.toArray)));
|
|
14847
|
-
const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
14848
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$5));
|
|
14849
14902
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14850
14903
|
file,
|
|
14851
14904
|
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14852
14905
|
rule: RULE$7,
|
|
14853
14906
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14854
14907
|
})));
|
|
14855
|
-
const
|
|
14856
|
-
const
|
|
14857
|
-
const
|
|
14858
|
-
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14908
|
+
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "mu");
|
|
14909
|
+
const manifestProblems$2 = (entry, source) => problemsFor(entry.file, source, manifestPattern)(manifestSpecifiers(source));
|
|
14910
|
+
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf$2(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14859
14911
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
14860
14912
|
const files = yield* RepositoryFiles;
|
|
14861
14913
|
const file = files.join(root, WORKSPACE_FILE);
|
|
@@ -14864,7 +14916,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14864
14916
|
return pipe(Option.all({
|
|
14865
14917
|
settings,
|
|
14866
14918
|
source
|
|
14867
|
-
}), Option.map(({ settings: held, source: text }) => problemsFor(file, text, catalogPattern)(catalogSpecifiers(fieldsOf(held)))), Option.getOrElse(() => []));
|
|
14919
|
+
}), Option.map(({ settings: held, source: text }) => problemsFor(file, text, catalogPattern)(catalogSpecifiers(fieldsOf$2(held)))), Option.getOrElse(() => []));
|
|
14868
14920
|
});
|
|
14869
14921
|
/** @internal */
|
|
14870
14922
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
@@ -14880,6 +14932,9 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14880
14932
|
});
|
|
14881
14933
|
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14882
14934
|
const RULE$6 = "pack-publint";
|
|
14935
|
+
const PREPUBLISH_RULE = "prepublish-script";
|
|
14936
|
+
const PREPUBLISH_SCRIPT = "prepublishOnly";
|
|
14937
|
+
const PREPUBLISH_COMMAND = "vp exec msch-publish prepublish .";
|
|
14883
14938
|
const CONFIG_FILE = "vite.config.ts";
|
|
14884
14939
|
const PACK_KEY = "pack:";
|
|
14885
14940
|
const START$4 = 0;
|
|
@@ -14887,7 +14942,8 @@ const READ_CONCURRENCY$1 = 16;
|
|
|
14887
14942
|
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14888
14943
|
const Manifest$4 = Schema.Struct({
|
|
14889
14944
|
private: Schema.optional(Schema.Boolean),
|
|
14890
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14945
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
14946
|
+
scripts: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
14891
14947
|
});
|
|
14892
14948
|
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
14893
14949
|
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
@@ -14904,7 +14960,17 @@ const problemFor = (file, source) => ({
|
|
|
14904
14960
|
rule: RULE$6,
|
|
14905
14961
|
message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
|
|
14906
14962
|
});
|
|
14907
|
-
const
|
|
14963
|
+
const publishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.filter(isPublished$2));
|
|
14964
|
+
const prepublishProblems = (file, source, manifest) => {
|
|
14965
|
+
const declared = pipe(Option.fromUndefinedOr(manifest.scripts), Option.flatMap(Record.get(PREPUBLISH_SCRIPT)));
|
|
14966
|
+
if (Option.contains(declared, PREPUBLISH_COMMAND)) return [];
|
|
14967
|
+
return [{
|
|
14968
|
+
file,
|
|
14969
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(`"${PREPUBLISH_SCRIPT}"`)(source), () => START$4)),
|
|
14970
|
+
rule: PREPUBLISH_RULE,
|
|
14971
|
+
message: `This package is published, so its ${PREPUBLISH_SCRIPT} script must be exactly \`${PREPUBLISH_COMMAND}\`. That one command refuses npm publish, which leaves catalog: in dependencies, and builds the package. Writing the guard in each package leaves some packages without it.`
|
|
14972
|
+
}];
|
|
14973
|
+
};
|
|
14908
14974
|
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14909
14975
|
const config = yield* Effect.tryPromise({
|
|
14910
14976
|
try: () => resolveConfigFromFile(configFile),
|
|
@@ -14920,9 +14986,12 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
|
|
|
14920
14986
|
});
|
|
14921
14987
|
const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14922
14988
|
const files = yield* RepositoryFiles;
|
|
14923
|
-
const
|
|
14924
|
-
|
|
14925
|
-
|
|
14989
|
+
const manifestFile = files.join(root, manifestName);
|
|
14990
|
+
const source = yield* files.readFile(manifestFile);
|
|
14991
|
+
const manifest = publishedManifest(source);
|
|
14992
|
+
if (Option.isNone(manifest) || Option.isNone(source)) return [];
|
|
14993
|
+
const config = yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14994
|
+
return [...prepublishProblems(manifestFile, source.value, manifest.value), ...config];
|
|
14926
14995
|
});
|
|
14927
14996
|
/** @internal */
|
|
14928
14997
|
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|