@r_masseater/msch 0.65.0 → 0.66.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +4 -4
- package/dist/cli.mjs +878 -864
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +5 -1
- package/dist/config.mjs.map +1 -1
- package/dist/{dependencies-B6p7x90y.mjs → dependencies-BDQ7XSwU.mjs} +7 -30
- package/dist/dependencies-BDQ7XSwU.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/export-subpaths-D6ZLYZGy.mjs +17 -0
- package/dist/export-subpaths-D6ZLYZGy.mjs.map +1 -0
- package/dist/{ignored-directories-BgUqwuc4.mjs → ignored-directories-DurTKTTN.mjs} +2 -2
- package/dist/{ignored-directories-BgUqwuc4.mjs.map → ignored-directories-DurTKTTN.mjs.map} +1 -1
- package/dist/{index-BZIBqvmt.d.mts → index-CWZNFtdG.d.mts} +5 -1
- package/dist/{lookup-DmifnzVb.mjs → lookup-DjQU0W6q.mjs} +3 -16
- package/dist/lookup-DjQU0W6q.mjs.map +1 -0
- package/dist/{lookup-report-ARfHc4ey.mjs → lookup-report-CPR_cj8F.mjs} +3 -3
- package/dist/lookup-report-CPR_cj8F.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{pass-records-CFIrQmB5.mjs → pass-records-DdiDtl_g.mjs} +5 -5
- package/dist/pass-records-DdiDtl_g.mjs.map +1 -0
- package/dist/{problem-D2HKNIVq.mjs → problem-glqVxx3h.mjs} +2 -2
- package/dist/{problem-D2HKNIVq.mjs.map → problem-glqVxx3h.mjs.map} +1 -1
- package/dist/publish.mjs +7 -18
- package/dist/publish.mjs.map +1 -1
- package/dist/{published-BIexKvdJ.mjs → published-DnkuW2Tw.mjs} +10 -15
- package/dist/published-DnkuW2Tw.mjs.map +1 -0
- package/dist/refs.mjs +53 -25
- package/dist/refs.mjs.map +1 -1
- package/dist/{repository-files-B5sRbxlz.mjs → repository-files-mOPItI5o.mjs} +3 -3
- package/dist/repository-files-mOPItI5o.mjs.map +1 -0
- package/dist/{runtime-A2p57njU.mjs → runtime-mDBC8Yey.mjs} +2 -2
- package/dist/{runtime-A2p57njU.mjs.map → runtime-mDBC8Yey.mjs.map} +1 -1
- package/dist/{syntax-C0ddqOHc.mjs → syntax-A3ga4Ksb.mjs} +2 -2
- package/dist/{syntax-C0ddqOHc.mjs.map → syntax-A3ga4Ksb.mjs.map} +1 -1
- package/dist/tree-sitter-BfzHNwTR.mjs +41 -0
- package/dist/tree-sitter-BfzHNwTR.mjs.map +1 -0
- package/dist/{upstream-exits-Dp0EeI5D.mjs → upstream-exits-Bv2E-QO6.mjs} +21 -12
- package/dist/upstream-exits-Bv2E-QO6.mjs.map +1 -0
- package/dist/wake.mjs +1 -1
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +18 -5
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +3 -6
- package/skills/msch-checks/SKILL.md +2 -2
- package/skills/msch-publishing/SKILL.md +2 -0
- package/dist/dependencies-B6p7x90y.mjs.map +0 -1
- package/dist/lookup-DmifnzVb.mjs.map +0 -1
- package/dist/lookup-report-ARfHc4ey.mjs.map +0 -1
- package/dist/pass-records-CFIrQmB5.mjs.map +0 -1
- package/dist/published-BIexKvdJ.mjs.map +0 -1
- package/dist/reference-links-B9NZUUF8.mjs +0 -172
- package/dist/reference-links-B9NZUUF8.mjs.map +0 -1
- package/dist/repository-files-B5sRbxlz.mjs.map +0 -1
- package/dist/upstream-exits-Dp0EeI5D.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-
|
|
3
|
-
import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-
|
|
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-
|
|
5
|
-
import { a as groupOf
|
|
6
|
-
import { o as positionOf } from "./
|
|
2
|
+
import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-DnkuW2Tw.mjs";
|
|
3
|
+
import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-BDQ7XSwU.mjs";
|
|
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-DdiDtl_g.mjs";
|
|
5
|
+
import { a as groupOf, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-mOPItI5o.mjs";
|
|
6
|
+
import { a as workspaceDeviations, c as tomlSourceComments, d as problemAtIndex, 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-Bv2E-QO6.mjs";
|
|
7
7
|
import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
|
|
8
|
-
import { a as problemAtPosition, i as problemAt$
|
|
8
|
+
import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-glqVxx3h.mjs";
|
|
9
9
|
import { t as JAPANESE } from "./config-CvPuqi4L.mjs";
|
|
10
|
-
import {
|
|
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-
|
|
12
|
-
import {
|
|
13
|
-
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-A2p57njU.mjs";
|
|
10
|
+
import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
|
|
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-A3ga4Ksb.mjs";
|
|
12
|
+
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-mDBC8Yey.mjs";
|
|
14
13
|
import "./cli-contract-D7btWrEu.mjs";
|
|
15
14
|
import { builtinModules } from "node:module";
|
|
16
15
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
@@ -523,80 +522,80 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
523
522
|
// src/features/check-overrides/model/git-subpath.ts
|
|
524
523
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
525
524
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
526
|
-
const RULE$
|
|
525
|
+
const RULE$64 = "git-subpath-dependency";
|
|
527
526
|
const WHOLE_MATCH$4 = 0;
|
|
528
|
-
const problemAt$
|
|
527
|
+
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
529
528
|
file,
|
|
530
529
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
531
|
-
rule: RULE$
|
|
530
|
+
rule: RULE$64,
|
|
532
531
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
533
532
|
});
|
|
534
|
-
const problemsIn$
|
|
533
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
|
|
535
534
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
536
535
|
/** @internal */
|
|
537
536
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
538
537
|
const listed = yield* listedFiles(root);
|
|
539
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
538
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$21);
|
|
540
539
|
});
|
|
541
540
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
542
|
-
const RULE$
|
|
541
|
+
const RULE$63 = "unnamed-restriction";
|
|
543
542
|
const WHOLE_MATCH$3 = 0;
|
|
544
543
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
545
|
-
const problemsIn$
|
|
544
|
+
const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
546
545
|
file: entry.file,
|
|
547
546
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
548
|
-
rule: RULE$
|
|
547
|
+
rule: RULE$63,
|
|
549
548
|
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
550
549
|
})));
|
|
551
550
|
/** @internal */
|
|
552
551
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
553
552
|
const listed = yield* listedFiles(root);
|
|
554
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
553
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
|
|
555
554
|
});
|
|
556
555
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
557
|
-
const RULE$
|
|
556
|
+
const RULE$62 = "named-type-exemption";
|
|
558
557
|
const WHOLE_MATCH$2 = 0;
|
|
559
558
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
560
|
-
const problemsIn$
|
|
559
|
+
const problemsIn$19 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
561
560
|
file: entry.file,
|
|
562
561
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
563
|
-
rule: RULE$
|
|
562
|
+
rule: RULE$62,
|
|
564
563
|
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
565
564
|
})));
|
|
566
565
|
/** @internal */
|
|
567
566
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
568
567
|
const listed = yield* listedFiles(root);
|
|
569
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
568
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$19);
|
|
570
569
|
});
|
|
571
570
|
// src/features/check-overrides/model/package-registry.ts
|
|
572
|
-
const RULE$
|
|
571
|
+
const RULE$61 = "package-registry";
|
|
573
572
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
574
573
|
const TRAILING_SLASH = /\/$/u;
|
|
575
574
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
576
575
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
577
576
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
578
577
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
579
|
-
const START$
|
|
578
|
+
const START$24 = 0;
|
|
580
579
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
581
580
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
582
581
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
583
582
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
584
583
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
585
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
584
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$24));
|
|
586
585
|
const workspaceProblem = (file, source, registry) => ({
|
|
587
586
|
file,
|
|
588
587
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
589
|
-
rule: RULE$
|
|
588
|
+
rule: RULE$61,
|
|
590
589
|
message: Option.match(registry, {
|
|
591
590
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$4}.`,
|
|
592
591
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
593
592
|
})
|
|
594
593
|
});
|
|
595
|
-
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf
|
|
594
|
+
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf("value")(found), isGuarded)), Array.map((found) => ({
|
|
596
595
|
file: entry.file,
|
|
597
|
-
...positionOf(source)(found.index ?? START$
|
|
598
|
-
rule: RULE$
|
|
599
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
596
|
+
...positionOf(source)(found.index ?? START$24),
|
|
597
|
+
rule: RULE$61,
|
|
598
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$24])}\`. Remove the line.`
|
|
600
599
|
})));
|
|
601
600
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
602
601
|
const files = yield* RepositoryFiles;
|
|
@@ -615,13 +614,13 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
615
614
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
616
615
|
});
|
|
617
616
|
// src/entities/package/model/specifiers.ts
|
|
618
|
-
const START$
|
|
617
|
+
const START$23 = 0;
|
|
619
618
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
620
619
|
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
621
620
|
const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
622
621
|
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
623
622
|
/** @internal */
|
|
624
|
-
const decodeManifest$
|
|
623
|
+
const decodeManifest$8 = (source) => decodeJson$2(source);
|
|
625
624
|
/** @internal */
|
|
626
625
|
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
627
626
|
/** @internal */
|
|
@@ -636,7 +635,7 @@ const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.ra
|
|
|
636
635
|
/** @internal */
|
|
637
636
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
638
637
|
/** @internal */
|
|
639
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
638
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
|
|
640
639
|
const SECTIONS = [
|
|
641
640
|
"dependencies",
|
|
642
641
|
"devDependencies",
|
|
@@ -644,8 +643,33 @@ const SECTIONS = [
|
|
|
644
643
|
];
|
|
645
644
|
/** @internal */
|
|
646
645
|
const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
|
|
646
|
+
// src/entities/package/model/published-manifest.ts
|
|
647
|
+
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
648
|
+
const PublishedManifestSchema = Schema.Struct({
|
|
649
|
+
name: Schema.optional(Schema.String),
|
|
650
|
+
private: Schema.optional(Schema.Boolean),
|
|
651
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
652
|
+
homepage: Schema.optional(Schema.Unknown),
|
|
653
|
+
repository: Schema.optional(Schema.Unknown)
|
|
654
|
+
});
|
|
655
|
+
const decodePublishedManifest = Schema.decodeUnknownOption(Schema.fromJsonString(PublishedManifestSchema));
|
|
656
|
+
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
657
|
+
const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePublishedManifest), Option.filter(isPublished$1));
|
|
658
|
+
/** @internal */
|
|
659
|
+
const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
|
|
660
|
+
const files = yield* RepositoryFiles;
|
|
661
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$8]);
|
|
662
|
+
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
663
|
+
name,
|
|
664
|
+
file: files.join(root, name)
|
|
665
|
+
}))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
|
|
666
|
+
entry,
|
|
667
|
+
source,
|
|
668
|
+
manifest
|
|
669
|
+
})), Option.getOrElse(() => [])));
|
|
670
|
+
});
|
|
647
671
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
648
|
-
const RULE$
|
|
672
|
+
const RULE$60 = "colocated-git-patterns";
|
|
649
673
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
650
674
|
const ROOT$3 = ".";
|
|
651
675
|
const NEGATION$1 = "!";
|
|
@@ -692,7 +716,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
692
716
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
693
717
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
694
718
|
});
|
|
695
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
719
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$60)(entry.file, {
|
|
696
720
|
line: entry.line,
|
|
697
721
|
column: FIRST$22
|
|
698
722
|
}, message);
|
|
@@ -755,7 +779,7 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
755
779
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
756
780
|
});
|
|
757
781
|
// src/features/check-placement/model/colocated-tests.ts
|
|
758
|
-
const RULE$
|
|
782
|
+
const RULE$59 = "colocated-test";
|
|
759
783
|
const FIRST$21 = 1;
|
|
760
784
|
const READ_CONCURRENCY$31 = 64;
|
|
761
785
|
const ROOT_SUBPATH = ".";
|
|
@@ -770,20 +794,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
770
794
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
771
795
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
772
796
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
773
|
-
const EXCLUDED$
|
|
797
|
+
const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
774
798
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
775
799
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
776
|
-
const Manifest$
|
|
800
|
+
const Manifest$6 = Schema.Struct({
|
|
777
801
|
name: Schema.optional(Schema.String),
|
|
778
802
|
exports: Schema.optional(Schema.Unknown)
|
|
779
803
|
});
|
|
780
|
-
const decodeManifest$
|
|
804
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
781
805
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
782
806
|
const problemFor$9 = (test, message) => ({
|
|
783
807
|
file: test.file,
|
|
784
808
|
line: FIRST$21,
|
|
785
809
|
column: FIRST$21,
|
|
786
|
-
rule: RULE$
|
|
810
|
+
rule: RULE$59,
|
|
787
811
|
message: `${test.base} ${message}`
|
|
788
812
|
});
|
|
789
813
|
const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
@@ -803,7 +827,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
803
827
|
if (Option.isNone(owner)) return [];
|
|
804
828
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
805
829
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
806
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
830
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(specifiersBeside({
|
|
807
831
|
join,
|
|
808
832
|
dirname: files.dirname,
|
|
809
833
|
directory: test.directory
|
|
@@ -831,7 +855,7 @@ const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
|
831
855
|
/** @internal */
|
|
832
856
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
833
857
|
const files = yield* RepositoryFiles;
|
|
834
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
858
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$7);
|
|
835
859
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
836
860
|
const context = {
|
|
837
861
|
root,
|
|
@@ -866,7 +890,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
866
890
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
867
891
|
const RECOMMENDED_LINES = 200;
|
|
868
892
|
const FIRST$20 = 1;
|
|
869
|
-
const RULE$
|
|
893
|
+
const RULE$58 = "agent-docs-length";
|
|
870
894
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
871
895
|
const problemFor$8 = (file) => (lines) => {
|
|
872
896
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -874,14 +898,14 @@ const problemFor$8 = (file) => (lines) => {
|
|
|
874
898
|
file,
|
|
875
899
|
line: 201,
|
|
876
900
|
column: FIRST$20,
|
|
877
|
-
rule: RULE$
|
|
901
|
+
rule: RULE$58,
|
|
878
902
|
message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`
|
|
879
903
|
});
|
|
880
904
|
};
|
|
881
905
|
/** @internal */
|
|
882
906
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
883
907
|
// src/features/check-placement/model/claude-link.ts
|
|
884
|
-
const RULE$
|
|
908
|
+
const RULE$57 = "claude-md-link";
|
|
885
909
|
const CLAUDE = "CLAUDE.md";
|
|
886
910
|
const AGENTS = "AGENTS.md";
|
|
887
911
|
const FIRST$19 = 1;
|
|
@@ -900,7 +924,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
900
924
|
file: path,
|
|
901
925
|
line: FIRST$19,
|
|
902
926
|
column: FIRST$19,
|
|
903
|
-
rule: RULE$
|
|
927
|
+
rule: RULE$57,
|
|
904
928
|
message: MESSAGE$17
|
|
905
929
|
})));
|
|
906
930
|
});
|
|
@@ -909,7 +933,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
909
933
|
return Array.getSomes(found);
|
|
910
934
|
});
|
|
911
935
|
// src/features/check-placement/model/dangling-links.ts
|
|
912
|
-
const RULE$
|
|
936
|
+
const RULE$56 = "dangling-link";
|
|
913
937
|
const SEPARATOR$19 = "/";
|
|
914
938
|
const FIRST$18 = 1;
|
|
915
939
|
const READ_CONCURRENCY$28 = 16;
|
|
@@ -925,7 +949,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
925
949
|
file,
|
|
926
950
|
line: FIRST$18,
|
|
927
951
|
column: FIRST$18,
|
|
928
|
-
rule: RULE$
|
|
952
|
+
rule: RULE$56,
|
|
929
953
|
message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
|
|
930
954
|
})));
|
|
931
955
|
});
|
|
@@ -936,7 +960,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
936
960
|
const ROOT_WORKSPACE$1 = ".";
|
|
937
961
|
const FIRST$17 = 1;
|
|
938
962
|
const SEPARATOR$18 = "/";
|
|
939
|
-
const EXCLUDED$
|
|
963
|
+
const EXCLUDED$6 = [
|
|
940
964
|
":(exclude,attr:linguist-vendored)",
|
|
941
965
|
":(exclude,attr:linguist-generated)",
|
|
942
966
|
":(exclude,attr:linguist-documentation)"
|
|
@@ -949,7 +973,7 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
949
973
|
const files = yield* RepositoryFiles;
|
|
950
974
|
return {
|
|
951
975
|
workspaces: yield* memberWorkspaces(root),
|
|
952
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$
|
|
976
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$6)
|
|
953
977
|
};
|
|
954
978
|
});
|
|
955
979
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
@@ -983,8 +1007,8 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
983
1007
|
}));
|
|
984
1008
|
});
|
|
985
1009
|
// src/features/check-placement/model/deployed-readme.ts
|
|
986
|
-
const RULE$
|
|
987
|
-
const ROOT_DIRECTORY$
|
|
1010
|
+
const RULE$55 = "deployed-readme";
|
|
1011
|
+
const ROOT_DIRECTORY$4 = "";
|
|
988
1012
|
const READ_CONCURRENCY$27 = 16;
|
|
989
1013
|
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
990
1014
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
@@ -1023,14 +1047,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1023
1047
|
const readme = yield* readReadme({
|
|
1024
1048
|
root,
|
|
1025
1049
|
directory,
|
|
1026
|
-
rule: RULE$
|
|
1050
|
+
rule: RULE$55,
|
|
1027
1051
|
missingMessage: MISSING_MESSAGE$2
|
|
1028
1052
|
});
|
|
1029
1053
|
return Result.match(readme, {
|
|
1030
1054
|
onFailure: Option.some,
|
|
1031
1055
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
1032
1056
|
file,
|
|
1033
|
-
rule: RULE$
|
|
1057
|
+
rule: RULE$55,
|
|
1034
1058
|
message: NO_URL_MESSAGE
|
|
1035
1059
|
})))
|
|
1036
1060
|
});
|
|
@@ -1042,12 +1066,12 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
1042
1066
|
const directories = yield* workspaceDirectories(root);
|
|
1043
1067
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
1044
1068
|
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$
|
|
1069
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array.dedupe);
|
|
1046
1070
|
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$27 });
|
|
1047
1071
|
return Array.getSomes(found);
|
|
1048
1072
|
});
|
|
1049
1073
|
// src/features/check-placement/model/nested-docs.ts
|
|
1050
|
-
const RULE$
|
|
1074
|
+
const RULE$54 = "nested-docs";
|
|
1051
1075
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
1052
1076
|
const SEPARATOR$17 = "/";
|
|
1053
1077
|
const READ_CONCURRENCY$26 = 64;
|
|
@@ -1060,7 +1084,7 @@ const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Sc
|
|
|
1060
1084
|
const taggedError$6 = Schema.TaggedError;
|
|
1061
1085
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1062
1086
|
const isNested = (name) => String$1.includes(SEPARATOR$17)(name);
|
|
1063
|
-
const problemFor$7 = problemInFile(RULE$
|
|
1087
|
+
const problemFor$7 = problemInFile(RULE$54);
|
|
1064
1088
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1065
1089
|
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
1066
1090
|
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
@@ -1117,7 +1141,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1117
1141
|
return [...Array.getSomes(found), ...missing];
|
|
1118
1142
|
});
|
|
1119
1143
|
// src/features/check-placement/model/published-readme.ts
|
|
1120
|
-
const RULE$
|
|
1144
|
+
const RULE$53 = "published-readme";
|
|
1121
1145
|
const READ_CONCURRENCY$25 = 16;
|
|
1122
1146
|
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1123
1147
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
@@ -1125,7 +1149,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1125
1149
|
const readme = yield* readReadme({
|
|
1126
1150
|
root,
|
|
1127
1151
|
directory,
|
|
1128
|
-
rule: RULE$
|
|
1152
|
+
rule: RULE$53,
|
|
1129
1153
|
missingMessage: MISSING_MESSAGE
|
|
1130
1154
|
});
|
|
1131
1155
|
return Result.match(readme, {
|
|
@@ -1136,7 +1160,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1136
1160
|
file,
|
|
1137
1161
|
line,
|
|
1138
1162
|
column,
|
|
1139
|
-
rule: RULE$
|
|
1163
|
+
rule: RULE$53,
|
|
1140
1164
|
message: MESSAGE$16
|
|
1141
1165
|
};
|
|
1142
1166
|
}))
|
|
@@ -1149,7 +1173,7 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
1149
1173
|
return Array.getSomes(found);
|
|
1150
1174
|
});
|
|
1151
1175
|
// src/features/check-placement/model/published-tests.ts
|
|
1152
|
-
const RULE$
|
|
1176
|
+
const RULE$52 = "published-tests";
|
|
1153
1177
|
const MANIFEST_FILE$2 = "package.json";
|
|
1154
1178
|
const FILE_START = 1;
|
|
1155
1179
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -1164,7 +1188,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1164
1188
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1165
1189
|
line: FILE_START,
|
|
1166
1190
|
column: FILE_START,
|
|
1167
|
-
rule: RULE$
|
|
1191
|
+
rule: RULE$52,
|
|
1168
1192
|
message: MESSAGE$15
|
|
1169
1193
|
});
|
|
1170
1194
|
});
|
|
@@ -1178,7 +1202,7 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1178
1202
|
return Array.getSomes(found);
|
|
1179
1203
|
});
|
|
1180
1204
|
// src/features/check-placement/model/root-docs.ts
|
|
1181
|
-
const RULE$
|
|
1205
|
+
const RULE$51 = "root-docs";
|
|
1182
1206
|
const SEPARATOR$16 = "/";
|
|
1183
1207
|
const FIRST$16 = 1;
|
|
1184
1208
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
@@ -1193,15 +1217,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1193
1217
|
file: files.join(root, name),
|
|
1194
1218
|
line: FIRST$16,
|
|
1195
1219
|
column: FIRST$16,
|
|
1196
|
-
rule: RULE$
|
|
1220
|
+
rule: RULE$51,
|
|
1197
1221
|
message: `${name} ${MESSAGE$14}`
|
|
1198
1222
|
})));
|
|
1199
1223
|
});
|
|
1200
1224
|
// src/features/check-placement/model/root-readme.ts
|
|
1201
|
-
const RULE$
|
|
1225
|
+
const RULE$50 = "root-readme";
|
|
1202
1226
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1203
1227
|
const READ_CONCURRENCY$24 = 16;
|
|
1204
|
-
const START$
|
|
1228
|
+
const START$22 = 0;
|
|
1205
1229
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1206
1230
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1207
1231
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -1215,7 +1239,7 @@ const NO_PLUGINS = {
|
|
|
1215
1239
|
names: []
|
|
1216
1240
|
};
|
|
1217
1241
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1218
|
-
const messageFor = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1242
|
+
const messageFor$1 = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1219
1243
|
const pluginsOf = (plugins) => {
|
|
1220
1244
|
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
|
|
1221
1245
|
const segments = pipe(directories, Array.map(baseName));
|
|
@@ -1238,17 +1262,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1238
1262
|
onNone: () => ownNames(plugins, names),
|
|
1239
1263
|
onSome: () => [directory]
|
|
1240
1264
|
}));
|
|
1241
|
-
const problemsIn$
|
|
1242
|
-
const message = messageFor(workspace.directory);
|
|
1265
|
+
const problemsIn$18 = (file, source, plugins) => (workspace) => {
|
|
1266
|
+
const message = messageFor$1(workspace.directory);
|
|
1243
1267
|
const at = positionOf(source);
|
|
1244
1268
|
const pattern = patternFor(plugins)(workspace);
|
|
1245
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1269
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$50)(file, at(found.index ?? START$22), message)));
|
|
1246
1270
|
};
|
|
1247
1271
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1248
1272
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1249
1273
|
return pipe(text, Option.match({
|
|
1250
1274
|
onNone: () => [],
|
|
1251
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1275
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$18(file, source, plugins)))
|
|
1252
1276
|
}));
|
|
1253
1277
|
});
|
|
1254
1278
|
/** @internal */
|
|
@@ -1279,7 +1303,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1279
1303
|
return Array.flatten(found);
|
|
1280
1304
|
});
|
|
1281
1305
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1282
|
-
const RULE$
|
|
1306
|
+
const RULE$49 = "docs-mirror";
|
|
1283
1307
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1284
1308
|
const MIRROR_LIMIT = 3;
|
|
1285
1309
|
const READ_CONCURRENCY$23 = 16;
|
|
@@ -1304,7 +1328,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
1304
1328
|
file,
|
|
1305
1329
|
line,
|
|
1306
1330
|
column,
|
|
1307
|
-
rule: RULE$
|
|
1331
|
+
rule: RULE$49,
|
|
1308
1332
|
message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`
|
|
1309
1333
|
};
|
|
1310
1334
|
}), Option.toArray);
|
|
@@ -1336,7 +1360,7 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1336
1360
|
return Array.flatten(found);
|
|
1337
1361
|
});
|
|
1338
1362
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1339
|
-
const RULE$
|
|
1363
|
+
const RULE$48 = "ignored-sources";
|
|
1340
1364
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1341
1365
|
const FIRST$15 = 1;
|
|
1342
1366
|
const MESSAGE$13 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
@@ -1348,7 +1372,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1348
1372
|
file: files.join(root, file),
|
|
1349
1373
|
line: FIRST$15,
|
|
1350
1374
|
column: FIRST$15,
|
|
1351
|
-
rule: RULE$
|
|
1375
|
+
rule: RULE$48,
|
|
1352
1376
|
message: MESSAGE$13
|
|
1353
1377
|
})));
|
|
1354
1378
|
});
|
|
@@ -9993,7 +10017,7 @@ const LAYER_ITEMS = [
|
|
|
9993
10017
|
"inner_attribute_item"
|
|
9994
10018
|
];
|
|
9995
10019
|
const READ_CONCURRENCY$22 = 64;
|
|
9996
|
-
const EXCLUDED$
|
|
10020
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9997
10021
|
const NONE$1 = [];
|
|
9998
10022
|
const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
|
|
9999
10023
|
const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
|
|
@@ -10054,7 +10078,7 @@ const isRead = ({ inner }) => {
|
|
|
10054
10078
|
};
|
|
10055
10079
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
10056
10080
|
const files = yield* RepositoryFiles;
|
|
10057
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
10081
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$5);
|
|
10058
10082
|
const owner = crateOf(crateDirectories(listed));
|
|
10059
10083
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
10060
10084
|
...owned,
|
|
@@ -10072,13 +10096,13 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10072
10096
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10073
10097
|
});
|
|
10074
10098
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10075
|
-
const RULE$
|
|
10099
|
+
const RULE$47 = "shadcn-ui-alias";
|
|
10076
10100
|
const FIRST$14 = 1;
|
|
10077
10101
|
const problemOf$8 = (directory, { file, alias }) => ({
|
|
10078
10102
|
file,
|
|
10079
10103
|
line: FIRST$14,
|
|
10080
10104
|
column: FIRST$14,
|
|
10081
|
-
rule: RULE$
|
|
10105
|
+
rule: RULE$47,
|
|
10082
10106
|
message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
|
|
10083
10107
|
});
|
|
10084
10108
|
/** @internal */
|
|
@@ -10098,8 +10122,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
10098
10122
|
const SOURCE_TARGET = "./src/*";
|
|
10099
10123
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10100
10124
|
const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
|
|
10101
|
-
const Manifest$
|
|
10102
|
-
const decodeManifest$
|
|
10125
|
+
const Manifest$5 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10126
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
10103
10127
|
const targetsOf = (target) => {
|
|
10104
10128
|
if (Predicate.isString(target)) return [target];
|
|
10105
10129
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10110,7 +10134,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10110
10134
|
const files = yield* RepositoryFiles;
|
|
10111
10135
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10112
10136
|
const text = yield* files.readFile(manifest);
|
|
10113
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10137
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
|
|
10114
10138
|
});
|
|
10115
10139
|
/** @internal */
|
|
10116
10140
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10148,12 +10172,12 @@ const FIRST$13 = 1;
|
|
|
10148
10172
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
10149
10173
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
10150
10174
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
10151
|
-
const Manifest$
|
|
10175
|
+
const Manifest$4 = Schema.Struct({
|
|
10152
10176
|
bin: Schema.optional(Schema.Unknown),
|
|
10153
10177
|
main: Schema.optional(Schema.Unknown),
|
|
10154
10178
|
exports: Schema.optional(Schema.Unknown)
|
|
10155
10179
|
});
|
|
10156
|
-
const decodeManifest$
|
|
10180
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
10157
10181
|
const NO_ENTRIES = {
|
|
10158
10182
|
all: [],
|
|
10159
10183
|
bins: []
|
|
@@ -10178,7 +10202,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
10178
10202
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10179
10203
|
const files = yield* RepositoryFiles;
|
|
10180
10204
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10181
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10205
|
+
return pipe(text, Option.flatMap(decodeManifest$5), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10182
10206
|
});
|
|
10183
10207
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10184
10208
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -10201,7 +10225,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10201
10225
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
10202
10226
|
})));
|
|
10203
10227
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10204
|
-
const problemsIn$
|
|
10228
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10205
10229
|
const files = yield* RepositoryFiles;
|
|
10206
10230
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10207
10231
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10240,12 +10264,12 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10240
10264
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10241
10265
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10242
10266
|
const workflows = yield* workflowText(root);
|
|
10243
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10267
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$17(root, directory, workflows), { concurrency: READ_CONCURRENCY$21 });
|
|
10244
10268
|
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
10245
10269
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10246
10270
|
});
|
|
10247
10271
|
// src/features/check-repository-layout/model/crates.ts
|
|
10248
|
-
const RULE$
|
|
10272
|
+
const RULE$46 = "unverified-crate";
|
|
10249
10273
|
const VERSION_RULE = "release-version";
|
|
10250
10274
|
const MANIFEST_FILE$1 = "package.json";
|
|
10251
10275
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
@@ -10259,7 +10283,7 @@ const problemFor$4 = (crate, message) => ({
|
|
|
10259
10283
|
file: crate.manifest,
|
|
10260
10284
|
line: FIRST$12,
|
|
10261
10285
|
column: FIRST$12,
|
|
10262
|
-
rule: RULE$
|
|
10286
|
+
rule: RULE$46,
|
|
10263
10287
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10264
10288
|
});
|
|
10265
10289
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10295,7 +10319,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10295
10319
|
return Array.getSomes(Array.flatten(found));
|
|
10296
10320
|
});
|
|
10297
10321
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10298
|
-
const RULE$
|
|
10322
|
+
const RULE$45 = "deploy-entry-pattern";
|
|
10299
10323
|
const FALLOW_KEYS = [
|
|
10300
10324
|
"entry",
|
|
10301
10325
|
"entryPoints",
|
|
@@ -10350,7 +10374,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10350
10374
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10351
10375
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10352
10376
|
});
|
|
10353
|
-
const problemsIn$
|
|
10377
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10354
10378
|
const { root, file, kind, workspaces, entries } = request;
|
|
10355
10379
|
const files = yield* RepositoryFiles;
|
|
10356
10380
|
const path = files.join(root, file);
|
|
@@ -10366,7 +10390,7 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10366
10390
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10367
10391
|
file: path,
|
|
10368
10392
|
...positionOf(text.value)(start - kind.offset),
|
|
10369
|
-
rule: RULE$
|
|
10393
|
+
rule: RULE$45,
|
|
10370
10394
|
message: `${pattern} ${MESSAGE$12}`
|
|
10371
10395
|
})));
|
|
10372
10396
|
});
|
|
@@ -10389,7 +10413,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10389
10413
|
}];
|
|
10390
10414
|
return [];
|
|
10391
10415
|
}));
|
|
10392
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10416
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$16({
|
|
10393
10417
|
root,
|
|
10394
10418
|
file,
|
|
10395
10419
|
kind,
|
|
@@ -10399,7 +10423,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10399
10423
|
return Array.flatten(found);
|
|
10400
10424
|
});
|
|
10401
10425
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10402
|
-
const RULE$
|
|
10426
|
+
const RULE$44 = "listed-entry";
|
|
10403
10427
|
const ENTRY_KEYS = [
|
|
10404
10428
|
"entry",
|
|
10405
10429
|
"entryPoints",
|
|
@@ -10420,7 +10444,7 @@ const entryPatternsIn = (node) => {
|
|
|
10420
10444
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10421
10445
|
};
|
|
10422
10446
|
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
|
|
10423
|
-
const problemsIn$
|
|
10447
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10424
10448
|
const files = yield* RepositoryFiles;
|
|
10425
10449
|
const path = files.join(root, file);
|
|
10426
10450
|
const text = yield* files.readFile(path);
|
|
@@ -10429,7 +10453,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10429
10453
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10430
10454
|
file: path,
|
|
10431
10455
|
...positionOf(text.value)(start),
|
|
10432
|
-
rule: RULE$
|
|
10456
|
+
rule: RULE$44,
|
|
10433
10457
|
message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`
|
|
10434
10458
|
})));
|
|
10435
10459
|
});
|
|
@@ -10437,11 +10461,11 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10437
10461
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10438
10462
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10439
10463
|
const directories = yield* workspaceDirectories(root);
|
|
10440
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10464
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$15(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
|
|
10441
10465
|
return Array.flatten(found);
|
|
10442
10466
|
});
|
|
10443
10467
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10444
|
-
const RULE$
|
|
10468
|
+
const RULE$43 = "root-workspace-path";
|
|
10445
10469
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10446
10470
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10447
10471
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -10457,10 +10481,10 @@ const mentions = (directory) => (text) => {
|
|
|
10457
10481
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10458
10482
|
}));
|
|
10459
10483
|
};
|
|
10460
|
-
const problemsIn$
|
|
10484
|
+
const problemsIn$14 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10461
10485
|
file,
|
|
10462
10486
|
...positionOf(source)(found.start),
|
|
10463
|
-
rule: RULE$
|
|
10487
|
+
rule: RULE$43,
|
|
10464
10488
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
10465
10489
|
})));
|
|
10466
10490
|
/** @internal */
|
|
@@ -10471,10 +10495,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10471
10495
|
if (Option.isNone(source)) return [];
|
|
10472
10496
|
const directories = yield* workspaceDirectories(root);
|
|
10473
10497
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10474
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10498
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$14(file, source.value, directories)));
|
|
10475
10499
|
});
|
|
10476
10500
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10477
|
-
const RULE$
|
|
10501
|
+
const RULE$42 = "hidden-verify";
|
|
10478
10502
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10479
10503
|
const FIRST$10 = 1;
|
|
10480
10504
|
const READ_CONCURRENCY$17 = 8;
|
|
@@ -10488,7 +10512,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10488
10512
|
file,
|
|
10489
10513
|
line: FIRST$10,
|
|
10490
10514
|
column: FIRST$10,
|
|
10491
|
-
rule: RULE$
|
|
10515
|
+
rule: RULE$42,
|
|
10492
10516
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
10493
10517
|
}).pipe(Option.filter(() => verified));
|
|
10494
10518
|
});
|
|
@@ -10499,7 +10523,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
10499
10523
|
return Array.getSomes(found);
|
|
10500
10524
|
});
|
|
10501
10525
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10502
|
-
const RULE$
|
|
10526
|
+
const RULE$41 = "shared-uncached-task";
|
|
10503
10527
|
const READ_CONCURRENCY$16 = 8;
|
|
10504
10528
|
const SHARED = 2;
|
|
10505
10529
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -10542,7 +10566,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
10542
10566
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10543
10567
|
file,
|
|
10544
10568
|
...position,
|
|
10545
|
-
rule: RULE$
|
|
10569
|
+
rule: RULE$41,
|
|
10546
10570
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
|
|
10547
10571
|
})));
|
|
10548
10572
|
};
|
|
@@ -10553,7 +10577,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
10553
10577
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10554
10578
|
});
|
|
10555
10579
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10556
|
-
const RULE$
|
|
10580
|
+
const RULE$40 = "unlocked-task";
|
|
10557
10581
|
const READ_CONCURRENCY$15 = 8;
|
|
10558
10582
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10559
10583
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -10565,7 +10589,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10565
10589
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10566
10590
|
file,
|
|
10567
10591
|
...positionOf(source)(task.start),
|
|
10568
|
-
rule: RULE$
|
|
10592
|
+
rule: RULE$40,
|
|
10569
10593
|
message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
|
|
10570
10594
|
})), Option.toArray)));
|
|
10571
10595
|
/** @internal */
|
|
@@ -10720,7 +10744,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10720
10744
|
/** @internal */
|
|
10721
10745
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10722
10746
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10723
|
-
const RULE$
|
|
10747
|
+
const RULE$39 = "workflow-path";
|
|
10724
10748
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10725
10749
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10726
10750
|
const READ_CONCURRENCY$14 = 8;
|
|
@@ -10786,10 +10810,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10786
10810
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10787
10811
|
file,
|
|
10788
10812
|
...positionOf(source)(found.offset),
|
|
10789
|
-
rule: RULE$
|
|
10813
|
+
rule: RULE$39,
|
|
10790
10814
|
message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`
|
|
10791
10815
|
});
|
|
10792
|
-
const problemsIn$
|
|
10816
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10793
10817
|
const files = yield* RepositoryFiles;
|
|
10794
10818
|
const file = files.join(root, workflow);
|
|
10795
10819
|
const source = yield* files.readFile(file);
|
|
@@ -10801,7 +10825,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10801
10825
|
/** @internal */
|
|
10802
10826
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10803
10827
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10804
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10828
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$14 });
|
|
10805
10829
|
return Array.flatten(found);
|
|
10806
10830
|
});
|
|
10807
10831
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10812,7 +10836,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10812
10836
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10813
10837
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10814
10838
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10815
|
-
const START$
|
|
10839
|
+
const START$21 = 0;
|
|
10816
10840
|
const READ_CONCURRENCY$13 = 8;
|
|
10817
10841
|
const SEPARATOR$8 = "/";
|
|
10818
10842
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
@@ -10820,7 +10844,7 @@ const SPACE = " ";
|
|
|
10820
10844
|
const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
|
|
10821
10845
|
const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
|
|
10822
10846
|
const keysOf$1 = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
|
|
10823
|
-
const problemAt$
|
|
10847
|
+
const problemAt$5 = ({ file, source }, rule, message) => (offset) => ({
|
|
10824
10848
|
file,
|
|
10825
10849
|
...positionOf(source)(offset),
|
|
10826
10850
|
rule,
|
|
@@ -10830,7 +10854,7 @@ const pathFiltersIn = (file, source) => {
|
|
|
10830
10854
|
const root = parseDocument(source).contents;
|
|
10831
10855
|
const triggers = pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf$1(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
|
|
10832
10856
|
const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
|
|
10833
|
-
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$
|
|
10857
|
+
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$5({
|
|
10834
10858
|
file,
|
|
10835
10859
|
source
|
|
10836
10860
|
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
@@ -10843,7 +10867,7 @@ const namesIn$1 = (name, source) => {
|
|
|
10843
10867
|
return [
|
|
10844
10868
|
{
|
|
10845
10869
|
text: name,
|
|
10846
|
-
offset: START$
|
|
10870
|
+
offset: START$21
|
|
10847
10871
|
},
|
|
10848
10872
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10849
10873
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10853,7 +10877,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, off
|
|
|
10853
10877
|
text: value,
|
|
10854
10878
|
offset
|
|
10855
10879
|
})))));
|
|
10856
|
-
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$
|
|
10880
|
+
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$5(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
|
|
10857
10881
|
const packagesIn = (workspaces, { file, name, source }) => {
|
|
10858
10882
|
const where = {
|
|
10859
10883
|
file,
|
|
@@ -10875,13 +10899,12 @@ const actionProblems = (workspaces, file, name) => pipe(named$1(workspaces, name
|
|
|
10875
10899
|
rule: PACKAGE,
|
|
10876
10900
|
message: packageMessage(`The action ${name}`, directory)
|
|
10877
10901
|
})), Option.toArray);
|
|
10878
|
-
const groupOf$1 = (pattern, name) => pipe(String$1.match(pattern)(name), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups["name"])));
|
|
10879
10902
|
/** @internal */
|
|
10880
10903
|
const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkflowScale(root) {
|
|
10881
10904
|
const files = yield* RepositoryFiles;
|
|
10882
10905
|
const listed = yield* files.listedFiles(root);
|
|
10883
10906
|
const workspaces = yield* namedWorkspaces(root);
|
|
10884
|
-
const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf
|
|
10907
|
+
const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf("name")(WORKFLOW.exec(name)), Option.map((stem) => ({
|
|
10885
10908
|
name,
|
|
10886
10909
|
stem
|
|
10887
10910
|
})), Option.toArray)));
|
|
@@ -10894,7 +10917,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10894
10917
|
source: text
|
|
10895
10918
|
})]), Option.getOrElse(() => []));
|
|
10896
10919
|
}), { concurrency: READ_CONCURRENCY$13 });
|
|
10897
|
-
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf
|
|
10920
|
+
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf("name")(ACTION.exec(name)), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10898
10921
|
return [...Array.flatten(found), ...actions];
|
|
10899
10922
|
});
|
|
10900
10923
|
// src/features/check-repository-layout/model/workspace-checks.ts
|
|
@@ -10912,6 +10935,9 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10912
10935
|
], { concurrency: "unbounded" });
|
|
10913
10936
|
return Array.flatten(found);
|
|
10914
10937
|
});
|
|
10938
|
+
// src/shared/lib/keys.ts
|
|
10939
|
+
/** @internal */
|
|
10940
|
+
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
10915
10941
|
// src/shared/lib/package-name.ts
|
|
10916
10942
|
const SCOPE$2 = "@";
|
|
10917
10943
|
const SEPARATOR$7 = "/";
|
|
@@ -10969,7 +10995,7 @@ const localFile = Effect.fn("localFile")(function* localFile({ directory, import
|
|
|
10969
10995
|
if (Option.isNone(target)) return Option.none();
|
|
10970
10996
|
return yield* existingSource(files.resolve(directory, target.value));
|
|
10971
10997
|
});
|
|
10972
|
-
const referenceOf$
|
|
10998
|
+
const referenceOf$3 = (graph, from, specifier) => {
|
|
10973
10999
|
if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT$1)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
|
|
10974
11000
|
const name = packageNameOf(specifier);
|
|
10975
11001
|
return Effect.succeedSome(Result.fail(name));
|
|
@@ -10980,7 +11006,7 @@ const referencesIn$2 = Effect.fn("referencesIn")(function* referencesIn(graph, f
|
|
|
10980
11006
|
onNone: () => [],
|
|
10981
11007
|
onSome: (source) => specifiersIn(graph.api, file, source)
|
|
10982
11008
|
});
|
|
10983
|
-
const references = yield* Effect.forEach(specifiers, (specifier) => referenceOf$
|
|
11009
|
+
const references = yield* Effect.forEach(specifiers, (specifier) => referenceOf$3(graph, file, specifier), { concurrency: 1 });
|
|
10984
11010
|
const found = Array.getSomes(references);
|
|
10985
11011
|
return {
|
|
10986
11012
|
packages: Array.getFailures(found),
|
|
@@ -11027,8 +11053,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
11027
11053
|
peerDependencies: DependencyMap,
|
|
11028
11054
|
peerDependenciesMeta: PeerMeta
|
|
11029
11055
|
});
|
|
11030
|
-
const decodeManifest$
|
|
11031
|
-
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11056
|
+
const decodeManifest$4 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11032
11057
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11033
11058
|
const installedNames = (manifest) => [
|
|
11034
11059
|
...keysOf(manifest.dependencies),
|
|
@@ -11038,7 +11063,7 @@ const installedNames = (manifest) => [
|
|
|
11038
11063
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11039
11064
|
const files = yield* RepositoryFiles;
|
|
11040
11065
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11041
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11066
|
+
return pipe(text, Option.flatMap(decodeManifest$4), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11042
11067
|
});
|
|
11043
11068
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11044
11069
|
const files = yield* RepositoryFiles;
|
|
@@ -11100,11 +11125,11 @@ const LISTED_LARGEST = 5;
|
|
|
11100
11125
|
const SIZE_CONCURRENCY = 32;
|
|
11101
11126
|
const MEGABYTE = 1e6;
|
|
11102
11127
|
const MEGABYTE_DIGITS = 1;
|
|
11103
|
-
const START$
|
|
11128
|
+
const START$20 = 0;
|
|
11104
11129
|
const SINGLE_ENTRY = 1;
|
|
11105
11130
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11106
11131
|
const usageHint = (dependency, entryCount) => {
|
|
11107
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11132
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$20 && dependency.entries.length < entryCount)) return "";
|
|
11108
11133
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11109
11134
|
};
|
|
11110
11135
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11113,7 +11138,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11113
11138
|
const { workspace, total } = overrun;
|
|
11114
11139
|
const config = yield* files.readFile(workspace.configFile);
|
|
11115
11140
|
const source = Option.getOrElse(config, () => "");
|
|
11116
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11141
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$20);
|
|
11117
11142
|
return {
|
|
11118
11143
|
file: workspace.configFile,
|
|
11119
11144
|
...positionOf(source)(index),
|
|
@@ -11130,7 +11155,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11130
11155
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11131
11156
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11132
11157
|
const sizes = HashMap.fromIterable(measured);
|
|
11133
|
-
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11158
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$20)), Number$1.sumAll);
|
|
11134
11159
|
return {
|
|
11135
11160
|
closures,
|
|
11136
11161
|
sizeOf,
|
|
@@ -11163,11 +11188,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11163
11188
|
})];
|
|
11164
11189
|
});
|
|
11165
11190
|
const stackProblems = (file, source, dependencies) => {
|
|
11166
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
11191
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$20);
|
|
11167
11192
|
const rest = String$1.slice(section)(source);
|
|
11168
11193
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11169
11194
|
file,
|
|
11170
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11195
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
|
|
11171
11196
|
rule: STACK_DEPENDENCY,
|
|
11172
11197
|
message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
|
|
11173
11198
|
})));
|
|
@@ -11302,16 +11327,15 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
|
|
|
11302
11327
|
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11303
11328
|
});
|
|
11304
11329
|
// src/features/check-tree-shaking/model/manifest.ts
|
|
11305
|
-
const Manifest$
|
|
11330
|
+
const Manifest$3 = Schema.Struct({
|
|
11306
11331
|
name: Schema.optional(Schema.String),
|
|
11307
11332
|
exports: Schema.optional(Schema.Unknown),
|
|
11308
11333
|
bin: Schema.optional(Schema.Unknown),
|
|
11309
11334
|
sideEffects: Schema.optional(Schema.Unknown),
|
|
11310
11335
|
dependencies: Schema.optional(Schema.Record(Schema.String, Schema.String))
|
|
11311
11336
|
});
|
|
11312
|
-
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$
|
|
11337
|
+
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$3));
|
|
11313
11338
|
const manifestOf$1 = (text) => decode(text);
|
|
11314
|
-
const dependencyNames = (manifest) => pipe(Option.fromUndefinedOr(manifest.dependencies), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11315
11339
|
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
11316
11340
|
const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
|
|
11317
11341
|
const listedSources = (declared, { workspace, join }) => new Set(pipe(declared, Array.flatMap((target) => Array.append(sourcesOf$1(workspace, target), join(target)))));
|
|
@@ -11337,19 +11361,19 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11337
11361
|
};
|
|
11338
11362
|
};
|
|
11339
11363
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11340
|
-
const RULE$
|
|
11341
|
-
const START$
|
|
11364
|
+
const RULE$38 = "optional-peer";
|
|
11365
|
+
const START$19 = 0;
|
|
11342
11366
|
const SINGLE = 1;
|
|
11343
11367
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11344
11368
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11345
11369
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11346
11370
|
const problemFor$3 = (located, name, importers) => {
|
|
11347
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$
|
|
11371
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(located.source), () => START$19);
|
|
11348
11372
|
const rest = String$1.slice(section)(located.source);
|
|
11349
11373
|
return {
|
|
11350
11374
|
file: located.file,
|
|
11351
|
-
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11352
|
-
rule: RULE$
|
|
11375
|
+
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
|
|
11376
|
+
rule: RULE$38,
|
|
11353
11377
|
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
11354
11378
|
};
|
|
11355
11379
|
};
|
|
@@ -11357,17 +11381,17 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11357
11381
|
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
11358
11382
|
const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
|
|
11359
11383
|
if (libraries.length <= SINGLE) return [];
|
|
11360
|
-
return pipe(dependencies, Array.flatMap((name) => {
|
|
11384
|
+
return pipe(keysOf(dependencies), Array.flatMap((name) => {
|
|
11361
11385
|
const importers = pipe(libraries, Array.filter(importsPackage(name)));
|
|
11362
11386
|
const neededByBin = pipe(bins, Array.some(importsPackage(name)));
|
|
11363
|
-
if (!(importers.length > START$
|
|
11387
|
+
if (!(importers.length > START$19 && importers.length < libraries.length) || neededByBin) return [];
|
|
11364
11388
|
return [problemFor$3(located, name, importers)];
|
|
11365
11389
|
}));
|
|
11366
11390
|
};
|
|
11367
11391
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11368
|
-
const RULE$
|
|
11392
|
+
const RULE$37 = "side-effects";
|
|
11369
11393
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11370
|
-
const START$
|
|
11394
|
+
const START$18 = 0;
|
|
11371
11395
|
const FIRST$8 = 1;
|
|
11372
11396
|
const LISTED_PACKAGES = 4;
|
|
11373
11397
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
@@ -11391,7 +11415,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
11391
11415
|
label: entry.label,
|
|
11392
11416
|
member,
|
|
11393
11417
|
...extra
|
|
11394
|
-
}, ({ modules }) => modules > START$
|
|
11418
|
+
}, ({ modules }) => modules > START$18);
|
|
11395
11419
|
});
|
|
11396
11420
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
11397
11421
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -11413,15 +11437,15 @@ const othersOf = (total) => {
|
|
|
11413
11437
|
};
|
|
11414
11438
|
const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
11415
11439
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
11416
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
11440
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$18));
|
|
11417
11441
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11418
11442
|
file,
|
|
11419
11443
|
...positionOf(source)(keyIndex$1(source)),
|
|
11420
|
-
rule: RULE$
|
|
11444
|
+
rule: RULE$37,
|
|
11421
11445
|
message: messageOf$4(worst, excesses.length)
|
|
11422
11446
|
})), Option.toArray);
|
|
11423
11447
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11424
|
-
const RULE$
|
|
11448
|
+
const RULE$36 = "top-level-effect";
|
|
11425
11449
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11426
11450
|
const READ_CONCURRENCY$12 = 16;
|
|
11427
11451
|
const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
|
|
@@ -11434,10 +11458,10 @@ const messageOf$3 = (statement) => {
|
|
|
11434
11458
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
11435
11459
|
return STATEMENT_MESSAGE;
|
|
11436
11460
|
};
|
|
11437
|
-
const problemsIn$
|
|
11461
|
+
const problemsIn$12 = (api) => (file) => (source) => {
|
|
11438
11462
|
const retained = api.createSourceFile(file, source);
|
|
11439
|
-
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$
|
|
11440
|
-
rule: RULE$
|
|
11463
|
+
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$7({
|
|
11464
|
+
rule: RULE$36,
|
|
11441
11465
|
message: messageOf$3(statement)
|
|
11442
11466
|
})(statement)));
|
|
11443
11467
|
retained.dispose();
|
|
@@ -11450,7 +11474,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11450
11474
|
const names = yield* files.ownedFiles(root);
|
|
11451
11475
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11452
11476
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11453
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
11477
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$12(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$12 });
|
|
11454
11478
|
return Array.flatten(found);
|
|
11455
11479
|
}, Effect.scoped);
|
|
11456
11480
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11531,7 +11555,7 @@ const analyse = Effect.fn("analyse")(function* analyse(pack) {
|
|
|
11531
11555
|
...effects,
|
|
11532
11556
|
...optionalPeerProblems({
|
|
11533
11557
|
located,
|
|
11534
|
-
dependencies:
|
|
11558
|
+
dependencies: manifest.dependencies,
|
|
11535
11559
|
used
|
|
11536
11560
|
})
|
|
11537
11561
|
];
|
|
@@ -11561,7 +11585,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11561
11585
|
return Array.flatten(found);
|
|
11562
11586
|
});
|
|
11563
11587
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11564
|
-
const RULE$
|
|
11588
|
+
const RULE$35 = "legacy-typescript";
|
|
11565
11589
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11566
11590
|
const COMPILER = "typescript";
|
|
11567
11591
|
const CURRENT_MAJOR = 7;
|
|
@@ -11592,12 +11616,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11592
11616
|
file,
|
|
11593
11617
|
line: lineOf$2(source)(legacy.id),
|
|
11594
11618
|
column: FIRST$7,
|
|
11595
|
-
rule: RULE$
|
|
11619
|
+
rule: RULE$35,
|
|
11596
11620
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11597
11621
|
})));
|
|
11598
11622
|
});
|
|
11599
11623
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11600
|
-
const RULE$
|
|
11624
|
+
const RULE$34 = "worker-bundle";
|
|
11601
11625
|
const BUNDLE_CONCURRENCY = 4;
|
|
11602
11626
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11603
11627
|
const CONDITIONS = [
|
|
@@ -11608,7 +11632,7 @@ const CONDITIONS = [
|
|
|
11608
11632
|
"module",
|
|
11609
11633
|
"default"
|
|
11610
11634
|
];
|
|
11611
|
-
const problemFor$2 = problemInFile(RULE$
|
|
11635
|
+
const problemFor$2 = problemInFile(RULE$34);
|
|
11612
11636
|
const problemOf$6 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11613
11637
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11614
11638
|
const built = yield* Effect.tryPromise({
|
|
@@ -11690,8 +11714,10 @@ const slotTarget = (context) => (expression) => slotOf(context.checker)(expressi
|
|
|
11690
11714
|
}));
|
|
11691
11715
|
const libraryTargetOf = (context) => (expression, contextual) => aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));
|
|
11692
11716
|
const siteWithin = (context) => (node) => Array.findFirst(context.sites, (site) => contains(node)(site.node));
|
|
11693
|
-
const
|
|
11694
|
-
const
|
|
11717
|
+
const aliasDeclarationOf = (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => Array.findFirst(declarationsOf(alias), isTypeAliasDeclaration)));
|
|
11718
|
+
const aliasSite = (context) => (type) => Option.flatMap(aliasDeclarationOf(type), siteWithin(context));
|
|
11719
|
+
const annotationAt = (checker) => (expression) => symbolAt(checker)(expression).pipe(Option.flatMap((symbol) => Option.fromUndefinedOr(symbol.valueDeclaration)), Option.flatMap((handle) => Option.fromUndefinedOr(handle.resolve())), Option.flatMap(annotationOf));
|
|
11720
|
+
const annotationSite = (context) => (expression) => annotationAt(context.checker)(expression).pipe(Option.flatMap((annotation) => siteWithin(context)(annotation).pipe(Option.orElse(() => aliasSite(context)(context.checker.getTypeFromTypeNode(annotation))))));
|
|
11695
11721
|
const siteBehind = (context) => (expression) => aliasSite(context)(context.checker.getTypeAtLocation(expression)).pipe(Option.orElse(() => annotationSite(context)(expression)));
|
|
11696
11722
|
const isFlowSource = (node) => isIdentifier(node) || isPropertyAccessExpression(node) || isElementAccessExpression(node);
|
|
11697
11723
|
const flowOf = (context) => (expression) => Option.fromUndefinedOr(context.checker.getContextualType(expression)).pipe(Option.flatMap((contextual) => Option.all([vocabularyOf(context.checker)(contextual), libraryTargetOf(context)(expression, contextual)])), Option.flatMap(([vocabulary, target]) => siteBehind(context)(expression).pipe(Option.filter((site) => isSubsetOf(site.values, vocabulary.values)), Option.map((site) => ({
|
|
@@ -11730,7 +11756,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11730
11756
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11731
11757
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11732
11758
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11733
|
-
const RULE$
|
|
11759
|
+
const RULE$33 = "hand-written-names";
|
|
11734
11760
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11735
11761
|
const nameListOf = (site) => {
|
|
11736
11762
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11745,7 +11771,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11745
11771
|
file,
|
|
11746
11772
|
line,
|
|
11747
11773
|
column,
|
|
11748
|
-
rule: RULE$
|
|
11774
|
+
rule: RULE$33,
|
|
11749
11775
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11750
11776
|
});
|
|
11751
11777
|
const problemOf$5 = ({ list, reason }) => listedProblem({
|
|
@@ -11818,7 +11844,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
11818
11844
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
11819
11845
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
11820
11846
|
};
|
|
11821
|
-
const annotationProblem = (message) => problemAt$
|
|
11847
|
+
const annotationProblem = (message) => problemAt$7({
|
|
11822
11848
|
rule: "owner-annotation",
|
|
11823
11849
|
message
|
|
11824
11850
|
});
|
|
@@ -11954,7 +11980,7 @@ const shapeProblem = (site, matches) => {
|
|
|
11954
11980
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
11955
11981
|
onSome: () => "Use the library type instead of copying it."
|
|
11956
11982
|
});
|
|
11957
|
-
return problemAt$
|
|
11983
|
+
return problemAt$7({
|
|
11958
11984
|
rule: "library-shape",
|
|
11959
11985
|
message: `This shape copies ${shown}. ${advice}`
|
|
11960
11986
|
})(site.node);
|
|
@@ -12002,14 +12028,10 @@ const selectsKeys = (checker) => (node, values) => {
|
|
|
12002
12028
|
return pipe(typeArguments, Array.filter((argument) => argument !== node), Array.some((argument) => isSubsetOf(values, propertyNamesOf(checker)(checker.getTypeFromTypeNode(argument)))));
|
|
12003
12029
|
};
|
|
12004
12030
|
const FILTERED_TYPE = 0;
|
|
12005
|
-
const isConditionalAlias = (
|
|
12031
|
+
const isConditionalAlias = (declaration) => isTypeAliasDeclaration(declaration) && declaration.type.kind === SyntaxKind.ConditionalType;
|
|
12006
12032
|
const filtersBy = (checker) => (node) => {
|
|
12007
12033
|
const { parent } = node;
|
|
12008
|
-
|
|
12009
|
-
const typeArguments = parent.typeArguments ?? [];
|
|
12010
|
-
if (Array.findFirstIndex(typeArguments, (argument) => argument === node).pipe(Option.exists((position) => position > FILTERED_TYPE)) && isConditionalAlias(checker)(parent)) return true;
|
|
12011
|
-
}
|
|
12012
|
-
return parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent);
|
|
12034
|
+
return isTypeReferenceNode(parent) && Array.findFirstIndex(parent.typeArguments ?? [], (argument) => argument === node).pipe(Option.exists((position) => position > FILTERED_TYPE)) && symbolAtLocation(checker)(parent.typeName).pipe(Option.map(declarationsOf), Option.exists(Array.some(isConditionalAlias))) || parent.kind !== SyntaxKind.SourceFile && filtersBy(checker)(parent);
|
|
12013
12035
|
};
|
|
12014
12036
|
const unionValuesOf = (checker) => (node) => literalUnionOf(checker.getTypeFromTypeNode(node)).pipe(Option.filter((values) => !selectsKeys(checker)(node, values) && !filtersBy(checker)(node)));
|
|
12015
12037
|
const isExpressionSite = (node) => isArrayLiteralExpression(node) || isCallExpression(node);
|
|
@@ -12059,7 +12081,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
12059
12081
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
12060
12082
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
12061
12083
|
const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;
|
|
12062
|
-
return verdict([problemAt$
|
|
12084
|
+
return verdict([problemAt$7({
|
|
12063
12085
|
rule: "owner-extension",
|
|
12064
12086
|
message
|
|
12065
12087
|
})(site.node)], []);
|
|
@@ -12081,7 +12103,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
12081
12103
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
12082
12104
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
12083
12105
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
12084
|
-
return verdict([problemAt$
|
|
12106
|
+
return verdict([problemAt$7({
|
|
12085
12107
|
rule: "owner-value-set",
|
|
12086
12108
|
message
|
|
12087
12109
|
})(site.node)], []);
|
|
@@ -12089,7 +12111,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
12089
12111
|
const candidates = libraryCandidates(context)(site);
|
|
12090
12112
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
12091
12113
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
12092
|
-
return verdict([problemAt$
|
|
12114
|
+
return verdict([problemAt$7({
|
|
12093
12115
|
rule: "library-value-set",
|
|
12094
12116
|
message
|
|
12095
12117
|
})(site.node)], []);
|
|
@@ -12120,7 +12142,7 @@ const isValuePosition = (node) => {
|
|
|
12120
12142
|
const { parent } = node;
|
|
12121
12143
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
12122
12144
|
};
|
|
12123
|
-
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$
|
|
12145
|
+
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$7({
|
|
12124
12146
|
rule: "owned-literal",
|
|
12125
12147
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
12126
12148
|
})(literal)));
|
|
@@ -12411,30 +12433,32 @@ const subsetListProblem = ({ lists, literals, relative }) => {
|
|
|
12411
12433
|
const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
|
|
12412
12434
|
const lists = pipe(sites, Array.dedupeWith((left, right) => left.file === right.file && left.start === right.start), Array.map(nameListOf), Array.getSomes);
|
|
12413
12435
|
const { relative } = repository;
|
|
12414
|
-
const
|
|
12415
|
-
|
|
12416
|
-
|
|
12417
|
-
|
|
12418
|
-
|
|
12419
|
-
|
|
12420
|
-
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
|
|
12424
|
-
|
|
12436
|
+
const checks = [
|
|
12437
|
+
listedPathProblem(repository),
|
|
12438
|
+
declaredNameProblem({
|
|
12439
|
+
literals,
|
|
12440
|
+
relative
|
|
12441
|
+
}),
|
|
12442
|
+
subsetListProblem({
|
|
12443
|
+
lists,
|
|
12444
|
+
literals,
|
|
12445
|
+
relative
|
|
12446
|
+
})
|
|
12447
|
+
];
|
|
12448
|
+
return pipe(lists, Array.map((list) => Array.findFirst(checks, (check) => check(list))), Array.getSomes);
|
|
12425
12449
|
};
|
|
12426
12450
|
// src/features/check-value-owners/model/repository-names.ts
|
|
12427
12451
|
const MANIFEST$3 = "package.json";
|
|
12428
12452
|
const SEPARATOR$5 = "/";
|
|
12429
12453
|
const FIRST_SEGMENT = 1;
|
|
12430
12454
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12431
|
-
const decodeManifest$
|
|
12455
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(ManifestJson);
|
|
12432
12456
|
const prefixesOf = (file) => {
|
|
12433
12457
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12434
12458
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12435
12459
|
};
|
|
12436
12460
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12437
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12461
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$3), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12438
12462
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12439
12463
|
const files = yield* RepositoryFiles;
|
|
12440
12464
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12546,7 +12570,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12546
12570
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12547
12571
|
}, Effect.scoped);
|
|
12548
12572
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12549
|
-
const RULE$
|
|
12573
|
+
const RULE$32 = "namespace-destructuring";
|
|
12550
12574
|
const LOCAL = /^[.#/]/u;
|
|
12551
12575
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
12552
12576
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12561,8 +12585,8 @@ const destructuredName = (declaration) => {
|
|
|
12561
12585
|
if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
|
|
12562
12586
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12563
12587
|
};
|
|
12564
|
-
const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$
|
|
12565
|
-
rule: RULE$
|
|
12588
|
+
const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
12589
|
+
rule: RULE$32,
|
|
12566
12590
|
message: messageOf$1(name)
|
|
12567
12591
|
})), Option.map((report) => report(declaration)));
|
|
12568
12592
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12570,7 +12594,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12570
12594
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$4(names)), Array.getSomes);
|
|
12571
12595
|
};
|
|
12572
12596
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12573
|
-
const RULE$
|
|
12597
|
+
const RULE$31 = "pass-through-wrapper";
|
|
12574
12598
|
const SINGLE_STATEMENT = 1;
|
|
12575
12599
|
const SINGLE_DECLARATION = 1;
|
|
12576
12600
|
const THIS_PARAMETER = "this";
|
|
@@ -12666,8 +12690,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12666
12690
|
};
|
|
12667
12691
|
const problemOf$3 = (checker) => (candidate) => {
|
|
12668
12692
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12669
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
12670
|
-
rule: RULE$
|
|
12693
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
12694
|
+
rule: RULE$31,
|
|
12671
12695
|
message: messageOf(forward.callee.getText())
|
|
12672
12696
|
})(candidate.name)));
|
|
12673
12697
|
};
|
|
@@ -12693,7 +12717,7 @@ var plugins = [{
|
|
|
12693
12717
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12694
12718
|
}];
|
|
12695
12719
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12696
|
-
const RULE$
|
|
12720
|
+
const RULE$30 = "known-plugins";
|
|
12697
12721
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12698
12722
|
const GITHUB$2 = "github";
|
|
12699
12723
|
const Source$1 = Schema.Struct({
|
|
@@ -12711,7 +12735,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12711
12735
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12712
12736
|
const MARKETPLACE = name;
|
|
12713
12737
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12714
|
-
const problem$1 = problemInFile(RULE$
|
|
12738
|
+
const problem$1 = problemInFile(RULE$30);
|
|
12715
12739
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12716
12740
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12717
12741
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12732,20 +12756,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12732
12756
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12733
12757
|
});
|
|
12734
12758
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12735
|
-
const RULE$
|
|
12759
|
+
const RULE$29 = "missing-hook";
|
|
12736
12760
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12737
12761
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12738
12762
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12739
12763
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12740
12764
|
const PLUGIN_ROOT = "..";
|
|
12741
12765
|
const READ_CONCURRENCY$11 = 16;
|
|
12742
|
-
const START$
|
|
12743
|
-
const referenceOf$
|
|
12766
|
+
const START$17 = 0;
|
|
12767
|
+
const referenceOf$2 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
12744
12768
|
path,
|
|
12745
|
-
index: found.index ?? START$
|
|
12769
|
+
index: found.index ?? START$17
|
|
12746
12770
|
})), Option.toArray);
|
|
12747
|
-
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$
|
|
12748
|
-
const problemsIn$
|
|
12771
|
+
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$2));
|
|
12772
|
+
const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12749
12773
|
const files = yield* RepositoryFiles;
|
|
12750
12774
|
const text = yield* files.readFile(file);
|
|
12751
12775
|
if (Option.isNone(text)) return [];
|
|
@@ -12757,7 +12781,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12757
12781
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12758
12782
|
file,
|
|
12759
12783
|
...positionOf(source)(index),
|
|
12760
|
-
rule: RULE$
|
|
12784
|
+
rule: RULE$29,
|
|
12761
12785
|
message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
|
|
12762
12786
|
})));
|
|
12763
12787
|
});
|
|
@@ -12781,7 +12805,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12781
12805
|
}];
|
|
12782
12806
|
return [];
|
|
12783
12807
|
}));
|
|
12784
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12808
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$11 });
|
|
12785
12809
|
return Array.flatten(found);
|
|
12786
12810
|
});
|
|
12787
12811
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12810,7 +12834,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12810
12834
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12811
12835
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12812
12836
|
// src/features/check-documented-commands/model/commands.ts
|
|
12813
|
-
const RULE$
|
|
12837
|
+
const RULE$28 = "documented-commands";
|
|
12814
12838
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12815
12839
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12816
12840
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12829,7 +12853,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12829
12853
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12830
12854
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12831
12855
|
const ONE$1 = 1;
|
|
12832
|
-
const START$
|
|
12856
|
+
const START$16 = 0;
|
|
12833
12857
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12834
12858
|
const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
12835
12859
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12885,11 +12909,11 @@ const whereOf = (scope, file) => {
|
|
|
12885
12909
|
return `the package that holds ${file}`;
|
|
12886
12910
|
};
|
|
12887
12911
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12888
|
-
const problemsIn$
|
|
12912
|
+
const problemsIn$10 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12889
12913
|
file: absolute(file),
|
|
12890
|
-
...positionOf(text)(match.index ?? START$
|
|
12891
|
-
rule: RULE$
|
|
12892
|
-
message: `${match[START$
|
|
12914
|
+
...positionOf(text)(match.index ?? START$16),
|
|
12915
|
+
rule: RULE$28,
|
|
12916
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12893
12917
|
})), Option.toArray)));
|
|
12894
12918
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12895
12919
|
/** @internal */
|
|
@@ -12913,14 +12937,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12913
12937
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12914
12938
|
line: ONE$1,
|
|
12915
12939
|
column: ONE$1,
|
|
12916
|
-
rule: RULE$
|
|
12940
|
+
rule: RULE$28,
|
|
12917
12941
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12918
12942
|
}],
|
|
12919
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
12943
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12920
12944
|
});
|
|
12921
12945
|
});
|
|
12922
12946
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12923
|
-
const RULE$
|
|
12947
|
+
const RULE$27 = "legacy-web";
|
|
12924
12948
|
const FIRST_COLUMN$3 = 1;
|
|
12925
12949
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12926
12950
|
const Finding = Schema.Struct({
|
|
@@ -12959,7 +12983,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12959
12983
|
file: files.join(root, file),
|
|
12960
12984
|
line,
|
|
12961
12985
|
column: FIRST_COLUMN$3,
|
|
12962
|
-
rule: RULE$
|
|
12986
|
+
rule: RULE$27,
|
|
12963
12987
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12964
12988
|
});
|
|
12965
12989
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -13030,7 +13054,7 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
|
|
|
13030
13054
|
const EXTENSION = /\.[^./]+$/u;
|
|
13031
13055
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13032
13056
|
const READ_CONCURRENCY$10 = 64;
|
|
13033
|
-
const RULE$
|
|
13057
|
+
const RULE$26 = "shell-script";
|
|
13034
13058
|
const MESSAGE$11 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
13035
13059
|
const HookSchema = Schema.Struct({
|
|
13036
13060
|
command: Schema.optional(Schema.String),
|
|
@@ -13063,7 +13087,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13063
13087
|
};
|
|
13064
13088
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13065
13089
|
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
13066
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13090
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$26)(files.join(root, name), MESSAGE$11)));
|
|
13067
13091
|
});
|
|
13068
13092
|
// src/shared/lib/workflow-files.ts
|
|
13069
13093
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
@@ -13082,8 +13106,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13082
13106
|
});
|
|
13083
13107
|
// src/shared/lib/workflow-run.ts
|
|
13084
13108
|
const RUN_KEY = "run";
|
|
13085
|
-
const START$
|
|
13086
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
13109
|
+
const START$15 = 0;
|
|
13110
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
13087
13111
|
const runScriptsOf = (source) => {
|
|
13088
13112
|
const found = [];
|
|
13089
13113
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -13098,7 +13122,7 @@ const runScriptsOf = (source) => {
|
|
|
13098
13122
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13099
13123
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13100
13124
|
const COMMENT = "#";
|
|
13101
|
-
const RULE$
|
|
13125
|
+
const RULE$25 = "workflow-script";
|
|
13102
13126
|
const ONE_COMMAND = 1;
|
|
13103
13127
|
const MESSAGE$10 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
13104
13128
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -13107,14 +13131,14 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
13107
13131
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
13108
13132
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
13109
13133
|
};
|
|
13110
|
-
const problemsIn$
|
|
13134
|
+
const problemsIn$9 = (file) => (source) => {
|
|
13111
13135
|
const at = positionOf(source);
|
|
13112
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13136
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$25)(file, at(start), MESSAGE$10)));
|
|
13113
13137
|
};
|
|
13114
13138
|
/** @internal */
|
|
13115
13139
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
13116
13140
|
const workflows = yield* readWorkflows(root);
|
|
13117
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
13141
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$9(file)(source)));
|
|
13118
13142
|
});
|
|
13119
13143
|
// src/features/check-scripts/model/script-checks.ts
|
|
13120
13144
|
/** @internal */
|
|
@@ -13197,20 +13221,16 @@ const commandProblems$1 = (sources) => pipe(sources, Array.flatMap(problemsOf));
|
|
|
13197
13221
|
// src/features/check-vite-plus/model/doc-sources.ts
|
|
13198
13222
|
const FENCE = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \t]*\n)(?<body>[\s\S]*?)^```[ \t]*$/gmu;
|
|
13199
13223
|
const INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\n]+)`(?!`)/gu;
|
|
13200
|
-
const
|
|
13201
|
-
|
|
13202
|
-
|
|
13203
|
-
|
|
13204
|
-
|
|
13205
|
-
|
|
13206
|
-
|
|
13207
|
-
|
|
13208
|
-
|
|
13209
|
-
|
|
13210
|
-
start: index + open.length,
|
|
13211
|
-
end: index + whole.length
|
|
13212
|
-
})), Option.toArray);
|
|
13213
|
-
}));
|
|
13224
|
+
const codeIn = (pattern) => (source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => pipe(Option.all({
|
|
13225
|
+
open: groupOf("open")(match),
|
|
13226
|
+
text: groupOf("body")(match),
|
|
13227
|
+
whole: Array.head(match),
|
|
13228
|
+
index: Option.fromUndefinedOr(match.index)
|
|
13229
|
+
}), Option.map(({ open, text, whole, index }) => ({
|
|
13230
|
+
text,
|
|
13231
|
+
start: index + open.length,
|
|
13232
|
+
end: index + whole.length
|
|
13233
|
+
})), Option.toArray)));
|
|
13214
13234
|
const outside = (fences) => (span) => !pipe(fences, Array.some((fence) => span.start >= fence.start && span.start < fence.end));
|
|
13215
13235
|
const docSources = (file) => (source) => {
|
|
13216
13236
|
const fences = codeIn(FENCE)(source);
|
|
@@ -13224,27 +13244,27 @@ const docSources = (file) => (source) => {
|
|
|
13224
13244
|
})));
|
|
13225
13245
|
};
|
|
13226
13246
|
// src/features/check-vite-plus/model/command-sources.ts
|
|
13227
|
-
const ROOT_DIRECTORY$
|
|
13247
|
+
const ROOT_DIRECTORY$3 = ".";
|
|
13228
13248
|
const COMMAND_KEY = "command";
|
|
13229
13249
|
const ARGUMENTS_KEY = "args";
|
|
13230
|
-
const EXCLUDED$
|
|
13231
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
13250
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13251
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$4];
|
|
13232
13252
|
const STEP_FILES = [
|
|
13233
13253
|
":(glob).github/workflows/*.yml",
|
|
13234
13254
|
":(glob).github/workflows/*.yaml",
|
|
13235
13255
|
":(glob)**/action.yml",
|
|
13236
13256
|
":(glob)**/action.yaml",
|
|
13237
|
-
...EXCLUDED$
|
|
13257
|
+
...EXCLUDED$4
|
|
13238
13258
|
];
|
|
13239
13259
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
13240
13260
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
13241
13261
|
const AGENT_DOCS = [
|
|
13242
13262
|
":(glob)**/AGENTS.md",
|
|
13243
13263
|
":(glob)**/CLAUDE.md",
|
|
13244
|
-
...EXCLUDED$
|
|
13264
|
+
...EXCLUDED$4
|
|
13245
13265
|
];
|
|
13246
13266
|
const READ_CONCURRENCY$8 = 16;
|
|
13247
|
-
const START$
|
|
13267
|
+
const START$14 = 0;
|
|
13248
13268
|
const FIRST$5 = 1;
|
|
13249
13269
|
const LINE = "\n";
|
|
13250
13270
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -13254,7 +13274,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
13254
13274
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
13255
13275
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13256
13276
|
const NO_SOURCES = [];
|
|
13257
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
13277
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
13258
13278
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
13259
13279
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
13260
13280
|
return {
|
|
@@ -13345,12 +13365,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13345
13365
|
readSources(root, hooks, hookSources),
|
|
13346
13366
|
readSources(root, AGENT_FILES, agentSources),
|
|
13347
13367
|
readSources(root, docs, docSources),
|
|
13348
|
-
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$
|
|
13368
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$3, ...workspaces]))
|
|
13349
13369
|
], { concurrency: "unbounded" });
|
|
13350
13370
|
return Array.flatten(found);
|
|
13351
13371
|
});
|
|
13352
13372
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13353
|
-
const RULE$
|
|
13373
|
+
const RULE$24 = "package-script";
|
|
13354
13374
|
const LIFECYCLE = [
|
|
13355
13375
|
"preinstall",
|
|
13356
13376
|
"install",
|
|
@@ -13373,12 +13393,12 @@ const LIFECYCLE = [
|
|
|
13373
13393
|
const problemOf$2 = ({ file, position, name }) => ({
|
|
13374
13394
|
file,
|
|
13375
13395
|
...position,
|
|
13376
|
-
rule: RULE$
|
|
13396
|
+
rule: RULE$24,
|
|
13377
13397
|
message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
|
|
13378
13398
|
});
|
|
13379
13399
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$2));
|
|
13380
13400
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13381
|
-
const RULE$
|
|
13401
|
+
const RULE$23 = "vite-plus-block";
|
|
13382
13402
|
const MARKER = Array.join([
|
|
13383
13403
|
"<!--",
|
|
13384
13404
|
"VITE PLUS START",
|
|
@@ -13391,7 +13411,7 @@ const problemIn = (file) => (source) => {
|
|
|
13391
13411
|
return Option.some({
|
|
13392
13412
|
file,
|
|
13393
13413
|
...positionOf(source)(index.value),
|
|
13394
|
-
rule: RULE$
|
|
13414
|
+
rule: RULE$23,
|
|
13395
13415
|
message: MESSAGE$9
|
|
13396
13416
|
});
|
|
13397
13417
|
};
|
|
@@ -13447,7 +13467,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13447
13467
|
})
|
|
13448
13468
|
});
|
|
13449
13469
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13450
|
-
const RULE$
|
|
13470
|
+
const RULE$21 = "publish-trigger";
|
|
13451
13471
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13452
13472
|
const MANUAL = "workflow_dispatch";
|
|
13453
13473
|
const TRIGGER_KEY = "on";
|
|
@@ -13467,18 +13487,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13467
13487
|
};
|
|
13468
13488
|
/** @internal */
|
|
13469
13489
|
const checkPublishTrigger = workflowCheck({
|
|
13470
|
-
rule: RULE$
|
|
13490
|
+
rule: RULE$21,
|
|
13471
13491
|
message: MESSAGE$7,
|
|
13472
13492
|
offsetsOf: publishTriggerOffsetsOf
|
|
13473
13493
|
});
|
|
13474
13494
|
// src/features/check-workflows/model/release-please.ts
|
|
13475
|
-
const RULE$
|
|
13495
|
+
const RULE$20 = "release-please";
|
|
13476
13496
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13477
13497
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13478
13498
|
const FIRST$4 = 1;
|
|
13479
13499
|
const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
13480
13500
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13481
|
-
rule: RULE$
|
|
13501
|
+
rule: RULE$20,
|
|
13482
13502
|
message: MESSAGE$6,
|
|
13483
13503
|
offsetsOf: scalarKeyOffsets({
|
|
13484
13504
|
name: "uses",
|
|
@@ -13492,7 +13512,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13492
13512
|
file: files.join(root, name),
|
|
13493
13513
|
line: FIRST$4,
|
|
13494
13514
|
column: FIRST$4,
|
|
13495
|
-
rule: RULE$
|
|
13515
|
+
rule: RULE$20,
|
|
13496
13516
|
message: MESSAGE$6
|
|
13497
13517
|
})));
|
|
13498
13518
|
});
|
|
@@ -13504,17 +13524,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13504
13524
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13505
13525
|
const CONCURRENCY_KEY = "concurrency";
|
|
13506
13526
|
const QUEUE_KEY = "queue";
|
|
13507
|
-
const RULE$
|
|
13527
|
+
const RULE$19 = "workflow-queue";
|
|
13508
13528
|
const MESSAGE$5 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
13509
13529
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13510
13530
|
/** @internal */
|
|
13511
13531
|
const checkWorkflowQueues = workflowCheck({
|
|
13512
|
-
rule: RULE$
|
|
13532
|
+
rule: RULE$19,
|
|
13513
13533
|
message: MESSAGE$5,
|
|
13514
13534
|
offsetsOf: queueOffsetsOf
|
|
13515
13535
|
});
|
|
13516
13536
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13517
|
-
const RULE$
|
|
13537
|
+
const RULE$18 = "workflow-commit";
|
|
13518
13538
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13519
13539
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13520
13540
|
const MESSAGE$4 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
@@ -13522,7 +13542,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
13522
13542
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13523
13543
|
/** @internal */
|
|
13524
13544
|
const checkWorkflowCommits = workflowCheck({
|
|
13525
|
-
rule: RULE$
|
|
13545
|
+
rule: RULE$18,
|
|
13526
13546
|
message: MESSAGE$4,
|
|
13527
13547
|
offsetsOf: commitOffsetsOf
|
|
13528
13548
|
});
|
|
@@ -13633,7 +13653,7 @@ const COMMENT_NODES = [
|
|
|
13633
13653
|
"block_comment",
|
|
13634
13654
|
"multiline_comment"
|
|
13635
13655
|
];
|
|
13636
|
-
const START$
|
|
13656
|
+
const START$13 = 0;
|
|
13637
13657
|
const NEXT = 1;
|
|
13638
13658
|
const NONE = [];
|
|
13639
13659
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13649,7 +13669,7 @@ const loadGrammars = Effect.fn("loadGrammars")(function* loadGrammars() {
|
|
|
13649
13669
|
const commentNodesIn = (language, source) => pipe(readTree({
|
|
13650
13670
|
language,
|
|
13651
13671
|
source,
|
|
13652
|
-
read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.
|
|
13672
|
+
read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.filter(Predicate.isNotNullish), Array.map((node) => ({
|
|
13653
13673
|
index: node.startIndex,
|
|
13654
13674
|
text: node.text
|
|
13655
13675
|
})))
|
|
@@ -13666,11 +13686,11 @@ const scriptGrammar = (attribs) => {
|
|
|
13666
13686
|
if (SHADER_TYPE.test(type)) return Option.some("cpp");
|
|
13667
13687
|
return Option.liftPredicate("javascript", () => SCRIPT_TYPE.test(type));
|
|
13668
13688
|
};
|
|
13669
|
-
const
|
|
13670
|
-
|
|
13671
|
-
|
|
13672
|
-
return Option.none();
|
|
13689
|
+
const EMBEDDED_GRAMMARS = {
|
|
13690
|
+
style: () => Option.some("css"),
|
|
13691
|
+
script: scriptGrammar
|
|
13673
13692
|
};
|
|
13693
|
+
const embeddedGrammar = ({ name, attribs }) => Record.get(EMBEDDED_GRAMMARS, name).pipe(Option.flatMap((grammarOf) => grammarOf(attribs)));
|
|
13674
13694
|
const shifted = (offset) => ({ index, text }) => ({
|
|
13675
13695
|
index: index + offset,
|
|
13676
13696
|
text
|
|
@@ -13683,7 +13703,7 @@ const markupComment = (source) => (node) => {
|
|
|
13683
13703
|
}];
|
|
13684
13704
|
};
|
|
13685
13705
|
const textComments = (grammars, grammar) => (text) => {
|
|
13686
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13706
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
13687
13707
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13688
13708
|
};
|
|
13689
13709
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13749,12 +13769,12 @@ const shebangReader = (source) => {
|
|
|
13749
13769
|
};
|
|
13750
13770
|
const readerOf = (name) => (source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13751
13771
|
// src/features/ban-comments/model/comments.ts
|
|
13752
|
-
const RULE$
|
|
13772
|
+
const RULE$17 = "comment";
|
|
13753
13773
|
const UNUSED_RULE$1 = "unused-comment-allowance";
|
|
13754
13774
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13755
13775
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13756
13776
|
const READ_CONCURRENCY$7 = 64;
|
|
13757
|
-
const START$
|
|
13777
|
+
const START$12 = 0;
|
|
13758
13778
|
const SHEBANG = "#!";
|
|
13759
13779
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
13760
13780
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
@@ -13776,11 +13796,11 @@ const taggedError$2 = Schema.TaggedError;
|
|
|
13776
13796
|
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
13777
13797
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13778
13798
|
const lineBefore = (source, index) => {
|
|
13779
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13799
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
13780
13800
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13781
13801
|
};
|
|
13782
13802
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13783
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13803
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
13784
13804
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13785
13805
|
const NOTHING = {
|
|
13786
13806
|
problems: [],
|
|
@@ -13790,7 +13810,7 @@ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but n
|
|
|
13790
13810
|
const problemOf$1 = (file, source) => ({ index }) => ({
|
|
13791
13811
|
file,
|
|
13792
13812
|
...positionOf(source)(index),
|
|
13793
|
-
rule: RULE$
|
|
13813
|
+
rule: RULE$17,
|
|
13794
13814
|
message: MESSAGE$3
|
|
13795
13815
|
});
|
|
13796
13816
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13827,7 +13847,7 @@ const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, sett
|
|
|
13827
13847
|
})), Array.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
13828
13848
|
});
|
|
13829
13849
|
const usedAllowances = (allowances, found) => pipe(allowances, Array.map((pattern, index) => [pattern, index]), Array.filter(([pattern]) => pipe(found, Array.some((comment) => pattern.test(valueOf(comment.text))))), Array.map(([, index]) => index));
|
|
13830
|
-
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$
|
|
13850
|
+
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$12));
|
|
13831
13851
|
const unusedAllowances = Effect.fn("unusedAllowances")(function* unusedAllowances(root, settings, used) {
|
|
13832
13852
|
const files = yield* RepositoryFiles;
|
|
13833
13853
|
const file = files.join(root, CONFIG_FILE$2);
|
|
@@ -13849,7 +13869,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
13849
13869
|
problems: pipe(found, Array.filter(kept), Array.map(toProblem)),
|
|
13850
13870
|
used: usedAllowances(allowances, found)
|
|
13851
13871
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
13852
|
-
problems: [problemInFile(RULE$
|
|
13872
|
+
problems: [problemInFile(RULE$17)(file, `msch could not read the comments in this file: ${message}`)],
|
|
13853
13873
|
used: []
|
|
13854
13874
|
})))
|
|
13855
13875
|
});
|
|
@@ -13962,21 +13982,21 @@ const PYTHON = {
|
|
|
13962
13982
|
/** @internal */
|
|
13963
13983
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13964
13984
|
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13965
|
-
const RULE$
|
|
13985
|
+
const RULE$16 = "uncataloged-dependency";
|
|
13966
13986
|
const OWNED_ELSEWHERE = [
|
|
13967
13987
|
"catalog:",
|
|
13968
13988
|
"workspace:",
|
|
13969
13989
|
"link:",
|
|
13970
13990
|
"file:"
|
|
13971
13991
|
];
|
|
13972
|
-
const ROOT_DIRECTORY$
|
|
13992
|
+
const ROOT_DIRECTORY$2 = ".";
|
|
13973
13993
|
const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
|
|
13974
13994
|
const MESSAGE$2 = "is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.";
|
|
13975
13995
|
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13976
|
-
const problemsIn$
|
|
13996
|
+
const problemsIn$8 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13977
13997
|
file: entry.file,
|
|
13978
13998
|
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13979
|
-
rule: RULE$
|
|
13999
|
+
rule: RULE$16,
|
|
13980
14000
|
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
13981
14001
|
})));
|
|
13982
14002
|
/** @internal */
|
|
@@ -13984,14 +14004,14 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
|
|
|
13984
14004
|
const files = yield* RepositoryFiles;
|
|
13985
14005
|
const directories = yield* workspaceDirectories(root);
|
|
13986
14006
|
const installed = yield* pipe(directories, Effect.filter((directory) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => !found))));
|
|
13987
|
-
const listed = pipe([ROOT_DIRECTORY$
|
|
14007
|
+
const listed = pipe([ROOT_DIRECTORY$2, ...installed], Array.map((directory) => {
|
|
13988
14008
|
const name = files.join(directory, MANIFEST_FILE$3);
|
|
13989
14009
|
return {
|
|
13990
14010
|
name,
|
|
13991
14011
|
file: files.join(root, name)
|
|
13992
14012
|
};
|
|
13993
14013
|
}));
|
|
13994
|
-
return yield* scanText(listed, problemsIn$
|
|
14014
|
+
return yield* scanText(listed, problemsIn$8);
|
|
13995
14015
|
});
|
|
13996
14016
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13997
14017
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
@@ -14016,8 +14036,8 @@ const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf(held)), Array
|
|
|
14016
14036
|
})));
|
|
14017
14037
|
const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(namedCatalogsOf(settings), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
|
|
14018
14038
|
const catalogOf = (specifier) => pipe(Option.liftPredicate(specifier, String$1.startsWith(CATALOG_PROTOCOL)), Option.map(String$1.slice(8)), Option.map((name) => Option.getOrElse(Option.liftPredicate(name, String$1.isNonEmpty), () => DEFAULT_CATALOG)));
|
|
14019
|
-
const referenceOf = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
|
|
14020
|
-
const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf(section), Record.toEntries, Array.flatMap(referenceOf))));
|
|
14039
|
+
const referenceOf$1 = ([name, specifier]) => pipe(decodeString$1(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
|
|
14040
|
+
const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf(section), Record.toEntries, Array.flatMap(referenceOf$1))));
|
|
14021
14041
|
const versionsOf = (raw) => pipe(Option.fromUndefinedOr(raw), Option.map((listed) => pipe(String$1.split(listed, VERSION_SEPARATOR), Array.map(String$1.trim))), Option.getOrElse(() => []));
|
|
14022
14042
|
const hasKeyWith = (keys) => (prefix) => pipe(keys, Array.some(String$1.startsWith(prefix)));
|
|
14023
14043
|
const isLocked = (keys) => (resolved) => Array.contains(keys, resolved) || hasKeyWith(keys)(`${resolved}(`);
|
|
@@ -14035,8 +14055,8 @@ const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root
|
|
|
14035
14055
|
const files = yield* RepositoryFiles;
|
|
14036
14056
|
const listed = yield* files.listedFiles(root);
|
|
14037
14057
|
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
|
|
14038
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
14039
|
-
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
14058
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$8(text))), Array.flatMap(referencesIn));
|
|
14059
|
+
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
|
|
14040
14060
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
14041
14061
|
});
|
|
14042
14062
|
const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
|
|
@@ -14046,17 +14066,17 @@ const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Arra
|
|
|
14046
14066
|
const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
14047
14067
|
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
|
|
14048
14068
|
const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\\s*$`, "u");
|
|
14049
|
-
const problemAt$
|
|
14069
|
+
const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
14050
14070
|
file,
|
|
14051
14071
|
line: at(needle),
|
|
14052
14072
|
column: FIRST_COLUMN$1,
|
|
14053
14073
|
rule,
|
|
14054
14074
|
message: `\`${name}\` ${message}`
|
|
14055
14075
|
});
|
|
14056
|
-
const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$
|
|
14076
|
+
const unusedIn = (located, settings, isUsed) => pipe(catalogEntries(settings), Array.filter(({ catalog, name }) => !isUsed(`${catalog}:${name}`)), Array.map(({ name }) => problemAt$4(located, UNUSED_RULE, UNUSED_MESSAGE)(name, entryLine(name))));
|
|
14057
14077
|
const staleIn = (located, settings, keys) => {
|
|
14058
14078
|
const excludes = Option.getOrElse(decodeStrings(settings["minimumReleaseAgeExclude"]), () => []);
|
|
14059
|
-
return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$
|
|
14079
|
+
return pipe(Option.toArray(keys), Array.flatMap((locked) => pipe(excludes, Array.filter((entry) => !resolvedIn(locked)(entry)))), Array.map((entry) => problemAt$4(located, STALE_RULE, STALE_MESSAGE)(entry, excludeLine(entry))));
|
|
14060
14080
|
};
|
|
14061
14081
|
const findingsIn = Effect.fn("findingsIn")(function* findingsIn(root, file, settings) {
|
|
14062
14082
|
const read = yield* (yield* RepositoryFiles).readFile(file);
|
|
@@ -14082,134 +14102,366 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
|
|
|
14082
14102
|
});
|
|
14083
14103
|
return [...catalogs, ...uncataloged];
|
|
14084
14104
|
});
|
|
14085
|
-
// src/features/check-
|
|
14086
|
-
const
|
|
14087
|
-
|
|
14088
|
-
|
|
14089
|
-
|
|
14090
|
-
|
|
14091
|
-
|
|
14092
|
-
const
|
|
14093
|
-
|
|
14094
|
-
|
|
14095
|
-
|
|
14096
|
-
|
|
14097
|
-
|
|
14098
|
-
|
|
14099
|
-
const
|
|
14100
|
-
const
|
|
14101
|
-
const
|
|
14102
|
-
|
|
14103
|
-
const
|
|
14104
|
-
|
|
14105
|
-
|
|
14106
|
-
|
|
14107
|
-
|
|
14108
|
-
})
|
|
14109
|
-
const
|
|
14110
|
-
const
|
|
14111
|
-
const
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
})
|
|
14118
|
-
|
|
14119
|
-
const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);
|
|
14120
|
-
return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
|
|
14121
|
-
};
|
|
14122
|
-
const catalogsIn = (settings) => pipe(namedCatalogsOf(settings), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
14123
|
-
const workspaceEntries = (text) => {
|
|
14124
|
-
const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf);
|
|
14125
|
-
return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings)];
|
|
14126
|
-
};
|
|
14127
|
-
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
|
|
14128
|
-
const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
14129
|
-
key,
|
|
14130
|
-
name: key,
|
|
14131
|
-
spec
|
|
14132
|
-
})), Option.toArray);
|
|
14133
|
-
const cargoEntries = (text) => {
|
|
14134
|
-
const cargo = parseToml(text);
|
|
14135
|
-
return [
|
|
14136
|
-
...sectionsIn(CARGO_SECTIONS)(cargo),
|
|
14137
|
-
...entriesIn("workspace.dependencies")(fieldOf("dependencies")(cargo["workspace"])),
|
|
14138
|
-
...singleEntry("rust-version", fieldOf("rust-version")(cargo["package"]))
|
|
14139
|
-
];
|
|
14140
|
-
};
|
|
14141
|
-
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14142
|
-
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14143
|
-
const RULE$14 = "version-downgrade";
|
|
14144
|
-
const DEFAULT_BASE = "origin/main";
|
|
14145
|
-
const READ_CONCURRENCY$5 = 16;
|
|
14146
|
-
const READERS = [
|
|
14147
|
-
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
14148
|
-
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
14149
|
-
[/(?:^|\/)Cargo\.toml$/u, cargoEntries],
|
|
14150
|
-
[/(?:^|\/)rust-toolchain\.toml$/u, toolchainEntries]
|
|
14151
|
-
];
|
|
14152
|
-
const lowestOf = (spec) => pipe(Option.liftThrowable(() => semver.minVersion(spec))(), Option.flatMap(Option.fromNullishOr), Option.orElse(() => Option.fromNullishOr(semver.coerce(spec))));
|
|
14153
|
-
const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(after)]), Option.match({
|
|
14154
|
-
onNone: () => false,
|
|
14155
|
-
onSome: ([old, current]) => semver.lt(current, old)
|
|
14156
|
-
}));
|
|
14157
|
-
const FIRST_LINE$1 = 1;
|
|
14158
|
-
const lineOf = (text, { name, spec }) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(name)(line) && String$1.includes(spec)(line)), Option.match({
|
|
14159
|
-
onNone: () => FIRST_LINE$1,
|
|
14160
|
-
onSome: (index) => index + FIRST_LINE$1
|
|
14161
|
-
}));
|
|
14162
|
-
const message = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
|
|
14163
|
-
const downgradesIn = ({ file, text, before, after }) => {
|
|
14164
|
-
const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
|
|
14165
|
-
return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
|
|
14105
|
+
// src/features/check-skills/model/skill-entry.ts
|
|
14106
|
+
const ENTRY_RULE = "unlocked-skill";
|
|
14107
|
+
const VISIBLE_RULE = "skill-source-visible";
|
|
14108
|
+
const CONFIG_FILE$1 = "vite.config.ts";
|
|
14109
|
+
const RENOVATE_FILE$1 = "renovate.json";
|
|
14110
|
+
const SOURCE = "masseater/skills";
|
|
14111
|
+
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
14112
|
+
const START$11 = 0;
|
|
14113
|
+
const LOCAL_PREFIX = "./";
|
|
14114
|
+
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
14115
|
+
const Source = Schema.Struct({
|
|
14116
|
+
commit: Schema.optional(Schema.String),
|
|
14117
|
+
skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
|
|
14118
|
+
});
|
|
14119
|
+
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
14120
|
+
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
14121
|
+
const taggedError$1 = Schema.TaggedError;
|
|
14122
|
+
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14123
|
+
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
14124
|
+
file,
|
|
14125
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
14126
|
+
rule,
|
|
14127
|
+
message
|
|
14128
|
+
});
|
|
14129
|
+
const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
|
|
14130
|
+
const files = yield* RepositoryFiles;
|
|
14131
|
+
const file = files.join(root, CONFIG_FILE$1);
|
|
14132
|
+
const text = yield* files.readFile(file);
|
|
14133
|
+
if (Option.isNone(text)) return Option.none();
|
|
14134
|
+
const config = yield* Effect.tryPromise({
|
|
14135
|
+
try: () => resolveConfigFromFile(file),
|
|
14136
|
+
catch: () => SkillsConfigUnreadable.make({ file })
|
|
14137
|
+
}).pipe(Effect.option);
|
|
14138
|
+
return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
|
|
14166
14139
|
file,
|
|
14167
|
-
|
|
14168
|
-
|
|
14169
|
-
|
|
14170
|
-
|
|
14171
|
-
|
|
14140
|
+
text: text.value,
|
|
14141
|
+
sources: skills
|
|
14142
|
+
})));
|
|
14143
|
+
});
|
|
14144
|
+
const entryProblems = ({ file, text, sources }) => {
|
|
14145
|
+
const at = problemAt$3(ENTRY_RULE, file, text);
|
|
14146
|
+
return pipe(Record.get(sources, SOURCE), Option.match({
|
|
14147
|
+
onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
|
|
14148
|
+
onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
|
|
14149
|
+
}));
|
|
14172
14150
|
};
|
|
14173
|
-
const
|
|
14151
|
+
const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
|
|
14152
|
+
const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$3(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
|
|
14153
|
+
const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
|
|
14174
14154
|
const files = yield* RepositoryFiles;
|
|
14175
|
-
const
|
|
14176
|
-
const
|
|
14177
|
-
|
|
14155
|
+
const file = files.join(root, RENOVATE_FILE$1);
|
|
14156
|
+
const text = yield* files.readFile(file);
|
|
14157
|
+
if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
|
|
14158
|
+
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
|
|
14178
14159
|
});
|
|
14179
14160
|
/** @internal */
|
|
14180
|
-
const
|
|
14181
|
-
const
|
|
14182
|
-
|
|
14183
|
-
|
|
14184
|
-
|
|
14185
|
-
|
|
14186
|
-
|
|
14187
|
-
|
|
14188
|
-
|
|
14189
|
-
|
|
14190
|
-
|
|
14191
|
-
|
|
14192
|
-
|
|
14193
|
-
|
|
14161
|
+
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
14162
|
+
const declared = yield* declaredSkills(root);
|
|
14163
|
+
if (Option.isNone(declared)) return [];
|
|
14164
|
+
const preset = yield* presetProblems(root);
|
|
14165
|
+
return [
|
|
14166
|
+
...entryProblems(declared.value),
|
|
14167
|
+
...visibleProblems(declared.value),
|
|
14168
|
+
...preset
|
|
14169
|
+
];
|
|
14170
|
+
});
|
|
14171
|
+
// src/features/check-skills/model/published-skills.ts
|
|
14172
|
+
const RULE$15 = "published-skills";
|
|
14173
|
+
const KEYWORD = "tanstack-intent";
|
|
14174
|
+
const SKILLS = "skills";
|
|
14175
|
+
const MANIFEST_FILE = "package.json";
|
|
14176
|
+
const SKILL_FILE$1 = "SKILL.md";
|
|
14177
|
+
const SUCCEEDED = 0;
|
|
14178
|
+
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14179
|
+
const problemAt$2 = problemInFile(RULE$15);
|
|
14180
|
+
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
|
|
14181
|
+
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14182
|
+
const packagingMessages = ({ keywords, files }, skills) => {
|
|
14183
|
+
const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
|
|
14184
|
+
const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
|
|
14185
|
+
return Array.getSomes([keyword, unshipped]);
|
|
14186
|
+
};
|
|
14187
|
+
const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
|
|
14188
|
+
const handle = yield* ChildProcess.make("node", [
|
|
14189
|
+
INTENT_CLI,
|
|
14190
|
+
"validate",
|
|
14191
|
+
SKILLS
|
|
14192
|
+
], {
|
|
14193
|
+
cwd: directory,
|
|
14194
|
+
extendEnv: true,
|
|
14195
|
+
stdin: "ignore"
|
|
14196
|
+
});
|
|
14197
|
+
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
14198
|
+
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
14199
|
+
}, Effect.scoped);
|
|
14200
|
+
const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
14201
|
+
const files = yield* RepositoryFiles;
|
|
14202
|
+
const directory = files.join(root, project.directory);
|
|
14203
|
+
const manifest = files.join(directory, MANIFEST_FILE);
|
|
14204
|
+
const skills = skillDirectoriesIn(files, directory);
|
|
14205
|
+
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
|
|
14206
|
+
const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
14207
|
+
return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
|
|
14208
|
+
});
|
|
14209
|
+
/** @internal */
|
|
14210
|
+
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
14211
|
+
const projects = yield* publishedProjects(root);
|
|
14212
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$7(root, project), { concurrency: 1 });
|
|
14213
|
+
return Array.flatten(problems);
|
|
14214
|
+
});
|
|
14215
|
+
// src/features/check-skills/model/skill-files.ts
|
|
14216
|
+
const RULE$14 = "skill-file";
|
|
14217
|
+
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14218
|
+
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14219
|
+
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
14220
|
+
const MARKDOWN = ".md";
|
|
14221
|
+
const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
|
|
14222
|
+
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
14223
|
+
const HEADING = /^# (?<title>.+)$/mu;
|
|
14224
|
+
const NAME_KEY$1 = /^name:/mu;
|
|
14225
|
+
const LICENSE_KEY = /^license:/mu;
|
|
14226
|
+
const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
|
|
14227
|
+
const LINK = /\]\((?<target>[^)\s]+)\)/gu;
|
|
14228
|
+
const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
|
|
14229
|
+
const FRAGMENT = /#.*$/u;
|
|
14230
|
+
const GITHUB = "https://github.com/";
|
|
14231
|
+
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
14232
|
+
const BLANK = /\s+/u;
|
|
14233
|
+
const SEPARATOR$2 = "/";
|
|
14234
|
+
const START$10 = 0;
|
|
14235
|
+
const FIRST$3 = 1;
|
|
14236
|
+
const READ_CONCURRENCY$5 = 16;
|
|
14237
|
+
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
14238
|
+
const Frontmatter = Schema.Struct({
|
|
14239
|
+
name: Schema.optional(Schema.String),
|
|
14240
|
+
license: Schema.optional(Schema.Unknown),
|
|
14241
|
+
metadata: Schema.optional(Metadata)
|
|
14242
|
+
});
|
|
14243
|
+
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
14244
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
14245
|
+
const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
|
|
14246
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
14247
|
+
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
14248
|
+
const nameProblems = ({ source, directory }, name, folder) => {
|
|
14249
|
+
const bodyStart = bodyStartOf(source);
|
|
14250
|
+
const body = String$1.slice(bodyStart)(source);
|
|
14251
|
+
const heading = groupOf("title")(HEADING.exec(body));
|
|
14252
|
+
return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
|
|
14253
|
+
index: offsetOf$1(source, NAME_KEY$1),
|
|
14254
|
+
message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
|
|
14255
|
+
})), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
|
|
14256
|
+
index: bodyStart + offsetOf$1(body, HEADING),
|
|
14257
|
+
message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
|
|
14258
|
+
})), Option.toArray)];
|
|
14259
|
+
};
|
|
14260
|
+
const derivedProblems = (source, derived) => pipe(String$1.split(String$1.trim(derived), BLANK), Array.filter((url) => String$1.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)), Array.map((url) => ({
|
|
14261
|
+
index: offsetOf$1(source, url),
|
|
14262
|
+
message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`
|
|
14263
|
+
})));
|
|
14264
|
+
const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
|
|
14265
|
+
...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
|
|
14266
|
+
...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
|
|
14267
|
+
index: offsetOf$1(skill.source, LICENSE_KEY),
|
|
14268
|
+
message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
|
|
14269
|
+
})), Option.toArray),
|
|
14270
|
+
...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
|
|
14271
|
+
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
14272
|
+
file: skill.file,
|
|
14273
|
+
...positionOf(skill.source)(index),
|
|
14274
|
+
rule: RULE$14,
|
|
14275
|
+
message
|
|
14276
|
+
})));
|
|
14277
|
+
const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
14278
|
+
target,
|
|
14279
|
+
index: found.index ?? START$10
|
|
14280
|
+
})), Option.toArray);
|
|
14281
|
+
const rangeOf$1 = (found) => {
|
|
14282
|
+
const start = found.index ?? START$10;
|
|
14283
|
+
return [start, start + found[START$10].length];
|
|
14284
|
+
};
|
|
14285
|
+
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
14286
|
+
const linksIn$1 = (source) => {
|
|
14287
|
+
const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
|
|
14288
|
+
return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
|
|
14289
|
+
};
|
|
14290
|
+
const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
14291
|
+
const files = yield* RepositoryFiles;
|
|
14292
|
+
const text = yield* files.readFile(file);
|
|
14293
|
+
if (Option.isNone(text)) return [];
|
|
14294
|
+
const source = text.value;
|
|
14295
|
+
const directory = files.dirname(file);
|
|
14296
|
+
const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
|
|
14297
|
+
const missing = yield* Effect.filter(linksIn$1(source), isMissing);
|
|
14298
|
+
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14299
|
+
file,
|
|
14300
|
+
...positionOf(source)(index),
|
|
14301
|
+
rule: RULE$14,
|
|
14302
|
+
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14303
|
+
})));
|
|
14304
|
+
});
|
|
14305
|
+
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
14306
|
+
const files = yield* RepositoryFiles;
|
|
14307
|
+
const file = files.join(root, name);
|
|
14308
|
+
const directory = files.dirname(name);
|
|
14309
|
+
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
14310
|
+
const text = yield* files.readFile(file);
|
|
14311
|
+
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
14312
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
|
|
14313
|
+
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
14314
|
+
file: files.join(root, entry),
|
|
14315
|
+
line: FIRST$3,
|
|
14316
|
+
column: FIRST$3,
|
|
14317
|
+
rule: RULE$14,
|
|
14318
|
+
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14319
|
+
})));
|
|
14320
|
+
return [
|
|
14321
|
+
...pipe(text, Option.map((source) => frontmatterProblems({
|
|
14322
|
+
file,
|
|
14323
|
+
directory,
|
|
14324
|
+
source
|
|
14325
|
+
}, files.basename(directory))), Option.getOrElse(() => [])),
|
|
14326
|
+
...licenses,
|
|
14327
|
+
...Array.flatten(links)
|
|
14328
|
+
];
|
|
14329
|
+
});
|
|
14330
|
+
/** @internal */
|
|
14331
|
+
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
14332
|
+
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
14333
|
+
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
14334
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
14335
|
+
return Array.flatten(found);
|
|
14336
|
+
});
|
|
14337
|
+
// src/features/check-version-downgrades/model/version-entries.ts
|
|
14338
|
+
const MANIFEST_SECTIONS = [
|
|
14339
|
+
"dependencies",
|
|
14340
|
+
"devDependencies",
|
|
14341
|
+
"optionalDependencies",
|
|
14342
|
+
"engines"
|
|
14343
|
+
];
|
|
14344
|
+
const CARGO_SECTIONS = [
|
|
14345
|
+
"dependencies",
|
|
14346
|
+
"dev-dependencies",
|
|
14347
|
+
"build-dependencies"
|
|
14348
|
+
];
|
|
14349
|
+
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
14350
|
+
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
14351
|
+
const decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));
|
|
14352
|
+
const decodeSpec = (value) => Option.orElse(decodeString(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
|
|
14353
|
+
const PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));
|
|
14354
|
+
const decodePackageManager = Schema.decodeUnknownOption(PackageManager);
|
|
14355
|
+
const fieldOf = (name) => (value) => fieldsOf(value)[name];
|
|
14356
|
+
const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
14357
|
+
key: `${section}:${name}`,
|
|
14358
|
+
name,
|
|
14359
|
+
spec
|
|
14360
|
+
})), Option.toArray)));
|
|
14361
|
+
const sectionsIn = (sections) => (fields) => pipe(sections, Array.flatMap((section) => entriesIn(section)(fields[section])));
|
|
14362
|
+
const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map((raw) => {
|
|
14363
|
+
const [name, version = ""] = String$1.split(raw, "@");
|
|
14364
|
+
return {
|
|
14365
|
+
key: `packageManager:${name}`,
|
|
14366
|
+
name,
|
|
14367
|
+
spec: version
|
|
14368
|
+
};
|
|
14369
|
+
}), Option.toArray);
|
|
14370
|
+
const manifestEntries = (text) => {
|
|
14371
|
+
const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf);
|
|
14372
|
+
return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
|
|
14373
|
+
};
|
|
14374
|
+
const catalogsIn = (settings) => pipe(namedCatalogsOf(settings), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
14375
|
+
const workspaceEntries = (text) => {
|
|
14376
|
+
const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf);
|
|
14377
|
+
return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings)];
|
|
14378
|
+
};
|
|
14379
|
+
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
|
|
14380
|
+
const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
14381
|
+
key,
|
|
14382
|
+
name: key,
|
|
14383
|
+
spec
|
|
14384
|
+
})), Option.toArray);
|
|
14385
|
+
const cargoEntries = (text) => {
|
|
14386
|
+
const cargo = parseToml(text);
|
|
14387
|
+
return [
|
|
14388
|
+
...sectionsIn(CARGO_SECTIONS)(cargo),
|
|
14389
|
+
...entriesIn("workspace.dependencies")(fieldOf("dependencies")(cargo["workspace"])),
|
|
14390
|
+
...singleEntry("rust-version", fieldOf("rust-version")(cargo["package"]))
|
|
14391
|
+
];
|
|
14392
|
+
};
|
|
14393
|
+
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14394
|
+
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14395
|
+
const RULE$13 = "version-downgrade";
|
|
14396
|
+
const DEFAULT_BASE = "origin/main";
|
|
14397
|
+
const READ_CONCURRENCY$4 = 16;
|
|
14398
|
+
const READERS = [
|
|
14399
|
+
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
14400
|
+
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
14401
|
+
[/(?:^|\/)Cargo\.toml$/u, cargoEntries],
|
|
14402
|
+
[/(?:^|\/)rust-toolchain\.toml$/u, toolchainEntries]
|
|
14403
|
+
];
|
|
14404
|
+
const lowestOf = (spec) => pipe(Option.liftThrowable(() => semver.minVersion(spec))(), Option.flatMap(Option.fromNullishOr), Option.orElse(() => Option.fromNullishOr(semver.coerce(spec))));
|
|
14405
|
+
const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(after)]), Option.match({
|
|
14406
|
+
onNone: () => false,
|
|
14407
|
+
onSome: ([old, current]) => semver.lt(current, old)
|
|
14408
|
+
}));
|
|
14409
|
+
const FIRST_LINE$1 = 1;
|
|
14410
|
+
const lineOf = (text, { name, spec }) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(name)(line) && String$1.includes(spec)(line)), Option.match({
|
|
14411
|
+
onNone: () => FIRST_LINE$1,
|
|
14412
|
+
onSome: (index) => index + FIRST_LINE$1
|
|
14413
|
+
}));
|
|
14414
|
+
const message = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
|
|
14415
|
+
const downgradesIn = ({ file, text, before, after }) => {
|
|
14416
|
+
const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
|
|
14417
|
+
return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
|
|
14418
|
+
file,
|
|
14419
|
+
line: lineOf(text, entry),
|
|
14420
|
+
column: FIRST_LINE$1,
|
|
14421
|
+
rule: RULE$13,
|
|
14422
|
+
message: message(old, entry)
|
|
14423
|
+
})), Option.toArray)));
|
|
14424
|
+
};
|
|
14425
|
+
const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
|
|
14426
|
+
const files = yield* RepositoryFiles;
|
|
14427
|
+
const configured = yield* Config.option(Config.String("VPA_BASE")).pipe(Effect.orDie);
|
|
14428
|
+
const base = Option.getOrElse(configured, () => DEFAULT_BASE);
|
|
14429
|
+
return yield* files.mergeBase(root, base);
|
|
14430
|
+
});
|
|
14431
|
+
/** @internal */
|
|
14432
|
+
const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(root) {
|
|
14433
|
+
const files = yield* RepositoryFiles;
|
|
14434
|
+
const base = yield* baseRevision(root);
|
|
14435
|
+
if (Option.isNone(base)) return [];
|
|
14436
|
+
const listed = yield* files.listedFiles(root);
|
|
14437
|
+
const found = yield* Effect.forEach(pipe(listed, Array.flatMap((name) => pipe(READERS, Array.findFirst(([pattern]) => pattern.test(name)), Option.map(([, read]) => [name, read]), Option.toArray))), ([name, read]) => Effect.gen(function* compare() {
|
|
14438
|
+
const file = files.join(root, name);
|
|
14439
|
+
const current = yield* files.readFile(file);
|
|
14440
|
+
const previous = yield* files.readAtRevision(root, base.value, name);
|
|
14441
|
+
return pipe(Option.all([previous, current]), Option.map(([before, after]) => downgradesIn({
|
|
14442
|
+
file,
|
|
14443
|
+
text: after,
|
|
14444
|
+
before: read(before),
|
|
14445
|
+
after: read(after)
|
|
14194
14446
|
})), Option.getOrElse(() => []));
|
|
14195
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
14447
|
+
}), { concurrency: READ_CONCURRENCY$4 });
|
|
14196
14448
|
return Array.flatten(found);
|
|
14197
14449
|
});
|
|
14198
14450
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
14199
|
-
const RENOVATE_FILE
|
|
14451
|
+
const RENOVATE_FILE = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
|
|
14200
14452
|
const AUTOMERGE_OFF = /["']?platformAutomerge["']?\s*:\s*false/gu;
|
|
14201
14453
|
const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)["']/gu;
|
|
14202
14454
|
const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
14203
14455
|
const CAP_RULE = "renovate-version-cap";
|
|
14204
14456
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14205
|
-
const PRESET
|
|
14206
|
-
const START$
|
|
14207
|
-
const READ_CONCURRENCY$
|
|
14457
|
+
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14458
|
+
const START$9 = 0;
|
|
14459
|
+
const READ_CONCURRENCY$3 = 16;
|
|
14208
14460
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14209
14461
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
14210
|
-
const PRESET_MESSAGE = `does not extend \`${PRESET
|
|
14462
|
+
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
14211
14463
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
14212
|
-
const problemsIn$
|
|
14464
|
+
const problemsIn$5 = (file, source) => {
|
|
14213
14465
|
const at = positionOf(source);
|
|
14214
14466
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
14215
14467
|
file,
|
|
@@ -14222,44 +14474,44 @@ const problemsIn$8 = (file, source) => {
|
|
|
14222
14474
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
14223
14475
|
...pipe([{
|
|
14224
14476
|
file,
|
|
14225
|
-
...at(START$
|
|
14477
|
+
...at(START$9),
|
|
14226
14478
|
rule: PRESET_RULE,
|
|
14227
14479
|
message: PRESET_MESSAGE
|
|
14228
|
-
}], Array.filter(() => !String$1.includes(`"${PRESET
|
|
14480
|
+
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
14229
14481
|
];
|
|
14230
14482
|
};
|
|
14231
14483
|
/** @internal */
|
|
14232
14484
|
const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* checkRenovateSettings(root) {
|
|
14233
14485
|
const files = yield* RepositoryFiles;
|
|
14234
14486
|
const listed = yield* files.listedFiles(root);
|
|
14235
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE
|
|
14487
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE.test(name))), (name) => {
|
|
14236
14488
|
const file = files.join(root, name);
|
|
14237
14489
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14238
14490
|
onNone: () => [],
|
|
14239
|
-
onSome: (source) => problemsIn$
|
|
14491
|
+
onSome: (source) => problemsIn$5(file, source)
|
|
14240
14492
|
})));
|
|
14241
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
14493
|
+
}, { concurrency: READ_CONCURRENCY$3 });
|
|
14242
14494
|
return Array.flatten(found);
|
|
14243
14495
|
});
|
|
14244
14496
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
14245
14497
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
14246
14498
|
const NUL = "\0";
|
|
14247
|
-
const START$
|
|
14499
|
+
const START$8 = 0;
|
|
14248
14500
|
const HEX = 16;
|
|
14249
14501
|
const CODE_POINT_WIDTH = 4;
|
|
14250
|
-
const READ_CONCURRENCY$
|
|
14251
|
-
const RULE$
|
|
14252
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
14502
|
+
const READ_CONCURRENCY$2 = 64;
|
|
14503
|
+
const RULE$12 = "hidden-unicode";
|
|
14504
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$8)(character), Option.getOrElse(() => START$8), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
14253
14505
|
const problemOf = (file, source) => (found) => {
|
|
14254
|
-
const hex = hexOf(found[START$
|
|
14506
|
+
const hex = hexOf(found[START$8]);
|
|
14255
14507
|
return {
|
|
14256
14508
|
file,
|
|
14257
|
-
...positionOf(source)(found.index ?? START$
|
|
14258
|
-
rule: RULE$
|
|
14509
|
+
...positionOf(source)(found.index ?? START$8),
|
|
14510
|
+
rule: RULE$12,
|
|
14259
14511
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
14260
14512
|
};
|
|
14261
14513
|
};
|
|
14262
|
-
const problemsIn$
|
|
14514
|
+
const problemsIn$4 = (file, source) => {
|
|
14263
14515
|
if (String$1.includes(NUL)(source)) return [];
|
|
14264
14516
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
|
|
14265
14517
|
};
|
|
@@ -14271,18 +14523,18 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14271
14523
|
const file = files.join(root, name);
|
|
14272
14524
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14273
14525
|
onNone: () => [],
|
|
14274
|
-
onSome: (source) => problemsIn$
|
|
14526
|
+
onSome: (source) => problemsIn$4(file, source)
|
|
14275
14527
|
})));
|
|
14276
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
14528
|
+
}, { concurrency: READ_CONCURRENCY$2 });
|
|
14277
14529
|
return Array.flatten(found);
|
|
14278
14530
|
});
|
|
14279
14531
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
14280
14532
|
const MSCH = "@r_masseater/msch";
|
|
14281
14533
|
const SCOPE$1 = "@r_masseater/";
|
|
14282
|
-
const RULE$
|
|
14534
|
+
const RULE$11 = "applied-package";
|
|
14283
14535
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
14284
14536
|
const NOT_FOUND = -1;
|
|
14285
|
-
const SEPARATOR$
|
|
14537
|
+
const SEPARATOR$1 = "/";
|
|
14286
14538
|
const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
|
|
14287
14539
|
const BinMap = Schema.Record(Schema.String, Schema.String);
|
|
14288
14540
|
const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
|
|
@@ -14296,7 +14548,7 @@ const declaredNames = (manifest) => pipe([
|
|
|
14296
14548
|
const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
|
|
14297
14549
|
onNone: () => [],
|
|
14298
14550
|
onSome: (bin) => {
|
|
14299
|
-
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$
|
|
14551
|
+
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
|
|
14300
14552
|
return Record.keys(bin);
|
|
14301
14553
|
}
|
|
14302
14554
|
}));
|
|
@@ -14321,16 +14573,16 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
14321
14573
|
const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
|
|
14322
14574
|
return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
|
|
14323
14575
|
});
|
|
14324
|
-
const problemAt$
|
|
14576
|
+
const problemAt$1 = (file, source) => (index, name) => ({
|
|
14325
14577
|
file,
|
|
14326
14578
|
...positionOf(source)(index),
|
|
14327
|
-
rule: RULE$
|
|
14579
|
+
rule: RULE$11,
|
|
14328
14580
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
14329
14581
|
});
|
|
14330
14582
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
14331
14583
|
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
14332
|
-
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$
|
|
14333
|
-
const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$
|
|
14584
|
+
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$1(file, source)(found.index ?? NOT_FOUND, entry.name)))));
|
|
14585
|
+
const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
|
|
14334
14586
|
onEmpty: () => "",
|
|
14335
14587
|
onNonEmpty: Array.max(BY_LENGTH)
|
|
14336
14588
|
}));
|
|
@@ -14349,7 +14601,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
|
|
|
14349
14601
|
declared: manifest
|
|
14350
14602
|
}), Option.match({
|
|
14351
14603
|
onNone: () => [],
|
|
14352
|
-
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$
|
|
14604
|
+
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$1(file, source)(index, name)), Option.toArray)))
|
|
14353
14605
|
}));
|
|
14354
14606
|
});
|
|
14355
14607
|
const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
|
|
@@ -14379,8 +14631,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14379
14631
|
return yield* appliedPackageProblems(root, applied);
|
|
14380
14632
|
});
|
|
14381
14633
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14382
|
-
const RULE$
|
|
14383
|
-
const FIRST$
|
|
14634
|
+
const RULE$10 = "replaced-tool";
|
|
14635
|
+
const FIRST$2 = 1;
|
|
14384
14636
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14385
14637
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
14386
14638
|
const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
|
|
@@ -14458,395 +14710,152 @@ const REPLACED = [
|
|
|
14458
14710
|
];
|
|
14459
14711
|
const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
14460
14712
|
file,
|
|
14461
|
-
line: FIRST$
|
|
14462
|
-
column: FIRST$
|
|
14463
|
-
rule: RULE$
|
|
14713
|
+
line: FIRST$2,
|
|
14714
|
+
column: FIRST$2,
|
|
14715
|
+
rule: RULE$10,
|
|
14464
14716
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14465
14717
|
})));
|
|
14466
14718
|
/** @internal */
|
|
14467
14719
|
const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplacedTools(root) {
|
|
14468
14720
|
const listed = yield* listedFiles(root);
|
|
14469
14721
|
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor$1(entry)))));
|
|
14470
|
-
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor$1(entry))));
|
|
14471
|
-
});
|
|
14472
|
-
// src/features/find-unneeded-files/model/lockfiles.ts
|
|
14473
|
-
const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
|
|
14474
|
-
const PLUGIN_LOCKFILE = /(?:^|\/)bun\.lock$/u;
|
|
14475
|
-
const PLUGIN_MANIFEST = ".claude-plugin/plugin.json";
|
|
14476
|
-
const installedByClaudeCode = (present) => ({ name }) => PLUGIN_LOCKFILE.test(name) && pipe(present, Array.some((entry) => entry.name === join(parent(name))(PLUGIN_MANIFEST)));
|
|
14477
|
-
const unneededLockfile = (present) => (entry) => FOREIGN_LOCKFILE.test(entry.name) && !installedByClaudeCode(present)(entry);
|
|
14478
|
-
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
14479
|
-
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
14480
|
-
const PNPM_DIRECTORY = ".pnpm/";
|
|
14481
|
-
const SEPARATOR$1 = "/";
|
|
14482
|
-
const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
|
|
14483
|
-
const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
|
|
14484
|
-
const PNPM_OUTPUT = /(?:^|\/)\.pnpm\//u;
|
|
14485
|
-
const CARGO_WORKSPACE = /^\[workspace\]/mu;
|
|
14486
|
-
const LEGACY_CARGO_CONFIG = /(?:^|\/)\.cargo\/config$/u;
|
|
14487
|
-
const CARGO_CONFIG_FILE = /(?:^|\/)\.cargo\/config\.toml$/u;
|
|
14488
|
-
const PNPM_CARGO_START = /# >>> pnpm-managed cargo sources >>>/u;
|
|
14489
|
-
const PNPM_CARGO_BLOCK = /# >>> pnpm-managed cargo sources >>>[\s\S]*?# <<< pnpm-managed cargo sources <<<\n?/gu;
|
|
14490
|
-
const SETUP_PATTERNS = [
|
|
14491
|
-
/(?<![\w./@-])rustup[ \t]+(?:toolchain[ \t]+install|install|update|default|override[ \t]+set|target[ \t]+add|component[ \t]+add)\b/gu,
|
|
14492
|
-
/(?<![\w./@-])cargo[ \t]+(?:vendor|fetch)\b/gu,
|
|
14493
|
-
/\buses:\s*["']?(?:dtolnay\/rust-toolchain|actions-rust-lang\/setup-rust-toolchain|actions-rs\/toolchain|moonrepo\/setup-rust)\b/gu
|
|
14494
|
-
];
|
|
14495
|
-
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14496
|
-
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14497
|
-
const START$8 = 0;
|
|
14498
|
-
const LAST_SEGMENT = 1;
|
|
14499
|
-
const FIRST_LINE = 1;
|
|
14500
|
-
const FIRST_COLUMN = 1;
|
|
14501
|
-
const WHOLE_MATCH = 0;
|
|
14502
|
-
const FILE_RULE = "unneeded-file";
|
|
14503
|
-
const SETUP_RULE = "unneeded-setup";
|
|
14504
|
-
const CARGO_RULE = "cargo-outside-pnpm";
|
|
14505
|
-
const CargoSettings = Schema.Struct({ enabled: Schema.optionalKey(Schema.Boolean) });
|
|
14506
|
-
const WorkspaceFile = Schema.Struct({ cargo: Schema.optionalKey(CargoSettings) });
|
|
14507
|
-
const decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);
|
|
14508
|
-
const cargoEnabled = (manifest) => pipe(decodeWorkspaceFile(manifest), Option.flatMap(({ cargo }) => Option.fromUndefinedOr(cargo)), Option.flatMap(({ enabled }) => Option.fromUndefinedOr(enabled)), Option.getOrElse(() => false));
|
|
14509
|
-
const problemAtStart = (rule, message) => ({ file }) => ({
|
|
14510
|
-
file,
|
|
14511
|
-
line: FIRST_LINE,
|
|
14512
|
-
column: FIRST_COLUMN,
|
|
14513
|
-
rule,
|
|
14514
|
-
message
|
|
14515
|
-
});
|
|
14516
|
-
const foreignLockfile = problemAtStart(FILE_RULE, "pnpm-lock.yaml is this repository's lockfile, and pnpm never reads this one. Delete it.");
|
|
14517
|
-
const nestedCargoLock = problemAtStart(FILE_RULE, "Cargo reads only the Cargo.lock beside the workspace's Cargo.toml, and pnpm install writes that one. Delete this one.");
|
|
14518
|
-
const legacyCargoConfig = problemAtStart(FILE_RULE, "pnpm install writes .cargo/config.toml, and Cargo warns when .cargo/config sits beside it. Move its settings into .cargo/config.toml and delete it.");
|
|
14519
|
-
const pnpmOutput = problemAtStart(FILE_RULE, "pnpm install writes .pnpm/ from Cargo.lock and rust-toolchain.toml. Add this .pnpm directory to .gitignore and keep it out of the repository.");
|
|
14520
|
-
const pnpmCargoConfig = problemAtStart(FILE_RULE, "pnpm install writes this .cargo/config.toml, and it holds nothing else. Add /.cargo/config.toml to .gitignore and keep it out of the repository.");
|
|
14521
|
-
const generatedCargoConfig = (entry, source) => {
|
|
14522
|
-
if (!CARGO_CONFIG_FILE.test(entry.name) || !PNPM_CARGO_START.test(source)) return [];
|
|
14523
|
-
if (String$1.isNonEmpty(String$1.trim(String$1.replaceAll(PNPM_CARGO_BLOCK, "")(source)))) return [];
|
|
14524
|
-
return [pnpmCargoConfig(entry)];
|
|
14525
|
-
};
|
|
14526
|
-
const cargoOutsidePnpm = problemAtStart(CARGO_RULE, `pnpm does not manage these crates. Set \`cargo: { enabled: true }\` in ${WORKSPACE_FILE$1} so pnpm install fetches the crates and the Rust toolchain.`);
|
|
14527
|
-
const setupProblem = ({ file }, source, advice) => (found) => ({
|
|
14528
|
-
file,
|
|
14529
|
-
...positionOf(source)(found.index ?? WHOLE_MATCH),
|
|
14530
|
-
rule: SETUP_RULE,
|
|
14531
|
-
message: advice(String$1.trim(found[WHOLE_MATCH]))
|
|
14532
|
-
});
|
|
14533
|
-
const removeSetup = (command) => `pnpm install already installs the toolchain in rust-toolchain.toml and vendors the crates in Cargo.lock. Remove \`${command}\`.`;
|
|
14534
|
-
const buildInstead = (command) => `\`${command}\` fetches crates that pnpm does not vendor. Add the tool as a dependency of a Cargo workspace that pnpm vendors, and build its binary there with \`cargo build -p <crate> --bin <name>\`.`;
|
|
14535
|
-
const setupPatternsFor = (entry) => {
|
|
14536
|
-
if (isToolVersions(entry)) return [...SETUP_PATTERNS, ...TOOL_PATTERNS];
|
|
14537
|
-
return SETUP_PATTERNS;
|
|
14538
|
-
};
|
|
14539
|
-
const matchesOf = (source) => (patterns) => pipe(patterns, Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))));
|
|
14540
|
-
const setupProblems = (entry, source) => {
|
|
14541
|
-
const found = matchesOf(source);
|
|
14542
|
-
const installs = pipe(found(INSTALL_PATTERNS), Array.map(setupProblem(entry, source, buildInstead)));
|
|
14543
|
-
return pipe(found(setupPatternsFor(entry)), Array.map(setupProblem(entry, source, removeSetup)), Array.appendAll(installs), Array.appendAll(generatedCargoConfig(entry, source)));
|
|
14544
|
-
};
|
|
14545
|
-
const matches = (pattern) => ({ name }) => pattern.test(name);
|
|
14546
|
-
const isCargoManifest = matches(CARGO_MANIFEST_FILE);
|
|
14547
|
-
const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
|
|
14548
|
-
const isPnpmOutput = matches(PNPM_OUTPUT);
|
|
14549
|
-
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
|
|
14550
|
-
const ancestorsOf = (directory) => {
|
|
14551
|
-
const parts = String$1.split(directory, SEPARATOR$1);
|
|
14552
|
-
return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR$1)), Array.filter((ancestor) => ancestor !== directory));
|
|
14553
|
-
};
|
|
14554
|
-
const readsCargoLock = (manifests, workspaces) => ({ name }) => {
|
|
14555
|
-
const directory = directoryOf(name);
|
|
14556
|
-
const insideWorkspace = pipe(ancestorsOf(directory), Array.some((ancestor) => Array.contains(workspaces, ancestor)));
|
|
14557
|
-
return Array.contains(manifests, directory) && (Array.contains(workspaces, directory) || !insideWorkspace);
|
|
14558
|
-
};
|
|
14559
|
-
const isWorkspaceManifest = (source) => Option.exists(source, (text) => CARGO_WORKSPACE.test(text));
|
|
14560
|
-
const directoriesOf = (entries) => pipe(entries, Array.map(({ name }) => directoryOf(name)));
|
|
14561
|
-
const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(manifests) {
|
|
14562
|
-
const files = yield* RepositoryFiles;
|
|
14563
|
-
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14564
|
-
return directoriesOf(roots);
|
|
14565
|
-
});
|
|
14566
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$8), (end) => String$1.slice(START$8, end)(name));
|
|
14567
|
-
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14568
|
-
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14569
|
-
const cargoProblems = (present, enabled) => {
|
|
14570
|
-
if (!enabled) return Effect.succeed(pipe(present, Array.filter(isCargoManifest), Array.match({
|
|
14571
|
-
onEmpty: () => [],
|
|
14572
|
-
onNonEmpty: (manifests) => [cargoOutsidePnpm(Array.min(manifests, byDepth))]
|
|
14573
|
-
})));
|
|
14574
|
-
return Effect.gen(function* enabledCargoProblems() {
|
|
14575
|
-
const manifests = pipe(present, Array.filter(isCargoManifest));
|
|
14576
|
-
const workspaces = yield* cargoWorkspaces(manifests);
|
|
14577
|
-
const reads = readsCargoLock(directoriesOf(manifests), workspaces);
|
|
14578
|
-
const setup = yield* scanText(pipe(present, Array.filter(isScannedText)), setupProblems);
|
|
14579
|
-
return [
|
|
14580
|
-
...pipe(present, Array.filter((entry) => CARGO_LOCK_FILE.test(entry.name) && !reads(entry)), Array.map(nestedCargoLock)),
|
|
14581
|
-
...pipe(present, Array.filter(isLegacyCargoConfig), Array.map(legacyCargoConfig)),
|
|
14582
|
-
...pnpmOutputs(present),
|
|
14583
|
-
...setup
|
|
14584
|
-
];
|
|
14585
|
-
});
|
|
14586
|
-
};
|
|
14587
|
-
const unneededIn = Effect.fn("unneededIn")(function* unneededIn(root, enabled) {
|
|
14588
|
-
const listed = yield* listedFiles(root);
|
|
14589
|
-
const present = yield* presentFiles(listed);
|
|
14590
|
-
const lockfiles = pipe(present, Array.filter(unneededLockfile(present)), Array.map(foreignLockfile));
|
|
14591
|
-
if (!pipe(present, Array.some(isCargoManifest))) return lockfiles;
|
|
14592
|
-
const cargo = yield* cargoProblems(present, enabled);
|
|
14593
|
-
return [...lockfiles, ...cargo];
|
|
14594
|
-
});
|
|
14595
|
-
/** @internal */
|
|
14596
|
-
const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneededFiles(root) {
|
|
14597
|
-
const workspace = yield* workspaceManifest(root);
|
|
14598
|
-
if (Option.isNone(workspace)) return [];
|
|
14599
|
-
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14600
|
-
});
|
|
14601
|
-
// src/features/check-skills/model/skill-entry.ts
|
|
14602
|
-
const ENTRY_RULE = "unlocked-skill";
|
|
14603
|
-
const VISIBLE_RULE = "skill-source-visible";
|
|
14604
|
-
const CONFIG_FILE$1 = "vite.config.ts";
|
|
14605
|
-
const RENOVATE_FILE = "renovate.json";
|
|
14606
|
-
const SOURCE = "masseater/skills";
|
|
14607
|
-
const PRESET = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
14608
|
-
const START$7 = 0;
|
|
14609
|
-
const LOCAL_PREFIX = "./";
|
|
14610
|
-
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
14611
|
-
const Source = Schema.Struct({
|
|
14612
|
-
commit: Schema.optional(Schema.String),
|
|
14613
|
-
skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
|
|
14614
|
-
});
|
|
14615
|
-
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
14616
|
-
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
14617
|
-
const taggedError$1 = Schema.TaggedError;
|
|
14618
|
-
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14619
|
-
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
14620
|
-
file,
|
|
14621
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$7))),
|
|
14622
|
-
rule,
|
|
14623
|
-
message
|
|
14624
|
-
});
|
|
14625
|
-
const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
|
|
14626
|
-
const files = yield* RepositoryFiles;
|
|
14627
|
-
const file = files.join(root, CONFIG_FILE$1);
|
|
14628
|
-
const text = yield* files.readFile(file);
|
|
14629
|
-
if (Option.isNone(text)) return Option.none();
|
|
14630
|
-
const config = yield* Effect.tryPromise({
|
|
14631
|
-
try: () => resolveConfigFromFile(file),
|
|
14632
|
-
catch: () => SkillsConfigUnreadable.make({ file })
|
|
14633
|
-
}).pipe(Effect.option);
|
|
14634
|
-
return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
|
|
14635
|
-
file,
|
|
14636
|
-
text: text.value,
|
|
14637
|
-
sources: skills
|
|
14638
|
-
})));
|
|
14639
|
-
});
|
|
14640
|
-
const entryProblems = ({ file, text, sources }) => {
|
|
14641
|
-
const at = problemAt$3(ENTRY_RULE, file, text);
|
|
14642
|
-
return pipe(Record.get(sources, SOURCE), Option.match({
|
|
14643
|
-
onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
|
|
14644
|
-
onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
|
|
14645
|
-
}));
|
|
14646
|
-
};
|
|
14647
|
-
const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
|
|
14648
|
-
const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$3(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
|
|
14649
|
-
const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
|
|
14650
|
-
const files = yield* RepositoryFiles;
|
|
14651
|
-
const file = files.join(root, RENOVATE_FILE);
|
|
14652
|
-
const text = yield* files.readFile(file);
|
|
14653
|
-
if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
|
|
14654
|
-
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
|
|
14655
|
-
});
|
|
14656
|
-
/** @internal */
|
|
14657
|
-
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
14658
|
-
const declared = yield* declaredSkills(root);
|
|
14659
|
-
if (Option.isNone(declared)) return [];
|
|
14660
|
-
const preset = yield* presetProblems(root);
|
|
14661
|
-
return [
|
|
14662
|
-
...entryProblems(declared.value),
|
|
14663
|
-
...visibleProblems(declared.value),
|
|
14664
|
-
...preset
|
|
14665
|
-
];
|
|
14666
|
-
});
|
|
14667
|
-
// src/features/check-skills/model/published-skills.ts
|
|
14668
|
-
const RULE$10 = "published-skills";
|
|
14669
|
-
const KEYWORD = "tanstack-intent";
|
|
14670
|
-
const SKILLS = "skills";
|
|
14671
|
-
const MANIFEST_FILE = "package.json";
|
|
14672
|
-
const SKILL_FILE$1 = "SKILL.md";
|
|
14673
|
-
const SUCCEEDED = 0;
|
|
14674
|
-
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14675
|
-
const problemAt$2 = problemInFile(RULE$10);
|
|
14676
|
-
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))));
|
|
14677
|
-
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14678
|
-
const packagingMessages = ({ keywords, files }, skills) => {
|
|
14679
|
-
const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
|
|
14680
|
-
const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
|
|
14681
|
-
return Array.getSomes([keyword, unshipped]);
|
|
14682
|
-
};
|
|
14683
|
-
const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
|
|
14684
|
-
const handle = yield* ChildProcess.make("node", [
|
|
14685
|
-
INTENT_CLI,
|
|
14686
|
-
"validate",
|
|
14687
|
-
SKILLS
|
|
14688
|
-
], {
|
|
14689
|
-
cwd: directory,
|
|
14690
|
-
extendEnv: true,
|
|
14691
|
-
stdin: "ignore"
|
|
14692
|
-
});
|
|
14693
|
-
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
14694
|
-
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
14695
|
-
}, Effect.scoped);
|
|
14696
|
-
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
14697
|
-
const files = yield* RepositoryFiles;
|
|
14698
|
-
const directory = files.join(root, project.directory);
|
|
14699
|
-
const manifest = files.join(directory, MANIFEST_FILE);
|
|
14700
|
-
const skills = skillDirectoriesIn(files, directory);
|
|
14701
|
-
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
|
|
14702
|
-
const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
14703
|
-
return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
|
|
14704
|
-
});
|
|
14705
|
-
/** @internal */
|
|
14706
|
-
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
14707
|
-
const projects = yield* publishedProjects(root);
|
|
14708
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$6(root, project), { concurrency: 1 });
|
|
14709
|
-
return Array.flatten(problems);
|
|
14710
|
-
});
|
|
14711
|
-
// src/features/check-skills/model/skill-files.ts
|
|
14712
|
-
const RULE$9 = "skill-file";
|
|
14713
|
-
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14714
|
-
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14715
|
-
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
14716
|
-
const MARKDOWN = ".md";
|
|
14717
|
-
const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
|
|
14718
|
-
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
14719
|
-
const HEADING = /^# (?<title>.+)$/mu;
|
|
14720
|
-
const NAME_KEY$1 = /^name:/mu;
|
|
14721
|
-
const LICENSE_KEY = /^license:/mu;
|
|
14722
|
-
const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
|
|
14723
|
-
const LINK = /\]\((?<target>[^)\s]+)\)/gu;
|
|
14724
|
-
const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
|
|
14725
|
-
const FRAGMENT = /#.*$/u;
|
|
14726
|
-
const GITHUB = "https://github.com/";
|
|
14727
|
-
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
14728
|
-
const BLANK = /\s+/u;
|
|
14722
|
+
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor$1(entry))));
|
|
14723
|
+
});
|
|
14724
|
+
// src/features/find-unneeded-files/model/lockfiles.ts
|
|
14725
|
+
const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
|
|
14726
|
+
const PLUGIN_LOCKFILE = /(?:^|\/)bun\.lock$/u;
|
|
14727
|
+
const PLUGIN_MANIFEST = ".claude-plugin/plugin.json";
|
|
14728
|
+
const installedByClaudeCode = (present) => ({ name }) => PLUGIN_LOCKFILE.test(name) && pipe(present, Array.some((entry) => entry.name === join(parent(name))(PLUGIN_MANIFEST)));
|
|
14729
|
+
const unneededLockfile = (present) => (entry) => FOREIGN_LOCKFILE.test(entry.name) && !installedByClaudeCode(present)(entry);
|
|
14730
|
+
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
14731
|
+
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
14732
|
+
const PNPM_DIRECTORY = ".pnpm/";
|
|
14729
14733
|
const SEPARATOR = "/";
|
|
14730
|
-
const
|
|
14731
|
-
const
|
|
14732
|
-
const
|
|
14733
|
-
const
|
|
14734
|
-
const
|
|
14735
|
-
|
|
14736
|
-
|
|
14737
|
-
|
|
14734
|
+
const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
|
|
14735
|
+
const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
|
|
14736
|
+
const PNPM_OUTPUT = /(?:^|\/)\.pnpm\//u;
|
|
14737
|
+
const CARGO_WORKSPACE = /^\[workspace\]/mu;
|
|
14738
|
+
const LEGACY_CARGO_CONFIG = /(?:^|\/)\.cargo\/config$/u;
|
|
14739
|
+
const CARGO_CONFIG_FILE = /(?:^|\/)\.cargo\/config\.toml$/u;
|
|
14740
|
+
const PNPM_CARGO_START = /# >>> pnpm-managed cargo sources >>>/u;
|
|
14741
|
+
const PNPM_CARGO_BLOCK = /# >>> pnpm-managed cargo sources >>>[\s\S]*?# <<< pnpm-managed cargo sources <<<\n?/gu;
|
|
14742
|
+
const SETUP_PATTERNS = [
|
|
14743
|
+
/(?<![\w./@-])rustup[ \t]+(?:toolchain[ \t]+install|install|update|default|override[ \t]+set|target[ \t]+add|component[ \t]+add)\b/gu,
|
|
14744
|
+
/(?<![\w./@-])cargo[ \t]+(?:vendor|fetch)\b/gu,
|
|
14745
|
+
/\buses:\s*["']?(?:dtolnay\/rust-toolchain|actions-rust-lang\/setup-rust-toolchain|actions-rs\/toolchain|moonrepo\/setup-rust)\b/gu
|
|
14746
|
+
];
|
|
14747
|
+
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14748
|
+
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14749
|
+
const START$7 = 0;
|
|
14750
|
+
const LAST_SEGMENT = 1;
|
|
14751
|
+
const FIRST_LINE = 1;
|
|
14752
|
+
const FIRST_COLUMN = 1;
|
|
14753
|
+
const WHOLE_MATCH = 0;
|
|
14754
|
+
const FILE_RULE = "unneeded-file";
|
|
14755
|
+
const SETUP_RULE = "unneeded-setup";
|
|
14756
|
+
const CARGO_RULE = "cargo-outside-pnpm";
|
|
14757
|
+
const CargoSettings = Schema.Struct({ enabled: Schema.optionalKey(Schema.Boolean) });
|
|
14758
|
+
const WorkspaceFile = Schema.Struct({ cargo: Schema.optionalKey(CargoSettings) });
|
|
14759
|
+
const decodeWorkspaceFile = Schema.decodeUnknownOption(WorkspaceFile);
|
|
14760
|
+
const cargoEnabled = (manifest) => pipe(decodeWorkspaceFile(manifest), Option.flatMap(({ cargo }) => Option.fromUndefinedOr(cargo)), Option.flatMap(({ enabled }) => Option.fromUndefinedOr(enabled)), Option.getOrElse(() => false));
|
|
14761
|
+
const problemAtStart = (rule, message) => ({ file }) => ({
|
|
14762
|
+
file,
|
|
14763
|
+
line: FIRST_LINE,
|
|
14764
|
+
column: FIRST_COLUMN,
|
|
14765
|
+
rule,
|
|
14766
|
+
message
|
|
14738
14767
|
});
|
|
14739
|
-
const
|
|
14740
|
-
const
|
|
14741
|
-
const
|
|
14742
|
-
const
|
|
14743
|
-
const
|
|
14744
|
-
const
|
|
14745
|
-
|
|
14746
|
-
|
|
14747
|
-
|
|
14748
|
-
return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
|
|
14749
|
-
index: offsetOf$1(source, NAME_KEY$1),
|
|
14750
|
-
message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
|
|
14751
|
-
})), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
|
|
14752
|
-
index: bodyStart + offsetOf$1(body, HEADING),
|
|
14753
|
-
message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
|
|
14754
|
-
})), Option.toArray)];
|
|
14768
|
+
const foreignLockfile = problemAtStart(FILE_RULE, "pnpm-lock.yaml is this repository's lockfile, and pnpm never reads this one. Delete it.");
|
|
14769
|
+
const nestedCargoLock = problemAtStart(FILE_RULE, "Cargo reads only the Cargo.lock beside the workspace's Cargo.toml, and pnpm install writes that one. Delete this one.");
|
|
14770
|
+
const legacyCargoConfig = problemAtStart(FILE_RULE, "pnpm install writes .cargo/config.toml, and Cargo warns when .cargo/config sits beside it. Move its settings into .cargo/config.toml and delete it.");
|
|
14771
|
+
const pnpmOutput = problemAtStart(FILE_RULE, "pnpm install writes .pnpm/ from Cargo.lock and rust-toolchain.toml. Add this .pnpm directory to .gitignore and keep it out of the repository.");
|
|
14772
|
+
const pnpmCargoConfig = problemAtStart(FILE_RULE, "pnpm install writes this .cargo/config.toml, and it holds nothing else. Add /.cargo/config.toml to .gitignore and keep it out of the repository.");
|
|
14773
|
+
const generatedCargoConfig = (entry, source) => {
|
|
14774
|
+
if (!CARGO_CONFIG_FILE.test(entry.name) || !PNPM_CARGO_START.test(source)) return [];
|
|
14775
|
+
if (String$1.isNonEmpty(String$1.trim(String$1.replaceAll(PNPM_CARGO_BLOCK, "")(source)))) return [];
|
|
14776
|
+
return [pnpmCargoConfig(entry)];
|
|
14755
14777
|
};
|
|
14756
|
-
const
|
|
14757
|
-
|
|
14758
|
-
|
|
14759
|
-
|
|
14760
|
-
|
|
14761
|
-
|
|
14762
|
-
|
|
14763
|
-
|
|
14764
|
-
|
|
14765
|
-
|
|
14766
|
-
|
|
14767
|
-
|
|
14768
|
-
file: skill.file,
|
|
14769
|
-
...positionOf(skill.source)(index),
|
|
14770
|
-
rule: RULE$9,
|
|
14771
|
-
message
|
|
14772
|
-
})));
|
|
14773
|
-
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) => ({
|
|
14774
|
-
target,
|
|
14775
|
-
index: found.index ?? START$6
|
|
14776
|
-
})), Option.toArray);
|
|
14777
|
-
const rangeOf$1 = (found) => {
|
|
14778
|
-
const start = found.index ?? START$6;
|
|
14779
|
-
return [start, start + found[START$6].length];
|
|
14778
|
+
const cargoOutsidePnpm = problemAtStart(CARGO_RULE, `pnpm does not manage these crates. Set \`cargo: { enabled: true }\` in ${WORKSPACE_FILE$1} so pnpm install fetches the crates and the Rust toolchain.`);
|
|
14779
|
+
const setupProblem = ({ file }, source, advice) => (found) => ({
|
|
14780
|
+
file,
|
|
14781
|
+
...positionOf(source)(found.index ?? WHOLE_MATCH),
|
|
14782
|
+
rule: SETUP_RULE,
|
|
14783
|
+
message: advice(String$1.trim(found[WHOLE_MATCH]))
|
|
14784
|
+
});
|
|
14785
|
+
const removeSetup = (command) => `pnpm install already installs the toolchain in rust-toolchain.toml and vendors the crates in Cargo.lock. Remove \`${command}\`.`;
|
|
14786
|
+
const buildInstead = (command) => `\`${command}\` fetches crates that pnpm does not vendor. Add the tool as a dependency of a Cargo workspace that pnpm vendors, and build its binary there with \`cargo build -p <crate> --bin <name>\`.`;
|
|
14787
|
+
const setupPatternsFor = (entry) => {
|
|
14788
|
+
if (isToolVersions(entry)) return [...SETUP_PATTERNS, ...TOOL_PATTERNS];
|
|
14789
|
+
return SETUP_PATTERNS;
|
|
14780
14790
|
};
|
|
14781
|
-
const
|
|
14782
|
-
const
|
|
14783
|
-
const
|
|
14784
|
-
|
|
14791
|
+
const matchesOf = (source) => (patterns) => pipe(patterns, Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))));
|
|
14792
|
+
const setupProblems = (entry, source) => {
|
|
14793
|
+
const found = matchesOf(source);
|
|
14794
|
+
const installs = pipe(found(INSTALL_PATTERNS), Array.map(setupProblem(entry, source, buildInstead)));
|
|
14795
|
+
return pipe(found(setupPatternsFor(entry)), Array.map(setupProblem(entry, source, removeSetup)), Array.appendAll(installs), Array.appendAll(generatedCargoConfig(entry, source)));
|
|
14785
14796
|
};
|
|
14786
|
-
const
|
|
14797
|
+
const matches = (pattern) => ({ name }) => pattern.test(name);
|
|
14798
|
+
const isCargoManifest = matches(CARGO_MANIFEST_FILE);
|
|
14799
|
+
const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
|
|
14800
|
+
const isPnpmOutput = matches(PNPM_OUTPUT);
|
|
14801
|
+
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
|
|
14802
|
+
const ancestorsOf = (directory) => {
|
|
14803
|
+
const parts = String$1.split(directory, SEPARATOR);
|
|
14804
|
+
return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
|
|
14805
|
+
};
|
|
14806
|
+
const readsCargoLock = (manifests, workspaces) => ({ name }) => {
|
|
14807
|
+
const directory = directoryOf(name);
|
|
14808
|
+
const insideWorkspace = pipe(ancestorsOf(directory), Array.some((ancestor) => Array.contains(workspaces, ancestor)));
|
|
14809
|
+
return Array.contains(manifests, directory) && (Array.contains(workspaces, directory) || !insideWorkspace);
|
|
14810
|
+
};
|
|
14811
|
+
const isWorkspaceManifest = (source) => Option.exists(source, (text) => CARGO_WORKSPACE.test(text));
|
|
14812
|
+
const directoriesOf = (entries) => pipe(entries, Array.map(({ name }) => directoryOf(name)));
|
|
14813
|
+
const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(manifests) {
|
|
14787
14814
|
const files = yield* RepositoryFiles;
|
|
14788
|
-
const
|
|
14789
|
-
|
|
14790
|
-
const source = text.value;
|
|
14791
|
-
const directory = files.dirname(file);
|
|
14792
|
-
const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
|
|
14793
|
-
const missing = yield* Effect.filter(linksIn(source), isMissing);
|
|
14794
|
-
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14795
|
-
file,
|
|
14796
|
-
...positionOf(source)(index),
|
|
14797
|
-
rule: RULE$9,
|
|
14798
|
-
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14799
|
-
})));
|
|
14815
|
+
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14816
|
+
return directoriesOf(roots);
|
|
14800
14817
|
});
|
|
14801
|
-
const
|
|
14802
|
-
|
|
14803
|
-
|
|
14804
|
-
|
|
14805
|
-
|
|
14806
|
-
|
|
14807
|
-
|
|
14808
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$2 });
|
|
14809
|
-
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
14810
|
-
file: files.join(root, entry),
|
|
14811
|
-
line: FIRST$2,
|
|
14812
|
-
column: FIRST$2,
|
|
14813
|
-
rule: RULE$9,
|
|
14814
|
-
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14818
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$7), (end) => String$1.slice(START$7, end)(name));
|
|
14819
|
+
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14820
|
+
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14821
|
+
const cargoProblems = (present, enabled) => {
|
|
14822
|
+
if (!enabled) return Effect.succeed(pipe(present, Array.filter(isCargoManifest), Array.match({
|
|
14823
|
+
onEmpty: () => [],
|
|
14824
|
+
onNonEmpty: (manifests) => [cargoOutsidePnpm(Array.min(manifests, byDepth))]
|
|
14815
14825
|
})));
|
|
14816
|
-
return
|
|
14817
|
-
|
|
14818
|
-
|
|
14819
|
-
|
|
14820
|
-
|
|
14821
|
-
|
|
14822
|
-
|
|
14823
|
-
|
|
14824
|
-
|
|
14825
|
-
|
|
14826
|
-
|
|
14827
|
-
|
|
14828
|
-
|
|
14829
|
-
|
|
14830
|
-
const
|
|
14831
|
-
|
|
14826
|
+
return Effect.gen(function* enabledCargoProblems() {
|
|
14827
|
+
const manifests = pipe(present, Array.filter(isCargoManifest));
|
|
14828
|
+
const workspaces = yield* cargoWorkspaces(manifests);
|
|
14829
|
+
const reads = readsCargoLock(directoriesOf(manifests), workspaces);
|
|
14830
|
+
const setup = yield* scanText(pipe(present, Array.filter(isScannedText)), setupProblems);
|
|
14831
|
+
return [
|
|
14832
|
+
...pipe(present, Array.filter((entry) => CARGO_LOCK_FILE.test(entry.name) && !reads(entry)), Array.map(nestedCargoLock)),
|
|
14833
|
+
...pipe(present, Array.filter(isLegacyCargoConfig), Array.map(legacyCargoConfig)),
|
|
14834
|
+
...pnpmOutputs(present),
|
|
14835
|
+
...setup
|
|
14836
|
+
];
|
|
14837
|
+
});
|
|
14838
|
+
};
|
|
14839
|
+
const unneededIn = Effect.fn("unneededIn")(function* unneededIn(root, enabled) {
|
|
14840
|
+
const listed = yield* listedFiles(root);
|
|
14841
|
+
const present = yield* presentFiles(listed);
|
|
14842
|
+
const lockfiles = pipe(present, Array.filter(unneededLockfile(present)), Array.map(foreignLockfile));
|
|
14843
|
+
if (!pipe(present, Array.some(isCargoManifest))) return lockfiles;
|
|
14844
|
+
const cargo = yield* cargoProblems(present, enabled);
|
|
14845
|
+
return [...lockfiles, ...cargo];
|
|
14832
14846
|
});
|
|
14833
|
-
// src/app/document-checks.ts
|
|
14834
14847
|
/** @internal */
|
|
14835
|
-
const
|
|
14836
|
-
const
|
|
14837
|
-
|
|
14838
|
-
|
|
14839
|
-
checkPublishedSkills(root),
|
|
14840
|
-
checkReferenceLinks(root)
|
|
14841
|
-
], { concurrency: "unbounded" });
|
|
14842
|
-
return Array.flatten(found);
|
|
14848
|
+
const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneededFiles(root) {
|
|
14849
|
+
const workspace = yield* workspaceManifest(root);
|
|
14850
|
+
if (Option.isNone(workspace)) return [];
|
|
14851
|
+
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14843
14852
|
});
|
|
14844
14853
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
14845
|
-
const RULE$
|
|
14854
|
+
const RULE$9 = "effect-diagnostics-once";
|
|
14846
14855
|
const PLUGIN = "@effect/language-service";
|
|
14847
14856
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14848
|
-
const EXCLUDED$
|
|
14849
|
-
const START$
|
|
14857
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14858
|
+
const START$6 = 0;
|
|
14850
14859
|
const Plugin = Schema.Struct({
|
|
14851
14860
|
name: Schema.optional(Schema.String),
|
|
14852
14861
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14857,30 +14866,30 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
14857
14866
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
14858
14867
|
const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
|
|
14859
14868
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14860
|
-
const problemsIn$
|
|
14869
|
+
const problemsIn$3 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
14861
14870
|
file: entry.file,
|
|
14862
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14863
|
-
rule: RULE$
|
|
14871
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$6))),
|
|
14872
|
+
rule: RULE$9,
|
|
14864
14873
|
message: MESSAGE$1
|
|
14865
14874
|
})), Option.toArray);
|
|
14866
14875
|
/** @internal */
|
|
14867
14876
|
const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* checkEffectDiagnostics(root) {
|
|
14868
14877
|
const files = yield* RepositoryFiles;
|
|
14869
|
-
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$
|
|
14878
|
+
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$3]);
|
|
14870
14879
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
14871
14880
|
name,
|
|
14872
14881
|
file: files.join(root, name)
|
|
14873
|
-
}))), problemsIn$
|
|
14882
|
+
}))), problemsIn$3);
|
|
14874
14883
|
});
|
|
14875
14884
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
14876
|
-
const RULE$
|
|
14885
|
+
const RULE$8 = "version-range";
|
|
14877
14886
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
14878
14887
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14879
14888
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14880
14889
|
const PATH_LIKE = "/";
|
|
14881
|
-
const EXCLUDED$
|
|
14890
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14882
14891
|
const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
|
|
14883
|
-
const versionOf = (specifier) => Option.getOrElse(groupOf
|
|
14892
|
+
const versionOf = (specifier) => Option.getOrElse(groupOf("version")(ALIAS.exec(specifier)), () => specifier);
|
|
14884
14893
|
/** @internal */
|
|
14885
14894
|
const isRange = (specifier) => {
|
|
14886
14895
|
const version = versionOf(specifier);
|
|
@@ -14889,7 +14898,7 @@ const isRange = (specifier) => {
|
|
|
14889
14898
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14890
14899
|
file,
|
|
14891
14900
|
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14892
|
-
rule: RULE$
|
|
14901
|
+
rule: RULE$8,
|
|
14893
14902
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14894
14903
|
})));
|
|
14895
14904
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "mu");
|
|
@@ -14908,7 +14917,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14908
14917
|
/** @internal */
|
|
14909
14918
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
14910
14919
|
const files = yield* RepositoryFiles;
|
|
14911
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14920
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14912
14921
|
const listed = pipe(manifests, Array.map((name) => ({
|
|
14913
14922
|
name,
|
|
14914
14923
|
file: files.join(root, name)
|
|
@@ -14918,32 +14927,25 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14918
14927
|
return [...fromManifests, ...fromCatalogs];
|
|
14919
14928
|
});
|
|
14920
14929
|
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14921
|
-
const RULE$
|
|
14930
|
+
const RULE$7 = "pack-publint";
|
|
14922
14931
|
const CONFIG_FILE = "vite.config.ts";
|
|
14923
14932
|
const PACK_KEY = "pack:";
|
|
14924
|
-
const START$
|
|
14933
|
+
const START$5 = 0;
|
|
14925
14934
|
const READ_CONCURRENCY$1 = 16;
|
|
14926
|
-
const EXCLUDED$
|
|
14927
|
-
const Manifest$4 = Schema.Struct({
|
|
14928
|
-
private: Schema.optional(Schema.Boolean),
|
|
14929
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14930
|
-
});
|
|
14931
|
-
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
14935
|
+
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14932
14936
|
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14933
14937
|
const isStrict = Schema.is(StrictPack);
|
|
14934
14938
|
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
14935
14939
|
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
14936
14940
|
const taggedError = Schema.TaggedError;
|
|
14937
14941
|
var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
14938
|
-
const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14939
14942
|
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14940
14943
|
const problemFor = (file, source) => ({
|
|
14941
14944
|
file,
|
|
14942
|
-
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$
|
|
14943
|
-
rule: RULE$
|
|
14945
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$5)),
|
|
14946
|
+
rule: RULE$7,
|
|
14944
14947
|
message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
|
|
14945
14948
|
});
|
|
14946
|
-
const publishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.filter(isPublished$2));
|
|
14947
14949
|
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14948
14950
|
const config = yield* Effect.tryPromise({
|
|
14949
14951
|
try: () => resolveConfigFromFile(configFile),
|
|
@@ -14957,50 +14959,21 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
|
|
|
14957
14959
|
if (yield* strictPublintIn(configFile)) return [];
|
|
14958
14960
|
return [problemFor(configFile, source.value)];
|
|
14959
14961
|
});
|
|
14960
|
-
const problemsIn$
|
|
14962
|
+
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14961
14963
|
const files = yield* RepositoryFiles;
|
|
14962
14964
|
const source = yield* files.readFile(files.join(root, manifestName));
|
|
14963
|
-
const manifest =
|
|
14965
|
+
const manifest = publishedManifestOf(source);
|
|
14964
14966
|
if (Option.isNone(manifest)) return [];
|
|
14965
14967
|
return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14966
14968
|
});
|
|
14967
14969
|
/** @internal */
|
|
14968
14970
|
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14969
|
-
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14970
|
-
const found = yield* Effect.forEach(manifests, (name) => problemsIn$
|
|
14971
|
+
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
14972
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14971
14973
|
return Array.flatten(found);
|
|
14972
14974
|
});
|
|
14973
|
-
// src/features/check-package-scope/model/package-scope.ts
|
|
14974
|
-
const RULE$5 = "package-scope";
|
|
14975
|
-
const SCOPE = "@r_masseater/";
|
|
14976
|
-
const NAME_KEY = "\"name\"";
|
|
14977
|
-
const START$3 = 0;
|
|
14978
|
-
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14979
|
-
const Manifest$3 = Schema.Struct({
|
|
14980
|
-
name: Schema.optional(Schema.String),
|
|
14981
|
-
private: Schema.optional(Schema.Boolean),
|
|
14982
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14983
|
-
});
|
|
14984
|
-
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
14985
|
-
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14986
|
-
const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
14987
|
-
const problemsIn$2 = (entry, source) => pipe(decodeManifest$3(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
|
|
14988
|
-
file: entry.file,
|
|
14989
|
-
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3))),
|
|
14990
|
-
rule: RULE$5,
|
|
14991
|
-
message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
|
|
14992
|
-
})), Option.toArray);
|
|
14993
|
-
/** @internal */
|
|
14994
|
-
const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageScope(root) {
|
|
14995
|
-
const files = yield* RepositoryFiles;
|
|
14996
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
14997
|
-
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
14998
|
-
name,
|
|
14999
|
-
file: files.join(root, name)
|
|
15000
|
-
}))), problemsIn$2);
|
|
15001
|
-
});
|
|
15002
14975
|
// src/features/check-plugin-marketplace/model/plugin-marketplace.ts
|
|
15003
|
-
const RULE$
|
|
14976
|
+
const RULE$6 = "plugin-marketplace";
|
|
15004
14977
|
const PLUGIN_DIRECTORY = ".claude-plugin";
|
|
15005
14978
|
const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
|
|
15006
14979
|
const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
|
|
@@ -15056,7 +15029,7 @@ const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
|
15056
15029
|
description: Option.getOrElse(project.description, () => "")
|
|
15057
15030
|
})));
|
|
15058
15031
|
});
|
|
15059
|
-
const problem = problemInFile(RULE$
|
|
15032
|
+
const problem = problemInFile(RULE$6);
|
|
15060
15033
|
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
15061
15034
|
const projects = yield* workspaceProjects(root);
|
|
15062
15035
|
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
@@ -15100,6 +15073,56 @@ const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* che
|
|
|
15100
15073
|
});
|
|
15101
15074
|
return yield* rewrite(file, `${text}\n`);
|
|
15102
15075
|
});
|
|
15076
|
+
// src/features/check-published-manifest/model/package-homepage.ts
|
|
15077
|
+
const RULE$5 = "package-homepage";
|
|
15078
|
+
const BRANCH = "main";
|
|
15079
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
15080
|
+
const START$4 = 0;
|
|
15081
|
+
const KEYS = [
|
|
15082
|
+
"\"homepage\"",
|
|
15083
|
+
"\"repository\"",
|
|
15084
|
+
"\"name\""
|
|
15085
|
+
];
|
|
15086
|
+
const RepositoryObject = Schema.Struct({
|
|
15087
|
+
url: Schema.String,
|
|
15088
|
+
directory: Schema.optional(Schema.String)
|
|
15089
|
+
});
|
|
15090
|
+
const decodeRepository = Schema.decodeUnknownOption(RepositoryObject);
|
|
15091
|
+
const repositoryMissing = (directory) => `Published packages declare \`repository\` as \`{ "type": "git", "url": "git+https://github.com/<owner>/<repository>.git", "directory": "${directory}" }\` so that npm and \`npm repo\` link to the source.`;
|
|
15092
|
+
const directoryWrong = (directory) => `In a monorepo \`repository.directory\` names the package directory, so npm links to the package and not to the repository root. Set it to "${directory}".`;
|
|
15093
|
+
const homepageWrong = (homepage) => `\`homepage\` is the link npm shows as the package's home, and the repository root is not the package. Set it to "${homepage}".`;
|
|
15094
|
+
const repositoryUrlOf = (url) => pipe(url, String$1.replace(/^git\+/u, ""), String$1.replace(/\.git$/u, ""));
|
|
15095
|
+
const homepageOf = (url, directory) => `${repositoryUrlOf(url)}/tree/${BRANCH}/${directory}#readme`;
|
|
15096
|
+
const repositoryMessages = (manifest, directory) => (repository) => {
|
|
15097
|
+
const expected = homepageOf(repository.url, directory);
|
|
15098
|
+
const wrongDirectory = directoryWrong(directory);
|
|
15099
|
+
const wrongHomepage = homepageWrong(expected);
|
|
15100
|
+
return Array.getSomes([Option.liftPredicate(wrongDirectory, () => repository.directory !== directory), Option.liftPredicate(wrongHomepage, () => manifest.homepage !== expected)]);
|
|
15101
|
+
};
|
|
15102
|
+
const messagesOf = (manifest, directory) => pipe(decodeRepository(manifest.repository), Option.match({
|
|
15103
|
+
onNone: () => [repositoryMissing(directory)],
|
|
15104
|
+
onSome: repositoryMessages(manifest, directory)
|
|
15105
|
+
}));
|
|
15106
|
+
const firstKeyIndex = (source) => pipe(KEYS, Array.findFirst((key) => String$1.includes(key)(source)), Option.flatMap((key) => String$1.indexOf(key)(source)), Option.getOrElse(() => START$4));
|
|
15107
|
+
/** @internal */
|
|
15108
|
+
const homepageProblems = (dirname) => ({ entry, source, manifest }) => pipe(Option.some(dirname(entry.name)), Option.filter((directory) => directory !== ROOT_DIRECTORY$1), Option.map((directory) => messagesOf(manifest, directory)), Option.getOrElse(() => []), Array.map((message) => problemAtIndex(RULE$5)(entry.file, source)(firstKeyIndex(source), message)));
|
|
15109
|
+
// src/features/check-published-manifest/model/package-scope.ts
|
|
15110
|
+
const RULE$4 = "package-scope";
|
|
15111
|
+
const SCOPE = "@r_masseater/";
|
|
15112
|
+
const NAME_KEY = "\"name\"";
|
|
15113
|
+
const START$3 = 0;
|
|
15114
|
+
const unscopedName = ({ manifest }) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
15115
|
+
const nameIndex = (source) => pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3));
|
|
15116
|
+
const messageFor = (name) => `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`;
|
|
15117
|
+
/** @internal */
|
|
15118
|
+
const scopeProblems = (found) => pipe(unscopedName(found), Option.map((name) => problemAtIndex(RULE$4)(found.entry.file, found.source)(nameIndex(found.source), messageFor(name))), Option.toArray);
|
|
15119
|
+
// src/features/check-published-manifest/model/published-manifests.ts
|
|
15120
|
+
/** @internal */
|
|
15121
|
+
const checkPublishedManifests = Effect.fn("checkPublishedManifests")(function* checkPublishedManifests(root) {
|
|
15122
|
+
const files = yield* RepositoryFiles;
|
|
15123
|
+
const homepage = homepageProblems(files.dirname);
|
|
15124
|
+
return yield* scanPublishedManifests(root, (found) => [...scopeProblems(found), ...homepage(found)]);
|
|
15125
|
+
});
|
|
15103
15126
|
// src/features/check-runtime-version/model/node-version.ts
|
|
15104
15127
|
const RULE$3 = "node-version";
|
|
15105
15128
|
const MINIMUM = 26;
|
|
@@ -15124,7 +15147,7 @@ const Manifest$2 = Schema.Struct({
|
|
|
15124
15147
|
engines: Schema.optional(Engines)
|
|
15125
15148
|
});
|
|
15126
15149
|
const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
15127
|
-
const majorOf = (found) => pipe(groupOf
|
|
15150
|
+
const majorOf = (found) => pipe(groupOf("major")(found), Option.map(Number));
|
|
15128
15151
|
const isOld = (major) => major < MINIMUM;
|
|
15129
15152
|
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
15130
15153
|
const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
@@ -15132,19 +15155,14 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
|
15132
15155
|
onSome: isOld
|
|
15133
15156
|
}));
|
|
15134
15157
|
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
|
|
15135
|
-
const problemAt
|
|
15136
|
-
file: entry.file,
|
|
15137
|
-
...positionOf(source)(index),
|
|
15138
|
-
rule: RULE$3,
|
|
15139
|
-
message
|
|
15140
|
-
});
|
|
15158
|
+
const problemAt = ({ entry, source, index }, message) => problemAtIndex(RULE$3)(entry.file, source)(index, message);
|
|
15141
15159
|
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$2));
|
|
15142
|
-
const unstatedProblem = (entry, source) => problemAt
|
|
15160
|
+
const unstatedProblem = (entry, source) => problemAt({
|
|
15143
15161
|
entry,
|
|
15144
15162
|
source,
|
|
15145
15163
|
index: START$2
|
|
15146
15164
|
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
15147
|
-
const rangeProblem = (entry, source) => (range) => problemAt
|
|
15165
|
+
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
15148
15166
|
entry,
|
|
15149
15167
|
source,
|
|
15150
15168
|
index: offsetOf(source, ENGINES_KEY)
|
|
@@ -15158,12 +15176,12 @@ const manifestProblems$1 = (entry, source) => {
|
|
|
15158
15176
|
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
15159
15177
|
return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
|
|
15160
15178
|
};
|
|
15161
|
-
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt
|
|
15179
|
+
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
|
|
15162
15180
|
entry,
|
|
15163
15181
|
source,
|
|
15164
15182
|
index: found.index ?? START$2
|
|
15165
15183
|
}, `${SUPPORTED} \`${String$1.trim(found[START$2])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
15166
|
-
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt
|
|
15184
|
+
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
15167
15185
|
entry,
|
|
15168
15186
|
source,
|
|
15169
15187
|
index: START$2
|
|
@@ -15314,12 +15332,6 @@ const Manifest = Schema.fromJsonString(Schema.Struct({
|
|
|
15314
15332
|
}));
|
|
15315
15333
|
const decodeManifest = Schema.decodeUnknownOption(Manifest);
|
|
15316
15334
|
const isManifest = (name) => name === MANIFEST || String$1.endsWith(`/${MANIFEST}`)(name);
|
|
15317
|
-
const problemAt = (entry, source) => (index, message) => ({
|
|
15318
|
-
file: entry.file,
|
|
15319
|
-
...positionOf(source)(index),
|
|
15320
|
-
rule: RULE$1,
|
|
15321
|
-
message
|
|
15322
|
-
});
|
|
15323
15335
|
const keyIndex = (source, key) => Option.getOrElse(String$1.indexOf(`"${key}"`)(source), () => START);
|
|
15324
15336
|
const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
|
|
15325
15337
|
onNone: () => [],
|
|
@@ -15336,8 +15348,8 @@ const fieldsIn = (source) => pipe(decodeManifest(source), Option.match({
|
|
|
15336
15348
|
return [...pnpmFields, ...managerFields];
|
|
15337
15349
|
}
|
|
15338
15350
|
}));
|
|
15339
|
-
const manifestProblems = (entry, source) => pipe(fieldsIn(source), Array.map(({ name, key }) =>
|
|
15340
|
-
const firstEntryProblem = (entry, source, deviations) => pipe(Array.head(deviations.entries), Option.map(({ index }) =>
|
|
15351
|
+
const manifestProblems = (entry, source) => pipe(fieldsIn(source), Array.map(({ name, key }) => problemAtIndex(RULE$1)(entry.file, source)(keyIndex(source, key), `${name} in package.json is not allowed. ${PLACE} Move it there.`)));
|
|
15352
|
+
const firstEntryProblem = (entry, source, deviations) => pipe(Array.head(deviations.entries), Option.map(({ index }) => problemAtIndex(RULE$1)(entry.file, source)(index, `This file is not read for upstream deviations. ${PLACE}`)), Option.toArray);
|
|
15341
15353
|
const problemsIn = (entry, source) => {
|
|
15342
15354
|
if (isManifest(entry.name)) return manifestProblems(entry, source);
|
|
15343
15355
|
if (String$1.endsWith(NESTED_WORKSPACE)(entry.name)) return firstEntryProblem(entry, source, workspaceDeviations(source));
|
|
@@ -15369,7 +15381,7 @@ const checkWorkspaceDescriptions = Effect.fn("checkWorkspaceDescriptions")(funct
|
|
|
15369
15381
|
const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
|
|
15370
15382
|
const found = yield* Effect.all([
|
|
15371
15383
|
checkNodeVersion(root),
|
|
15372
|
-
|
|
15384
|
+
checkPublishedManifests(root),
|
|
15373
15385
|
checkPackSettings(root),
|
|
15374
15386
|
checkUnusedWorkspaces(root),
|
|
15375
15387
|
checkExactVersions(root),
|
|
@@ -15391,7 +15403,9 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
15391
15403
|
checkUnneededFiles(root),
|
|
15392
15404
|
checkReplacedTools(root),
|
|
15393
15405
|
checkManifests(root),
|
|
15394
|
-
|
|
15406
|
+
checkSkillFiles(root),
|
|
15407
|
+
checkSkillEntry(root),
|
|
15408
|
+
checkPublishedSkills(root),
|
|
15395
15409
|
checkComments(root),
|
|
15396
15410
|
checkAppliedPackages(root),
|
|
15397
15411
|
checkGitSubpath(root),
|