@r_masseater/msch 0.95.0 → 0.97.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/{base-revision-uiUwYlbc.mjs → base-revision-Bl-4nxAd.mjs} +2 -2
- package/dist/{base-revision-uiUwYlbc.mjs.map → base-revision-Bl-4nxAd.mjs.map} +1 -1
- package/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +5 -5
- package/dist/cli.mjs +403 -196
- package/dist/cli.mjs.map +1 -1
- package/dist/config-BBdsNPSO.mjs.map +1 -1
- package/dist/config.d.mts +19 -16
- package/dist/config.mjs +23 -161
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-BjHY5WNt.mjs → define-lint-preset-B-hC9_df.mjs} +60 -45
- package/dist/define-lint-preset-B-hC9_df.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/{ignored-directories-BRRODOoG.mjs → ignored-directories-D-7Rm_2X.mjs} +2 -2
- package/dist/{ignored-directories-BRRODOoG.mjs.map → ignored-directories-D-7Rm_2X.mjs.map} +1 -1
- package/dist/{index-Bw2kfEek.d.mts → index-CEazCJ_w.d.mts} +38 -11
- package/dist/{index-CMyIrsah.d.mts → index-Dm0Gg9wS.d.mts} +2 -2
- package/dist/judge.mjs +4 -4
- package/dist/lint-rules.mjs +23 -11
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +2 -2
- package/dist/lint.mjs +1 -1
- package/dist/{lookup-report-BWiDFlSS.mjs → lookup-report-L5OLXRMf.mjs} +3 -3
- package/dist/{lookup-report-BWiDFlSS.mjs.map → lookup-report-L5OLXRMf.mjs.map} +1 -1
- package/dist/{manifest-texts-Bhlz2Z2_.mjs → manifest-texts-DPgsV8kj.mjs} +2 -2
- package/dist/{manifest-texts-Bhlz2Z2_.mjs.map → manifest-texts-DPgsV8kj.mjs.map} +1 -1
- package/dist/{output-B4GNchqH.mjs → output-DAvdel9H.mjs} +3 -3
- package/dist/{output-B4GNchqH.mjs.map → output-DAvdel9H.mjs.map} +1 -1
- package/dist/oxlint.mjs +2 -2
- package/dist/{package-routes-BdYpOLTv.mjs → package-routes-BQWX5ttU.mjs} +2 -2
- package/dist/{package-routes-BdYpOLTv.mjs.map → package-routes-BQWX5ttU.mjs.map} +1 -1
- package/dist/{package-versions-BLtKon6D.mjs → package-versions-sx15IGwA.mjs} +4 -4
- package/dist/{package-versions-BLtKon6D.mjs.map → package-versions-sx15IGwA.mjs.map} +1 -1
- package/dist/{pass-records-ljpQ--tm.mjs → pass-records-BcAAWgiQ.mjs} +4 -4
- package/dist/{pass-records-ljpQ--tm.mjs.map → pass-records-BcAAWgiQ.mjs.map} +1 -1
- package/dist/{problem-Bi4Kgg9b.mjs → problem-DbuTeNvL.mjs} +2 -2
- package/dist/{problem-Bi4Kgg9b.mjs.map → problem-DbuTeNvL.mjs.map} +1 -1
- package/dist/publish.mjs +1 -1
- package/dist/{published-BGur-Htr.mjs → published-3eokcs_D.mjs} +17 -3
- package/dist/published-3eokcs_D.mjs.map +1 -0
- package/dist/published.mjs +6 -6
- package/dist/refs.mjs +4 -5
- package/dist/refs.mjs.map +1 -1
- package/dist/{registry-releases-CaO-8xAO.mjs → registry-releases-BBtz4wGE.mjs} +2 -2
- package/dist/{registry-releases-CaO-8xAO.mjs.map → registry-releases-BBtz4wGE.mjs.map} +1 -1
- package/dist/{repository-files-hbJpQ1i0.mjs → repository-files-DSwKJnrj.mjs} +5 -4
- package/dist/repository-files-DSwKJnrj.mjs.map +1 -0
- package/dist/repository-text-DGfYd5Wq.mjs +178 -0
- package/dist/repository-text-DGfYd5Wq.mjs.map +1 -0
- package/dist/{runtime-BdEuIL6Z.mjs → runtime-Djm7zMwu.mjs} +2 -2
- package/dist/{runtime-BdEuIL6Z.mjs.map → runtime-Djm7zMwu.mjs.map} +1 -1
- package/dist/unbumped.mjs +5 -5
- package/dist/{upstream-exits-BC8ofnVa.mjs → upstream-exits-4bn4gblF.mjs} +5 -6
- package/dist/{upstream-exits-BC8ofnVa.mjs.map → upstream-exits-4bn4gblF.mjs.map} +1 -1
- package/dist/{upstream-record-I5ZgAwk-.mjs → upstream-record-DRNGym9S.mjs} +2 -3
- package/dist/{upstream-record-I5ZgAwk-.mjs.map → upstream-record-DRNGym9S.mjs.map} +1 -1
- package/dist/upstream.mjs +6 -6
- package/dist/{workspace-projects-DnWDM8G1.mjs → workspace-projects-MpL8K7Nz.mjs} +2 -2
- package/dist/{workspace-projects-DnWDM8G1.mjs.map → workspace-projects-MpL8K7Nz.mjs.map} +1 -1
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +50 -31
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +10 -10
- package/skills/msch-publishing/SKILL.md +1 -1
- package/skills/msch-repository-config/SKILL.md +19 -8
- package/skills/msch-workspace-settings/SKILL.md +8 -10
- package/src/app/vite.d.ts +3 -3
- package/dist/collections-CdEHfcEj.mjs +0 -6
- package/dist/collections-CdEHfcEj.mjs.map +0 -1
- package/dist/define-lint-preset-BjHY5WNt.mjs.map +0 -1
- package/dist/index-skill-Bf5Ish11.mjs +0 -19
- package/dist/index-skill-Bf5Ish11.mjs.map +0 -1
- package/dist/published-BGur-Htr.mjs.map +0 -1
- package/dist/repository-files-hbJpQ1i0.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
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-
|
|
3
|
-
import { n as NODE_MODULES, o as TOOL_NAME$1, r as RepositoryFiles, t as MSCH_CACHE } from "./repository-files-
|
|
2
|
+
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-BcAAWgiQ.mjs";
|
|
3
|
+
import { n as NODE_MODULES, o as TOOL_NAME$1, r as RepositoryFiles, s as groupOf, t as MSCH_CACHE } from "./repository-files-DSwKJnrj.mjs";
|
|
4
4
|
import { t as workspaceManifest } from "./workspace-manifest-BAVyPzbA.mjs";
|
|
5
|
-
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-
|
|
5
|
+
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-4bn4gblF.mjs";
|
|
6
6
|
import { a as parent, i as join, n as isInside, t as baseName } from "./path-DUttmo2s.mjs";
|
|
7
|
-
import { i as workspaceProjects, n as unmatchedWorkspacePatterns, o as installedManifest, r as workspaceDirectories, s as readManifest, t as publishedProjects } from "./workspace-projects-
|
|
8
|
-
import { $ as isIdentifier, A as uniqueByReference, B as getTextOfJSDocComment, C as moduleSpecifierOf, E as referencedSymbols, F as SymbolFlags, G as isCallExpression, H as isArrowFunction, I as SyntaxKind, J as isEnumDeclaration, K as isClassDeclaration, L as getJSDocTags, O as symbolAt, P as SignatureKind, Q as isFunctionExpression, S as moduleSpecifierLiteralOf, St as isVariableStatement, T as propertyNamesOf, U as isBinaryExpression, V as isArrayLiteralExpression, W as isBlock, X as isExpressionStatement, Y as isExportDeclaration, Z as isFunctionDeclaration, _ as isGenericDeclaration, _t as isTypeLiteralNode, a as problemAtPosition, at as isNumericLiteral, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, ct as isPropertyAccessExpression, d as contains, dt as isSatisfiesExpression, et as isImportDeclaration, f as declarationsOf, ft as isSignatureDeclaration, g as isExternalDeclaration, gt as isTypeAliasDeclaration, h as importedModulesOf, ht as isStringLiteral, i as problemAt$7, it as isNewExpression, k as symbolAtLocation, l as childrenOf$1, lt as isPropertyAssignment, m as descendantsOf, mt as isSpreadElement, nt as isModuleBlock, o as problemInFile, ot as isObjectLiteralExpression, p as declaresAType, pt as isSourceFile, q as isElementAccessExpression, rt as isModuleDeclaration, s as sortProblems, st as isParenthesizedExpression, t as ProblemList, tt as isInterfaceDeclaration, u as columnOf, ut as isReturnStatement, v as isInsideAny, vt as isTypeReferenceNode, w as packageOf$1, x as lineOf$3, xt as isVariableDeclarationList, y as isOutsideDeclaration, yt as isUnionTypeNode, z as getNameOfDeclaration } from "./problem-
|
|
9
|
-
import {
|
|
7
|
+
import { i as workspaceProjects, n as unmatchedWorkspacePatterns, o as installedManifest, r as workspaceDirectories, s as readManifest, t as publishedProjects } from "./workspace-projects-MpL8K7Nz.mjs";
|
|
8
|
+
import { $ as isIdentifier, A as uniqueByReference, B as getTextOfJSDocComment, C as moduleSpecifierOf, E as referencedSymbols, F as SymbolFlags, G as isCallExpression, H as isArrowFunction, I as SyntaxKind, J as isEnumDeclaration, K as isClassDeclaration, L as getJSDocTags, O as symbolAt, P as SignatureKind, Q as isFunctionExpression, S as moduleSpecifierLiteralOf, St as isVariableStatement, T as propertyNamesOf, U as isBinaryExpression, V as isArrayLiteralExpression, W as isBlock, X as isExpressionStatement, Y as isExportDeclaration, Z as isFunctionDeclaration, _ as isGenericDeclaration, _t as isTypeLiteralNode, a as problemAtPosition, at as isNumericLiteral, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, ct as isPropertyAccessExpression, d as contains, dt as isSatisfiesExpression, et as isImportDeclaration, f as declarationsOf, ft as isSignatureDeclaration, g as isExternalDeclaration, gt as isTypeAliasDeclaration, h as importedModulesOf, ht as isStringLiteral, i as problemAt$7, it as isNewExpression, k as symbolAtLocation, l as childrenOf$1, lt as isPropertyAssignment, m as descendantsOf, mt as isSpreadElement, nt as isModuleBlock, o as problemInFile, ot as isObjectLiteralExpression, p as declaresAType, pt as isSourceFile, q as isElementAccessExpression, rt as isModuleDeclaration, s as sortProblems, st as isParenthesizedExpression, t as ProblemList, tt as isInterfaceDeclaration, u as columnOf, ut as isReturnStatement, v as isInsideAny, vt as isTypeReferenceNode, w as packageOf$1, x as lineOf$3, xt as isVariableDeclarationList, y as isOutsideDeclaration, yt as isUnionTypeNode, z as getNameOfDeclaration } from "./problem-DbuTeNvL.mjs";
|
|
9
|
+
import { C as hasVerifyTask, F as literalOf, I as nestedValues, L as propertyValue, M as KeySchema, N as childrenOf$2, P as keyName, R as stringsIn, S as definesTask, _ as shadcnUiOf, a as workspaceConfigs, b as RUN_TASKS, c as publicEntriesOf, d as splitFrontmatter, h as deployEntries, i as publishedWorkspaces, j as workspaceConfigOf, l as isIndexSkill, m as bundledEntries, o as entryNameOf, p as workspaceLinks, r as packedWorkspaces, s as isBinEntry, u as FRONTMATTER, x as VERIFY_TASK } from "./published-3eokcs_D.mjs";
|
|
10
10
|
import { r as JAPANESE } from "./config-BBdsNPSO.mjs";
|
|
11
|
-
import { d as RENOVATE_PRESET, f as SELF_NAME } from "./package-routes-
|
|
11
|
+
import { d as RENOVATE_PRESET, f as SELF_NAME } from "./package-routes-BQWX5ttU.mjs";
|
|
12
12
|
import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
|
|
13
|
-
import { t as
|
|
14
|
-
import { n as
|
|
15
|
-
import { a as
|
|
13
|
+
import { n as baseRevision, t as baseName$1 } from "./base-revision-Bl-4nxAd.mjs";
|
|
14
|
+
import { S as exempt, f as lint$3, h as decisionTestRules, n as MARKDOWN_RULES, t as MARKDOWN_IGNORES } from "./define-lint-preset-B-hC9_df.mjs";
|
|
15
|
+
import { a as MSCH_TASK_COMMANDS, n as builtTextRuleNames, r as secretsOf, t as TEXT_IGNORES } from "./repository-text-DGfYd5Wq.mjs";
|
|
16
|
+
import { a as presentFiles, i as listedFiles, n as isScannedText, o as scanText, r as isToolVersions, t as upstreamRecords } from "./upstream-record-DRNGym9S.mjs";
|
|
16
17
|
import { a as offsetIn$1, i as namedCatalogsOf, n as manifestPattern, o as quoted$1, r as manifestSpecifiers, s as specifiedIn, t as fieldsOf } from "./specifiers-BrCyPubD.mjs";
|
|
17
18
|
import { i as withTrailingSlash, n as PUBLIC_REGISTRY, r as scopeOfName, t as INSTALL_REGISTRY } from "./registries-DePiYd3D.mjs";
|
|
18
|
-
import {
|
|
19
|
-
import { t as
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import { t as runCli } from "./runtime-BdEuIL6Z.mjs";
|
|
19
|
+
import { t as checkPackageVersions } from "./package-versions-sx15IGwA.mjs";
|
|
20
|
+
import { t as manifestTexts } from "./manifest-texts-DPgsV8kj.mjs";
|
|
21
|
+
import { i as writeProblems, n as failWhenAny, r as writeJsonProblems } from "./output-DAvdel9H.mjs";
|
|
22
|
+
import { t as runCli } from "./runtime-Djm7zMwu.mjs";
|
|
23
23
|
import "./cli-contract-D7btWrEu.mjs";
|
|
24
24
|
import { builtinModules, isBuiltin } from "node:module";
|
|
25
25
|
import { VpToolsError, findCiDrift, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
26
|
-
import { Array as Array$1, Boolean as Boolean$1, Context, Effect, FileSystem, HashMap, HashSet, Match, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
26
|
+
import { Array as Array$1, Boolean as Boolean$1, Context, Effect, Equal, FileSystem, HashMap, HashSet, Match, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
27
27
|
import { lockedGraph, lockedPackageIds, parseDependencyPath, updateWorkspaceManifest } from "@r_masseater/masseater-utils/kestrion/pnpm";
|
|
28
28
|
import { ChildProcess } from "effect/process";
|
|
29
29
|
import { PACKAGE_JSON_FILE, RUNTIME_SECTIONS, binEntriesOf, namesIn, optionalPeerNames, runtimeDependencyNames, targetsIn } from "@r_masseater/masseater-utils/kestrion";
|
|
@@ -480,8 +480,8 @@ const RESOLUTION_FILES = [
|
|
|
480
480
|
];
|
|
481
481
|
const RESOLUTION_CONCURRENCY = 2;
|
|
482
482
|
const SUCCEEDED$1 = 0;
|
|
483
|
-
const taggedError$
|
|
484
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
483
|
+
const taggedError$8 = Schema.TaggedError;
|
|
484
|
+
var OverrideResolutionFailed = class extends taggedError$8()("OverrideResolutionFailed", {
|
|
485
485
|
override: Schema.String,
|
|
486
486
|
output: Schema.String
|
|
487
487
|
}) {};
|
|
@@ -598,12 +598,12 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
598
598
|
// src/features/check-overrides/model/git-subpath.ts
|
|
599
599
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
600
600
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
601
|
-
const RULE$
|
|
601
|
+
const RULE$79 = "git-subpath-dependency";
|
|
602
602
|
const WHOLE_MATCH$4 = 0;
|
|
603
603
|
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
604
604
|
file,
|
|
605
605
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
606
|
-
rule: RULE$
|
|
606
|
+
rule: RULE$79,
|
|
607
607
|
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])}\`.`
|
|
608
608
|
});
|
|
609
609
|
const problemsIn$25 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array$1.map(problemAt$6(entry, source)));
|
|
@@ -614,13 +614,13 @@ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(r
|
|
|
614
614
|
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$25);
|
|
615
615
|
});
|
|
616
616
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
617
|
-
const RULE$
|
|
617
|
+
const RULE$78 = "unnamed-restriction";
|
|
618
618
|
const WHOLE_MATCH$3 = 0;
|
|
619
619
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
620
620
|
const problemsIn$24 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(UNNAMED)(source)), Array$1.map((found) => ({
|
|
621
621
|
file: entry.file,
|
|
622
622
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
623
|
-
rule: RULE$
|
|
623
|
+
rule: RULE$78,
|
|
624
624
|
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.`
|
|
625
625
|
})));
|
|
626
626
|
/** @internal */
|
|
@@ -629,13 +629,13 @@ const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRe
|
|
|
629
629
|
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$24);
|
|
630
630
|
});
|
|
631
631
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
632
|
-
const RULE$
|
|
632
|
+
const RULE$77 = "named-type-exemption";
|
|
633
633
|
const WHOLE_MATCH$2 = 0;
|
|
634
634
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
635
635
|
const problemsIn$23 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array$1.map((found) => ({
|
|
636
636
|
file: entry.file,
|
|
637
637
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
638
|
-
rule: RULE$
|
|
638
|
+
rule: RULE$77,
|
|
639
639
|
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."
|
|
640
640
|
})));
|
|
641
641
|
/** @internal */
|
|
@@ -644,21 +644,21 @@ const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkType
|
|
|
644
644
|
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$23);
|
|
645
645
|
});
|
|
646
646
|
// src/features/check-overrides/model/package-registry.ts
|
|
647
|
-
const RULE$
|
|
647
|
+
const RULE$76 = "package-registry";
|
|
648
648
|
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
649
649
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
650
650
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
651
651
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
652
|
-
const START$
|
|
652
|
+
const START$31 = 0;
|
|
653
653
|
const REASON$1 = `Installs go through Takumi Guard (${INSTALL_REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
654
654
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
655
655
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
656
656
|
const isRequired = (found) => withTrailingSlash(found) === INSTALL_REGISTRY;
|
|
657
|
-
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
657
|
+
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$31));
|
|
658
658
|
const workspaceProblem = ({ file, source }, registry) => ({
|
|
659
659
|
file,
|
|
660
660
|
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
661
|
-
rule: RULE$
|
|
661
|
+
rule: RULE$76,
|
|
662
662
|
message: Option.match(registry, {
|
|
663
663
|
onNone: () => `${REASON$1} Set \`registry: ${INSTALL_REGISTRY}\` in ${WORKSPACE_FILE$6}.`,
|
|
664
664
|
onSome: (value) => `${REASON$1} \`registry\` is ${value}. Set it to ${INSTALL_REGISTRY}.`
|
|
@@ -666,9 +666,9 @@ const workspaceProblem = ({ file, source }, registry) => ({
|
|
|
666
666
|
});
|
|
667
667
|
const npmrcProblems = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array$1.filter((found) => !Option.exists(groupOf("value")(found), isRequired)), Array$1.map((found) => ({
|
|
668
668
|
file: entry.file,
|
|
669
|
-
...positionOf(source)(found.index ?? START$
|
|
670
|
-
rule: RULE$
|
|
671
|
-
message: `${REASON$1} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
669
|
+
...positionOf(source)(found.index ?? START$31),
|
|
670
|
+
rule: RULE$76,
|
|
671
|
+
message: `${REASON$1} This .npmrc overrides it with \`${String$1.trim(found[START$31])}\`. Remove the line.`
|
|
672
672
|
})));
|
|
673
673
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
674
674
|
const files = yield* RepositoryFiles;
|
|
@@ -2817,7 +2817,7 @@ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* sca
|
|
|
2817
2817
|
})), Option.getOrElse(() => [])));
|
|
2818
2818
|
});
|
|
2819
2819
|
// src/features/check-overrides/model/removed-peers.ts
|
|
2820
|
-
const RULE$
|
|
2820
|
+
const RULE$75 = "removed-peer";
|
|
2821
2821
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
2822
2822
|
const REMOVED = "-";
|
|
2823
2823
|
const PARENT_SEPARATOR = ">";
|
|
@@ -2844,7 +2844,7 @@ const problemAt$5 = (file, { key, line, column }) => ({ peer, dependent }) => ({
|
|
|
2844
2844
|
file,
|
|
2845
2845
|
line,
|
|
2846
2846
|
column,
|
|
2847
|
-
rule: RULE$
|
|
2847
|
+
rule: RULE$75,
|
|
2848
2848
|
message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
|
|
2849
2849
|
});
|
|
2850
2850
|
const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
|
|
@@ -2878,7 +2878,7 @@ const checkRemovedPeers = Effect.fn("checkRemovedPeers")(function* checkRemovedP
|
|
|
2878
2878
|
});
|
|
2879
2879
|
});
|
|
2880
2880
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
2881
|
-
const RULE$
|
|
2881
|
+
const RULE$74 = "colocated-git-patterns";
|
|
2882
2882
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
2883
2883
|
const ROOT$3 = ".";
|
|
2884
2884
|
const NEGATION$1 = "!";
|
|
@@ -2925,7 +2925,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
2925
2925
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
2926
2926
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array$1.map(toEntry), Array$1.getSomes);
|
|
2927
2927
|
});
|
|
2928
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
2928
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$74)(entry.file, {
|
|
2929
2929
|
line: entry.line,
|
|
2930
2930
|
column: FIRST$25
|
|
2931
2931
|
}, message);
|
|
@@ -2988,7 +2988,7 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
2988
2988
|
return Array$1.getSomes([...misplacedFound, ...repeatedFound]);
|
|
2989
2989
|
});
|
|
2990
2990
|
// src/features/check-placement/model/colocated-tests.ts
|
|
2991
|
-
const RULE$
|
|
2991
|
+
const RULE$73 = "colocated-test";
|
|
2992
2992
|
const FIRST$24 = 1;
|
|
2993
2993
|
const READ_CONCURRENCY$32 = 64;
|
|
2994
2994
|
const ROOT_SUBPATH$1 = ".";
|
|
@@ -3011,7 +3011,7 @@ const problemFor$10 = (test, message) => ({
|
|
|
3011
3011
|
file: test.file,
|
|
3012
3012
|
line: FIRST$24,
|
|
3013
3013
|
column: FIRST$24,
|
|
3014
|
-
rule: RULE$
|
|
3014
|
+
rule: RULE$73,
|
|
3015
3015
|
message: `${test.base} ${message}`
|
|
3016
3016
|
});
|
|
3017
3017
|
const groupsOf$2 = (source, pattern, group) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array$1.getSomes);
|
|
@@ -3094,7 +3094,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
3094
3094
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
3095
3095
|
const RECOMMENDED_LINES = 200;
|
|
3096
3096
|
const FIRST$23 = 1;
|
|
3097
|
-
const RULE$
|
|
3097
|
+
const RULE$72 = "agent-docs-length";
|
|
3098
3098
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
3099
3099
|
const problemFor$9 = (file) => (lines) => {
|
|
3100
3100
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -3102,14 +3102,14 @@ const problemFor$9 = (file) => (lines) => {
|
|
|
3102
3102
|
file,
|
|
3103
3103
|
line: 201,
|
|
3104
3104
|
column: FIRST$23,
|
|
3105
|
-
rule: RULE$
|
|
3105
|
+
rule: RULE$72,
|
|
3106
3106
|
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.`
|
|
3107
3107
|
});
|
|
3108
3108
|
};
|
|
3109
3109
|
/** @internal */
|
|
3110
3110
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$9(file)(lineCount(source)));
|
|
3111
3111
|
// src/features/check-placement/model/claude-link.ts
|
|
3112
|
-
const RULE$
|
|
3112
|
+
const RULE$71 = "claude-md-link";
|
|
3113
3113
|
const CLAUDE = "CLAUDE.md";
|
|
3114
3114
|
const AGENTS = "AGENTS.md";
|
|
3115
3115
|
const FIRST$22 = 1;
|
|
@@ -3128,7 +3128,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3128
3128
|
file: path,
|
|
3129
3129
|
line: FIRST$22,
|
|
3130
3130
|
column: FIRST$22,
|
|
3131
|
-
rule: RULE$
|
|
3131
|
+
rule: RULE$71,
|
|
3132
3132
|
message: MESSAGE$19
|
|
3133
3133
|
})));
|
|
3134
3134
|
});
|
|
@@ -3137,7 +3137,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3137
3137
|
return Array$1.getSomes(found);
|
|
3138
3138
|
});
|
|
3139
3139
|
// src/features/check-placement/model/dangling-links.ts
|
|
3140
|
-
const RULE$
|
|
3140
|
+
const RULE$70 = "dangling-link";
|
|
3141
3141
|
const SEPARATOR$23 = "/";
|
|
3142
3142
|
const FIRST$21 = 1;
|
|
3143
3143
|
const READ_CONCURRENCY$29 = 16;
|
|
@@ -3153,7 +3153,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
3153
3153
|
file,
|
|
3154
3154
|
line: FIRST$21,
|
|
3155
3155
|
column: FIRST$21,
|
|
3156
|
-
rule: RULE$
|
|
3156
|
+
rule: RULE$70,
|
|
3157
3157
|
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.`
|
|
3158
3158
|
})));
|
|
3159
3159
|
});
|
|
@@ -3211,7 +3211,7 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
3211
3211
|
}));
|
|
3212
3212
|
});
|
|
3213
3213
|
// src/features/check-placement/model/deployed-readme.ts
|
|
3214
|
-
const RULE$
|
|
3214
|
+
const RULE$69 = "deployed-readme";
|
|
3215
3215
|
const ROOT_DIRECTORY$4 = "";
|
|
3216
3216
|
const READ_CONCURRENCY$28 = 16;
|
|
3217
3217
|
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.";
|
|
@@ -3251,14 +3251,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
3251
3251
|
const readme = yield* readReadme({
|
|
3252
3252
|
root,
|
|
3253
3253
|
directory,
|
|
3254
|
-
rule: RULE$
|
|
3254
|
+
rule: RULE$69,
|
|
3255
3255
|
missingMessage: MISSING_MESSAGE$2
|
|
3256
3256
|
});
|
|
3257
3257
|
return Result.match(readme, {
|
|
3258
3258
|
onFailure: Option.some,
|
|
3259
3259
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
3260
3260
|
file,
|
|
3261
|
-
rule: RULE$
|
|
3261
|
+
rule: RULE$69,
|
|
3262
3262
|
message: NO_URL_MESSAGE
|
|
3263
3263
|
})))
|
|
3264
3264
|
});
|
|
@@ -3275,8 +3275,8 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
3275
3275
|
return Array$1.getSomes(found);
|
|
3276
3276
|
});
|
|
3277
3277
|
// src/features/check-placement/model/nested-docs.ts
|
|
3278
|
-
const RULE$
|
|
3279
|
-
const CONFIG_FILE$
|
|
3278
|
+
const RULE$68 = "nested-docs";
|
|
3279
|
+
const CONFIG_FILE$9 = "vite.config.ts";
|
|
3280
3280
|
const SEPARATOR$21 = "/";
|
|
3281
3281
|
const READ_CONCURRENCY$27 = 64;
|
|
3282
3282
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
@@ -3285,10 +3285,10 @@ const README = /^README(?:\.[^/]+)?$/iu;
|
|
|
3285
3285
|
const MANIFEST$2 = "package.json";
|
|
3286
3286
|
const MISSING_RULE = "workspace-agents-md";
|
|
3287
3287
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
3288
|
-
const taggedError$
|
|
3289
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
3288
|
+
const taggedError$7 = Schema.TaggedError;
|
|
3289
|
+
var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
3290
3290
|
const isNested = (name) => String$1.includes(SEPARATOR$21)(name);
|
|
3291
|
-
const problemFor$8 = problemInFile(RULE$
|
|
3291
|
+
const problemFor$8 = problemInFile(RULE$68);
|
|
3292
3292
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
3293
3293
|
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.";
|
|
3294
3294
|
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.";
|
|
@@ -3316,7 +3316,7 @@ const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, na
|
|
|
3316
3316
|
});
|
|
3317
3317
|
const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
|
|
3318
3318
|
const files = yield* RepositoryFiles;
|
|
3319
|
-
const file = files.join(root, CONFIG_FILE$
|
|
3319
|
+
const file = files.join(root, CONFIG_FILE$9);
|
|
3320
3320
|
if (!(yield* files.exists(file))) return false;
|
|
3321
3321
|
const config = yield* Effect.tryPromise({
|
|
3322
3322
|
try: () => resolveConfigFromFile(file),
|
|
@@ -3345,7 +3345,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
3345
3345
|
return [...Array$1.getSomes(found), ...missing];
|
|
3346
3346
|
});
|
|
3347
3347
|
// src/features/check-placement/model/published-readme.ts
|
|
3348
|
-
const RULE$
|
|
3348
|
+
const RULE$67 = "published-readme";
|
|
3349
3349
|
const READ_CONCURRENCY$26 = 16;
|
|
3350
3350
|
const MESSAGE$18 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
3351
3351
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
@@ -3353,7 +3353,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
3353
3353
|
const readme = yield* readReadme({
|
|
3354
3354
|
root,
|
|
3355
3355
|
directory,
|
|
3356
|
-
rule: RULE$
|
|
3356
|
+
rule: RULE$67,
|
|
3357
3357
|
missingMessage: MISSING_MESSAGE
|
|
3358
3358
|
});
|
|
3359
3359
|
return Result.match(readme, {
|
|
@@ -3364,7 +3364,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
3364
3364
|
file,
|
|
3365
3365
|
line,
|
|
3366
3366
|
column,
|
|
3367
|
-
rule: RULE$
|
|
3367
|
+
rule: RULE$67,
|
|
3368
3368
|
message: MESSAGE$18
|
|
3369
3369
|
};
|
|
3370
3370
|
}))
|
|
@@ -3377,7 +3377,7 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
3377
3377
|
return Array$1.getSomes(found);
|
|
3378
3378
|
});
|
|
3379
3379
|
// src/features/check-placement/model/published-tests.ts
|
|
3380
|
-
const RULE$
|
|
3380
|
+
const RULE$66 = "published-tests";
|
|
3381
3381
|
const FILE_START = 1;
|
|
3382
3382
|
const TEST_FILE$3 = /\.test\.[cm]?[jt]sx?$/u;
|
|
3383
3383
|
const MESSAGE$17 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
@@ -3391,7 +3391,7 @@ const problemFor$7 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
3391
3391
|
file: files.join(absolute, PACKAGE_JSON_FILE),
|
|
3392
3392
|
line: FILE_START,
|
|
3393
3393
|
column: FILE_START,
|
|
3394
|
-
rule: RULE$
|
|
3394
|
+
rule: RULE$66,
|
|
3395
3395
|
message: MESSAGE$17
|
|
3396
3396
|
});
|
|
3397
3397
|
});
|
|
@@ -3405,7 +3405,7 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
3405
3405
|
return Array$1.getSomes(found);
|
|
3406
3406
|
});
|
|
3407
3407
|
// src/features/check-placement/model/root-docs.ts
|
|
3408
|
-
const RULE$
|
|
3408
|
+
const RULE$65 = "root-docs";
|
|
3409
3409
|
const SEPARATOR$20 = "/";
|
|
3410
3410
|
const FIRST$19 = 1;
|
|
3411
3411
|
const MARKDOWN$5 = /\.(?:md|mdx|markdown)$/iu;
|
|
@@ -3420,15 +3420,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
3420
3420
|
file: files.join(root, name),
|
|
3421
3421
|
line: FIRST$19,
|
|
3422
3422
|
column: FIRST$19,
|
|
3423
|
-
rule: RULE$
|
|
3423
|
+
rule: RULE$65,
|
|
3424
3424
|
message: `${name} ${MESSAGE$16}`
|
|
3425
3425
|
})));
|
|
3426
3426
|
});
|
|
3427
3427
|
// src/features/check-placement/model/root-readme.ts
|
|
3428
|
-
const RULE$
|
|
3428
|
+
const RULE$64 = "root-readme";
|
|
3429
3429
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
3430
3430
|
const READ_CONCURRENCY$25 = 16;
|
|
3431
|
-
const START$
|
|
3431
|
+
const START$30 = 0;
|
|
3432
3432
|
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
3433
3433
|
const RELATIVE$2 = /^\.\//u;
|
|
3434
3434
|
const MarketplacePlugin = Schema.Struct({
|
|
@@ -3468,7 +3468,7 @@ const problemsIn$22 = (file, source, plugins) => (workspace) => {
|
|
|
3468
3468
|
const message = messageFor$3(workspace.directory);
|
|
3469
3469
|
const at = positionOf(source);
|
|
3470
3470
|
const pattern = patternFor(plugins)(workspace);
|
|
3471
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$
|
|
3471
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$64)(file, at(found.index ?? START$30), message)));
|
|
3472
3472
|
};
|
|
3473
3473
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
3474
3474
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
@@ -3505,7 +3505,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
3505
3505
|
return Array$1.flatten(found);
|
|
3506
3506
|
});
|
|
3507
3507
|
// src/features/check-placement/model/docs-mirror.ts
|
|
3508
|
-
const RULE$
|
|
3508
|
+
const RULE$63 = "docs-mirror";
|
|
3509
3509
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
3510
3510
|
const MIRROR_LIMIT = 3;
|
|
3511
3511
|
const READ_CONCURRENCY$24 = 16;
|
|
@@ -3530,7 +3530,7 @@ const problemFor$6 = (file, source, mentions) => pipe(Array$1.head(mentions), Op
|
|
|
3530
3530
|
file,
|
|
3531
3531
|
line,
|
|
3532
3532
|
column,
|
|
3533
|
-
rule: RULE$
|
|
3533
|
+
rule: RULE$63,
|
|
3534
3534
|
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.`
|
|
3535
3535
|
};
|
|
3536
3536
|
}), Option.toArray);
|
|
@@ -3562,7 +3562,7 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
3562
3562
|
return Array$1.flatten(found);
|
|
3563
3563
|
});
|
|
3564
3564
|
// src/features/check-placement/model/ignored-sources.ts
|
|
3565
|
-
const RULE$
|
|
3565
|
+
const RULE$62 = "ignored-sources";
|
|
3566
3566
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
3567
3567
|
const FIRST$18 = 1;
|
|
3568
3568
|
const MESSAGE$15 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
@@ -3574,7 +3574,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
3574
3574
|
file: files.join(root, file),
|
|
3575
3575
|
line: FIRST$18,
|
|
3576
3576
|
column: FIRST$18,
|
|
3577
|
-
rule: RULE$
|
|
3577
|
+
rule: RULE$62,
|
|
3578
3578
|
message: MESSAGE$15
|
|
3579
3579
|
})));
|
|
3580
3580
|
});
|
|
@@ -12297,13 +12297,13 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
12297
12297
|
return [...sliceNameProblems(root, files.join, sources), ...Array$1.flatMap(Array$1.getSomes(read), problemsOf$4)];
|
|
12298
12298
|
});
|
|
12299
12299
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
12300
|
-
const RULE$
|
|
12300
|
+
const RULE$61 = "shadcn-ui-alias";
|
|
12301
12301
|
const FIRST$17 = 1;
|
|
12302
12302
|
const problemOf$10 = (directory, { file, alias }) => ({
|
|
12303
12303
|
file,
|
|
12304
12304
|
line: FIRST$17,
|
|
12305
12305
|
column: FIRST$17,
|
|
12306
|
-
rule: RULE$
|
|
12306
|
+
rule: RULE$61,
|
|
12307
12307
|
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/*".`
|
|
12308
12308
|
});
|
|
12309
12309
|
/** @internal */
|
|
@@ -12482,14 +12482,14 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
12482
12482
|
];
|
|
12483
12483
|
});
|
|
12484
12484
|
// src/features/check-repository-layout/model/path-mention.ts
|
|
12485
|
-
const START$
|
|
12485
|
+
const START$29 = 0;
|
|
12486
12486
|
const QUOTES = ["\"", "'"];
|
|
12487
12487
|
const firstIndex = (source, needles) => {
|
|
12488
12488
|
const found = pipe(needles, Array$1.flatMap((needle) => Option.toArray(String$1.indexOf(needle)(source))));
|
|
12489
12489
|
return Array$1.head(Array$1.sort(found, Order.Number));
|
|
12490
12490
|
};
|
|
12491
12491
|
const quoted = (text) => pipe(QUOTES, Array$1.map((quote) => `${quote}${text}${quote}`));
|
|
12492
|
-
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$
|
|
12492
|
+
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$29));
|
|
12493
12493
|
// src/features/check-repository-layout/model/cargo-paths.ts
|
|
12494
12494
|
const MEMBER_LISTS = [
|
|
12495
12495
|
"members",
|
|
@@ -12505,14 +12505,14 @@ const WORKSPACE = "workspace";
|
|
|
12505
12505
|
const PATCH = "patch";
|
|
12506
12506
|
const PATCH_DEPTH = 2;
|
|
12507
12507
|
const WORKSPACE_DEPTH = 1;
|
|
12508
|
-
const START$
|
|
12508
|
+
const START$28 = 0;
|
|
12509
12509
|
const WILDCARD$4 = /[*?[]/u;
|
|
12510
12510
|
const KEY_SEPARATOR = ".";
|
|
12511
12511
|
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
12512
12512
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12513
12513
|
const decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));
|
|
12514
|
-
const declaresPath = (trail) => pipe(Array$1.last(trail), Option.exists((name) => Array$1.contains(DEPENDENCY_TABLES, name))) || trail.length === PATCH_DEPTH && Array$1.get(trail, START$
|
|
12515
|
-
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$
|
|
12514
|
+
const declaresPath = (trail) => pipe(Array$1.last(trail), Option.exists((name) => Array$1.contains(DEPENDENCY_TABLES, name))) || trail.length === PATCH_DEPTH && Array$1.get(trail, START$28).pipe(Option.exists((name) => name === PATCH));
|
|
12515
|
+
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$28).pipe(Option.exists((name) => name === WORKSPACE)) && Array$1.contains(MEMBER_LISTS, key);
|
|
12516
12516
|
const namedPaths = (trail, key, value) => {
|
|
12517
12517
|
const field = Array$1.join([...trail, key], KEY_SEPARATOR);
|
|
12518
12518
|
if (listsMembers(trail, key)) return pipe(decodeStrings(value), Option.getOrElse(() => []), Array$1.filter((member) => !WILDCARD$4.test(member)), Array$1.map((member) => ({
|
|
@@ -12599,7 +12599,7 @@ const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMention
|
|
|
12599
12599
|
])));
|
|
12600
12600
|
});
|
|
12601
12601
|
// src/features/check-repository-layout/model/config-paths.ts
|
|
12602
|
-
const RULE$
|
|
12602
|
+
const RULE$60 = "config-path";
|
|
12603
12603
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
12604
12604
|
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
12605
12605
|
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
@@ -12618,7 +12618,7 @@ const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
|
12618
12618
|
const problemOf$9 = (file, source) => (mention) => ({
|
|
12619
12619
|
file,
|
|
12620
12620
|
...positionOf(source)(mention.index),
|
|
12621
|
-
rule: RULE$
|
|
12621
|
+
rule: RULE$60,
|
|
12622
12622
|
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
12623
12623
|
});
|
|
12624
12624
|
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
@@ -12643,7 +12643,7 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
12643
12643
|
return pipe(patterns, Array$1.map((pattern) => ({
|
|
12644
12644
|
file,
|
|
12645
12645
|
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
12646
|
-
rule: RULE$
|
|
12646
|
+
rule: RULE$60,
|
|
12647
12647
|
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
12648
12648
|
})));
|
|
12649
12649
|
});
|
|
@@ -12655,11 +12655,11 @@ const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPath
|
|
|
12655
12655
|
return [...Array$1.flatten(found), ...patterns];
|
|
12656
12656
|
});
|
|
12657
12657
|
// src/features/check-repository-layout/model/crates.ts
|
|
12658
|
-
const RULE$
|
|
12658
|
+
const RULE$59 = "unverified-crate";
|
|
12659
12659
|
const VERSION_RULE = "release-version";
|
|
12660
12660
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
12661
12661
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
12662
|
-
const CONFIG_FILE$
|
|
12662
|
+
const CONFIG_FILE$8 = "vite.config.ts";
|
|
12663
12663
|
const SEPARATOR$14 = "/";
|
|
12664
12664
|
const FIRST$14 = 1;
|
|
12665
12665
|
const READ_CONCURRENCY$20 = 8;
|
|
@@ -12667,15 +12667,15 @@ const problemFor$5 = (crate, message) => ({
|
|
|
12667
12667
|
file: crate.manifest,
|
|
12668
12668
|
line: FIRST$14,
|
|
12669
12669
|
column: FIRST$14,
|
|
12670
|
-
rule: RULE$
|
|
12670
|
+
rule: RULE$59,
|
|
12671
12671
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
12672
12672
|
});
|
|
12673
12673
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
12674
12674
|
const files = yield* RepositoryFiles;
|
|
12675
12675
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
12676
12676
|
if (Option.isNone(workspace)) return Option.some(problemFor$5(crate, "is outside every workspace package"));
|
|
12677
|
-
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$
|
|
12678
|
-
return Option.some(problemFor$5(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$
|
|
12677
|
+
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$8))) return Option.none();
|
|
12678
|
+
return Option.some(problemFor$5(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$8} has no verify task`));
|
|
12679
12679
|
});
|
|
12680
12680
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
12681
12681
|
const files = yield* RepositoryFiles;
|
|
@@ -12703,7 +12703,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
12703
12703
|
return Array$1.getSomes(Array$1.flatten(found));
|
|
12704
12704
|
});
|
|
12705
12705
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
12706
|
-
const RULE$
|
|
12706
|
+
const RULE$58 = "deploy-entry-pattern";
|
|
12707
12707
|
const FALLOW_KEYS = [
|
|
12708
12708
|
"entry",
|
|
12709
12709
|
"entryPoints",
|
|
@@ -12774,7 +12774,7 @@ const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
12774
12774
|
return pipe(Array$1.getSomes(flagged), Array$1.map(({ text: pattern, start }) => ({
|
|
12775
12775
|
file: path,
|
|
12776
12776
|
...positionOf(text.value)(start - kind.offset),
|
|
12777
|
-
rule: RULE$
|
|
12777
|
+
rule: RULE$58,
|
|
12778
12778
|
message: `${pattern} ${MESSAGE$14}`
|
|
12779
12779
|
})));
|
|
12780
12780
|
});
|
|
@@ -12807,7 +12807,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
12807
12807
|
return Array$1.flatten(found);
|
|
12808
12808
|
});
|
|
12809
12809
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
12810
|
-
const RULE$
|
|
12810
|
+
const RULE$57 = "listed-entry";
|
|
12811
12811
|
const ENTRY_KEYS = [
|
|
12812
12812
|
"entry",
|
|
12813
12813
|
"entryPoints",
|
|
@@ -12837,7 +12837,7 @@ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
12837
12837
|
return pipe(entryPatternsIn(parsed.program), Array$1.filter(namesOneFile(directories)), Array$1.map(({ text: pattern, start }) => ({
|
|
12838
12838
|
file: path,
|
|
12839
12839
|
...positionOf(text.value)(start),
|
|
12840
|
-
rule: RULE$
|
|
12840
|
+
rule: RULE$57,
|
|
12841
12841
|
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.`
|
|
12842
12842
|
})));
|
|
12843
12843
|
});
|
|
@@ -12849,8 +12849,8 @@ const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallow
|
|
|
12849
12849
|
return Array$1.flatten(found);
|
|
12850
12850
|
});
|
|
12851
12851
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
12852
|
-
const RULE$
|
|
12853
|
-
const CONFIG_FILE$
|
|
12852
|
+
const RULE$56 = "root-workspace-path";
|
|
12853
|
+
const CONFIG_FILE$7 = "vite.config.ts";
|
|
12854
12854
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
12855
12855
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
12856
12856
|
const FIRST$13 = 0;
|
|
@@ -12868,13 +12868,13 @@ const mentions = (directory) => (text) => {
|
|
|
12868
12868
|
const problemsIn$17 = (file, source, directories) => (found) => pipe(directories, Array$1.filter((directory) => mentions(directory)(found.text)), Array$1.map((directory) => ({
|
|
12869
12869
|
file,
|
|
12870
12870
|
...positionOf(source)(found.start),
|
|
12871
|
-
rule: RULE$
|
|
12872
|
-
message: `${directory} is a workspace. The root ${CONFIG_FILE$
|
|
12871
|
+
rule: RULE$56,
|
|
12872
|
+
message: `${directory} is a workspace. The root ${CONFIG_FILE$7} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$7}: msch.lint, msch.devDependencies or its verify task.`
|
|
12873
12873
|
})));
|
|
12874
12874
|
/** @internal */
|
|
12875
12875
|
const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
|
|
12876
12876
|
const files = yield* RepositoryFiles;
|
|
12877
|
-
const file = files.join(root, CONFIG_FILE$
|
|
12877
|
+
const file = files.join(root, CONFIG_FILE$7);
|
|
12878
12878
|
const source = yield* files.readFile(file);
|
|
12879
12879
|
if (Option.isNone(source)) return [];
|
|
12880
12880
|
const directories = yield* workspaceDirectories(root);
|
|
@@ -12882,8 +12882,8 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
12882
12882
|
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$17(file, source.value, directories)));
|
|
12883
12883
|
});
|
|
12884
12884
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
12885
|
-
const RULE$
|
|
12886
|
-
const CONFIG_FILE$
|
|
12885
|
+
const RULE$55 = "hidden-verify";
|
|
12886
|
+
const CONFIG_FILE$6 = "vite.config.ts";
|
|
12887
12887
|
const FIRST$12 = 1;
|
|
12888
12888
|
const READ_CONCURRENCY$17 = 8;
|
|
12889
12889
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
@@ -12896,8 +12896,8 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
12896
12896
|
file,
|
|
12897
12897
|
line: FIRST$12,
|
|
12898
12898
|
column: FIRST$12,
|
|
12899
|
-
rule: RULE$
|
|
12900
|
-
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$
|
|
12899
|
+
rule: RULE$55,
|
|
12900
|
+
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$6}. The root verify reads ${CONFIG_FILE$6} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$6}.`
|
|
12901
12901
|
}).pipe(Option.filter(() => verified));
|
|
12902
12902
|
});
|
|
12903
12903
|
/** @internal */
|
|
@@ -12907,7 +12907,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
12907
12907
|
return Array$1.getSomes(found);
|
|
12908
12908
|
});
|
|
12909
12909
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
12910
|
-
const RULE$
|
|
12910
|
+
const RULE$54 = "shared-uncached-task";
|
|
12911
12911
|
const READ_CONCURRENCY$16 = 8;
|
|
12912
12912
|
const SHARED = 2;
|
|
12913
12913
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -12950,7 +12950,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
12950
12950
|
return pipe(definitions, Array$1.map(({ file, position, name, command }) => ({
|
|
12951
12951
|
file,
|
|
12952
12952
|
...position,
|
|
12953
|
-
rule: RULE$
|
|
12953
|
+
rule: RULE$54,
|
|
12954
12954
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array$1.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
|
|
12955
12955
|
})));
|
|
12956
12956
|
};
|
|
@@ -12961,7 +12961,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
12961
12961
|
return pipe(Array$1.flatten(found), Array$1.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array$1.flatMap(problemsOf$3));
|
|
12962
12962
|
});
|
|
12963
12963
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
12964
|
-
const RULE$
|
|
12964
|
+
const RULE$53 = "unlocked-task";
|
|
12965
12965
|
const READ_CONCURRENCY$15 = 8;
|
|
12966
12966
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
12967
12967
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -12973,7 +12973,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
12973
12973
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array$1.filter(tracksLockfiles), Array$1.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
12974
12974
|
file,
|
|
12975
12975
|
...positionOf(source)(task.start),
|
|
12976
|
-
rule: RULE$
|
|
12976
|
+
rule: RULE$53,
|
|
12977
12977
|
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.`
|
|
12978
12978
|
})), Option.toArray)));
|
|
12979
12979
|
/** @internal */
|
|
@@ -13128,7 +13128,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
13128
13128
|
/** @internal */
|
|
13129
13129
|
const producedPaths = (source) => pipe(jobsOf(source), Array$1.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array$1.flatMap(outputPathsOf));
|
|
13130
13130
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
13131
|
-
const RULE$
|
|
13131
|
+
const RULE$52 = "workflow-path";
|
|
13132
13132
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
13133
13133
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
13134
13134
|
const READ_CONCURRENCY$14 = 8;
|
|
@@ -13172,7 +13172,7 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
13172
13172
|
const problemOf$8 = (file, source) => (found) => ({
|
|
13173
13173
|
file,
|
|
13174
13174
|
...positionOf(source)(found.offset),
|
|
13175
|
-
rule: RULE$
|
|
13175
|
+
rule: RULE$52,
|
|
13176
13176
|
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.`
|
|
13177
13177
|
});
|
|
13178
13178
|
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -13198,7 +13198,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
13198
13198
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
13199
13199
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
13200
13200
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
13201
|
-
const START$
|
|
13201
|
+
const START$27 = 0;
|
|
13202
13202
|
const READ_CONCURRENCY$13 = 8;
|
|
13203
13203
|
const SEPARATOR$10 = "/";
|
|
13204
13204
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
@@ -13229,7 +13229,7 @@ const namesIn$2 = (name, source) => {
|
|
|
13229
13229
|
return [
|
|
13230
13230
|
{
|
|
13231
13231
|
text: name,
|
|
13232
|
-
offset: START$
|
|
13232
|
+
offset: START$27
|
|
13233
13233
|
},
|
|
13234
13234
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
13235
13235
|
...keysOf(childOf("jobs")(root))
|
|
@@ -13240,7 +13240,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array$1.flatMap(({ text, o
|
|
|
13240
13240
|
offset
|
|
13241
13241
|
})))));
|
|
13242
13242
|
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$4(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
|
|
13243
|
-
const packagesIn = (workspaces, { file, name, source }) => {
|
|
13243
|
+
const packagesIn$1 = (workspaces, { file, name, source }) => {
|
|
13244
13244
|
const where = {
|
|
13245
13245
|
file,
|
|
13246
13246
|
source
|
|
@@ -13273,7 +13273,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
13273
13273
|
const found = yield* Effect.forEach(workflows, ({ name, stem }) => Effect.gen(function* problemsOf() {
|
|
13274
13274
|
const file = files.join(root, name);
|
|
13275
13275
|
const source = yield* files.readFile(file);
|
|
13276
|
-
return pipe(source, Option.map((text) => [...pathFiltersIn(file, text), ...packagesIn(workspaces, {
|
|
13276
|
+
return pipe(source, Option.map((text) => [...pathFiltersIn(file, text), ...packagesIn$1(workspaces, {
|
|
13277
13277
|
file,
|
|
13278
13278
|
name: stem,
|
|
13279
13279
|
source: text
|
|
@@ -13464,11 +13464,11 @@ const LISTED_LARGEST = 5;
|
|
|
13464
13464
|
const SIZE_CONCURRENCY = 32;
|
|
13465
13465
|
const MEGABYTE = 1e6;
|
|
13466
13466
|
const MEGABYTE_DIGITS = 1;
|
|
13467
|
-
const START$
|
|
13467
|
+
const START$26 = 0;
|
|
13468
13468
|
const SINGLE_ENTRY = 1;
|
|
13469
13469
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
13470
13470
|
const usageHint = (dependency, entryCount) => {
|
|
13471
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
13471
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$26 && dependency.entries.length < entryCount)) return "";
|
|
13472
13472
|
return ` (imported only from ${Array$1.join(dependency.entries, ", ")})`;
|
|
13473
13473
|
};
|
|
13474
13474
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array$1.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array$1.join(", "));
|
|
@@ -13477,7 +13477,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
13477
13477
|
const { workspace, total } = overrun;
|
|
13478
13478
|
const config = yield* files.readFile(workspace.configFile);
|
|
13479
13479
|
const source = Option.getOrElse(config, () => "");
|
|
13480
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
13480
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$26);
|
|
13481
13481
|
return {
|
|
13482
13482
|
file: workspace.configFile,
|
|
13483
13483
|
...positionOf(source)(index),
|
|
@@ -13494,7 +13494,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
13494
13494
|
const everything = pipe(closures, Array$1.flatMap(([, packages]) => Array$1.fromIterable(packages)), HashSet.fromIterable);
|
|
13495
13495
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
13496
13496
|
const sizes = HashMap.fromIterable(measured);
|
|
13497
|
-
const sizeOf = (packages) => packages.pipe(Array$1.fromIterable, Array$1.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
13497
|
+
const sizeOf = (packages) => packages.pipe(Array$1.fromIterable, Array$1.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$26)), Number$1.sumAll);
|
|
13498
13498
|
return {
|
|
13499
13499
|
closures,
|
|
13500
13500
|
sizeOf,
|
|
@@ -13527,11 +13527,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
13527
13527
|
})];
|
|
13528
13528
|
});
|
|
13529
13529
|
const stackProblems = (file, source, dependencies) => {
|
|
13530
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
13530
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$26);
|
|
13531
13531
|
const rest = String$1.slice(section)(source);
|
|
13532
13532
|
return pipe(Record.toEntries(dependencies), Array$1.filter(([, specifier]) => specifier === STACK_CATALOG), Array$1.map(([name]) => ({
|
|
13533
13533
|
file,
|
|
13534
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
13534
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$26)),
|
|
13535
13535
|
rule: STACK_DEPENDENCY,
|
|
13536
13536
|
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.`
|
|
13537
13537
|
})));
|
|
@@ -13570,7 +13570,7 @@ const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* che
|
|
|
13570
13570
|
return Array$1.flatten(found);
|
|
13571
13571
|
});
|
|
13572
13572
|
// src/features/check-migration-order/model/migration-order.ts
|
|
13573
|
-
const RULE$
|
|
13573
|
+
const RULE$51 = "migration-order";
|
|
13574
13574
|
const SNAPSHOT = "snapshot.json";
|
|
13575
13575
|
const MIGRATION = "migration.sql";
|
|
13576
13576
|
const SNAPSHOTS = [`*/${SNAPSHOT}`];
|
|
@@ -13604,7 +13604,7 @@ const outOfOrder = (root, base, join) => (migrations) => pipe(latestOf(migration
|
|
|
13604
13604
|
file: join(root, file),
|
|
13605
13605
|
line: FIRST$11,
|
|
13606
13606
|
column: FIRST$11,
|
|
13607
|
-
rule: RULE$
|
|
13607
|
+
rule: RULE$51,
|
|
13608
13608
|
message: `${folder} is new, but it sorts before ${latest.folder}, which ${base} already has. A database that has applied ${latest.folder} rejects an earlier migration, so delete ${folder} and generate it again after ${latest.folder}.`
|
|
13609
13609
|
})))), Option.getOrElse(() => []));
|
|
13610
13610
|
/** @internal */
|
|
@@ -13655,7 +13655,7 @@ const unresolvedFrom = (entries) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
|
13655
13655
|
catch: bundleErrorDetail
|
|
13656
13656
|
}), (bundle) => Effect.promise(() => bundle.close())).pipe(Effect.map(({ output }) => unresolvedIn(pipe(output, Array$1.filter(isChunk$1)))));
|
|
13657
13657
|
// src/features/check-plugin-dependencies/model/plugin-dependencies.ts
|
|
13658
|
-
const RULE$
|
|
13658
|
+
const RULE$50 = "plugin-dependencies";
|
|
13659
13659
|
const PLUGIN_FILE$2 = ".claude-plugin/plugin.json";
|
|
13660
13660
|
const LOCK_FILE = "bun.lock";
|
|
13661
13661
|
const SOURCE_FILE = /\.[cm]?[jt]sx?$/u;
|
|
@@ -13664,7 +13664,7 @@ const SUCCESS$1 = 0;
|
|
|
13664
13664
|
const NOT_STARTED = -1;
|
|
13665
13665
|
const DETAIL_LINES = 3;
|
|
13666
13666
|
const PLUGIN_CONCURRENCY = 2;
|
|
13667
|
-
const problemFor$4 = problemInFile(RULE$
|
|
13667
|
+
const problemFor$4 = problemInFile(RULE$50);
|
|
13668
13668
|
const hasDependencies = Effect.fn("hasDependencies")(function* hasDependencies(directory) {
|
|
13669
13669
|
const files = yield* RepositoryFiles;
|
|
13670
13670
|
const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
|
|
@@ -13764,8 +13764,8 @@ const quote = (text) => pipe(Schema.encodeOption(Quoted)(text), Option.getOrElse
|
|
|
13764
13764
|
const builtins = new Set(builtinModules);
|
|
13765
13765
|
const always = () => true;
|
|
13766
13766
|
const never = () => false;
|
|
13767
|
-
const taggedError$
|
|
13768
|
-
var BundleFailed = class extends taggedError$
|
|
13767
|
+
const taggedError$6 = Schema.TaggedError;
|
|
13768
|
+
var BundleFailed = class extends taggedError$6()("BundleFailed", { detail: Schema.String }) {};
|
|
13769
13769
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
13770
13770
|
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
13771
13771
|
const isBuiltin$1 = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
@@ -13804,9 +13804,25 @@ const optionsFor = (scope, input, effectful) => {
|
|
|
13804
13804
|
};
|
|
13805
13805
|
};
|
|
13806
13806
|
const isChunk = (item) => item.type === "chunk";
|
|
13807
|
+
const packagesIn = (specifiers) => pipe(specifiers, Array$1.filter((specifier) => isBare(specifier) && !isBuiltin$1(specifier)), Array$1.map(packageNameOf), Array$1.dedupe, Array$1.sortBy(Order.String));
|
|
13808
|
+
const importsOf$1 = (byFile) => (file) => Option.match(Record.get(byFile, file), {
|
|
13809
|
+
onNone: () => [],
|
|
13810
|
+
onSome: (chunk) => chunk.imports
|
|
13811
|
+
});
|
|
13812
|
+
const reachedFrom = (byFile, files) => {
|
|
13813
|
+
const next = pipe(files, Array$1.flatMap(importsOf$1(byFile)), Array$1.prependAll(files), Array$1.dedupe);
|
|
13814
|
+
if (next.length === files.length) return files;
|
|
13815
|
+
return reachedFrom(byFile, next);
|
|
13816
|
+
};
|
|
13817
|
+
const loadedAtStartup = (chunks) => {
|
|
13818
|
+
const byFile = Record.fromIterableWith(chunks, (chunk) => [chunk.fileName, chunk]);
|
|
13819
|
+
const entries = pipe(chunks, Array$1.filter((chunk) => chunk.isEntry), Array$1.map((chunk) => chunk.fileName));
|
|
13820
|
+
return pipe(reachedFrom(byFile, entries), Array$1.flatMap((file) => Option.toArray(Record.get(byFile, file))));
|
|
13821
|
+
};
|
|
13807
13822
|
const keptBy = (chunks) => ({
|
|
13808
13823
|
modules: pipe(chunks, Array$1.flatMap((chunk) => Record.keys(chunk.modules)), Array$1.filter((id) => !String$1.startsWith(VIRTUAL_PREFIX)(id)), Array$1.dedupe, Array$1.sortBy(Order.String)),
|
|
13809
|
-
packages: pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports])
|
|
13824
|
+
packages: packagesIn(pipe(chunks, Array$1.flatMap((chunk) => [...chunk.imports, ...chunk.dynamicImports]))),
|
|
13825
|
+
startup: packagesIn(pipe(loadedAtStartup(chunks), Array$1.flatMap((chunk) => chunk.imports)))
|
|
13810
13826
|
});
|
|
13811
13827
|
const generate = (options) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
13812
13828
|
try: () => rolldown(options),
|
|
@@ -13867,23 +13883,24 @@ const bundleScopeOf = ({ manifest, workspace }) => ({
|
|
|
13867
13883
|
});
|
|
13868
13884
|
const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
13869
13885
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
13870
|
-
const RULE$
|
|
13886
|
+
const RULE$49 = "optional-peer";
|
|
13871
13887
|
const REQUIRED_RULE = "required-peer";
|
|
13872
|
-
const START$
|
|
13888
|
+
const START$25 = 0;
|
|
13873
13889
|
const SINGLE$1 = 1;
|
|
13874
13890
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
13875
13891
|
const PEER_META_KEY = "\"peerDependenciesMeta\"";
|
|
13876
13892
|
const importsPackage = (name) => ({ packages }) => Array$1.contains(packages, name);
|
|
13893
|
+
const loadsAtStartup = (name) => ({ startup }) => Array$1.contains(startup, name);
|
|
13877
13894
|
const labelsOf$1 = (importers) => pipe(importers, Array$1.map(({ entry }) => `\`${entry.label}\``), Array$1.dedupe, Array$1.join(", "));
|
|
13878
13895
|
const positionIn = (located, key, name) => {
|
|
13879
|
-
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$
|
|
13896
|
+
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$25);
|
|
13880
13897
|
const rest = String$1.slice(section)(located.source);
|
|
13881
|
-
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
13898
|
+
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$25));
|
|
13882
13899
|
};
|
|
13883
13900
|
const problemFor$3 = (located, name, importers) => ({
|
|
13884
13901
|
file: located.file,
|
|
13885
13902
|
...positionIn(located, DEPENDENCIES_KEY, name),
|
|
13886
|
-
rule: RULE$
|
|
13903
|
+
rule: RULE$49,
|
|
13887
13904
|
message: `${name} is imported only from ${labelsOf$1(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
13888
13905
|
});
|
|
13889
13906
|
const requiredPeerAdvice = (fromStack) => {
|
|
@@ -13898,7 +13915,7 @@ const optionalPeerProblems = ({ located, manifest, used }) => {
|
|
|
13898
13915
|
return pipe(Record.keys(manifest.dependencies ?? {}), Array$1.flatMap((name) => {
|
|
13899
13916
|
const importers = pipe(libraries, Array$1.filter(importsPackage(name)));
|
|
13900
13917
|
const neededByBin = pipe(bins, Array$1.some(importsPackage(name)));
|
|
13901
|
-
if (!(importers.length > START$
|
|
13918
|
+
if (!(importers.length > START$25 && importers.length < libraries.length) || neededByBin) return [];
|
|
13902
13919
|
return [problemFor$3(located, name, importers)];
|
|
13903
13920
|
}));
|
|
13904
13921
|
};
|
|
@@ -13906,8 +13923,8 @@ const requiredPeerProblems = ({ located, manifest, used }) => {
|
|
|
13906
13923
|
const libraries = librariesIn(used);
|
|
13907
13924
|
const stack = stackPackagesOf(manifest);
|
|
13908
13925
|
return pipe(optionalPeerNames(manifest), Array$1.flatMap((name) => {
|
|
13909
|
-
const bins = pipe(used, Array$1.filter((entry) => isBinEntry(entry.entry) &&
|
|
13910
|
-
const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array$1.isReadonlyArrayNonEmpty(all) && pipe(all, Array$1.every(
|
|
13926
|
+
const bins = pipe(used, Array$1.filter((entry) => isBinEntry(entry.entry) && loadsAtStartup(name)(entry)));
|
|
13927
|
+
const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array$1.isReadonlyArrayNonEmpty(all) && pipe(all, Array$1.every(loadsAtStartup(name)))), Option.getOrElse(() => []));
|
|
13911
13928
|
const importers = Array$1.appendAll(bins, everyLibrary);
|
|
13912
13929
|
if (!Array$1.isArrayNonEmpty(importers)) return [];
|
|
13913
13930
|
return [{
|
|
@@ -13919,9 +13936,9 @@ const requiredPeerProblems = ({ located, manifest, used }) => {
|
|
|
13919
13936
|
}));
|
|
13920
13937
|
};
|
|
13921
13938
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
13922
|
-
const RULE$
|
|
13939
|
+
const RULE$48 = "side-effects";
|
|
13923
13940
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
13924
|
-
const START$
|
|
13941
|
+
const START$24 = 0;
|
|
13925
13942
|
const FIRST$10 = 1;
|
|
13926
13943
|
const LISTED_PACKAGES = 4;
|
|
13927
13944
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
@@ -13945,7 +13962,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
13945
13962
|
label: entry.label,
|
|
13946
13963
|
member,
|
|
13947
13964
|
...extra
|
|
13948
|
-
}, ({ modules }) => modules > START$
|
|
13965
|
+
}, ({ modules }) => modules > START$24);
|
|
13949
13966
|
});
|
|
13950
13967
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
13951
13968
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -13967,15 +13984,15 @@ const othersOf = (total) => {
|
|
|
13967
13984
|
};
|
|
13968
13985
|
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.`;
|
|
13969
13986
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
13970
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
13987
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$24));
|
|
13971
13988
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array$1.sortBy(largest), Array$1.head, Option.map((worst) => ({
|
|
13972
13989
|
file,
|
|
13973
13990
|
...positionOf(source)(keyIndex$1(source)),
|
|
13974
|
-
rule: RULE$
|
|
13991
|
+
rule: RULE$48,
|
|
13975
13992
|
message: messageOf$4(worst, excesses.length)
|
|
13976
13993
|
})), Option.toArray);
|
|
13977
13994
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
13978
|
-
const RULE$
|
|
13995
|
+
const RULE$47 = "top-level-effect";
|
|
13979
13996
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
13980
13997
|
const READ_CONCURRENCY$11 = 16;
|
|
13981
13998
|
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.";
|
|
@@ -13991,7 +14008,7 @@ const messageOf$3 = (statement) => {
|
|
|
13991
14008
|
const problemsIn$15 = (api) => (file) => (source) => {
|
|
13992
14009
|
const retained = api.createSourceFile(file, source);
|
|
13993
14010
|
const problems = pipe(retained.sourceFile.statements, Array$1.fromIterable, Array$1.filter(isEffect), Array$1.map((statement) => problemAt$7({
|
|
13994
|
-
rule: RULE$
|
|
14011
|
+
rule: RULE$47,
|
|
13995
14012
|
message: messageOf$3(statement)
|
|
13996
14013
|
})(statement)));
|
|
13997
14014
|
retained.dispose();
|
|
@@ -14008,7 +14025,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
14008
14025
|
return Array$1.flatten(found);
|
|
14009
14026
|
}, Effect.scoped);
|
|
14010
14027
|
const BUNDLED_RULE = "bundled-side-effects";
|
|
14011
|
-
const START$
|
|
14028
|
+
const START$23 = 0;
|
|
14012
14029
|
const NAME_KEY$2 = "\"name\"";
|
|
14013
14030
|
const packageDirectoryOf = (manifests, files) => (module) => {
|
|
14014
14031
|
const parent = files.dirname(module);
|
|
@@ -14025,7 +14042,7 @@ const undeclaredAt = Effect.fn("undeclaredAt")(function* undeclaredAt(directory)
|
|
|
14025
14042
|
})));
|
|
14026
14043
|
});
|
|
14027
14044
|
const undeclaredMessage = (files, root) => ({ directory, name }) => `bundles modules of \`${name}\`, whose package.json does not declare "sideEffects". A bundler reads that field from the package that owns each module, so it keeps every module that \`${name}\` re-exports, together with what those modules import, even when this package uses none of them. Declare "sideEffects": false in ${files.relative(root, files.join(directory, PACKAGE_JSON_FILE))}, and keep a module that must run for its effect out of that package.`;
|
|
14028
|
-
const nameIndex$1 = (source) => pipe(String$1.indexOf(NAME_KEY$2)(source), Option.getOrElse(() => START$
|
|
14045
|
+
const nameIndex$1 = (source) => pipe(String$1.indexOf(NAME_KEY$2)(source), Option.getOrElse(() => START$23));
|
|
14029
14046
|
/** @internal */
|
|
14030
14047
|
const bundledSideEffectProblems = Effect.fn("bundledSideEffectProblems")(function* bundledSideEffectProblems({ root, directory, located, used }) {
|
|
14031
14048
|
const files = yield* RepositoryFiles;
|
|
@@ -14058,6 +14075,7 @@ const usedBy = Effect.fn("usedBy")(function* usedBy(scope, entry) {
|
|
|
14058
14075
|
return {
|
|
14059
14076
|
entry,
|
|
14060
14077
|
packages: kept.packages,
|
|
14078
|
+
startup: kept.startup,
|
|
14061
14079
|
modules: kept.modules
|
|
14062
14080
|
};
|
|
14063
14081
|
});
|
|
@@ -14159,7 +14177,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
14159
14177
|
return Array$1.flatten(found);
|
|
14160
14178
|
});
|
|
14161
14179
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
14162
|
-
const RULE$
|
|
14180
|
+
const RULE$46 = "legacy-typescript";
|
|
14163
14181
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
14164
14182
|
const COMPILER = "typescript";
|
|
14165
14183
|
const CURRENT_MAJOR = 7;
|
|
@@ -14190,12 +14208,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
14190
14208
|
file,
|
|
14191
14209
|
line: lineOf$2(source)(legacy.id),
|
|
14192
14210
|
column: FIRST$9,
|
|
14193
|
-
rule: RULE$
|
|
14211
|
+
rule: RULE$46,
|
|
14194
14212
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
14195
14213
|
})));
|
|
14196
14214
|
});
|
|
14197
14215
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
14198
|
-
const RULE$
|
|
14216
|
+
const RULE$45 = "worker-bundle";
|
|
14199
14217
|
const BUNDLE_CONCURRENCY = 4;
|
|
14200
14218
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
14201
14219
|
const CONDITIONS = [
|
|
@@ -14206,7 +14224,7 @@ const CONDITIONS = [
|
|
|
14206
14224
|
"module",
|
|
14207
14225
|
"default"
|
|
14208
14226
|
];
|
|
14209
|
-
const problemFor$2 = problemInFile(RULE$
|
|
14227
|
+
const problemFor$2 = problemInFile(RULE$45);
|
|
14210
14228
|
const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
14211
14229
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
14212
14230
|
const built = yield* Effect.tryPromise({
|
|
@@ -14235,6 +14253,185 @@ const checkWorkerBundles = Effect.fn("checkWorkerBundles")(function* checkWorker
|
|
|
14235
14253
|
const found = yield* Effect.forEach(entries, (entry) => bundleProblem(files.join(root, entry)), { concurrency: BUNDLE_CONCURRENCY });
|
|
14236
14254
|
return Array$1.getSomes(found);
|
|
14237
14255
|
});
|
|
14256
|
+
// src/app/check-expectations.ts
|
|
14257
|
+
const OFF = [
|
|
14258
|
+
"off",
|
|
14259
|
+
"allow",
|
|
14260
|
+
0
|
|
14261
|
+
];
|
|
14262
|
+
const PrintedConfig = Schema.fromJsonString(Schema.Struct({ rules: Schema.Record(Schema.String, Schema.Unknown) }));
|
|
14263
|
+
const isList$1 = (value) => Array$1.isArray(value);
|
|
14264
|
+
const severityOf$1 = (value) => pipe(Option.some(value), Option.filter(isList$1), Option.flatMap(Array$1.head), Option.getOrElse(() => value));
|
|
14265
|
+
const printedConfig = Effect.fn("printedConfig")(function* printedConfig(root) {
|
|
14266
|
+
const handle = yield* ChildProcess.make("vp", ["lint", "--print-config"], {
|
|
14267
|
+
cwd: root,
|
|
14268
|
+
extendEnv: true,
|
|
14269
|
+
stdin: "ignore"
|
|
14270
|
+
});
|
|
14271
|
+
const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
14272
|
+
yield* handle.exitCode;
|
|
14273
|
+
return yield* Schema.decodeEffect(PrintedConfig)(text);
|
|
14274
|
+
}, Effect.scoped);
|
|
14275
|
+
const enabledRulesIn = Effect.fn("enabledRulesIn")(function* enabledRulesIn(root) {
|
|
14276
|
+
const printed = yield* printedConfig(root).pipe(Effect.option);
|
|
14277
|
+
return pipe(printed, Option.map(({ rules }) => pipe(Record.toEntries(rules), Array$1.filter(([, value]) => !Array$1.contains(OFF, severityOf$1(value))), Array$1.map(([name]) => name))), Option.getOrElse(() => []), (names) => new Set(names));
|
|
14278
|
+
});
|
|
14279
|
+
/** @internal */
|
|
14280
|
+
const expectationsIn = Effect.fn("expectationsIn")(function* expectationsIn(root) {
|
|
14281
|
+
return {
|
|
14282
|
+
enabledRules: yield* enabledRulesIn(root),
|
|
14283
|
+
text: {
|
|
14284
|
+
ignores: TEXT_IGNORES,
|
|
14285
|
+
builtRuleNames: builtTextRuleNames
|
|
14286
|
+
},
|
|
14287
|
+
markdown: {
|
|
14288
|
+
ignores: MARKDOWN_IGNORES,
|
|
14289
|
+
rules: MARKDOWN_RULES
|
|
14290
|
+
},
|
|
14291
|
+
tasks: MSCH_TASK_COMMANDS,
|
|
14292
|
+
verifyTasks: Record.keys(MSCH_TASK_COMMANDS),
|
|
14293
|
+
secrets: secretsOf()
|
|
14294
|
+
};
|
|
14295
|
+
});
|
|
14296
|
+
// src/app/config-weakenings.ts
|
|
14297
|
+
const PRESET_KEYS = [
|
|
14298
|
+
"categories",
|
|
14299
|
+
"plugins",
|
|
14300
|
+
"jsPlugins",
|
|
14301
|
+
"rules",
|
|
14302
|
+
"options",
|
|
14303
|
+
"settings"
|
|
14304
|
+
];
|
|
14305
|
+
const ENABLED = ["error", "deny"];
|
|
14306
|
+
const SEVERITY_ONLY = 1;
|
|
14307
|
+
const MSCH_RELAXATIONS = [
|
|
14308
|
+
{ "react/jsx-props-no-spreading": "off" },
|
|
14309
|
+
{ "import/no-default-export": "off" },
|
|
14310
|
+
decisionTestRules
|
|
14311
|
+
];
|
|
14312
|
+
const isList = (value) => Array$1.isArray(value);
|
|
14313
|
+
const isSection = (value) => Predicate.isObject(value) && !Array$1.isArray(value);
|
|
14314
|
+
const sectionOf = (value) => pipe(Option.some(value), Option.filter(isSection), Option.getOrElse(() => ({})));
|
|
14315
|
+
const listOf = (value) => pipe(Option.some(value), Option.filter(isList), Option.getOrElse(() => []));
|
|
14316
|
+
const severityOf = (value) => pipe(listOf(value), Array$1.head, Option.getOrElse(() => value));
|
|
14317
|
+
const hasOptions = (value) => Array$1.length(listOf(value)) > SEVERITY_ONLY;
|
|
14318
|
+
const unless = (kept, weakening) => Array$1.filter([weakening], () => !kept);
|
|
14319
|
+
const whenPresent = (what, weakeningsIn) => (value) => Option.match(Option.fromUndefinedOr(value), {
|
|
14320
|
+
onNone: () => [{
|
|
14321
|
+
anchor: "defineConfig",
|
|
14322
|
+
message: `vite.config.ts has no ${what}. Spread repositoryConfig from @r_masseater/msch/config into defineConfig.`
|
|
14323
|
+
}],
|
|
14324
|
+
onSome: (present) => weakeningsIn(sectionOf(present))
|
|
14325
|
+
});
|
|
14326
|
+
const presetDifferences = (lint) => pipe(PRESET_KEYS, Array$1.filter((key) => !Equal.equals(lint[key], lint$3[key])), Array$1.map((key) => ({
|
|
14327
|
+
anchor: "lint",
|
|
14328
|
+
message: `lint.${key} differs from the msch preset. Leave the lint section as repositoryConfig builds it; to add a rule, pass it in overrides or a workspace's msch.lint.overrides.`
|
|
14329
|
+
})));
|
|
14330
|
+
const isPresetOverride = (override) => pipe(lint$3.overrides, Array$1.some((built) => Equal.equals(built, override)));
|
|
14331
|
+
const isMschRelaxation = (override) => pipe(MSCH_RELAXATIONS, Array$1.some((rules) => Equal.equals(rules, override["rules"])));
|
|
14332
|
+
const ruleWeakening = (enabledRules) => ([name, value]) => [...unless(Array$1.contains(ENABLED, severityOf(value)), {
|
|
14333
|
+
anchor: name,
|
|
14334
|
+
message: `An override sets ${name} to ${String(severityOf(value))}. Rules are not turned off in a repository that uses msch: fix what the rule reports, or fix the rule in msch.`
|
|
14335
|
+
}), ...unless(!(hasOptions(value) && enabledRules.has(name)), {
|
|
14336
|
+
anchor: name,
|
|
14337
|
+
message: `An override changes the options of ${name}, which the msch preset already sets. Options of preset rules are not changed per file: fix what the rule reports, or change the rule in msch.`
|
|
14338
|
+
})];
|
|
14339
|
+
const overrideWeakenings = (enabledRules) => (override) => {
|
|
14340
|
+
const section = sectionOf(override);
|
|
14341
|
+
const builtByMsch = isPresetOverride(override) || isMschRelaxation(section);
|
|
14342
|
+
return pipe(Record.toEntries(sectionOf(section["rules"])), Array$1.filter(() => !builtByMsch), Array$1.flatMap(ruleWeakening(enabledRules)));
|
|
14343
|
+
};
|
|
14344
|
+
const lintWeakenings = (enabledRules) => whenPresent("lint section, so the msch preset does not run", (section) => [
|
|
14345
|
+
...presetDifferences(section),
|
|
14346
|
+
...unless(Equal.equals(section["ignorePatterns"], exempt), {
|
|
14347
|
+
anchor: "ignorePatterns",
|
|
14348
|
+
message: "lint.ignorePatterns differs from the files msch exempts (generated files, fixtures and upstream code). Files are not taken out of lint in a repository that uses msch."
|
|
14349
|
+
}),
|
|
14350
|
+
...pipe(listOf(section["overrides"]), Array$1.flatMap(overrideWeakenings(enabledRules)))
|
|
14351
|
+
]);
|
|
14352
|
+
const isOff = (value) => value === false || pipe(Record.values(sectionOf(value)), Array$1.some(isOff));
|
|
14353
|
+
const textRuleWeakenings = (expected) => (owner, rules) => [...pipe(expected.builtRuleNames, Array$1.filter((name) => !Record.has(rules, name)), Array$1.map((name) => ({
|
|
14354
|
+
anchor: "textlint",
|
|
14355
|
+
message: `${owner} does not run ${name}, which msch sets. Leave the textlint section as repositoryConfig builds it.`
|
|
14356
|
+
}))), ...pipe(Record.toEntries(rules), Array$1.filter(([, value]) => isOff(value)), Array$1.map(([name]) => ({
|
|
14357
|
+
anchor: name,
|
|
14358
|
+
message: `${owner} turns off ${name} or one of its rules. Rules are not turned off in a repository that uses msch: rewrite the text, or fix the rule in msch.`
|
|
14359
|
+
})))];
|
|
14360
|
+
const textWeakenings = (expected) => whenPresent("textlint section, so the Japanese text checks do not run", (section) => [
|
|
14361
|
+
...unless(Equal.equals(section["ignores"], expected.ignores), {
|
|
14362
|
+
anchor: "ignores",
|
|
14363
|
+
message: "textlint.ignores differs from the files msch exempts. Files are not taken out of the text checks in a repository that uses msch."
|
|
14364
|
+
}),
|
|
14365
|
+
...textRuleWeakenings(expected)("textlint", sectionOf(section["rules"])),
|
|
14366
|
+
...pipe(listOf(section["sources"]), Array$1.flatMap((source) => textRuleWeakenings(expected)("A textlint source", sectionOf(sectionOf(source)["rules"]))))
|
|
14367
|
+
]);
|
|
14368
|
+
const markdownWeakenings = (expected) => whenPresent("y8 section, so the Markdown checks do not run", (section) => [...unless(Equal.equals(section["ignores"], expected.ignores), {
|
|
14369
|
+
anchor: "ignores",
|
|
14370
|
+
message: "y8.ignores differs from the files msch exempts. Files are not taken out of the Markdown checks in a repository that uses msch."
|
|
14371
|
+
}), ...unless(Equal.equals(section["rules"], expected.rules), {
|
|
14372
|
+
anchor: "y8",
|
|
14373
|
+
message: "y8.rules differs from what markdownOf builds. Markdown rules are not turned off or changed in a repository that uses msch."
|
|
14374
|
+
})]);
|
|
14375
|
+
const taskWeakenings = (run, expected) => {
|
|
14376
|
+
const tasks = sectionOf(sectionOf(run)["tasks"]);
|
|
14377
|
+
const dependsOn = listOf(sectionOf(tasks["verify"])["dependsOn"]);
|
|
14378
|
+
return [...pipe(Record.toEntries(expected.tasks), Array$1.filter(([name, command]) => !Equal.equals(sectionOf(tasks[name])["command"], command)), Array$1.map(([name]) => ({
|
|
14379
|
+
anchor: "run",
|
|
14380
|
+
message: `The ${name} task does not run what msch builds for it. Leave msch's tasks as repositoryConfig builds them; add other work under another task name.`
|
|
14381
|
+
}))), ...pipe(expected.verifyTasks, Array$1.filter((name) => !Array$1.contains(dependsOn, name)), Array$1.map((name) => ({
|
|
14382
|
+
anchor: "verify",
|
|
14383
|
+
message: `verify does not run the ${name} task. Leave verify as repositoryConfig builds it.`
|
|
14384
|
+
})))];
|
|
14385
|
+
};
|
|
14386
|
+
const secretWeakenings = (h56m, expected) => unless(Equal.equals(h56m, expected), {
|
|
14387
|
+
anchor: "h56m",
|
|
14388
|
+
message: "h56m differs from what secretsOf builds. Findings and files are not taken out of the secret scan in a repository that uses msch: remove the value, or fix the scan in msch when the value is public."
|
|
14389
|
+
});
|
|
14390
|
+
/** @internal */
|
|
14391
|
+
const weakeningsOf = (expected) => (config) => [
|
|
14392
|
+
...lintWeakenings(expected.enabledRules)(config.lint),
|
|
14393
|
+
...textWeakenings(expected.text)(config.textlint),
|
|
14394
|
+
...markdownWeakenings(expected.markdown)(config.y8),
|
|
14395
|
+
...taskWeakenings(config.run, expected),
|
|
14396
|
+
...secretWeakenings(config.h56m, expected.secrets)
|
|
14397
|
+
];
|
|
14398
|
+
// src/app/disabled-rules.ts
|
|
14399
|
+
const RULE$44 = "disabled-rule";
|
|
14400
|
+
const CONFIG_FILE$5 = "vite.config.ts";
|
|
14401
|
+
const START$22 = 0;
|
|
14402
|
+
const SIDE_CONFIG = /(?:^|\/)(?:\.oxlintrc(?:\.jsonc?)?|oxlint\.config\.[cm]?[jt]s|\.oxlintignore|\.eslintrc(?:\.\w+)?|eslint\.config\.[cm]?[jt]s|\.eslintignore|\.textlintrc(?:\.\w+)?|\.textlintignore|\.markdownlint(?:-cli2)?(?:\.\w+)?|\.markdownlintignore|\.prettierignore|\.oxfmtrc(?:\.jsonc?)?|knip\.jsonc?)$/u;
|
|
14403
|
+
const SIDE_CONFIG_MESSAGE = "This file configures a check outside vite.config.ts, where msch cannot see whether it turns rules off. Delete it; msch builds every check setting in vite.config.ts.";
|
|
14404
|
+
const taggedError$5 = Schema.TaggedError;
|
|
14405
|
+
var DisabledRulesConfigUnreadable = class extends taggedError$5()("DisabledRulesConfigUnreadable", {
|
|
14406
|
+
file: Schema.String,
|
|
14407
|
+
reason: Schema.String
|
|
14408
|
+
}) {};
|
|
14409
|
+
const sideConfigs = Effect.fn("sideConfigs")(function* sideConfigs(root) {
|
|
14410
|
+
const files = yield* RepositoryFiles;
|
|
14411
|
+
const listed = yield* files.listedFiles(root);
|
|
14412
|
+
const isExempt = matcher(exempt);
|
|
14413
|
+
return pipe(listed, Array$1.filter((name) => SIDE_CONFIG.test(name) && !isExempt(name)), Array$1.map((name) => problemAtIndex(RULE$44)(files.join(root, name), "")(START$22, SIDE_CONFIG_MESSAGE)));
|
|
14414
|
+
});
|
|
14415
|
+
const configWeakenings = Effect.fn("configWeakenings")(function* configWeakenings(root, source) {
|
|
14416
|
+
const file = (yield* RepositoryFiles).join(root, CONFIG_FILE$5);
|
|
14417
|
+
const config = yield* Effect.tryPromise({
|
|
14418
|
+
try: () => resolveConfigFromFile(file),
|
|
14419
|
+
catch: (error) => DisabledRulesConfigUnreadable.make({
|
|
14420
|
+
file,
|
|
14421
|
+
reason: String(error)
|
|
14422
|
+
})
|
|
14423
|
+
});
|
|
14424
|
+
const expected = yield* expectationsIn(root);
|
|
14425
|
+
const at = problemAtIndex(RULE$44)(file, source);
|
|
14426
|
+
return pipe(weakeningsOf(expected)(config), Array$1.map(({ anchor, message }) => at(Option.getOrElse(String$1.indexOf(anchor)(source), () => START$22), message)));
|
|
14427
|
+
});
|
|
14428
|
+
/** @internal */
|
|
14429
|
+
const checkDisabledRules = Effect.fn("checkDisabledRules")(function* checkDisabledRules(root) {
|
|
14430
|
+
const files = yield* RepositoryFiles;
|
|
14431
|
+
const text = yield* files.readFile(files.join(root, CONFIG_FILE$5));
|
|
14432
|
+
if (Option.isNone(text)) return [];
|
|
14433
|
+
return [...yield* configWeakenings(root, text.value).pipe(Effect.catchTag("DisabledRulesConfigUnreadable", ({ file, reason }) => Effect.succeed([problemAtIndex(RULE$44)(file, "")(START$22, `msch could not load this file: ${reason}`)]))), ...yield* sideConfigs(root)];
|
|
14434
|
+
});
|
|
14238
14435
|
// src/app/build-checks.ts
|
|
14239
14436
|
/** @internal */
|
|
14240
14437
|
const checkBuilds = Effect.fn("checkBuilds")(function* checkBuilds(root) {
|
|
@@ -14243,7 +14440,8 @@ const checkBuilds = Effect.fn("checkBuilds")(function* checkBuilds(root) {
|
|
|
14243
14440
|
checkWorkerBundles(root),
|
|
14244
14441
|
checkTreeShaking(root),
|
|
14245
14442
|
checkMigrationOrder(root),
|
|
14246
|
-
checkPluginDependencies(root)
|
|
14443
|
+
checkPluginDependencies(root),
|
|
14444
|
+
checkDisabledRules(root)
|
|
14247
14445
|
], { concurrency: "unbounded" });
|
|
14248
14446
|
return Array$1.flatten(found);
|
|
14249
14447
|
});
|
|
@@ -16184,18 +16382,48 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
16184
16382
|
});
|
|
16185
16383
|
// src/shared/lib/comment-directives.ts
|
|
16186
16384
|
const COMMENT_DIRECTIVES = [
|
|
16187
|
-
"oxlint-disable",
|
|
16188
|
-
"textlint-disable",
|
|
16189
|
-
"textlint-enable",
|
|
16190
16385
|
String.raw`\* @internal \*?$`,
|
|
16191
16386
|
String.raw`\* @msch \S+ \*?$`,
|
|
16192
16387
|
String.raw`\* @stability (?:experimental|unstable) \*?$`,
|
|
16193
|
-
String.raw`shellcheck
|
|
16194
|
-
String.raw`zizmor: ignore\[`,
|
|
16388
|
+
String.raw`shellcheck (?:source|shell)=`,
|
|
16195
16389
|
String.raw`exit: \S`,
|
|
16196
16390
|
"> statement-breakpoint$",
|
|
16197
16391
|
"/ <reference (?:types|path|lib)="
|
|
16198
16392
|
];
|
|
16393
|
+
const SUPPRESSION = pipe([
|
|
16394
|
+
String.raw`\b(?:${Array$1.join([
|
|
16395
|
+
"eslint",
|
|
16396
|
+
"oxlint",
|
|
16397
|
+
"textlint",
|
|
16398
|
+
"y8",
|
|
16399
|
+
"markdownlint",
|
|
16400
|
+
"biome",
|
|
16401
|
+
"prettier",
|
|
16402
|
+
"oxfmt",
|
|
16403
|
+
"stylelint",
|
|
16404
|
+
"fallow",
|
|
16405
|
+
"knip",
|
|
16406
|
+
"jscpd",
|
|
16407
|
+
"c8",
|
|
16408
|
+
"v8",
|
|
16409
|
+
"istanbul",
|
|
16410
|
+
"tsrs",
|
|
16411
|
+
"tsgolint",
|
|
16412
|
+
"deno-lint",
|
|
16413
|
+
"rustfmt",
|
|
16414
|
+
"clippy"
|
|
16415
|
+
], "|")})[- ](?:disable|enable|ignore)\b`,
|
|
16416
|
+
String.raw`@ts-(?:ignore|expect-error|nocheck)\b`,
|
|
16417
|
+
String.raw`\b(?:gitleaks|betterleaks|h56m|trufflehog|detect-secrets)\s*:\s*allow`,
|
|
16418
|
+
String.raw`\bpragma:\s*allowlist`,
|
|
16419
|
+
String.raw`\bshellcheck\s+disable=`,
|
|
16420
|
+
String.raw`\bzizmor\s*:\s*ignore`,
|
|
16421
|
+
String.raw`\bactionlint\s*:\s*ignore`,
|
|
16422
|
+
String.raw`\bnosemgrep\b`,
|
|
16423
|
+
String.raw`\bnoqa\b`,
|
|
16424
|
+
String.raw`\btype:\s*ignore\b`
|
|
16425
|
+
], Array$1.join("|"), (source) => new RegExp(source, "iu"));
|
|
16426
|
+
const SUPPRESSION_MESSAGE = "This comment turns a check off. Checks are not turned off in a repository that uses msch: fix what the check reports, or, when the check itself is wrong, fix the check in msch.";
|
|
16199
16427
|
// src/features/ban-comments/model/found-comment.ts
|
|
16200
16428
|
const taggedError$3 = Schema.TaggedError;
|
|
16201
16429
|
var CommentsUnreadable = class extends taggedError$3()("CommentsUnreadable", {
|
|
@@ -16372,11 +16600,25 @@ const shebangReader = (source) => {
|
|
|
16372
16600
|
return pipe(SHEBANG_READERS, Array$1.findFirst(([pattern]) => pattern.test(source)));
|
|
16373
16601
|
};
|
|
16374
16602
|
const readerOf = (name) => (source) => pipe(READERS$1, Array$1.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
16603
|
+
// src/features/ban-comments/model/scanned-files.ts
|
|
16604
|
+
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
16605
|
+
const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root) {
|
|
16606
|
+
const files = yield* RepositoryFiles;
|
|
16607
|
+
const listed = yield* files.listedFiles(root);
|
|
16608
|
+
const generated = yield* files.generatedFiles(root);
|
|
16609
|
+
const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);
|
|
16610
|
+
const isIgnored = matcher(exempt);
|
|
16611
|
+
const skipped = HashSet.fromIterable([...generated, ...pipe(vendored, Array$1.map((name) => files.join(root, name)))]);
|
|
16612
|
+
return pipe(listed, Array$1.filter((name) => !isIgnored(name)), Array$1.map((name) => ({
|
|
16613
|
+
name,
|
|
16614
|
+
file: files.join(root, name)
|
|
16615
|
+
})), Array$1.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
16616
|
+
});
|
|
16375
16617
|
// src/features/ban-comments/model/comments.ts
|
|
16376
16618
|
const RULE$26 = "comment";
|
|
16619
|
+
const SUPPRESSION_RULE = "suppression";
|
|
16377
16620
|
const UNUSED_RULE = "unused-comment-allowance";
|
|
16378
16621
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
16379
|
-
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
16380
16622
|
const READ_CONCURRENCY$6 = 64;
|
|
16381
16623
|
const START$16 = 0;
|
|
16382
16624
|
const SHEBANG = "#!";
|
|
@@ -16387,15 +16629,8 @@ const MESSAGE$4 = "Comments are not written in this repository. Say it with name
|
|
|
16387
16629
|
const Patterns = Schema.Array(Schema.String);
|
|
16388
16630
|
const CommentSettings = Schema.Struct({ allow: Patterns });
|
|
16389
16631
|
const MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });
|
|
16390
|
-
const
|
|
16391
|
-
const
|
|
16392
|
-
msch: Schema.optional(MschSettings),
|
|
16393
|
-
lint: Schema.optional(LintSettings)
|
|
16394
|
-
});
|
|
16395
|
-
const NO_SETTINGS = {
|
|
16396
|
-
allow: [],
|
|
16397
|
-
ignorePatterns: []
|
|
16398
|
-
};
|
|
16632
|
+
const RootConfig = Schema.Struct({ msch: Schema.optional(MschSettings) });
|
|
16633
|
+
const NO_SETTINGS = { allow: [] };
|
|
16399
16634
|
const taggedError$2 = Schema.TaggedError;
|
|
16400
16635
|
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
16401
16636
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
@@ -16405,25 +16640,18 @@ const lineBefore = (source, index) => {
|
|
|
16405
16640
|
};
|
|
16406
16641
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
16407
16642
|
const isShebang = ({ index, text }) => index === START$16 && String$1.startsWith(SHEBANG)(text);
|
|
16408
|
-
const
|
|
16643
|
+
const isSuppression = (comment) => SUPPRESSION.test(comment.text);
|
|
16644
|
+
const isAllowed = (source, directives) => (comment) => !isSuppression(comment) && (isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment));
|
|
16409
16645
|
const NOTHING = {
|
|
16410
16646
|
problems: [],
|
|
16411
16647
|
used: []
|
|
16412
16648
|
};
|
|
16413
16649
|
const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but no comment in the repository matches it. Delete the entry and add it back when a comment needs it.`;
|
|
16414
|
-
const problemOf$1 = (file, source) => (
|
|
16415
|
-
|
|
16416
|
-
|
|
16417
|
-
|
|
16418
|
-
|
|
16419
|
-
});
|
|
16420
|
-
const settingsOf = ({ msch, lint }) => ({
|
|
16421
|
-
allow: pipe(Option.fromUndefinedOr(msch), Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)), Option.match({
|
|
16422
|
-
onNone: () => NO_SETTINGS.allow,
|
|
16423
|
-
onSome: ({ allow }) => allow
|
|
16424
|
-
})),
|
|
16425
|
-
ignorePatterns: pipe(Option.fromUndefinedOr(lint), Option.flatMap(({ ignorePatterns }) => Option.fromUndefinedOr(ignorePatterns)), Option.getOrElse(() => NO_SETTINGS.ignorePatterns))
|
|
16426
|
-
});
|
|
16650
|
+
const problemOf$1 = (file, source) => (comment) => Match.value(isSuppression(comment)).pipe(Match.when(true, () => problemAtIndex(SUPPRESSION_RULE)(file, source)(comment.index, SUPPRESSION_MESSAGE)), Match.orElse(() => problemAtIndex(RULE$26)(file, source)(comment.index, MESSAGE$4)));
|
|
16651
|
+
const settingsOf = ({ msch }) => ({ allow: pipe(Option.fromUndefinedOr(msch), Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)), Option.match({
|
|
16652
|
+
onNone: () => NO_SETTINGS.allow,
|
|
16653
|
+
onSome: ({ allow }) => allow
|
|
16654
|
+
})) });
|
|
16427
16655
|
const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
|
|
16428
16656
|
const files = yield* RepositoryFiles;
|
|
16429
16657
|
const file = files.join(root, CONFIG_FILE$3);
|
|
@@ -16438,31 +16666,14 @@ const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
|
|
|
16438
16666
|
}));
|
|
16439
16667
|
});
|
|
16440
16668
|
const directivePattern = (directives) => new RegExp(String.raw`^\s?(?:${Array$1.join(directives, "|")})`, "u");
|
|
16441
|
-
const
|
|
16442
|
-
const files = yield* RepositoryFiles;
|
|
16443
|
-
const listed = yield* files.listedFiles(root);
|
|
16444
|
-
const generated = yield* files.generatedFiles(root);
|
|
16445
|
-
const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);
|
|
16446
|
-
const isIgnored = matcher(settings.ignorePatterns);
|
|
16447
|
-
const skipped = HashSet.fromIterable([...generated, ...pipe(vendored, Array$1.map((name) => files.join(root, name)))]);
|
|
16448
|
-
return pipe(listed, Array$1.filter((name) => !isIgnored(name)), Array$1.map((name) => ({
|
|
16449
|
-
name,
|
|
16450
|
-
file: files.join(root, name)
|
|
16451
|
-
})), Array$1.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
16452
|
-
});
|
|
16453
|
-
const usedAllowances = (allowances, found) => pipe(allowances, Array$1.map((pattern, index) => [pattern, index]), Array$1.filter(([pattern]) => pipe(found, Array$1.some((comment) => pattern.test(valueOf(comment.text))))), Array$1.map(([, index]) => index));
|
|
16669
|
+
const usedAllowances = (allowances, found) => pipe(allowances, Array$1.map((pattern, index) => [pattern, index]), Array$1.filter(([pattern]) => pipe(found, Array$1.some((comment) => !isSuppression(comment) && pattern.test(valueOf(comment.text))))), Array$1.map(([, index]) => index));
|
|
16454
16670
|
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$16));
|
|
16455
16671
|
const unusedAllowances = Effect.fn("unusedAllowances")(function* unusedAllowances(root, settings, used) {
|
|
16456
16672
|
const files = yield* RepositoryFiles;
|
|
16457
16673
|
const file = files.join(root, CONFIG_FILE$3);
|
|
16458
16674
|
const text = yield* files.readFile(file);
|
|
16459
16675
|
const source = Option.getOrElse(text, () => "");
|
|
16460
|
-
return pipe(settings.allow, Array$1.filter((_entry, index) => !HashSet.has(used, index)), Array$1.map((entry) => (
|
|
16461
|
-
file,
|
|
16462
|
-
...positionOf(source)(entryOffset(source, entry)),
|
|
16463
|
-
rule: UNUSED_RULE,
|
|
16464
|
-
message: unusedMessage(entry)
|
|
16465
|
-
})));
|
|
16676
|
+
return pipe(settings.allow, Array$1.filter((_entry, index) => !HashSet.has(used, index)), Array$1.map((entry) => problemAtIndex(UNUSED_RULE)(file, source)(entryOffset(source, entry), unusedMessage(entry))));
|
|
16466
16677
|
});
|
|
16467
16678
|
const scanFile = ({ directives, allowances, comments }) => ({ name, file }, source) => {
|
|
16468
16679
|
const kept = Predicate.not(isAllowed(source, directives));
|
|
@@ -16473,7 +16684,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
16473
16684
|
problems: pipe(found, Array$1.filter(kept), Array$1.map(toProblem)),
|
|
16474
16685
|
used: usedAllowances(allowances, found)
|
|
16475
16686
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
16476
|
-
problems: [
|
|
16687
|
+
problems: [problemAtIndex(RULE$26)(file, source)(START$16, `msch could not read the comments in this file: ${message}`)],
|
|
16477
16688
|
used: []
|
|
16478
16689
|
})))
|
|
16479
16690
|
});
|
|
@@ -16482,7 +16693,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
16482
16693
|
const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
16483
16694
|
const files = yield* RepositoryFiles;
|
|
16484
16695
|
const settings = yield* rootSettings(root);
|
|
16485
|
-
const scanned = yield* scannedFiles(root
|
|
16696
|
+
const scanned = yield* scannedFiles(root);
|
|
16486
16697
|
const grammars = yield* loadGrammars();
|
|
16487
16698
|
const scan = scanFile({
|
|
16488
16699
|
directives: directivePattern([...COMMENT_DIRECTIVES, ...settings.allow]),
|
|
@@ -17369,16 +17580,12 @@ const SKIPPED_DIRECTORIES = [
|
|
|
17369
17580
|
"/upstream/"
|
|
17370
17581
|
];
|
|
17371
17582
|
const SKIPPED_FILES = ["CHANGELOG.md", "CLAUDE.md"];
|
|
17372
|
-
const DISABLE = /<!--\s*(?:y8|markdownlint|textlint)-disable(?:-next-line|-line|-file)?(
|
|
17583
|
+
const DISABLE = /<!--\s*(?:y8|markdownlint|textlint)-(?:disable|enable|capture|restore|configure-file)(?:-next-line|-line|-file)?(?:\s[\s\S]*?)?-->/giu;
|
|
17373
17584
|
const FENCE$1 = /^\s{0,3}(?:`{3,}|~{3,})/u;
|
|
17374
17585
|
const BACKTICK = /`/gu;
|
|
17375
|
-
const
|
|
17376
|
-
const SEPARATORS = /[\s,]+/u;
|
|
17377
|
-
const MESSAGE$2 = "Name the rules this comment disables, as in `<!-- y8-disable MD033 -->`. A comment with no rule name stops every rule, so it also hides violations that are added later.";
|
|
17586
|
+
const MESSAGE$2 = "This comment turns a Markdown or text check off. Checks are not turned off in a repository that uses msch: fix what the check reports, or, when the check itself is wrong, fix the check in msch.";
|
|
17378
17587
|
const fenceStep = (inside, line) => Match.value(FENCE$1.test(line)).pipe(Match.when(true, () => [!inside, true]), Match.orElse(() => [inside, inside]));
|
|
17379
17588
|
const insideCodeSpan = (before) => Array$1.fromIterable(String$1.matchAll(BACKTICK)(before)).length % PAIR === ODD;
|
|
17380
|
-
const namedRules = (rest) => pipe(rest, String$1.replace(DESCRIPTION, ""), String$1.split(SEPARATORS), Array$1.filter(String$1.isNonEmpty));
|
|
17381
|
-
const restOf = (found) => pipe(Option.fromNullishOr(found.groups), Option.flatMap(Record.get("rest")), Option.getOrElse(() => ""));
|
|
17382
17589
|
const problemsIn$7 = (file, source) => {
|
|
17383
17590
|
const lines = String$1.split("\n")(source);
|
|
17384
17591
|
const fenced = Array$1.mapAccum(lines, false, fenceStep)[SECOND];
|
|
@@ -17386,7 +17593,7 @@ const problemsIn$7 = (file, source) => {
|
|
|
17386
17593
|
const { line, column } = positionOf(source)(index);
|
|
17387
17594
|
return pipe(Array$1.get(fenced, line - SECOND), Option.getOrElse(() => false)) || pipe(Array$1.get(lines, line - SECOND), Option.map(String$1.slice(START$11, column - SECOND)), Option.exists(insideCodeSpan));
|
|
17388
17595
|
};
|
|
17389
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(DISABLE)(source)), Array$1.filter((match) =>
|
|
17596
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(DISABLE)(source)), Array$1.filter((match) => !isCode(match.index ?? START$11)), Array$1.map((match) => problemAtIndex(RULE$18)(file, source)(match.index ?? START$11, MESSAGE$2)));
|
|
17390
17597
|
};
|
|
17391
17598
|
const isChecked = (name) => String$1.endsWith(MARKDOWN$3)(name) && !pipe(SKIPPED_DIRECTORIES, Array$1.some((directory) => String$1.includes(directory)(`/${name}`))) && !pipe(SKIPPED_FILES, Array$1.some((skipped) => name === skipped || String$1.endsWith(`/${skipped}`)(name)));
|
|
17392
17599
|
/** @internal */
|