@r_masseater/msch 0.65.1 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs
CHANGED
|
@@ -522,70 +522,70 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
522
522
|
// src/features/check-overrides/model/git-subpath.ts
|
|
523
523
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
524
524
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
525
|
-
const RULE$
|
|
525
|
+
const RULE$64 = "git-subpath-dependency";
|
|
526
526
|
const WHOLE_MATCH$4 = 0;
|
|
527
527
|
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
528
528
|
file,
|
|
529
529
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
530
|
-
rule: RULE$
|
|
530
|
+
rule: RULE$64,
|
|
531
531
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
532
532
|
});
|
|
533
|
-
const problemsIn$
|
|
533
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
|
|
534
534
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
535
535
|
/** @internal */
|
|
536
536
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
537
537
|
const listed = yield* listedFiles(root);
|
|
538
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
538
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$21);
|
|
539
539
|
});
|
|
540
540
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
541
|
-
const RULE$
|
|
541
|
+
const RULE$63 = "unnamed-restriction";
|
|
542
542
|
const WHOLE_MATCH$3 = 0;
|
|
543
543
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
544
|
-
const problemsIn$
|
|
544
|
+
const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
545
545
|
file: entry.file,
|
|
546
546
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
547
|
-
rule: RULE$
|
|
547
|
+
rule: RULE$63,
|
|
548
548
|
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.`
|
|
549
549
|
})));
|
|
550
550
|
/** @internal */
|
|
551
551
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
552
552
|
const listed = yield* listedFiles(root);
|
|
553
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
553
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
|
|
554
554
|
});
|
|
555
555
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
556
|
-
const RULE$
|
|
556
|
+
const RULE$62 = "named-type-exemption";
|
|
557
557
|
const WHOLE_MATCH$2 = 0;
|
|
558
558
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
559
|
-
const problemsIn$
|
|
559
|
+
const problemsIn$19 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
560
560
|
file: entry.file,
|
|
561
561
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
562
|
-
rule: RULE$
|
|
562
|
+
rule: RULE$62,
|
|
563
563
|
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."
|
|
564
564
|
})));
|
|
565
565
|
/** @internal */
|
|
566
566
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
567
567
|
const listed = yield* listedFiles(root);
|
|
568
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
568
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$19);
|
|
569
569
|
});
|
|
570
570
|
// src/features/check-overrides/model/package-registry.ts
|
|
571
|
-
const RULE$
|
|
571
|
+
const RULE$61 = "package-registry";
|
|
572
572
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
573
573
|
const TRAILING_SLASH = /\/$/u;
|
|
574
574
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
575
575
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
576
576
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
577
577
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
578
|
-
const START$
|
|
578
|
+
const START$24 = 0;
|
|
579
579
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
580
580
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
581
581
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
582
582
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
583
583
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
584
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
584
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$24));
|
|
585
585
|
const workspaceProblem = (file, source, registry) => ({
|
|
586
586
|
file,
|
|
587
587
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
588
|
-
rule: RULE$
|
|
588
|
+
rule: RULE$61,
|
|
589
589
|
message: Option.match(registry, {
|
|
590
590
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$4}.`,
|
|
591
591
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -593,9 +593,9 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
593
593
|
});
|
|
594
594
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf("value")(found), isGuarded)), Array.map((found) => ({
|
|
595
595
|
file: entry.file,
|
|
596
|
-
...positionOf(source)(found.index ?? START$
|
|
597
|
-
rule: RULE$
|
|
598
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
596
|
+
...positionOf(source)(found.index ?? START$24),
|
|
597
|
+
rule: RULE$61,
|
|
598
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
|
|
599
599
|
})));
|
|
600
600
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
601
601
|
const files = yield* RepositoryFiles;
|
|
@@ -614,13 +614,13 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
614
614
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
615
615
|
});
|
|
616
616
|
// src/entities/package/model/specifiers.ts
|
|
617
|
-
const START$
|
|
617
|
+
const START$23 = 0;
|
|
618
618
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
619
619
|
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
620
620
|
const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
621
621
|
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
622
622
|
/** @internal */
|
|
623
|
-
const decodeManifest$
|
|
623
|
+
const decodeManifest$8 = (source) => decodeJson$2(source);
|
|
624
624
|
/** @internal */
|
|
625
625
|
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
626
626
|
/** @internal */
|
|
@@ -635,7 +635,7 @@ const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.ra
|
|
|
635
635
|
/** @internal */
|
|
636
636
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
637
637
|
/** @internal */
|
|
638
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
638
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
|
|
639
639
|
const SECTIONS = [
|
|
640
640
|
"dependencies",
|
|
641
641
|
"devDependencies",
|
|
@@ -643,8 +643,33 @@ const SECTIONS = [
|
|
|
643
643
|
];
|
|
644
644
|
/** @internal */
|
|
645
645
|
const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
|
|
646
|
+
// src/entities/package/model/published-manifest.ts
|
|
647
|
+
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
648
|
+
const PublishedManifestSchema = Schema.Struct({
|
|
649
|
+
name: Schema.optional(Schema.String),
|
|
650
|
+
private: Schema.optional(Schema.Boolean),
|
|
651
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
652
|
+
homepage: Schema.optional(Schema.Unknown),
|
|
653
|
+
repository: Schema.optional(Schema.Unknown)
|
|
654
|
+
});
|
|
655
|
+
const decodePublishedManifest = Schema.decodeUnknownOption(Schema.fromJsonString(PublishedManifestSchema));
|
|
656
|
+
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
657
|
+
const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePublishedManifest), Option.filter(isPublished$1));
|
|
658
|
+
/** @internal */
|
|
659
|
+
const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
|
|
660
|
+
const files = yield* RepositoryFiles;
|
|
661
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$8]);
|
|
662
|
+
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
663
|
+
name,
|
|
664
|
+
file: files.join(root, name)
|
|
665
|
+
}))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
|
|
666
|
+
entry,
|
|
667
|
+
source,
|
|
668
|
+
manifest
|
|
669
|
+
})), Option.getOrElse(() => [])));
|
|
670
|
+
});
|
|
646
671
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
647
|
-
const RULE$
|
|
672
|
+
const RULE$60 = "colocated-git-patterns";
|
|
648
673
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
649
674
|
const ROOT$3 = ".";
|
|
650
675
|
const NEGATION$1 = "!";
|
|
@@ -691,7 +716,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
691
716
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
692
717
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
693
718
|
});
|
|
694
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
719
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$60)(entry.file, {
|
|
695
720
|
line: entry.line,
|
|
696
721
|
column: FIRST$22
|
|
697
722
|
}, message);
|
|
@@ -754,7 +779,7 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
754
779
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
755
780
|
});
|
|
756
781
|
// src/features/check-placement/model/colocated-tests.ts
|
|
757
|
-
const RULE$
|
|
782
|
+
const RULE$59 = "colocated-test";
|
|
758
783
|
const FIRST$21 = 1;
|
|
759
784
|
const READ_CONCURRENCY$31 = 64;
|
|
760
785
|
const ROOT_SUBPATH = ".";
|
|
@@ -769,20 +794,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
769
794
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
770
795
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
771
796
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
772
|
-
const EXCLUDED$
|
|
797
|
+
const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
773
798
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
774
799
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
775
|
-
const Manifest$
|
|
800
|
+
const Manifest$6 = Schema.Struct({
|
|
776
801
|
name: Schema.optional(Schema.String),
|
|
777
802
|
exports: Schema.optional(Schema.Unknown)
|
|
778
803
|
});
|
|
779
|
-
const decodeManifest$
|
|
804
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
780
805
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
781
806
|
const problemFor$9 = (test, message) => ({
|
|
782
807
|
file: test.file,
|
|
783
808
|
line: FIRST$21,
|
|
784
809
|
column: FIRST$21,
|
|
785
|
-
rule: RULE$
|
|
810
|
+
rule: RULE$59,
|
|
786
811
|
message: `${test.base} ${message}`
|
|
787
812
|
});
|
|
788
813
|
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);
|
|
@@ -802,7 +827,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
802
827
|
if (Option.isNone(owner)) return [];
|
|
803
828
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
804
829
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
805
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
830
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(specifiersBeside({
|
|
806
831
|
join,
|
|
807
832
|
dirname: files.dirname,
|
|
808
833
|
directory: test.directory
|
|
@@ -830,7 +855,7 @@ const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
|
830
855
|
/** @internal */
|
|
831
856
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
832
857
|
const files = yield* RepositoryFiles;
|
|
833
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
858
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$7);
|
|
834
859
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
835
860
|
const context = {
|
|
836
861
|
root,
|
|
@@ -865,7 +890,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
865
890
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
866
891
|
const RECOMMENDED_LINES = 200;
|
|
867
892
|
const FIRST$20 = 1;
|
|
868
|
-
const RULE$
|
|
893
|
+
const RULE$58 = "agent-docs-length";
|
|
869
894
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
870
895
|
const problemFor$8 = (file) => (lines) => {
|
|
871
896
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -873,14 +898,14 @@ const problemFor$8 = (file) => (lines) => {
|
|
|
873
898
|
file,
|
|
874
899
|
line: 201,
|
|
875
900
|
column: FIRST$20,
|
|
876
|
-
rule: RULE$
|
|
901
|
+
rule: RULE$58,
|
|
877
902
|
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.`
|
|
878
903
|
});
|
|
879
904
|
};
|
|
880
905
|
/** @internal */
|
|
881
906
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
882
907
|
// src/features/check-placement/model/claude-link.ts
|
|
883
|
-
const RULE$
|
|
908
|
+
const RULE$57 = "claude-md-link";
|
|
884
909
|
const CLAUDE = "CLAUDE.md";
|
|
885
910
|
const AGENTS = "AGENTS.md";
|
|
886
911
|
const FIRST$19 = 1;
|
|
@@ -899,7 +924,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
899
924
|
file: path,
|
|
900
925
|
line: FIRST$19,
|
|
901
926
|
column: FIRST$19,
|
|
902
|
-
rule: RULE$
|
|
927
|
+
rule: RULE$57,
|
|
903
928
|
message: MESSAGE$17
|
|
904
929
|
})));
|
|
905
930
|
});
|
|
@@ -908,7 +933,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
908
933
|
return Array.getSomes(found);
|
|
909
934
|
});
|
|
910
935
|
// src/features/check-placement/model/dangling-links.ts
|
|
911
|
-
const RULE$
|
|
936
|
+
const RULE$56 = "dangling-link";
|
|
912
937
|
const SEPARATOR$19 = "/";
|
|
913
938
|
const FIRST$18 = 1;
|
|
914
939
|
const READ_CONCURRENCY$28 = 16;
|
|
@@ -924,7 +949,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
924
949
|
file,
|
|
925
950
|
line: FIRST$18,
|
|
926
951
|
column: FIRST$18,
|
|
927
|
-
rule: RULE$
|
|
952
|
+
rule: RULE$56,
|
|
928
953
|
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.`
|
|
929
954
|
})));
|
|
930
955
|
});
|
|
@@ -935,7 +960,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
935
960
|
const ROOT_WORKSPACE$1 = ".";
|
|
936
961
|
const FIRST$17 = 1;
|
|
937
962
|
const SEPARATOR$18 = "/";
|
|
938
|
-
const EXCLUDED$
|
|
963
|
+
const EXCLUDED$6 = [
|
|
939
964
|
":(exclude,attr:linguist-vendored)",
|
|
940
965
|
":(exclude,attr:linguist-generated)",
|
|
941
966
|
":(exclude,attr:linguist-documentation)"
|
|
@@ -948,7 +973,7 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
948
973
|
const files = yield* RepositoryFiles;
|
|
949
974
|
return {
|
|
950
975
|
workspaces: yield* memberWorkspaces(root),
|
|
951
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$
|
|
976
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$6)
|
|
952
977
|
};
|
|
953
978
|
});
|
|
954
979
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
@@ -982,8 +1007,8 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
982
1007
|
}));
|
|
983
1008
|
});
|
|
984
1009
|
// src/features/check-placement/model/deployed-readme.ts
|
|
985
|
-
const RULE$
|
|
986
|
-
const ROOT_DIRECTORY$
|
|
1010
|
+
const RULE$55 = "deployed-readme";
|
|
1011
|
+
const ROOT_DIRECTORY$4 = "";
|
|
987
1012
|
const READ_CONCURRENCY$27 = 16;
|
|
988
1013
|
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.";
|
|
989
1014
|
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.";
|
|
@@ -1022,14 +1047,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1022
1047
|
const readme = yield* readReadme({
|
|
1023
1048
|
root,
|
|
1024
1049
|
directory,
|
|
1025
|
-
rule: RULE$
|
|
1050
|
+
rule: RULE$55,
|
|
1026
1051
|
missingMessage: MISSING_MESSAGE$2
|
|
1027
1052
|
});
|
|
1028
1053
|
return Result.match(readme, {
|
|
1029
1054
|
onFailure: Option.some,
|
|
1030
1055
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
1031
1056
|
file,
|
|
1032
|
-
rule: RULE$
|
|
1057
|
+
rule: RULE$55,
|
|
1033
1058
|
message: NO_URL_MESSAGE
|
|
1034
1059
|
})))
|
|
1035
1060
|
});
|
|
@@ -1041,12 +1066,12 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
1041
1066
|
const directories = yield* workspaceDirectories(root);
|
|
1042
1067
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
1043
1068
|
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$27 });
|
|
1044
|
-
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$
|
|
1069
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array.dedupe);
|
|
1045
1070
|
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$27 });
|
|
1046
1071
|
return Array.getSomes(found);
|
|
1047
1072
|
});
|
|
1048
1073
|
// src/features/check-placement/model/nested-docs.ts
|
|
1049
|
-
const RULE$
|
|
1074
|
+
const RULE$54 = "nested-docs";
|
|
1050
1075
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
1051
1076
|
const SEPARATOR$17 = "/";
|
|
1052
1077
|
const READ_CONCURRENCY$26 = 64;
|
|
@@ -1059,7 +1084,7 @@ const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Sc
|
|
|
1059
1084
|
const taggedError$6 = Schema.TaggedError;
|
|
1060
1085
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1061
1086
|
const isNested = (name) => String$1.includes(SEPARATOR$17)(name);
|
|
1062
|
-
const problemFor$7 = problemInFile(RULE$
|
|
1087
|
+
const problemFor$7 = problemInFile(RULE$54);
|
|
1063
1088
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1064
1089
|
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.";
|
|
1065
1090
|
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.";
|
|
@@ -1116,7 +1141,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1116
1141
|
return [...Array.getSomes(found), ...missing];
|
|
1117
1142
|
});
|
|
1118
1143
|
// src/features/check-placement/model/published-readme.ts
|
|
1119
|
-
const RULE$
|
|
1144
|
+
const RULE$53 = "published-readme";
|
|
1120
1145
|
const READ_CONCURRENCY$25 = 16;
|
|
1121
1146
|
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1122
1147
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
@@ -1124,7 +1149,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1124
1149
|
const readme = yield* readReadme({
|
|
1125
1150
|
root,
|
|
1126
1151
|
directory,
|
|
1127
|
-
rule: RULE$
|
|
1152
|
+
rule: RULE$53,
|
|
1128
1153
|
missingMessage: MISSING_MESSAGE
|
|
1129
1154
|
});
|
|
1130
1155
|
return Result.match(readme, {
|
|
@@ -1135,7 +1160,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1135
1160
|
file,
|
|
1136
1161
|
line,
|
|
1137
1162
|
column,
|
|
1138
|
-
rule: RULE$
|
|
1163
|
+
rule: RULE$53,
|
|
1139
1164
|
message: MESSAGE$16
|
|
1140
1165
|
};
|
|
1141
1166
|
}))
|
|
@@ -1148,7 +1173,7 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
1148
1173
|
return Array.getSomes(found);
|
|
1149
1174
|
});
|
|
1150
1175
|
// src/features/check-placement/model/published-tests.ts
|
|
1151
|
-
const RULE$
|
|
1176
|
+
const RULE$52 = "published-tests";
|
|
1152
1177
|
const MANIFEST_FILE$2 = "package.json";
|
|
1153
1178
|
const FILE_START = 1;
|
|
1154
1179
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -1163,7 +1188,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1163
1188
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1164
1189
|
line: FILE_START,
|
|
1165
1190
|
column: FILE_START,
|
|
1166
|
-
rule: RULE$
|
|
1191
|
+
rule: RULE$52,
|
|
1167
1192
|
message: MESSAGE$15
|
|
1168
1193
|
});
|
|
1169
1194
|
});
|
|
@@ -1177,7 +1202,7 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1177
1202
|
return Array.getSomes(found);
|
|
1178
1203
|
});
|
|
1179
1204
|
// src/features/check-placement/model/root-docs.ts
|
|
1180
|
-
const RULE$
|
|
1205
|
+
const RULE$51 = "root-docs";
|
|
1181
1206
|
const SEPARATOR$16 = "/";
|
|
1182
1207
|
const FIRST$16 = 1;
|
|
1183
1208
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
@@ -1192,15 +1217,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1192
1217
|
file: files.join(root, name),
|
|
1193
1218
|
line: FIRST$16,
|
|
1194
1219
|
column: FIRST$16,
|
|
1195
|
-
rule: RULE$
|
|
1220
|
+
rule: RULE$51,
|
|
1196
1221
|
message: `${name} ${MESSAGE$14}`
|
|
1197
1222
|
})));
|
|
1198
1223
|
});
|
|
1199
1224
|
// src/features/check-placement/model/root-readme.ts
|
|
1200
|
-
const RULE$
|
|
1225
|
+
const RULE$50 = "root-readme";
|
|
1201
1226
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1202
1227
|
const READ_CONCURRENCY$24 = 16;
|
|
1203
|
-
const START$
|
|
1228
|
+
const START$22 = 0;
|
|
1204
1229
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1205
1230
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1206
1231
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -1214,7 +1239,7 @@ const NO_PLUGINS = {
|
|
|
1214
1239
|
names: []
|
|
1215
1240
|
};
|
|
1216
1241
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1217
|
-
const messageFor = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1242
|
+
const messageFor$1 = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1218
1243
|
const pluginsOf = (plugins) => {
|
|
1219
1244
|
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
|
|
1220
1245
|
const segments = pipe(directories, Array.map(baseName));
|
|
@@ -1237,17 +1262,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1237
1262
|
onNone: () => ownNames(plugins, names),
|
|
1238
1263
|
onSome: () => [directory]
|
|
1239
1264
|
}));
|
|
1240
|
-
const problemsIn$
|
|
1241
|
-
const message = messageFor(workspace.directory);
|
|
1265
|
+
const problemsIn$18 = (file, source, plugins) => (workspace) => {
|
|
1266
|
+
const message = messageFor$1(workspace.directory);
|
|
1242
1267
|
const at = positionOf(source);
|
|
1243
1268
|
const pattern = patternFor(plugins)(workspace);
|
|
1244
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1269
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$50)(file, at(found.index ?? START$22), message)));
|
|
1245
1270
|
};
|
|
1246
1271
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1247
1272
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1248
1273
|
return pipe(text, Option.match({
|
|
1249
1274
|
onNone: () => [],
|
|
1250
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1275
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$18(file, source, plugins)))
|
|
1251
1276
|
}));
|
|
1252
1277
|
});
|
|
1253
1278
|
/** @internal */
|
|
@@ -1278,7 +1303,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1278
1303
|
return Array.flatten(found);
|
|
1279
1304
|
});
|
|
1280
1305
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1281
|
-
const RULE$
|
|
1306
|
+
const RULE$49 = "docs-mirror";
|
|
1282
1307
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1283
1308
|
const MIRROR_LIMIT = 3;
|
|
1284
1309
|
const READ_CONCURRENCY$23 = 16;
|
|
@@ -1303,7 +1328,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
1303
1328
|
file,
|
|
1304
1329
|
line,
|
|
1305
1330
|
column,
|
|
1306
|
-
rule: RULE$
|
|
1331
|
+
rule: RULE$49,
|
|
1307
1332
|
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.`
|
|
1308
1333
|
};
|
|
1309
1334
|
}), Option.toArray);
|
|
@@ -1335,7 +1360,7 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1335
1360
|
return Array.flatten(found);
|
|
1336
1361
|
});
|
|
1337
1362
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1338
|
-
const RULE$
|
|
1363
|
+
const RULE$48 = "ignored-sources";
|
|
1339
1364
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1340
1365
|
const FIRST$15 = 1;
|
|
1341
1366
|
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.";
|
|
@@ -1347,7 +1372,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1347
1372
|
file: files.join(root, file),
|
|
1348
1373
|
line: FIRST$15,
|
|
1349
1374
|
column: FIRST$15,
|
|
1350
|
-
rule: RULE$
|
|
1375
|
+
rule: RULE$48,
|
|
1351
1376
|
message: MESSAGE$13
|
|
1352
1377
|
})));
|
|
1353
1378
|
});
|
|
@@ -9992,7 +10017,7 @@ const LAYER_ITEMS = [
|
|
|
9992
10017
|
"inner_attribute_item"
|
|
9993
10018
|
];
|
|
9994
10019
|
const READ_CONCURRENCY$22 = 64;
|
|
9995
|
-
const EXCLUDED$
|
|
10020
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9996
10021
|
const NONE$1 = [];
|
|
9997
10022
|
const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
|
|
9998
10023
|
const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
|
|
@@ -10053,7 +10078,7 @@ const isRead = ({ inner }) => {
|
|
|
10053
10078
|
};
|
|
10054
10079
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
10055
10080
|
const files = yield* RepositoryFiles;
|
|
10056
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
10081
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$5);
|
|
10057
10082
|
const owner = crateOf(crateDirectories(listed));
|
|
10058
10083
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
10059
10084
|
...owned,
|
|
@@ -10071,13 +10096,13 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10071
10096
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10072
10097
|
});
|
|
10073
10098
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10074
|
-
const RULE$
|
|
10099
|
+
const RULE$47 = "shadcn-ui-alias";
|
|
10075
10100
|
const FIRST$14 = 1;
|
|
10076
10101
|
const problemOf$8 = (directory, { file, alias }) => ({
|
|
10077
10102
|
file,
|
|
10078
10103
|
line: FIRST$14,
|
|
10079
10104
|
column: FIRST$14,
|
|
10080
|
-
rule: RULE$
|
|
10105
|
+
rule: RULE$47,
|
|
10081
10106
|
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/*".`
|
|
10082
10107
|
});
|
|
10083
10108
|
/** @internal */
|
|
@@ -10097,8 +10122,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
10097
10122
|
const SOURCE_TARGET = "./src/*";
|
|
10098
10123
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10099
10124
|
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.`;
|
|
10100
|
-
const Manifest$
|
|
10101
|
-
const decodeManifest$
|
|
10125
|
+
const Manifest$5 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10126
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
10102
10127
|
const targetsOf = (target) => {
|
|
10103
10128
|
if (Predicate.isString(target)) return [target];
|
|
10104
10129
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10109,7 +10134,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10109
10134
|
const files = yield* RepositoryFiles;
|
|
10110
10135
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10111
10136
|
const text = yield* files.readFile(manifest);
|
|
10112
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10137
|
+
return pipe(text, Option.flatMap(decodeManifest$6), 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}`)));
|
|
10113
10138
|
});
|
|
10114
10139
|
/** @internal */
|
|
10115
10140
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10147,12 +10172,12 @@ const FIRST$13 = 1;
|
|
|
10147
10172
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
10148
10173
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
10149
10174
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
10150
|
-
const Manifest$
|
|
10175
|
+
const Manifest$4 = Schema.Struct({
|
|
10151
10176
|
bin: Schema.optional(Schema.Unknown),
|
|
10152
10177
|
main: Schema.optional(Schema.Unknown),
|
|
10153
10178
|
exports: Schema.optional(Schema.Unknown)
|
|
10154
10179
|
});
|
|
10155
|
-
const decodeManifest$
|
|
10180
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
10156
10181
|
const NO_ENTRIES = {
|
|
10157
10182
|
all: [],
|
|
10158
10183
|
bins: []
|
|
@@ -10177,7 +10202,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
10177
10202
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10178
10203
|
const files = yield* RepositoryFiles;
|
|
10179
10204
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10180
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10205
|
+
return pipe(text, Option.flatMap(decodeManifest$5), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10181
10206
|
});
|
|
10182
10207
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10183
10208
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -10200,7 +10225,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10200
10225
|
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.`
|
|
10201
10226
|
})));
|
|
10202
10227
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10203
|
-
const problemsIn$
|
|
10228
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10204
10229
|
const files = yield* RepositoryFiles;
|
|
10205
10230
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10206
10231
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10239,12 +10264,12 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10239
10264
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10240
10265
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10241
10266
|
const workflows = yield* workflowText(root);
|
|
10242
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10267
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$17(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
|
|
10243
10268
|
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
10244
10269
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10245
10270
|
});
|
|
10246
10271
|
// src/features/check-repository-layout/model/crates.ts
|
|
10247
|
-
const RULE$
|
|
10272
|
+
const RULE$46 = "unverified-crate";
|
|
10248
10273
|
const VERSION_RULE = "release-version";
|
|
10249
10274
|
const MANIFEST_FILE$1 = "package.json";
|
|
10250
10275
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
@@ -10258,7 +10283,7 @@ const problemFor$4 = (crate, message) => ({
|
|
|
10258
10283
|
file: crate.manifest,
|
|
10259
10284
|
line: FIRST$12,
|
|
10260
10285
|
column: FIRST$12,
|
|
10261
|
-
rule: RULE$
|
|
10286
|
+
rule: RULE$46,
|
|
10262
10287
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10263
10288
|
});
|
|
10264
10289
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10294,7 +10319,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10294
10319
|
return Array.getSomes(Array.flatten(found));
|
|
10295
10320
|
});
|
|
10296
10321
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10297
|
-
const RULE$
|
|
10322
|
+
const RULE$45 = "deploy-entry-pattern";
|
|
10298
10323
|
const FALLOW_KEYS = [
|
|
10299
10324
|
"entry",
|
|
10300
10325
|
"entryPoints",
|
|
@@ -10349,7 +10374,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10349
10374
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10350
10375
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10351
10376
|
});
|
|
10352
|
-
const problemsIn$
|
|
10377
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10353
10378
|
const { root, file, kind, workspaces, entries } = request;
|
|
10354
10379
|
const files = yield* RepositoryFiles;
|
|
10355
10380
|
const path = files.join(root, file);
|
|
@@ -10365,7 +10390,7 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10365
10390
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10366
10391
|
file: path,
|
|
10367
10392
|
...positionOf(text.value)(start - kind.offset),
|
|
10368
|
-
rule: RULE$
|
|
10393
|
+
rule: RULE$45,
|
|
10369
10394
|
message: `${pattern} ${MESSAGE$12}`
|
|
10370
10395
|
})));
|
|
10371
10396
|
});
|
|
@@ -10388,7 +10413,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10388
10413
|
}];
|
|
10389
10414
|
return [];
|
|
10390
10415
|
}));
|
|
10391
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10416
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$16({
|
|
10392
10417
|
root,
|
|
10393
10418
|
file,
|
|
10394
10419
|
kind,
|
|
@@ -10398,7 +10423,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10398
10423
|
return Array.flatten(found);
|
|
10399
10424
|
});
|
|
10400
10425
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10401
|
-
const RULE$
|
|
10426
|
+
const RULE$44 = "listed-entry";
|
|
10402
10427
|
const ENTRY_KEYS = [
|
|
10403
10428
|
"entry",
|
|
10404
10429
|
"entryPoints",
|
|
@@ -10419,7 +10444,7 @@ const entryPatternsIn = (node) => {
|
|
|
10419
10444
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10420
10445
|
};
|
|
10421
10446
|
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);
|
|
10422
|
-
const problemsIn$
|
|
10447
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10423
10448
|
const files = yield* RepositoryFiles;
|
|
10424
10449
|
const path = files.join(root, file);
|
|
10425
10450
|
const text = yield* files.readFile(path);
|
|
@@ -10428,7 +10453,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10428
10453
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10429
10454
|
file: path,
|
|
10430
10455
|
...positionOf(text.value)(start),
|
|
10431
|
-
rule: RULE$
|
|
10456
|
+
rule: RULE$44,
|
|
10432
10457
|
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.`
|
|
10433
10458
|
})));
|
|
10434
10459
|
});
|
|
@@ -10436,11 +10461,11 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10436
10461
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10437
10462
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10438
10463
|
const directories = yield* workspaceDirectories(root);
|
|
10439
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10464
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$15(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
|
|
10440
10465
|
return Array.flatten(found);
|
|
10441
10466
|
});
|
|
10442
10467
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10443
|
-
const RULE$
|
|
10468
|
+
const RULE$43 = "root-workspace-path";
|
|
10444
10469
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10445
10470
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10446
10471
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -10456,10 +10481,10 @@ const mentions = (directory) => (text) => {
|
|
|
10456
10481
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10457
10482
|
}));
|
|
10458
10483
|
};
|
|
10459
|
-
const problemsIn$
|
|
10484
|
+
const problemsIn$14 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10460
10485
|
file,
|
|
10461
10486
|
...positionOf(source)(found.start),
|
|
10462
|
-
rule: RULE$
|
|
10487
|
+
rule: RULE$43,
|
|
10463
10488
|
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.`
|
|
10464
10489
|
})));
|
|
10465
10490
|
/** @internal */
|
|
@@ -10470,10 +10495,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10470
10495
|
if (Option.isNone(source)) return [];
|
|
10471
10496
|
const directories = yield* workspaceDirectories(root);
|
|
10472
10497
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10473
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10498
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$14(file, source.value, directories)));
|
|
10474
10499
|
});
|
|
10475
10500
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10476
|
-
const RULE$
|
|
10501
|
+
const RULE$42 = "hidden-verify";
|
|
10477
10502
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10478
10503
|
const FIRST$10 = 1;
|
|
10479
10504
|
const READ_CONCURRENCY$17 = 8;
|
|
@@ -10487,7 +10512,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10487
10512
|
file,
|
|
10488
10513
|
line: FIRST$10,
|
|
10489
10514
|
column: FIRST$10,
|
|
10490
|
-
rule: RULE$
|
|
10515
|
+
rule: RULE$42,
|
|
10491
10516
|
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}.`
|
|
10492
10517
|
}).pipe(Option.filter(() => verified));
|
|
10493
10518
|
});
|
|
@@ -10498,7 +10523,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
10498
10523
|
return Array.getSomes(found);
|
|
10499
10524
|
});
|
|
10500
10525
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10501
|
-
const RULE$
|
|
10526
|
+
const RULE$41 = "shared-uncached-task";
|
|
10502
10527
|
const READ_CONCURRENCY$16 = 8;
|
|
10503
10528
|
const SHARED = 2;
|
|
10504
10529
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -10541,7 +10566,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
10541
10566
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10542
10567
|
file,
|
|
10543
10568
|
...position,
|
|
10544
|
-
rule: RULE$
|
|
10569
|
+
rule: RULE$41,
|
|
10545
10570
|
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.`
|
|
10546
10571
|
})));
|
|
10547
10572
|
};
|
|
@@ -10552,7 +10577,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
10552
10577
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10553
10578
|
});
|
|
10554
10579
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10555
|
-
const RULE$
|
|
10580
|
+
const RULE$40 = "unlocked-task";
|
|
10556
10581
|
const READ_CONCURRENCY$15 = 8;
|
|
10557
10582
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10558
10583
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -10564,7 +10589,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10564
10589
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10565
10590
|
file,
|
|
10566
10591
|
...positionOf(source)(task.start),
|
|
10567
|
-
rule: RULE$
|
|
10592
|
+
rule: RULE$40,
|
|
10568
10593
|
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.`
|
|
10569
10594
|
})), Option.toArray)));
|
|
10570
10595
|
/** @internal */
|
|
@@ -10719,7 +10744,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10719
10744
|
/** @internal */
|
|
10720
10745
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10721
10746
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10722
|
-
const RULE$
|
|
10747
|
+
const RULE$39 = "workflow-path";
|
|
10723
10748
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10724
10749
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10725
10750
|
const READ_CONCURRENCY$14 = 8;
|
|
@@ -10785,10 +10810,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10785
10810
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10786
10811
|
file,
|
|
10787
10812
|
...positionOf(source)(found.offset),
|
|
10788
|
-
rule: RULE$
|
|
10813
|
+
rule: RULE$39,
|
|
10789
10814
|
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.`
|
|
10790
10815
|
});
|
|
10791
|
-
const problemsIn$
|
|
10816
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10792
10817
|
const files = yield* RepositoryFiles;
|
|
10793
10818
|
const file = files.join(root, workflow);
|
|
10794
10819
|
const source = yield* files.readFile(file);
|
|
@@ -10800,7 +10825,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10800
10825
|
/** @internal */
|
|
10801
10826
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10802
10827
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10803
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10828
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$14 });
|
|
10804
10829
|
return Array.flatten(found);
|
|
10805
10830
|
});
|
|
10806
10831
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10811,7 +10836,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10811
10836
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10812
10837
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10813
10838
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10814
|
-
const START$
|
|
10839
|
+
const START$21 = 0;
|
|
10815
10840
|
const READ_CONCURRENCY$13 = 8;
|
|
10816
10841
|
const SEPARATOR$8 = "/";
|
|
10817
10842
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
@@ -10842,7 +10867,7 @@ const namesIn$1 = (name, source) => {
|
|
|
10842
10867
|
return [
|
|
10843
10868
|
{
|
|
10844
10869
|
text: name,
|
|
10845
|
-
offset: START$
|
|
10870
|
+
offset: START$21
|
|
10846
10871
|
},
|
|
10847
10872
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10848
10873
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -11028,7 +11053,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
11028
11053
|
peerDependencies: DependencyMap,
|
|
11029
11054
|
peerDependenciesMeta: PeerMeta
|
|
11030
11055
|
});
|
|
11031
|
-
const decodeManifest$
|
|
11056
|
+
const decodeManifest$4 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11032
11057
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11033
11058
|
const installedNames = (manifest) => [
|
|
11034
11059
|
...keysOf(manifest.dependencies),
|
|
@@ -11038,7 +11063,7 @@ const installedNames = (manifest) => [
|
|
|
11038
11063
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11039
11064
|
const files = yield* RepositoryFiles;
|
|
11040
11065
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11041
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11066
|
+
return pipe(text, Option.flatMap(decodeManifest$4), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11042
11067
|
});
|
|
11043
11068
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11044
11069
|
const files = yield* RepositoryFiles;
|
|
@@ -11100,11 +11125,11 @@ const LISTED_LARGEST = 5;
|
|
|
11100
11125
|
const SIZE_CONCURRENCY = 32;
|
|
11101
11126
|
const MEGABYTE = 1e6;
|
|
11102
11127
|
const MEGABYTE_DIGITS = 1;
|
|
11103
|
-
const START$
|
|
11128
|
+
const START$20 = 0;
|
|
11104
11129
|
const SINGLE_ENTRY = 1;
|
|
11105
11130
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11106
11131
|
const usageHint = (dependency, entryCount) => {
|
|
11107
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11132
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$20 && dependency.entries.length < entryCount)) return "";
|
|
11108
11133
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11109
11134
|
};
|
|
11110
11135
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11113,7 +11138,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11113
11138
|
const { workspace, total } = overrun;
|
|
11114
11139
|
const config = yield* files.readFile(workspace.configFile);
|
|
11115
11140
|
const source = Option.getOrElse(config, () => "");
|
|
11116
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11141
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$20);
|
|
11117
11142
|
return {
|
|
11118
11143
|
file: workspace.configFile,
|
|
11119
11144
|
...positionOf(source)(index),
|
|
@@ -11130,7 +11155,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11130
11155
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11131
11156
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11132
11157
|
const sizes = HashMap.fromIterable(measured);
|
|
11133
|
-
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11158
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$20)), Number$1.sumAll);
|
|
11134
11159
|
return {
|
|
11135
11160
|
closures,
|
|
11136
11161
|
sizeOf,
|
|
@@ -11163,11 +11188,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11163
11188
|
})];
|
|
11164
11189
|
});
|
|
11165
11190
|
const stackProblems = (file, source, dependencies) => {
|
|
11166
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
11191
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$20);
|
|
11167
11192
|
const rest = String$1.slice(section)(source);
|
|
11168
11193
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11169
11194
|
file,
|
|
11170
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11195
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
|
|
11171
11196
|
rule: STACK_DEPENDENCY,
|
|
11172
11197
|
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.`
|
|
11173
11198
|
})));
|
|
@@ -11302,14 +11327,14 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
|
|
|
11302
11327
|
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11303
11328
|
});
|
|
11304
11329
|
// src/features/check-tree-shaking/model/manifest.ts
|
|
11305
|
-
const Manifest$
|
|
11330
|
+
const Manifest$3 = Schema.Struct({
|
|
11306
11331
|
name: Schema.optional(Schema.String),
|
|
11307
11332
|
exports: Schema.optional(Schema.Unknown),
|
|
11308
11333
|
bin: Schema.optional(Schema.Unknown),
|
|
11309
11334
|
sideEffects: Schema.optional(Schema.Unknown),
|
|
11310
11335
|
dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
11311
11336
|
});
|
|
11312
|
-
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$
|
|
11337
|
+
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$3));
|
|
11313
11338
|
const manifestOf$1 = (text) => decode(text);
|
|
11314
11339
|
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
11315
11340
|
const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
|
|
@@ -11336,19 +11361,19 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11336
11361
|
};
|
|
11337
11362
|
};
|
|
11338
11363
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11339
|
-
const RULE$
|
|
11340
|
-
const START$
|
|
11364
|
+
const RULE$38 = "optional-peer";
|
|
11365
|
+
const START$19 = 0;
|
|
11341
11366
|
const SINGLE = 1;
|
|
11342
11367
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11343
11368
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11344
11369
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11345
11370
|
const problemFor$3 = (located, name, importers) => {
|
|
11346
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$
|
|
11371
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$19);
|
|
11347
11372
|
const rest = String$1.slice(section)(located.source);
|
|
11348
11373
|
return {
|
|
11349
11374
|
file: located.file,
|
|
11350
|
-
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11351
|
-
rule: RULE$
|
|
11375
|
+
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
|
|
11376
|
+
rule: RULE$38,
|
|
11352
11377
|
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.`
|
|
11353
11378
|
};
|
|
11354
11379
|
};
|
|
@@ -11359,14 +11384,14 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11359
11384
|
return pipe(keysOf(dependencies), Array.flatMap((name) => {
|
|
11360
11385
|
const importers = pipe(libraries, Array.filter(importsPackage(name)));
|
|
11361
11386
|
const neededByBin = pipe(bins, Array.some(importsPackage(name)));
|
|
11362
|
-
if (!(importers.length > START$
|
|
11387
|
+
if (!(importers.length > START$19 && importers.length < libraries.length) || neededByBin) return [];
|
|
11363
11388
|
return [problemFor$3(located, name, importers)];
|
|
11364
11389
|
}));
|
|
11365
11390
|
};
|
|
11366
11391
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11367
|
-
const RULE$
|
|
11392
|
+
const RULE$37 = "side-effects";
|
|
11368
11393
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11369
|
-
const START$
|
|
11394
|
+
const START$18 = 0;
|
|
11370
11395
|
const FIRST$8 = 1;
|
|
11371
11396
|
const LISTED_PACKAGES = 4;
|
|
11372
11397
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
@@ -11390,7 +11415,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
11390
11415
|
label: entry.label,
|
|
11391
11416
|
member,
|
|
11392
11417
|
...extra
|
|
11393
|
-
}, ({ modules }) => modules > START$
|
|
11418
|
+
}, ({ modules }) => modules > START$18);
|
|
11394
11419
|
});
|
|
11395
11420
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
11396
11421
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -11412,15 +11437,15 @@ const othersOf = (total) => {
|
|
|
11412
11437
|
};
|
|
11413
11438
|
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.`;
|
|
11414
11439
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
11415
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
11440
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$18));
|
|
11416
11441
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11417
11442
|
file,
|
|
11418
11443
|
...positionOf(source)(keyIndex$1(source)),
|
|
11419
|
-
rule: RULE$
|
|
11444
|
+
rule: RULE$37,
|
|
11420
11445
|
message: messageOf$4(worst, excesses.length)
|
|
11421
11446
|
})), Option.toArray);
|
|
11422
11447
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11423
|
-
const RULE$
|
|
11448
|
+
const RULE$36 = "top-level-effect";
|
|
11424
11449
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11425
11450
|
const READ_CONCURRENCY$12 = 16;
|
|
11426
11451
|
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.";
|
|
@@ -11433,10 +11458,10 @@ const messageOf$3 = (statement) => {
|
|
|
11433
11458
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
11434
11459
|
return STATEMENT_MESSAGE;
|
|
11435
11460
|
};
|
|
11436
|
-
const problemsIn$
|
|
11461
|
+
const problemsIn$12 = (api) => (file) => (source) => {
|
|
11437
11462
|
const retained = api.createSourceFile(file, source);
|
|
11438
11463
|
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$7({
|
|
11439
|
-
rule: RULE$
|
|
11464
|
+
rule: RULE$36,
|
|
11440
11465
|
message: messageOf$3(statement)
|
|
11441
11466
|
})(statement)));
|
|
11442
11467
|
retained.dispose();
|
|
@@ -11449,7 +11474,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11449
11474
|
const names = yield* files.ownedFiles(root);
|
|
11450
11475
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11451
11476
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11452
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
11477
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$12(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
|
|
11453
11478
|
return Array.flatten(found);
|
|
11454
11479
|
}, Effect.scoped);
|
|
11455
11480
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11560,7 +11585,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11560
11585
|
return Array.flatten(found);
|
|
11561
11586
|
});
|
|
11562
11587
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11563
|
-
const RULE$
|
|
11588
|
+
const RULE$35 = "legacy-typescript";
|
|
11564
11589
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11565
11590
|
const COMPILER = "typescript";
|
|
11566
11591
|
const CURRENT_MAJOR = 7;
|
|
@@ -11591,12 +11616,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11591
11616
|
file,
|
|
11592
11617
|
line: lineOf$2(source)(legacy.id),
|
|
11593
11618
|
column: FIRST$7,
|
|
11594
|
-
rule: RULE$
|
|
11619
|
+
rule: RULE$35,
|
|
11595
11620
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11596
11621
|
})));
|
|
11597
11622
|
});
|
|
11598
11623
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11599
|
-
const RULE$
|
|
11624
|
+
const RULE$34 = "worker-bundle";
|
|
11600
11625
|
const BUNDLE_CONCURRENCY = 4;
|
|
11601
11626
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11602
11627
|
const CONDITIONS = [
|
|
@@ -11607,7 +11632,7 @@ const CONDITIONS = [
|
|
|
11607
11632
|
"module",
|
|
11608
11633
|
"default"
|
|
11609
11634
|
];
|
|
11610
|
-
const problemFor$2 = problemInFile(RULE$
|
|
11635
|
+
const problemFor$2 = problemInFile(RULE$34);
|
|
11611
11636
|
const problemOf$6 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11612
11637
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11613
11638
|
const built = yield* Effect.tryPromise({
|
|
@@ -11731,7 +11756,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11731
11756
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11732
11757
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11733
11758
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11734
|
-
const RULE$
|
|
11759
|
+
const RULE$33 = "hand-written-names";
|
|
11735
11760
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11736
11761
|
const nameListOf = (site) => {
|
|
11737
11762
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11746,7 +11771,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11746
11771
|
file,
|
|
11747
11772
|
line,
|
|
11748
11773
|
column,
|
|
11749
|
-
rule: RULE$
|
|
11774
|
+
rule: RULE$33,
|
|
11750
11775
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11751
11776
|
});
|
|
11752
11777
|
const problemOf$5 = ({ list, reason }) => listedProblem({
|
|
@@ -12427,13 +12452,13 @@ const MANIFEST$3 = "package.json";
|
|
|
12427
12452
|
const SEPARATOR$5 = "/";
|
|
12428
12453
|
const FIRST_SEGMENT = 1;
|
|
12429
12454
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12430
|
-
const decodeManifest$
|
|
12455
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(ManifestJson);
|
|
12431
12456
|
const prefixesOf = (file) => {
|
|
12432
12457
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12433
12458
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12434
12459
|
};
|
|
12435
12460
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12436
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12461
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$3), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12437
12462
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12438
12463
|
const files = yield* RepositoryFiles;
|
|
12439
12464
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12545,7 +12570,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12545
12570
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12546
12571
|
}, Effect.scoped);
|
|
12547
12572
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12548
|
-
const RULE$
|
|
12573
|
+
const RULE$32 = "namespace-destructuring";
|
|
12549
12574
|
const LOCAL = /^[.#/]/u;
|
|
12550
12575
|
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.`;
|
|
12551
12576
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12561,7 +12586,7 @@ const destructuredName = (declaration) => {
|
|
|
12561
12586
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12562
12587
|
};
|
|
12563
12588
|
const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
12564
|
-
rule: RULE$
|
|
12589
|
+
rule: RULE$32,
|
|
12565
12590
|
message: messageOf$1(name)
|
|
12566
12591
|
})), Option.map((report) => report(declaration)));
|
|
12567
12592
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12569,7 +12594,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12569
12594
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$4(names)), Array.getSomes);
|
|
12570
12595
|
};
|
|
12571
12596
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12572
|
-
const RULE$
|
|
12597
|
+
const RULE$31 = "pass-through-wrapper";
|
|
12573
12598
|
const SINGLE_STATEMENT = 1;
|
|
12574
12599
|
const SINGLE_DECLARATION = 1;
|
|
12575
12600
|
const THIS_PARAMETER = "this";
|
|
@@ -12666,7 +12691,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12666
12691
|
const problemOf$3 = (checker) => (candidate) => {
|
|
12667
12692
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12668
12693
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
12669
|
-
rule: RULE$
|
|
12694
|
+
rule: RULE$31,
|
|
12670
12695
|
message: messageOf(forward.callee.getText())
|
|
12671
12696
|
})(candidate.name)));
|
|
12672
12697
|
};
|
|
@@ -12692,7 +12717,7 @@ var plugins = [{
|
|
|
12692
12717
|
"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."
|
|
12693
12718
|
}];
|
|
12694
12719
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12695
|
-
const RULE$
|
|
12720
|
+
const RULE$30 = "known-plugins";
|
|
12696
12721
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12697
12722
|
const GITHUB$2 = "github";
|
|
12698
12723
|
const Source$1 = Schema.Struct({
|
|
@@ -12710,7 +12735,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12710
12735
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12711
12736
|
const MARKETPLACE = name;
|
|
12712
12737
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12713
|
-
const problem$1 = problemInFile(RULE$
|
|
12738
|
+
const problem$1 = problemInFile(RULE$30);
|
|
12714
12739
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12715
12740
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12716
12741
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12731,20 +12756,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12731
12756
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12732
12757
|
});
|
|
12733
12758
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12734
|
-
const RULE$
|
|
12759
|
+
const RULE$29 = "missing-hook";
|
|
12735
12760
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12736
12761
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12737
12762
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12738
12763
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12739
12764
|
const PLUGIN_ROOT = "..";
|
|
12740
12765
|
const READ_CONCURRENCY$11 = 16;
|
|
12741
|
-
const START$
|
|
12766
|
+
const START$17 = 0;
|
|
12742
12767
|
const referenceOf$2 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
12743
12768
|
path,
|
|
12744
|
-
index: found.index ?? START$
|
|
12769
|
+
index: found.index ?? START$17
|
|
12745
12770
|
})), Option.toArray);
|
|
12746
12771
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$2));
|
|
12747
|
-
const problemsIn$
|
|
12772
|
+
const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12748
12773
|
const files = yield* RepositoryFiles;
|
|
12749
12774
|
const text = yield* files.readFile(file);
|
|
12750
12775
|
if (Option.isNone(text)) return [];
|
|
@@ -12756,7 +12781,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12756
12781
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12757
12782
|
file,
|
|
12758
12783
|
...positionOf(source)(index),
|
|
12759
|
-
rule: RULE$
|
|
12784
|
+
rule: RULE$29,
|
|
12760
12785
|
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.`
|
|
12761
12786
|
})));
|
|
12762
12787
|
});
|
|
@@ -12780,7 +12805,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12780
12805
|
}];
|
|
12781
12806
|
return [];
|
|
12782
12807
|
}));
|
|
12783
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12808
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$11 });
|
|
12784
12809
|
return Array.flatten(found);
|
|
12785
12810
|
});
|
|
12786
12811
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12809,7 +12834,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12809
12834
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12810
12835
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12811
12836
|
// src/features/check-documented-commands/model/commands.ts
|
|
12812
|
-
const RULE$
|
|
12837
|
+
const RULE$28 = "documented-commands";
|
|
12813
12838
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12814
12839
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12815
12840
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12828,7 +12853,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12828
12853
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12829
12854
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12830
12855
|
const ONE$1 = 1;
|
|
12831
|
-
const START$
|
|
12856
|
+
const START$16 = 0;
|
|
12832
12857
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12833
12858
|
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)))));
|
|
12834
12859
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12884,11 +12909,11 @@ const whereOf = (scope, file) => {
|
|
|
12884
12909
|
return `the package that holds ${file}`;
|
|
12885
12910
|
};
|
|
12886
12911
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12887
|
-
const problemsIn$
|
|
12912
|
+
const problemsIn$10 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12888
12913
|
file: absolute(file),
|
|
12889
|
-
...positionOf(text)(match.index ?? START$
|
|
12890
|
-
rule: RULE$
|
|
12891
|
-
message: `${match[START$
|
|
12914
|
+
...positionOf(text)(match.index ?? START$16),
|
|
12915
|
+
rule: RULE$28,
|
|
12916
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12892
12917
|
})), Option.toArray)));
|
|
12893
12918
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12894
12919
|
/** @internal */
|
|
@@ -12912,14 +12937,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12912
12937
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12913
12938
|
line: ONE$1,
|
|
12914
12939
|
column: ONE$1,
|
|
12915
|
-
rule: RULE$
|
|
12940
|
+
rule: RULE$28,
|
|
12916
12941
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12917
12942
|
}],
|
|
12918
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
12943
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12919
12944
|
});
|
|
12920
12945
|
});
|
|
12921
12946
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12922
|
-
const RULE$
|
|
12947
|
+
const RULE$27 = "legacy-web";
|
|
12923
12948
|
const FIRST_COLUMN$3 = 1;
|
|
12924
12949
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12925
12950
|
const Finding = Schema.Struct({
|
|
@@ -12958,7 +12983,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12958
12983
|
file: files.join(root, file),
|
|
12959
12984
|
line,
|
|
12960
12985
|
column: FIRST_COLUMN$3,
|
|
12961
|
-
rule: RULE$
|
|
12986
|
+
rule: RULE$27,
|
|
12962
12987
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12963
12988
|
});
|
|
12964
12989
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -13029,7 +13054,7 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
|
|
|
13029
13054
|
const EXTENSION = /\.[^./]+$/u;
|
|
13030
13055
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13031
13056
|
const READ_CONCURRENCY$10 = 64;
|
|
13032
|
-
const RULE$
|
|
13057
|
+
const RULE$26 = "shell-script";
|
|
13033
13058
|
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.";
|
|
13034
13059
|
const HookSchema = Schema.Struct({
|
|
13035
13060
|
command: Schema.optional(Schema.String),
|
|
@@ -13062,7 +13087,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13062
13087
|
};
|
|
13063
13088
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13064
13089
|
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
13065
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13090
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$26)(files.join(root, name), MESSAGE$11)));
|
|
13066
13091
|
});
|
|
13067
13092
|
// src/shared/lib/workflow-files.ts
|
|
13068
13093
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
@@ -13081,8 +13106,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13081
13106
|
});
|
|
13082
13107
|
// src/shared/lib/workflow-run.ts
|
|
13083
13108
|
const RUN_KEY = "run";
|
|
13084
|
-
const START$
|
|
13085
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
13109
|
+
const START$15 = 0;
|
|
13110
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
13086
13111
|
const runScriptsOf = (source) => {
|
|
13087
13112
|
const found = [];
|
|
13088
13113
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -13097,7 +13122,7 @@ const runScriptsOf = (source) => {
|
|
|
13097
13122
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13098
13123
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13099
13124
|
const COMMENT = "#";
|
|
13100
|
-
const RULE$
|
|
13125
|
+
const RULE$25 = "workflow-script";
|
|
13101
13126
|
const ONE_COMMAND = 1;
|
|
13102
13127
|
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.";
|
|
13103
13128
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -13106,14 +13131,14 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
13106
13131
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
13107
13132
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
13108
13133
|
};
|
|
13109
|
-
const problemsIn$
|
|
13134
|
+
const problemsIn$9 = (file) => (source) => {
|
|
13110
13135
|
const at = positionOf(source);
|
|
13111
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13136
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$25)(file, at(start), MESSAGE$10)));
|
|
13112
13137
|
};
|
|
13113
13138
|
/** @internal */
|
|
13114
13139
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
13115
13140
|
const workflows = yield* readWorkflows(root);
|
|
13116
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
13141
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$9(file)(source)));
|
|
13117
13142
|
});
|
|
13118
13143
|
// src/features/check-scripts/model/script-checks.ts
|
|
13119
13144
|
/** @internal */
|
|
@@ -13219,27 +13244,27 @@ const docSources = (file) => (source) => {
|
|
|
13219
13244
|
})));
|
|
13220
13245
|
};
|
|
13221
13246
|
// src/features/check-vite-plus/model/command-sources.ts
|
|
13222
|
-
const ROOT_DIRECTORY$
|
|
13247
|
+
const ROOT_DIRECTORY$3 = ".";
|
|
13223
13248
|
const COMMAND_KEY = "command";
|
|
13224
13249
|
const ARGUMENTS_KEY = "args";
|
|
13225
|
-
const EXCLUDED$
|
|
13226
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
13250
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13251
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$4];
|
|
13227
13252
|
const STEP_FILES = [
|
|
13228
13253
|
":(glob).github/workflows/*.yml",
|
|
13229
13254
|
":(glob).github/workflows/*.yaml",
|
|
13230
13255
|
":(glob)**/action.yml",
|
|
13231
13256
|
":(glob)**/action.yaml",
|
|
13232
|
-
...EXCLUDED$
|
|
13257
|
+
...EXCLUDED$4
|
|
13233
13258
|
];
|
|
13234
13259
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
13235
13260
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
13236
13261
|
const AGENT_DOCS = [
|
|
13237
13262
|
":(glob)**/AGENTS.md",
|
|
13238
13263
|
":(glob)**/CLAUDE.md",
|
|
13239
|
-
...EXCLUDED$
|
|
13264
|
+
...EXCLUDED$4
|
|
13240
13265
|
];
|
|
13241
13266
|
const READ_CONCURRENCY$8 = 16;
|
|
13242
|
-
const START$
|
|
13267
|
+
const START$14 = 0;
|
|
13243
13268
|
const FIRST$5 = 1;
|
|
13244
13269
|
const LINE = "\n";
|
|
13245
13270
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -13249,7 +13274,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
13249
13274
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
13250
13275
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13251
13276
|
const NO_SOURCES = [];
|
|
13252
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
13277
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
13253
13278
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
13254
13279
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
13255
13280
|
return {
|
|
@@ -13340,12 +13365,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13340
13365
|
readSources(root, hooks, hookSources),
|
|
13341
13366
|
readSources(root, AGENT_FILES, agentSources),
|
|
13342
13367
|
readSources(root, docs, docSources),
|
|
13343
|
-
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$
|
|
13368
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$3, ...workspaces]))
|
|
13344
13369
|
], { concurrency: "unbounded" });
|
|
13345
13370
|
return Array.flatten(found);
|
|
13346
13371
|
});
|
|
13347
13372
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13348
|
-
const RULE$
|
|
13373
|
+
const RULE$24 = "package-script";
|
|
13349
13374
|
const LIFECYCLE = [
|
|
13350
13375
|
"preinstall",
|
|
13351
13376
|
"install",
|
|
@@ -13368,12 +13393,12 @@ const LIFECYCLE = [
|
|
|
13368
13393
|
const problemOf$2 = ({ file, position, name }) => ({
|
|
13369
13394
|
file,
|
|
13370
13395
|
...position,
|
|
13371
|
-
rule: RULE$
|
|
13396
|
+
rule: RULE$24,
|
|
13372
13397
|
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.`
|
|
13373
13398
|
});
|
|
13374
13399
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$2));
|
|
13375
13400
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13376
|
-
const RULE$
|
|
13401
|
+
const RULE$23 = "vite-plus-block";
|
|
13377
13402
|
const MARKER = Array.join([
|
|
13378
13403
|
"<!--",
|
|
13379
13404
|
"VITE PLUS START",
|
|
@@ -13386,7 +13411,7 @@ const problemIn = (file) => (source) => {
|
|
|
13386
13411
|
return Option.some({
|
|
13387
13412
|
file,
|
|
13388
13413
|
...positionOf(source)(index.value),
|
|
13389
|
-
rule: RULE$
|
|
13414
|
+
rule: RULE$23,
|
|
13390
13415
|
message: MESSAGE$9
|
|
13391
13416
|
});
|
|
13392
13417
|
};
|
|
@@ -13442,7 +13467,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13442
13467
|
})
|
|
13443
13468
|
});
|
|
13444
13469
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13445
|
-
const RULE$
|
|
13470
|
+
const RULE$21 = "publish-trigger";
|
|
13446
13471
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13447
13472
|
const MANUAL = "workflow_dispatch";
|
|
13448
13473
|
const TRIGGER_KEY = "on";
|
|
@@ -13462,18 +13487,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13462
13487
|
};
|
|
13463
13488
|
/** @internal */
|
|
13464
13489
|
const checkPublishTrigger = workflowCheck({
|
|
13465
|
-
rule: RULE$
|
|
13490
|
+
rule: RULE$21,
|
|
13466
13491
|
message: MESSAGE$7,
|
|
13467
13492
|
offsetsOf: publishTriggerOffsetsOf
|
|
13468
13493
|
});
|
|
13469
13494
|
// src/features/check-workflows/model/release-please.ts
|
|
13470
|
-
const RULE$
|
|
13495
|
+
const RULE$20 = "release-please";
|
|
13471
13496
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13472
13497
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13473
13498
|
const FIRST$4 = 1;
|
|
13474
13499
|
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.";
|
|
13475
13500
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13476
|
-
rule: RULE$
|
|
13501
|
+
rule: RULE$20,
|
|
13477
13502
|
message: MESSAGE$6,
|
|
13478
13503
|
offsetsOf: scalarKeyOffsets({
|
|
13479
13504
|
name: "uses",
|
|
@@ -13487,7 +13512,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13487
13512
|
file: files.join(root, name),
|
|
13488
13513
|
line: FIRST$4,
|
|
13489
13514
|
column: FIRST$4,
|
|
13490
|
-
rule: RULE$
|
|
13515
|
+
rule: RULE$20,
|
|
13491
13516
|
message: MESSAGE$6
|
|
13492
13517
|
})));
|
|
13493
13518
|
});
|
|
@@ -13499,17 +13524,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13499
13524
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13500
13525
|
const CONCURRENCY_KEY = "concurrency";
|
|
13501
13526
|
const QUEUE_KEY = "queue";
|
|
13502
|
-
const RULE$
|
|
13527
|
+
const RULE$19 = "workflow-queue";
|
|
13503
13528
|
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.";
|
|
13504
13529
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13505
13530
|
/** @internal */
|
|
13506
13531
|
const checkWorkflowQueues = workflowCheck({
|
|
13507
|
-
rule: RULE$
|
|
13532
|
+
rule: RULE$19,
|
|
13508
13533
|
message: MESSAGE$5,
|
|
13509
13534
|
offsetsOf: queueOffsetsOf
|
|
13510
13535
|
});
|
|
13511
13536
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13512
|
-
const RULE$
|
|
13537
|
+
const RULE$18 = "workflow-commit";
|
|
13513
13538
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13514
13539
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13515
13540
|
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.";
|
|
@@ -13517,7 +13542,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
13517
13542
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13518
13543
|
/** @internal */
|
|
13519
13544
|
const checkWorkflowCommits = workflowCheck({
|
|
13520
|
-
rule: RULE$
|
|
13545
|
+
rule: RULE$18,
|
|
13521
13546
|
message: MESSAGE$4,
|
|
13522
13547
|
offsetsOf: commitOffsetsOf
|
|
13523
13548
|
});
|
|
@@ -13628,7 +13653,7 @@ const COMMENT_NODES = [
|
|
|
13628
13653
|
"block_comment",
|
|
13629
13654
|
"multiline_comment"
|
|
13630
13655
|
];
|
|
13631
|
-
const START$
|
|
13656
|
+
const START$13 = 0;
|
|
13632
13657
|
const NEXT = 1;
|
|
13633
13658
|
const NONE = [];
|
|
13634
13659
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13678,7 +13703,7 @@ const markupComment = (source) => (node) => {
|
|
|
13678
13703
|
}];
|
|
13679
13704
|
};
|
|
13680
13705
|
const textComments = (grammars, grammar) => (text) => {
|
|
13681
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13706
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
13682
13707
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13683
13708
|
};
|
|
13684
13709
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13744,12 +13769,12 @@ const shebangReader = (source) => {
|
|
|
13744
13769
|
};
|
|
13745
13770
|
const readerOf = (name) => (source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13746
13771
|
// src/features/ban-comments/model/comments.ts
|
|
13747
|
-
const RULE$
|
|
13772
|
+
const RULE$17 = "comment";
|
|
13748
13773
|
const UNUSED_RULE$1 = "unused-comment-allowance";
|
|
13749
13774
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13750
13775
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13751
13776
|
const READ_CONCURRENCY$7 = 64;
|
|
13752
|
-
const START$
|
|
13777
|
+
const START$12 = 0;
|
|
13753
13778
|
const SHEBANG = "#!";
|
|
13754
13779
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
13755
13780
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
@@ -13771,11 +13796,11 @@ const taggedError$2 = Schema.TaggedError;
|
|
|
13771
13796
|
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
13772
13797
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13773
13798
|
const lineBefore = (source, index) => {
|
|
13774
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13799
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
13775
13800
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13776
13801
|
};
|
|
13777
13802
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13778
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13803
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
13779
13804
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13780
13805
|
const NOTHING = {
|
|
13781
13806
|
problems: [],
|
|
@@ -13785,7 +13810,7 @@ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but n
|
|
|
13785
13810
|
const problemOf$1 = (file, source) => ({ index }) => ({
|
|
13786
13811
|
file,
|
|
13787
13812
|
...positionOf(source)(index),
|
|
13788
|
-
rule: RULE$
|
|
13813
|
+
rule: RULE$17,
|
|
13789
13814
|
message: MESSAGE$3
|
|
13790
13815
|
});
|
|
13791
13816
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13822,7 +13847,7 @@ const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, sett
|
|
|
13822
13847
|
})), Array.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
13823
13848
|
});
|
|
13824
13849
|
const usedAllowances = (allowances, found) => pipe(allowances, Array.map((pattern, index) => [pattern, index]), Array.filter(([pattern]) => pipe(found, Array.some((comment) => pattern.test(valueOf(comment.text))))), Array.map(([, index]) => index));
|
|
13825
|
-
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$
|
|
13850
|
+
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$12));
|
|
13826
13851
|
const unusedAllowances = Effect.fn("unusedAllowances")(function* unusedAllowances(root, settings, used) {
|
|
13827
13852
|
const files = yield* RepositoryFiles;
|
|
13828
13853
|
const file = files.join(root, CONFIG_FILE$2);
|
|
@@ -13844,7 +13869,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
13844
13869
|
problems: pipe(found, Array.filter(kept), Array.map(toProblem)),
|
|
13845
13870
|
used: usedAllowances(allowances, found)
|
|
13846
13871
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
13847
|
-
problems: [problemInFile(RULE$
|
|
13872
|
+
problems: [problemInFile(RULE$17)(file, `msch could not read the comments in this file: ${message}`)],
|
|
13848
13873
|
used: []
|
|
13849
13874
|
})))
|
|
13850
13875
|
});
|
|
@@ -13957,21 +13982,21 @@ const PYTHON = {
|
|
|
13957
13982
|
/** @internal */
|
|
13958
13983
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13959
13984
|
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13960
|
-
const RULE$
|
|
13985
|
+
const RULE$16 = "uncataloged-dependency";
|
|
13961
13986
|
const OWNED_ELSEWHERE = [
|
|
13962
13987
|
"catalog:",
|
|
13963
13988
|
"workspace:",
|
|
13964
13989
|
"link:",
|
|
13965
13990
|
"file:"
|
|
13966
13991
|
];
|
|
13967
|
-
const ROOT_DIRECTORY$
|
|
13992
|
+
const ROOT_DIRECTORY$2 = ".";
|
|
13968
13993
|
const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
|
|
13969
13994
|
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
13995
|
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13971
|
-
const problemsIn$
|
|
13996
|
+
const problemsIn$8 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13972
13997
|
file: entry.file,
|
|
13973
13998
|
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13974
|
-
rule: RULE$
|
|
13999
|
+
rule: RULE$16,
|
|
13975
14000
|
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
13976
14001
|
})));
|
|
13977
14002
|
/** @internal */
|
|
@@ -13979,14 +14004,14 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
|
|
|
13979
14004
|
const files = yield* RepositoryFiles;
|
|
13980
14005
|
const directories = yield* workspaceDirectories(root);
|
|
13981
14006
|
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$
|
|
14007
|
+
const listed = pipe([ROOT_DIRECTORY$2, ...installed], Array.map((directory) => {
|
|
13983
14008
|
const name = files.join(directory, MANIFEST_FILE$3);
|
|
13984
14009
|
return {
|
|
13985
14010
|
name,
|
|
13986
14011
|
file: files.join(root, name)
|
|
13987
14012
|
};
|
|
13988
14013
|
}));
|
|
13989
|
-
return yield* scanText(listed, problemsIn$
|
|
14014
|
+
return yield* scanText(listed, problemsIn$8);
|
|
13990
14015
|
});
|
|
13991
14016
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13992
14017
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
@@ -14030,7 +14055,7 @@ const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root
|
|
|
14030
14055
|
const files = yield* RepositoryFiles;
|
|
14031
14056
|
const listed = yield* files.listedFiles(root);
|
|
14032
14057
|
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 });
|
|
14033
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
14058
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$8(text))), Array.flatMap(referencesIn));
|
|
14034
14059
|
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
|
|
14035
14060
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
14036
14061
|
});
|
|
@@ -14084,7 +14109,7 @@ const CONFIG_FILE$1 = "vite.config.ts";
|
|
|
14084
14109
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
14085
14110
|
const SOURCE = "masseater/skills";
|
|
14086
14111
|
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
14087
|
-
const START$
|
|
14112
|
+
const START$11 = 0;
|
|
14088
14113
|
const LOCAL_PREFIX = "./";
|
|
14089
14114
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
14090
14115
|
const Source = Schema.Struct({
|
|
@@ -14097,7 +14122,7 @@ const taggedError$1 = Schema.TaggedError;
|
|
|
14097
14122
|
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14098
14123
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
14099
14124
|
file,
|
|
14100
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
14125
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
14101
14126
|
rule,
|
|
14102
14127
|
message
|
|
14103
14128
|
});
|
|
@@ -14144,14 +14169,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
14144
14169
|
];
|
|
14145
14170
|
});
|
|
14146
14171
|
// src/features/check-skills/model/published-skills.ts
|
|
14147
|
-
const RULE$
|
|
14172
|
+
const RULE$15 = "published-skills";
|
|
14148
14173
|
const KEYWORD = "tanstack-intent";
|
|
14149
14174
|
const SKILLS = "skills";
|
|
14150
14175
|
const MANIFEST_FILE = "package.json";
|
|
14151
14176
|
const SKILL_FILE$1 = "SKILL.md";
|
|
14152
14177
|
const SUCCEEDED = 0;
|
|
14153
14178
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14154
|
-
const problemAt$2 = problemInFile(RULE$
|
|
14179
|
+
const problemAt$2 = problemInFile(RULE$15);
|
|
14155
14180
|
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
|
|
14156
14181
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14157
14182
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -14172,7 +14197,7 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
14172
14197
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
14173
14198
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
14174
14199
|
}, Effect.scoped);
|
|
14175
|
-
const problemsIn$
|
|
14200
|
+
const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
14176
14201
|
const files = yield* RepositoryFiles;
|
|
14177
14202
|
const directory = files.join(root, project.directory);
|
|
14178
14203
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
@@ -14184,11 +14209,11 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
14184
14209
|
/** @internal */
|
|
14185
14210
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
14186
14211
|
const projects = yield* publishedProjects(root);
|
|
14187
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
14212
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$7(root, project), { concurrency: 1 });
|
|
14188
14213
|
return Array.flatten(problems);
|
|
14189
14214
|
});
|
|
14190
14215
|
// src/features/check-skills/model/skill-files.ts
|
|
14191
|
-
const RULE$
|
|
14216
|
+
const RULE$14 = "skill-file";
|
|
14192
14217
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14193
14218
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14194
14219
|
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
@@ -14206,7 +14231,7 @@ const GITHUB = "https://github.com/";
|
|
|
14206
14231
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
14207
14232
|
const BLANK = /\s+/u;
|
|
14208
14233
|
const SEPARATOR$2 = "/";
|
|
14209
|
-
const START$
|
|
14234
|
+
const START$10 = 0;
|
|
14210
14235
|
const FIRST$3 = 1;
|
|
14211
14236
|
const READ_CONCURRENCY$5 = 16;
|
|
14212
14237
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
@@ -14216,9 +14241,9 @@ const Frontmatter = Schema.Struct({
|
|
|
14216
14241
|
metadata: Schema.optional(Metadata)
|
|
14217
14242
|
});
|
|
14218
14243
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
14219
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
14244
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
14220
14245
|
const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
|
|
14221
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
14246
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
14222
14247
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
14223
14248
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
14224
14249
|
const bodyStart = bodyStartOf(source);
|
|
@@ -14246,16 +14271,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
14246
14271
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
14247
14272
|
file: skill.file,
|
|
14248
14273
|
...positionOf(skill.source)(index),
|
|
14249
|
-
rule: RULE$
|
|
14274
|
+
rule: RULE$14,
|
|
14250
14275
|
message
|
|
14251
14276
|
})));
|
|
14252
14277
|
const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
14253
14278
|
target,
|
|
14254
|
-
index: found.index ?? START$
|
|
14279
|
+
index: found.index ?? START$10
|
|
14255
14280
|
})), Option.toArray);
|
|
14256
14281
|
const rangeOf$1 = (found) => {
|
|
14257
|
-
const start = found.index ?? START$
|
|
14258
|
-
return [start, start + found[START$
|
|
14282
|
+
const start = found.index ?? START$10;
|
|
14283
|
+
return [start, start + found[START$10].length];
|
|
14259
14284
|
};
|
|
14260
14285
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
14261
14286
|
const linksIn$1 = (source) => {
|
|
@@ -14273,11 +14298,11 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
14273
14298
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14274
14299
|
file,
|
|
14275
14300
|
...positionOf(source)(index),
|
|
14276
|
-
rule: RULE$
|
|
14301
|
+
rule: RULE$14,
|
|
14277
14302
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14278
14303
|
})));
|
|
14279
14304
|
});
|
|
14280
|
-
const problemsIn$
|
|
14305
|
+
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
14281
14306
|
const files = yield* RepositoryFiles;
|
|
14282
14307
|
const file = files.join(root, name);
|
|
14283
14308
|
const directory = files.dirname(name);
|
|
@@ -14289,7 +14314,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14289
14314
|
file: files.join(root, entry),
|
|
14290
14315
|
line: FIRST$3,
|
|
14291
14316
|
column: FIRST$3,
|
|
14292
|
-
rule: RULE$
|
|
14317
|
+
rule: RULE$14,
|
|
14293
14318
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14294
14319
|
})));
|
|
14295
14320
|
return [
|
|
@@ -14306,7 +14331,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14306
14331
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
14307
14332
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
14308
14333
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
14309
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
14334
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
14310
14335
|
return Array.flatten(found);
|
|
14311
14336
|
});
|
|
14312
14337
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -14367,7 +14392,7 @@ const cargoEntries = (text) => {
|
|
|
14367
14392
|
};
|
|
14368
14393
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14369
14394
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14370
|
-
const RULE$
|
|
14395
|
+
const RULE$13 = "version-downgrade";
|
|
14371
14396
|
const DEFAULT_BASE = "origin/main";
|
|
14372
14397
|
const READ_CONCURRENCY$4 = 16;
|
|
14373
14398
|
const READERS = [
|
|
@@ -14393,7 +14418,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
14393
14418
|
file,
|
|
14394
14419
|
line: lineOf(text, entry),
|
|
14395
14420
|
column: FIRST_LINE$1,
|
|
14396
|
-
rule: RULE$
|
|
14421
|
+
rule: RULE$13,
|
|
14397
14422
|
message: message(old, entry)
|
|
14398
14423
|
})), Option.toArray)));
|
|
14399
14424
|
};
|
|
@@ -14430,13 +14455,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
14430
14455
|
const CAP_RULE = "renovate-version-cap";
|
|
14431
14456
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14432
14457
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14433
|
-
const START$
|
|
14458
|
+
const START$9 = 0;
|
|
14434
14459
|
const READ_CONCURRENCY$3 = 16;
|
|
14435
14460
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14436
14461
|
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.";
|
|
14437
14462
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
14438
14463
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
14439
|
-
const problemsIn$
|
|
14464
|
+
const problemsIn$5 = (file, source) => {
|
|
14440
14465
|
const at = positionOf(source);
|
|
14441
14466
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
14442
14467
|
file,
|
|
@@ -14449,7 +14474,7 @@ const problemsIn$6 = (file, source) => {
|
|
|
14449
14474
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
14450
14475
|
...pipe([{
|
|
14451
14476
|
file,
|
|
14452
|
-
...at(START$
|
|
14477
|
+
...at(START$9),
|
|
14453
14478
|
rule: PRESET_RULE,
|
|
14454
14479
|
message: PRESET_MESSAGE
|
|
14455
14480
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -14463,7 +14488,7 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14463
14488
|
const file = files.join(root, name);
|
|
14464
14489
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14465
14490
|
onNone: () => [],
|
|
14466
|
-
onSome: (source) => problemsIn$
|
|
14491
|
+
onSome: (source) => problemsIn$5(file, source)
|
|
14467
14492
|
})));
|
|
14468
14493
|
}, { concurrency: READ_CONCURRENCY$3 });
|
|
14469
14494
|
return Array.flatten(found);
|
|
@@ -14471,22 +14496,22 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14471
14496
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
14472
14497
|
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;
|
|
14473
14498
|
const NUL = "\0";
|
|
14474
|
-
const START$
|
|
14499
|
+
const START$8 = 0;
|
|
14475
14500
|
const HEX = 16;
|
|
14476
14501
|
const CODE_POINT_WIDTH = 4;
|
|
14477
14502
|
const READ_CONCURRENCY$2 = 64;
|
|
14478
|
-
const RULE$
|
|
14479
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
14503
|
+
const RULE$12 = "hidden-unicode";
|
|
14504
|
+
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"));
|
|
14480
14505
|
const problemOf = (file, source) => (found) => {
|
|
14481
|
-
const hex = hexOf(found[START$
|
|
14506
|
+
const hex = hexOf(found[START$8]);
|
|
14482
14507
|
return {
|
|
14483
14508
|
file,
|
|
14484
|
-
...positionOf(source)(found.index ?? START$
|
|
14485
|
-
rule: RULE$
|
|
14509
|
+
...positionOf(source)(found.index ?? START$8),
|
|
14510
|
+
rule: RULE$12,
|
|
14486
14511
|
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}.`
|
|
14487
14512
|
};
|
|
14488
14513
|
};
|
|
14489
|
-
const problemsIn$
|
|
14514
|
+
const problemsIn$4 = (file, source) => {
|
|
14490
14515
|
if (String$1.includes(NUL)(source)) return [];
|
|
14491
14516
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
|
|
14492
14517
|
};
|
|
@@ -14498,7 +14523,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14498
14523
|
const file = files.join(root, name);
|
|
14499
14524
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14500
14525
|
onNone: () => [],
|
|
14501
|
-
onSome: (source) => problemsIn$
|
|
14526
|
+
onSome: (source) => problemsIn$4(file, source)
|
|
14502
14527
|
})));
|
|
14503
14528
|
}, { concurrency: READ_CONCURRENCY$2 });
|
|
14504
14529
|
return Array.flatten(found);
|
|
@@ -14506,7 +14531,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14506
14531
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
14507
14532
|
const MSCH = "@r_masseater/msch";
|
|
14508
14533
|
const SCOPE$1 = "@r_masseater/";
|
|
14509
|
-
const RULE$
|
|
14534
|
+
const RULE$11 = "applied-package";
|
|
14510
14535
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
14511
14536
|
const NOT_FOUND = -1;
|
|
14512
14537
|
const SEPARATOR$1 = "/";
|
|
@@ -14551,7 +14576,7 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
14551
14576
|
const problemAt$1 = (file, source) => (index, name) => ({
|
|
14552
14577
|
file,
|
|
14553
14578
|
...positionOf(source)(index),
|
|
14554
|
-
rule: RULE$
|
|
14579
|
+
rule: RULE$11,
|
|
14555
14580
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
14556
14581
|
});
|
|
14557
14582
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
@@ -14606,7 +14631,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14606
14631
|
return yield* appliedPackageProblems(root, applied);
|
|
14607
14632
|
});
|
|
14608
14633
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14609
|
-
const RULE$
|
|
14634
|
+
const RULE$10 = "replaced-tool";
|
|
14610
14635
|
const FIRST$2 = 1;
|
|
14611
14636
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14612
14637
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
@@ -14687,7 +14712,7 @@ const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ patte
|
|
|
14687
14712
|
file,
|
|
14688
14713
|
line: FIRST$2,
|
|
14689
14714
|
column: FIRST$2,
|
|
14690
|
-
rule: RULE$
|
|
14715
|
+
rule: RULE$10,
|
|
14691
14716
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14692
14717
|
})));
|
|
14693
14718
|
/** @internal */
|
|
@@ -14721,7 +14746,7 @@ const SETUP_PATTERNS = [
|
|
|
14721
14746
|
];
|
|
14722
14747
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14723
14748
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14724
|
-
const START$
|
|
14749
|
+
const START$7 = 0;
|
|
14725
14750
|
const LAST_SEGMENT = 1;
|
|
14726
14751
|
const FIRST_LINE = 1;
|
|
14727
14752
|
const FIRST_COLUMN = 1;
|
|
@@ -14790,7 +14815,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14790
14815
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14791
14816
|
return directoriesOf(roots);
|
|
14792
14817
|
});
|
|
14793
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
14818
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$7), (end) => String$1.slice(START$7, end)(name));
|
|
14794
14819
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14795
14820
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14796
14821
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14826,11 +14851,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14826
14851
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14827
14852
|
});
|
|
14828
14853
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
14829
|
-
const RULE$
|
|
14854
|
+
const RULE$9 = "effect-diagnostics-once";
|
|
14830
14855
|
const PLUGIN = "@effect/language-service";
|
|
14831
14856
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14832
|
-
const EXCLUDED$
|
|
14833
|
-
const START$
|
|
14857
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14858
|
+
const START$6 = 0;
|
|
14834
14859
|
const Plugin = Schema.Struct({
|
|
14835
14860
|
name: Schema.optional(Schema.String),
|
|
14836
14861
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14841,28 +14866,28 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
14841
14866
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
14842
14867
|
const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
|
|
14843
14868
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14844
|
-
const problemsIn$
|
|
14869
|
+
const problemsIn$3 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
14845
14870
|
file: entry.file,
|
|
14846
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14847
|
-
rule: RULE$
|
|
14871
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$6))),
|
|
14872
|
+
rule: RULE$9,
|
|
14848
14873
|
message: MESSAGE$1
|
|
14849
14874
|
})), Option.toArray);
|
|
14850
14875
|
/** @internal */
|
|
14851
14876
|
const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* checkEffectDiagnostics(root) {
|
|
14852
14877
|
const files = yield* RepositoryFiles;
|
|
14853
|
-
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$
|
|
14878
|
+
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$3]);
|
|
14854
14879
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
14855
14880
|
name,
|
|
14856
14881
|
file: files.join(root, name)
|
|
14857
|
-
}))), problemsIn$
|
|
14882
|
+
}))), problemsIn$3);
|
|
14858
14883
|
});
|
|
14859
14884
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
14860
|
-
const RULE$
|
|
14885
|
+
const RULE$8 = "version-range";
|
|
14861
14886
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
14862
14887
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14863
14888
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14864
14889
|
const PATH_LIKE = "/";
|
|
14865
|
-
const EXCLUDED$
|
|
14890
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14866
14891
|
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.";
|
|
14867
14892
|
const versionOf = (specifier) => Option.getOrElse(groupOf("version")(ALIAS.exec(specifier)), () => specifier);
|
|
14868
14893
|
/** @internal */
|
|
@@ -14873,7 +14898,7 @@ const isRange = (specifier) => {
|
|
|
14873
14898
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14874
14899
|
file,
|
|
14875
14900
|
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14876
|
-
rule: RULE$
|
|
14901
|
+
rule: RULE$8,
|
|
14877
14902
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14878
14903
|
})));
|
|
14879
14904
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "mu");
|
|
@@ -14892,7 +14917,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14892
14917
|
/** @internal */
|
|
14893
14918
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
14894
14919
|
const files = yield* RepositoryFiles;
|
|
14895
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14920
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14896
14921
|
const listed = pipe(manifests, Array.map((name) => ({
|
|
14897
14922
|
name,
|
|
14898
14923
|
file: files.join(root, name)
|
|
@@ -14902,32 +14927,25 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14902
14927
|
return [...fromManifests, ...fromCatalogs];
|
|
14903
14928
|
});
|
|
14904
14929
|
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14905
|
-
const RULE$
|
|
14930
|
+
const RULE$7 = "pack-publint";
|
|
14906
14931
|
const CONFIG_FILE = "vite.config.ts";
|
|
14907
14932
|
const PACK_KEY = "pack:";
|
|
14908
|
-
const START$
|
|
14933
|
+
const START$5 = 0;
|
|
14909
14934
|
const READ_CONCURRENCY$1 = 16;
|
|
14910
|
-
const EXCLUDED$
|
|
14911
|
-
const Manifest$4 = Schema.Struct({
|
|
14912
|
-
private: Schema.optional(Schema.Boolean),
|
|
14913
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14914
|
-
});
|
|
14915
|
-
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
14935
|
+
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14916
14936
|
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14917
14937
|
const isStrict = Schema.is(StrictPack);
|
|
14918
14938
|
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
14919
14939
|
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
14920
14940
|
const taggedError = Schema.TaggedError;
|
|
14921
14941
|
var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
14922
|
-
const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14923
14942
|
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14924
14943
|
const problemFor = (file, source) => ({
|
|
14925
14944
|
file,
|
|
14926
|
-
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$
|
|
14927
|
-
rule: RULE$
|
|
14945
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$5)),
|
|
14946
|
+
rule: RULE$7,
|
|
14928
14947
|
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."
|
|
14929
14948
|
});
|
|
14930
|
-
const publishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.filter(isPublished$2));
|
|
14931
14949
|
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14932
14950
|
const config = yield* Effect.tryPromise({
|
|
14933
14951
|
try: () => resolveConfigFromFile(configFile),
|
|
@@ -14941,50 +14959,21 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
|
|
|
14941
14959
|
if (yield* strictPublintIn(configFile)) return [];
|
|
14942
14960
|
return [problemFor(configFile, source.value)];
|
|
14943
14961
|
});
|
|
14944
|
-
const problemsIn$
|
|
14962
|
+
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14945
14963
|
const files = yield* RepositoryFiles;
|
|
14946
14964
|
const source = yield* files.readFile(files.join(root, manifestName));
|
|
14947
|
-
const manifest =
|
|
14965
|
+
const manifest = publishedManifestOf(source);
|
|
14948
14966
|
if (Option.isNone(manifest)) return [];
|
|
14949
14967
|
return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14950
14968
|
});
|
|
14951
14969
|
/** @internal */
|
|
14952
14970
|
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14953
|
-
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14954
|
-
const found = yield* Effect.forEach(manifests, (name) => problemsIn$
|
|
14971
|
+
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
14972
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14955
14973
|
return Array.flatten(found);
|
|
14956
14974
|
});
|
|
14957
|
-
// src/features/check-package-scope/model/package-scope.ts
|
|
14958
|
-
const RULE$5 = "package-scope";
|
|
14959
|
-
const SCOPE = "@r_masseater/";
|
|
14960
|
-
const NAME_KEY = "\"name\"";
|
|
14961
|
-
const START$3 = 0;
|
|
14962
|
-
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14963
|
-
const Manifest$3 = Schema.Struct({
|
|
14964
|
-
name: Schema.optional(Schema.String),
|
|
14965
|
-
private: Schema.optional(Schema.Boolean),
|
|
14966
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14967
|
-
});
|
|
14968
|
-
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
14969
|
-
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14970
|
-
const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
14971
|
-
const problemsIn$2 = (entry, source) => pipe(decodeManifest$3(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
|
|
14972
|
-
file: entry.file,
|
|
14973
|
-
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3))),
|
|
14974
|
-
rule: RULE$5,
|
|
14975
|
-
message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
|
|
14976
|
-
})), Option.toArray);
|
|
14977
|
-
/** @internal */
|
|
14978
|
-
const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageScope(root) {
|
|
14979
|
-
const files = yield* RepositoryFiles;
|
|
14980
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
14981
|
-
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
14982
|
-
name,
|
|
14983
|
-
file: files.join(root, name)
|
|
14984
|
-
}))), problemsIn$2);
|
|
14985
|
-
});
|
|
14986
14975
|
// src/features/check-plugin-marketplace/model/plugin-marketplace.ts
|
|
14987
|
-
const RULE$
|
|
14976
|
+
const RULE$6 = "plugin-marketplace";
|
|
14988
14977
|
const PLUGIN_DIRECTORY = ".claude-plugin";
|
|
14989
14978
|
const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
|
|
14990
14979
|
const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
|
|
@@ -15040,7 +15029,7 @@ const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
|
15040
15029
|
description: Option.getOrElse(project.description, () => "")
|
|
15041
15030
|
})));
|
|
15042
15031
|
});
|
|
15043
|
-
const problem = problemInFile(RULE$
|
|
15032
|
+
const problem = problemInFile(RULE$6);
|
|
15044
15033
|
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
15045
15034
|
const projects = yield* workspaceProjects(root);
|
|
15046
15035
|
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
@@ -15084,6 +15073,56 @@ const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* che
|
|
|
15084
15073
|
});
|
|
15085
15074
|
return yield* rewrite(file, `${text}\n`);
|
|
15086
15075
|
});
|
|
15076
|
+
// src/features/check-published-manifest/model/package-homepage.ts
|
|
15077
|
+
const RULE$5 = "package-homepage";
|
|
15078
|
+
const BRANCH = "main";
|
|
15079
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
15080
|
+
const START$4 = 0;
|
|
15081
|
+
const KEYS = [
|
|
15082
|
+
"\"homepage\"",
|
|
15083
|
+
"\"repository\"",
|
|
15084
|
+
"\"name\""
|
|
15085
|
+
];
|
|
15086
|
+
const RepositoryObject = Schema.Struct({
|
|
15087
|
+
url: Schema.String,
|
|
15088
|
+
directory: Schema.optional(Schema.String)
|
|
15089
|
+
});
|
|
15090
|
+
const decodeRepository = Schema.decodeUnknownOption(RepositoryObject);
|
|
15091
|
+
const repositoryMissing = (directory) => `Published packages declare \`repository\` as \`{ "type": "git", "url": "git+https://github.com/<owner>/<repository>.git", "directory": "${directory}" }\` so that npm and \`npm repo\` link to the source.`;
|
|
15092
|
+
const directoryWrong = (directory) => `In a monorepo \`repository.directory\` names the package directory, so npm links to the package and not to the repository root. Set it to "${directory}".`;
|
|
15093
|
+
const homepageWrong = (homepage) => `\`homepage\` is the link npm shows as the package's home, and the repository root is not the package. Set it to "${homepage}".`;
|
|
15094
|
+
const repositoryUrlOf = (url) => pipe(url, String$1.replace(/^git\+/u, ""), String$1.replace(/\.git$/u, ""));
|
|
15095
|
+
const homepageOf = (url, directory) => `${repositoryUrlOf(url)}/tree/${BRANCH}/${directory}#readme`;
|
|
15096
|
+
const repositoryMessages = (manifest, directory) => (repository) => {
|
|
15097
|
+
const expected = homepageOf(repository.url, directory);
|
|
15098
|
+
const wrongDirectory = directoryWrong(directory);
|
|
15099
|
+
const wrongHomepage = homepageWrong(expected);
|
|
15100
|
+
return Array.getSomes([Option.liftPredicate(wrongDirectory, () => repository.directory !== directory), Option.liftPredicate(wrongHomepage, () => manifest.homepage !== expected)]);
|
|
15101
|
+
};
|
|
15102
|
+
const messagesOf = (manifest, directory) => pipe(decodeRepository(manifest.repository), Option.match({
|
|
15103
|
+
onNone: () => [repositoryMissing(directory)],
|
|
15104
|
+
onSome: repositoryMessages(manifest, directory)
|
|
15105
|
+
}));
|
|
15106
|
+
const firstKeyIndex = (source) => pipe(KEYS, Array.findFirst((key) => String$1.includes(key)(source)), Option.flatMap((key) => String$1.indexOf(key)(source)), Option.getOrElse(() => START$4));
|
|
15107
|
+
/** @internal */
|
|
15108
|
+
const homepageProblems = (dirname) => ({ entry, source, manifest }) => pipe(Option.some(dirname(entry.name)), Option.filter((directory) => directory !== ROOT_DIRECTORY$1), Option.map((directory) => messagesOf(manifest, directory)), Option.getOrElse(() => []), Array.map((message) => problemAtIndex(RULE$5)(entry.file, source)(firstKeyIndex(source), message)));
|
|
15109
|
+
// src/features/check-published-manifest/model/package-scope.ts
|
|
15110
|
+
const RULE$4 = "package-scope";
|
|
15111
|
+
const SCOPE = "@r_masseater/";
|
|
15112
|
+
const NAME_KEY = "\"name\"";
|
|
15113
|
+
const START$3 = 0;
|
|
15114
|
+
const unscopedName = ({ manifest }) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
15115
|
+
const nameIndex = (source) => pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3));
|
|
15116
|
+
const messageFor = (name) => `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`;
|
|
15117
|
+
/** @internal */
|
|
15118
|
+
const scopeProblems = (found) => pipe(unscopedName(found), Option.map((name) => problemAtIndex(RULE$4)(found.entry.file, found.source)(nameIndex(found.source), messageFor(name))), Option.toArray);
|
|
15119
|
+
// src/features/check-published-manifest/model/published-manifests.ts
|
|
15120
|
+
/** @internal */
|
|
15121
|
+
const checkPublishedManifests = Effect.fn("checkPublishedManifests")(function* checkPublishedManifests(root) {
|
|
15122
|
+
const files = yield* RepositoryFiles;
|
|
15123
|
+
const homepage = homepageProblems(files.dirname);
|
|
15124
|
+
return yield* scanPublishedManifests(root, (found) => [...scopeProblems(found), ...homepage(found)]);
|
|
15125
|
+
});
|
|
15087
15126
|
// src/features/check-runtime-version/model/node-version.ts
|
|
15088
15127
|
const RULE$3 = "node-version";
|
|
15089
15128
|
const MINIMUM = 26;
|
|
@@ -15342,7 +15381,7 @@ const checkWorkspaceDescriptions = Effect.fn("checkWorkspaceDescriptions")(funct
|
|
|
15342
15381
|
const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
|
|
15343
15382
|
const found = yield* Effect.all([
|
|
15344
15383
|
checkNodeVersion(root),
|
|
15345
|
-
|
|
15384
|
+
checkPublishedManifests(root),
|
|
15346
15385
|
checkPackSettings(root),
|
|
15347
15386
|
checkUnusedWorkspaces(root),
|
|
15348
15387
|
checkExactVersions(root),
|