@r_masseater/msch 0.90.1 → 0.91.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +210 -91
- package/dist/cli.mjs.map +1 -1
- package/dist/config.mjs +5 -0
- package/dist/config.mjs.map +1 -1
- package/dist/publish.mjs +29 -1
- package/dist/publish.mjs.map +1 -1
- package/dist/wake.mjs +1 -1
- package/package.json +3 -3
- package/skills/msch-publishing/SKILL.md +2 -0
package/dist/cli.mjs
CHANGED
|
@@ -18,7 +18,7 @@ import { t as manifestTexts } from "./manifest-texts-B69vIp7o.mjs";
|
|
|
18
18
|
import { i as writeProblems, n as failWhenAny, r as writeJsonProblems } from "./output-B_YPmKad.mjs";
|
|
19
19
|
import { t as runCli } from "./runtime-C8OGDSk9.mjs";
|
|
20
20
|
import "./cli-contract-D7btWrEu.mjs";
|
|
21
|
-
import { builtinModules } from "node:module";
|
|
21
|
+
import { builtinModules, isBuiltin } from "node:module";
|
|
22
22
|
import { VpToolsError, findCiDrift, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
23
23
|
import { Array as Array$1, Boolean as Boolean$1, Context, Effect, FileSystem, HashMap, HashSet, Match, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
24
24
|
import { lockedGraph, lockedPackageIds, parseDependencyPath, updateWorkspaceManifest } from "@r_masseater/masseater-utils/kestrion/pnpm";
|
|
@@ -189,7 +189,7 @@ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(r
|
|
|
189
189
|
});
|
|
190
190
|
// src/entities/workspace/model/cargo-crates.ts
|
|
191
191
|
const SEPARATOR$24 = "/";
|
|
192
|
-
const SUCCESS$
|
|
192
|
+
const SUCCESS$2 = 0;
|
|
193
193
|
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
194
194
|
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
195
195
|
const CrateEntry = Schema.Struct({
|
|
@@ -222,7 +222,7 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
222
222
|
stdin: "ignore"
|
|
223
223
|
});
|
|
224
224
|
const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
225
|
-
if ((yield* handle.exitCode) !== SUCCESS$
|
|
225
|
+
if ((yield* handle.exitCode) !== SUCCESS$2) return [];
|
|
226
226
|
const list = yield* decodeCrateList(output);
|
|
227
227
|
return pipe(list.packages, Array$1.map(crateOf$1));
|
|
228
228
|
}, Effect.scoped);
|
|
@@ -241,7 +241,7 @@ const splitFrontmatter = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(
|
|
|
241
241
|
body: String$1.slice(found[START$30].length)(source)
|
|
242
242
|
})))));
|
|
243
243
|
// src/entities/workspace/model/plugins.ts
|
|
244
|
-
const PLUGIN_FILE$
|
|
244
|
+
const PLUGIN_FILE$3 = ".claude-plugin/plugin.json";
|
|
245
245
|
const SKILLS_DIRECTORY = "skills";
|
|
246
246
|
const SKILL_FILE$3 = "SKILL.md";
|
|
247
247
|
const CONCURRENCY$4 = 16;
|
|
@@ -286,7 +286,7 @@ const skillsOf = Effect.fn("skillsOf")(function* skillsOf(scan, plugin, director
|
|
|
286
286
|
});
|
|
287
287
|
const pluginAt = Effect.fn("pluginAt")(function* pluginAt(scan, directory) {
|
|
288
288
|
const files = yield* RepositoryFiles;
|
|
289
|
-
const manifest = yield* files.readFile(files.join(directory, PLUGIN_FILE$
|
|
289
|
+
const manifest = yield* files.readFile(files.join(directory, PLUGIN_FILE$3));
|
|
290
290
|
const decoded = pipe(manifest, Option.flatMap(decodeManifest));
|
|
291
291
|
if (Option.isNone(decoded)) return Option.none();
|
|
292
292
|
const { name } = decoded.value;
|
|
@@ -590,12 +590,12 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
590
590
|
// src/features/check-overrides/model/git-subpath.ts
|
|
591
591
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
592
592
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
593
|
-
const RULE$
|
|
593
|
+
const RULE$77 = "git-subpath-dependency";
|
|
594
594
|
const WHOLE_MATCH$4 = 0;
|
|
595
595
|
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
596
596
|
file,
|
|
597
597
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
598
|
-
rule: RULE$
|
|
598
|
+
rule: RULE$77,
|
|
599
599
|
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])}\`.`
|
|
600
600
|
});
|
|
601
601
|
const problemsIn$25 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array$1.map(problemAt$6(entry, source)));
|
|
@@ -606,13 +606,13 @@ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(r
|
|
|
606
606
|
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$25);
|
|
607
607
|
});
|
|
608
608
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
609
|
-
const RULE$
|
|
609
|
+
const RULE$76 = "unnamed-restriction";
|
|
610
610
|
const WHOLE_MATCH$3 = 0;
|
|
611
611
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
612
612
|
const problemsIn$24 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(UNNAMED)(source)), Array$1.map((found) => ({
|
|
613
613
|
file: entry.file,
|
|
614
614
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
615
|
-
rule: RULE$
|
|
615
|
+
rule: RULE$76,
|
|
616
616
|
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.`
|
|
617
617
|
})));
|
|
618
618
|
/** @internal */
|
|
@@ -621,13 +621,13 @@ const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRe
|
|
|
621
621
|
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$24);
|
|
622
622
|
});
|
|
623
623
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
624
|
-
const RULE$
|
|
624
|
+
const RULE$75 = "named-type-exemption";
|
|
625
625
|
const WHOLE_MATCH$2 = 0;
|
|
626
626
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
627
627
|
const problemsIn$23 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array$1.map((found) => ({
|
|
628
628
|
file: entry.file,
|
|
629
629
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
630
|
-
rule: RULE$
|
|
630
|
+
rule: RULE$75,
|
|
631
631
|
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."
|
|
632
632
|
})));
|
|
633
633
|
/** @internal */
|
|
@@ -636,7 +636,7 @@ const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkType
|
|
|
636
636
|
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$23);
|
|
637
637
|
});
|
|
638
638
|
// src/features/check-overrides/model/package-registry.ts
|
|
639
|
-
const RULE$
|
|
639
|
+
const RULE$74 = "package-registry";
|
|
640
640
|
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
641
641
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
642
642
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
@@ -657,7 +657,7 @@ const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ inde
|
|
|
657
657
|
const workspaceProblem = (required, { file, source }, registry) => ({
|
|
658
658
|
file,
|
|
659
659
|
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
660
|
-
rule: RULE$
|
|
660
|
+
rule: RULE$74,
|
|
661
661
|
message: Option.match(registry, {
|
|
662
662
|
onNone: () => `${required.reason} Set \`registry: ${required.registry}\` in ${WORKSPACE_FILE$6}.`,
|
|
663
663
|
onSome: (value) => `${required.reason} \`registry\` is ${value}. Set it to ${required.registry}.`
|
|
@@ -666,7 +666,7 @@ const workspaceProblem = (required, { file, source }, registry) => ({
|
|
|
666
666
|
const npmrcProblems = (required) => (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array$1.filter((found) => !Option.exists(groupOf("value")(found), isRequired(required))), Array$1.map((found) => ({
|
|
667
667
|
file: entry.file,
|
|
668
668
|
...positionOf(source)(found.index ?? START$29),
|
|
669
|
-
rule: RULE$
|
|
669
|
+
rule: RULE$74,
|
|
670
670
|
message: `${required.reason} This .npmrc overrides it with \`${String$1.trim(found[START$29])}\`. Remove the line.`
|
|
671
671
|
})));
|
|
672
672
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root, required) {
|
|
@@ -2818,7 +2818,7 @@ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* sca
|
|
|
2818
2818
|
})), Option.getOrElse(() => [])));
|
|
2819
2819
|
});
|
|
2820
2820
|
// src/features/check-overrides/model/removed-peers.ts
|
|
2821
|
-
const RULE$
|
|
2821
|
+
const RULE$73 = "removed-peer";
|
|
2822
2822
|
const MSCH$1 = "@r_masseater/msch";
|
|
2823
2823
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
2824
2824
|
const REMOVED = "-";
|
|
@@ -2846,7 +2846,7 @@ const problemAt$5 = (file, { key, line, column }) => ({ peer, dependent }) => ({
|
|
|
2846
2846
|
file,
|
|
2847
2847
|
line,
|
|
2848
2848
|
column,
|
|
2849
|
-
rule: RULE$
|
|
2849
|
+
rule: RULE$73,
|
|
2850
2850
|
message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
|
|
2851
2851
|
});
|
|
2852
2852
|
const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
|
|
@@ -2880,7 +2880,7 @@ const checkRemovedPeers = Effect.fn("checkRemovedPeers")(function* checkRemovedP
|
|
|
2880
2880
|
});
|
|
2881
2881
|
});
|
|
2882
2882
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
2883
|
-
const RULE$
|
|
2883
|
+
const RULE$72 = "colocated-git-patterns";
|
|
2884
2884
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
2885
2885
|
const ROOT$3 = ".";
|
|
2886
2886
|
const NEGATION$1 = "!";
|
|
@@ -2927,7 +2927,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
2927
2927
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
2928
2928
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array$1.map(toEntry), Array$1.getSomes);
|
|
2929
2929
|
});
|
|
2930
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
2930
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$72)(entry.file, {
|
|
2931
2931
|
line: entry.line,
|
|
2932
2932
|
column: FIRST$25
|
|
2933
2933
|
}, message);
|
|
@@ -2990,14 +2990,14 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
2990
2990
|
return Array$1.getSomes([...misplacedFound, ...repeatedFound]);
|
|
2991
2991
|
});
|
|
2992
2992
|
// src/features/check-placement/model/colocated-tests.ts
|
|
2993
|
-
const RULE$
|
|
2993
|
+
const RULE$71 = "colocated-test";
|
|
2994
2994
|
const FIRST$24 = 1;
|
|
2995
2995
|
const READ_CONCURRENCY$32 = 64;
|
|
2996
2996
|
const ROOT_SUBPATH$1 = ".";
|
|
2997
2997
|
const NAME_GROUP = "name";
|
|
2998
2998
|
const SPECIFIER_GROUP = "specifier";
|
|
2999
2999
|
const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
|
|
3000
|
-
const TEST_FILE$
|
|
3000
|
+
const TEST_FILE$4 = /\.test\.[cm]?[jt]sx?$/u;
|
|
3001
3001
|
const MANIFEST_NAME = /package\.json$/u;
|
|
3002
3002
|
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
|
|
3003
3003
|
const SPEC_DIRECTORY = /(?:^|\/)specs?\//u;
|
|
@@ -3009,15 +3009,15 @@ const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguis
|
|
|
3009
3009
|
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.";
|
|
3010
3010
|
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>.";
|
|
3011
3011
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
3012
|
-
const problemFor$
|
|
3012
|
+
const problemFor$10 = (test, message) => ({
|
|
3013
3013
|
file: test.file,
|
|
3014
3014
|
line: FIRST$24,
|
|
3015
3015
|
column: FIRST$24,
|
|
3016
|
-
rule: RULE$
|
|
3016
|
+
rule: RULE$71,
|
|
3017
3017
|
message: `${test.base} ${message}`
|
|
3018
3018
|
});
|
|
3019
3019
|
const groupsOf$2 = (source, pattern, group) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array$1.getSomes);
|
|
3020
|
-
const namesSibling = (source) => pipe([...groupsOf$2(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$2(source, DIRNAME_REFERENCE, NAME_GROUP)], Array$1.some((name) => !TEST_FILE$
|
|
3020
|
+
const namesSibling = (source) => pipe([...groupsOf$2(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$2(source, DIRNAME_REFERENCE, NAME_GROUP)], Array$1.some((name) => !TEST_FILE$4.test(name)));
|
|
3021
3021
|
const ownerOf$5 = (packages, name) => {
|
|
3022
3022
|
const owners = pipe(packages, Array$1.filter((directory) => String$1.startsWith(directory)(name)));
|
|
3023
3023
|
return Array$1.last(Array$1.sort(owners, byLength$2));
|
|
@@ -3053,10 +3053,10 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
3053
3053
|
});
|
|
3054
3054
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
3055
3055
|
const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
3056
|
-
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$
|
|
3057
|
-
if (!TEST_FILE$
|
|
3056
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$10(test, DIRECTORY_MESSAGE));
|
|
3057
|
+
if (!TEST_FILE$4.test(test.name)) return Option.none();
|
|
3058
3058
|
if (yield* refersIn(context, test)) return Option.none();
|
|
3059
|
-
return Option.some(problemFor$
|
|
3059
|
+
return Option.some(problemFor$10(test, SIBLING_MESSAGE));
|
|
3060
3060
|
});
|
|
3061
3061
|
/** @internal */
|
|
3062
3062
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
@@ -3096,22 +3096,22 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
3096
3096
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
3097
3097
|
const RECOMMENDED_LINES = 200;
|
|
3098
3098
|
const FIRST$23 = 1;
|
|
3099
|
-
const RULE$
|
|
3099
|
+
const RULE$70 = "agent-docs-length";
|
|
3100
3100
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
3101
|
-
const problemFor$
|
|
3101
|
+
const problemFor$9 = (file) => (lines) => {
|
|
3102
3102
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
3103
3103
|
return Option.some({
|
|
3104
3104
|
file,
|
|
3105
3105
|
line: 201,
|
|
3106
3106
|
column: FIRST$23,
|
|
3107
|
-
rule: RULE$
|
|
3107
|
+
rule: RULE$70,
|
|
3108
3108
|
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.`
|
|
3109
3109
|
});
|
|
3110
3110
|
};
|
|
3111
3111
|
/** @internal */
|
|
3112
|
-
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$
|
|
3112
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$9(file)(lineCount(source)));
|
|
3113
3113
|
// src/features/check-placement/model/claude-link.ts
|
|
3114
|
-
const RULE$
|
|
3114
|
+
const RULE$69 = "claude-md-link";
|
|
3115
3115
|
const CLAUDE = "CLAUDE.md";
|
|
3116
3116
|
const AGENTS = "AGENTS.md";
|
|
3117
3117
|
const FIRST$22 = 1;
|
|
@@ -3130,7 +3130,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3130
3130
|
file: path,
|
|
3131
3131
|
line: FIRST$22,
|
|
3132
3132
|
column: FIRST$22,
|
|
3133
|
-
rule: RULE$
|
|
3133
|
+
rule: RULE$69,
|
|
3134
3134
|
message: MESSAGE$19
|
|
3135
3135
|
})));
|
|
3136
3136
|
});
|
|
@@ -3139,7 +3139,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3139
3139
|
return Array$1.getSomes(found);
|
|
3140
3140
|
});
|
|
3141
3141
|
// src/features/check-placement/model/dangling-links.ts
|
|
3142
|
-
const RULE$
|
|
3142
|
+
const RULE$68 = "dangling-link";
|
|
3143
3143
|
const SEPARATOR$22 = "/";
|
|
3144
3144
|
const FIRST$21 = 1;
|
|
3145
3145
|
const READ_CONCURRENCY$29 = 16;
|
|
@@ -3155,7 +3155,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
3155
3155
|
file,
|
|
3156
3156
|
line: FIRST$21,
|
|
3157
3157
|
column: FIRST$21,
|
|
3158
|
-
rule: RULE$
|
|
3158
|
+
rule: RULE$68,
|
|
3159
3159
|
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.`
|
|
3160
3160
|
})));
|
|
3161
3161
|
});
|
|
@@ -3213,7 +3213,7 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
3213
3213
|
}));
|
|
3214
3214
|
});
|
|
3215
3215
|
// src/features/check-placement/model/deployed-readme.ts
|
|
3216
|
-
const RULE$
|
|
3216
|
+
const RULE$67 = "deployed-readme";
|
|
3217
3217
|
const ROOT_DIRECTORY$4 = "";
|
|
3218
3218
|
const READ_CONCURRENCY$28 = 16;
|
|
3219
3219
|
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.";
|
|
@@ -3253,14 +3253,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
3253
3253
|
const readme = yield* readReadme({
|
|
3254
3254
|
root,
|
|
3255
3255
|
directory,
|
|
3256
|
-
rule: RULE$
|
|
3256
|
+
rule: RULE$67,
|
|
3257
3257
|
missingMessage: MISSING_MESSAGE$2
|
|
3258
3258
|
});
|
|
3259
3259
|
return Result.match(readme, {
|
|
3260
3260
|
onFailure: Option.some,
|
|
3261
3261
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
3262
3262
|
file,
|
|
3263
|
-
rule: RULE$
|
|
3263
|
+
rule: RULE$67,
|
|
3264
3264
|
message: NO_URL_MESSAGE
|
|
3265
3265
|
})))
|
|
3266
3266
|
});
|
|
@@ -3277,7 +3277,7 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
3277
3277
|
return Array$1.getSomes(found);
|
|
3278
3278
|
});
|
|
3279
3279
|
// src/features/check-placement/model/nested-docs.ts
|
|
3280
|
-
const RULE$
|
|
3280
|
+
const RULE$66 = "nested-docs";
|
|
3281
3281
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
3282
3282
|
const SEPARATOR$20 = "/";
|
|
3283
3283
|
const READ_CONCURRENCY$27 = 64;
|
|
@@ -3290,19 +3290,19 @@ const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Sc
|
|
|
3290
3290
|
const taggedError$6 = Schema.TaggedError;
|
|
3291
3291
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
3292
3292
|
const isNested = (name) => String$1.includes(SEPARATOR$20)(name);
|
|
3293
|
-
const problemFor$
|
|
3293
|
+
const problemFor$8 = problemInFile(RULE$66);
|
|
3294
3294
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
3295
3295
|
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.";
|
|
3296
3296
|
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.";
|
|
3297
3297
|
const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
|
|
3298
3298
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
3299
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
3299
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$8(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
3300
3300
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
3301
|
-
return Option.some(problemFor$
|
|
3301
|
+
return Option.some(problemFor$8(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
3302
3302
|
};
|
|
3303
3303
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
3304
3304
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
3305
|
-
return Option.some(problemFor$
|
|
3305
|
+
return Option.some(problemFor$8(file, `${base} ${README_MESSAGE}`));
|
|
3306
3306
|
};
|
|
3307
3307
|
const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array$1.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array$1.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$2), MISSING_MESSAGE$1)));
|
|
3308
3308
|
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
@@ -3347,7 +3347,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
3347
3347
|
return [...Array$1.getSomes(found), ...missing];
|
|
3348
3348
|
});
|
|
3349
3349
|
// src/features/check-placement/model/published-readme.ts
|
|
3350
|
-
const RULE$
|
|
3350
|
+
const RULE$65 = "published-readme";
|
|
3351
3351
|
const READ_CONCURRENCY$26 = 16;
|
|
3352
3352
|
const MESSAGE$18 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
3353
3353
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
@@ -3355,7 +3355,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, english, {
|
|
|
3355
3355
|
const readme = yield* readReadme({
|
|
3356
3356
|
root,
|
|
3357
3357
|
directory,
|
|
3358
|
-
rule: RULE$
|
|
3358
|
+
rule: RULE$65,
|
|
3359
3359
|
missingMessage: MISSING_MESSAGE
|
|
3360
3360
|
});
|
|
3361
3361
|
return Result.match(readme, {
|
|
@@ -3366,7 +3366,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, english, {
|
|
|
3366
3366
|
file,
|
|
3367
3367
|
line,
|
|
3368
3368
|
column,
|
|
3369
|
-
rule: RULE$
|
|
3369
|
+
rule: RULE$65,
|
|
3370
3370
|
message: MESSAGE$18
|
|
3371
3371
|
};
|
|
3372
3372
|
}))
|
|
@@ -3381,12 +3381,12 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
3381
3381
|
return Array$1.getSomes(found);
|
|
3382
3382
|
});
|
|
3383
3383
|
// src/features/check-placement/model/published-tests.ts
|
|
3384
|
-
const RULE$
|
|
3384
|
+
const RULE$64 = "published-tests";
|
|
3385
3385
|
const FILE_START = 1;
|
|
3386
|
-
const TEST_FILE$
|
|
3386
|
+
const TEST_FILE$3 = /\.test\.[cm]?[jt]sx?$/u;
|
|
3387
3387
|
const MESSAGE$17 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
3388
|
-
const testedIn = (listed) => (prefix) => pipe(listed, Array$1.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$
|
|
3389
|
-
const problemFor$
|
|
3388
|
+
const testedIn = (listed) => (prefix) => pipe(listed, Array$1.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$3.test(file)));
|
|
3389
|
+
const problemFor$7 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
3390
3390
|
const files = yield* RepositoryFiles;
|
|
3391
3391
|
const absolute = files.join(root, directory);
|
|
3392
3392
|
const prefix = `${absolute}/`;
|
|
@@ -3395,7 +3395,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
3395
3395
|
file: files.join(absolute, PACKAGE_JSON_FILE),
|
|
3396
3396
|
line: FILE_START,
|
|
3397
3397
|
column: FILE_START,
|
|
3398
|
-
rule: RULE$
|
|
3398
|
+
rule: RULE$64,
|
|
3399
3399
|
message: MESSAGE$17
|
|
3400
3400
|
});
|
|
3401
3401
|
});
|
|
@@ -3405,11 +3405,11 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
3405
3405
|
const projects = yield* publishedProjects(root);
|
|
3406
3406
|
const listed = yield* files.listedFiles(root);
|
|
3407
3407
|
const absolute = pipe(listed, Array$1.map((file) => files.join(root, file)));
|
|
3408
|
-
const found = yield* Effect.forEach(projects, (project) => problemFor$
|
|
3408
|
+
const found = yield* Effect.forEach(projects, (project) => problemFor$7(root, absolute, project), { concurrency: 1 });
|
|
3409
3409
|
return Array$1.getSomes(found);
|
|
3410
3410
|
});
|
|
3411
3411
|
// src/features/check-placement/model/root-docs.ts
|
|
3412
|
-
const RULE$
|
|
3412
|
+
const RULE$63 = "root-docs";
|
|
3413
3413
|
const SEPARATOR$19 = "/";
|
|
3414
3414
|
const FIRST$19 = 1;
|
|
3415
3415
|
const MARKDOWN$5 = /\.(?:md|mdx|markdown)$/iu;
|
|
@@ -3424,12 +3424,12 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
3424
3424
|
file: files.join(root, name),
|
|
3425
3425
|
line: FIRST$19,
|
|
3426
3426
|
column: FIRST$19,
|
|
3427
|
-
rule: RULE$
|
|
3427
|
+
rule: RULE$63,
|
|
3428
3428
|
message: `${name} ${MESSAGE$16}`
|
|
3429
3429
|
})));
|
|
3430
3430
|
});
|
|
3431
3431
|
// src/features/check-placement/model/root-readme.ts
|
|
3432
|
-
const RULE$
|
|
3432
|
+
const RULE$62 = "root-readme";
|
|
3433
3433
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
3434
3434
|
const READ_CONCURRENCY$25 = 16;
|
|
3435
3435
|
const START$28 = 0;
|
|
@@ -3473,7 +3473,7 @@ const problemsIn$22 = (file, source, plugins) => (workspace) => {
|
|
|
3473
3473
|
const message = messageFor$2(workspace.directory);
|
|
3474
3474
|
const at = positionOf(source);
|
|
3475
3475
|
const pattern = patternFor(plugins)(workspace);
|
|
3476
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$
|
|
3476
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$62)(file, at(found.index ?? START$28), message)));
|
|
3477
3477
|
};
|
|
3478
3478
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
3479
3479
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
@@ -3510,7 +3510,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
3510
3510
|
return Array$1.flatten(found);
|
|
3511
3511
|
});
|
|
3512
3512
|
// src/features/check-placement/model/docs-mirror.ts
|
|
3513
|
-
const RULE$
|
|
3513
|
+
const RULE$61 = "docs-mirror";
|
|
3514
3514
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
3515
3515
|
const MIRROR_LIMIT = 3;
|
|
3516
3516
|
const READ_CONCURRENCY$24 = 16;
|
|
@@ -3529,20 +3529,20 @@ const firstMention = (source, workspace) => {
|
|
|
3529
3529
|
};
|
|
3530
3530
|
const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
|
|
3531
3531
|
const describe = (mentions) => pipe(mentions, Array$1.map(({ directory }) => `\`${directory}\``), Array$1.join(", "));
|
|
3532
|
-
const problemFor$
|
|
3532
|
+
const problemFor$6 = (file, source, mentions) => pipe(Array$1.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
|
|
3533
3533
|
const { line, column } = positionOf(source)(offset);
|
|
3534
3534
|
return {
|
|
3535
3535
|
file,
|
|
3536
3536
|
line,
|
|
3537
3537
|
column,
|
|
3538
|
-
rule: RULE$
|
|
3538
|
+
rule: RULE$61,
|
|
3539
3539
|
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.`
|
|
3540
3540
|
};
|
|
3541
3541
|
}), Option.toArray);
|
|
3542
3542
|
const othersIn = (doc, workspaces) => pipe(workspaces, Array$1.filter((workspace) => !ownerOf$3(doc)(workspace)));
|
|
3543
3543
|
const problemIn$4 = (workspaces) => (doc, file, source) => {
|
|
3544
3544
|
const mentions = pipe(othersIn(doc, workspaces), Array$1.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
|
|
3545
|
-
return problemFor$
|
|
3545
|
+
return problemFor$6(file, source, Array$1.sort(mentions, byOffset));
|
|
3546
3546
|
};
|
|
3547
3547
|
const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
3548
3548
|
const files = yield* RepositoryFiles;
|
|
@@ -3567,7 +3567,7 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
3567
3567
|
return Array$1.flatten(found);
|
|
3568
3568
|
});
|
|
3569
3569
|
// src/features/check-placement/model/ignored-sources.ts
|
|
3570
|
-
const RULE$
|
|
3570
|
+
const RULE$60 = "ignored-sources";
|
|
3571
3571
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
3572
3572
|
const FIRST$18 = 1;
|
|
3573
3573
|
const MESSAGE$15 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
@@ -3579,7 +3579,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
3579
3579
|
file: files.join(root, file),
|
|
3580
3580
|
line: FIRST$18,
|
|
3581
3581
|
column: FIRST$18,
|
|
3582
|
-
rule: RULE$
|
|
3582
|
+
rule: RULE$60,
|
|
3583
3583
|
message: MESSAGE$15
|
|
3584
3584
|
})));
|
|
3585
3585
|
});
|
|
@@ -12302,13 +12302,13 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
12302
12302
|
return [...sliceNameProblems(root, files.join, sources), ...Array$1.flatMap(Array$1.getSomes(read), problemsOf$4)];
|
|
12303
12303
|
});
|
|
12304
12304
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
12305
|
-
const RULE$
|
|
12305
|
+
const RULE$59 = "shadcn-ui-alias";
|
|
12306
12306
|
const FIRST$17 = 1;
|
|
12307
12307
|
const problemOf$10 = (directory, { file, alias }) => ({
|
|
12308
12308
|
file,
|
|
12309
12309
|
line: FIRST$17,
|
|
12310
12310
|
column: FIRST$17,
|
|
12311
|
-
rule: RULE$
|
|
12311
|
+
rule: RULE$59,
|
|
12312
12312
|
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/*".`
|
|
12313
12313
|
});
|
|
12314
12314
|
/** @internal */
|
|
@@ -12604,7 +12604,7 @@ const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMention
|
|
|
12604
12604
|
])));
|
|
12605
12605
|
});
|
|
12606
12606
|
// src/features/check-repository-layout/model/config-paths.ts
|
|
12607
|
-
const RULE$
|
|
12607
|
+
const RULE$58 = "config-path";
|
|
12608
12608
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
12609
12609
|
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
12610
12610
|
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
@@ -12623,7 +12623,7 @@ const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
|
12623
12623
|
const problemOf$9 = (file, source) => (mention) => ({
|
|
12624
12624
|
file,
|
|
12625
12625
|
...positionOf(source)(mention.index),
|
|
12626
|
-
rule: RULE$
|
|
12626
|
+
rule: RULE$58,
|
|
12627
12627
|
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
12628
12628
|
});
|
|
12629
12629
|
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
@@ -12648,7 +12648,7 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
12648
12648
|
return pipe(patterns, Array$1.map((pattern) => ({
|
|
12649
12649
|
file,
|
|
12650
12650
|
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
12651
|
-
rule: RULE$
|
|
12651
|
+
rule: RULE$58,
|
|
12652
12652
|
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
12653
12653
|
})));
|
|
12654
12654
|
});
|
|
@@ -12660,7 +12660,7 @@ const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPath
|
|
|
12660
12660
|
return [...Array$1.flatten(found), ...patterns];
|
|
12661
12661
|
});
|
|
12662
12662
|
// src/features/check-repository-layout/model/crates.ts
|
|
12663
|
-
const RULE$
|
|
12663
|
+
const RULE$57 = "unverified-crate";
|
|
12664
12664
|
const VERSION_RULE = "release-version";
|
|
12665
12665
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
12666
12666
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
@@ -12668,19 +12668,19 @@ const CONFIG_FILE$6 = "vite.config.ts";
|
|
|
12668
12668
|
const SEPARATOR$13 = "/";
|
|
12669
12669
|
const FIRST$14 = 1;
|
|
12670
12670
|
const READ_CONCURRENCY$20 = 8;
|
|
12671
|
-
const problemFor$
|
|
12671
|
+
const problemFor$5 = (crate, message) => ({
|
|
12672
12672
|
file: crate.manifest,
|
|
12673
12673
|
line: FIRST$14,
|
|
12674
12674
|
column: FIRST$14,
|
|
12675
|
-
rule: RULE$
|
|
12675
|
+
rule: RULE$57,
|
|
12676
12676
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
12677
12677
|
});
|
|
12678
12678
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
12679
12679
|
const files = yield* RepositoryFiles;
|
|
12680
12680
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
12681
|
-
if (Option.isNone(workspace)) return Option.some(problemFor$
|
|
12681
|
+
if (Option.isNone(workspace)) return Option.some(problemFor$5(crate, "is outside every workspace package"));
|
|
12682
12682
|
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
|
|
12683
|
-
return Option.some(problemFor$
|
|
12683
|
+
return Option.some(problemFor$5(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
|
|
12684
12684
|
});
|
|
12685
12685
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
12686
12686
|
const files = yield* RepositoryFiles;
|
|
@@ -12708,7 +12708,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
12708
12708
|
return Array$1.getSomes(Array$1.flatten(found));
|
|
12709
12709
|
});
|
|
12710
12710
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
12711
|
-
const RULE$
|
|
12711
|
+
const RULE$56 = "deploy-entry-pattern";
|
|
12712
12712
|
const FALLOW_KEYS = [
|
|
12713
12713
|
"entry",
|
|
12714
12714
|
"entryPoints",
|
|
@@ -12779,7 +12779,7 @@ const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
12779
12779
|
return pipe(Array$1.getSomes(flagged), Array$1.map(({ text: pattern, start }) => ({
|
|
12780
12780
|
file: path,
|
|
12781
12781
|
...positionOf(text.value)(start - kind.offset),
|
|
12782
|
-
rule: RULE$
|
|
12782
|
+
rule: RULE$56,
|
|
12783
12783
|
message: `${pattern} ${MESSAGE$14}`
|
|
12784
12784
|
})));
|
|
12785
12785
|
});
|
|
@@ -12812,7 +12812,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
12812
12812
|
return Array$1.flatten(found);
|
|
12813
12813
|
});
|
|
12814
12814
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
12815
|
-
const RULE$
|
|
12815
|
+
const RULE$55 = "listed-entry";
|
|
12816
12816
|
const ENTRY_KEYS = [
|
|
12817
12817
|
"entry",
|
|
12818
12818
|
"entryPoints",
|
|
@@ -12842,7 +12842,7 @@ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
12842
12842
|
return pipe(entryPatternsIn(parsed.program), Array$1.filter(namesOneFile(directories)), Array$1.map(({ text: pattern, start }) => ({
|
|
12843
12843
|
file: path,
|
|
12844
12844
|
...positionOf(text.value)(start),
|
|
12845
|
-
rule: RULE$
|
|
12845
|
+
rule: RULE$55,
|
|
12846
12846
|
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.`
|
|
12847
12847
|
})));
|
|
12848
12848
|
});
|
|
@@ -12854,7 +12854,7 @@ const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallow
|
|
|
12854
12854
|
return Array$1.flatten(found);
|
|
12855
12855
|
});
|
|
12856
12856
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
12857
|
-
const RULE$
|
|
12857
|
+
const RULE$54 = "root-workspace-path";
|
|
12858
12858
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
12859
12859
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
12860
12860
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -12873,7 +12873,7 @@ const mentions = (directory) => (text) => {
|
|
|
12873
12873
|
const problemsIn$17 = (file, source, directories) => (found) => pipe(directories, Array$1.filter((directory) => mentions(directory)(found.text)), Array$1.map((directory) => ({
|
|
12874
12874
|
file,
|
|
12875
12875
|
...positionOf(source)(found.start),
|
|
12876
|
-
rule: RULE$
|
|
12876
|
+
rule: RULE$54,
|
|
12877
12877
|
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.`
|
|
12878
12878
|
})));
|
|
12879
12879
|
/** @internal */
|
|
@@ -12887,7 +12887,7 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
12887
12887
|
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$17(file, source.value, directories)));
|
|
12888
12888
|
});
|
|
12889
12889
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
12890
|
-
const RULE$
|
|
12890
|
+
const RULE$53 = "hidden-verify";
|
|
12891
12891
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
12892
12892
|
const FIRST$12 = 1;
|
|
12893
12893
|
const READ_CONCURRENCY$17 = 8;
|
|
@@ -12901,7 +12901,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
12901
12901
|
file,
|
|
12902
12902
|
line: FIRST$12,
|
|
12903
12903
|
column: FIRST$12,
|
|
12904
|
-
rule: RULE$
|
|
12904
|
+
rule: RULE$53,
|
|
12905
12905
|
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}.`
|
|
12906
12906
|
}).pipe(Option.filter(() => verified));
|
|
12907
12907
|
});
|
|
@@ -12912,7 +12912,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
12912
12912
|
return Array$1.getSomes(found);
|
|
12913
12913
|
});
|
|
12914
12914
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
12915
|
-
const RULE$
|
|
12915
|
+
const RULE$52 = "shared-uncached-task";
|
|
12916
12916
|
const READ_CONCURRENCY$16 = 8;
|
|
12917
12917
|
const SHARED = 2;
|
|
12918
12918
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -12955,7 +12955,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
12955
12955
|
return pipe(definitions, Array$1.map(({ file, position, name, command }) => ({
|
|
12956
12956
|
file,
|
|
12957
12957
|
...position,
|
|
12958
|
-
rule: RULE$
|
|
12958
|
+
rule: RULE$52,
|
|
12959
12959
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array$1.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.`
|
|
12960
12960
|
})));
|
|
12961
12961
|
};
|
|
@@ -12966,7 +12966,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
12966
12966
|
return pipe(Array$1.flatten(found), Array$1.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array$1.flatMap(problemsOf$3));
|
|
12967
12967
|
});
|
|
12968
12968
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
12969
|
-
const RULE$
|
|
12969
|
+
const RULE$51 = "unlocked-task";
|
|
12970
12970
|
const READ_CONCURRENCY$15 = 8;
|
|
12971
12971
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
12972
12972
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -12978,7 +12978,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
12978
12978
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array$1.filter(tracksLockfiles), Array$1.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
12979
12979
|
file,
|
|
12980
12980
|
...positionOf(source)(task.start),
|
|
12981
|
-
rule: RULE$
|
|
12981
|
+
rule: RULE$51,
|
|
12982
12982
|
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.`
|
|
12983
12983
|
})), Option.toArray)));
|
|
12984
12984
|
/** @internal */
|
|
@@ -13133,7 +13133,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
13133
13133
|
/** @internal */
|
|
13134
13134
|
const producedPaths = (source) => pipe(jobsOf(source), Array$1.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array$1.flatMap(outputPathsOf));
|
|
13135
13135
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
13136
|
-
const RULE$
|
|
13136
|
+
const RULE$50 = "workflow-path";
|
|
13137
13137
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
13138
13138
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
13139
13139
|
const READ_CONCURRENCY$14 = 8;
|
|
@@ -13177,7 +13177,7 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
13177
13177
|
const problemOf$8 = (file, source) => (found) => ({
|
|
13178
13178
|
file,
|
|
13179
13179
|
...positionOf(source)(found.offset),
|
|
13180
|
-
rule: RULE$
|
|
13180
|
+
rule: RULE$50,
|
|
13181
13181
|
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.`
|
|
13182
13182
|
});
|
|
13183
13183
|
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -13575,7 +13575,7 @@ const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* che
|
|
|
13575
13575
|
return Array$1.flatten(found);
|
|
13576
13576
|
});
|
|
13577
13577
|
// src/features/check-migration-order/model/migration-order.ts
|
|
13578
|
-
const RULE$
|
|
13578
|
+
const RULE$49 = "migration-order";
|
|
13579
13579
|
const SNAPSHOT = "snapshot.json";
|
|
13580
13580
|
const MIGRATION = "migration.sql";
|
|
13581
13581
|
const SNAPSHOTS = [`*/${SNAPSHOT}`];
|
|
@@ -13609,7 +13609,7 @@ const outOfOrder = (root, base, join) => (migrations) => pipe(latestOf(migration
|
|
|
13609
13609
|
file: join(root, file),
|
|
13610
13610
|
line: FIRST$11,
|
|
13611
13611
|
column: FIRST$11,
|
|
13612
|
-
rule: RULE$
|
|
13612
|
+
rule: RULE$49,
|
|
13613
13613
|
message: `${folder} is new, but it sorts before ${latest.folder}, which ${base} already has. A database that has applied ${latest.folder} rejects an earlier migration, so delete ${folder} and generate it again after ${latest.folder}.`
|
|
13614
13614
|
})))), Option.getOrElse(() => []));
|
|
13615
13615
|
/** @internal */
|
|
@@ -13636,6 +13636,124 @@ const bundleErrorDetail = (error) => {
|
|
|
13636
13636
|
onNonEmpty: Array$1.join(" ")
|
|
13637
13637
|
}));
|
|
13638
13638
|
};
|
|
13639
|
+
// src/features/check-plugin-dependencies/model/unresolved-imports.ts
|
|
13640
|
+
const NOT_A_PACKAGE = /^(?:\.|\/|[A-Za-z]:[\\/])/u;
|
|
13641
|
+
/** @internal */
|
|
13642
|
+
const unresolvedIn = (chunks) => {
|
|
13643
|
+
const emitted = pipe(chunks, Array$1.map(({ fileName }) => fileName));
|
|
13644
|
+
return pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]), Array$1.filter((specifier) => !NOT_A_PACKAGE.test(specifier) && !isBuiltin(specifier) && !Array$1.contains(emitted, specifier)), Array$1.map(packageNameOf), Array$1.dedupe, Array$1.sortBy(Order.String));
|
|
13645
|
+
};
|
|
13646
|
+
const isChunk$1 = (item) => item.type === "chunk";
|
|
13647
|
+
const optionsFor$1 = (entries) => ({
|
|
13648
|
+
input: [...entries],
|
|
13649
|
+
platform: "node",
|
|
13650
|
+
logLevel: "silent",
|
|
13651
|
+
treeshake: false,
|
|
13652
|
+
external: (specifier) => isBuiltin(specifier)
|
|
13653
|
+
});
|
|
13654
|
+
/** @internal */
|
|
13655
|
+
const unresolvedFrom = (entries) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
13656
|
+
try: () => rolldown(optionsFor$1(entries)),
|
|
13657
|
+
catch: bundleErrorDetail
|
|
13658
|
+
}), (bundle) => Effect.tryPromise({
|
|
13659
|
+
try: () => bundle.generate({ format: "esm" }),
|
|
13660
|
+
catch: bundleErrorDetail
|
|
13661
|
+
}), (bundle) => Effect.promise(() => bundle.close())).pipe(Effect.map(({ output }) => unresolvedIn(pipe(output, Array$1.filter(isChunk$1)))));
|
|
13662
|
+
// src/features/check-plugin-dependencies/model/plugin-dependencies.ts
|
|
13663
|
+
const RULE$48 = "plugin-dependencies";
|
|
13664
|
+
const PLUGIN_FILE$2 = ".claude-plugin/plugin.json";
|
|
13665
|
+
const LOCK_FILE = "bun.lock";
|
|
13666
|
+
const SOURCE_FILE = /\.[cm]?[jt]sx?$/u;
|
|
13667
|
+
const TEST_FILE$2 = /\.test(?:\.support)?\.[cm]?[jt]sx?$/u;
|
|
13668
|
+
const SUCCESS$1 = 0;
|
|
13669
|
+
const NOT_STARTED = -1;
|
|
13670
|
+
const DETAIL_LINES = 3;
|
|
13671
|
+
const PLUGIN_CONCURRENCY = 2;
|
|
13672
|
+
const problemFor$4 = problemInFile(RULE$48);
|
|
13673
|
+
const hasDependencies = Effect.fn("hasDependencies")(function* hasDependencies(directory) {
|
|
13674
|
+
const files = yield* RepositoryFiles;
|
|
13675
|
+
const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
|
|
13676
|
+
return pipe(text, Option.flatMap(decodePackageJson), Option.flatMapNullishOr(({ dependencies }) => dependencies), Option.exists((dependencies) => !Record.isEmptyRecord(dependencies)));
|
|
13677
|
+
});
|
|
13678
|
+
const shipsDependencies = Effect.fn("shipsDependencies")(function* shipsDependencies(root, project) {
|
|
13679
|
+
const files = yield* RepositoryFiles;
|
|
13680
|
+
const directory = files.join(root, project.directory);
|
|
13681
|
+
if (!(yield* files.exists(files.join(directory, PLUGIN_FILE$2)))) return false;
|
|
13682
|
+
return yield* hasDependencies(directory);
|
|
13683
|
+
});
|
|
13684
|
+
const needed = (project) => (file) => {
|
|
13685
|
+
const prefix = `${project.directory}/`;
|
|
13686
|
+
return String$1.startsWith(prefix)(file) && (SOURCE_FILE.test(file) || file === `${prefix}${PACKAGE_JSON_FILE}` || file === `${prefix}${LOCK_FILE}`);
|
|
13687
|
+
};
|
|
13688
|
+
const copied = Effect.fn("copied")(function* copied(root, project, sandbox) {
|
|
13689
|
+
const files = yield* RepositoryFiles;
|
|
13690
|
+
const listed = yield* files.listedFiles(root);
|
|
13691
|
+
const copies = pipe(listed, Array$1.filter(needed(project)), Array$1.map((file) => ({
|
|
13692
|
+
from: files.join(root, file),
|
|
13693
|
+
name: files.relative(project.directory, file)
|
|
13694
|
+
})));
|
|
13695
|
+
yield* Effect.forEach(copies, ({ from, name }) => files.readFile(from).pipe(Effect.flatMap(Option.match({
|
|
13696
|
+
onNone: () => Effect.void,
|
|
13697
|
+
onSome: (source) => files.writeFile(files.join(sandbox, name), source)
|
|
13698
|
+
}))), {
|
|
13699
|
+
concurrency: 1,
|
|
13700
|
+
discard: true
|
|
13701
|
+
});
|
|
13702
|
+
return pipe(copies, Array$1.map(({ name }) => name), Array$1.filter((name) => SOURCE_FILE.test(name) && !TEST_FILE$2.test(name)), Array$1.map((name) => files.join(sandbox, name)));
|
|
13703
|
+
});
|
|
13704
|
+
const installed = Effect.fn("installed")(function* installed(sandbox) {
|
|
13705
|
+
const handle = yield* ChildProcess.make("bun", ["install", "--frozen-lockfile"], {
|
|
13706
|
+
cwd: sandbox,
|
|
13707
|
+
extendEnv: true,
|
|
13708
|
+
stdin: "ignore",
|
|
13709
|
+
stdout: "ignore"
|
|
13710
|
+
});
|
|
13711
|
+
const detail = yield* handle.stderr.pipe(Stream.decodeText(), Stream.mkString);
|
|
13712
|
+
const code = yield* handle.exitCode;
|
|
13713
|
+
return {
|
|
13714
|
+
code: Number(code),
|
|
13715
|
+
detail
|
|
13716
|
+
};
|
|
13717
|
+
}, Effect.scoped);
|
|
13718
|
+
const bunNotStarted = () => ({
|
|
13719
|
+
code: NOT_STARTED,
|
|
13720
|
+
detail: "bun could not be started. Install bun, because Claude Code installs plugin dependencies with it."
|
|
13721
|
+
});
|
|
13722
|
+
const firstLines = (detail) => pipe(String$1.split(detail, "\n"), Array$1.filter(String$1.isNonEmpty), Array$1.take(DETAIL_LINES), Array$1.join(" "));
|
|
13723
|
+
const installProblem = (file, { detail }) => problemFor$4(file, `\`bun install --frozen-lockfile\` with only package.json and ${LOCK_FILE} fails, and Claude Code installs a plugin's dependencies this way. ${firstLines(detail)}`);
|
|
13724
|
+
const missingLock = (file) => problemFor$4(file, `Claude Code installs a plugin's dependencies from package.json and a lockfile only. Commit ${LOCK_FILE}, which \`bun install\` writes in the plugin directory.`);
|
|
13725
|
+
const unresolvedProblem = (file, names) => problemFor$4(file, `${Array$1.join(names, ", ")} cannot be resolved after installing only the dependencies in package.json and ${LOCK_FILE}, so a hook that loads it fails in the plugin cache, where optional peers are not installed. List each package the plugin or a dependency imports in "dependencies", or bundle it into the dependency.`);
|
|
13726
|
+
const bundleProblem$2 = (file, detail) => problemFor$4(file, `A source of the plugin does not bundle against the installed dependencies. ${detail}`);
|
|
13727
|
+
const unresolvedProblems = (file, names) => {
|
|
13728
|
+
if (Array$1.isReadonlyArrayEmpty(names)) return [];
|
|
13729
|
+
return [unresolvedProblem(file, names)];
|
|
13730
|
+
};
|
|
13731
|
+
const checkInstalled = Effect.fn("checkInstalled")(function* checkInstalled(manifest, sandbox, entries) {
|
|
13732
|
+
const result = yield* installed(sandbox).pipe(Effect.orElseSucceed(bunNotStarted));
|
|
13733
|
+
if (result.code !== SUCCESS$1) return [installProblem(manifest, result)];
|
|
13734
|
+
if (!Array$1.isReadonlyArrayNonEmpty(entries)) return [];
|
|
13735
|
+
return yield* unresolvedFrom(entries).pipe(Effect.match({
|
|
13736
|
+
onFailure: (detail) => [bundleProblem$2(manifest, detail)],
|
|
13737
|
+
onSuccess: (names) => unresolvedProblems(manifest, names)
|
|
13738
|
+
}));
|
|
13739
|
+
});
|
|
13740
|
+
const checkPlugin = Effect.fn("checkPlugin")(function* checkPlugin(root, project) {
|
|
13741
|
+
const files = yield* RepositoryFiles;
|
|
13742
|
+
const fileSystem = yield* FileSystem.FileSystem;
|
|
13743
|
+
const directory = files.join(root, project.directory);
|
|
13744
|
+
const manifest = files.join(directory, PACKAGE_JSON_FILE);
|
|
13745
|
+
if (!(yield* files.exists(files.join(directory, LOCK_FILE)))) return [missingLock(manifest)];
|
|
13746
|
+
const sandbox = yield* fileSystem.makeTempDirectoryScoped({ prefix: "msch-plugin-" });
|
|
13747
|
+
const entries = yield* copied(root, project, sandbox);
|
|
13748
|
+
return yield* checkInstalled(manifest, sandbox, entries);
|
|
13749
|
+
}, Effect.scoped);
|
|
13750
|
+
/** @internal */
|
|
13751
|
+
const checkPluginDependencies = Effect.fn("checkPluginDependencies")(function* checkPluginDependencies(root) {
|
|
13752
|
+
const projects = yield* workspaceProjects(root);
|
|
13753
|
+
const plugins = yield* Effect.filter(projects, (project) => shipsDependencies(root, project), { concurrency: "unbounded" });
|
|
13754
|
+
const found = yield* Effect.forEach(plugins, (project) => checkPlugin(root, project), { concurrency: PLUGIN_CONCURRENCY });
|
|
13755
|
+
return Array$1.flatten(found);
|
|
13756
|
+
});
|
|
13639
13757
|
// src/features/check-tree-shaking/model/consumer-bundle.ts
|
|
13640
13758
|
const VIRTUAL_PREFIX = "\0";
|
|
13641
13759
|
const VIRTUAL = `${VIRTUAL_PREFIX}tree-shaking-consumer`;
|
|
@@ -13654,8 +13772,8 @@ const taggedError$5 = Schema.TaggedError;
|
|
|
13654
13772
|
var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schema.String }) {};
|
|
13655
13773
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
13656
13774
|
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
13657
|
-
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
13658
|
-
const isExternal = ({ declared, bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && (isBuiltin(specifier) || Array$1.contains(declared, packageNameOf(specifier)) && !Array$1.contains(bundled, packageNameOf(specifier)));
|
|
13775
|
+
const isBuiltin$1 = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
13776
|
+
const isExternal = ({ declared, bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && (isBuiltin$1(specifier) || Array$1.contains(declared, packageNameOf(specifier)) && !Array$1.contains(bundled, packageNameOf(specifier)));
|
|
13659
13777
|
const consumerSource = ({ entry, member }) => Option.match(member, {
|
|
13660
13778
|
onNone: () => `export * from ${quote(entry)};\n`,
|
|
13661
13779
|
onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`
|
|
@@ -13692,7 +13810,7 @@ const optionsFor = (scope, input, effectful) => {
|
|
|
13692
13810
|
const isChunk = (item) => item.type === "chunk";
|
|
13693
13811
|
const keptBy = (chunks) => ({
|
|
13694
13812
|
modules: pipe(chunks, Array$1.flatMap((chunk) => Record.keys(chunk.modules)), Array$1.filter((id) => !String$1.startsWith(VIRTUAL_PREFIX)(id)), Array$1.dedupe, Array$1.sortBy(Order.String)),
|
|
13695
|
-
packages: pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]), Array$1.filter((specifier) => isBare(specifier) && !isBuiltin(specifier)), Array$1.map(packageNameOf), Array$1.dedupe, Array$1.sortBy(Order.String))
|
|
13813
|
+
packages: pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]), Array$1.filter((specifier) => isBare(specifier) && !isBuiltin$1(specifier)), Array$1.map(packageNameOf), Array$1.dedupe, Array$1.sortBy(Order.String))
|
|
13696
13814
|
});
|
|
13697
13815
|
const generate = (options) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
13698
13816
|
try: () => rolldown(options),
|
|
@@ -14128,7 +14246,8 @@ const checkBuilds = Effect.fn("checkBuilds")(function* checkBuilds(root) {
|
|
|
14128
14246
|
checkTypescriptGeneration(root),
|
|
14129
14247
|
checkWorkerBundles(root),
|
|
14130
14248
|
checkTreeShaking(root),
|
|
14131
|
-
checkMigrationOrder(root)
|
|
14249
|
+
checkMigrationOrder(root),
|
|
14250
|
+
checkPluginDependencies(root)
|
|
14132
14251
|
], { concurrency: "unbounded" });
|
|
14133
14252
|
return Array$1.flatten(found);
|
|
14134
14253
|
});
|