@r_masseater/msch 0.61.2 → 0.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -1
- package/dist/cli.mjs +553 -394
- package/dist/cli.mjs.map +1 -1
- package/dist/exits.mjs +1 -1
- package/dist/{upstream-exits-DgkAyuu-.mjs → upstream-exits-DitN-yYH.mjs} +15 -3
- package/dist/upstream-exits-DitN-yYH.mjs.map +1 -0
- package/package.json +1 -2
- package/skills/msch-checks/SKILL.md +0 -10
- package/dist/fix.d.mts +0 -1
- package/dist/fix.mjs +0 -130
- package/dist/fix.mjs.map +0 -1
- package/dist/pack-settings-FN4-vi6J.mjs +0 -225
- package/dist/pack-settings-FN4-vi6J.mjs.map +0 -1
- package/dist/text-position-DrvZ7k2Y.mjs +0 -17
- package/dist/text-position-DrvZ7k2Y.mjs.map +0 -1
- package/dist/upstream-exits-DgkAyuu-.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -3,14 +3,12 @@ import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as
|
|
|
3
3
|
import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-B6p7x90y.mjs";
|
|
4
4
|
import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-CFIrQmB5.mjs";
|
|
5
5
|
import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
|
|
6
|
-
import { t as positionOf } from "./
|
|
6
|
+
import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-DitN-yYH.mjs";
|
|
7
7
|
import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
|
|
8
8
|
import { a as problemAtPosition, i as problemAt$8, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-D2HKNIVq.mjs";
|
|
9
9
|
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-BD6WGsC7.mjs";
|
|
10
10
|
import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
|
|
11
11
|
import { $ as isPropertyAccessExpression, A as getNameOfDeclaration, B as isExportDeclaration, D as SyntaxKind, E as SymbolFlags, F as isBlock, G as isImportDeclaration, H as isFunctionDeclaration, I as isCallExpression, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isParenthesizedExpression, R as isElementAccessExpression, T as SignatureKind, U as isFunctionExpression, V as isExpressionStatement, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as referencedSymbols, a as declarationsOf, at as isSpreadElement, b as symbolAtLocation, c as importedModulesOf, ct as isTypeLiteralNode, d as isInsideAny, dt as isVariableDeclaration, et as isPropertyAssignment, f as isOutsideDeclaration, ft as isVariableDeclarationList, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSourceFile, j as getTextOfJSDocComment, l as isExternalDeclaration, lt as isTypeReferenceNode, m as lineOf$3, n as childrenOf$2, nt as isSatisfiesExpression, o as declaresAType, ot as isStringLiteral, p as isTypeDeclaration, pt as isVariableStatement, q as isModuleBlock, r as columnOf, rt as isSignatureDeclaration, s as descendantsOf, st as isTypeAliasDeclaration, t as carriesTag, tt as isReturnStatement, u as isGenericDeclaration, ut as isUnionTypeNode, x as uniqueByReference, y as symbolAt, z as isEnumDeclaration } from "./syntax-C0ddqOHc.mjs";
|
|
12
|
-
import { _ as presentFiles, c as manifestPattern, d as offsetIn$1, f as quoted$1, g as listedFiles, h as isToolVersions, i as uncatalogedDependencies, l as manifestSpecifiers, m as isScannedText, o as decodeManifest$9, p as specifiedIn, s as fieldsOf, t as checkPackSettings, u as namedCatalogsOf, v as scanText } from "./pack-settings-FN4-vi6J.mjs";
|
|
13
|
-
import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits } from "./upstream-exits-DgkAyuu-.mjs";
|
|
14
12
|
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-A2p57njU.mjs";
|
|
15
13
|
import "./cli-contract-D7btWrEu.mjs";
|
|
16
14
|
import { builtinModules } from "node:module";
|
|
@@ -373,8 +371,8 @@ const RESOLUTION_FILES = [
|
|
|
373
371
|
];
|
|
374
372
|
const RESOLUTION_CONCURRENCY = 2;
|
|
375
373
|
const SUCCEEDED$1 = 0;
|
|
376
|
-
const taggedError$
|
|
377
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
374
|
+
const taggedError$8 = Schema.TaggedError;
|
|
375
|
+
var OverrideResolutionFailed = class extends taggedError$8()("OverrideResolutionFailed", {
|
|
378
376
|
override: Schema.String,
|
|
379
377
|
output: Schema.String
|
|
380
378
|
}) {};
|
|
@@ -492,73 +490,103 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
492
490
|
overrides
|
|
493
491
|
}, keys));
|
|
494
492
|
});
|
|
493
|
+
// src/shared/lib/scanned-files.ts
|
|
494
|
+
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
495
|
+
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
496
|
+
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
497
|
+
const READ_CONCURRENCY$33 = 64;
|
|
498
|
+
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
499
|
+
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
500
|
+
/** @internal */
|
|
501
|
+
const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
|
|
502
|
+
const files = yield* RepositoryFiles;
|
|
503
|
+
const names = yield* files.ownedFiles(root);
|
|
504
|
+
return pipe(names, Array.map((name) => ({
|
|
505
|
+
name,
|
|
506
|
+
file: files.join(root, name)
|
|
507
|
+
})));
|
|
508
|
+
});
|
|
509
|
+
/** @internal */
|
|
510
|
+
const presentFiles = Effect.fn("presentFiles")(function* presentFiles(listed) {
|
|
511
|
+
const files = yield* RepositoryFiles;
|
|
512
|
+
return yield* pipe(listed, Effect.filter(({ file }) => files.exists(file)));
|
|
513
|
+
});
|
|
514
|
+
/** @internal */
|
|
515
|
+
const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
516
|
+
const files = yield* RepositoryFiles;
|
|
517
|
+
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
518
|
+
onNone: () => [],
|
|
519
|
+
onSome: (source) => problemsIn(entry, source)
|
|
520
|
+
}))), { concurrency: READ_CONCURRENCY$33 });
|
|
521
|
+
return Array.flatten(found);
|
|
522
|
+
});
|
|
495
523
|
// src/features/check-overrides/model/git-subpath.ts
|
|
496
524
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
497
525
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
498
|
-
const RULE$
|
|
526
|
+
const RULE$64 = "git-subpath-dependency";
|
|
499
527
|
const WHOLE_MATCH$4 = 0;
|
|
500
528
|
const problemAt$7 = ({ file }, source) => (found) => ({
|
|
501
529
|
file,
|
|
502
530
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
503
|
-
rule: RULE$
|
|
531
|
+
rule: RULE$64,
|
|
504
532
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
505
533
|
});
|
|
506
|
-
const problemsIn$
|
|
534
|
+
const problemsIn$23 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
|
|
507
535
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
508
536
|
/** @internal */
|
|
509
537
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
510
538
|
const listed = yield* listedFiles(root);
|
|
511
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
539
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$23);
|
|
512
540
|
});
|
|
513
541
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
514
|
-
const RULE$
|
|
542
|
+
const RULE$63 = "unnamed-restriction";
|
|
515
543
|
const WHOLE_MATCH$3 = 0;
|
|
516
544
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
517
|
-
const problemsIn$
|
|
545
|
+
const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
518
546
|
file: entry.file,
|
|
519
547
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
520
|
-
rule: RULE$
|
|
548
|
+
rule: RULE$63,
|
|
521
549
|
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
522
550
|
})));
|
|
523
551
|
/** @internal */
|
|
524
552
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
525
553
|
const listed = yield* listedFiles(root);
|
|
526
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
554
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$22);
|
|
527
555
|
});
|
|
528
556
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
529
|
-
const RULE$
|
|
557
|
+
const RULE$62 = "named-type-exemption";
|
|
530
558
|
const WHOLE_MATCH$2 = 0;
|
|
531
559
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
532
|
-
const problemsIn$
|
|
560
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
533
561
|
file: entry.file,
|
|
534
562
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
535
|
-
rule: RULE$
|
|
563
|
+
rule: RULE$62,
|
|
536
564
|
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
537
565
|
})));
|
|
538
566
|
/** @internal */
|
|
539
567
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
540
568
|
const listed = yield* listedFiles(root);
|
|
541
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
569
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
|
|
542
570
|
});
|
|
543
571
|
// src/features/check-overrides/model/package-registry.ts
|
|
544
|
-
const RULE$
|
|
572
|
+
const RULE$61 = "package-registry";
|
|
545
573
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
546
574
|
const TRAILING_SLASH = /\/$/u;
|
|
547
575
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
548
576
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
549
577
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
550
578
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
551
|
-
const START$
|
|
579
|
+
const START$24 = 0;
|
|
552
580
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
553
581
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
554
582
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
555
583
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
556
584
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
557
|
-
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
585
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$24));
|
|
558
586
|
const workspaceProblem = (file, source, registry) => ({
|
|
559
587
|
file,
|
|
560
|
-
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
561
|
-
rule: RULE$
|
|
588
|
+
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
589
|
+
rule: RULE$61,
|
|
562
590
|
message: Option.match(registry, {
|
|
563
591
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
564
592
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -566,9 +594,9 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
566
594
|
});
|
|
567
595
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
|
|
568
596
|
file: entry.file,
|
|
569
|
-
...positionOf(source)(found.index ?? START$
|
|
570
|
-
rule: RULE$
|
|
571
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
597
|
+
...positionOf(source)(found.index ?? START$24),
|
|
598
|
+
rule: RULE$61,
|
|
599
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
|
|
572
600
|
})));
|
|
573
601
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
574
602
|
const files = yield* RepositoryFiles;
|
|
@@ -586,8 +614,38 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
586
614
|
const overrides = yield* scanText(pipe(listed, Array.filter(({ name }) => NPMRC.test(name))), npmrcProblems);
|
|
587
615
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
588
616
|
});
|
|
617
|
+
// src/entities/package/model/specifiers.ts
|
|
618
|
+
const START$23 = 0;
|
|
619
|
+
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
620
|
+
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
621
|
+
const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
622
|
+
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
623
|
+
/** @internal */
|
|
624
|
+
const decodeManifest$10 = (source) => decodeJson$2(source);
|
|
625
|
+
/** @internal */
|
|
626
|
+
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
627
|
+
/** @internal */
|
|
628
|
+
const namedCatalogsOf = (settings) => Record.toEntries(fieldsOf(settings["catalogs"]));
|
|
629
|
+
/** @internal */
|
|
630
|
+
const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString$2(value), Option.map((specifier) => ({
|
|
631
|
+
name,
|
|
632
|
+
specifier
|
|
633
|
+
})), Option.toArray)));
|
|
634
|
+
/** @internal */
|
|
635
|
+
const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
636
|
+
/** @internal */
|
|
637
|
+
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
638
|
+
/** @internal */
|
|
639
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
|
|
640
|
+
const SECTIONS = [
|
|
641
|
+
"dependencies",
|
|
642
|
+
"devDependencies",
|
|
643
|
+
"optionalDependencies"
|
|
644
|
+
];
|
|
645
|
+
/** @internal */
|
|
646
|
+
const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
|
|
589
647
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
590
|
-
const RULE$
|
|
648
|
+
const RULE$60 = "colocated-git-patterns";
|
|
591
649
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
592
650
|
const ROOT$3 = ".";
|
|
593
651
|
const NEGATION$1 = "!";
|
|
@@ -598,7 +656,7 @@ const LEADING_SLASHES = /^\/+/u;
|
|
|
598
656
|
const TRAILING_SLASHES = /\/+$/u;
|
|
599
657
|
const SPACES = /\s+/u;
|
|
600
658
|
const FIRST$22 = 1;
|
|
601
|
-
const READ_CONCURRENCY$
|
|
659
|
+
const READ_CONCURRENCY$32 = 16;
|
|
602
660
|
const withoutPrefix = (prefix, text) => {
|
|
603
661
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
604
662
|
return text;
|
|
@@ -634,7 +692,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
634
692
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
635
693
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
636
694
|
});
|
|
637
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
695
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$60)(entry.file, {
|
|
638
696
|
line: entry.line,
|
|
639
697
|
column: FIRST$22
|
|
640
698
|
}, message);
|
|
@@ -689,17 +747,17 @@ const repeated = (entries) => (entry) => {
|
|
|
689
747
|
/** @internal */
|
|
690
748
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
691
749
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
692
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
750
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$32 });
|
|
693
751
|
const entries = Array.flatten(read);
|
|
694
752
|
const workspaces = yield* workspaceDirectories(root);
|
|
695
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
753
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$32 });
|
|
696
754
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
697
755
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
698
756
|
});
|
|
699
757
|
// src/features/check-placement/model/colocated-tests.ts
|
|
700
|
-
const RULE$
|
|
758
|
+
const RULE$59 = "colocated-test";
|
|
701
759
|
const FIRST$21 = 1;
|
|
702
|
-
const READ_CONCURRENCY$
|
|
760
|
+
const READ_CONCURRENCY$31 = 64;
|
|
703
761
|
const ROOT_SUBPATH = ".";
|
|
704
762
|
const NAME_GROUP = "name";
|
|
705
763
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -712,20 +770,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
712
770
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
713
771
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
714
772
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
715
|
-
const EXCLUDED$
|
|
773
|
+
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
716
774
|
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.";
|
|
717
775
|
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>.";
|
|
718
|
-
const Manifest$
|
|
776
|
+
const Manifest$8 = Schema.Struct({
|
|
719
777
|
name: Schema.optional(Schema.String),
|
|
720
778
|
exports: Schema.optional(Schema.Unknown)
|
|
721
779
|
});
|
|
722
|
-
const decodeManifest$
|
|
780
|
+
const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$8));
|
|
723
781
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
724
|
-
const problemFor$
|
|
782
|
+
const problemFor$9 = (test, message) => ({
|
|
725
783
|
file: test.file,
|
|
726
784
|
line: FIRST$21,
|
|
727
785
|
column: FIRST$21,
|
|
728
|
-
rule: RULE$
|
|
786
|
+
rule: RULE$59,
|
|
729
787
|
message: `${test.base} ${message}`
|
|
730
788
|
});
|
|
731
789
|
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);
|
|
@@ -745,7 +803,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
745
803
|
if (Option.isNone(owner)) return [];
|
|
746
804
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
747
805
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
748
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
806
|
+
return pipe(text, Option.flatMap(decodeManifest$9), Option.map(specifiersBeside({
|
|
749
807
|
join,
|
|
750
808
|
dirname: files.dirname,
|
|
751
809
|
directory: test.directory
|
|
@@ -765,15 +823,15 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
765
823
|
});
|
|
766
824
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
767
825
|
const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
768
|
-
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$
|
|
826
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$9(test, DIRECTORY_MESSAGE));
|
|
769
827
|
if (!TEST_FILE$2.test(test.name)) return Option.none();
|
|
770
828
|
if (yield* refersIn(context, test)) return Option.none();
|
|
771
|
-
return Option.some(problemFor$
|
|
829
|
+
return Option.some(problemFor$9(test, SIBLING_MESSAGE));
|
|
772
830
|
});
|
|
773
831
|
/** @internal */
|
|
774
832
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
775
833
|
const files = yield* RepositoryFiles;
|
|
776
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
834
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$8);
|
|
777
835
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
778
836
|
const context = {
|
|
779
837
|
root,
|
|
@@ -788,12 +846,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
788
846
|
directory: files.dirname(file)
|
|
789
847
|
};
|
|
790
848
|
}));
|
|
791
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$
|
|
849
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$31 });
|
|
792
850
|
return Array.getSomes(found);
|
|
793
851
|
});
|
|
794
852
|
// src/shared/lib/agent-docs.ts
|
|
795
853
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
796
|
-
const READ_CONCURRENCY$
|
|
854
|
+
const READ_CONCURRENCY$30 = 16;
|
|
797
855
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
798
856
|
const files = yield* RepositoryFiles;
|
|
799
857
|
const listed = yield* files.listedFiles(root);
|
|
@@ -802,33 +860,33 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
802
860
|
const file = files.join(root, name);
|
|
803
861
|
const problemOf = Option.flatMap(problemIn(file));
|
|
804
862
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
805
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
863
|
+
}, { concurrency: READ_CONCURRENCY$30 });
|
|
806
864
|
return Array.getSomes(found);
|
|
807
865
|
});
|
|
808
866
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
809
867
|
const RECOMMENDED_LINES = 200;
|
|
810
868
|
const FIRST$20 = 1;
|
|
811
|
-
const RULE$
|
|
869
|
+
const RULE$58 = "agent-docs-length";
|
|
812
870
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
813
|
-
const problemFor$
|
|
871
|
+
const problemFor$8 = (file) => (lines) => {
|
|
814
872
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
815
873
|
return Option.some({
|
|
816
874
|
file,
|
|
817
875
|
line: 201,
|
|
818
876
|
column: FIRST$20,
|
|
819
|
-
rule: RULE$
|
|
877
|
+
rule: RULE$58,
|
|
820
878
|
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.`
|
|
821
879
|
});
|
|
822
880
|
};
|
|
823
881
|
/** @internal */
|
|
824
|
-
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$
|
|
882
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
825
883
|
// src/features/check-placement/model/claude-link.ts
|
|
826
|
-
const RULE$
|
|
884
|
+
const RULE$57 = "claude-md-link";
|
|
827
885
|
const CLAUDE = "CLAUDE.md";
|
|
828
886
|
const AGENTS = "AGENTS.md";
|
|
829
887
|
const FIRST$19 = 1;
|
|
830
|
-
const READ_CONCURRENCY$
|
|
831
|
-
const MESSAGE$
|
|
888
|
+
const READ_CONCURRENCY$29 = 16;
|
|
889
|
+
const MESSAGE$17 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
832
890
|
/** @internal */
|
|
833
891
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
834
892
|
const files = yield* RepositoryFiles;
|
|
@@ -842,19 +900,19 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
842
900
|
file: path,
|
|
843
901
|
line: FIRST$19,
|
|
844
902
|
column: FIRST$19,
|
|
845
|
-
rule: RULE$
|
|
846
|
-
message: MESSAGE$
|
|
903
|
+
rule: RULE$57,
|
|
904
|
+
message: MESSAGE$17
|
|
847
905
|
})));
|
|
848
906
|
});
|
|
849
907
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
850
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
908
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$29 });
|
|
851
909
|
return Array.getSomes(found);
|
|
852
910
|
});
|
|
853
911
|
// src/features/check-placement/model/dangling-links.ts
|
|
854
|
-
const RULE$
|
|
912
|
+
const RULE$56 = "dangling-link";
|
|
855
913
|
const SEPARATOR$19 = "/";
|
|
856
914
|
const FIRST$18 = 1;
|
|
857
|
-
const READ_CONCURRENCY$
|
|
915
|
+
const READ_CONCURRENCY$28 = 16;
|
|
858
916
|
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$19}`)(name);
|
|
859
917
|
/** @internal */
|
|
860
918
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
@@ -867,18 +925,18 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
867
925
|
file,
|
|
868
926
|
line: FIRST$18,
|
|
869
927
|
column: FIRST$18,
|
|
870
|
-
rule: RULE$
|
|
928
|
+
rule: RULE$56,
|
|
871
929
|
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.`
|
|
872
930
|
})));
|
|
873
931
|
});
|
|
874
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
932
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$28 });
|
|
875
933
|
return Array.getSomes(found);
|
|
876
934
|
});
|
|
877
935
|
// src/features/check-placement/model/member-sources.ts
|
|
878
936
|
const ROOT_WORKSPACE$1 = ".";
|
|
879
937
|
const FIRST$17 = 1;
|
|
880
938
|
const SEPARATOR$18 = "/";
|
|
881
|
-
const EXCLUDED$
|
|
939
|
+
const EXCLUDED$7 = [
|
|
882
940
|
":(exclude,attr:linguist-vendored)",
|
|
883
941
|
":(exclude,attr:linguist-generated)",
|
|
884
942
|
":(exclude,attr:linguist-documentation)"
|
|
@@ -891,7 +949,7 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
891
949
|
const files = yield* RepositoryFiles;
|
|
892
950
|
return {
|
|
893
951
|
workspaces: yield* memberWorkspaces(root),
|
|
894
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$
|
|
952
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$7)
|
|
895
953
|
};
|
|
896
954
|
});
|
|
897
955
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
@@ -925,9 +983,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
925
983
|
}));
|
|
926
984
|
});
|
|
927
985
|
// src/features/check-placement/model/deployed-readme.ts
|
|
928
|
-
const RULE$
|
|
929
|
-
const ROOT_DIRECTORY$
|
|
930
|
-
const READ_CONCURRENCY$
|
|
986
|
+
const RULE$55 = "deployed-readme";
|
|
987
|
+
const ROOT_DIRECTORY$3 = "";
|
|
988
|
+
const READ_CONCURRENCY$27 = 16;
|
|
931
989
|
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
932
990
|
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.";
|
|
933
991
|
const ADDRESS_KEYS = [
|
|
@@ -965,14 +1023,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
965
1023
|
const readme = yield* readReadme({
|
|
966
1024
|
root,
|
|
967
1025
|
directory,
|
|
968
|
-
rule: RULE$
|
|
1026
|
+
rule: RULE$55,
|
|
969
1027
|
missingMessage: MISSING_MESSAGE$2
|
|
970
1028
|
});
|
|
971
1029
|
return Result.match(readme, {
|
|
972
1030
|
onFailure: Option.some,
|
|
973
1031
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
974
1032
|
file,
|
|
975
|
-
rule: RULE$
|
|
1033
|
+
rule: RULE$55,
|
|
976
1034
|
message: NO_URL_MESSAGE
|
|
977
1035
|
})))
|
|
978
1036
|
});
|
|
@@ -983,38 +1041,38 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
983
1041
|
const listed = yield* files.listedFiles(root);
|
|
984
1042
|
const directories = yield* workspaceDirectories(root);
|
|
985
1043
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
986
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
987
|
-
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$
|
|
988
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1044
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$27 });
|
|
1045
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$3))), Array.dedupe);
|
|
1046
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$27 });
|
|
989
1047
|
return Array.getSomes(found);
|
|
990
1048
|
});
|
|
991
1049
|
// src/features/check-placement/model/nested-docs.ts
|
|
992
|
-
const RULE$
|
|
993
|
-
const CONFIG_FILE$
|
|
1050
|
+
const RULE$54 = "nested-docs";
|
|
1051
|
+
const CONFIG_FILE$7 = "vite.config.ts";
|
|
994
1052
|
const SEPARATOR$17 = "/";
|
|
995
|
-
const READ_CONCURRENCY$
|
|
1053
|
+
const READ_CONCURRENCY$26 = 64;
|
|
996
1054
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
997
1055
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
998
1056
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
999
1057
|
const MANIFEST$5 = "package.json";
|
|
1000
1058
|
const MISSING_RULE = "workspace-agents-md";
|
|
1001
1059
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1002
|
-
const taggedError$
|
|
1003
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
1060
|
+
const taggedError$7 = Schema.TaggedError;
|
|
1061
|
+
var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1004
1062
|
const isNested = (name) => String$1.includes(SEPARATOR$17)(name);
|
|
1005
|
-
const problemFor$
|
|
1063
|
+
const problemFor$7 = problemInFile(RULE$54);
|
|
1006
1064
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1007
1065
|
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.";
|
|
1008
1066
|
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
1009
1067
|
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.";
|
|
1010
1068
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
1011
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
1069
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$7(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
1012
1070
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1013
|
-
return Option.some(problemFor$
|
|
1071
|
+
return Option.some(problemFor$7(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
1014
1072
|
};
|
|
1015
1073
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
1016
1074
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1017
|
-
return Option.some(problemFor$
|
|
1075
|
+
return Option.some(problemFor$7(file, `${base} ${README_MESSAGE}`));
|
|
1018
1076
|
};
|
|
1019
1077
|
const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$5), MISSING_MESSAGE$1)));
|
|
1020
1078
|
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
@@ -1030,7 +1088,7 @@ const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, na
|
|
|
1030
1088
|
});
|
|
1031
1089
|
const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
|
|
1032
1090
|
const files = yield* RepositoryFiles;
|
|
1033
|
-
const file = files.join(root, CONFIG_FILE$
|
|
1091
|
+
const file = files.join(root, CONFIG_FILE$7);
|
|
1034
1092
|
if (!(yield* files.exists(file))) return false;
|
|
1035
1093
|
const config = yield* Effect.tryPromise({
|
|
1036
1094
|
try: () => resolveConfigFromFile(file),
|
|
@@ -1049,7 +1107,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1049
1107
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
1050
1108
|
workspaceAgentDocs
|
|
1051
1109
|
};
|
|
1052
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
1110
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$26 });
|
|
1053
1111
|
const missing = missingProblems({
|
|
1054
1112
|
required: workspaceAgentDocs,
|
|
1055
1113
|
directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
|
|
@@ -1059,15 +1117,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1059
1117
|
return [...Array.getSomes(found), ...missing];
|
|
1060
1118
|
});
|
|
1061
1119
|
// src/features/check-placement/model/published-readme.ts
|
|
1062
|
-
const RULE$
|
|
1063
|
-
const READ_CONCURRENCY$
|
|
1064
|
-
const MESSAGE$
|
|
1120
|
+
const RULE$53 = "published-readme";
|
|
1121
|
+
const READ_CONCURRENCY$25 = 16;
|
|
1122
|
+
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1065
1123
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
1066
1124
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
1067
1125
|
const readme = yield* readReadme({
|
|
1068
1126
|
root,
|
|
1069
1127
|
directory,
|
|
1070
|
-
rule: RULE$
|
|
1128
|
+
rule: RULE$53,
|
|
1071
1129
|
missingMessage: MISSING_MESSAGE
|
|
1072
1130
|
});
|
|
1073
1131
|
return Result.match(readme, {
|
|
@@ -1078,8 +1136,8 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1078
1136
|
file,
|
|
1079
1137
|
line,
|
|
1080
1138
|
column,
|
|
1081
|
-
rule: RULE$
|
|
1082
|
-
message: MESSAGE$
|
|
1139
|
+
rule: RULE$53,
|
|
1140
|
+
message: MESSAGE$16
|
|
1083
1141
|
};
|
|
1084
1142
|
}))
|
|
1085
1143
|
});
|
|
@@ -1087,17 +1145,17 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1087
1145
|
/** @internal */
|
|
1088
1146
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
1089
1147
|
const projects = yield* publishedProjects(root);
|
|
1090
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$
|
|
1148
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$25 });
|
|
1091
1149
|
return Array.getSomes(found);
|
|
1092
1150
|
});
|
|
1093
1151
|
// src/features/check-placement/model/published-tests.ts
|
|
1094
|
-
const RULE$
|
|
1152
|
+
const RULE$52 = "published-tests";
|
|
1095
1153
|
const MANIFEST_FILE$2 = "package.json";
|
|
1096
1154
|
const FILE_START = 1;
|
|
1097
1155
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
1098
|
-
const MESSAGE$
|
|
1156
|
+
const MESSAGE$15 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
1099
1157
|
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
1100
|
-
const problemFor$
|
|
1158
|
+
const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
1101
1159
|
const files = yield* RepositoryFiles;
|
|
1102
1160
|
const absolute = files.join(root, directory);
|
|
1103
1161
|
const prefix = `${absolute}/`;
|
|
@@ -1106,8 +1164,8 @@ const problemFor$5 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1106
1164
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1107
1165
|
line: FILE_START,
|
|
1108
1166
|
column: FILE_START,
|
|
1109
|
-
rule: RULE$
|
|
1110
|
-
message: MESSAGE$
|
|
1167
|
+
rule: RULE$52,
|
|
1168
|
+
message: MESSAGE$15
|
|
1111
1169
|
});
|
|
1112
1170
|
});
|
|
1113
1171
|
/** @internal */
|
|
@@ -1116,16 +1174,16 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1116
1174
|
const projects = yield* publishedProjects(root);
|
|
1117
1175
|
const listed = yield* files.listedFiles(root);
|
|
1118
1176
|
const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
|
|
1119
|
-
const found = yield* Effect.forEach(projects, (project) => problemFor$
|
|
1177
|
+
const found = yield* Effect.forEach(projects, (project) => problemFor$6(root, absolute, project), { concurrency: 1 });
|
|
1120
1178
|
return Array.getSomes(found);
|
|
1121
1179
|
});
|
|
1122
1180
|
// src/features/check-placement/model/root-docs.ts
|
|
1123
|
-
const RULE$
|
|
1181
|
+
const RULE$51 = "root-docs";
|
|
1124
1182
|
const SEPARATOR$16 = "/";
|
|
1125
1183
|
const FIRST$16 = 1;
|
|
1126
1184
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1127
1185
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1128
|
-
const MESSAGE$
|
|
1186
|
+
const MESSAGE$14 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
1129
1187
|
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$16)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1130
1188
|
/** @internal */
|
|
1131
1189
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
@@ -1135,15 +1193,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1135
1193
|
file: files.join(root, name),
|
|
1136
1194
|
line: FIRST$16,
|
|
1137
1195
|
column: FIRST$16,
|
|
1138
|
-
rule: RULE$
|
|
1139
|
-
message: `${name} ${MESSAGE$
|
|
1196
|
+
rule: RULE$51,
|
|
1197
|
+
message: `${name} ${MESSAGE$14}`
|
|
1140
1198
|
})));
|
|
1141
1199
|
});
|
|
1142
1200
|
// src/features/check-placement/model/root-readme.ts
|
|
1143
|
-
const RULE$
|
|
1201
|
+
const RULE$50 = "root-readme";
|
|
1144
1202
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1145
|
-
const READ_CONCURRENCY$
|
|
1146
|
-
const START$
|
|
1203
|
+
const READ_CONCURRENCY$24 = 16;
|
|
1204
|
+
const START$22 = 0;
|
|
1147
1205
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1148
1206
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1149
1207
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -1180,17 +1238,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1180
1238
|
onNone: () => ownNames(plugins, names),
|
|
1181
1239
|
onSome: () => [directory]
|
|
1182
1240
|
}));
|
|
1183
|
-
const problemsIn$
|
|
1241
|
+
const problemsIn$20 = (file, source, plugins) => (workspace) => {
|
|
1184
1242
|
const message = messageFor(workspace.directory);
|
|
1185
1243
|
const at = positionOf(source);
|
|
1186
1244
|
const pattern = patternFor(plugins)(workspace);
|
|
1187
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1245
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$50)(file, at(found.index ?? START$22), message)));
|
|
1188
1246
|
};
|
|
1189
1247
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1190
1248
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1191
1249
|
return pipe(text, Option.match({
|
|
1192
1250
|
onNone: () => [],
|
|
1193
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1251
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$20(file, source, plugins)))
|
|
1194
1252
|
}));
|
|
1195
1253
|
});
|
|
1196
1254
|
/** @internal */
|
|
@@ -1201,7 +1259,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1201
1259
|
const named = yield* namedWorkspaces(root);
|
|
1202
1260
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1203
1261
|
const plugins = yield* marketplacePlugins(root);
|
|
1204
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
1262
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$24 });
|
|
1205
1263
|
return Array.flatten(found);
|
|
1206
1264
|
});
|
|
1207
1265
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -1221,10 +1279,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1221
1279
|
return Array.flatten(found);
|
|
1222
1280
|
});
|
|
1223
1281
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1224
|
-
const RULE$
|
|
1282
|
+
const RULE$49 = "docs-mirror";
|
|
1225
1283
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1226
1284
|
const MIRROR_LIMIT = 3;
|
|
1227
|
-
const READ_CONCURRENCY$
|
|
1285
|
+
const READ_CONCURRENCY$23 = 16;
|
|
1228
1286
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
1229
1287
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
1230
1288
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -1240,20 +1298,20 @@ const firstMention = (source, workspace) => {
|
|
|
1240
1298
|
};
|
|
1241
1299
|
const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
|
|
1242
1300
|
const describe = (mentions) => pipe(mentions, Array.map(({ directory }) => `\`${directory}\``), Array.join(", "));
|
|
1243
|
-
const problemFor$
|
|
1301
|
+
const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
|
|
1244
1302
|
const { line, column } = positionOf(source)(offset);
|
|
1245
1303
|
return {
|
|
1246
1304
|
file,
|
|
1247
1305
|
line,
|
|
1248
1306
|
column,
|
|
1249
|
-
rule: RULE$
|
|
1307
|
+
rule: RULE$49,
|
|
1250
1308
|
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.`
|
|
1251
1309
|
};
|
|
1252
1310
|
}), Option.toArray);
|
|
1253
1311
|
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$3(doc)(workspace)));
|
|
1254
1312
|
const problemIn$4 = (workspaces) => (doc, file, source) => {
|
|
1255
1313
|
const mentions = pipe(othersIn(doc, workspaces), Array.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
|
|
1256
|
-
return problemFor$
|
|
1314
|
+
return problemFor$5(file, source, Array.sort(mentions, byOffset));
|
|
1257
1315
|
};
|
|
1258
1316
|
const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
1259
1317
|
const files = yield* RepositoryFiles;
|
|
@@ -1261,7 +1319,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
1261
1319
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
1262
1320
|
directory,
|
|
1263
1321
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
1264
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1322
|
+
}))), { concurrency: READ_CONCURRENCY$23 });
|
|
1265
1323
|
});
|
|
1266
1324
|
/** @internal */
|
|
1267
1325
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1274,14 +1332,14 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1274
1332
|
onNone: () => [],
|
|
1275
1333
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
1276
1334
|
})));
|
|
1277
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1335
|
+
}, { concurrency: READ_CONCURRENCY$23 });
|
|
1278
1336
|
return Array.flatten(found);
|
|
1279
1337
|
});
|
|
1280
1338
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1281
|
-
const RULE$
|
|
1339
|
+
const RULE$48 = "ignored-sources";
|
|
1282
1340
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1283
1341
|
const FIRST$15 = 1;
|
|
1284
|
-
const MESSAGE$
|
|
1342
|
+
const MESSAGE$13 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
1285
1343
|
/** @internal */
|
|
1286
1344
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
1287
1345
|
const files = yield* RepositoryFiles;
|
|
@@ -1290,8 +1348,8 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1290
1348
|
file: files.join(root, file),
|
|
1291
1349
|
line: FIRST$15,
|
|
1292
1350
|
column: FIRST$15,
|
|
1293
|
-
rule: RULE$
|
|
1294
|
-
message: MESSAGE$
|
|
1351
|
+
rule: RULE$48,
|
|
1352
|
+
message: MESSAGE$13
|
|
1295
1353
|
})));
|
|
1296
1354
|
});
|
|
1297
1355
|
// src/features/check-placement/model/public-entries.ts
|
|
@@ -1321,8 +1379,8 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
|
|
|
1321
1379
|
return Array.flatten(entries);
|
|
1322
1380
|
});
|
|
1323
1381
|
// src/shared/lib/tree-sitter.ts
|
|
1324
|
-
const taggedError$
|
|
1325
|
-
var GrammarUnreadable = class extends taggedError$
|
|
1382
|
+
const taggedError$6 = Schema.TaggedError;
|
|
1383
|
+
var GrammarUnreadable = class extends taggedError$6()("GrammarUnreadable", {
|
|
1326
1384
|
grammar: Schema.String,
|
|
1327
1385
|
message: Schema.String
|
|
1328
1386
|
}) {};
|
|
@@ -9968,8 +10026,8 @@ const LAYER_ITEMS = [
|
|
|
9968
10026
|
"attribute_item",
|
|
9969
10027
|
"inner_attribute_item"
|
|
9970
10028
|
];
|
|
9971
|
-
const READ_CONCURRENCY$
|
|
9972
|
-
const EXCLUDED$
|
|
10029
|
+
const READ_CONCURRENCY$22 = 64;
|
|
10030
|
+
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9973
10031
|
const NONE$2 = [];
|
|
9974
10032
|
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.";
|
|
9975
10033
|
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.";
|
|
@@ -10030,7 +10088,7 @@ const isRead = ({ inner }) => {
|
|
|
10030
10088
|
};
|
|
10031
10089
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
10032
10090
|
const files = yield* RepositoryFiles;
|
|
10033
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
10091
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$6);
|
|
10034
10092
|
const owner = crateOf(crateDirectories(listed));
|
|
10035
10093
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
10036
10094
|
...owned,
|
|
@@ -10044,17 +10102,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10044
10102
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
|
|
10045
10103
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
10046
10104
|
const parse = parsedWith(language);
|
|
10047
|
-
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$
|
|
10105
|
+
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$22 });
|
|
10048
10106
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10049
10107
|
});
|
|
10050
10108
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10051
|
-
const RULE$
|
|
10109
|
+
const RULE$47 = "shadcn-ui-alias";
|
|
10052
10110
|
const FIRST$14 = 1;
|
|
10053
10111
|
const problemOf$9 = (directory, { file, alias }) => ({
|
|
10054
10112
|
file,
|
|
10055
10113
|
line: FIRST$14,
|
|
10056
10114
|
column: FIRST$14,
|
|
10057
|
-
rule: RULE$
|
|
10115
|
+
rule: RULE$47,
|
|
10058
10116
|
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/*".`
|
|
10059
10117
|
});
|
|
10060
10118
|
/** @internal */
|
|
@@ -10074,8 +10132,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
10074
10132
|
const SOURCE_TARGET = "./src/*";
|
|
10075
10133
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10076
10134
|
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.`;
|
|
10077
|
-
const Manifest$
|
|
10078
|
-
const decodeManifest$
|
|
10135
|
+
const Manifest$7 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10136
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
|
|
10079
10137
|
const targetsOf = (target) => {
|
|
10080
10138
|
if (Predicate.isString(target)) return [target];
|
|
10081
10139
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10086,7 +10144,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10086
10144
|
const files = yield* RepositoryFiles;
|
|
10087
10145
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10088
10146
|
const text = yield* files.readFile(manifest);
|
|
10089
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10147
|
+
return pipe(text, Option.flatMap(decodeManifest$8), 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}`)));
|
|
10090
10148
|
});
|
|
10091
10149
|
/** @internal */
|
|
10092
10150
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10119,17 +10177,17 @@ const SCRIPTS_DIRECTORY = "scripts";
|
|
|
10119
10177
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
10120
10178
|
const SEPARATOR$13 = "/";
|
|
10121
10179
|
const CURRENT = "./";
|
|
10122
|
-
const READ_CONCURRENCY$
|
|
10180
|
+
const READ_CONCURRENCY$21 = 8;
|
|
10123
10181
|
const FIRST$13 = 1;
|
|
10124
10182
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
10125
10183
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
10126
10184
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
10127
|
-
const Manifest$
|
|
10185
|
+
const Manifest$6 = Schema.Struct({
|
|
10128
10186
|
bin: Schema.optional(Schema.Unknown),
|
|
10129
10187
|
main: Schema.optional(Schema.Unknown),
|
|
10130
10188
|
exports: Schema.optional(Schema.Unknown)
|
|
10131
10189
|
});
|
|
10132
|
-
const decodeManifest$
|
|
10190
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
10133
10191
|
const NO_ENTRIES = {
|
|
10134
10192
|
all: [],
|
|
10135
10193
|
bins: []
|
|
@@ -10154,7 +10212,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
10154
10212
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10155
10213
|
const files = yield* RepositoryFiles;
|
|
10156
10214
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10157
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10215
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10158
10216
|
});
|
|
10159
10217
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10160
10218
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -10166,7 +10224,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
10166
10224
|
const files = yield* RepositoryFiles;
|
|
10167
10225
|
const listed = yield* files.listedFiles(root);
|
|
10168
10226
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
10169
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
10227
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$21 });
|
|
10170
10228
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
10171
10229
|
});
|
|
10172
10230
|
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13));
|
|
@@ -10177,7 +10235,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10177
10235
|
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.`
|
|
10178
10236
|
})));
|
|
10179
10237
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10180
|
-
const problemsIn$
|
|
10238
|
+
const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10181
10239
|
const files = yield* RepositoryFiles;
|
|
10182
10240
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10183
10241
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10216,34 +10274,34 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10216
10274
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10217
10275
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10218
10276
|
const workflows = yield* workflowText(root);
|
|
10219
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10220
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10277
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$19(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
|
|
10278
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
10221
10279
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10222
10280
|
});
|
|
10223
10281
|
// src/features/check-repository-layout/model/crates.ts
|
|
10224
|
-
const RULE$
|
|
10282
|
+
const RULE$46 = "unverified-crate";
|
|
10225
10283
|
const VERSION_RULE = "release-version";
|
|
10226
10284
|
const MANIFEST_FILE$1 = "package.json";
|
|
10227
10285
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10228
10286
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
10229
|
-
const CONFIG_FILE$
|
|
10287
|
+
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10230
10288
|
const SEPARATOR$12 = "/";
|
|
10231
10289
|
const FIRST$12 = 1;
|
|
10232
|
-
const READ_CONCURRENCY$
|
|
10290
|
+
const READ_CONCURRENCY$20 = 8;
|
|
10233
10291
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10234
|
-
const problemFor$
|
|
10292
|
+
const problemFor$4 = (crate, message) => ({
|
|
10235
10293
|
file: crate.manifest,
|
|
10236
10294
|
line: FIRST$12,
|
|
10237
10295
|
column: FIRST$12,
|
|
10238
|
-
rule: RULE$
|
|
10296
|
+
rule: RULE$46,
|
|
10239
10297
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10240
10298
|
});
|
|
10241
10299
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
10242
10300
|
const files = yield* RepositoryFiles;
|
|
10243
10301
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
10244
|
-
if (Option.isNone(workspace)) return Option.some(problemFor$
|
|
10245
|
-
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$
|
|
10246
|
-
return Option.some(problemFor$
|
|
10302
|
+
if (Option.isNone(workspace)) return Option.some(problemFor$4(crate, "is outside every workspace package"));
|
|
10303
|
+
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
|
|
10304
|
+
return Option.some(problemFor$4(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
|
|
10247
10305
|
});
|
|
10248
10306
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
10249
10307
|
const files = yield* RepositoryFiles;
|
|
@@ -10267,11 +10325,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10267
10325
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10268
10326
|
const directories = yield* workspaceDirectories(root);
|
|
10269
10327
|
const crates = yield* cratesIn(root);
|
|
10270
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10328
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$20 });
|
|
10271
10329
|
return Array.getSomes(Array.flatten(found));
|
|
10272
10330
|
});
|
|
10273
10331
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10274
|
-
const RULE$
|
|
10332
|
+
const RULE$45 = "deploy-entry-pattern";
|
|
10275
10333
|
const FALLOW_KEYS = [
|
|
10276
10334
|
"entry",
|
|
10277
10335
|
"entryPoints",
|
|
@@ -10289,8 +10347,8 @@ const NEGATED = "!";
|
|
|
10289
10347
|
const ROOT_WORKSPACE = ".";
|
|
10290
10348
|
const WRAP_OFFSET$1 = 1;
|
|
10291
10349
|
const NO_OFFSET = 0;
|
|
10292
|
-
const READ_CONCURRENCY$
|
|
10293
|
-
const MESSAGE$
|
|
10350
|
+
const READ_CONCURRENCY$19 = 8;
|
|
10351
|
+
const MESSAGE$12 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10294
10352
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10295
10353
|
const FALLOW = {
|
|
10296
10354
|
keys: FALLOW_KEYS,
|
|
@@ -10326,7 +10384,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10326
10384
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10327
10385
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10328
10386
|
});
|
|
10329
|
-
const problemsIn$
|
|
10387
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10330
10388
|
const { root, file, kind, workspaces, entries } = request;
|
|
10331
10389
|
const files = yield* RepositoryFiles;
|
|
10332
10390
|
const path = files.join(root, file);
|
|
@@ -10342,8 +10400,8 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10342
10400
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10343
10401
|
file: path,
|
|
10344
10402
|
...positionOf(text.value)(start - kind.offset),
|
|
10345
|
-
rule: RULE$
|
|
10346
|
-
message: `${pattern} ${MESSAGE$
|
|
10403
|
+
rule: RULE$45,
|
|
10404
|
+
message: `${pattern} ${MESSAGE$12}`
|
|
10347
10405
|
})));
|
|
10348
10406
|
});
|
|
10349
10407
|
/** @internal */
|
|
@@ -10365,17 +10423,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10365
10423
|
}];
|
|
10366
10424
|
return [];
|
|
10367
10425
|
}));
|
|
10368
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10426
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$18({
|
|
10369
10427
|
root,
|
|
10370
10428
|
file,
|
|
10371
10429
|
kind,
|
|
10372
10430
|
workspaces,
|
|
10373
10431
|
entries
|
|
10374
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10432
|
+
}), { concurrency: READ_CONCURRENCY$19 });
|
|
10375
10433
|
return Array.flatten(found);
|
|
10376
10434
|
});
|
|
10377
10435
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10378
|
-
const RULE$
|
|
10436
|
+
const RULE$44 = "listed-entry";
|
|
10379
10437
|
const ENTRY_KEYS = [
|
|
10380
10438
|
"entry",
|
|
10381
10439
|
"entryPoints",
|
|
@@ -10385,7 +10443,7 @@ const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?
|
|
|
10385
10443
|
const WILDCARD$3 = /[*?{[]/u;
|
|
10386
10444
|
const SEPARATOR$11 = "/";
|
|
10387
10445
|
const WRAP_OFFSET = 1;
|
|
10388
|
-
const READ_CONCURRENCY$
|
|
10446
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10389
10447
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10390
10448
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10391
10449
|
const entryPatternsIn = (node) => {
|
|
@@ -10396,7 +10454,7 @@ const entryPatternsIn = (node) => {
|
|
|
10396
10454
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10397
10455
|
};
|
|
10398
10456
|
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
|
|
10399
|
-
const problemsIn$
|
|
10457
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10400
10458
|
const files = yield* RepositoryFiles;
|
|
10401
10459
|
const path = files.join(root, file);
|
|
10402
10460
|
const text = yield* files.readFile(path);
|
|
@@ -10405,7 +10463,7 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10405
10463
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10406
10464
|
file: path,
|
|
10407
10465
|
...positionOf(text.value)(start),
|
|
10408
|
-
rule: RULE$
|
|
10466
|
+
rule: RULE$44,
|
|
10409
10467
|
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.`
|
|
10410
10468
|
})));
|
|
10411
10469
|
});
|
|
@@ -10413,12 +10471,12 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10413
10471
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10414
10472
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10415
10473
|
const directories = yield* workspaceDirectories(root);
|
|
10416
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10474
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$17(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
|
|
10417
10475
|
return Array.flatten(found);
|
|
10418
10476
|
});
|
|
10419
10477
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10420
|
-
const RULE$
|
|
10421
|
-
const CONFIG_FILE$
|
|
10478
|
+
const RULE$43 = "root-workspace-path";
|
|
10479
|
+
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10422
10480
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10423
10481
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10424
10482
|
const FIRST$11 = 0;
|
|
@@ -10433,27 +10491,27 @@ const mentions = (directory) => (text) => {
|
|
|
10433
10491
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10434
10492
|
}));
|
|
10435
10493
|
};
|
|
10436
|
-
const problemsIn$
|
|
10494
|
+
const problemsIn$16 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10437
10495
|
file,
|
|
10438
10496
|
...positionOf(source)(found.start),
|
|
10439
|
-
rule: RULE$
|
|
10440
|
-
message: `${directory} is a workspace. The root ${CONFIG_FILE$
|
|
10497
|
+
rule: RULE$43,
|
|
10498
|
+
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.`
|
|
10441
10499
|
})));
|
|
10442
10500
|
/** @internal */
|
|
10443
10501
|
const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
|
|
10444
10502
|
const files = yield* RepositoryFiles;
|
|
10445
|
-
const file = files.join(root, CONFIG_FILE$
|
|
10503
|
+
const file = files.join(root, CONFIG_FILE$5);
|
|
10446
10504
|
const source = yield* files.readFile(file);
|
|
10447
10505
|
if (Option.isNone(source)) return [];
|
|
10448
10506
|
const directories = yield* workspaceDirectories(root);
|
|
10449
10507
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10450
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10508
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$16(file, source.value, directories)));
|
|
10451
10509
|
});
|
|
10452
10510
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10453
|
-
const RULE$
|
|
10454
|
-
const CONFIG_FILE$
|
|
10511
|
+
const RULE$42 = "hidden-verify";
|
|
10512
|
+
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10455
10513
|
const FIRST$10 = 1;
|
|
10456
|
-
const READ_CONCURRENCY$
|
|
10514
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10457
10515
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10458
10516
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10459
10517
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10464,19 +10522,19 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10464
10522
|
file,
|
|
10465
10523
|
line: FIRST$10,
|
|
10466
10524
|
column: FIRST$10,
|
|
10467
|
-
rule: RULE$
|
|
10468
|
-
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$
|
|
10525
|
+
rule: RULE$42,
|
|
10526
|
+
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}.`
|
|
10469
10527
|
}).pipe(Option.filter(() => verified));
|
|
10470
10528
|
});
|
|
10471
10529
|
/** @internal */
|
|
10472
10530
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10473
10531
|
const directories = yield* workspaceDirectories(root);
|
|
10474
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10532
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$17 });
|
|
10475
10533
|
return Array.getSomes(found);
|
|
10476
10534
|
});
|
|
10477
10535
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10478
|
-
const RULE$
|
|
10479
|
-
const READ_CONCURRENCY$
|
|
10536
|
+
const RULE$41 = "shared-uncached-task";
|
|
10537
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10480
10538
|
const SHARED = 2;
|
|
10481
10539
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10482
10540
|
const UncachedTask = Schema.Struct({
|
|
@@ -10518,19 +10576,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10518
10576
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10519
10577
|
file,
|
|
10520
10578
|
...position,
|
|
10521
|
-
rule: RULE$
|
|
10579
|
+
rule: RULE$41,
|
|
10522
10580
|
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.`
|
|
10523
10581
|
})));
|
|
10524
10582
|
};
|
|
10525
10583
|
/** @internal */
|
|
10526
10584
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10527
10585
|
const directories = yield* workspaceDirectories(root);
|
|
10528
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10586
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10529
10587
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10530
10588
|
});
|
|
10531
10589
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10532
|
-
const RULE$
|
|
10533
|
-
const READ_CONCURRENCY$
|
|
10590
|
+
const RULE$40 = "unlocked-task";
|
|
10591
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10534
10592
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10535
10593
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10536
10594
|
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))));
|
|
@@ -10541,13 +10599,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10541
10599
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10542
10600
|
file,
|
|
10543
10601
|
...positionOf(source)(task.start),
|
|
10544
|
-
rule: RULE$
|
|
10602
|
+
rule: RULE$40,
|
|
10545
10603
|
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.`
|
|
10546
10604
|
})), Option.toArray)));
|
|
10547
10605
|
/** @internal */
|
|
10548
10606
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10549
10607
|
const directories = yield* workspaceDirectories(root);
|
|
10550
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10608
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$15 });
|
|
10551
10609
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10552
10610
|
});
|
|
10553
10611
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10696,10 +10754,10 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10696
10754
|
/** @internal */
|
|
10697
10755
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10698
10756
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10699
|
-
const RULE$
|
|
10757
|
+
const RULE$39 = "workflow-path";
|
|
10700
10758
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10701
10759
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10702
|
-
const READ_CONCURRENCY$
|
|
10760
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10703
10761
|
const WILDCARD$2 = /[*?[]/u;
|
|
10704
10762
|
const SEPARATOR$9 = "/";
|
|
10705
10763
|
const FIRST$9 = 0;
|
|
@@ -10762,10 +10820,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10762
10820
|
const problemOf$8 = (file, source) => (found) => ({
|
|
10763
10821
|
file,
|
|
10764
10822
|
...positionOf(source)(found.offset),
|
|
10765
|
-
rule: RULE$
|
|
10823
|
+
rule: RULE$39,
|
|
10766
10824
|
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.`
|
|
10767
10825
|
});
|
|
10768
|
-
const problemsIn$
|
|
10826
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10769
10827
|
const files = yield* RepositoryFiles;
|
|
10770
10828
|
const file = files.join(root, workflow);
|
|
10771
10829
|
const source = yield* files.readFile(file);
|
|
@@ -10777,7 +10835,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10777
10835
|
/** @internal */
|
|
10778
10836
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10779
10837
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10780
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10838
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$15(root, workflow), { concurrency: READ_CONCURRENCY$14 });
|
|
10781
10839
|
return Array.flatten(found);
|
|
10782
10840
|
});
|
|
10783
10841
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10788,8 +10846,8 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10788
10846
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10789
10847
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10790
10848
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10791
|
-
const START$
|
|
10792
|
-
const READ_CONCURRENCY$
|
|
10849
|
+
const START$21 = 0;
|
|
10850
|
+
const READ_CONCURRENCY$13 = 8;
|
|
10793
10851
|
const SEPARATOR$8 = "/";
|
|
10794
10852
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10795
10853
|
const SPACE = " ";
|
|
@@ -10819,7 +10877,7 @@ const namesIn$1 = (name, source) => {
|
|
|
10819
10877
|
return [
|
|
10820
10878
|
{
|
|
10821
10879
|
text: name,
|
|
10822
|
-
offset: START$
|
|
10880
|
+
offset: START$21
|
|
10823
10881
|
},
|
|
10824
10882
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10825
10883
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10869,7 +10927,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10869
10927
|
name: stem,
|
|
10870
10928
|
source: text
|
|
10871
10929
|
})]), Option.getOrElse(() => []));
|
|
10872
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10930
|
+
}), { concurrency: READ_CONCURRENCY$13 });
|
|
10873
10931
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10874
10932
|
return [...Array.flatten(found), ...actions];
|
|
10875
10933
|
});
|
|
@@ -11003,7 +11061,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
11003
11061
|
peerDependencies: DependencyMap,
|
|
11004
11062
|
peerDependenciesMeta: PeerMeta
|
|
11005
11063
|
});
|
|
11006
|
-
const decodeManifest$
|
|
11064
|
+
const decodeManifest$6 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11007
11065
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11008
11066
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11009
11067
|
const installedNames = (manifest) => [
|
|
@@ -11014,7 +11072,7 @@ const installedNames = (manifest) => [
|
|
|
11014
11072
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11015
11073
|
const files = yield* RepositoryFiles;
|
|
11016
11074
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11017
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11075
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11018
11076
|
});
|
|
11019
11077
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11020
11078
|
const files = yield* RepositoryFiles;
|
|
@@ -11076,11 +11134,11 @@ const LISTED_LARGEST = 5;
|
|
|
11076
11134
|
const SIZE_CONCURRENCY = 32;
|
|
11077
11135
|
const MEGABYTE = 1e6;
|
|
11078
11136
|
const MEGABYTE_DIGITS = 1;
|
|
11079
|
-
const START$
|
|
11137
|
+
const START$20 = 0;
|
|
11080
11138
|
const SINGLE_ENTRY = 1;
|
|
11081
11139
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11082
11140
|
const usageHint = (dependency, entryCount) => {
|
|
11083
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11141
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$20 && dependency.entries.length < entryCount)) return "";
|
|
11084
11142
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11085
11143
|
};
|
|
11086
11144
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11089,7 +11147,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11089
11147
|
const { workspace, total } = overrun;
|
|
11090
11148
|
const config = yield* files.readFile(workspace.configFile);
|
|
11091
11149
|
const source = Option.getOrElse(config, () => "");
|
|
11092
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11150
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$20);
|
|
11093
11151
|
return {
|
|
11094
11152
|
file: workspace.configFile,
|
|
11095
11153
|
...positionOf(source)(index),
|
|
@@ -11106,7 +11164,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11106
11164
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11107
11165
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11108
11166
|
const sizes = HashMap.fromIterable(measured);
|
|
11109
|
-
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11167
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$20)), Number$1.sumAll);
|
|
11110
11168
|
return {
|
|
11111
11169
|
closures,
|
|
11112
11170
|
sizeOf,
|
|
@@ -11139,11 +11197,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11139
11197
|
})];
|
|
11140
11198
|
});
|
|
11141
11199
|
const stackProblems = (file, source, dependencies) => {
|
|
11142
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
11200
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$20);
|
|
11143
11201
|
const rest = String$1.slice(section)(source);
|
|
11144
11202
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11145
11203
|
file,
|
|
11146
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11204
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
|
|
11147
11205
|
rule: STACK_DEPENDENCY,
|
|
11148
11206
|
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.`
|
|
11149
11207
|
})));
|
|
@@ -11215,8 +11273,8 @@ const quote = (text) => pipe(Schema.encodeOption(Quoted)(text), Option.getOrElse
|
|
|
11215
11273
|
const builtins = new Set(builtinModules);
|
|
11216
11274
|
const always = () => true;
|
|
11217
11275
|
const never = () => false;
|
|
11218
|
-
const taggedError$
|
|
11219
|
-
var BundleFailed = class extends taggedError$
|
|
11276
|
+
const taggedError$5 = Schema.TaggedError;
|
|
11277
|
+
var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schema.String }) {};
|
|
11220
11278
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
11221
11279
|
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
11222
11280
|
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
@@ -11278,14 +11336,14 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
|
|
|
11278
11336
|
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11279
11337
|
});
|
|
11280
11338
|
// src/features/check-tree-shaking/model/manifest.ts
|
|
11281
|
-
const Manifest$
|
|
11339
|
+
const Manifest$5 = Schema.Struct({
|
|
11282
11340
|
name: Schema.optional(Schema.String),
|
|
11283
11341
|
exports: Schema.optional(Schema.Unknown),
|
|
11284
11342
|
bin: Schema.optional(Schema.Unknown),
|
|
11285
11343
|
sideEffects: Schema.optional(Schema.Unknown),
|
|
11286
11344
|
dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
11287
11345
|
});
|
|
11288
|
-
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$
|
|
11346
|
+
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$5));
|
|
11289
11347
|
const manifestOf$1 = (text) => decode(text);
|
|
11290
11348
|
const dependencyNames = (manifest) => pipe(Option.fromUndefinedOr(manifest.dependencies), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11291
11349
|
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
@@ -11313,19 +11371,19 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11313
11371
|
};
|
|
11314
11372
|
};
|
|
11315
11373
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11316
|
-
const RULE$
|
|
11317
|
-
const START$
|
|
11374
|
+
const RULE$38 = "optional-peer";
|
|
11375
|
+
const START$19 = 0;
|
|
11318
11376
|
const SINGLE = 1;
|
|
11319
11377
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11320
11378
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11321
11379
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11322
|
-
const problemFor$
|
|
11323
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$
|
|
11380
|
+
const problemFor$3 = (located, name, importers) => {
|
|
11381
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$19);
|
|
11324
11382
|
const rest = String$1.slice(section)(located.source);
|
|
11325
11383
|
return {
|
|
11326
11384
|
file: located.file,
|
|
11327
|
-
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11328
|
-
rule: RULE$
|
|
11385
|
+
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
|
|
11386
|
+
rule: RULE$38,
|
|
11329
11387
|
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
11330
11388
|
};
|
|
11331
11389
|
};
|
|
@@ -11336,14 +11394,14 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11336
11394
|
return pipe(dependencies, Array.flatMap((name) => {
|
|
11337
11395
|
const importers = pipe(libraries, Array.filter(importsPackage(name)));
|
|
11338
11396
|
const neededByBin = pipe(bins, Array.some(importsPackage(name)));
|
|
11339
|
-
if (!(importers.length > START$
|
|
11340
|
-
return [problemFor$
|
|
11397
|
+
if (!(importers.length > START$19 && importers.length < libraries.length) || neededByBin) return [];
|
|
11398
|
+
return [problemFor$3(located, name, importers)];
|
|
11341
11399
|
}));
|
|
11342
11400
|
};
|
|
11343
11401
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11344
|
-
const RULE$
|
|
11402
|
+
const RULE$37 = "side-effects";
|
|
11345
11403
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11346
|
-
const START$
|
|
11404
|
+
const START$18 = 0;
|
|
11347
11405
|
const FIRST$8 = 1;
|
|
11348
11406
|
const LISTED_PACKAGES = 4;
|
|
11349
11407
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
@@ -11367,7 +11425,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
11367
11425
|
label: entry.label,
|
|
11368
11426
|
member,
|
|
11369
11427
|
...extra
|
|
11370
|
-
}, ({ modules }) => modules > START$
|
|
11428
|
+
}, ({ modules }) => modules > START$18);
|
|
11371
11429
|
});
|
|
11372
11430
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
11373
11431
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -11389,17 +11447,17 @@ const othersOf = (total) => {
|
|
|
11389
11447
|
};
|
|
11390
11448
|
const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
11391
11449
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
11392
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
11450
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$18));
|
|
11393
11451
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11394
11452
|
file,
|
|
11395
11453
|
...positionOf(source)(keyIndex$1(source)),
|
|
11396
|
-
rule: RULE$
|
|
11454
|
+
rule: RULE$37,
|
|
11397
11455
|
message: messageOf$4(worst, excesses.length)
|
|
11398
11456
|
})), Option.toArray);
|
|
11399
11457
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11400
|
-
const RULE$
|
|
11458
|
+
const RULE$36 = "top-level-effect";
|
|
11401
11459
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11402
|
-
const READ_CONCURRENCY$
|
|
11460
|
+
const READ_CONCURRENCY$12 = 16;
|
|
11403
11461
|
const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
|
|
11404
11462
|
const STATEMENT_MESSAGE = "runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.";
|
|
11405
11463
|
const isEffect = (statement) => {
|
|
@@ -11410,10 +11468,10 @@ const messageOf$3 = (statement) => {
|
|
|
11410
11468
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
11411
11469
|
return STATEMENT_MESSAGE;
|
|
11412
11470
|
};
|
|
11413
|
-
const problemsIn$
|
|
11471
|
+
const problemsIn$14 = (api) => (file) => (source) => {
|
|
11414
11472
|
const retained = api.createSourceFile(file, source);
|
|
11415
11473
|
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$8({
|
|
11416
|
-
rule: RULE$
|
|
11474
|
+
rule: RULE$36,
|
|
11417
11475
|
message: messageOf$3(statement)
|
|
11418
11476
|
})(statement)));
|
|
11419
11477
|
retained.dispose();
|
|
@@ -11426,7 +11484,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11426
11484
|
const names = yield* files.ownedFiles(root);
|
|
11427
11485
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11428
11486
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11429
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
11487
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$14(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
|
|
11430
11488
|
return Array.flatten(found);
|
|
11431
11489
|
}, Effect.scoped);
|
|
11432
11490
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11537,7 +11595,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11537
11595
|
return Array.flatten(found);
|
|
11538
11596
|
});
|
|
11539
11597
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11540
|
-
const RULE$
|
|
11598
|
+
const RULE$35 = "legacy-typescript";
|
|
11541
11599
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11542
11600
|
const COMPILER = "typescript";
|
|
11543
11601
|
const CURRENT_MAJOR = 7;
|
|
@@ -11568,12 +11626,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11568
11626
|
file,
|
|
11569
11627
|
line: lineOf$2(source)(legacy.id),
|
|
11570
11628
|
column: FIRST$7,
|
|
11571
|
-
rule: RULE$
|
|
11629
|
+
rule: RULE$35,
|
|
11572
11630
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11573
11631
|
})));
|
|
11574
11632
|
});
|
|
11575
11633
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11576
|
-
const RULE$
|
|
11634
|
+
const RULE$34 = "worker-bundle";
|
|
11577
11635
|
const BUNDLE_CONCURRENCY = 4;
|
|
11578
11636
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11579
11637
|
const CONDITIONS = [
|
|
@@ -11584,8 +11642,8 @@ const CONDITIONS = [
|
|
|
11584
11642
|
"module",
|
|
11585
11643
|
"default"
|
|
11586
11644
|
];
|
|
11587
|
-
const problemFor$
|
|
11588
|
-
const problemOf$7 = (file, detail) => problemFor$
|
|
11645
|
+
const problemFor$2 = problemInFile(RULE$34);
|
|
11646
|
+
const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11589
11647
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11590
11648
|
const built = yield* Effect.tryPromise({
|
|
11591
11649
|
try: () => rolldown({
|
|
@@ -11706,7 +11764,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11706
11764
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11707
11765
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11708
11766
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11709
|
-
const RULE$
|
|
11767
|
+
const RULE$33 = "hand-written-names";
|
|
11710
11768
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11711
11769
|
const nameListOf = (site) => {
|
|
11712
11770
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11721,7 +11779,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11721
11779
|
file,
|
|
11722
11780
|
line,
|
|
11723
11781
|
column,
|
|
11724
|
-
rule: RULE$
|
|
11782
|
+
rule: RULE$33,
|
|
11725
11783
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11726
11784
|
});
|
|
11727
11785
|
const problemOf$6 = ({ list, reason }) => listedProblem({
|
|
@@ -12404,13 +12462,13 @@ const MANIFEST$3 = "package.json";
|
|
|
12404
12462
|
const SEPARATOR$5 = "/";
|
|
12405
12463
|
const FIRST_SEGMENT = 1;
|
|
12406
12464
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12407
|
-
const decodeManifest$
|
|
12465
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(ManifestJson);
|
|
12408
12466
|
const prefixesOf = (file) => {
|
|
12409
12467
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12410
12468
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12411
12469
|
};
|
|
12412
12470
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12413
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12471
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$5), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12414
12472
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12415
12473
|
const files = yield* RepositoryFiles;
|
|
12416
12474
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12522,7 +12580,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12522
12580
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12523
12581
|
}, Effect.scoped);
|
|
12524
12582
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12525
|
-
const RULE$
|
|
12583
|
+
const RULE$32 = "namespace-destructuring";
|
|
12526
12584
|
const LOCAL = /^[.#/]/u;
|
|
12527
12585
|
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.`;
|
|
12528
12586
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12538,7 +12596,7 @@ const destructuredName = (declaration) => {
|
|
|
12538
12596
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12539
12597
|
};
|
|
12540
12598
|
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
|
|
12541
|
-
rule: RULE$
|
|
12599
|
+
rule: RULE$32,
|
|
12542
12600
|
message: messageOf$1(name)
|
|
12543
12601
|
})), Option.map((report) => report(declaration)));
|
|
12544
12602
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12546,7 +12604,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12546
12604
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
12547
12605
|
};
|
|
12548
12606
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12549
|
-
const RULE$
|
|
12607
|
+
const RULE$31 = "pass-through-wrapper";
|
|
12550
12608
|
const SINGLE_STATEMENT = 1;
|
|
12551
12609
|
const SINGLE_DECLARATION = 1;
|
|
12552
12610
|
const THIS_PARAMETER = "this";
|
|
@@ -12643,7 +12701,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12643
12701
|
const problemOf$4 = (checker) => (candidate) => {
|
|
12644
12702
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12645
12703
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
|
|
12646
|
-
rule: RULE$
|
|
12704
|
+
rule: RULE$31,
|
|
12647
12705
|
message: messageOf(forward.callee.getText())
|
|
12648
12706
|
})(candidate.name)));
|
|
12649
12707
|
};
|
|
@@ -12669,7 +12727,7 @@ var plugins = [{
|
|
|
12669
12727
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12670
12728
|
}];
|
|
12671
12729
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12672
|
-
const RULE$
|
|
12730
|
+
const RULE$30 = "known-plugins";
|
|
12673
12731
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12674
12732
|
const GITHUB$2 = "github";
|
|
12675
12733
|
const Source$1 = Schema.Struct({
|
|
@@ -12687,7 +12745,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12687
12745
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12688
12746
|
const MARKETPLACE = name;
|
|
12689
12747
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12690
|
-
const problem$1 = problemInFile(RULE$
|
|
12748
|
+
const problem$1 = problemInFile(RULE$30);
|
|
12691
12749
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12692
12750
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12693
12751
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12708,20 +12766,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12708
12766
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12709
12767
|
});
|
|
12710
12768
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12711
|
-
const RULE$
|
|
12769
|
+
const RULE$29 = "missing-hook";
|
|
12712
12770
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12713
12771
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12714
12772
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12715
12773
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12716
12774
|
const PLUGIN_ROOT = "..";
|
|
12717
|
-
const READ_CONCURRENCY$
|
|
12718
|
-
const START$
|
|
12775
|
+
const READ_CONCURRENCY$11 = 16;
|
|
12776
|
+
const START$17 = 0;
|
|
12719
12777
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12720
12778
|
path,
|
|
12721
|
-
index: found.index ?? START$
|
|
12779
|
+
index: found.index ?? START$17
|
|
12722
12780
|
})), Option.toArray);
|
|
12723
12781
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12724
|
-
const problemsIn$
|
|
12782
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12725
12783
|
const files = yield* RepositoryFiles;
|
|
12726
12784
|
const text = yield* files.readFile(file);
|
|
12727
12785
|
if (Option.isNone(text)) return [];
|
|
@@ -12733,7 +12791,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12733
12791
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12734
12792
|
file,
|
|
12735
12793
|
...positionOf(source)(index),
|
|
12736
|
-
rule: RULE$
|
|
12794
|
+
rule: RULE$29,
|
|
12737
12795
|
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.`
|
|
12738
12796
|
})));
|
|
12739
12797
|
});
|
|
@@ -12757,7 +12815,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12757
12815
|
}];
|
|
12758
12816
|
return [];
|
|
12759
12817
|
}));
|
|
12760
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12818
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$13, { concurrency: READ_CONCURRENCY$11 });
|
|
12761
12819
|
return Array.flatten(found);
|
|
12762
12820
|
});
|
|
12763
12821
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12786,7 +12844,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12786
12844
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12787
12845
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12788
12846
|
// src/features/check-documented-commands/model/commands.ts
|
|
12789
|
-
const RULE$
|
|
12847
|
+
const RULE$28 = "documented-commands";
|
|
12790
12848
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12791
12849
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12792
12850
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12805,7 +12863,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12805
12863
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12806
12864
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12807
12865
|
const ONE$1 = 1;
|
|
12808
|
-
const START$
|
|
12866
|
+
const START$16 = 0;
|
|
12809
12867
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12810
12868
|
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)))));
|
|
12811
12869
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12861,11 +12919,11 @@ const whereOf = (scope, file) => {
|
|
|
12861
12919
|
return `the package that holds ${file}`;
|
|
12862
12920
|
};
|
|
12863
12921
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12864
|
-
const problemsIn$
|
|
12922
|
+
const problemsIn$12 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12865
12923
|
file: absolute(file),
|
|
12866
|
-
...positionOf(text)(match.index ?? START$
|
|
12867
|
-
rule: RULE$
|
|
12868
|
-
message: `${match[START$
|
|
12924
|
+
...positionOf(text)(match.index ?? START$16),
|
|
12925
|
+
rule: RULE$28,
|
|
12926
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12869
12927
|
})), Option.toArray)));
|
|
12870
12928
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12871
12929
|
/** @internal */
|
|
@@ -12889,14 +12947,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12889
12947
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12890
12948
|
line: ONE$1,
|
|
12891
12949
|
column: ONE$1,
|
|
12892
|
-
rule: RULE$
|
|
12950
|
+
rule: RULE$28,
|
|
12893
12951
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12894
12952
|
}],
|
|
12895
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
12953
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$12(found, absolute, document)))
|
|
12896
12954
|
});
|
|
12897
12955
|
});
|
|
12898
12956
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12899
|
-
const RULE$
|
|
12957
|
+
const RULE$27 = "legacy-web";
|
|
12900
12958
|
const FIRST_COLUMN$3 = 1;
|
|
12901
12959
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12902
12960
|
const Finding = Schema.Struct({
|
|
@@ -12935,15 +12993,15 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12935
12993
|
file: files.join(root, file),
|
|
12936
12994
|
line,
|
|
12937
12995
|
column: FIRST_COLUMN$3,
|
|
12938
|
-
rule: RULE$
|
|
12996
|
+
rule: RULE$27,
|
|
12939
12997
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12940
12998
|
});
|
|
12941
12999
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
12942
13000
|
});
|
|
12943
13001
|
// src/shared/lib/section-check.ts
|
|
12944
|
-
const taggedError$
|
|
12945
|
-
var SectionConfigUnreadable = class extends taggedError$
|
|
12946
|
-
const CONFIG_FILE$
|
|
13002
|
+
const taggedError$4 = Schema.TaggedError;
|
|
13003
|
+
var SectionConfigUnreadable = class extends taggedError$4()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
13004
|
+
const CONFIG_FILE$3 = "vite.config.ts";
|
|
12947
13005
|
const FIRST$6 = 1;
|
|
12948
13006
|
const ONE = 1;
|
|
12949
13007
|
const diagnostics = Metric.counter("lint.diagnostics", { description: "Diagnostics that each lint rule reported, before msch keeps only the errors" });
|
|
@@ -12965,7 +13023,7 @@ const sectionAt = (file, pick) => Effect.gen(function* readSection() {
|
|
|
12965
13023
|
});
|
|
12966
13024
|
const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
12967
13025
|
const files = yield* RepositoryFiles;
|
|
12968
|
-
const configFile = files.join(root, CONFIG_FILE$
|
|
13026
|
+
const configFile = files.join(root, CONFIG_FILE$3);
|
|
12969
13027
|
const section = yield* sectionAt(configFile, check.pick);
|
|
12970
13028
|
if (Option.isNone(section)) return [];
|
|
12971
13029
|
const config = section.value;
|
|
@@ -13005,9 +13063,9 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
13005
13063
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
13006
13064
|
const EXTENSION = /\.[^./]+$/u;
|
|
13007
13065
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13008
|
-
const READ_CONCURRENCY$
|
|
13009
|
-
const RULE$
|
|
13010
|
-
const MESSAGE$
|
|
13066
|
+
const READ_CONCURRENCY$10 = 64;
|
|
13067
|
+
const RULE$26 = "shell-script";
|
|
13068
|
+
const MESSAGE$11 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
13011
13069
|
const HookSchema = Schema.Struct({
|
|
13012
13070
|
command: Schema.optional(Schema.String),
|
|
13013
13071
|
args: Schema.String.pipe(Schema.Array, Schema.optional)
|
|
@@ -13038,12 +13096,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13038
13096
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
13039
13097
|
};
|
|
13040
13098
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13041
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
13042
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13099
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
13100
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$26)(files.join(root, name), MESSAGE$11)));
|
|
13043
13101
|
});
|
|
13044
13102
|
// src/shared/lib/workflow-files.ts
|
|
13045
13103
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
13046
|
-
const READ_CONCURRENCY$
|
|
13104
|
+
const READ_CONCURRENCY$9 = 16;
|
|
13047
13105
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
13048
13106
|
const files = yield* RepositoryFiles;
|
|
13049
13107
|
const names = yield* files.listedFiles(root);
|
|
@@ -13053,13 +13111,13 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13053
13111
|
file,
|
|
13054
13112
|
source
|
|
13055
13113
|
}))));
|
|
13056
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13114
|
+
}, { concurrency: READ_CONCURRENCY$9 });
|
|
13057
13115
|
return Array.getSomes(found);
|
|
13058
13116
|
});
|
|
13059
13117
|
// src/shared/lib/workflow-run.ts
|
|
13060
13118
|
const RUN_KEY = "run";
|
|
13061
|
-
const START$
|
|
13062
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
13119
|
+
const START$15 = 0;
|
|
13120
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
13063
13121
|
const runScriptsOf = (source) => {
|
|
13064
13122
|
const found = [];
|
|
13065
13123
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -13074,23 +13132,23 @@ const runScriptsOf = (source) => {
|
|
|
13074
13132
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13075
13133
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13076
13134
|
const COMMENT = "#";
|
|
13077
|
-
const RULE$
|
|
13135
|
+
const RULE$25 = "workflow-script";
|
|
13078
13136
|
const ONE_COMMAND = 1;
|
|
13079
|
-
const MESSAGE$
|
|
13137
|
+
const MESSAGE$10 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
13080
13138
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
13081
13139
|
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
13082
13140
|
const runsMoreThanOneCommand = ({ text }) => {
|
|
13083
13141
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
13084
13142
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
13085
13143
|
};
|
|
13086
|
-
const problemsIn$
|
|
13144
|
+
const problemsIn$11 = (file) => (source) => {
|
|
13087
13145
|
const at = positionOf(source);
|
|
13088
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13146
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$25)(file, at(start), MESSAGE$10)));
|
|
13089
13147
|
};
|
|
13090
13148
|
/** @internal */
|
|
13091
13149
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
13092
13150
|
const workflows = yield* readWorkflows(root);
|
|
13093
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
13151
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$11(file)(source)));
|
|
13094
13152
|
});
|
|
13095
13153
|
// src/features/check-scripts/model/script-checks.ts
|
|
13096
13154
|
/** @internal */
|
|
@@ -13200,27 +13258,27 @@ const docSources = (file) => (source) => {
|
|
|
13200
13258
|
})));
|
|
13201
13259
|
};
|
|
13202
13260
|
// src/features/check-vite-plus/model/command-sources.ts
|
|
13203
|
-
const ROOT_DIRECTORY$
|
|
13261
|
+
const ROOT_DIRECTORY$2 = ".";
|
|
13204
13262
|
const COMMAND_KEY = "command";
|
|
13205
13263
|
const ARGUMENTS_KEY = "args";
|
|
13206
|
-
const EXCLUDED$
|
|
13207
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
13264
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13265
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$5];
|
|
13208
13266
|
const STEP_FILES = [
|
|
13209
13267
|
":(glob).github/workflows/*.yml",
|
|
13210
13268
|
":(glob).github/workflows/*.yaml",
|
|
13211
13269
|
":(glob)**/action.yml",
|
|
13212
13270
|
":(glob)**/action.yaml",
|
|
13213
|
-
...EXCLUDED$
|
|
13271
|
+
...EXCLUDED$5
|
|
13214
13272
|
];
|
|
13215
13273
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
13216
13274
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
13217
13275
|
const AGENT_DOCS = [
|
|
13218
13276
|
":(glob)**/AGENTS.md",
|
|
13219
13277
|
":(glob)**/CLAUDE.md",
|
|
13220
|
-
...EXCLUDED$
|
|
13278
|
+
...EXCLUDED$5
|
|
13221
13279
|
];
|
|
13222
|
-
const READ_CONCURRENCY$
|
|
13223
|
-
const START$
|
|
13280
|
+
const READ_CONCURRENCY$8 = 16;
|
|
13281
|
+
const START$14 = 0;
|
|
13224
13282
|
const FIRST$5 = 1;
|
|
13225
13283
|
const LINE = "\n";
|
|
13226
13284
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -13230,7 +13288,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
13230
13288
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
13231
13289
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13232
13290
|
const NO_SOURCES = [];
|
|
13233
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
13291
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
13234
13292
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
13235
13293
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
13236
13294
|
return {
|
|
@@ -13290,7 +13348,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
13290
13348
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
13291
13349
|
});
|
|
13292
13350
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
13293
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13351
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$8 });
|
|
13294
13352
|
return Array.flatten(found);
|
|
13295
13353
|
});
|
|
13296
13354
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -13302,7 +13360,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
13302
13360
|
onSome: sourcesOf(file, name)
|
|
13303
13361
|
});
|
|
13304
13362
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
13305
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13363
|
+
}, { concurrency: READ_CONCURRENCY$8 });
|
|
13306
13364
|
return Array.flatten(found);
|
|
13307
13365
|
});
|
|
13308
13366
|
/** @internal */
|
|
@@ -13321,12 +13379,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13321
13379
|
readSources(root, hooks, hookSources),
|
|
13322
13380
|
readSources(root, AGENT_FILES, agentSources),
|
|
13323
13381
|
readSources(root, docs, docSources),
|
|
13324
|
-
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$
|
|
13382
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$2, ...workspaces]))
|
|
13325
13383
|
], { concurrency: "unbounded" });
|
|
13326
13384
|
return Array.flatten(found);
|
|
13327
13385
|
});
|
|
13328
13386
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13329
|
-
const RULE$
|
|
13387
|
+
const RULE$24 = "package-script";
|
|
13330
13388
|
const LIFECYCLE = [
|
|
13331
13389
|
"preinstall",
|
|
13332
13390
|
"install",
|
|
@@ -13349,26 +13407,26 @@ const LIFECYCLE = [
|
|
|
13349
13407
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
13350
13408
|
file,
|
|
13351
13409
|
...position,
|
|
13352
|
-
rule: RULE$
|
|
13410
|
+
rule: RULE$24,
|
|
13353
13411
|
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.`
|
|
13354
13412
|
});
|
|
13355
13413
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
13356
13414
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13357
|
-
const RULE$
|
|
13415
|
+
const RULE$23 = "vite-plus-block";
|
|
13358
13416
|
const MARKER = Array.join([
|
|
13359
13417
|
"<!--",
|
|
13360
13418
|
"VITE PLUS START",
|
|
13361
13419
|
"-->"
|
|
13362
13420
|
], "");
|
|
13363
|
-
const MESSAGE$
|
|
13421
|
+
const MESSAGE$9 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
|
|
13364
13422
|
const problemIn = (file) => (source) => {
|
|
13365
13423
|
const index = String$1.indexOf(MARKER)(source);
|
|
13366
13424
|
if (Option.isNone(index)) return Option.none();
|
|
13367
13425
|
return Option.some({
|
|
13368
13426
|
file,
|
|
13369
13427
|
...positionOf(source)(index.value),
|
|
13370
|
-
rule: RULE$
|
|
13371
|
-
message: MESSAGE$
|
|
13428
|
+
rule: RULE$23,
|
|
13429
|
+
message: MESSAGE$9
|
|
13372
13430
|
});
|
|
13373
13431
|
};
|
|
13374
13432
|
/** @internal */
|
|
@@ -13423,11 +13481,11 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13423
13481
|
})
|
|
13424
13482
|
});
|
|
13425
13483
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13426
|
-
const RULE$
|
|
13484
|
+
const RULE$21 = "publish-trigger";
|
|
13427
13485
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13428
13486
|
const MANUAL = "workflow_dispatch";
|
|
13429
13487
|
const TRIGGER_KEY = "on";
|
|
13430
|
-
const MESSAGE$
|
|
13488
|
+
const MESSAGE$7 = "publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Publishing is manual: bump the version in a PR, then dispatch the workflow for the workspace.";
|
|
13431
13489
|
const triggersOf = (node) => {
|
|
13432
13490
|
if (isScalar(node)) return [String(node.value)];
|
|
13433
13491
|
if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
|
|
@@ -13443,19 +13501,19 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13443
13501
|
};
|
|
13444
13502
|
/** @internal */
|
|
13445
13503
|
const checkPublishTrigger = workflowCheck({
|
|
13446
|
-
rule: RULE$
|
|
13447
|
-
message: MESSAGE$
|
|
13504
|
+
rule: RULE$21,
|
|
13505
|
+
message: MESSAGE$7,
|
|
13448
13506
|
offsetsOf: publishTriggerOffsetsOf
|
|
13449
13507
|
});
|
|
13450
13508
|
// src/features/check-workflows/model/release-please.ts
|
|
13451
|
-
const RULE$
|
|
13509
|
+
const RULE$20 = "release-please";
|
|
13452
13510
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13453
13511
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13454
13512
|
const FIRST$4 = 1;
|
|
13455
|
-
const MESSAGE$
|
|
13513
|
+
const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
13456
13514
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13457
|
-
rule: RULE$
|
|
13458
|
-
message: MESSAGE$
|
|
13515
|
+
rule: RULE$20,
|
|
13516
|
+
message: MESSAGE$6,
|
|
13459
13517
|
offsetsOf: scalarKeyOffsets({
|
|
13460
13518
|
name: "uses",
|
|
13461
13519
|
matches: (value) => RELEASE_PLEASE.test(value)
|
|
@@ -13468,8 +13526,8 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13468
13526
|
file: files.join(root, name),
|
|
13469
13527
|
line: FIRST$4,
|
|
13470
13528
|
column: FIRST$4,
|
|
13471
|
-
rule: RULE$
|
|
13472
|
-
message: MESSAGE$
|
|
13529
|
+
rule: RULE$20,
|
|
13530
|
+
message: MESSAGE$6
|
|
13473
13531
|
})));
|
|
13474
13532
|
});
|
|
13475
13533
|
/** @internal */
|
|
@@ -13480,26 +13538,26 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13480
13538
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13481
13539
|
const CONCURRENCY_KEY = "concurrency";
|
|
13482
13540
|
const QUEUE_KEY = "queue";
|
|
13483
|
-
const RULE$
|
|
13484
|
-
const MESSAGE$
|
|
13541
|
+
const RULE$19 = "workflow-queue";
|
|
13542
|
+
const MESSAGE$5 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
13485
13543
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13486
13544
|
/** @internal */
|
|
13487
13545
|
const checkWorkflowQueues = workflowCheck({
|
|
13488
|
-
rule: RULE$
|
|
13489
|
-
message: MESSAGE$
|
|
13546
|
+
rule: RULE$19,
|
|
13547
|
+
message: MESSAGE$5,
|
|
13490
13548
|
offsetsOf: queueOffsetsOf
|
|
13491
13549
|
});
|
|
13492
13550
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13493
|
-
const RULE$
|
|
13551
|
+
const RULE$18 = "workflow-commit";
|
|
13494
13552
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13495
13553
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13496
|
-
const MESSAGE$
|
|
13554
|
+
const MESSAGE$4 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
13497
13555
|
const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source), Array.filter(({ value }) => isScalar(value) && typeof value.value === "string" && pattern.test(value.value)), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap(({ range }) => Option.fromNullishOr(range)), Option.map(([start]) => start), Option.toArray)));
|
|
13498
13556
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13499
13557
|
/** @internal */
|
|
13500
13558
|
const checkWorkflowCommits = workflowCheck({
|
|
13501
|
-
rule: RULE$
|
|
13502
|
-
message: MESSAGE$
|
|
13559
|
+
rule: RULE$18,
|
|
13560
|
+
message: MESSAGE$4,
|
|
13503
13561
|
offsetsOf: commitOffsetsOf
|
|
13504
13562
|
});
|
|
13505
13563
|
// src/features/check-workflows/model/workflow-lint.ts
|
|
@@ -13535,8 +13593,8 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
13535
13593
|
return Array.flatten(found);
|
|
13536
13594
|
});
|
|
13537
13595
|
// src/features/ban-comments/model/found-comment.ts
|
|
13538
|
-
const taggedError$
|
|
13539
|
-
var CommentsUnreadable = class extends taggedError$
|
|
13596
|
+
const taggedError$3 = Schema.TaggedError;
|
|
13597
|
+
var CommentsUnreadable = class extends taggedError$3()("CommentsUnreadable", {
|
|
13540
13598
|
reader: Schema.String,
|
|
13541
13599
|
message: Schema.String
|
|
13542
13600
|
}) {};
|
|
@@ -13599,7 +13657,7 @@ const COMMENT_NODES = [
|
|
|
13599
13657
|
"block_comment",
|
|
13600
13658
|
"multiline_comment"
|
|
13601
13659
|
];
|
|
13602
|
-
const START$
|
|
13660
|
+
const START$13 = 0;
|
|
13603
13661
|
const NEXT = 1;
|
|
13604
13662
|
const NONE$1 = [];
|
|
13605
13663
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13649,7 +13707,7 @@ const markupComment = (source) => (node) => {
|
|
|
13649
13707
|
}];
|
|
13650
13708
|
};
|
|
13651
13709
|
const textComments = (grammars, grammar) => (text) => {
|
|
13652
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13710
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
13653
13711
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13654
13712
|
};
|
|
13655
13713
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13685,11 +13743,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
13685
13743
|
}[reader](source);
|
|
13686
13744
|
};
|
|
13687
13745
|
// src/features/ban-comments/model/comments.ts
|
|
13688
|
-
const RULE$
|
|
13689
|
-
const CONFIG_FILE$
|
|
13746
|
+
const RULE$17 = "comment";
|
|
13747
|
+
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13690
13748
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13691
|
-
const READ_CONCURRENCY$
|
|
13692
|
-
const START$
|
|
13749
|
+
const READ_CONCURRENCY$7 = 64;
|
|
13750
|
+
const START$12 = 0;
|
|
13693
13751
|
const READERS$1 = [
|
|
13694
13752
|
[/\.(?:[cm]?jsx?)$/u, "javascript"],
|
|
13695
13753
|
[/\.(?:[cm]?ts)$/u, "typescript"],
|
|
@@ -13721,7 +13779,7 @@ const SHEBANG = "#!";
|
|
|
13721
13779
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
13722
13780
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
13723
13781
|
const DELIMITERS = /^(?:\/\/|\/\*|<!--|<#|#|--)|(?:\*\/|-->|#>)$/gu;
|
|
13724
|
-
const MESSAGE$
|
|
13782
|
+
const MESSAGE$3 = "Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.";
|
|
13725
13783
|
const Patterns = Schema.Array(Schema.String);
|
|
13726
13784
|
const CommentSettings = Schema.Struct({ allow: Patterns });
|
|
13727
13785
|
const MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });
|
|
@@ -13735,8 +13793,8 @@ const NO_SETTINGS = {
|
|
|
13735
13793
|
ignorePatterns: []
|
|
13736
13794
|
};
|
|
13737
13795
|
const NONE = [];
|
|
13738
|
-
const taggedError$
|
|
13739
|
-
var CommentConfigUnreadable = class extends taggedError$
|
|
13796
|
+
const taggedError$2 = Schema.TaggedError;
|
|
13797
|
+
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
13740
13798
|
const shebangReader = (source) => {
|
|
13741
13799
|
if (!String$1.startsWith(SHEBANG)(source)) return Option.none();
|
|
13742
13800
|
return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
|
|
@@ -13744,17 +13802,17 @@ const shebangReader = (source) => {
|
|
|
13744
13802
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13745
13803
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13746
13804
|
const lineBefore = (source, index) => {
|
|
13747
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13805
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
13748
13806
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13749
13807
|
};
|
|
13750
13808
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13751
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13809
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
13752
13810
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13753
13811
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
13754
13812
|
file,
|
|
13755
13813
|
...positionOf(source)(index),
|
|
13756
|
-
rule: RULE$
|
|
13757
|
-
message: MESSAGE$
|
|
13814
|
+
rule: RULE$17,
|
|
13815
|
+
message: MESSAGE$3
|
|
13758
13816
|
});
|
|
13759
13817
|
const settingsOf = ({ msch, lint }) => ({
|
|
13760
13818
|
allow: pipe(Option.fromUndefinedOr(msch), Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)), Option.match({
|
|
@@ -13765,7 +13823,7 @@ const settingsOf = ({ msch, lint }) => ({
|
|
|
13765
13823
|
});
|
|
13766
13824
|
const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
|
|
13767
13825
|
const files = yield* RepositoryFiles;
|
|
13768
|
-
const file = files.join(root, CONFIG_FILE$
|
|
13826
|
+
const file = files.join(root, CONFIG_FILE$2);
|
|
13769
13827
|
if (!(yield* files.exists(file))) return NO_SETTINGS;
|
|
13770
13828
|
const config = yield* Effect.tryPromise({
|
|
13771
13829
|
try: () => resolveConfigFromFile(file),
|
|
@@ -13802,13 +13860,13 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13802
13860
|
const toProblem = problemOf$2(file, source);
|
|
13803
13861
|
return Option.match(readerOf(name, source), {
|
|
13804
13862
|
onNone: () => Effect.succeed(NONE),
|
|
13805
|
-
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$
|
|
13863
|
+
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$17)(file, `msch could not read the comments in this file: ${message}`)])))
|
|
13806
13864
|
});
|
|
13807
13865
|
};
|
|
13808
13866
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
13809
13867
|
onNone: () => Effect.succeed(NONE),
|
|
13810
13868
|
onSome: (source) => problemsIn(entry, source)
|
|
13811
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
13869
|
+
}))), { concurrency: READ_CONCURRENCY$7 });
|
|
13812
13870
|
return Array.flatten(found);
|
|
13813
13871
|
});
|
|
13814
13872
|
// src/features/ban-tools/model/banned-tool.ts
|
|
@@ -13899,6 +13957,38 @@ const PYTHON = {
|
|
|
13899
13957
|
};
|
|
13900
13958
|
/** @internal */
|
|
13901
13959
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13960
|
+
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13961
|
+
const RULE$16 = "uncataloged-dependency";
|
|
13962
|
+
const OWNED_ELSEWHERE = [
|
|
13963
|
+
"catalog:",
|
|
13964
|
+
"workspace:",
|
|
13965
|
+
"link:",
|
|
13966
|
+
"file:"
|
|
13967
|
+
];
|
|
13968
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
13969
|
+
const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
|
|
13970
|
+
const MESSAGE$2 = "is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.";
|
|
13971
|
+
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13972
|
+
const problemsIn$10 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13973
|
+
file: entry.file,
|
|
13974
|
+
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13975
|
+
rule: RULE$16,
|
|
13976
|
+
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
13977
|
+
})));
|
|
13978
|
+
/** @internal */
|
|
13979
|
+
const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* uncatalogedDependencies(root) {
|
|
13980
|
+
const files = yield* RepositoryFiles;
|
|
13981
|
+
const directories = yield* workspaceDirectories(root);
|
|
13982
|
+
const installed = yield* pipe(directories, Effect.filter((directory) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => !found))));
|
|
13983
|
+
const listed = pipe([ROOT_DIRECTORY$1, ...installed], Array.map((directory) => {
|
|
13984
|
+
const name = files.join(directory, MANIFEST_FILE$3);
|
|
13985
|
+
return {
|
|
13986
|
+
name,
|
|
13987
|
+
file: files.join(root, name)
|
|
13988
|
+
};
|
|
13989
|
+
}));
|
|
13990
|
+
return yield* scanText(listed, problemsIn$10);
|
|
13991
|
+
});
|
|
13902
13992
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13903
13993
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
13904
13994
|
const MANIFEST$2 = /(?:^|\/)package\.json$/u;
|
|
@@ -13909,7 +13999,7 @@ const WILDCARD = "*";
|
|
|
13909
13999
|
const FIRST_LINE$2 = 1;
|
|
13910
14000
|
const FIRST_COLUMN$1 = 1;
|
|
13911
14001
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
13912
|
-
const READ_CONCURRENCY$
|
|
14002
|
+
const READ_CONCURRENCY$6 = 16;
|
|
13913
14003
|
const STALE_RULE = "stale-release-age-exclude";
|
|
13914
14004
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
13915
14005
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
@@ -13940,8 +14030,8 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
13940
14030
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
13941
14031
|
const files = yield* RepositoryFiles;
|
|
13942
14032
|
const listed = yield* files.listedFiles(root);
|
|
13943
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
13944
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
14033
|
+
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
|
|
14034
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$10(text))), Array.flatMap(referencesIn));
|
|
13945
14035
|
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13946
14036
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13947
14037
|
});
|
|
@@ -13991,11 +14081,11 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
|
|
|
13991
14081
|
// src/features/check-skills/model/skill-entry.ts
|
|
13992
14082
|
const ENTRY_RULE = "unlocked-skill";
|
|
13993
14083
|
const VISIBLE_RULE = "skill-source-visible";
|
|
13994
|
-
const CONFIG_FILE = "vite.config.ts";
|
|
14084
|
+
const CONFIG_FILE$1 = "vite.config.ts";
|
|
13995
14085
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13996
14086
|
const SOURCE = "masseater/skills";
|
|
13997
14087
|
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
13998
|
-
const START$
|
|
14088
|
+
const START$11 = 0;
|
|
13999
14089
|
const LOCAL_PREFIX = "./";
|
|
14000
14090
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
14001
14091
|
const Source = Schema.Struct({
|
|
@@ -14004,17 +14094,17 @@ const Source = Schema.Struct({
|
|
|
14004
14094
|
});
|
|
14005
14095
|
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
14006
14096
|
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
14007
|
-
const taggedError = Schema.TaggedError;
|
|
14008
|
-
var SkillsConfigUnreadable = class extends taggedError()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14097
|
+
const taggedError$1 = Schema.TaggedError;
|
|
14098
|
+
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14009
14099
|
const problemAt$4 = (rule, file, text) => (anchor, message) => ({
|
|
14010
14100
|
file,
|
|
14011
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
14101
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
14012
14102
|
rule,
|
|
14013
14103
|
message
|
|
14014
14104
|
});
|
|
14015
14105
|
const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
|
|
14016
14106
|
const files = yield* RepositoryFiles;
|
|
14017
|
-
const file = files.join(root, CONFIG_FILE);
|
|
14107
|
+
const file = files.join(root, CONFIG_FILE$1);
|
|
14018
14108
|
const text = yield* files.readFile(file);
|
|
14019
14109
|
if (Option.isNone(text)) return Option.none();
|
|
14020
14110
|
const config = yield* Effect.tryPromise({
|
|
@@ -14041,7 +14131,7 @@ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root
|
|
|
14041
14131
|
const file = files.join(root, RENOVATE_FILE$1);
|
|
14042
14132
|
const text = yield* files.readFile(file);
|
|
14043
14133
|
if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
|
|
14044
|
-
return [problemAt$4(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}.`)];
|
|
14134
|
+
return [problemAt$4(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}.`)];
|
|
14045
14135
|
});
|
|
14046
14136
|
/** @internal */
|
|
14047
14137
|
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
@@ -14055,14 +14145,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
14055
14145
|
];
|
|
14056
14146
|
});
|
|
14057
14147
|
// src/features/check-skills/model/published-skills.ts
|
|
14058
|
-
const RULE$
|
|
14148
|
+
const RULE$15 = "published-skills";
|
|
14059
14149
|
const KEYWORD = "tanstack-intent";
|
|
14060
14150
|
const SKILLS = "skills";
|
|
14061
14151
|
const MANIFEST_FILE = "package.json";
|
|
14062
14152
|
const SKILL_FILE$1 = "SKILL.md";
|
|
14063
14153
|
const SUCCEEDED = 0;
|
|
14064
14154
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14065
|
-
const problemAt$3 = problemInFile(RULE$
|
|
14155
|
+
const problemAt$3 = problemInFile(RULE$15);
|
|
14066
14156
|
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))));
|
|
14067
14157
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14068
14158
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -14083,7 +14173,7 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
14083
14173
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
14084
14174
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
14085
14175
|
}, Effect.scoped);
|
|
14086
|
-
const problemsIn$
|
|
14176
|
+
const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
14087
14177
|
const files = yield* RepositoryFiles;
|
|
14088
14178
|
const directory = files.join(root, project.directory);
|
|
14089
14179
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
@@ -14095,11 +14185,11 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
14095
14185
|
/** @internal */
|
|
14096
14186
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
14097
14187
|
const projects = yield* publishedProjects(root);
|
|
14098
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
14188
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$9(root, project), { concurrency: 1 });
|
|
14099
14189
|
return Array.flatten(problems);
|
|
14100
14190
|
});
|
|
14101
14191
|
// src/features/check-skills/model/skill-files.ts
|
|
14102
|
-
const RULE$
|
|
14192
|
+
const RULE$14 = "skill-file";
|
|
14103
14193
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14104
14194
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14105
14195
|
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
@@ -14117,9 +14207,9 @@ const GITHUB = "https://github.com/";
|
|
|
14117
14207
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
14118
14208
|
const BLANK = /\s+/u;
|
|
14119
14209
|
const SEPARATOR$2 = "/";
|
|
14120
|
-
const START$
|
|
14210
|
+
const START$10 = 0;
|
|
14121
14211
|
const FIRST$3 = 1;
|
|
14122
|
-
const READ_CONCURRENCY$
|
|
14212
|
+
const READ_CONCURRENCY$5 = 16;
|
|
14123
14213
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
14124
14214
|
const Frontmatter = Schema.Struct({
|
|
14125
14215
|
name: Schema.optional(Schema.String),
|
|
@@ -14127,9 +14217,9 @@ const Frontmatter = Schema.Struct({
|
|
|
14127
14217
|
metadata: Schema.optional(Metadata)
|
|
14128
14218
|
});
|
|
14129
14219
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
14130
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
14220
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
14131
14221
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
|
|
14132
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
14222
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
14133
14223
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
14134
14224
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
14135
14225
|
const bodyStart = bodyStartOf(source);
|
|
@@ -14157,16 +14247,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
14157
14247
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
14158
14248
|
file: skill.file,
|
|
14159
14249
|
...positionOf(skill.source)(index),
|
|
14160
|
-
rule: RULE$
|
|
14250
|
+
rule: RULE$14,
|
|
14161
14251
|
message
|
|
14162
14252
|
})));
|
|
14163
14253
|
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) => ({
|
|
14164
14254
|
target,
|
|
14165
|
-
index: found.index ?? START$
|
|
14255
|
+
index: found.index ?? START$10
|
|
14166
14256
|
})), Option.toArray);
|
|
14167
14257
|
const rangeOf$1 = (found) => {
|
|
14168
|
-
const start = found.index ?? START$
|
|
14169
|
-
return [start, start + found[START$
|
|
14258
|
+
const start = found.index ?? START$10;
|
|
14259
|
+
return [start, start + found[START$10].length];
|
|
14170
14260
|
};
|
|
14171
14261
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
14172
14262
|
const linksIn = (source) => {
|
|
@@ -14184,23 +14274,23 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
14184
14274
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14185
14275
|
file,
|
|
14186
14276
|
...positionOf(source)(index),
|
|
14187
|
-
rule: RULE$
|
|
14277
|
+
rule: RULE$14,
|
|
14188
14278
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14189
14279
|
})));
|
|
14190
14280
|
});
|
|
14191
|
-
const problemsIn$
|
|
14281
|
+
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
14192
14282
|
const files = yield* RepositoryFiles;
|
|
14193
14283
|
const file = files.join(root, name);
|
|
14194
14284
|
const directory = files.dirname(name);
|
|
14195
14285
|
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
14196
14286
|
const text = yield* files.readFile(file);
|
|
14197
14287
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
14198
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
14288
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
|
|
14199
14289
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
14200
14290
|
file: files.join(root, entry),
|
|
14201
14291
|
line: FIRST$3,
|
|
14202
14292
|
column: FIRST$3,
|
|
14203
|
-
rule: RULE$
|
|
14293
|
+
rule: RULE$14,
|
|
14204
14294
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14205
14295
|
})));
|
|
14206
14296
|
return [
|
|
@@ -14217,7 +14307,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14217
14307
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
14218
14308
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
14219
14309
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
14220
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
14310
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$8(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
14221
14311
|
return Array.flatten(found);
|
|
14222
14312
|
});
|
|
14223
14313
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -14278,9 +14368,9 @@ const cargoEntries = (text) => {
|
|
|
14278
14368
|
};
|
|
14279
14369
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14280
14370
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14281
|
-
const RULE$
|
|
14371
|
+
const RULE$13 = "version-downgrade";
|
|
14282
14372
|
const DEFAULT_BASE = "origin/main";
|
|
14283
|
-
const READ_CONCURRENCY$
|
|
14373
|
+
const READ_CONCURRENCY$4 = 16;
|
|
14284
14374
|
const READERS = [
|
|
14285
14375
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
14286
14376
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -14304,7 +14394,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
14304
14394
|
file,
|
|
14305
14395
|
line: lineOf(text, entry),
|
|
14306
14396
|
column: FIRST_LINE$1,
|
|
14307
|
-
rule: RULE$
|
|
14397
|
+
rule: RULE$13,
|
|
14308
14398
|
message: message(old, entry)
|
|
14309
14399
|
})), Option.toArray)));
|
|
14310
14400
|
};
|
|
@@ -14330,7 +14420,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
14330
14420
|
before: read(before),
|
|
14331
14421
|
after: read(after)
|
|
14332
14422
|
})), Option.getOrElse(() => []));
|
|
14333
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
14423
|
+
}), { concurrency: READ_CONCURRENCY$4 });
|
|
14334
14424
|
return Array.flatten(found);
|
|
14335
14425
|
});
|
|
14336
14426
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -14341,13 +14431,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
14341
14431
|
const CAP_RULE = "renovate-version-cap";
|
|
14342
14432
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14343
14433
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14344
|
-
const START$
|
|
14345
|
-
const READ_CONCURRENCY$
|
|
14434
|
+
const START$9 = 0;
|
|
14435
|
+
const READ_CONCURRENCY$3 = 16;
|
|
14346
14436
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14347
14437
|
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.";
|
|
14348
14438
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
14349
14439
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
14350
|
-
const problemsIn$
|
|
14440
|
+
const problemsIn$7 = (file, source) => {
|
|
14351
14441
|
const at = positionOf(source);
|
|
14352
14442
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
14353
14443
|
file,
|
|
@@ -14360,7 +14450,7 @@ const problemsIn$6 = (file, source) => {
|
|
|
14360
14450
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
14361
14451
|
...pipe([{
|
|
14362
14452
|
file,
|
|
14363
|
-
...at(START$
|
|
14453
|
+
...at(START$9),
|
|
14364
14454
|
rule: PRESET_RULE,
|
|
14365
14455
|
message: PRESET_MESSAGE
|
|
14366
14456
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -14374,30 +14464,30 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14374
14464
|
const file = files.join(root, name);
|
|
14375
14465
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14376
14466
|
onNone: () => [],
|
|
14377
|
-
onSome: (source) => problemsIn$
|
|
14467
|
+
onSome: (source) => problemsIn$7(file, source)
|
|
14378
14468
|
})));
|
|
14379
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
14469
|
+
}, { concurrency: READ_CONCURRENCY$3 });
|
|
14380
14470
|
return Array.flatten(found);
|
|
14381
14471
|
});
|
|
14382
14472
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
14383
14473
|
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;
|
|
14384
14474
|
const NUL = "\0";
|
|
14385
|
-
const START$
|
|
14475
|
+
const START$8 = 0;
|
|
14386
14476
|
const HEX = 16;
|
|
14387
14477
|
const CODE_POINT_WIDTH = 4;
|
|
14388
|
-
const READ_CONCURRENCY$
|
|
14389
|
-
const RULE$
|
|
14390
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
14478
|
+
const READ_CONCURRENCY$2 = 64;
|
|
14479
|
+
const RULE$12 = "hidden-unicode";
|
|
14480
|
+
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"));
|
|
14391
14481
|
const problemOf$1 = (file, source) => (found) => {
|
|
14392
|
-
const hex = hexOf(found[START$
|
|
14482
|
+
const hex = hexOf(found[START$8]);
|
|
14393
14483
|
return {
|
|
14394
14484
|
file,
|
|
14395
|
-
...positionOf(source)(found.index ?? START$
|
|
14396
|
-
rule: RULE$
|
|
14485
|
+
...positionOf(source)(found.index ?? START$8),
|
|
14486
|
+
rule: RULE$12,
|
|
14397
14487
|
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}.`
|
|
14398
14488
|
};
|
|
14399
14489
|
};
|
|
14400
|
-
const problemsIn$
|
|
14490
|
+
const problemsIn$6 = (file, source) => {
|
|
14401
14491
|
if (String$1.includes(NUL)(source)) return [];
|
|
14402
14492
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
|
|
14403
14493
|
};
|
|
@@ -14409,25 +14499,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14409
14499
|
const file = files.join(root, name);
|
|
14410
14500
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14411
14501
|
onNone: () => [],
|
|
14412
|
-
onSome: (source) => problemsIn$
|
|
14502
|
+
onSome: (source) => problemsIn$6(file, source)
|
|
14413
14503
|
})));
|
|
14414
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
14504
|
+
}, { concurrency: READ_CONCURRENCY$2 });
|
|
14415
14505
|
return Array.flatten(found);
|
|
14416
14506
|
});
|
|
14417
14507
|
// src/features/find-unneeded-files/model/alchemy-patch.ts
|
|
14418
|
-
const RULE$
|
|
14508
|
+
const RULE$11 = "alchemy-patch";
|
|
14419
14509
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
14420
14510
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
14421
|
-
const START$
|
|
14511
|
+
const START$7 = 0;
|
|
14422
14512
|
const problemOf = (file, position, name) => ({
|
|
14423
14513
|
file,
|
|
14424
14514
|
...position,
|
|
14425
|
-
rule: RULE$
|
|
14515
|
+
rule: RULE$11,
|
|
14426
14516
|
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.`
|
|
14427
14517
|
});
|
|
14428
|
-
const problemsIn$
|
|
14518
|
+
const problemsIn$5 = (file, patched) => (source) => {
|
|
14429
14519
|
const at = positionOf(source);
|
|
14430
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
14520
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$7));
|
|
14431
14521
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
14432
14522
|
};
|
|
14433
14523
|
/** @internal */
|
|
@@ -14437,12 +14527,12 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
|
|
|
14437
14527
|
const text = yield* files.readFile(file);
|
|
14438
14528
|
const manifest = yield* workspaceManifest(root);
|
|
14439
14529
|
const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
14440
|
-
return pipe(text, Option.map(problemsIn$
|
|
14530
|
+
return pipe(text, Option.map(problemsIn$5(file, patched)), Option.getOrElse(() => []));
|
|
14441
14531
|
});
|
|
14442
14532
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
14443
14533
|
const MSCH = "@r_masseater/msch";
|
|
14444
14534
|
const SCOPE$1 = "@r_masseater/";
|
|
14445
|
-
const RULE$
|
|
14535
|
+
const RULE$10 = "applied-package";
|
|
14446
14536
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
14447
14537
|
const NOT_FOUND = -1;
|
|
14448
14538
|
const SEPARATOR$1 = "/";
|
|
@@ -14487,7 +14577,7 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
14487
14577
|
const problemAt$2 = (file, source) => (index, name) => ({
|
|
14488
14578
|
file,
|
|
14489
14579
|
...positionOf(source)(index),
|
|
14490
|
-
rule: RULE$
|
|
14580
|
+
rule: RULE$10,
|
|
14491
14581
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
14492
14582
|
});
|
|
14493
14583
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
@@ -14542,7 +14632,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14542
14632
|
return yield* appliedPackageProblems(root, applied);
|
|
14543
14633
|
});
|
|
14544
14634
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14545
|
-
const RULE$
|
|
14635
|
+
const RULE$9 = "replaced-tool";
|
|
14546
14636
|
const FIRST$2 = 1;
|
|
14547
14637
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14548
14638
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
@@ -14619,18 +14709,18 @@ const REPLACED = [
|
|
|
14619
14709
|
replacement: "the root AGENTS.md and the skills in masseater/skills"
|
|
14620
14710
|
}
|
|
14621
14711
|
];
|
|
14622
|
-
const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
14712
|
+
const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
14623
14713
|
file,
|
|
14624
14714
|
line: FIRST$2,
|
|
14625
14715
|
column: FIRST$2,
|
|
14626
|
-
rule: RULE$
|
|
14716
|
+
rule: RULE$9,
|
|
14627
14717
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14628
14718
|
})));
|
|
14629
14719
|
/** @internal */
|
|
14630
14720
|
const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplacedTools(root) {
|
|
14631
14721
|
const listed = yield* listedFiles(root);
|
|
14632
|
-
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor(entry)))));
|
|
14633
|
-
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor(entry))));
|
|
14722
|
+
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor$1(entry)))));
|
|
14723
|
+
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor$1(entry))));
|
|
14634
14724
|
});
|
|
14635
14725
|
// src/features/find-unneeded-files/model/lockfiles.ts
|
|
14636
14726
|
const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
|
|
@@ -14657,7 +14747,7 @@ const SETUP_PATTERNS = [
|
|
|
14657
14747
|
];
|
|
14658
14748
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14659
14749
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14660
|
-
const START$
|
|
14750
|
+
const START$6 = 0;
|
|
14661
14751
|
const LAST_SEGMENT = 1;
|
|
14662
14752
|
const FIRST_LINE = 1;
|
|
14663
14753
|
const FIRST_COLUMN = 1;
|
|
@@ -14726,7 +14816,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14726
14816
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14727
14817
|
return directoriesOf(roots);
|
|
14728
14818
|
});
|
|
14729
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
14819
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
|
|
14730
14820
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14731
14821
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14732
14822
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14762,11 +14852,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14762
14852
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14763
14853
|
});
|
|
14764
14854
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
14765
|
-
const RULE$
|
|
14855
|
+
const RULE$8 = "effect-diagnostics-once";
|
|
14766
14856
|
const PLUGIN = "@effect/language-service";
|
|
14767
14857
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14768
|
-
const EXCLUDED$
|
|
14769
|
-
const START$
|
|
14858
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14859
|
+
const START$5 = 0;
|
|
14770
14860
|
const Plugin = Schema.Struct({
|
|
14771
14861
|
name: Schema.optional(Schema.String),
|
|
14772
14862
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14777,28 +14867,28 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
14777
14867
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
14778
14868
|
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.`;
|
|
14779
14869
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14780
|
-
const problemsIn$
|
|
14870
|
+
const problemsIn$4 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
14781
14871
|
file: entry.file,
|
|
14782
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14783
|
-
rule: RULE$
|
|
14872
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$5))),
|
|
14873
|
+
rule: RULE$8,
|
|
14784
14874
|
message: MESSAGE$1
|
|
14785
14875
|
})), Option.toArray);
|
|
14786
14876
|
/** @internal */
|
|
14787
14877
|
const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* checkEffectDiagnostics(root) {
|
|
14788
14878
|
const files = yield* RepositoryFiles;
|
|
14789
|
-
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$
|
|
14879
|
+
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$4]);
|
|
14790
14880
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
14791
14881
|
name,
|
|
14792
14882
|
file: files.join(root, name)
|
|
14793
|
-
}))), problemsIn$
|
|
14883
|
+
}))), problemsIn$4);
|
|
14794
14884
|
});
|
|
14795
14885
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
14796
|
-
const RULE$
|
|
14886
|
+
const RULE$7 = "version-range";
|
|
14797
14887
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
14798
14888
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14799
14889
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14800
14890
|
const PATH_LIKE = "/";
|
|
14801
|
-
const EXCLUDED$
|
|
14891
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14802
14892
|
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.";
|
|
14803
14893
|
const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
|
|
14804
14894
|
/** @internal */
|
|
@@ -14808,8 +14898,8 @@ const isRange = (specifier) => {
|
|
|
14808
14898
|
};
|
|
14809
14899
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14810
14900
|
file,
|
|
14811
|
-
...positionOf(source)(offsetIn
|
|
14812
|
-
rule: RULE$
|
|
14901
|
+
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14902
|
+
rule: RULE$7,
|
|
14813
14903
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14814
14904
|
})));
|
|
14815
14905
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "mu");
|
|
@@ -14828,7 +14918,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14828
14918
|
/** @internal */
|
|
14829
14919
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
14830
14920
|
const files = yield* RepositoryFiles;
|
|
14831
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14921
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$3]);
|
|
14832
14922
|
const listed = pipe(manifests, Array.map((name) => ({
|
|
14833
14923
|
name,
|
|
14834
14924
|
file: files.join(root, name)
|
|
@@ -14837,6 +14927,75 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14837
14927
|
const fromCatalogs = yield* catalogProblems(root);
|
|
14838
14928
|
return [...fromManifests, ...fromCatalogs];
|
|
14839
14929
|
});
|
|
14930
|
+
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14931
|
+
const RULE$6 = "pack-publint";
|
|
14932
|
+
const PREPUBLISH_RULE = "prepublish-script";
|
|
14933
|
+
const PREPUBLISH_SCRIPT = "prepublishOnly";
|
|
14934
|
+
const PREPUBLISH_COMMAND = "vp exec msch-publish prepublish .";
|
|
14935
|
+
const CONFIG_FILE = "vite.config.ts";
|
|
14936
|
+
const PACK_KEY = "pack:";
|
|
14937
|
+
const START$4 = 0;
|
|
14938
|
+
const READ_CONCURRENCY$1 = 16;
|
|
14939
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14940
|
+
const Manifest$4 = Schema.Struct({
|
|
14941
|
+
private: Schema.optional(Schema.Boolean),
|
|
14942
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
14943
|
+
scripts: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
14944
|
+
});
|
|
14945
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
14946
|
+
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14947
|
+
const isStrict = Schema.is(StrictPack);
|
|
14948
|
+
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
14949
|
+
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
14950
|
+
const taggedError = Schema.TaggedError;
|
|
14951
|
+
var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
14952
|
+
const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14953
|
+
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14954
|
+
const problemFor = (file, source) => ({
|
|
14955
|
+
file,
|
|
14956
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$4)),
|
|
14957
|
+
rule: RULE$6,
|
|
14958
|
+
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."
|
|
14959
|
+
});
|
|
14960
|
+
const publishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.filter(isPublished$2));
|
|
14961
|
+
const prepublishProblems = (file, source, manifest) => {
|
|
14962
|
+
const declared = pipe(Option.fromUndefinedOr(manifest.scripts), Option.flatMap(Record.get(PREPUBLISH_SCRIPT)));
|
|
14963
|
+
if (Option.contains(declared, PREPUBLISH_COMMAND)) return [];
|
|
14964
|
+
return [{
|
|
14965
|
+
file,
|
|
14966
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(`"${PREPUBLISH_SCRIPT}"`)(source), () => START$4)),
|
|
14967
|
+
rule: PREPUBLISH_RULE,
|
|
14968
|
+
message: `This package is published, so its ${PREPUBLISH_SCRIPT} script must be exactly \`${PREPUBLISH_COMMAND}\`. That one command refuses npm publish, which leaves catalog: in dependencies, and builds the package. Writing the guard in each package leaves some packages without it.`
|
|
14969
|
+
}];
|
|
14970
|
+
};
|
|
14971
|
+
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14972
|
+
const config = yield* Effect.tryPromise({
|
|
14973
|
+
try: () => resolveConfigFromFile(configFile),
|
|
14974
|
+
catch: () => PackConfigUnreadable.make({ file: configFile })
|
|
14975
|
+
}).pipe(Effect.option);
|
|
14976
|
+
return Option.exists(config, runsStrictPublint);
|
|
14977
|
+
});
|
|
14978
|
+
const configProblems = Effect.fn("configProblems")(function* configProblems(configFile) {
|
|
14979
|
+
const source = yield* (yield* RepositoryFiles).readFile(configFile);
|
|
14980
|
+
if (Option.isNone(source)) return [];
|
|
14981
|
+
if (yield* strictPublintIn(configFile)) return [];
|
|
14982
|
+
return [problemFor(configFile, source.value)];
|
|
14983
|
+
});
|
|
14984
|
+
const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14985
|
+
const files = yield* RepositoryFiles;
|
|
14986
|
+
const manifestFile = files.join(root, manifestName);
|
|
14987
|
+
const source = yield* files.readFile(manifestFile);
|
|
14988
|
+
const manifest = publishedManifest(source);
|
|
14989
|
+
if (Option.isNone(manifest) || Option.isNone(source)) return [];
|
|
14990
|
+
const config = yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14991
|
+
return [...prepublishProblems(manifestFile, source.value, manifest.value), ...config];
|
|
14992
|
+
});
|
|
14993
|
+
/** @internal */
|
|
14994
|
+
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14995
|
+
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14996
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$3(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14997
|
+
return Array.flatten(found);
|
|
14998
|
+
});
|
|
14840
14999
|
// src/features/check-package-scope/model/package-scope.ts
|
|
14841
15000
|
const RULE$5 = "package-scope";
|
|
14842
15001
|
const SCOPE = "@r_masseater/";
|