@r_masseater/msch 0.53.0 → 0.53.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 +580 -397
- package/dist/cli.mjs.map +1 -1
- package/dist/publish.mjs +1 -1
- package/dist/publish.mjs.map +1 -1
- package/package.json +12 -12
package/dist/cli.mjs
CHANGED
|
@@ -226,8 +226,8 @@ const RESOLUTION_FILES = [
|
|
|
226
226
|
];
|
|
227
227
|
const RESOLUTION_CONCURRENCY = 4;
|
|
228
228
|
const SUCCEEDED$1 = 0;
|
|
229
|
-
const taggedError$
|
|
230
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
229
|
+
const taggedError$7 = Schema.TaggedError;
|
|
230
|
+
var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
|
|
231
231
|
override: Schema.String,
|
|
232
232
|
output: Schema.String
|
|
233
233
|
}) {};
|
|
@@ -348,55 +348,55 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
348
348
|
// src/features/check-overrides/model/git-subpath.ts
|
|
349
349
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
350
350
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
351
|
-
const RULE$
|
|
351
|
+
const RULE$57 = "git-subpath-dependency";
|
|
352
352
|
const WHOLE_MATCH$3 = 0;
|
|
353
353
|
const problemAt$7 = ({ file }, source) => (found) => ({
|
|
354
354
|
file,
|
|
355
355
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
356
|
-
rule: RULE$
|
|
356
|
+
rule: RULE$57,
|
|
357
357
|
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$3])}\`.`
|
|
358
358
|
});
|
|
359
|
-
const problemsIn$
|
|
359
|
+
const problemsIn$19 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
|
|
360
360
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
361
361
|
/** @internal */
|
|
362
362
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
363
363
|
const listed = yield* listedFiles(root);
|
|
364
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
364
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$19);
|
|
365
365
|
});
|
|
366
366
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
367
|
-
const RULE$
|
|
367
|
+
const RULE$56 = "unnamed-restriction";
|
|
368
368
|
const WHOLE_MATCH$2 = 0;
|
|
369
369
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
370
|
-
const problemsIn$
|
|
370
|
+
const problemsIn$18 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
371
371
|
file: entry.file,
|
|
372
372
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
373
|
-
rule: RULE$
|
|
373
|
+
rule: RULE$56,
|
|
374
374
|
message: `${found[WHOLE_MATCH$2]} 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.`
|
|
375
375
|
})));
|
|
376
376
|
/** @internal */
|
|
377
377
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
378
378
|
const listed = yield* listedFiles(root);
|
|
379
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
379
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$18);
|
|
380
380
|
});
|
|
381
381
|
// src/features/check-overrides/model/package-registry.ts
|
|
382
|
-
const RULE$
|
|
382
|
+
const RULE$55 = "package-registry";
|
|
383
383
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
384
384
|
const TRAILING_SLASH = /\/$/u;
|
|
385
385
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
386
386
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
387
387
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
388
388
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
389
|
-
const START$
|
|
389
|
+
const START$21 = 0;
|
|
390
390
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
391
391
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
392
392
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
393
393
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
394
394
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
395
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
395
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$21));
|
|
396
396
|
const workspaceProblem = (file, source, registry) => ({
|
|
397
397
|
file,
|
|
398
398
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
399
|
-
rule: RULE$
|
|
399
|
+
rule: RULE$55,
|
|
400
400
|
message: Option.match(registry, {
|
|
401
401
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
402
402
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -404,9 +404,9 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
404
404
|
});
|
|
405
405
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
|
|
406
406
|
file: entry.file,
|
|
407
|
-
...positionOf(source)(found.index ?? START$
|
|
408
|
-
rule: RULE$
|
|
409
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
407
|
+
...positionOf(source)(found.index ?? START$21),
|
|
408
|
+
rule: RULE$55,
|
|
409
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$21])}\`. Remove the line.`
|
|
410
410
|
})));
|
|
411
411
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
412
412
|
const files = yield* RepositoryFiles;
|
|
@@ -425,7 +425,7 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
425
425
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
426
426
|
});
|
|
427
427
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
428
|
-
const RULE$
|
|
428
|
+
const RULE$54 = "colocated-git-patterns";
|
|
429
429
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
430
430
|
const ROOT$3 = ".";
|
|
431
431
|
const SEPARATOR$22 = "/";
|
|
@@ -437,7 +437,7 @@ const LEADING_SLASHES = /^\/+/u;
|
|
|
437
437
|
const TRAILING_SLASHES = /\/+$/u;
|
|
438
438
|
const SPACES = /\s+/u;
|
|
439
439
|
const FIRST$21 = 1;
|
|
440
|
-
const READ_CONCURRENCY$
|
|
440
|
+
const READ_CONCURRENCY$31 = 16;
|
|
441
441
|
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$3 || String$1.startsWith(`${directory}${SEPARATOR$22}`)(inner));
|
|
442
442
|
const withoutPrefix = (prefix, text) => {
|
|
443
443
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
@@ -478,7 +478,7 @@ const problemAt$6 = (entry, message) => ({
|
|
|
478
478
|
file: entry.file,
|
|
479
479
|
line: entry.line,
|
|
480
480
|
column: FIRST$21,
|
|
481
|
-
rule: RULE$
|
|
481
|
+
rule: RULE$54,
|
|
482
482
|
message
|
|
483
483
|
});
|
|
484
484
|
const misplacedMessage = (kind, workspaces) => {
|
|
@@ -532,17 +532,17 @@ const repeated = (entries) => (entry) => {
|
|
|
532
532
|
/** @internal */
|
|
533
533
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
534
534
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
535
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
535
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$31 });
|
|
536
536
|
const entries = Array.flatten(read);
|
|
537
537
|
const workspaces = yield* workspaceDirectories(root);
|
|
538
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
538
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$31 });
|
|
539
539
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
540
540
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
541
541
|
});
|
|
542
542
|
// src/features/check-placement/model/colocated-tests.ts
|
|
543
|
-
const RULE$
|
|
543
|
+
const RULE$53 = "colocated-test";
|
|
544
544
|
const FIRST$20 = 1;
|
|
545
|
-
const READ_CONCURRENCY$
|
|
545
|
+
const READ_CONCURRENCY$30 = 64;
|
|
546
546
|
const ROOT_SUBPATH = ".";
|
|
547
547
|
const NAME_GROUP = "name";
|
|
548
548
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -555,20 +555,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
555
555
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
556
556
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
557
557
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
558
|
-
const EXCLUDED$
|
|
558
|
+
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
559
559
|
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.";
|
|
560
560
|
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>.";
|
|
561
|
-
const Manifest$
|
|
561
|
+
const Manifest$6 = Schema.Struct({
|
|
562
562
|
name: Schema.optional(Schema.String),
|
|
563
563
|
exports: Schema.optional(Schema.Unknown)
|
|
564
564
|
});
|
|
565
|
-
const decodeManifest$
|
|
565
|
+
const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
566
566
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
567
|
-
const problemFor$
|
|
567
|
+
const problemFor$7 = (test, message) => ({
|
|
568
568
|
file: test.file,
|
|
569
569
|
line: FIRST$20,
|
|
570
570
|
column: FIRST$20,
|
|
571
|
-
rule: RULE$
|
|
571
|
+
rule: RULE$53,
|
|
572
572
|
message: `${test.base} ${message}`
|
|
573
573
|
});
|
|
574
574
|
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);
|
|
@@ -588,7 +588,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
588
588
|
if (Option.isNone(owner)) return [];
|
|
589
589
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
590
590
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
591
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
591
|
+
return pipe(text, Option.flatMap(decodeManifest$10), Option.map(specifiersBeside({
|
|
592
592
|
join,
|
|
593
593
|
dirname: files.dirname,
|
|
594
594
|
directory: test.directory
|
|
@@ -607,16 +607,16 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
607
607
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
608
608
|
});
|
|
609
609
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
610
|
-
const problemIn$
|
|
611
|
-
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$
|
|
610
|
+
const problemIn$7 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
611
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$7(test, DIRECTORY_MESSAGE));
|
|
612
612
|
if (!TEST_FILE$2.test(test.name)) return Option.none();
|
|
613
613
|
if (yield* refersIn(context, test)) return Option.none();
|
|
614
|
-
return Option.some(problemFor$
|
|
614
|
+
return Option.some(problemFor$7(test, SIBLING_MESSAGE));
|
|
615
615
|
});
|
|
616
616
|
/** @internal */
|
|
617
617
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
618
618
|
const files = yield* RepositoryFiles;
|
|
619
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
619
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$8);
|
|
620
620
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
621
621
|
const context = {
|
|
622
622
|
root,
|
|
@@ -631,12 +631,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
631
631
|
directory: files.dirname(file)
|
|
632
632
|
};
|
|
633
633
|
}));
|
|
634
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$
|
|
634
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$7(context, test), { concurrency: READ_CONCURRENCY$30 });
|
|
635
635
|
return Array.getSomes(found);
|
|
636
636
|
});
|
|
637
637
|
// src/shared/lib/agent-docs.ts
|
|
638
638
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
639
|
-
const READ_CONCURRENCY$
|
|
639
|
+
const READ_CONCURRENCY$29 = 16;
|
|
640
640
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
641
641
|
const files = yield* RepositoryFiles;
|
|
642
642
|
const listed = yield* files.listedFiles(root);
|
|
@@ -645,32 +645,32 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
645
645
|
const file = files.join(root, name);
|
|
646
646
|
const problemOf = Option.flatMap(problemIn(file));
|
|
647
647
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
648
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
648
|
+
}, { concurrency: READ_CONCURRENCY$29 });
|
|
649
649
|
return Array.getSomes(found);
|
|
650
650
|
});
|
|
651
651
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
652
652
|
const RECOMMENDED_LINES = 200;
|
|
653
653
|
const FIRST$19 = 1;
|
|
654
|
-
const RULE$
|
|
654
|
+
const RULE$52 = "agent-docs-length";
|
|
655
655
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
656
|
-
const problemFor$
|
|
656
|
+
const problemFor$6 = (file) => (lines) => {
|
|
657
657
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
658
658
|
return Option.some({
|
|
659
659
|
file,
|
|
660
660
|
line: 201,
|
|
661
661
|
column: FIRST$19,
|
|
662
|
-
rule: RULE$
|
|
662
|
+
rule: RULE$52,
|
|
663
663
|
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.`
|
|
664
664
|
});
|
|
665
665
|
};
|
|
666
666
|
/** @internal */
|
|
667
|
-
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$
|
|
667
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$6(file)(lineCount(source)));
|
|
668
668
|
// src/features/check-placement/model/claude-link.ts
|
|
669
|
-
const RULE$
|
|
669
|
+
const RULE$51 = "claude-md-link";
|
|
670
670
|
const CLAUDE = "CLAUDE.md";
|
|
671
671
|
const AGENTS = "AGENTS.md";
|
|
672
672
|
const FIRST$18 = 1;
|
|
673
|
-
const READ_CONCURRENCY$
|
|
673
|
+
const READ_CONCURRENCY$28 = 16;
|
|
674
674
|
const MESSAGE$16 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
675
675
|
/** @internal */
|
|
676
676
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -685,19 +685,19 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
685
685
|
file: path,
|
|
686
686
|
line: FIRST$18,
|
|
687
687
|
column: FIRST$18,
|
|
688
|
-
rule: RULE$
|
|
688
|
+
rule: RULE$51,
|
|
689
689
|
message: MESSAGE$16
|
|
690
690
|
})));
|
|
691
691
|
});
|
|
692
692
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
693
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
693
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$28 });
|
|
694
694
|
return Array.getSomes(found);
|
|
695
695
|
});
|
|
696
696
|
// src/features/check-placement/model/dangling-links.ts
|
|
697
|
-
const RULE$
|
|
697
|
+
const RULE$50 = "dangling-link";
|
|
698
698
|
const SEPARATOR$21 = "/";
|
|
699
699
|
const FIRST$17 = 1;
|
|
700
|
-
const READ_CONCURRENCY$
|
|
700
|
+
const READ_CONCURRENCY$27 = 16;
|
|
701
701
|
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$21}`)(name);
|
|
702
702
|
/** @internal */
|
|
703
703
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
@@ -710,37 +710,151 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
710
710
|
file,
|
|
711
711
|
line: FIRST$17,
|
|
712
712
|
column: FIRST$17,
|
|
713
|
-
rule: RULE$
|
|
713
|
+
rule: RULE$50,
|
|
714
714
|
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.`
|
|
715
715
|
})));
|
|
716
716
|
});
|
|
717
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
717
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$27 });
|
|
718
718
|
return Array.getSomes(found);
|
|
719
719
|
});
|
|
720
|
-
// src/features/check-placement/model/
|
|
721
|
-
const
|
|
722
|
-
const
|
|
720
|
+
// src/features/check-placement/model/member-sources.ts
|
|
721
|
+
const ROOT_WORKSPACE$1 = ".";
|
|
722
|
+
const FIRST$16 = 1;
|
|
723
723
|
const SEPARATOR$20 = "/";
|
|
724
|
-
const
|
|
724
|
+
const EXCLUDED$7 = [
|
|
725
|
+
":(exclude,attr:linguist-vendored)",
|
|
726
|
+
":(exclude,attr:linguist-generated)",
|
|
727
|
+
":(exclude,attr:linguist-documentation)"
|
|
728
|
+
];
|
|
729
|
+
const memberWorkspaces = Effect.fn("memberWorkspaces")(function* memberWorkspaces(root) {
|
|
730
|
+
const declared = yield* workspaceDirectories(root);
|
|
731
|
+
return pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE$1));
|
|
732
|
+
});
|
|
733
|
+
const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
734
|
+
const files = yield* RepositoryFiles;
|
|
735
|
+
return {
|
|
736
|
+
workspaces: yield* memberWorkspaces(root),
|
|
737
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$7)
|
|
738
|
+
};
|
|
739
|
+
});
|
|
740
|
+
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
741
|
+
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
742
|
+
file,
|
|
743
|
+
line: FIRST$16,
|
|
744
|
+
column: FIRST$16,
|
|
745
|
+
rule,
|
|
746
|
+
message
|
|
747
|
+
});
|
|
748
|
+
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$20}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
749
|
+
workspace,
|
|
750
|
+
inner: String$1.slice(workspace.length + 1)(name)
|
|
751
|
+
})));
|
|
752
|
+
// src/features/check-placement/model/readme-file.ts
|
|
753
|
+
const README_FILE = "README.md";
|
|
754
|
+
const readReadme = Effect.fn("readReadme")(function* readReadme({ root, directory, rule, missingMessage }) {
|
|
755
|
+
const files = yield* RepositoryFiles;
|
|
756
|
+
const file = files.join(root, directory, README_FILE);
|
|
757
|
+
const text = yield* files.readFile(file);
|
|
758
|
+
return pipe(text, Option.match({
|
|
759
|
+
onNone: () => Result.fail(fileProblem$1({
|
|
760
|
+
file,
|
|
761
|
+
rule,
|
|
762
|
+
message: missingMessage
|
|
763
|
+
})),
|
|
764
|
+
onSome: (source) => Result.succeed({
|
|
765
|
+
file,
|
|
766
|
+
source
|
|
767
|
+
})
|
|
768
|
+
}));
|
|
769
|
+
});
|
|
770
|
+
// src/features/check-placement/model/deployed-readme.ts
|
|
771
|
+
const RULE$49 = "deployed-readme";
|
|
772
|
+
const ROOT_DIRECTORY$2 = "";
|
|
773
|
+
const READ_CONCURRENCY$26 = 16;
|
|
774
|
+
const MISSING_MESSAGE$1 = "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.";
|
|
775
|
+
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.";
|
|
776
|
+
const ADDRESS_KEYS = [
|
|
777
|
+
"domain",
|
|
778
|
+
"domains",
|
|
779
|
+
"routes",
|
|
780
|
+
"hostname"
|
|
781
|
+
];
|
|
782
|
+
const URL_KEY = "url";
|
|
783
|
+
const STACK_FILE = /(?:^|\/)alchemy\.(?![^/]*\.test\.)[^/]+\.[cm]?ts$/u;
|
|
784
|
+
const ALCHEMY_IMPORT = /from\s+["'](?:alchemy|@alchemy\.run)(?:\/[^"']*)?["']/u;
|
|
785
|
+
const URL_PATTERN = /https:\/\/[^\s)>\]]+/u;
|
|
786
|
+
const decodeKey$2 = Schema.decodeUnknownOption(KeySchema);
|
|
787
|
+
const propertyNamed = (names) => (node) => Predicate.isReadonlyObject(node) && node["type"] === "Property" && pipe(decodeKey$2(node["key"]), Option.exists((key) => Array.contains(names, keyName(key))));
|
|
788
|
+
const isAddressProperty = propertyNamed(ADDRESS_KEYS);
|
|
789
|
+
const isUrlProperty = propertyNamed([URL_KEY]);
|
|
790
|
+
const ReturnedObject = Schema.Struct({
|
|
791
|
+
type: Schema.Literal("ReturnStatement"),
|
|
792
|
+
argument: Schema.Struct({
|
|
793
|
+
type: Schema.Literal("ObjectExpression"),
|
|
794
|
+
properties: Schema.Array(Schema.Unknown)
|
|
795
|
+
})
|
|
796
|
+
});
|
|
797
|
+
const decodeReturnedObject = Schema.decodeUnknownOption(ReturnedObject);
|
|
798
|
+
const returnsUrl = (node) => pipe(decodeReturnedObject(node), Option.exists(({ argument }) => pipe(argument.properties, Array.some(isUrlProperty))));
|
|
799
|
+
const servesAddress = (node) => isAddressProperty(node) || returnsUrl(node) || pipe(childrenOf$1(node), Array.some(servesAddress));
|
|
800
|
+
const deploysTo = Effect.fn("deploysTo")(function* deploysTo(root, file) {
|
|
801
|
+
const files = yield* RepositoryFiles;
|
|
802
|
+
const text = yield* files.readFile(files.join(root, file));
|
|
803
|
+
if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value)) return false;
|
|
804
|
+
const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: "ts" }));
|
|
805
|
+
return servesAddress(parsed.program);
|
|
806
|
+
});
|
|
807
|
+
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
808
|
+
const readme = yield* readReadme({
|
|
809
|
+
root,
|
|
810
|
+
directory,
|
|
811
|
+
rule: RULE$49,
|
|
812
|
+
missingMessage: MISSING_MESSAGE$1
|
|
813
|
+
});
|
|
814
|
+
return Result.match(readme, {
|
|
815
|
+
onFailure: Option.some,
|
|
816
|
+
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
817
|
+
file,
|
|
818
|
+
rule: RULE$49,
|
|
819
|
+
message: NO_URL_MESSAGE
|
|
820
|
+
})))
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
/** @internal */
|
|
824
|
+
const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDeployedReadme(root) {
|
|
825
|
+
const files = yield* RepositoryFiles;
|
|
826
|
+
const listed = yield* files.listedFiles(root);
|
|
827
|
+
const directories = yield* workspaceDirectories(root);
|
|
828
|
+
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
829
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$26 });
|
|
830
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$2))), Array.dedupe);
|
|
831
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$6(root, directory), { concurrency: READ_CONCURRENCY$26 });
|
|
832
|
+
return Array.getSomes(found);
|
|
833
|
+
});
|
|
834
|
+
// src/features/check-placement/model/nested-docs.ts
|
|
835
|
+
const RULE$48 = "nested-docs";
|
|
836
|
+
const CONFIG_FILE$7 = "vite.config.ts";
|
|
837
|
+
const SEPARATOR$19 = "/";
|
|
838
|
+
const READ_CONCURRENCY$25 = 64;
|
|
725
839
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
726
840
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
727
841
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
728
842
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
729
|
-
const taggedError$
|
|
730
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
731
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
732
|
-
const problemFor$
|
|
843
|
+
const taggedError$6 = Schema.TaggedError;
|
|
844
|
+
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
845
|
+
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
846
|
+
const problemFor$5 = problemInFile(RULE$48);
|
|
733
847
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
734
848
|
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.";
|
|
735
849
|
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.";
|
|
736
850
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
737
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
851
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$5(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
738
852
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
739
|
-
return Option.some(problemFor$
|
|
853
|
+
return Option.some(problemFor$5(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
740
854
|
};
|
|
741
855
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
742
856
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
743
|
-
return Option.some(problemFor$
|
|
857
|
+
return Option.some(problemFor$5(file, `${base} ${README_MESSAGE}`));
|
|
744
858
|
};
|
|
745
859
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
746
860
|
const files = yield* RepositoryFiles;
|
|
@@ -755,7 +869,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, na
|
|
|
755
869
|
});
|
|
756
870
|
const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
|
|
757
871
|
const files = yield* RepositoryFiles;
|
|
758
|
-
const file = files.join(root, CONFIG_FILE$
|
|
872
|
+
const file = files.join(root, CONFIG_FILE$7);
|
|
759
873
|
if (!(yield* files.exists(file))) return false;
|
|
760
874
|
const config = yield* Effect.tryPromise({
|
|
761
875
|
try: () => resolveConfigFromFile(file),
|
|
@@ -774,52 +888,49 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
774
888
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
775
889
|
workspaceAgentDocs
|
|
776
890
|
};
|
|
777
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
891
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$25 });
|
|
778
892
|
return Array.getSomes(found);
|
|
779
893
|
});
|
|
780
894
|
// src/features/check-placement/model/published-readme.ts
|
|
781
|
-
const RULE$
|
|
782
|
-
const
|
|
783
|
-
const READ_CONCURRENCY$23 = 16;
|
|
895
|
+
const RULE$47 = "published-readme";
|
|
896
|
+
const READ_CONCURRENCY$24 = 16;
|
|
784
897
|
const MESSAGE$15 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
785
898
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
786
|
-
const FILE_START$1 = 1;
|
|
787
899
|
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
788
|
-
const
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
900
|
+
const readme = yield* readReadme({
|
|
901
|
+
root,
|
|
902
|
+
directory,
|
|
903
|
+
rule: RULE$47,
|
|
904
|
+
missingMessage: MISSING_MESSAGE
|
|
905
|
+
});
|
|
906
|
+
return Result.match(readme, {
|
|
907
|
+
onFailure: Option.some,
|
|
908
|
+
onSuccess: ({ file, source }) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
909
|
+
const { line, column } = positionOf(source)(found.index);
|
|
910
|
+
return {
|
|
911
|
+
file,
|
|
912
|
+
line,
|
|
913
|
+
column,
|
|
914
|
+
rule: RULE$47,
|
|
915
|
+
message: MESSAGE$15
|
|
916
|
+
};
|
|
917
|
+
}))
|
|
797
918
|
});
|
|
798
|
-
return pipe(text, Option.flatMap((source) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
799
|
-
const { line, column } = positionOf(source)(found.index);
|
|
800
|
-
return {
|
|
801
|
-
file,
|
|
802
|
-
line,
|
|
803
|
-
column,
|
|
804
|
-
rule: RULE$46,
|
|
805
|
-
message: MESSAGE$15
|
|
806
|
-
};
|
|
807
|
-
}))));
|
|
808
919
|
});
|
|
809
920
|
/** @internal */
|
|
810
921
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
811
922
|
const projects = yield* publishedProjects(root);
|
|
812
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$
|
|
923
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$24 });
|
|
813
924
|
return Array.getSomes(found);
|
|
814
925
|
});
|
|
815
926
|
// src/features/check-placement/model/published-tests.ts
|
|
816
|
-
const RULE$
|
|
927
|
+
const RULE$46 = "published-tests";
|
|
817
928
|
const MANIFEST_FILE$2 = "package.json";
|
|
818
929
|
const FILE_START = 1;
|
|
819
930
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
820
931
|
const MESSAGE$14 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
821
932
|
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
822
|
-
const problemFor$
|
|
933
|
+
const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
823
934
|
const files = yield* RepositoryFiles;
|
|
824
935
|
const absolute = files.join(root, directory);
|
|
825
936
|
const prefix = `${absolute}/`;
|
|
@@ -828,7 +939,7 @@ const problemFor$3 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
828
939
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
829
940
|
line: FILE_START,
|
|
830
941
|
column: FILE_START,
|
|
831
|
-
rule: RULE$
|
|
942
|
+
rule: RULE$46,
|
|
832
943
|
message: MESSAGE$14
|
|
833
944
|
});
|
|
834
945
|
});
|
|
@@ -838,38 +949,38 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
838
949
|
const projects = yield* publishedProjects(root);
|
|
839
950
|
const listed = yield* files.listedFiles(root);
|
|
840
951
|
const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
|
|
841
|
-
const found = yield* Effect.forEach(projects, (project) => problemFor$
|
|
952
|
+
const found = yield* Effect.forEach(projects, (project) => problemFor$4(root, absolute, project), { concurrency: 1 });
|
|
842
953
|
return Array.getSomes(found);
|
|
843
954
|
});
|
|
844
955
|
// src/features/check-placement/model/root-docs.ts
|
|
845
|
-
const RULE$
|
|
846
|
-
const SEPARATOR$
|
|
847
|
-
const FIRST$
|
|
956
|
+
const RULE$45 = "root-docs";
|
|
957
|
+
const SEPARATOR$18 = "/";
|
|
958
|
+
const FIRST$15 = 1;
|
|
848
959
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
849
960
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
850
961
|
const MESSAGE$13 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
851
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
962
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
852
963
|
/** @internal */
|
|
853
964
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
854
965
|
const files = yield* RepositoryFiles;
|
|
855
966
|
const names = yield* files.listedFiles(root);
|
|
856
967
|
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
857
968
|
file: files.join(root, name),
|
|
858
|
-
line: FIRST$
|
|
859
|
-
column: FIRST$
|
|
860
|
-
rule: RULE$
|
|
969
|
+
line: FIRST$15,
|
|
970
|
+
column: FIRST$15,
|
|
971
|
+
rule: RULE$45,
|
|
861
972
|
message: `${name} ${MESSAGE$13}`
|
|
862
973
|
})));
|
|
863
974
|
});
|
|
864
975
|
// src/features/check-placement/model/root-readme.ts
|
|
865
|
-
const RULE$
|
|
976
|
+
const RULE$44 = "root-readme";
|
|
866
977
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
867
|
-
const READ_CONCURRENCY$
|
|
868
|
-
const START$
|
|
978
|
+
const READ_CONCURRENCY$23 = 16;
|
|
979
|
+
const START$20 = 0;
|
|
869
980
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
870
981
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
871
982
|
const RELATIVE$1 = /^\.\//u;
|
|
872
|
-
const SEPARATOR$
|
|
983
|
+
const SEPARATOR$17 = "/";
|
|
873
984
|
const MarketplacePlugin = Schema.Struct({
|
|
874
985
|
name: Schema.optional(Schema.String),
|
|
875
986
|
source: Schema.Unknown
|
|
@@ -881,7 +992,7 @@ const NO_PLUGINS = {
|
|
|
881
992
|
};
|
|
882
993
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
883
994
|
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.`;
|
|
884
|
-
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$
|
|
995
|
+
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$17)(directory), Array.last, Option.getOrElse(() => directory));
|
|
885
996
|
const pluginsOf = (plugins) => {
|
|
886
997
|
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
|
|
887
998
|
const segments = pipe(directories, Array.map(lastSegment));
|
|
@@ -904,14 +1015,14 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
904
1015
|
onNone: () => ownNames(plugins, names),
|
|
905
1016
|
onSome: () => [directory]
|
|
906
1017
|
}));
|
|
907
|
-
const problemsIn$
|
|
1018
|
+
const problemsIn$17 = (file, source, plugins) => (workspace) => {
|
|
908
1019
|
const message = messageFor(workspace.directory);
|
|
909
1020
|
const at = positionOf(source);
|
|
910
1021
|
const pattern = patternFor(plugins)(workspace);
|
|
911
1022
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
912
1023
|
file,
|
|
913
|
-
...at(found.index ?? START$
|
|
914
|
-
rule: RULE$
|
|
1024
|
+
...at(found.index ?? START$20),
|
|
1025
|
+
rule: RULE$44,
|
|
915
1026
|
message
|
|
916
1027
|
})));
|
|
917
1028
|
};
|
|
@@ -919,7 +1030,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
|
|
|
919
1030
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
920
1031
|
return pipe(text, Option.match({
|
|
921
1032
|
onNone: () => [],
|
|
922
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1033
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$17(file, source, plugins)))
|
|
923
1034
|
}));
|
|
924
1035
|
});
|
|
925
1036
|
/** @internal */
|
|
@@ -930,7 +1041,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
930
1041
|
const named = yield* namedWorkspaces(root);
|
|
931
1042
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
932
1043
|
const plugins = yield* marketplacePlugins(root);
|
|
933
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
1044
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$23 });
|
|
934
1045
|
return Array.flatten(found);
|
|
935
1046
|
});
|
|
936
1047
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -944,15 +1055,16 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
944
1055
|
checkAgentDocsLength(root),
|
|
945
1056
|
checkDanglingLinks(root),
|
|
946
1057
|
checkPublishedReadme(root),
|
|
1058
|
+
checkDeployedReadme(root),
|
|
947
1059
|
checkPublishedTests(root)
|
|
948
1060
|
], { concurrency: "unbounded" });
|
|
949
1061
|
return Array.flatten(found);
|
|
950
1062
|
});
|
|
951
1063
|
// src/features/check-placement/model/docs-mirror.ts
|
|
952
|
-
const RULE$
|
|
1064
|
+
const RULE$43 = "docs-mirror";
|
|
953
1065
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
954
1066
|
const MIRROR_LIMIT = 3;
|
|
955
|
-
const READ_CONCURRENCY$
|
|
1067
|
+
const READ_CONCURRENCY$22 = 16;
|
|
956
1068
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
957
1069
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
958
1070
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -966,22 +1078,22 @@ const firstMention = (source, workspace) => {
|
|
|
966
1078
|
const mentions = pipe(workspace.names, Array.flatMap(mentionOf(source, workspace.directory)));
|
|
967
1079
|
return Array.head(Array.sort(mentions, byOffset));
|
|
968
1080
|
};
|
|
969
|
-
const ownerOf$
|
|
1081
|
+
const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
|
|
970
1082
|
const describe = (mentions) => pipe(mentions, Array.map(({ directory }) => `\`${directory}\``), Array.join(", "));
|
|
971
|
-
const problemFor$
|
|
1083
|
+
const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
|
|
972
1084
|
const { line, column } = positionOf(source)(offset);
|
|
973
1085
|
return {
|
|
974
1086
|
file,
|
|
975
1087
|
line,
|
|
976
1088
|
column,
|
|
977
|
-
rule: RULE$
|
|
1089
|
+
rule: RULE$43,
|
|
978
1090
|
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.`
|
|
979
1091
|
};
|
|
980
1092
|
}), Option.toArray);
|
|
981
|
-
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$
|
|
1093
|
+
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$3(doc)(workspace)));
|
|
982
1094
|
const problemIn$3 = (workspaces) => (doc, file, source) => {
|
|
983
1095
|
const mentions = pipe(othersIn(doc, workspaces), Array.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
|
|
984
|
-
return problemFor$
|
|
1096
|
+
return problemFor$3(file, source, Array.sort(mentions, byOffset));
|
|
985
1097
|
};
|
|
986
1098
|
const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
987
1099
|
const files = yield* RepositoryFiles;
|
|
@@ -989,7 +1101,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
989
1101
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
990
1102
|
directory,
|
|
991
1103
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
992
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1104
|
+
}))), { concurrency: READ_CONCURRENCY$22 });
|
|
993
1105
|
});
|
|
994
1106
|
/** @internal */
|
|
995
1107
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1002,13 +1114,13 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1002
1114
|
onNone: () => [],
|
|
1003
1115
|
onSome: (text) => problemIn$3(workspaces)(doc, file, text)
|
|
1004
1116
|
})));
|
|
1005
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1117
|
+
}, { concurrency: READ_CONCURRENCY$22 });
|
|
1006
1118
|
return Array.flatten(found);
|
|
1007
1119
|
});
|
|
1008
1120
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1009
|
-
const RULE$
|
|
1121
|
+
const RULE$42 = "ignored-sources";
|
|
1010
1122
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1011
|
-
const FIRST$
|
|
1123
|
+
const FIRST$14 = 1;
|
|
1012
1124
|
const MESSAGE$12 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
1013
1125
|
/** @internal */
|
|
1014
1126
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
@@ -1016,44 +1128,12 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1016
1128
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
1017
1129
|
return pipe(ignored, Array.map((file) => ({
|
|
1018
1130
|
file: files.join(root, file),
|
|
1019
|
-
line: FIRST$
|
|
1020
|
-
column: FIRST$
|
|
1021
|
-
rule: RULE$
|
|
1131
|
+
line: FIRST$14,
|
|
1132
|
+
column: FIRST$14,
|
|
1133
|
+
rule: RULE$42,
|
|
1022
1134
|
message: MESSAGE$12
|
|
1023
1135
|
})));
|
|
1024
1136
|
});
|
|
1025
|
-
// src/features/check-placement/model/member-sources.ts
|
|
1026
|
-
const ROOT_WORKSPACE$1 = ".";
|
|
1027
|
-
const FIRST$14 = 1;
|
|
1028
|
-
const SEPARATOR$17 = "/";
|
|
1029
|
-
const EXCLUDED$6 = [
|
|
1030
|
-
":(exclude,attr:linguist-vendored)",
|
|
1031
|
-
":(exclude,attr:linguist-generated)",
|
|
1032
|
-
":(exclude,attr:linguist-documentation)"
|
|
1033
|
-
];
|
|
1034
|
-
const memberWorkspaces = Effect.fn("memberWorkspaces")(function* memberWorkspaces(root) {
|
|
1035
|
-
const declared = yield* workspaceDirectories(root);
|
|
1036
|
-
return pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE$1));
|
|
1037
|
-
});
|
|
1038
|
-
const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
1039
|
-
const files = yield* RepositoryFiles;
|
|
1040
|
-
return {
|
|
1041
|
-
workspaces: yield* memberWorkspaces(root),
|
|
1042
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$6)
|
|
1043
|
-
};
|
|
1044
|
-
});
|
|
1045
|
-
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1046
|
-
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
1047
|
-
file,
|
|
1048
|
-
line: FIRST$14,
|
|
1049
|
-
column: FIRST$14,
|
|
1050
|
-
rule,
|
|
1051
|
-
message
|
|
1052
|
-
});
|
|
1053
|
-
const ownerOf$3 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$17}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
1054
|
-
workspace,
|
|
1055
|
-
inner: String$1.slice(workspace.length + 1)(name)
|
|
1056
|
-
})));
|
|
1057
1137
|
// src/features/check-placement/model/public-entries.ts
|
|
1058
1138
|
const ENTRY_RULE$3 = "public-entry";
|
|
1059
1139
|
const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
|
|
@@ -1081,8 +1161,8 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
|
|
|
1081
1161
|
return Array.flatten(entries);
|
|
1082
1162
|
});
|
|
1083
1163
|
// src/shared/lib/tree-sitter.ts
|
|
1084
|
-
const taggedError$
|
|
1085
|
-
var GrammarUnreadable = class extends taggedError$
|
|
1164
|
+
const taggedError$5 = Schema.TaggedError;
|
|
1165
|
+
var GrammarUnreadable = class extends taggedError$5()("GrammarUnreadable", {
|
|
1086
1166
|
grammar: Schema.String,
|
|
1087
1167
|
message: Schema.String
|
|
1088
1168
|
}) {};
|
|
@@ -9631,16 +9711,27 @@ var english_verbs_default = [
|
|
|
9631
9711
|
// src/features/check-placement/model/source-names.ts
|
|
9632
9712
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
9633
9713
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
9714
|
+
const SEGMENT_RULE = "slice-segment-name";
|
|
9634
9715
|
const SEPARATOR$15 = "/";
|
|
9635
9716
|
const NEXT$3 = 1;
|
|
9636
9717
|
const WORD_SEPARATOR$1 = "-";
|
|
9637
9718
|
const MINIMUM_WORDS = 2;
|
|
9638
9719
|
const FEATURES$1 = "src/features/";
|
|
9639
9720
|
const SOURCE$1 = "src/";
|
|
9721
|
+
const SEGMENTS = /* @__PURE__ */ new Set([
|
|
9722
|
+
"ui",
|
|
9723
|
+
"model",
|
|
9724
|
+
"api",
|
|
9725
|
+
"lib",
|
|
9726
|
+
"config",
|
|
9727
|
+
"@x"
|
|
9728
|
+
]);
|
|
9640
9729
|
const DEPLOY_MARKER = /(?:^|[.-])entrypoints?(?=[.-]|$)|\.worker(?=\.)/iu;
|
|
9730
|
+
const INDEX = /\/index(?:\.[a-z]+)*\.[cm]?[jt]sx?$/u;
|
|
9641
9731
|
const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
|
|
9642
9732
|
const VERBS = new Set(english_verbs_default);
|
|
9643
9733
|
const SLICE_MESSAGE$1 = "is not named <verb>-<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check-layout, sync-manuscripts).";
|
|
9734
|
+
const SEGMENT_MESSAGE = "is a folder in a slice that is not one of the segments ui, model, api, lib or config. Name the segment after its purpose and put the code in one of them; a segment that grows holds folders of its own.";
|
|
9644
9735
|
const ENTRY_MESSAGE$1 = "is named after where it is deployed. Name it after what the code does; the Alchemy resource that deploys it decides which file is the entry.";
|
|
9645
9736
|
const isVerbObjectBy = (separator) => (slice) => {
|
|
9646
9737
|
const words = String$1.split(slice, separator);
|
|
@@ -9648,6 +9739,29 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
9648
9739
|
};
|
|
9649
9740
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
9650
9741
|
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$15))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$15}${FEATURES$1}${slice}`));
|
|
9742
|
+
const SLICE_LAYERS = [
|
|
9743
|
+
"features",
|
|
9744
|
+
"entities",
|
|
9745
|
+
"widgets",
|
|
9746
|
+
"pages"
|
|
9747
|
+
];
|
|
9748
|
+
const SLICE_DEPTHS = [3, 4];
|
|
9749
|
+
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$15);
|
|
9750
|
+
const isInSliceLayer = (parts) => {
|
|
9751
|
+
const [source, layer] = parts;
|
|
9752
|
+
return `${source}${SEPARATOR$15}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
|
|
9753
|
+
};
|
|
9754
|
+
const indexedSlice = (owned) => {
|
|
9755
|
+
const parts = String$1.split(owned.inner, SEPARATOR$15);
|
|
9756
|
+
const depth = parts.length - NEXT$3;
|
|
9757
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$15}${pathPrefix(parts, depth)}`));
|
|
9758
|
+
};
|
|
9759
|
+
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
9760
|
+
const parts = String$1.split(inner, SEPARATOR$15);
|
|
9761
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$15}${pathPrefix(parts, depth)}`);
|
|
9762
|
+
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
9763
|
+
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$15}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
9764
|
+
};
|
|
9651
9765
|
const deployNamed = ({ workspace, inner }) => {
|
|
9652
9766
|
if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
|
|
9653
9767
|
const segments = String$1.split(inner, SEPARATOR$15);
|
|
@@ -9657,13 +9771,21 @@ const deployNamed = ({ workspace, inner }) => {
|
|
|
9657
9771
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
9658
9772
|
const files = yield* RepositoryFiles;
|
|
9659
9773
|
const { workspaces, listed } = yield* memberSources(root);
|
|
9660
|
-
const owned = pipe(listed, Array.map(ownerOf$
|
|
9774
|
+
const owned = pipe(listed, Array.map(ownerOf$4(workspaces)), Array.getSomes);
|
|
9775
|
+
const slices = new Set(pipe(owned, Array.map(indexedSlice), Array.getSomes));
|
|
9661
9776
|
const report = (rule, message) => (found) => pipe(Array.dedupe(found), Array.map((name) => fileProblem$1({
|
|
9662
9777
|
file: files.join(root, name),
|
|
9663
9778
|
rule,
|
|
9664
9779
|
message
|
|
9665
9780
|
})));
|
|
9666
|
-
|
|
9781
|
+
const misnamedSlices = pipe(owned, Array.map(misnamedSlice$1), Array.getSomes);
|
|
9782
|
+
const misnamedSegments = pipe(owned, Array.map(misnamedSegment(slices)), Array.getSomes);
|
|
9783
|
+
const deployNames = pipe(owned, Array.map(deployNamed), Array.getSomes);
|
|
9784
|
+
return [
|
|
9785
|
+
...report(SLICE_RULE$1, SLICE_MESSAGE$1)(misnamedSlices),
|
|
9786
|
+
...report(SEGMENT_RULE, SEGMENT_MESSAGE)(misnamedSegments),
|
|
9787
|
+
...report(ENTRY_RULE$2, ENTRY_MESSAGE$1)(deployNames)
|
|
9788
|
+
];
|
|
9667
9789
|
});
|
|
9668
9790
|
// src/features/check-placement/model/rust-modules.ts
|
|
9669
9791
|
const LAYERED_RULE = "layered-source";
|
|
@@ -9686,8 +9808,8 @@ const LAYER_ITEMS = [
|
|
|
9686
9808
|
"attribute_item",
|
|
9687
9809
|
"inner_attribute_item"
|
|
9688
9810
|
];
|
|
9689
|
-
const READ_CONCURRENCY$
|
|
9690
|
-
const EXCLUDED$
|
|
9811
|
+
const READ_CONCURRENCY$21 = 64;
|
|
9812
|
+
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9691
9813
|
const NONE$2 = [];
|
|
9692
9814
|
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.";
|
|
9693
9815
|
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.";
|
|
@@ -9754,7 +9876,7 @@ const isRead = ({ inner }) => {
|
|
|
9754
9876
|
};
|
|
9755
9877
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
9756
9878
|
const files = yield* RepositoryFiles;
|
|
9757
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
9879
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$6);
|
|
9758
9880
|
const owner = crateOf(crateDirectories(listed));
|
|
9759
9881
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
9760
9882
|
...owned,
|
|
@@ -9768,17 +9890,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
9768
9890
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
|
|
9769
9891
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
9770
9892
|
const parse = parsedWith(language);
|
|
9771
|
-
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$
|
|
9893
|
+
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$21 });
|
|
9772
9894
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
9773
9895
|
});
|
|
9774
9896
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
9775
|
-
const RULE$
|
|
9897
|
+
const RULE$41 = "shadcn-ui-alias";
|
|
9776
9898
|
const FIRST$13 = 1;
|
|
9777
9899
|
const problemOf$8 = (directory, { file, alias }) => ({
|
|
9778
9900
|
file,
|
|
9779
9901
|
line: FIRST$13,
|
|
9780
9902
|
column: FIRST$13,
|
|
9781
|
-
rule: RULE$
|
|
9903
|
+
rule: RULE$41,
|
|
9782
9904
|
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/*".`
|
|
9783
9905
|
});
|
|
9784
9906
|
/** @internal */
|
|
@@ -9798,8 +9920,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
9798
9920
|
const SOURCE_TARGET = "./src/*";
|
|
9799
9921
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
9800
9922
|
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.`;
|
|
9801
|
-
const Manifest$
|
|
9802
|
-
const decodeManifest$
|
|
9923
|
+
const Manifest$5 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
9924
|
+
const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
9803
9925
|
const targetsOf = (target) => {
|
|
9804
9926
|
if (Predicate.isString(target)) return [target];
|
|
9805
9927
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -9810,7 +9932,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
9810
9932
|
const files = yield* RepositoryFiles;
|
|
9811
9933
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
9812
9934
|
const text = yield* files.readFile(manifest);
|
|
9813
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
9935
|
+
return pipe(text, Option.flatMap(decodeManifest$9), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
|
|
9814
9936
|
});
|
|
9815
9937
|
/** @internal */
|
|
9816
9938
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -9843,18 +9965,18 @@ const SCRIPTS_DIRECTORY = "scripts";
|
|
|
9843
9965
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
9844
9966
|
const SEPARATOR$14 = "/";
|
|
9845
9967
|
const CURRENT = "./";
|
|
9846
|
-
const READ_CONCURRENCY$
|
|
9968
|
+
const READ_CONCURRENCY$20 = 8;
|
|
9847
9969
|
const FIRST$12 = 1;
|
|
9848
9970
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
9849
9971
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9850
9972
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
9851
|
-
const Manifest$
|
|
9973
|
+
const Manifest$4 = Schema.Struct({
|
|
9852
9974
|
bin: Schema.optional(Schema.Unknown),
|
|
9853
9975
|
main: Schema.optional(Schema.Unknown),
|
|
9854
9976
|
exports: Schema.optional(Schema.Unknown)
|
|
9855
9977
|
});
|
|
9856
9978
|
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
9857
|
-
const decodeManifest$
|
|
9979
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
9858
9980
|
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
9859
9981
|
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
9860
9982
|
const NO_ENTRIES = {
|
|
@@ -9881,7 +10003,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
9881
10003
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
9882
10004
|
const files = yield* RepositoryFiles;
|
|
9883
10005
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
9884
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10006
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
9885
10007
|
});
|
|
9886
10008
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
9887
10009
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -9893,7 +10015,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
9893
10015
|
const files = yield* RepositoryFiles;
|
|
9894
10016
|
const listed = yield* files.listedFiles(root);
|
|
9895
10017
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
9896
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
10018
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$20 });
|
|
9897
10019
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
9898
10020
|
});
|
|
9899
10021
|
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$14));
|
|
@@ -9904,7 +10026,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
9904
10026
|
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.`
|
|
9905
10027
|
})));
|
|
9906
10028
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
9907
|
-
const problemsIn$
|
|
10029
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
9908
10030
|
const files = yield* RepositoryFiles;
|
|
9909
10031
|
const config = yield* workspaceConfigOf(root, directory);
|
|
9910
10032
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -9943,34 +10065,34 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
9943
10065
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
9944
10066
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
9945
10067
|
const workflows = yield* workflowText(root);
|
|
9946
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
9947
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10068
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$16(root, directory, workflows), { concurrency: READ_CONCURRENCY$20 });
|
|
10069
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$20 });
|
|
9948
10070
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
9949
10071
|
});
|
|
9950
10072
|
// src/features/check-repository-layout/model/crates.ts
|
|
9951
|
-
const RULE$
|
|
10073
|
+
const RULE$40 = "unverified-crate";
|
|
9952
10074
|
const VERSION_RULE = "release-version";
|
|
9953
10075
|
const MANIFEST_FILE$1 = "package.json";
|
|
9954
10076
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
9955
10077
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
9956
|
-
const CONFIG_FILE$
|
|
10078
|
+
const CONFIG_FILE$6 = "vite.config.ts";
|
|
9957
10079
|
const SEPARATOR$13 = "/";
|
|
9958
10080
|
const FIRST$11 = 1;
|
|
9959
|
-
const READ_CONCURRENCY$
|
|
10081
|
+
const READ_CONCURRENCY$19 = 8;
|
|
9960
10082
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
9961
|
-
const problemFor$
|
|
10083
|
+
const problemFor$2 = (crate, message) => ({
|
|
9962
10084
|
file: crate.manifest,
|
|
9963
10085
|
line: FIRST$11,
|
|
9964
10086
|
column: FIRST$11,
|
|
9965
|
-
rule: RULE$
|
|
10087
|
+
rule: RULE$40,
|
|
9966
10088
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
9967
10089
|
});
|
|
9968
10090
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
9969
10091
|
const files = yield* RepositoryFiles;
|
|
9970
10092
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
9971
|
-
if (Option.isNone(workspace)) return Option.some(problemFor$
|
|
9972
|
-
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$
|
|
9973
|
-
return Option.some(problemFor$
|
|
10093
|
+
if (Option.isNone(workspace)) return Option.some(problemFor$2(crate, "is outside every workspace package"));
|
|
10094
|
+
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
|
|
10095
|
+
return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
|
|
9974
10096
|
});
|
|
9975
10097
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
9976
10098
|
const files = yield* RepositoryFiles;
|
|
@@ -9994,11 +10116,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
9994
10116
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
9995
10117
|
const directories = yield* workspaceDirectories(root);
|
|
9996
10118
|
const crates = yield* cratesIn(root);
|
|
9997
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10119
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$19 });
|
|
9998
10120
|
return Array.getSomes(Array.flatten(found));
|
|
9999
10121
|
});
|
|
10000
10122
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10001
|
-
const RULE$
|
|
10123
|
+
const RULE$39 = "deploy-entry-pattern";
|
|
10002
10124
|
const FALLOW_KEYS = [
|
|
10003
10125
|
"entry",
|
|
10004
10126
|
"entryPoints",
|
|
@@ -10016,7 +10138,7 @@ const NEGATED = "!";
|
|
|
10016
10138
|
const ROOT_WORKSPACE = ".";
|
|
10017
10139
|
const WRAP_OFFSET$1 = 1;
|
|
10018
10140
|
const NO_OFFSET = 0;
|
|
10019
|
-
const READ_CONCURRENCY$
|
|
10141
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10020
10142
|
const MESSAGE$11 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10021
10143
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10022
10144
|
const FALLOW = {
|
|
@@ -10053,7 +10175,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10053
10175
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10054
10176
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10055
10177
|
});
|
|
10056
|
-
const problemsIn$
|
|
10178
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10057
10179
|
const { root, file, kind, workspaces, entries } = request;
|
|
10058
10180
|
const files = yield* RepositoryFiles;
|
|
10059
10181
|
const path = files.join(root, file);
|
|
@@ -10069,7 +10191,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10069
10191
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10070
10192
|
file: path,
|
|
10071
10193
|
...positionOf(text.value)(start - kind.offset),
|
|
10072
|
-
rule: RULE$
|
|
10194
|
+
rule: RULE$39,
|
|
10073
10195
|
message: `${pattern} ${MESSAGE$11}`
|
|
10074
10196
|
})));
|
|
10075
10197
|
});
|
|
@@ -10092,17 +10214,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10092
10214
|
}];
|
|
10093
10215
|
return [];
|
|
10094
10216
|
}));
|
|
10095
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10217
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$15({
|
|
10096
10218
|
root,
|
|
10097
10219
|
file,
|
|
10098
10220
|
kind,
|
|
10099
10221
|
workspaces,
|
|
10100
10222
|
entries
|
|
10101
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10223
|
+
}), { concurrency: READ_CONCURRENCY$18 });
|
|
10102
10224
|
return Array.flatten(found);
|
|
10103
10225
|
});
|
|
10104
10226
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10105
|
-
const RULE$
|
|
10227
|
+
const RULE$38 = "listed-entry";
|
|
10106
10228
|
const ENTRY_KEYS = [
|
|
10107
10229
|
"entry",
|
|
10108
10230
|
"entryPoints",
|
|
@@ -10112,7 +10234,7 @@ const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?
|
|
|
10112
10234
|
const WILDCARD$3 = /[*?{[]/u;
|
|
10113
10235
|
const SEPARATOR$12 = "/";
|
|
10114
10236
|
const WRAP_OFFSET = 1;
|
|
10115
|
-
const READ_CONCURRENCY$
|
|
10237
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10116
10238
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10117
10239
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10118
10240
|
const entryPatternsIn = (node) => {
|
|
@@ -10123,7 +10245,7 @@ const entryPatternsIn = (node) => {
|
|
|
10123
10245
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10124
10246
|
};
|
|
10125
10247
|
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$12}`)(text))) || String$1.includes(SEPARATOR$12)(text) && !WILDCARD$3.test(text);
|
|
10126
|
-
const problemsIn$
|
|
10248
|
+
const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10127
10249
|
const files = yield* RepositoryFiles;
|
|
10128
10250
|
const path = files.join(root, file);
|
|
10129
10251
|
const text = yield* files.readFile(path);
|
|
@@ -10132,7 +10254,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10132
10254
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10133
10255
|
file: path,
|
|
10134
10256
|
...positionOf(text.value)(start),
|
|
10135
|
-
rule: RULE$
|
|
10257
|
+
rule: RULE$38,
|
|
10136
10258
|
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.`
|
|
10137
10259
|
})));
|
|
10138
10260
|
});
|
|
@@ -10140,12 +10262,12 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10140
10262
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10141
10263
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10142
10264
|
const directories = yield* workspaceDirectories(root);
|
|
10143
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10265
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$14(root, file, directories), { concurrency: READ_CONCURRENCY$17 });
|
|
10144
10266
|
return Array.flatten(found);
|
|
10145
10267
|
});
|
|
10146
10268
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10147
|
-
const RULE$
|
|
10148
|
-
const CONFIG_FILE$
|
|
10269
|
+
const RULE$37 = "root-workspace-path";
|
|
10270
|
+
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10149
10271
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10150
10272
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10151
10273
|
const FIRST$10 = 0;
|
|
@@ -10160,27 +10282,27 @@ const mentions = (directory) => (text) => {
|
|
|
10160
10282
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10161
10283
|
}));
|
|
10162
10284
|
};
|
|
10163
|
-
const problemsIn$
|
|
10285
|
+
const problemsIn$13 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10164
10286
|
file,
|
|
10165
10287
|
...positionOf(source)(found.start),
|
|
10166
|
-
rule: RULE$
|
|
10167
|
-
message: `${directory} is a workspace. The root ${CONFIG_FILE$
|
|
10288
|
+
rule: RULE$37,
|
|
10289
|
+
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.`
|
|
10168
10290
|
})));
|
|
10169
10291
|
/** @internal */
|
|
10170
10292
|
const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
|
|
10171
10293
|
const files = yield* RepositoryFiles;
|
|
10172
|
-
const file = files.join(root, CONFIG_FILE$
|
|
10294
|
+
const file = files.join(root, CONFIG_FILE$5);
|
|
10173
10295
|
const source = yield* files.readFile(file);
|
|
10174
10296
|
if (Option.isNone(source)) return [];
|
|
10175
10297
|
const directories = yield* workspaceDirectories(root);
|
|
10176
10298
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10177
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10299
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$13(file, source.value, directories)));
|
|
10178
10300
|
});
|
|
10179
10301
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10180
|
-
const RULE$
|
|
10181
|
-
const CONFIG_FILE$
|
|
10302
|
+
const RULE$36 = "hidden-verify";
|
|
10303
|
+
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10182
10304
|
const FIRST$9 = 1;
|
|
10183
|
-
const READ_CONCURRENCY$
|
|
10305
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10184
10306
|
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10185
10307
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10186
10308
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10191,19 +10313,19 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10191
10313
|
file,
|
|
10192
10314
|
line: FIRST$9,
|
|
10193
10315
|
column: FIRST$9,
|
|
10194
|
-
rule: RULE$
|
|
10195
|
-
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$
|
|
10316
|
+
rule: RULE$36,
|
|
10317
|
+
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}.`
|
|
10196
10318
|
}).pipe(Option.filter(() => verified));
|
|
10197
10319
|
});
|
|
10198
10320
|
/** @internal */
|
|
10199
10321
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10200
10322
|
const directories = yield* workspaceDirectories(root);
|
|
10201
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10323
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10202
10324
|
return Array.getSomes(found);
|
|
10203
10325
|
});
|
|
10204
10326
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10205
|
-
const RULE$
|
|
10206
|
-
const READ_CONCURRENCY$
|
|
10327
|
+
const RULE$35 = "shared-uncached-task";
|
|
10328
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10207
10329
|
const SHARED = 2;
|
|
10208
10330
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10209
10331
|
const UncachedTask = Schema.Struct({
|
|
@@ -10245,19 +10367,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10245
10367
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10246
10368
|
file,
|
|
10247
10369
|
...position,
|
|
10248
|
-
rule: RULE$
|
|
10370
|
+
rule: RULE$35,
|
|
10249
10371
|
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.`
|
|
10250
10372
|
})));
|
|
10251
10373
|
};
|
|
10252
10374
|
/** @internal */
|
|
10253
10375
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10254
10376
|
const directories = yield* workspaceDirectories(root);
|
|
10255
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10377
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$15 });
|
|
10256
10378
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10257
10379
|
});
|
|
10258
10380
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10259
|
-
const RULE$
|
|
10260
|
-
const READ_CONCURRENCY$
|
|
10381
|
+
const RULE$34 = "unlocked-task";
|
|
10382
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10261
10383
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10262
10384
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10263
10385
|
const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array.findFirst(Array.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
|
|
@@ -10268,13 +10390,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10268
10390
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10269
10391
|
file,
|
|
10270
10392
|
...positionOf(source)(task.start),
|
|
10271
|
-
rule: RULE$
|
|
10393
|
+
rule: RULE$34,
|
|
10272
10394
|
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.`
|
|
10273
10395
|
})), Option.toArray)));
|
|
10274
10396
|
/** @internal */
|
|
10275
10397
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10276
10398
|
const directories = yield* workspaceDirectories(root);
|
|
10277
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10399
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$14 });
|
|
10278
10400
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10279
10401
|
});
|
|
10280
10402
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10423,10 +10545,10 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10423
10545
|
/** @internal */
|
|
10424
10546
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10425
10547
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10426
|
-
const RULE$
|
|
10548
|
+
const RULE$33 = "workflow-path";
|
|
10427
10549
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10428
10550
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10429
|
-
const READ_CONCURRENCY$
|
|
10551
|
+
const READ_CONCURRENCY$13 = 8;
|
|
10430
10552
|
const WILDCARD$2 = /[*?[]/u;
|
|
10431
10553
|
const SEPARATOR$10 = "/";
|
|
10432
10554
|
const FIRST$8 = 0;
|
|
@@ -10489,10 +10611,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10489
10611
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10490
10612
|
file,
|
|
10491
10613
|
...positionOf(source)(found.offset),
|
|
10492
|
-
rule: RULE$
|
|
10614
|
+
rule: RULE$33,
|
|
10493
10615
|
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.`
|
|
10494
10616
|
});
|
|
10495
|
-
const problemsIn$
|
|
10617
|
+
const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10496
10618
|
const files = yield* RepositoryFiles;
|
|
10497
10619
|
const file = files.join(root, workflow);
|
|
10498
10620
|
const source = yield* files.readFile(file);
|
|
@@ -10504,7 +10626,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10504
10626
|
/** @internal */
|
|
10505
10627
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10506
10628
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10507
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10629
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$12(root, workflow), { concurrency: READ_CONCURRENCY$13 });
|
|
10508
10630
|
return Array.flatten(found);
|
|
10509
10631
|
});
|
|
10510
10632
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10515,8 +10637,8 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10515
10637
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10516
10638
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10517
10639
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10518
|
-
const START$
|
|
10519
|
-
const READ_CONCURRENCY$
|
|
10640
|
+
const START$19 = 0;
|
|
10641
|
+
const READ_CONCURRENCY$12 = 8;
|
|
10520
10642
|
const SEPARATOR$9 = "/";
|
|
10521
10643
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10522
10644
|
const SPACE = " ";
|
|
@@ -10546,7 +10668,7 @@ const namesIn = (name, source) => {
|
|
|
10546
10668
|
return [
|
|
10547
10669
|
{
|
|
10548
10670
|
text: name,
|
|
10549
|
-
offset: START$
|
|
10671
|
+
offset: START$19
|
|
10550
10672
|
},
|
|
10551
10673
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10552
10674
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10596,7 +10718,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10596
10718
|
name: stem,
|
|
10597
10719
|
source: text
|
|
10598
10720
|
})]), Option.getOrElse(() => []));
|
|
10599
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10721
|
+
}), { concurrency: READ_CONCURRENCY$12 });
|
|
10600
10722
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10601
10723
|
return [...Array.flatten(found), ...actions];
|
|
10602
10724
|
});
|
|
@@ -10616,7 +10738,7 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10616
10738
|
return Array.flatten(found);
|
|
10617
10739
|
});
|
|
10618
10740
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
10619
|
-
const RULE$
|
|
10741
|
+
const RULE$32 = "legacy-typescript";
|
|
10620
10742
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
10621
10743
|
const COMPILER = "typescript";
|
|
10622
10744
|
const CURRENT_MAJOR = 7;
|
|
@@ -10647,7 +10769,7 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
10647
10769
|
file,
|
|
10648
10770
|
line: lineOf$2(source)(legacy.id),
|
|
10649
10771
|
column: FIRST$7,
|
|
10650
|
-
rule: RULE$
|
|
10772
|
+
rule: RULE$32,
|
|
10651
10773
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
10652
10774
|
})));
|
|
10653
10775
|
});
|
|
@@ -10765,7 +10887,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
10765
10887
|
peerDependencies: DependencyMap,
|
|
10766
10888
|
peerDependenciesMeta: PeerMeta
|
|
10767
10889
|
});
|
|
10768
|
-
const decodeManifest$
|
|
10890
|
+
const decodeManifest$7 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
10769
10891
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
10770
10892
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
10771
10893
|
const installedNames = (manifest) => [
|
|
@@ -10776,7 +10898,7 @@ const installedNames = (manifest) => [
|
|
|
10776
10898
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
10777
10899
|
const files = yield* RepositoryFiles;
|
|
10778
10900
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
10779
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10901
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
10780
10902
|
});
|
|
10781
10903
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
10782
10904
|
const files = yield* RepositoryFiles;
|
|
@@ -10838,11 +10960,11 @@ const LISTED_LARGEST = 5;
|
|
|
10838
10960
|
const SIZE_CONCURRENCY = 32;
|
|
10839
10961
|
const MEGABYTE = 1e6;
|
|
10840
10962
|
const MEGABYTE_DIGITS = 1;
|
|
10841
|
-
const START$
|
|
10963
|
+
const START$18 = 0;
|
|
10842
10964
|
const SINGLE_ENTRY = 1;
|
|
10843
10965
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
10844
10966
|
const usageHint = (dependency, entryCount) => {
|
|
10845
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
10967
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$18 && dependency.entries.length < entryCount)) return "";
|
|
10846
10968
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
10847
10969
|
};
|
|
10848
10970
|
const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -10851,7 +10973,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
10851
10973
|
const { workspace, total } = overrun;
|
|
10852
10974
|
const config = yield* files.readFile(workspace.configFile);
|
|
10853
10975
|
const source = Option.getOrElse(config, () => "");
|
|
10854
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
10976
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$18);
|
|
10855
10977
|
return {
|
|
10856
10978
|
file: workspace.configFile,
|
|
10857
10979
|
...positionOf(source)(index),
|
|
@@ -10868,7 +10990,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
10868
10990
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
10869
10991
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
10870
10992
|
const sizes = HashMap.fromIterable(measured);
|
|
10871
|
-
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
10993
|
+
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$18))));
|
|
10872
10994
|
return {
|
|
10873
10995
|
closures,
|
|
10874
10996
|
sizeOf,
|
|
@@ -10901,11 +11023,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
10901
11023
|
})];
|
|
10902
11024
|
});
|
|
10903
11025
|
const stackProblems = (file, source, dependencies) => {
|
|
10904
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$
|
|
11026
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$18);
|
|
10905
11027
|
const rest = String$1.slice(section)(source);
|
|
10906
11028
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
10907
11029
|
file,
|
|
10908
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11030
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$18)),
|
|
10909
11031
|
rule: STACK_DEPENDENCY,
|
|
10910
11032
|
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.`
|
|
10911
11033
|
})));
|
|
@@ -11561,7 +11683,7 @@ const duplicateProblems = (relative) => (sites) => {
|
|
|
11561
11683
|
}))));
|
|
11562
11684
|
};
|
|
11563
11685
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11564
|
-
const RULE$
|
|
11686
|
+
const RULE$31 = "hand-written-names";
|
|
11565
11687
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11566
11688
|
const nameListOf = (site) => {
|
|
11567
11689
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11576,7 +11698,7 @@ const problemOf$6 = ({ list, reason }) => ({
|
|
|
11576
11698
|
file: list.site.file,
|
|
11577
11699
|
line: list.site.line,
|
|
11578
11700
|
column: list.site.column,
|
|
11579
|
-
rule: RULE$
|
|
11701
|
+
rule: RULE$31,
|
|
11580
11702
|
message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
|
|
11581
11703
|
});
|
|
11582
11704
|
// src/features/check-value-owners/model/declared-names.ts
|
|
@@ -11685,13 +11807,13 @@ const MANIFEST$2 = "package.json";
|
|
|
11685
11807
|
const SEPARATOR$6 = "/";
|
|
11686
11808
|
const FIRST_SEGMENT = 1;
|
|
11687
11809
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
11688
|
-
const decodeManifest$
|
|
11810
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(ManifestJson);
|
|
11689
11811
|
const prefixesOf = (file) => {
|
|
11690
11812
|
const segments = pipe(file, String$1.split(SEPARATOR$6));
|
|
11691
11813
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$6))));
|
|
11692
11814
|
};
|
|
11693
11815
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
11694
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
11816
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
11695
11817
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
11696
11818
|
const files = yield* RepositoryFiles;
|
|
11697
11819
|
const listed = yield* files.listedFiles(root);
|
|
@@ -11803,7 +11925,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
11803
11925
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
11804
11926
|
}, Effect.scoped);
|
|
11805
11927
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
11806
|
-
const RULE$
|
|
11928
|
+
const RULE$30 = "namespace-destructuring";
|
|
11807
11929
|
const LOCAL = /^[.#/]/u;
|
|
11808
11930
|
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.`;
|
|
11809
11931
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -11819,7 +11941,7 @@ const destructuredName = (declaration) => {
|
|
|
11819
11941
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
11820
11942
|
};
|
|
11821
11943
|
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
|
|
11822
|
-
rule: RULE$
|
|
11944
|
+
rule: RULE$30,
|
|
11823
11945
|
message: messageOf$1(name)
|
|
11824
11946
|
})), Option.map((report) => report(declaration)));
|
|
11825
11947
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -11827,7 +11949,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
11827
11949
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
11828
11950
|
};
|
|
11829
11951
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
11830
|
-
const RULE$
|
|
11952
|
+
const RULE$29 = "pass-through-wrapper";
|
|
11831
11953
|
const SINGLE_STATEMENT = 1;
|
|
11832
11954
|
const SINGLE_DECLARATION = 1;
|
|
11833
11955
|
const THIS_PARAMETER = "this";
|
|
@@ -11924,7 +12046,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
11924
12046
|
const problemOf$4 = (checker) => (candidate) => {
|
|
11925
12047
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
11926
12048
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
|
|
11927
|
-
rule: RULE$
|
|
12049
|
+
rule: RULE$29,
|
|
11928
12050
|
message: messageOf(forward.callee.getText())
|
|
11929
12051
|
})(candidate.name)));
|
|
11930
12052
|
};
|
|
@@ -11956,7 +12078,7 @@ var repository = {
|
|
|
11956
12078
|
"directory": "libs/msch"
|
|
11957
12079
|
};
|
|
11958
12080
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
11959
|
-
const RULE$
|
|
12081
|
+
const RULE$28 = "known-plugins";
|
|
11960
12082
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
11961
12083
|
const GITHUB$2 = "github";
|
|
11962
12084
|
const REPOSITORY = /github\.com\/(?<repository>[\w.-]+\/[\w.-]+?)(?:\.git)?$/u;
|
|
@@ -11976,7 +12098,7 @@ const repositoryOf = (url) => pipe(String$1.match(REPOSITORY)(url), Option.flatM
|
|
|
11976
12098
|
const REPOSITORY_NAME = repositoryOf(repository.url);
|
|
11977
12099
|
const MARKETPLACE = name;
|
|
11978
12100
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
11979
|
-
const problem$1 = problemInFile(RULE$
|
|
12101
|
+
const problem$1 = problemInFile(RULE$28);
|
|
11980
12102
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
11981
12103
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
11982
12104
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -11997,20 +12119,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
11997
12119
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
11998
12120
|
});
|
|
11999
12121
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12000
|
-
const RULE$
|
|
12122
|
+
const RULE$27 = "missing-hook";
|
|
12001
12123
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12002
12124
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12003
12125
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12004
12126
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12005
12127
|
const PLUGIN_ROOT = "..";
|
|
12006
|
-
const READ_CONCURRENCY$
|
|
12007
|
-
const START$
|
|
12128
|
+
const READ_CONCURRENCY$11 = 16;
|
|
12129
|
+
const START$17 = 0;
|
|
12008
12130
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12009
12131
|
path,
|
|
12010
|
-
index: found.index ?? START$
|
|
12132
|
+
index: found.index ?? START$17
|
|
12011
12133
|
})), Option.toArray);
|
|
12012
12134
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12013
|
-
const problemsIn$
|
|
12135
|
+
const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12014
12136
|
const files = yield* RepositoryFiles;
|
|
12015
12137
|
const text = yield* files.readFile(file);
|
|
12016
12138
|
if (Option.isNone(text)) return [];
|
|
@@ -12022,7 +12144,7 @@ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12022
12144
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12023
12145
|
file,
|
|
12024
12146
|
...positionOf(source)(index),
|
|
12025
|
-
rule: RULE$
|
|
12147
|
+
rule: RULE$27,
|
|
12026
12148
|
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.`
|
|
12027
12149
|
})));
|
|
12028
12150
|
});
|
|
@@ -12046,7 +12168,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12046
12168
|
}];
|
|
12047
12169
|
return [];
|
|
12048
12170
|
}));
|
|
12049
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12171
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$11 });
|
|
12050
12172
|
return Array.flatten(found);
|
|
12051
12173
|
});
|
|
12052
12174
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12075,7 +12197,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12075
12197
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12076
12198
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12077
12199
|
// src/features/check-documented-commands/model/commands.ts
|
|
12078
|
-
const RULE$
|
|
12200
|
+
const RULE$26 = "documented-commands";
|
|
12079
12201
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12080
12202
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12081
12203
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12094,7 +12216,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12094
12216
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12095
12217
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12096
12218
|
const ONE$1 = 1;
|
|
12097
|
-
const START$
|
|
12219
|
+
const START$16 = 0;
|
|
12098
12220
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12099
12221
|
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)))));
|
|
12100
12222
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12150,11 +12272,11 @@ const whereOf = (scope, file) => {
|
|
|
12150
12272
|
return `the package that holds ${file}`;
|
|
12151
12273
|
};
|
|
12152
12274
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12153
|
-
const problemsIn$
|
|
12275
|
+
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 }) => ({
|
|
12154
12276
|
file: absolute(file),
|
|
12155
|
-
...positionOf(text)(match.index ?? START$
|
|
12156
|
-
rule: RULE$
|
|
12157
|
-
message: `${match[START$
|
|
12277
|
+
...positionOf(text)(match.index ?? START$16),
|
|
12278
|
+
rule: RULE$26,
|
|
12279
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12158
12280
|
})), Option.toArray)));
|
|
12159
12281
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$5), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12160
12282
|
/** @internal */
|
|
@@ -12178,14 +12300,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12178
12300
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12179
12301
|
line: ONE$1,
|
|
12180
12302
|
column: ONE$1,
|
|
12181
|
-
rule: RULE$
|
|
12303
|
+
rule: RULE$26,
|
|
12182
12304
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12183
12305
|
}],
|
|
12184
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
12306
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12185
12307
|
});
|
|
12186
12308
|
});
|
|
12187
12309
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12188
|
-
const RULE$
|
|
12310
|
+
const RULE$25 = "legacy-web";
|
|
12189
12311
|
const FIRST_COLUMN$3 = 1;
|
|
12190
12312
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12191
12313
|
const Finding = Schema.Struct({
|
|
@@ -12224,15 +12346,15 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12224
12346
|
file: files.join(root, file),
|
|
12225
12347
|
line,
|
|
12226
12348
|
column: FIRST_COLUMN$3,
|
|
12227
|
-
rule: RULE$
|
|
12349
|
+
rule: RULE$25,
|
|
12228
12350
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12229
12351
|
});
|
|
12230
12352
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
12231
12353
|
});
|
|
12232
12354
|
// src/shared/lib/section-check.ts
|
|
12233
|
-
const taggedError$
|
|
12234
|
-
var SectionConfigUnreadable = class extends taggedError$
|
|
12235
|
-
const CONFIG_FILE$
|
|
12355
|
+
const taggedError$4 = Schema.TaggedError;
|
|
12356
|
+
var SectionConfigUnreadable = class extends taggedError$4()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
12357
|
+
const CONFIG_FILE$3 = "vite.config.ts";
|
|
12236
12358
|
const FIRST$6 = 1;
|
|
12237
12359
|
const ONE = 1;
|
|
12238
12360
|
const diagnostics = Metric.counter("lint.diagnostics", { description: "Diagnostics that each lint rule reported, before msch keeps only the errors" });
|
|
@@ -12254,7 +12376,7 @@ const sectionAt = (file, pick) => Effect.gen(function* readSection() {
|
|
|
12254
12376
|
});
|
|
12255
12377
|
const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
12256
12378
|
const files = yield* RepositoryFiles;
|
|
12257
|
-
const configFile = files.join(root, CONFIG_FILE$
|
|
12379
|
+
const configFile = files.join(root, CONFIG_FILE$3);
|
|
12258
12380
|
const section = yield* sectionAt(configFile, check.pick);
|
|
12259
12381
|
if (Option.isNone(section)) return [];
|
|
12260
12382
|
const config = section.value;
|
|
@@ -12294,8 +12416,8 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
12294
12416
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
12295
12417
|
const EXTENSION = /\.[^./]+$/u;
|
|
12296
12418
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
12297
|
-
const READ_CONCURRENCY$
|
|
12298
|
-
const RULE$
|
|
12419
|
+
const READ_CONCURRENCY$10 = 64;
|
|
12420
|
+
const RULE$24 = "shell-script";
|
|
12299
12421
|
const MESSAGE$10 = "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.";
|
|
12300
12422
|
const HookSchema = Schema.Struct({
|
|
12301
12423
|
command: Schema.optional(Schema.String),
|
|
@@ -12328,12 +12450,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
12328
12450
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
12329
12451
|
};
|
|
12330
12452
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
12331
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
12332
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
12453
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
12454
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$24)(files.join(root, name), MESSAGE$10)));
|
|
12333
12455
|
});
|
|
12334
12456
|
// src/shared/lib/workflow-files.ts
|
|
12335
12457
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
12336
|
-
const READ_CONCURRENCY$
|
|
12458
|
+
const READ_CONCURRENCY$9 = 16;
|
|
12337
12459
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
12338
12460
|
const files = yield* RepositoryFiles;
|
|
12339
12461
|
const names = yield* files.listedFiles(root);
|
|
@@ -12343,13 +12465,13 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
12343
12465
|
file,
|
|
12344
12466
|
source
|
|
12345
12467
|
}))));
|
|
12346
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
12468
|
+
}, { concurrency: READ_CONCURRENCY$9 });
|
|
12347
12469
|
return Array.getSomes(found);
|
|
12348
12470
|
});
|
|
12349
12471
|
// src/shared/lib/workflow-run.ts
|
|
12350
12472
|
const RUN_KEY = "run";
|
|
12351
|
-
const START$
|
|
12352
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
12473
|
+
const START$15 = 0;
|
|
12474
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
12353
12475
|
const runScriptsOf = (source) => {
|
|
12354
12476
|
const found = [];
|
|
12355
12477
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -12364,7 +12486,7 @@ const runScriptsOf = (source) => {
|
|
|
12364
12486
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
12365
12487
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12366
12488
|
const COMMENT = "#";
|
|
12367
|
-
const RULE$
|
|
12489
|
+
const RULE$23 = "workflow-script";
|
|
12368
12490
|
const ONE_COMMAND = 1;
|
|
12369
12491
|
const MESSAGE$9 = "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.";
|
|
12370
12492
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -12373,19 +12495,19 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
12373
12495
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
12374
12496
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
12375
12497
|
};
|
|
12376
|
-
const problemsIn$
|
|
12498
|
+
const problemsIn$9 = (file) => (source) => {
|
|
12377
12499
|
const at = positionOf(source);
|
|
12378
12500
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
12379
12501
|
file,
|
|
12380
12502
|
...at(start),
|
|
12381
|
-
rule: RULE$
|
|
12503
|
+
rule: RULE$23,
|
|
12382
12504
|
message: MESSAGE$9
|
|
12383
12505
|
})));
|
|
12384
12506
|
};
|
|
12385
12507
|
/** @internal */
|
|
12386
12508
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
12387
12509
|
const workflows = yield* readWorkflows(root);
|
|
12388
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
12510
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$9(file)(source)));
|
|
12389
12511
|
});
|
|
12390
12512
|
// src/features/check-scripts/model/script-checks.ts
|
|
12391
12513
|
/** @internal */
|
|
@@ -12491,24 +12613,24 @@ const docSources = (file) => (source) => {
|
|
|
12491
12613
|
const ROOT_DIRECTORY$1 = ".";
|
|
12492
12614
|
const COMMAND_KEY = "command";
|
|
12493
12615
|
const ARGUMENTS_KEY = "args";
|
|
12494
|
-
const EXCLUDED$
|
|
12495
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
12616
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12617
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$5];
|
|
12496
12618
|
const STEP_FILES = [
|
|
12497
12619
|
":(glob).github/workflows/*.yml",
|
|
12498
12620
|
":(glob).github/workflows/*.yaml",
|
|
12499
12621
|
":(glob)**/action.yml",
|
|
12500
12622
|
":(glob)**/action.yaml",
|
|
12501
|
-
...EXCLUDED$
|
|
12623
|
+
...EXCLUDED$5
|
|
12502
12624
|
];
|
|
12503
12625
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
12504
12626
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
12505
12627
|
const AGENT_DOCS = [
|
|
12506
12628
|
":(glob)**/AGENTS.md",
|
|
12507
12629
|
":(glob)**/CLAUDE.md",
|
|
12508
|
-
...EXCLUDED$
|
|
12630
|
+
...EXCLUDED$5
|
|
12509
12631
|
];
|
|
12510
|
-
const READ_CONCURRENCY$
|
|
12511
|
-
const START$
|
|
12632
|
+
const READ_CONCURRENCY$8 = 16;
|
|
12633
|
+
const START$14 = 0;
|
|
12512
12634
|
const FIRST$5 = 1;
|
|
12513
12635
|
const LINE = "\n";
|
|
12514
12636
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -12518,7 +12640,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
12518
12640
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
12519
12641
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12520
12642
|
const NO_SOURCES = [];
|
|
12521
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
12643
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
12522
12644
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
12523
12645
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
12524
12646
|
return {
|
|
@@ -12578,7 +12700,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
12578
12700
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
12579
12701
|
});
|
|
12580
12702
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
12581
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
12703
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$8 });
|
|
12582
12704
|
return Array.flatten(found);
|
|
12583
12705
|
});
|
|
12584
12706
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -12590,7 +12712,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
12590
12712
|
onSome: sourcesOf(file, name)
|
|
12591
12713
|
});
|
|
12592
12714
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
12593
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
12715
|
+
}, { concurrency: READ_CONCURRENCY$8 });
|
|
12594
12716
|
return Array.flatten(found);
|
|
12595
12717
|
});
|
|
12596
12718
|
/** @internal */
|
|
@@ -12614,7 +12736,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
12614
12736
|
return Array.flatten(found);
|
|
12615
12737
|
});
|
|
12616
12738
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
12617
|
-
const RULE$
|
|
12739
|
+
const RULE$22 = "package-script";
|
|
12618
12740
|
const LIFECYCLE = [
|
|
12619
12741
|
"preinstall",
|
|
12620
12742
|
"install",
|
|
@@ -12637,12 +12759,12 @@ const LIFECYCLE = [
|
|
|
12637
12759
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
12638
12760
|
file,
|
|
12639
12761
|
...position,
|
|
12640
|
-
rule: RULE$
|
|
12762
|
+
rule: RULE$22,
|
|
12641
12763
|
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.`
|
|
12642
12764
|
});
|
|
12643
12765
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
12644
12766
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
12645
|
-
const RULE$
|
|
12767
|
+
const RULE$21 = "vite-plus-block";
|
|
12646
12768
|
const MARKER = Array.join([
|
|
12647
12769
|
"<!--",
|
|
12648
12770
|
"VITE PLUS START",
|
|
@@ -12655,7 +12777,7 @@ const problemIn = (file) => (source) => {
|
|
|
12655
12777
|
return Option.some({
|
|
12656
12778
|
file,
|
|
12657
12779
|
...positionOf(source)(index.value),
|
|
12658
|
-
rule: RULE$
|
|
12780
|
+
rule: RULE$21,
|
|
12659
12781
|
message: MESSAGE$8
|
|
12660
12782
|
});
|
|
12661
12783
|
};
|
|
@@ -12711,7 +12833,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
12711
12833
|
})
|
|
12712
12834
|
});
|
|
12713
12835
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
12714
|
-
const RULE$
|
|
12836
|
+
const RULE$19 = "publish-trigger";
|
|
12715
12837
|
const PUBLISH = /\bmsch-publish\b/u;
|
|
12716
12838
|
const MANUAL = "workflow_dispatch";
|
|
12717
12839
|
const TRIGGER_KEY = "on";
|
|
@@ -12731,18 +12853,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
12731
12853
|
};
|
|
12732
12854
|
/** @internal */
|
|
12733
12855
|
const checkPublishTrigger = workflowCheck({
|
|
12734
|
-
rule: RULE$
|
|
12856
|
+
rule: RULE$19,
|
|
12735
12857
|
message: MESSAGE$6,
|
|
12736
12858
|
offsetsOf: publishTriggerOffsetsOf
|
|
12737
12859
|
});
|
|
12738
12860
|
// src/features/check-workflows/model/release-please.ts
|
|
12739
|
-
const RULE$
|
|
12861
|
+
const RULE$18 = "release-please";
|
|
12740
12862
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
12741
12863
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
12742
12864
|
const FIRST$4 = 1;
|
|
12743
12865
|
const MESSAGE$5 = "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.";
|
|
12744
12866
|
const checkReleasePleaseSteps = workflowCheck({
|
|
12745
|
-
rule: RULE$
|
|
12867
|
+
rule: RULE$18,
|
|
12746
12868
|
message: MESSAGE$5,
|
|
12747
12869
|
offsetsOf: scalarKeyOffsets({
|
|
12748
12870
|
name: "uses",
|
|
@@ -12756,7 +12878,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
12756
12878
|
file: files.join(root, name),
|
|
12757
12879
|
line: FIRST$4,
|
|
12758
12880
|
column: FIRST$4,
|
|
12759
|
-
rule: RULE$
|
|
12881
|
+
rule: RULE$18,
|
|
12760
12882
|
message: MESSAGE$5
|
|
12761
12883
|
})));
|
|
12762
12884
|
});
|
|
@@ -12768,17 +12890,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
12768
12890
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
12769
12891
|
const CONCURRENCY_KEY = "concurrency";
|
|
12770
12892
|
const QUEUE_KEY = "queue";
|
|
12771
|
-
const RULE$
|
|
12893
|
+
const RULE$17 = "workflow-queue";
|
|
12772
12894
|
const MESSAGE$4 = "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.";
|
|
12773
12895
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
12774
12896
|
/** @internal */
|
|
12775
12897
|
const checkWorkflowQueues = workflowCheck({
|
|
12776
|
-
rule: RULE$
|
|
12898
|
+
rule: RULE$17,
|
|
12777
12899
|
message: MESSAGE$4,
|
|
12778
12900
|
offsetsOf: queueOffsetsOf
|
|
12779
12901
|
});
|
|
12780
12902
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
12781
|
-
const RULE$
|
|
12903
|
+
const RULE$16 = "workflow-commit";
|
|
12782
12904
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
12783
12905
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
12784
12906
|
const MESSAGE$3 = "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.";
|
|
@@ -12786,7 +12908,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
12786
12908
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
12787
12909
|
/** @internal */
|
|
12788
12910
|
const checkWorkflowCommits = workflowCheck({
|
|
12789
|
-
rule: RULE$
|
|
12911
|
+
rule: RULE$16,
|
|
12790
12912
|
message: MESSAGE$3,
|
|
12791
12913
|
offsetsOf: commitOffsetsOf
|
|
12792
12914
|
});
|
|
@@ -12822,8 +12944,8 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
12822
12944
|
return Array.flatten(found);
|
|
12823
12945
|
});
|
|
12824
12946
|
// src/features/ban-comments/model/found-comment.ts
|
|
12825
|
-
const taggedError$
|
|
12826
|
-
var CommentsUnreadable = class extends taggedError$
|
|
12947
|
+
const taggedError$3 = Schema.TaggedError;
|
|
12948
|
+
var CommentsUnreadable = class extends taggedError$3()("CommentsUnreadable", {
|
|
12827
12949
|
reader: Schema.String,
|
|
12828
12950
|
message: Schema.String
|
|
12829
12951
|
}) {};
|
|
@@ -12894,7 +13016,7 @@ const COMMENT_NODES = [
|
|
|
12894
13016
|
"block_comment",
|
|
12895
13017
|
"multiline_comment"
|
|
12896
13018
|
];
|
|
12897
|
-
const START$
|
|
13019
|
+
const START$13 = 0;
|
|
12898
13020
|
const NEXT = 1;
|
|
12899
13021
|
const NONE$1 = [];
|
|
12900
13022
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -12947,7 +13069,7 @@ const markupComment = (source) => (node) => {
|
|
|
12947
13069
|
}];
|
|
12948
13070
|
};
|
|
12949
13071
|
const textComments = (grammars, grammar) => (text) => {
|
|
12950
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13072
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
12951
13073
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
12952
13074
|
};
|
|
12953
13075
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -12983,11 +13105,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
12983
13105
|
}[reader](source);
|
|
12984
13106
|
};
|
|
12985
13107
|
// src/features/ban-comments/model/comments.ts
|
|
12986
|
-
const RULE$
|
|
12987
|
-
const CONFIG_FILE$
|
|
13108
|
+
const RULE$15 = "comment";
|
|
13109
|
+
const CONFIG_FILE$2 = "vite.config.ts";
|
|
12988
13110
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
12989
|
-
const READ_CONCURRENCY$
|
|
12990
|
-
const START$
|
|
13111
|
+
const READ_CONCURRENCY$7 = 64;
|
|
13112
|
+
const START$12 = 0;
|
|
12991
13113
|
const READERS$1 = [
|
|
12992
13114
|
[/\.(?:[cm]?jsx?)$/u, "javascript"],
|
|
12993
13115
|
[/\.(?:[cm]?ts)$/u, "typescript"],
|
|
@@ -13033,8 +13155,8 @@ const NO_SETTINGS = {
|
|
|
13033
13155
|
ignorePatterns: []
|
|
13034
13156
|
};
|
|
13035
13157
|
const NONE = [];
|
|
13036
|
-
const taggedError$
|
|
13037
|
-
var CommentConfigUnreadable = class extends taggedError$
|
|
13158
|
+
const taggedError$2 = Schema.TaggedError;
|
|
13159
|
+
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
13038
13160
|
const shebangReader = (source) => {
|
|
13039
13161
|
if (!String$1.startsWith(SHEBANG)(source)) return Option.none();
|
|
13040
13162
|
return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
|
|
@@ -13042,16 +13164,16 @@ const shebangReader = (source) => {
|
|
|
13042
13164
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13043
13165
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13044
13166
|
const lineBefore = (source, index) => {
|
|
13045
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13167
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
13046
13168
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13047
13169
|
};
|
|
13048
13170
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13049
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13171
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
13050
13172
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13051
13173
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
13052
13174
|
file,
|
|
13053
13175
|
...positionOf(source)(index),
|
|
13054
|
-
rule: RULE$
|
|
13176
|
+
rule: RULE$15,
|
|
13055
13177
|
message: MESSAGE$2
|
|
13056
13178
|
});
|
|
13057
13179
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13063,7 +13185,7 @@ const settingsOf = ({ msch, lint }) => ({
|
|
|
13063
13185
|
});
|
|
13064
13186
|
const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
|
|
13065
13187
|
const files = yield* RepositoryFiles;
|
|
13066
|
-
const file = files.join(root, CONFIG_FILE$
|
|
13188
|
+
const file = files.join(root, CONFIG_FILE$2);
|
|
13067
13189
|
if (!(yield* files.exists(file))) return NO_SETTINGS;
|
|
13068
13190
|
const config = yield* Effect.tryPromise({
|
|
13069
13191
|
try: () => resolveConfigFromFile(file),
|
|
@@ -13100,13 +13222,13 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13100
13222
|
const toProblem = problemOf$2(file, source);
|
|
13101
13223
|
return Option.match(readerOf(name, source), {
|
|
13102
13224
|
onNone: () => Effect.succeed(NONE),
|
|
13103
|
-
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$
|
|
13225
|
+
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$15)(file, `msch could not read the comments in this file: ${message}`)])))
|
|
13104
13226
|
});
|
|
13105
13227
|
};
|
|
13106
13228
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
13107
13229
|
onNone: () => Effect.succeed(NONE),
|
|
13108
13230
|
onSome: (source) => problemsIn(entry, source)
|
|
13109
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
13231
|
+
}))), { concurrency: READ_CONCURRENCY$7 });
|
|
13110
13232
|
return Array.flatten(found);
|
|
13111
13233
|
});
|
|
13112
13234
|
// src/features/ban-tools/model/banned-tool.ts
|
|
@@ -13206,13 +13328,13 @@ const WILDCARD = "*";
|
|
|
13206
13328
|
const FIRST_LINE$2 = 1;
|
|
13207
13329
|
const FIRST_COLUMN$1 = 1;
|
|
13208
13330
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
13209
|
-
const READ_CONCURRENCY$
|
|
13331
|
+
const READ_CONCURRENCY$6 = 16;
|
|
13210
13332
|
const STALE_RULE = "stale-release-age-exclude";
|
|
13211
13333
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
13212
13334
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
13213
13335
|
const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
|
|
13214
13336
|
const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
|
|
13215
|
-
const decodeManifest$
|
|
13337
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
|
|
13216
13338
|
const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
|
|
13217
13339
|
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
13218
13340
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
@@ -13240,8 +13362,8 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
13240
13362
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
13241
13363
|
const files = yield* RepositoryFiles;
|
|
13242
13364
|
const listed = yield* files.listedFiles(root);
|
|
13243
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
13244
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
13365
|
+
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
|
|
13366
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$5(text))), Array.flatMap(referencesIn));
|
|
13245
13367
|
const fromOverrides = pipe(fieldsOf$2(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13246
13368
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13247
13369
|
});
|
|
@@ -13286,11 +13408,11 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
|
|
|
13286
13408
|
// src/features/check-skills/model/skill-entry.ts
|
|
13287
13409
|
const ENTRY_RULE = "unlocked-skill";
|
|
13288
13410
|
const VISIBLE_RULE = "skill-source-visible";
|
|
13289
|
-
const CONFIG_FILE = "vite.config.ts";
|
|
13411
|
+
const CONFIG_FILE$1 = "vite.config.ts";
|
|
13290
13412
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13291
13413
|
const SOURCE = "masseater/skills";
|
|
13292
13414
|
const PRESET$1 = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
|
|
13293
|
-
const START$
|
|
13415
|
+
const START$11 = 0;
|
|
13294
13416
|
const LOCAL_PREFIX = "./";
|
|
13295
13417
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
13296
13418
|
const Source = Schema.Struct({
|
|
@@ -13299,17 +13421,17 @@ const Source = Schema.Struct({
|
|
|
13299
13421
|
});
|
|
13300
13422
|
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
13301
13423
|
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
13302
|
-
const taggedError = Schema.TaggedError;
|
|
13303
|
-
var SkillsConfigUnreadable = class extends taggedError()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13424
|
+
const taggedError$1 = Schema.TaggedError;
|
|
13425
|
+
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13304
13426
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
13305
13427
|
file,
|
|
13306
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
13428
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
13307
13429
|
rule,
|
|
13308
13430
|
message
|
|
13309
13431
|
});
|
|
13310
13432
|
const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
|
|
13311
13433
|
const files = yield* RepositoryFiles;
|
|
13312
|
-
const file = files.join(root, CONFIG_FILE);
|
|
13434
|
+
const file = files.join(root, CONFIG_FILE$1);
|
|
13313
13435
|
const text = yield* files.readFile(file);
|
|
13314
13436
|
if (Option.isNone(text)) return Option.none();
|
|
13315
13437
|
const config = yield* Effect.tryPromise({
|
|
@@ -13336,7 +13458,7 @@ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root
|
|
|
13336
13458
|
const file = files.join(root, RENOVATE_FILE$1);
|
|
13337
13459
|
const text = yield* files.readFile(file);
|
|
13338
13460
|
if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
|
|
13339
|
-
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`)];
|
|
13461
|
+
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
|
|
13340
13462
|
});
|
|
13341
13463
|
/** @internal */
|
|
13342
13464
|
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
@@ -13350,7 +13472,7 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
13350
13472
|
];
|
|
13351
13473
|
});
|
|
13352
13474
|
// src/features/check-skills/model/published-skills.ts
|
|
13353
|
-
const RULE$
|
|
13475
|
+
const RULE$14 = "published-skills";
|
|
13354
13476
|
const KEYWORD = "tanstack-intent";
|
|
13355
13477
|
const SKILLS = "skills";
|
|
13356
13478
|
const MANIFEST_FILE = "package.json";
|
|
@@ -13358,7 +13480,7 @@ const SKILL_FILE$1 = "SKILL.md";
|
|
|
13358
13480
|
const SUCCEEDED = 0;
|
|
13359
13481
|
const SYNC = "Run vp exec intent maintainer sync in the repository root.";
|
|
13360
13482
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
13361
|
-
const problemAt$2 = problemInFile(RULE$
|
|
13483
|
+
const problemAt$2 = problemInFile(RULE$14);
|
|
13362
13484
|
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))));
|
|
13363
13485
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
13364
13486
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -13379,7 +13501,7 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
13379
13501
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
13380
13502
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
13381
13503
|
}, Effect.scoped);
|
|
13382
|
-
const problemsIn$
|
|
13504
|
+
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
13383
13505
|
const files = yield* RepositoryFiles;
|
|
13384
13506
|
const directory = files.join(root, project.directory);
|
|
13385
13507
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
@@ -13391,11 +13513,11 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
13391
13513
|
/** @internal */
|
|
13392
13514
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
13393
13515
|
const projects = yield* publishedProjects(root);
|
|
13394
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
13516
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$8(root, project), { concurrency: 1 });
|
|
13395
13517
|
return Array.flatten(problems);
|
|
13396
13518
|
});
|
|
13397
13519
|
// src/features/check-skills/model/skill-files.ts
|
|
13398
|
-
const RULE$
|
|
13520
|
+
const RULE$13 = "skill-file";
|
|
13399
13521
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
13400
13522
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
13401
13523
|
const MARKDOWN = ".md";
|
|
@@ -13412,9 +13534,9 @@ const GITHUB = "https://github.com/";
|
|
|
13412
13534
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
13413
13535
|
const BLANK = /\s+/u;
|
|
13414
13536
|
const SEPARATOR$3 = "/";
|
|
13415
|
-
const START$
|
|
13537
|
+
const START$10 = 0;
|
|
13416
13538
|
const FIRST$3 = 1;
|
|
13417
|
-
const READ_CONCURRENCY$
|
|
13539
|
+
const READ_CONCURRENCY$5 = 16;
|
|
13418
13540
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
13419
13541
|
const Frontmatter = Schema.Struct({
|
|
13420
13542
|
name: Schema.optional(Schema.String),
|
|
@@ -13422,9 +13544,9 @@ const Frontmatter = Schema.Struct({
|
|
|
13422
13544
|
metadata: Schema.optional(Metadata)
|
|
13423
13545
|
});
|
|
13424
13546
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
13425
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
13547
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
13426
13548
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
13427
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
13549
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
13428
13550
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
13429
13551
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
13430
13552
|
const bodyStart = bodyStartOf(source);
|
|
@@ -13452,16 +13574,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
13452
13574
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
13453
13575
|
file: skill.file,
|
|
13454
13576
|
...positionOf(skill.source)(index),
|
|
13455
|
-
rule: RULE$
|
|
13577
|
+
rule: RULE$13,
|
|
13456
13578
|
message
|
|
13457
13579
|
})));
|
|
13458
13580
|
const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
13459
13581
|
target,
|
|
13460
|
-
index: found.index ?? START$
|
|
13582
|
+
index: found.index ?? START$10
|
|
13461
13583
|
})), Option.toArray);
|
|
13462
13584
|
const rangeOf$1 = (found) => {
|
|
13463
|
-
const start = found.index ?? START$
|
|
13464
|
-
return [start, start + found[START$
|
|
13585
|
+
const start = found.index ?? START$10;
|
|
13586
|
+
return [start, start + found[START$10].length];
|
|
13465
13587
|
};
|
|
13466
13588
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
13467
13589
|
const linksIn = (source) => {
|
|
@@ -13479,23 +13601,23 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
13479
13601
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
13480
13602
|
file,
|
|
13481
13603
|
...positionOf(source)(index),
|
|
13482
|
-
rule: RULE$
|
|
13604
|
+
rule: RULE$13,
|
|
13483
13605
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
13484
13606
|
})));
|
|
13485
13607
|
});
|
|
13486
|
-
const problemsIn$
|
|
13608
|
+
const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
13487
13609
|
const files = yield* RepositoryFiles;
|
|
13488
13610
|
const file = files.join(root, name);
|
|
13489
13611
|
const directory = files.dirname(name);
|
|
13490
13612
|
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$3}`)));
|
|
13491
13613
|
const text = yield* files.readFile(file);
|
|
13492
13614
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
13493
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
13615
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
|
|
13494
13616
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
13495
13617
|
file: files.join(root, entry),
|
|
13496
13618
|
line: FIRST$3,
|
|
13497
13619
|
column: FIRST$3,
|
|
13498
|
-
rule: RULE$
|
|
13620
|
+
rule: RULE$13,
|
|
13499
13621
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
13500
13622
|
})));
|
|
13501
13623
|
return [
|
|
@@ -13512,7 +13634,7 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13512
13634
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
13513
13635
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13514
13636
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
|
|
13515
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
13637
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$7(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
13516
13638
|
return Array.flatten(found);
|
|
13517
13639
|
});
|
|
13518
13640
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -13575,9 +13697,9 @@ const cargoEntries = (text) => {
|
|
|
13575
13697
|
};
|
|
13576
13698
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
13577
13699
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
13578
|
-
const RULE$
|
|
13700
|
+
const RULE$12 = "version-downgrade";
|
|
13579
13701
|
const DEFAULT_BASE = "origin/main";
|
|
13580
|
-
const READ_CONCURRENCY$
|
|
13702
|
+
const READ_CONCURRENCY$4 = 16;
|
|
13581
13703
|
const READERS = [
|
|
13582
13704
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
13583
13705
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -13601,7 +13723,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
13601
13723
|
file,
|
|
13602
13724
|
line: lineOf(text, entry),
|
|
13603
13725
|
column: FIRST_LINE$1,
|
|
13604
|
-
rule: RULE$
|
|
13726
|
+
rule: RULE$12,
|
|
13605
13727
|
message: message(old, entry)
|
|
13606
13728
|
})), Option.toArray)));
|
|
13607
13729
|
};
|
|
@@ -13627,7 +13749,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
13627
13749
|
before: read(before),
|
|
13628
13750
|
after: read(after)
|
|
13629
13751
|
})), Option.getOrElse(() => []));
|
|
13630
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
13752
|
+
}), { concurrency: READ_CONCURRENCY$4 });
|
|
13631
13753
|
return Array.flatten(found);
|
|
13632
13754
|
});
|
|
13633
13755
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -13638,13 +13760,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
13638
13760
|
const CAP_RULE = "renovate-version-cap";
|
|
13639
13761
|
const PRESET_RULE = "renovate-msch-preset";
|
|
13640
13762
|
const PRESET = "github>masseater/masseater.dev//libs/msch/renovate";
|
|
13641
|
-
const START$
|
|
13642
|
-
const READ_CONCURRENCY$
|
|
13763
|
+
const START$9 = 0;
|
|
13764
|
+
const READ_CONCURRENCY$3 = 16;
|
|
13643
13765
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
13644
13766
|
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.";
|
|
13645
13767
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
13646
13768
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
13647
|
-
const problemsIn$
|
|
13769
|
+
const problemsIn$6 = (file, source) => {
|
|
13648
13770
|
const at = positionOf(source);
|
|
13649
13771
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
13650
13772
|
file,
|
|
@@ -13657,7 +13779,7 @@ const problemsIn$5 = (file, source) => {
|
|
|
13657
13779
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
13658
13780
|
...pipe([{
|
|
13659
13781
|
file,
|
|
13660
|
-
...at(START$
|
|
13782
|
+
...at(START$9),
|
|
13661
13783
|
rule: PRESET_RULE,
|
|
13662
13784
|
message: PRESET_MESSAGE
|
|
13663
13785
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -13671,30 +13793,30 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13671
13793
|
const file = files.join(root, name);
|
|
13672
13794
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13673
13795
|
onNone: () => [],
|
|
13674
|
-
onSome: (source) => problemsIn$
|
|
13796
|
+
onSome: (source) => problemsIn$6(file, source)
|
|
13675
13797
|
})));
|
|
13676
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13798
|
+
}, { concurrency: READ_CONCURRENCY$3 });
|
|
13677
13799
|
return Array.flatten(found);
|
|
13678
13800
|
});
|
|
13679
13801
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
13680
13802
|
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;
|
|
13681
13803
|
const NUL = "\0";
|
|
13682
|
-
const START$
|
|
13804
|
+
const START$8 = 0;
|
|
13683
13805
|
const HEX = 16;
|
|
13684
13806
|
const CODE_POINT_WIDTH = 4;
|
|
13685
|
-
const READ_CONCURRENCY$
|
|
13686
|
-
const RULE$
|
|
13687
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
13807
|
+
const READ_CONCURRENCY$2 = 64;
|
|
13808
|
+
const RULE$11 = "hidden-unicode";
|
|
13809
|
+
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"));
|
|
13688
13810
|
const problemOf$1 = (file, source) => (found) => {
|
|
13689
|
-
const hex = hexOf(found[START$
|
|
13811
|
+
const hex = hexOf(found[START$8]);
|
|
13690
13812
|
return {
|
|
13691
13813
|
file,
|
|
13692
|
-
...positionOf(source)(found.index ?? START$
|
|
13693
|
-
rule: RULE$
|
|
13814
|
+
...positionOf(source)(found.index ?? START$8),
|
|
13815
|
+
rule: RULE$11,
|
|
13694
13816
|
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}.`
|
|
13695
13817
|
};
|
|
13696
13818
|
};
|
|
13697
|
-
const problemsIn$
|
|
13819
|
+
const problemsIn$5 = (file, source) => {
|
|
13698
13820
|
if (String$1.includes(NUL)(source)) return [];
|
|
13699
13821
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
|
|
13700
13822
|
};
|
|
@@ -13706,25 +13828,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
13706
13828
|
const file = files.join(root, name);
|
|
13707
13829
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13708
13830
|
onNone: () => [],
|
|
13709
|
-
onSome: (source) => problemsIn$
|
|
13831
|
+
onSome: (source) => problemsIn$5(file, source)
|
|
13710
13832
|
})));
|
|
13711
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13833
|
+
}, { concurrency: READ_CONCURRENCY$2 });
|
|
13712
13834
|
return Array.flatten(found);
|
|
13713
13835
|
});
|
|
13714
13836
|
// src/features/find-unneeded-files/model/alchemy-patch.ts
|
|
13715
|
-
const RULE$
|
|
13837
|
+
const RULE$10 = "alchemy-patch";
|
|
13716
13838
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
13717
13839
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
13718
|
-
const START$
|
|
13840
|
+
const START$7 = 0;
|
|
13719
13841
|
const problemOf = (file, position, name) => ({
|
|
13720
13842
|
file,
|
|
13721
13843
|
...position,
|
|
13722
|
-
rule: RULE$
|
|
13844
|
+
rule: RULE$10,
|
|
13723
13845
|
message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
|
|
13724
13846
|
});
|
|
13725
|
-
const problemsIn$
|
|
13847
|
+
const problemsIn$4 = (file, patched) => (source) => {
|
|
13726
13848
|
const at = positionOf(source);
|
|
13727
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
13849
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$7));
|
|
13728
13850
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
13729
13851
|
};
|
|
13730
13852
|
/** @internal */
|
|
@@ -13734,12 +13856,12 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
|
|
|
13734
13856
|
const text = yield* files.readFile(file);
|
|
13735
13857
|
const manifest = yield* workspaceManifest(root);
|
|
13736
13858
|
const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
13737
|
-
return pipe(text, Option.map(problemsIn$
|
|
13859
|
+
return pipe(text, Option.map(problemsIn$4(file, patched)), Option.getOrElse(() => []));
|
|
13738
13860
|
});
|
|
13739
13861
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
13740
13862
|
const MSCH = "@r_masseater/msch";
|
|
13741
13863
|
const SCOPE$1 = "@r_masseater/";
|
|
13742
|
-
const RULE$
|
|
13864
|
+
const RULE$9 = "applied-package";
|
|
13743
13865
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
13744
13866
|
const NOT_FOUND = -1;
|
|
13745
13867
|
const SEPARATOR$2 = "/";
|
|
@@ -13784,7 +13906,7 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
13784
13906
|
const problemAt$1 = (file, source) => (index, name) => ({
|
|
13785
13907
|
file,
|
|
13786
13908
|
...positionOf(source)(index),
|
|
13787
|
-
rule: RULE$
|
|
13909
|
+
rule: RULE$9,
|
|
13788
13910
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
13789
13911
|
});
|
|
13790
13912
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
@@ -13839,7 +13961,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
13839
13961
|
return yield* appliedPackageProblems(root, applied);
|
|
13840
13962
|
});
|
|
13841
13963
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
13842
|
-
const RULE$
|
|
13964
|
+
const RULE$8 = "replaced-tool";
|
|
13843
13965
|
const FIRST$2 = 1;
|
|
13844
13966
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
13845
13967
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
@@ -13916,18 +14038,18 @@ const REPLACED = [
|
|
|
13916
14038
|
replacement: "the root AGENTS.md and the skills in masseater/skills"
|
|
13917
14039
|
}
|
|
13918
14040
|
];
|
|
13919
|
-
const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
14041
|
+
const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
13920
14042
|
file,
|
|
13921
14043
|
line: FIRST$2,
|
|
13922
14044
|
column: FIRST$2,
|
|
13923
|
-
rule: RULE$
|
|
14045
|
+
rule: RULE$8,
|
|
13924
14046
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
13925
14047
|
})));
|
|
13926
14048
|
/** @internal */
|
|
13927
14049
|
const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplacedTools(root) {
|
|
13928
14050
|
const listed = yield* listedFiles(root);
|
|
13929
|
-
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor(entry)))));
|
|
13930
|
-
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor(entry))));
|
|
14051
|
+
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor$1(entry)))));
|
|
14052
|
+
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor$1(entry))));
|
|
13931
14053
|
});
|
|
13932
14054
|
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
13933
14055
|
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
@@ -13949,7 +14071,7 @@ const SETUP_PATTERNS = [
|
|
|
13949
14071
|
];
|
|
13950
14072
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
13951
14073
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
13952
|
-
const START$
|
|
14074
|
+
const START$6 = 0;
|
|
13953
14075
|
const LAST_SEGMENT = 1;
|
|
13954
14076
|
const FIRST_LINE = 1;
|
|
13955
14077
|
const FIRST_COLUMN = 1;
|
|
@@ -14019,7 +14141,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14019
14141
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14020
14142
|
return directoriesOf(roots);
|
|
14021
14143
|
});
|
|
14022
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
14144
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
|
|
14023
14145
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14024
14146
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14025
14147
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14055,11 +14177,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14055
14177
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14056
14178
|
});
|
|
14057
14179
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
14058
|
-
const RULE$
|
|
14180
|
+
const RULE$7 = "effect-diagnostics-once";
|
|
14059
14181
|
const PLUGIN = "@effect/language-service";
|
|
14060
14182
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14061
|
-
const EXCLUDED$
|
|
14062
|
-
const START$
|
|
14183
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14184
|
+
const START$5 = 0;
|
|
14063
14185
|
const Plugin = Schema.Struct({
|
|
14064
14186
|
name: Schema.optional(Schema.String),
|
|
14065
14187
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14070,38 +14192,38 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
14070
14192
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
14071
14193
|
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.`;
|
|
14072
14194
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14073
|
-
const problemsIn$
|
|
14195
|
+
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(() => ({
|
|
14074
14196
|
file: entry.file,
|
|
14075
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14076
|
-
rule: RULE$
|
|
14197
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$5))),
|
|
14198
|
+
rule: RULE$7,
|
|
14077
14199
|
message: MESSAGE$1
|
|
14078
14200
|
})), Option.toArray);
|
|
14079
14201
|
/** @internal */
|
|
14080
14202
|
const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* checkEffectDiagnostics(root) {
|
|
14081
14203
|
const files = yield* RepositoryFiles;
|
|
14082
|
-
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$
|
|
14204
|
+
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$4]);
|
|
14083
14205
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
14084
14206
|
name,
|
|
14085
14207
|
file: files.join(root, name)
|
|
14086
|
-
}))), problemsIn$
|
|
14208
|
+
}))), problemsIn$3);
|
|
14087
14209
|
});
|
|
14088
14210
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
14089
|
-
const RULE$
|
|
14211
|
+
const RULE$6 = "version-range";
|
|
14090
14212
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
14091
14213
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14092
14214
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14093
14215
|
const PATH_LIKE = "/";
|
|
14094
|
-
const START$
|
|
14216
|
+
const START$4 = 0;
|
|
14095
14217
|
const SECTIONS = [
|
|
14096
14218
|
"dependencies",
|
|
14097
14219
|
"devDependencies",
|
|
14098
14220
|
"optionalDependencies"
|
|
14099
14221
|
];
|
|
14100
|
-
const EXCLUDED$
|
|
14222
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14101
14223
|
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.";
|
|
14102
14224
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
14103
14225
|
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
14104
|
-
const decodeManifest$
|
|
14226
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
14105
14227
|
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
14106
14228
|
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
14107
14229
|
const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
|
|
@@ -14115,16 +14237,16 @@ const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatM
|
|
|
14115
14237
|
specifier
|
|
14116
14238
|
})), Option.toArray)));
|
|
14117
14239
|
const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
14118
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
14240
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$4));
|
|
14119
14241
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14120
14242
|
file,
|
|
14121
14243
|
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14122
|
-
rule: RULE$
|
|
14244
|
+
rule: RULE$6,
|
|
14123
14245
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14124
14246
|
})));
|
|
14125
14247
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted(name)}"\\s*:\\s*"${quoted(specifier)}"`, "u");
|
|
14126
14248
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "mu");
|
|
14127
|
-
const manifestProblems$1 = (entry, source) => pipe(decodeManifest$
|
|
14249
|
+
const manifestProblems$1 = (entry, source) => pipe(decodeManifest$4(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
|
|
14128
14250
|
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14129
14251
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
14130
14252
|
const files = yield* RepositoryFiles;
|
|
@@ -14139,7 +14261,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14139
14261
|
/** @internal */
|
|
14140
14262
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
14141
14263
|
const files = yield* RepositoryFiles;
|
|
14142
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14264
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$3]);
|
|
14143
14265
|
const listed = pipe(manifests, Array.map((name) => ({
|
|
14144
14266
|
name,
|
|
14145
14267
|
file: files.join(root, name)
|
|
@@ -14148,6 +14270,58 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14148
14270
|
const fromCatalogs = yield* catalogProblems(root);
|
|
14149
14271
|
return [...fromManifests, ...fromCatalogs];
|
|
14150
14272
|
});
|
|
14273
|
+
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14274
|
+
const RULE$5 = "pack-publint";
|
|
14275
|
+
const CONFIG_FILE = "vite.config.ts";
|
|
14276
|
+
const PACK_KEY = "pack:";
|
|
14277
|
+
const START$3 = 0;
|
|
14278
|
+
const READ_CONCURRENCY$1 = 16;
|
|
14279
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14280
|
+
const Manifest$3 = Schema.Struct({
|
|
14281
|
+
private: Schema.optional(Schema.Boolean),
|
|
14282
|
+
publishConfig: Schema.optional(Schema.Unknown)
|
|
14283
|
+
});
|
|
14284
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
14285
|
+
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14286
|
+
const isStrict = Schema.is(StrictPack);
|
|
14287
|
+
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
14288
|
+
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
14289
|
+
const taggedError = Schema.TaggedError;
|
|
14290
|
+
var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
14291
|
+
const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14292
|
+
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14293
|
+
const problemFor = (file, source) => ({
|
|
14294
|
+
file,
|
|
14295
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$3)),
|
|
14296
|
+
rule: RULE$5,
|
|
14297
|
+
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."
|
|
14298
|
+
});
|
|
14299
|
+
const isPublishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$3), Option.exists(isPublished$2));
|
|
14300
|
+
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14301
|
+
const config = yield* Effect.tryPromise({
|
|
14302
|
+
try: () => resolveConfigFromFile(configFile),
|
|
14303
|
+
catch: () => PackConfigUnreadable.make({ file: configFile })
|
|
14304
|
+
}).pipe(Effect.option);
|
|
14305
|
+
return Option.exists(config, runsStrictPublint);
|
|
14306
|
+
});
|
|
14307
|
+
const configProblems = Effect.fn("configProblems")(function* configProblems(configFile) {
|
|
14308
|
+
const source = yield* (yield* RepositoryFiles).readFile(configFile);
|
|
14309
|
+
if (Option.isNone(source)) return [];
|
|
14310
|
+
if (yield* strictPublintIn(configFile)) return [];
|
|
14311
|
+
return [problemFor(configFile, source.value)];
|
|
14312
|
+
});
|
|
14313
|
+
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14314
|
+
const files = yield* RepositoryFiles;
|
|
14315
|
+
const manifest = yield* files.readFile(files.join(root, manifestName));
|
|
14316
|
+
if (!isPublishedManifest(manifest)) return [];
|
|
14317
|
+
return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14318
|
+
});
|
|
14319
|
+
/** @internal */
|
|
14320
|
+
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14321
|
+
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14322
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14323
|
+
return Array.flatten(found);
|
|
14324
|
+
});
|
|
14151
14325
|
// src/features/check-package-scope/model/package-scope.ts
|
|
14152
14326
|
const RULE$4 = "package-scope";
|
|
14153
14327
|
const SCOPE = "@r_masseater/";
|
|
@@ -14190,6 +14364,7 @@ const OwnerSchema = Schema.Struct({
|
|
|
14190
14364
|
const Person = Schema.Union([Schema.String, OwnerSchema]);
|
|
14191
14365
|
const RootManifest = Schema.fromJsonString(Schema.Struct({
|
|
14192
14366
|
name: Schema.String,
|
|
14367
|
+
description: Schema.optionalKey(Schema.String),
|
|
14193
14368
|
author: Schema.optionalKey(Person)
|
|
14194
14369
|
}));
|
|
14195
14370
|
const PluginManifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));
|
|
@@ -14202,9 +14377,11 @@ const PluginSchema = Schema.Struct({
|
|
|
14202
14377
|
source: Schema.Union([Schema.String, NpmSource]),
|
|
14203
14378
|
description: Schema.String
|
|
14204
14379
|
});
|
|
14380
|
+
const MetadataSchema = Schema.Struct({ description: Schema.String });
|
|
14205
14381
|
const Marketplace = Schema.fromJsonString(Schema.Struct({
|
|
14206
14382
|
name: Schema.String,
|
|
14207
14383
|
owner: OwnerSchema,
|
|
14384
|
+
metadata: Schema.optionalKey(MetadataSchema),
|
|
14208
14385
|
plugins: Schema.Array(PluginSchema)
|
|
14209
14386
|
}), { space: INDENT });
|
|
14210
14387
|
const decodeRoot = Schema.decodeUnknownOption(RootManifest);
|
|
@@ -14237,12 +14414,17 @@ const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
|
14237
14414
|
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
14238
14415
|
return Array.getSomes(found);
|
|
14239
14416
|
});
|
|
14417
|
+
const described = (description) => pipe(Option.fromUndefinedOr(description), Option.match({
|
|
14418
|
+
onNone: () => ({}),
|
|
14419
|
+
onSome: (text) => ({ metadata: { description: text } })
|
|
14420
|
+
}));
|
|
14240
14421
|
const ownerIn = Effect.fn("ownerIn")(function* ownerIn(root) {
|
|
14241
14422
|
const files = yield* RepositoryFiles;
|
|
14242
14423
|
const text = yield* files.readFile(files.join(root, MANIFEST_FILE$3));
|
|
14243
|
-
return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
|
|
14424
|
+
return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, description, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
|
|
14244
14425
|
name: marketplaceName(name),
|
|
14245
|
-
owner: ownerOf(found)
|
|
14426
|
+
owner: ownerOf(found),
|
|
14427
|
+
...described(description)
|
|
14246
14428
|
})))));
|
|
14247
14429
|
});
|
|
14248
14430
|
const rewrite = Effect.fn("rewrite")(function* rewrite(file, expected) {
|
|
@@ -14490,6 +14672,7 @@ const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root
|
|
|
14490
14672
|
const found = yield* Effect.all([
|
|
14491
14673
|
checkNodeVersion(root),
|
|
14492
14674
|
checkPackageScope(root),
|
|
14675
|
+
checkPackSettings(root),
|
|
14493
14676
|
checkUnusedWorkspaces(root),
|
|
14494
14677
|
checkExactVersions(root),
|
|
14495
14678
|
checkUpstreamExits(root),
|