@r_masseater/msch 0.66.0 → 0.67.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/cargo-inputs.mjs +2 -2
- package/dist/changed.mjs +4 -4
- package/dist/cli.mjs +589 -367
- package/dist/cli.mjs.map +1 -1
- package/dist/config.mjs +4 -0
- package/dist/config.mjs.map +1 -1
- package/dist/{dependencies-BDQ7XSwU.mjs → dependencies-B9hf2aIC.mjs} +21 -21
- package/dist/dependencies-B9hf2aIC.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/{ignored-directories-DurTKTTN.mjs → ignored-directories-DzwJE3Y7.mjs} +2 -2
- package/dist/{ignored-directories-DurTKTTN.mjs.map → ignored-directories-DzwJE3Y7.mjs.map} +1 -1
- package/dist/{lookup-report-CPR_cj8F.mjs → lookup-report-FU7iFxSa.mjs} +3 -3
- package/dist/{lookup-report-CPR_cj8F.mjs.map → lookup-report-FU7iFxSa.mjs.map} +1 -1
- package/dist/manifest-texts-B8NV4YCS.mjs +59 -0
- package/dist/manifest-texts-B8NV4YCS.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{pass-records-DdiDtl_g.mjs → pass-records-C5tcV6Qh.mjs} +4 -4
- package/dist/{pass-records-DdiDtl_g.mjs.map → pass-records-C5tcV6Qh.mjs.map} +1 -1
- package/dist/{problem-glqVxx3h.mjs → problem-BvRpVt97.mjs} +2 -2
- package/dist/{problem-glqVxx3h.mjs.map → problem-BvRpVt97.mjs.map} +1 -1
- package/dist/publish.mjs +1 -1
- package/dist/{published-DnkuW2Tw.mjs → published-l5wN7u0m.mjs} +3 -3
- package/dist/{published-DnkuW2Tw.mjs.map → published-l5wN7u0m.mjs.map} +1 -1
- package/dist/published.d.mts +1 -0
- package/dist/published.mjs +118 -0
- package/dist/published.mjs.map +1 -0
- package/dist/refs.mjs +3 -3
- package/dist/{repository-files-mOPItI5o.mjs → repository-files-BxmKrOgg.mjs} +35 -22
- package/dist/repository-files-BxmKrOgg.mjs.map +1 -0
- package/dist/{runtime-mDBC8Yey.mjs → runtime-C6khg0XJ.mjs} +2 -2
- package/dist/{runtime-mDBC8Yey.mjs.map → runtime-C6khg0XJ.mjs.map} +1 -1
- package/dist/{syntax-A3ga4Ksb.mjs → syntax-V4CunkGE.mjs} +2 -2
- package/dist/{syntax-A3ga4Ksb.mjs.map → syntax-V4CunkGE.mjs.map} +1 -1
- package/dist/{upstream-exits-Bv2E-QO6.mjs → upstream-exits-DLZh68ZH.mjs} +4 -4
- package/dist/{upstream-exits-Bv2E-QO6.mjs.map → upstream-exits-DLZh68ZH.mjs.map} +1 -1
- package/dist/wake.mjs +1 -1
- package/dist/workspace-manifest-BC-1cRIJ.mjs +20 -0
- package/dist/workspace-manifest-BC-1cRIJ.mjs.map +1 -0
- package/dist/workspace-settings.mjs +4 -4
- package/package.json +7 -7
- package/skills/msch-checks/SKILL.md +6 -0
- package/dist/dependencies-BDQ7XSwU.mjs.map +0 -1
- package/dist/repository-files-mOPItI5o.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-
|
|
3
|
-
import {
|
|
4
|
-
import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-
|
|
5
|
-
import { a as groupOf, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-
|
|
6
|
-
import { a as workspaceDeviations, c as tomlSourceComments, d as problemAtIndex, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-
|
|
2
|
+
import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, _ as deployEntries, a as EntryManifestJson, c as publicEntriesOf, d as workspaceLinks, g as bundledEntries, i as publishedWorkspaces, l as targetsIn, m as lockedPackages, o as entryNameOf, p as lockedGraph, r as packedWorkspaces, s as isBinEntry, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-l5wN7u0m.mjs";
|
|
3
|
+
import { t as workspaceManifest } from "./workspace-manifest-BC-1cRIJ.mjs";
|
|
4
|
+
import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-C5tcV6Qh.mjs";
|
|
5
|
+
import { a as groupOf, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-BxmKrOgg.mjs";
|
|
6
|
+
import { a as workspaceDeviations, c as tomlSourceComments, d as problemAtIndex, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-DLZh68ZH.mjs";
|
|
7
7
|
import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
|
|
8
|
-
import { a as
|
|
8
|
+
import { a as publishedProjects, c as workspaceProjects, o as unmatchedWorkspacePatterns, r as readManifest, s as workspaceDirectories, t as MANIFEST_FILE$3 } from "./dependencies-B9hf2aIC.mjs";
|
|
9
|
+
import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-BvRpVt97.mjs";
|
|
9
10
|
import { t as JAPANESE } from "./config-CvPuqi4L.mjs";
|
|
10
11
|
import { n as readTree, t as loadLanguage } from "./tree-sitter-BfzHNwTR.mjs";
|
|
11
|
-
import { $ as isPropertyAccessExpression, A as getNameOfDeclaration, B as isExportDeclaration, D as SyntaxKind, E as SymbolFlags, F as isBlock, G as isImportDeclaration, H as isFunctionDeclaration, I as isCallExpression, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isParenthesizedExpression, R as isElementAccessExpression, T as SignatureKind, U as isFunctionExpression, V as isExpressionStatement, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as referencedSymbols, a as declarationsOf, at as isSpreadElement, b as symbolAtLocation, c as importedModulesOf, ct as isTypeLiteralNode, d as isInsideAny, dt as isVariableDeclaration, et as isPropertyAssignment, f as isOutsideDeclaration, ft as isVariableDeclarationList, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSourceFile, j as getTextOfJSDocComment, l as isExternalDeclaration, lt as isTypeReferenceNode, m as lineOf$3, n as childrenOf$2, nt as isSatisfiesExpression, o as declaresAType, ot as isStringLiteral, p as isTypeDeclaration, pt as isVariableStatement, q as isModuleBlock, r as columnOf, rt as isSignatureDeclaration, s as descendantsOf, st as isTypeAliasDeclaration, t as carriesTag, tt as isReturnStatement, u as isGenericDeclaration, ut as isUnionTypeNode, x as uniqueByReference, y as symbolAt, z as isEnumDeclaration } from "./syntax-
|
|
12
|
-
import { n as
|
|
12
|
+
import { $ as isPropertyAccessExpression, A as getNameOfDeclaration, B as isExportDeclaration, D as SyntaxKind, E as SymbolFlags, F as isBlock, G as isImportDeclaration, H as isFunctionDeclaration, I as isCallExpression, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isParenthesizedExpression, R as isElementAccessExpression, T as SignatureKind, U as isFunctionExpression, V as isExpressionStatement, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as referencedSymbols, a as declarationsOf, at as isSpreadElement, b as symbolAtLocation, c as importedModulesOf, ct as isTypeLiteralNode, d as isInsideAny, dt as isVariableDeclaration, et as isPropertyAssignment, f as isOutsideDeclaration, ft as isVariableDeclarationList, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSourceFile, j as getTextOfJSDocComment, l as isExternalDeclaration, lt as isTypeReferenceNode, m as lineOf$3, n as childrenOf$2, nt as isSatisfiesExpression, o as declaresAType, ot as isStringLiteral, p as isTypeDeclaration, pt as isVariableStatement, q as isModuleBlock, r as columnOf, rt as isSignatureDeclaration, s as descendantsOf, st as isTypeAliasDeclaration, t as carriesTag, tt as isReturnStatement, u as isGenericDeclaration, ut as isUnionTypeNode, x as uniqueByReference, y as symbolAt, z as isEnumDeclaration } from "./syntax-V4CunkGE.mjs";
|
|
13
|
+
import { a as fieldsOf, c as namedCatalogsOf, d as specifiedIn, i as decodeManifest$9, l as offsetIn$1, n as baseName$1, o as manifestPattern, r as baseRevision, s as manifestSpecifiers, t as manifestTexts, u as quoted$2 } from "./manifest-texts-B8NV4YCS.mjs";
|
|
14
|
+
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-C6khg0XJ.mjs";
|
|
13
15
|
import "./cli-contract-D7btWrEu.mjs";
|
|
14
16
|
import { builtinModules } from "node:module";
|
|
15
17
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
16
|
-
import { Array, Boolean as Boolean$1,
|
|
18
|
+
import { Array, Boolean as Boolean$1, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
17
19
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
18
20
|
import { ChildProcess } from "effect/process";
|
|
19
21
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
20
22
|
import { parse as parse$1 } from "@pnpm/deps.path";
|
|
21
23
|
import { fileURLToPath } from "node:url";
|
|
24
|
+
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
22
25
|
import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
|
|
23
26
|
import { rolldown } from "vite/rolldown";
|
|
24
27
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -30,7 +33,6 @@ import { isComment, isTag, isText } from "domhandler";
|
|
|
30
33
|
import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
|
|
31
34
|
import { DockerfileParser } from "dockerfile-ast";
|
|
32
35
|
import { parse as parse$3 } from "sql-parser-cst";
|
|
33
|
-
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
34
36
|
import { findSkillFiles } from "@tanstack/intent";
|
|
35
37
|
// src/entities/workspace/model/run-tasks.ts
|
|
36
38
|
const TaskProperty = Schema.Struct({
|
|
@@ -84,7 +86,8 @@ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(r
|
|
|
84
86
|
return pipe(projects, Array.map(namedIn((directory) => files.basename(directory))));
|
|
85
87
|
});
|
|
86
88
|
// src/entities/workspace/model/cargo-crates.ts
|
|
87
|
-
const SEPARATOR$
|
|
89
|
+
const SEPARATOR$22 = "/";
|
|
90
|
+
const SUCCESS$1 = 0;
|
|
88
91
|
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
89
92
|
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
90
93
|
const CrateEntry = Schema.Struct({
|
|
@@ -105,7 +108,7 @@ const crateOf$1 = (crate) => ({
|
|
|
105
108
|
});
|
|
106
109
|
/** @internal */
|
|
107
110
|
const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
108
|
-
const
|
|
111
|
+
const handle = yield* ChildProcess.make("cargo", [
|
|
109
112
|
"metadata",
|
|
110
113
|
"--no-deps",
|
|
111
114
|
"--format-version",
|
|
@@ -115,13 +118,15 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
115
118
|
cwd: root,
|
|
116
119
|
extendEnv: true,
|
|
117
120
|
stdin: "ignore"
|
|
118
|
-
})
|
|
121
|
+
});
|
|
122
|
+
const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
123
|
+
if ((yield* handle.exitCode) !== SUCCESS$1) return [];
|
|
119
124
|
const list = yield* decodeCrateList(output);
|
|
120
125
|
return pipe(list.packages, Array.map(crateOf$1));
|
|
121
126
|
}, Effect.scoped);
|
|
122
127
|
/** @internal */
|
|
123
128
|
const owningWorkspace = (directories) => (directory) => {
|
|
124
|
-
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
129
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$22}`)(directory)));
|
|
125
130
|
return Array.last(Array.sort(owners, String$1.Order));
|
|
126
131
|
};
|
|
127
132
|
// src/features/check-overrides/model/override-findings.ts
|
|
@@ -341,11 +346,11 @@ const judge = (baseline) => (key, candidate) => {
|
|
|
341
346
|
};
|
|
342
347
|
const BASELINE_PROBE = "msch-baseline-probe";
|
|
343
348
|
const REMOVED_DEPENDENCY = "-";
|
|
344
|
-
const QUOTES = ["\"", "'"];
|
|
349
|
+
const QUOTES$1 = ["\"", "'"];
|
|
345
350
|
const PREVIOUS = 1;
|
|
346
351
|
const keyStart = (source) => (index) => {
|
|
347
352
|
const before = String$1.slice(index - PREVIOUS, index)(source);
|
|
348
|
-
return index - Number(Array.contains(QUOTES, before)) * PREVIOUS;
|
|
353
|
+
return index - Number(Array.contains(QUOTES$1, before)) * PREVIOUS;
|
|
349
354
|
};
|
|
350
355
|
const overrideKeysOf = (source) => (overrides) => {
|
|
351
356
|
const at = positionOf(source);
|
|
@@ -360,10 +365,10 @@ const withBaselineProbe = (overrides) => ({
|
|
|
360
365
|
[BASELINE_PROBE]: REMOVED_DEPENDENCY
|
|
361
366
|
});
|
|
362
367
|
// src/features/check-overrides/model/overrides.ts
|
|
363
|
-
const WORKSPACE_FILE$
|
|
368
|
+
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
364
369
|
const RESOLUTION_FILES = [
|
|
365
370
|
"*package.json",
|
|
366
|
-
WORKSPACE_FILE$
|
|
371
|
+
WORKSPACE_FILE$6,
|
|
367
372
|
"pnpm-lock.yaml",
|
|
368
373
|
".npmrc",
|
|
369
374
|
"patches/*"
|
|
@@ -465,7 +470,7 @@ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace,
|
|
|
465
470
|
const { root, overrides } = workspace;
|
|
466
471
|
const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));
|
|
467
472
|
const judgeAgainstBaseline = judge(baseline);
|
|
468
|
-
const file = path.join(root, WORKSPACE_FILE$
|
|
473
|
+
const file = path.join(root, WORKSPACE_FILE$6);
|
|
469
474
|
const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(Effect.map((candidate) => overrideProblem({
|
|
470
475
|
...located,
|
|
471
476
|
file
|
|
@@ -477,7 +482,7 @@ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace,
|
|
|
477
482
|
const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
|
|
478
483
|
const fs = yield* FileSystem.FileSystem;
|
|
479
484
|
const path = yield* Path.Path;
|
|
480
|
-
const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$
|
|
485
|
+
const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$6)).pipe(Effect.option);
|
|
481
486
|
const manifest = yield* workspaceManifest(root);
|
|
482
487
|
const overrides = pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)), Option.getOrElse(() => ({})));
|
|
483
488
|
const keys = pipe(source, Option.map((text) => overrideKeysOf(text)(overrides)), Option.getOrElse(() => []));
|
|
@@ -493,7 +498,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
493
498
|
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
494
499
|
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
495
500
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
496
|
-
const READ_CONCURRENCY$
|
|
501
|
+
const READ_CONCURRENCY$35 = 64;
|
|
497
502
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
498
503
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
499
504
|
/** @internal */
|
|
@@ -516,93 +521,93 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
516
521
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
517
522
|
onNone: () => [],
|
|
518
523
|
onSome: (source) => problemsIn(entry, source)
|
|
519
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
524
|
+
}))), { concurrency: READ_CONCURRENCY$35 });
|
|
520
525
|
return Array.flatten(found);
|
|
521
526
|
});
|
|
522
527
|
// src/features/check-overrides/model/git-subpath.ts
|
|
523
528
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
524
529
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
525
|
-
const RULE$
|
|
530
|
+
const RULE$66 = "git-subpath-dependency";
|
|
526
531
|
const WHOLE_MATCH$4 = 0;
|
|
527
532
|
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
528
533
|
file,
|
|
529
534
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
530
|
-
rule: RULE$
|
|
535
|
+
rule: RULE$66,
|
|
531
536
|
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])}\`.`
|
|
532
537
|
});
|
|
533
|
-
const problemsIn$
|
|
538
|
+
const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
|
|
534
539
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
535
540
|
/** @internal */
|
|
536
541
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
537
542
|
const listed = yield* listedFiles(root);
|
|
538
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
543
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$22);
|
|
539
544
|
});
|
|
540
545
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
541
|
-
const RULE$
|
|
546
|
+
const RULE$65 = "unnamed-restriction";
|
|
542
547
|
const WHOLE_MATCH$3 = 0;
|
|
543
548
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
544
|
-
const problemsIn$
|
|
549
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
545
550
|
file: entry.file,
|
|
546
551
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
547
|
-
rule: RULE$
|
|
552
|
+
rule: RULE$65,
|
|
548
553
|
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.`
|
|
549
554
|
})));
|
|
550
555
|
/** @internal */
|
|
551
556
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
552
557
|
const listed = yield* listedFiles(root);
|
|
553
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
558
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
|
|
554
559
|
});
|
|
555
560
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
556
|
-
const RULE$
|
|
561
|
+
const RULE$64 = "named-type-exemption";
|
|
557
562
|
const WHOLE_MATCH$2 = 0;
|
|
558
563
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
559
|
-
const problemsIn$
|
|
564
|
+
const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
560
565
|
file: entry.file,
|
|
561
566
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
562
|
-
rule: RULE$
|
|
567
|
+
rule: RULE$64,
|
|
563
568
|
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."
|
|
564
569
|
})));
|
|
565
570
|
/** @internal */
|
|
566
571
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
567
572
|
const listed = yield* listedFiles(root);
|
|
568
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
573
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
|
|
569
574
|
});
|
|
570
575
|
// src/features/check-overrides/model/package-registry.ts
|
|
571
|
-
const RULE$
|
|
576
|
+
const RULE$63 = "package-registry";
|
|
572
577
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
573
578
|
const TRAILING_SLASH = /\/$/u;
|
|
574
|
-
const WORKSPACE_FILE$
|
|
579
|
+
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
575
580
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
576
581
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
577
582
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
578
|
-
const START$
|
|
583
|
+
const START$25 = 0;
|
|
579
584
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
580
585
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
581
586
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
582
587
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
583
588
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
584
|
-
const offsetIn
|
|
589
|
+
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$25));
|
|
585
590
|
const workspaceProblem = (file, source, registry) => ({
|
|
586
591
|
file,
|
|
587
|
-
...positionOf(source)(offsetIn
|
|
588
|
-
rule: RULE$
|
|
592
|
+
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
593
|
+
rule: RULE$63,
|
|
589
594
|
message: Option.match(registry, {
|
|
590
|
-
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$
|
|
595
|
+
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
591
596
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
592
597
|
})
|
|
593
598
|
});
|
|
594
599
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf("value")(found), isGuarded)), Array.map((found) => ({
|
|
595
600
|
file: entry.file,
|
|
596
|
-
...positionOf(source)(found.index ?? START$
|
|
597
|
-
rule: RULE$
|
|
598
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
601
|
+
...positionOf(source)(found.index ?? START$25),
|
|
602
|
+
rule: RULE$63,
|
|
603
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$25])}\`. Remove the line.`
|
|
599
604
|
})));
|
|
600
605
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
601
606
|
const files = yield* RepositoryFiles;
|
|
602
607
|
const manifest = yield* workspaceManifest(root);
|
|
603
608
|
if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) return [];
|
|
604
609
|
const registry = registryOf(manifest.value);
|
|
605
|
-
const file = files.join(root, WORKSPACE_FILE$
|
|
610
|
+
const file = files.join(root, WORKSPACE_FILE$5);
|
|
606
611
|
const read = yield* files.readFile(file);
|
|
607
612
|
const source = Option.getOrElse(read, () => "");
|
|
608
613
|
return [workspaceProblem(file, source, registry)];
|
|
@@ -613,36 +618,6 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
613
618
|
const overrides = yield* scanText(pipe(listed, Array.filter(({ name }) => NPMRC.test(name))), npmrcProblems);
|
|
614
619
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
615
620
|
});
|
|
616
|
-
// src/entities/package/model/specifiers.ts
|
|
617
|
-
const START$23 = 0;
|
|
618
|
-
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
619
|
-
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
620
|
-
const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
621
|
-
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
622
|
-
/** @internal */
|
|
623
|
-
const decodeManifest$8 = (source) => decodeJson$2(source);
|
|
624
|
-
/** @internal */
|
|
625
|
-
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
626
|
-
/** @internal */
|
|
627
|
-
const namedCatalogsOf = (settings) => Record.toEntries(fieldsOf(settings["catalogs"]));
|
|
628
|
-
/** @internal */
|
|
629
|
-
const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString$2(value), Option.map((specifier) => ({
|
|
630
|
-
name,
|
|
631
|
-
specifier
|
|
632
|
-
})), Option.toArray)));
|
|
633
|
-
/** @internal */
|
|
634
|
-
const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
635
|
-
/** @internal */
|
|
636
|
-
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
637
|
-
/** @internal */
|
|
638
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
|
|
639
|
-
const SECTIONS = [
|
|
640
|
-
"dependencies",
|
|
641
|
-
"devDependencies",
|
|
642
|
-
"optionalDependencies"
|
|
643
|
-
];
|
|
644
|
-
/** @internal */
|
|
645
|
-
const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
|
|
646
621
|
// src/entities/package/model/published-manifest.ts
|
|
647
622
|
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
648
623
|
const PublishedManifestSchema = Schema.Struct({
|
|
@@ -669,7 +644,7 @@ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* sca
|
|
|
669
644
|
})), Option.getOrElse(() => [])));
|
|
670
645
|
});
|
|
671
646
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
672
|
-
const RULE$
|
|
647
|
+
const RULE$62 = "colocated-git-patterns";
|
|
673
648
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
674
649
|
const ROOT$3 = ".";
|
|
675
650
|
const NEGATION$1 = "!";
|
|
@@ -680,7 +655,7 @@ const LEADING_SLASHES = /^\/+/u;
|
|
|
680
655
|
const TRAILING_SLASHES = /\/+$/u;
|
|
681
656
|
const SPACES = /\s+/u;
|
|
682
657
|
const FIRST$22 = 1;
|
|
683
|
-
const READ_CONCURRENCY$
|
|
658
|
+
const READ_CONCURRENCY$34 = 16;
|
|
684
659
|
const withoutPrefix = (prefix, text) => {
|
|
685
660
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
686
661
|
return text;
|
|
@@ -716,7 +691,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
716
691
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
717
692
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
718
693
|
});
|
|
719
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
694
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$62)(entry.file, {
|
|
720
695
|
line: entry.line,
|
|
721
696
|
column: FIRST$22
|
|
722
697
|
}, message);
|
|
@@ -771,17 +746,17 @@ const repeated = (entries) => (entry) => {
|
|
|
771
746
|
/** @internal */
|
|
772
747
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
773
748
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
774
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
749
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$34 });
|
|
775
750
|
const entries = Array.flatten(read);
|
|
776
751
|
const workspaces = yield* workspaceDirectories(root);
|
|
777
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
752
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$34 });
|
|
778
753
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
779
754
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
780
755
|
});
|
|
781
756
|
// src/features/check-placement/model/colocated-tests.ts
|
|
782
|
-
const RULE$
|
|
757
|
+
const RULE$61 = "colocated-test";
|
|
783
758
|
const FIRST$21 = 1;
|
|
784
|
-
const READ_CONCURRENCY$
|
|
759
|
+
const READ_CONCURRENCY$33 = 64;
|
|
785
760
|
const ROOT_SUBPATH = ".";
|
|
786
761
|
const NAME_GROUP = "name";
|
|
787
762
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -797,17 +772,17 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
|
|
|
797
772
|
const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
798
773
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
799
774
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
800
|
-
const Manifest$
|
|
775
|
+
const Manifest$7 = Schema.Struct({
|
|
801
776
|
name: Schema.optional(Schema.String),
|
|
802
777
|
exports: Schema.optional(Schema.Unknown)
|
|
803
778
|
});
|
|
804
|
-
const decodeManifest$
|
|
779
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
|
|
805
780
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
806
781
|
const problemFor$9 = (test, message) => ({
|
|
807
782
|
file: test.file,
|
|
808
783
|
line: FIRST$21,
|
|
809
784
|
column: FIRST$21,
|
|
810
|
-
rule: RULE$
|
|
785
|
+
rule: RULE$61,
|
|
811
786
|
message: `${test.base} ${message}`
|
|
812
787
|
});
|
|
813
788
|
const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
@@ -827,7 +802,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
827
802
|
if (Option.isNone(owner)) return [];
|
|
828
803
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
829
804
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
830
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
805
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(specifiersBeside({
|
|
831
806
|
join,
|
|
832
807
|
dirname: files.dirname,
|
|
833
808
|
directory: test.directory
|
|
@@ -870,12 +845,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
870
845
|
directory: files.dirname(file)
|
|
871
846
|
};
|
|
872
847
|
}));
|
|
873
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$
|
|
848
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$33 });
|
|
874
849
|
return Array.getSomes(found);
|
|
875
850
|
});
|
|
876
851
|
// src/shared/lib/agent-docs.ts
|
|
877
852
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
878
|
-
const READ_CONCURRENCY$
|
|
853
|
+
const READ_CONCURRENCY$32 = 16;
|
|
879
854
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
880
855
|
const files = yield* RepositoryFiles;
|
|
881
856
|
const listed = yield* files.listedFiles(root);
|
|
@@ -884,13 +859,13 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
884
859
|
const file = files.join(root, name);
|
|
885
860
|
const problemOf = Option.flatMap(problemIn(file));
|
|
886
861
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
887
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
862
|
+
}, { concurrency: READ_CONCURRENCY$32 });
|
|
888
863
|
return Array.getSomes(found);
|
|
889
864
|
});
|
|
890
865
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
891
866
|
const RECOMMENDED_LINES = 200;
|
|
892
867
|
const FIRST$20 = 1;
|
|
893
|
-
const RULE$
|
|
868
|
+
const RULE$60 = "agent-docs-length";
|
|
894
869
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
895
870
|
const problemFor$8 = (file) => (lines) => {
|
|
896
871
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -898,18 +873,18 @@ const problemFor$8 = (file) => (lines) => {
|
|
|
898
873
|
file,
|
|
899
874
|
line: 201,
|
|
900
875
|
column: FIRST$20,
|
|
901
|
-
rule: RULE$
|
|
876
|
+
rule: RULE$60,
|
|
902
877
|
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.`
|
|
903
878
|
});
|
|
904
879
|
};
|
|
905
880
|
/** @internal */
|
|
906
881
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
907
882
|
// src/features/check-placement/model/claude-link.ts
|
|
908
|
-
const RULE$
|
|
883
|
+
const RULE$59 = "claude-md-link";
|
|
909
884
|
const CLAUDE = "CLAUDE.md";
|
|
910
885
|
const AGENTS = "AGENTS.md";
|
|
911
886
|
const FIRST$19 = 1;
|
|
912
|
-
const READ_CONCURRENCY$
|
|
887
|
+
const READ_CONCURRENCY$31 = 16;
|
|
913
888
|
const MESSAGE$17 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
914
889
|
/** @internal */
|
|
915
890
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -924,20 +899,20 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
924
899
|
file: path,
|
|
925
900
|
line: FIRST$19,
|
|
926
901
|
column: FIRST$19,
|
|
927
|
-
rule: RULE$
|
|
902
|
+
rule: RULE$59,
|
|
928
903
|
message: MESSAGE$17
|
|
929
904
|
})));
|
|
930
905
|
});
|
|
931
906
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
932
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
907
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$31 });
|
|
933
908
|
return Array.getSomes(found);
|
|
934
909
|
});
|
|
935
910
|
// src/features/check-placement/model/dangling-links.ts
|
|
936
|
-
const RULE$
|
|
937
|
-
const SEPARATOR$
|
|
911
|
+
const RULE$58 = "dangling-link";
|
|
912
|
+
const SEPARATOR$21 = "/";
|
|
938
913
|
const FIRST$18 = 1;
|
|
939
|
-
const READ_CONCURRENCY$
|
|
940
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
914
|
+
const READ_CONCURRENCY$30 = 16;
|
|
915
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$21}`)(name);
|
|
941
916
|
/** @internal */
|
|
942
917
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
943
918
|
const files = yield* RepositoryFiles;
|
|
@@ -949,17 +924,17 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
949
924
|
file,
|
|
950
925
|
line: FIRST$18,
|
|
951
926
|
column: FIRST$18,
|
|
952
|
-
rule: RULE$
|
|
927
|
+
rule: RULE$58,
|
|
953
928
|
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.`
|
|
954
929
|
})));
|
|
955
930
|
});
|
|
956
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
931
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$30 });
|
|
957
932
|
return Array.getSomes(found);
|
|
958
933
|
});
|
|
959
934
|
// src/features/check-placement/model/member-sources.ts
|
|
960
935
|
const ROOT_WORKSPACE$1 = ".";
|
|
961
936
|
const FIRST$17 = 1;
|
|
962
|
-
const SEPARATOR$
|
|
937
|
+
const SEPARATOR$20 = "/";
|
|
963
938
|
const EXCLUDED$6 = [
|
|
964
939
|
":(exclude,attr:linguist-vendored)",
|
|
965
940
|
":(exclude,attr:linguist-generated)",
|
|
@@ -984,7 +959,7 @@ const fileProblem$1 = ({ file, rule, message }) => ({
|
|
|
984
959
|
rule,
|
|
985
960
|
message
|
|
986
961
|
});
|
|
987
|
-
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$
|
|
962
|
+
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$20}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
988
963
|
workspace,
|
|
989
964
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
990
965
|
})));
|
|
@@ -1007,9 +982,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
1007
982
|
}));
|
|
1008
983
|
});
|
|
1009
984
|
// src/features/check-placement/model/deployed-readme.ts
|
|
1010
|
-
const RULE$
|
|
985
|
+
const RULE$57 = "deployed-readme";
|
|
1011
986
|
const ROOT_DIRECTORY$4 = "";
|
|
1012
|
-
const READ_CONCURRENCY$
|
|
987
|
+
const READ_CONCURRENCY$29 = 16;
|
|
1013
988
|
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.";
|
|
1014
989
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
1015
990
|
const ADDRESS_KEYS = [
|
|
@@ -1047,14 +1022,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1047
1022
|
const readme = yield* readReadme({
|
|
1048
1023
|
root,
|
|
1049
1024
|
directory,
|
|
1050
|
-
rule: RULE$
|
|
1025
|
+
rule: RULE$57,
|
|
1051
1026
|
missingMessage: MISSING_MESSAGE$2
|
|
1052
1027
|
});
|
|
1053
1028
|
return Result.match(readme, {
|
|
1054
1029
|
onFailure: Option.some,
|
|
1055
1030
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
1056
1031
|
file,
|
|
1057
|
-
rule: RULE$
|
|
1032
|
+
rule: RULE$57,
|
|
1058
1033
|
message: NO_URL_MESSAGE
|
|
1059
1034
|
})))
|
|
1060
1035
|
});
|
|
@@ -1065,16 +1040,16 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
1065
1040
|
const listed = yield* files.listedFiles(root);
|
|
1066
1041
|
const directories = yield* workspaceDirectories(root);
|
|
1067
1042
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
1068
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
1043
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$29 });
|
|
1069
1044
|
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array.dedupe);
|
|
1070
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1045
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$29 });
|
|
1071
1046
|
return Array.getSomes(found);
|
|
1072
1047
|
});
|
|
1073
1048
|
// src/features/check-placement/model/nested-docs.ts
|
|
1074
|
-
const RULE$
|
|
1049
|
+
const RULE$56 = "nested-docs";
|
|
1075
1050
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
1076
|
-
const SEPARATOR$
|
|
1077
|
-
const READ_CONCURRENCY$
|
|
1051
|
+
const SEPARATOR$19 = "/";
|
|
1052
|
+
const READ_CONCURRENCY$28 = 64;
|
|
1078
1053
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1079
1054
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1080
1055
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
@@ -1083,8 +1058,8 @@ const MISSING_RULE = "workspace-agents-md";
|
|
|
1083
1058
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1084
1059
|
const taggedError$6 = Schema.TaggedError;
|
|
1085
1060
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1086
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1087
|
-
const problemFor$7 = problemInFile(RULE$
|
|
1061
|
+
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
1062
|
+
const problemFor$7 = problemInFile(RULE$56);
|
|
1088
1063
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1089
1064
|
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.";
|
|
1090
1065
|
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.";
|
|
@@ -1131,7 +1106,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1131
1106
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
1132
1107
|
workspaceAgentDocs
|
|
1133
1108
|
};
|
|
1134
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
1109
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$28 });
|
|
1135
1110
|
const missing = missingProblems({
|
|
1136
1111
|
required: workspaceAgentDocs,
|
|
1137
1112
|
directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
|
|
@@ -1141,15 +1116,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1141
1116
|
return [...Array.getSomes(found), ...missing];
|
|
1142
1117
|
});
|
|
1143
1118
|
// src/features/check-placement/model/published-readme.ts
|
|
1144
|
-
const RULE$
|
|
1145
|
-
const READ_CONCURRENCY$
|
|
1119
|
+
const RULE$55 = "published-readme";
|
|
1120
|
+
const READ_CONCURRENCY$27 = 16;
|
|
1146
1121
|
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1147
1122
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
1148
1123
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
1149
1124
|
const readme = yield* readReadme({
|
|
1150
1125
|
root,
|
|
1151
1126
|
directory,
|
|
1152
|
-
rule: RULE$
|
|
1127
|
+
rule: RULE$55,
|
|
1153
1128
|
missingMessage: MISSING_MESSAGE
|
|
1154
1129
|
});
|
|
1155
1130
|
return Result.match(readme, {
|
|
@@ -1160,7 +1135,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1160
1135
|
file,
|
|
1161
1136
|
line,
|
|
1162
1137
|
column,
|
|
1163
|
-
rule: RULE$
|
|
1138
|
+
rule: RULE$55,
|
|
1164
1139
|
message: MESSAGE$16
|
|
1165
1140
|
};
|
|
1166
1141
|
}))
|
|
@@ -1169,11 +1144,11 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1169
1144
|
/** @internal */
|
|
1170
1145
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
1171
1146
|
const projects = yield* publishedProjects(root);
|
|
1172
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$
|
|
1147
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$27 });
|
|
1173
1148
|
return Array.getSomes(found);
|
|
1174
1149
|
});
|
|
1175
1150
|
// src/features/check-placement/model/published-tests.ts
|
|
1176
|
-
const RULE$
|
|
1151
|
+
const RULE$54 = "published-tests";
|
|
1177
1152
|
const MANIFEST_FILE$2 = "package.json";
|
|
1178
1153
|
const FILE_START = 1;
|
|
1179
1154
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -1188,7 +1163,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1188
1163
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1189
1164
|
line: FILE_START,
|
|
1190
1165
|
column: FILE_START,
|
|
1191
|
-
rule: RULE$
|
|
1166
|
+
rule: RULE$54,
|
|
1192
1167
|
message: MESSAGE$15
|
|
1193
1168
|
});
|
|
1194
1169
|
});
|
|
@@ -1202,13 +1177,13 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1202
1177
|
return Array.getSomes(found);
|
|
1203
1178
|
});
|
|
1204
1179
|
// src/features/check-placement/model/root-docs.ts
|
|
1205
|
-
const RULE$
|
|
1206
|
-
const SEPARATOR$
|
|
1180
|
+
const RULE$53 = "root-docs";
|
|
1181
|
+
const SEPARATOR$18 = "/";
|
|
1207
1182
|
const FIRST$16 = 1;
|
|
1208
1183
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1209
1184
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1210
1185
|
const MESSAGE$14 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
1211
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
1186
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1212
1187
|
/** @internal */
|
|
1213
1188
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1214
1189
|
const files = yield* RepositoryFiles;
|
|
@@ -1217,18 +1192,18 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1217
1192
|
file: files.join(root, name),
|
|
1218
1193
|
line: FIRST$16,
|
|
1219
1194
|
column: FIRST$16,
|
|
1220
|
-
rule: RULE$
|
|
1195
|
+
rule: RULE$53,
|
|
1221
1196
|
message: `${name} ${MESSAGE$14}`
|
|
1222
1197
|
})));
|
|
1223
1198
|
});
|
|
1224
1199
|
// src/features/check-placement/model/root-readme.ts
|
|
1225
|
-
const RULE$
|
|
1200
|
+
const RULE$52 = "root-readme";
|
|
1226
1201
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1227
|
-
const READ_CONCURRENCY$
|
|
1228
|
-
const START$
|
|
1202
|
+
const READ_CONCURRENCY$26 = 16;
|
|
1203
|
+
const START$24 = 0;
|
|
1229
1204
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1230
1205
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1231
|
-
const RELATIVE$
|
|
1206
|
+
const RELATIVE$2 = /^\.\//u;
|
|
1232
1207
|
const MarketplacePlugin = Schema.Struct({
|
|
1233
1208
|
name: Schema.optional(Schema.String),
|
|
1234
1209
|
source: Schema.Unknown
|
|
@@ -1241,7 +1216,7 @@ const NO_PLUGINS = {
|
|
|
1241
1216
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1242
1217
|
const messageFor$1 = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1243
1218
|
const pluginsOf = (plugins) => {
|
|
1244
|
-
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$
|
|
1219
|
+
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$2, "")));
|
|
1245
1220
|
const segments = pipe(directories, Array.map(baseName));
|
|
1246
1221
|
return {
|
|
1247
1222
|
directories,
|
|
@@ -1262,17 +1237,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1262
1237
|
onNone: () => ownNames(plugins, names),
|
|
1263
1238
|
onSome: () => [directory]
|
|
1264
1239
|
}));
|
|
1265
|
-
const problemsIn$
|
|
1240
|
+
const problemsIn$19 = (file, source, plugins) => (workspace) => {
|
|
1266
1241
|
const message = messageFor$1(workspace.directory);
|
|
1267
1242
|
const at = positionOf(source);
|
|
1268
1243
|
const pattern = patternFor(plugins)(workspace);
|
|
1269
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1244
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$52)(file, at(found.index ?? START$24), message)));
|
|
1270
1245
|
};
|
|
1271
1246
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1272
1247
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1273
1248
|
return pipe(text, Option.match({
|
|
1274
1249
|
onNone: () => [],
|
|
1275
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1250
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$19(file, source, plugins)))
|
|
1276
1251
|
}));
|
|
1277
1252
|
});
|
|
1278
1253
|
/** @internal */
|
|
@@ -1283,7 +1258,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1283
1258
|
const named = yield* namedWorkspaces(root);
|
|
1284
1259
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1285
1260
|
const plugins = yield* marketplacePlugins(root);
|
|
1286
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
1261
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$26 });
|
|
1287
1262
|
return Array.flatten(found);
|
|
1288
1263
|
});
|
|
1289
1264
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -1303,10 +1278,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1303
1278
|
return Array.flatten(found);
|
|
1304
1279
|
});
|
|
1305
1280
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1306
|
-
const RULE$
|
|
1281
|
+
const RULE$51 = "docs-mirror";
|
|
1307
1282
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1308
1283
|
const MIRROR_LIMIT = 3;
|
|
1309
|
-
const READ_CONCURRENCY$
|
|
1284
|
+
const READ_CONCURRENCY$25 = 16;
|
|
1310
1285
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
1311
1286
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
1312
1287
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -1328,7 +1303,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
1328
1303
|
file,
|
|
1329
1304
|
line,
|
|
1330
1305
|
column,
|
|
1331
|
-
rule: RULE$
|
|
1306
|
+
rule: RULE$51,
|
|
1332
1307
|
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.`
|
|
1333
1308
|
};
|
|
1334
1309
|
}), Option.toArray);
|
|
@@ -1343,7 +1318,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
1343
1318
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
1344
1319
|
directory,
|
|
1345
1320
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
1346
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1321
|
+
}))), { concurrency: READ_CONCURRENCY$25 });
|
|
1347
1322
|
});
|
|
1348
1323
|
/** @internal */
|
|
1349
1324
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1356,11 +1331,11 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1356
1331
|
onNone: () => [],
|
|
1357
1332
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
1358
1333
|
})));
|
|
1359
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1334
|
+
}, { concurrency: READ_CONCURRENCY$25 });
|
|
1360
1335
|
return Array.flatten(found);
|
|
1361
1336
|
});
|
|
1362
1337
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1363
|
-
const RULE$
|
|
1338
|
+
const RULE$50 = "ignored-sources";
|
|
1364
1339
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1365
1340
|
const FIRST$15 = 1;
|
|
1366
1341
|
const MESSAGE$13 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
@@ -1372,7 +1347,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1372
1347
|
file: files.join(root, file),
|
|
1373
1348
|
line: FIRST$15,
|
|
1374
1349
|
column: FIRST$15,
|
|
1375
|
-
rule: RULE$
|
|
1350
|
+
rule: RULE$50,
|
|
1376
1351
|
message: MESSAGE$13
|
|
1377
1352
|
})));
|
|
1378
1353
|
});
|
|
@@ -9920,7 +9895,7 @@ var english_verbs_default = [
|
|
|
9920
9895
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
9921
9896
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
9922
9897
|
const SEGMENT_RULE = "slice-segment-name";
|
|
9923
|
-
const SEPARATOR$
|
|
9898
|
+
const SEPARATOR$16 = "/";
|
|
9924
9899
|
const NEXT$3 = 1;
|
|
9925
9900
|
const WORD_SEPARATOR$1 = "-";
|
|
9926
9901
|
const MINIMUM_WORDS = 2;
|
|
@@ -9946,7 +9921,7 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
9946
9921
|
return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
|
|
9947
9922
|
};
|
|
9948
9923
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
9949
|
-
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$
|
|
9924
|
+
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$16))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$16}${FEATURES$1}${slice}`));
|
|
9950
9925
|
const SLICE_LAYERS = [
|
|
9951
9926
|
"features",
|
|
9952
9927
|
"entities",
|
|
@@ -9954,26 +9929,26 @@ const SLICE_LAYERS = [
|
|
|
9954
9929
|
"pages"
|
|
9955
9930
|
];
|
|
9956
9931
|
const SLICE_DEPTHS = [3, 4];
|
|
9957
|
-
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$
|
|
9932
|
+
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$16);
|
|
9958
9933
|
const isInSliceLayer = (parts) => {
|
|
9959
9934
|
const [source, layer] = parts;
|
|
9960
|
-
return `${source}${SEPARATOR$
|
|
9935
|
+
return `${source}${SEPARATOR$16}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
|
|
9961
9936
|
};
|
|
9962
9937
|
const indexedSlice = (owned) => {
|
|
9963
|
-
const parts = String$1.split(owned.inner, SEPARATOR$
|
|
9938
|
+
const parts = String$1.split(owned.inner, SEPARATOR$16);
|
|
9964
9939
|
const depth = parts.length - NEXT$3;
|
|
9965
|
-
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$
|
|
9940
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$16}${pathPrefix(parts, depth)}`));
|
|
9966
9941
|
};
|
|
9967
9942
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
9968
|
-
const parts = String$1.split(inner, SEPARATOR$
|
|
9969
|
-
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$
|
|
9943
|
+
const parts = String$1.split(inner, SEPARATOR$16);
|
|
9944
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$16}${pathPrefix(parts, depth)}`);
|
|
9970
9945
|
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
9971
|
-
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$
|
|
9946
|
+
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$16}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
9972
9947
|
};
|
|
9973
9948
|
const deployNamed = ({ workspace, inner }) => {
|
|
9974
9949
|
if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
|
|
9975
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
9976
|
-
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$
|
|
9950
|
+
const segments = String$1.split(inner, SEPARATOR$16);
|
|
9951
|
+
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$16}${Array.join(Array.take(segments, index + NEXT$3), SEPARATOR$16)}`));
|
|
9977
9952
|
};
|
|
9978
9953
|
/** @internal */
|
|
9979
9954
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -10016,7 +9991,7 @@ const LAYER_ITEMS = [
|
|
|
10016
9991
|
"attribute_item",
|
|
10017
9992
|
"inner_attribute_item"
|
|
10018
9993
|
];
|
|
10019
|
-
const READ_CONCURRENCY$
|
|
9994
|
+
const READ_CONCURRENCY$24 = 64;
|
|
10020
9995
|
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
10021
9996
|
const NONE$1 = [];
|
|
10022
9997
|
const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
|
|
@@ -10092,17 +10067,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10092
10067
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$1;
|
|
10093
10068
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
10094
10069
|
const parse = parsedWith(language);
|
|
10095
|
-
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$
|
|
10070
|
+
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$24 });
|
|
10096
10071
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10097
10072
|
});
|
|
10098
10073
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10099
|
-
const RULE$
|
|
10074
|
+
const RULE$49 = "shadcn-ui-alias";
|
|
10100
10075
|
const FIRST$14 = 1;
|
|
10101
|
-
const problemOf$
|
|
10076
|
+
const problemOf$9 = (directory, { file, alias }) => ({
|
|
10102
10077
|
file,
|
|
10103
10078
|
line: FIRST$14,
|
|
10104
10079
|
column: FIRST$14,
|
|
10105
|
-
rule: RULE$
|
|
10080
|
+
rule: RULE$49,
|
|
10106
10081
|
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/*".`
|
|
10107
10082
|
});
|
|
10108
10083
|
/** @internal */
|
|
@@ -10114,7 +10089,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
|
|
|
10114
10089
|
onNone: () => Effect.succeed(false),
|
|
10115
10090
|
onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
|
|
10116
10091
|
})) return Array.empty();
|
|
10117
|
-
return [problemOf$
|
|
10092
|
+
return [problemOf$9(directory, found.value)];
|
|
10118
10093
|
});
|
|
10119
10094
|
// src/features/check-placement/model/source-aliases.ts
|
|
10120
10095
|
const ALIAS_RULE = "source-alias";
|
|
@@ -10122,8 +10097,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
10122
10097
|
const SOURCE_TARGET = "./src/*";
|
|
10123
10098
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10124
10099
|
const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
|
|
10125
|
-
const Manifest$
|
|
10126
|
-
const decodeManifest$
|
|
10100
|
+
const Manifest$6 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10101
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
10127
10102
|
const targetsOf = (target) => {
|
|
10128
10103
|
if (Predicate.isString(target)) return [target];
|
|
10129
10104
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10134,7 +10109,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10134
10109
|
const files = yield* RepositoryFiles;
|
|
10135
10110
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10136
10111
|
const text = yield* files.readFile(manifest);
|
|
10137
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10112
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
|
|
10138
10113
|
});
|
|
10139
10114
|
/** @internal */
|
|
10140
10115
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10165,19 +10140,19 @@ const SCRIPTS = "scripts-directory";
|
|
|
10165
10140
|
const BIN = "bin";
|
|
10166
10141
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
10167
10142
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
10168
|
-
const SEPARATOR$
|
|
10143
|
+
const SEPARATOR$15 = "/";
|
|
10169
10144
|
const CURRENT = "./";
|
|
10170
|
-
const READ_CONCURRENCY$
|
|
10145
|
+
const READ_CONCURRENCY$23 = 8;
|
|
10171
10146
|
const FIRST$13 = 1;
|
|
10172
10147
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
10173
10148
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
10174
10149
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
10175
|
-
const Manifest$
|
|
10150
|
+
const Manifest$5 = Schema.Struct({
|
|
10176
10151
|
bin: Schema.optional(Schema.Unknown),
|
|
10177
10152
|
main: Schema.optional(Schema.Unknown),
|
|
10178
10153
|
exports: Schema.optional(Schema.Unknown)
|
|
10179
10154
|
});
|
|
10180
|
-
const decodeManifest$
|
|
10155
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
10181
10156
|
const NO_ENTRIES = {
|
|
10182
10157
|
all: [],
|
|
10183
10158
|
bins: []
|
|
@@ -10202,22 +10177,22 @@ const entriesOf$2 = (manifest) => {
|
|
|
10202
10177
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10203
10178
|
const files = yield* RepositoryFiles;
|
|
10204
10179
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10205
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10180
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10206
10181
|
});
|
|
10207
10182
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10208
10183
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
10209
10184
|
const files = yield* RepositoryFiles;
|
|
10210
10185
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
10211
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
10186
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$15}${name}`), Array.filter(isCommand$1));
|
|
10212
10187
|
});
|
|
10213
10188
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
10214
10189
|
const files = yield* RepositoryFiles;
|
|
10215
10190
|
const listed = yield* files.listedFiles(root);
|
|
10216
10191
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
10217
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
10192
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$23 });
|
|
10218
10193
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
10219
10194
|
});
|
|
10220
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
10195
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$15));
|
|
10221
10196
|
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND$1.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
10222
10197
|
file,
|
|
10223
10198
|
...positionOf(source)(start),
|
|
@@ -10225,7 +10200,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10225
10200
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
10226
10201
|
})));
|
|
10227
10202
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10228
|
-
const problemsIn$
|
|
10203
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10229
10204
|
const files = yield* RepositoryFiles;
|
|
10230
10205
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10231
10206
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10264,26 +10239,199 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10264
10239
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10265
10240
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10266
10241
|
const workflows = yield* workflowText(root);
|
|
10267
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10268
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10242
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$18(root, directory, workflows), { concurrency: READ_CONCURRENCY$23 });
|
|
10243
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$23 });
|
|
10269
10244
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10270
10245
|
});
|
|
10246
|
+
// src/features/check-repository-layout/model/path-mention.ts
|
|
10247
|
+
const START$23 = 0;
|
|
10248
|
+
const QUOTES = ["\"", "'"];
|
|
10249
|
+
const firstIndex = (source, needles) => {
|
|
10250
|
+
const found = pipe(needles, Array.flatMap((needle) => Option.toArray(String$1.indexOf(needle)(source))));
|
|
10251
|
+
return Array.head(Array.sort(found, Order.Number));
|
|
10252
|
+
};
|
|
10253
|
+
const quoted$1 = (text) => pipe(QUOTES, Array.map((quote) => `${quote}${text}${quote}`));
|
|
10254
|
+
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted$1(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$23));
|
|
10255
|
+
// src/features/check-repository-layout/model/cargo-paths.ts
|
|
10256
|
+
const MEMBER_LISTS = [
|
|
10257
|
+
"members",
|
|
10258
|
+
"exclude",
|
|
10259
|
+
"default-members"
|
|
10260
|
+
];
|
|
10261
|
+
const DEPENDENCY_TABLES = [
|
|
10262
|
+
"dependencies",
|
|
10263
|
+
"dev-dependencies",
|
|
10264
|
+
"build-dependencies"
|
|
10265
|
+
];
|
|
10266
|
+
const WORKSPACE = "workspace";
|
|
10267
|
+
const PATCH = "patch";
|
|
10268
|
+
const PATCH_DEPTH = 2;
|
|
10269
|
+
const WORKSPACE_DEPTH = 1;
|
|
10270
|
+
const START$22 = 0;
|
|
10271
|
+
const WILDCARD$5 = /[*?[]/u;
|
|
10272
|
+
const KEY_SEPARATOR = ".";
|
|
10273
|
+
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
10274
|
+
const decodeStrings$1 = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
10275
|
+
const decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));
|
|
10276
|
+
const declaresPath = (trail) => pipe(Array.last(trail), Option.exists((name) => Array.contains(DEPENDENCY_TABLES, name))) || trail.length === PATCH_DEPTH && Array.get(trail, START$22).pipe(Option.exists((name) => name === PATCH));
|
|
10277
|
+
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array.get(trail, START$22).pipe(Option.exists((name) => name === WORKSPACE)) && Array.contains(MEMBER_LISTS, key);
|
|
10278
|
+
const namedPaths = (trail, key, value) => {
|
|
10279
|
+
const field = Array.join([...trail, key], KEY_SEPARATOR);
|
|
10280
|
+
if (listsMembers(trail, key)) return pipe(decodeStrings$1(value), Option.getOrElse(() => []), Array.filter((member) => !WILDCARD$5.test(member)), Array.map((member) => ({
|
|
10281
|
+
field,
|
|
10282
|
+
target: member
|
|
10283
|
+
})));
|
|
10284
|
+
if (declaresPath(trail)) return pipe(decodePath(value), Option.toArray, Array.map(({ path }) => ({
|
|
10285
|
+
field: `${field}${KEY_SEPARATOR}path`,
|
|
10286
|
+
target: path
|
|
10287
|
+
})));
|
|
10288
|
+
return [];
|
|
10289
|
+
};
|
|
10290
|
+
const pathsIn = (trail) => (value) => pipe(decodeTable(value), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.flatMap(([key, child]) => [...namedPaths(trail, key, child), ...pathsIn([...trail, key])(child)]));
|
|
10291
|
+
/** @internal */
|
|
10292
|
+
const cargoMentions = (source) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(source)))(), Option.toArray, Array.flatMap(pathsIn([])), Array.filter(({ target }) => String$1.isNonEmpty(target)), Array.map(({ field, target }) => ({
|
|
10293
|
+
field,
|
|
10294
|
+
text: target,
|
|
10295
|
+
candidates: [target],
|
|
10296
|
+
index: indexOfText(source)(target)
|
|
10297
|
+
})));
|
|
10298
|
+
// src/features/check-repository-layout/model/path-existence.ts
|
|
10299
|
+
const WILDCARD$4 = /[*?[]/u;
|
|
10300
|
+
const SEPARATOR$14 = "/";
|
|
10301
|
+
const FIRST$12 = 0;
|
|
10302
|
+
/** @internal */
|
|
10303
|
+
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
10304
|
+
const files = yield* RepositoryFiles;
|
|
10305
|
+
return yield* files.exists(files.join(root, path));
|
|
10306
|
+
});
|
|
10307
|
+
/** @internal */
|
|
10308
|
+
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
10309
|
+
const files = yield* RepositoryFiles;
|
|
10310
|
+
const directory = yield* files.isDirectory(files.join(root, path));
|
|
10311
|
+
return Option.getOrElse(directory, () => false);
|
|
10312
|
+
});
|
|
10313
|
+
/** @internal */
|
|
10314
|
+
const staticPrefix = (path) => {
|
|
10315
|
+
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$4));
|
|
10316
|
+
if (String$1.endsWith(SEPARATOR$14)(prefix)) return String$1.slice(FIRST$12, -1)(prefix);
|
|
10317
|
+
return prefix;
|
|
10318
|
+
};
|
|
10319
|
+
/** @internal */
|
|
10320
|
+
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
10321
|
+
const prefix = staticPrefix(path);
|
|
10322
|
+
if (String$1.isEmpty(prefix)) return false;
|
|
10323
|
+
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR$14}`]);
|
|
10324
|
+
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10325
|
+
});
|
|
10326
|
+
// src/features/check-repository-layout/model/tsconfig-paths.ts
|
|
10327
|
+
const WRAP_OFFSET$2 = 1;
|
|
10328
|
+
const WILDCARD$3 = /[*?[{]/u;
|
|
10329
|
+
const SEPARATOR$13 = "/";
|
|
10330
|
+
const RELATIVE$1 = ".";
|
|
10331
|
+
const JSON_EXTENSION = ".json";
|
|
10332
|
+
const isObject = (node) => Predicate.isReadonlyObject(node) && node["type"] === "ObjectExpression";
|
|
10333
|
+
const firstObject = (node) => {
|
|
10334
|
+
if (isObject(node)) return Option.some(node);
|
|
10335
|
+
return pipe(childrenOf$1(node), Array.findFirst(firstObject));
|
|
10336
|
+
};
|
|
10337
|
+
const leadingDirectory = (pattern) => pipe(String$1.split(pattern, SEPARATOR$13), Array.takeWhile((segment) => !WILDCARD$3.test(segment)), Array.join(SEPARATOR$13));
|
|
10338
|
+
const listed$2 = (root) => (name, candidatesOf, valuesOf = stringsIn) => pipe(propertyValue(name)(root), Option.toArray, Array.flatMap(valuesOf), Array.map(({ text, start }) => ({
|
|
10339
|
+
field: name,
|
|
10340
|
+
text,
|
|
10341
|
+
candidates: candidatesOf(text),
|
|
10342
|
+
index: start - WRAP_OFFSET$2
|
|
10343
|
+
})), Array.filter(({ candidates }) => Array.isReadonlyArrayNonEmpty(candidates)));
|
|
10344
|
+
const objectsIn = (node) => [...Array.filter([node], isObject), ...pipe(childrenOf$1(node), Array.flatMap(objectsIn))];
|
|
10345
|
+
const referencedPaths = (references) => pipe(objectsIn(references), Array.flatMap((reference) => Option.toArray(propertyValue("path")(reference))), Array.flatMap(stringsIn));
|
|
10346
|
+
const exactly = (text) => [text];
|
|
10347
|
+
const relativeConfig = (text) => {
|
|
10348
|
+
if (String$1.startsWith(RELATIVE$1)(text)) return [text, `${text}${JSON_EXTENSION}`];
|
|
10349
|
+
return [];
|
|
10350
|
+
};
|
|
10351
|
+
const patternRoot = (text) => pipe([leadingDirectory(text)], Array.filter(String$1.isNonEmpty));
|
|
10352
|
+
/** @internal */
|
|
10353
|
+
const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMentions(file, source) {
|
|
10354
|
+
const program = (yield* Effect.promise(() => parse(`${file}.ts`, `(${source})`, { lang: "ts" }))).program;
|
|
10355
|
+
const root = firstObject(program);
|
|
10356
|
+
return pipe(root, Option.toArray, Array.flatMap((object) => Array.flatten([
|
|
10357
|
+
listed$2(object)("references", exactly, referencedPaths),
|
|
10358
|
+
listed$2(object)("extends", relativeConfig),
|
|
10359
|
+
listed$2(object)("files", exactly),
|
|
10360
|
+
listed$2(object)("include", patternRoot)
|
|
10361
|
+
])));
|
|
10362
|
+
});
|
|
10363
|
+
// src/features/check-repository-layout/model/config-paths.ts
|
|
10364
|
+
const RULE$48 = "config-path";
|
|
10365
|
+
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
10366
|
+
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
10367
|
+
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
10368
|
+
const OUTSIDE = "..";
|
|
10369
|
+
const READ_CONCURRENCY$22 = 8;
|
|
10370
|
+
const isMissing$2 = Effect.fn("isMissing")(function* isMissing(root, file, mention) {
|
|
10371
|
+
const files = yield* RepositoryFiles;
|
|
10372
|
+
const relatives = pipe(mention.candidates, Array.map((candidate) => files.relative(root, files.resolve(files.dirname(file), candidate))), Array.filter((relative) => !String$1.startsWith(OUTSIDE)(relative)));
|
|
10373
|
+
if (!Array.isReadonlyArrayNonEmpty(relatives)) return false;
|
|
10374
|
+
const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), { concurrency: READ_CONCURRENCY$22 });
|
|
10375
|
+
if (pipe(present, Array.some(Boolean))) return false;
|
|
10376
|
+
const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), { concurrency: READ_CONCURRENCY$22 });
|
|
10377
|
+
return !pipe(ignored, Array.some(Boolean));
|
|
10378
|
+
});
|
|
10379
|
+
const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
10380
|
+
const problemOf$8 = (file, source) => (mention) => ({
|
|
10381
|
+
file,
|
|
10382
|
+
...positionOf(source)(mention.index),
|
|
10383
|
+
rule: RULE$48,
|
|
10384
|
+
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
10385
|
+
});
|
|
10386
|
+
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
10387
|
+
if (CARGO_MANIFEST.test(file)) return cargoMentions(source);
|
|
10388
|
+
return yield* tsconfigMentions(file, source);
|
|
10389
|
+
});
|
|
10390
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, name) {
|
|
10391
|
+
const files = yield* RepositoryFiles;
|
|
10392
|
+
const file = files.join(root, name);
|
|
10393
|
+
const source = yield* files.readFile(file);
|
|
10394
|
+
if (Option.isNone(source)) return [];
|
|
10395
|
+
const mentions = yield* mentionsIn(file, source.value);
|
|
10396
|
+
const missing = yield* Effect.filter(mentions, (mention) => isMissing$2(root, file, mention), { concurrency: READ_CONCURRENCY$22 });
|
|
10397
|
+
return pipe(Array.sort(missing, byIndex), Array.map(problemOf$8(file, source.value)));
|
|
10398
|
+
});
|
|
10399
|
+
const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatterns(root) {
|
|
10400
|
+
const files = yield* RepositoryFiles;
|
|
10401
|
+
const file = files.join(root, WORKSPACE_FILE$4);
|
|
10402
|
+
const source = yield* files.readFile(file);
|
|
10403
|
+
if (Option.isNone(source)) return [];
|
|
10404
|
+
const patterns = yield* unmatchedWorkspacePatterns(root);
|
|
10405
|
+
return pipe(patterns, Array.map((pattern) => ({
|
|
10406
|
+
file,
|
|
10407
|
+
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
10408
|
+
rule: RULE$48,
|
|
10409
|
+
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
10410
|
+
})));
|
|
10411
|
+
});
|
|
10412
|
+
/** @internal */
|
|
10413
|
+
const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPaths(root) {
|
|
10414
|
+
const owned = yield* (yield* RepositoryFiles).ownedFiles(root);
|
|
10415
|
+
const configs = pipe(owned, Array.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)));
|
|
10416
|
+
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$17(root, name), { concurrency: READ_CONCURRENCY$22 }), unmatchedPatterns(root)], { concurrency: "unbounded" });
|
|
10417
|
+
return [...Array.flatten(found), ...patterns];
|
|
10418
|
+
});
|
|
10271
10419
|
// src/features/check-repository-layout/model/crates.ts
|
|
10272
|
-
const RULE$
|
|
10420
|
+
const RULE$47 = "unverified-crate";
|
|
10273
10421
|
const VERSION_RULE = "release-version";
|
|
10274
10422
|
const MANIFEST_FILE$1 = "package.json";
|
|
10275
10423
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10276
10424
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
10277
10425
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10278
10426
|
const SEPARATOR$12 = "/";
|
|
10279
|
-
const FIRST$
|
|
10280
|
-
const READ_CONCURRENCY$
|
|
10427
|
+
const FIRST$11 = 1;
|
|
10428
|
+
const READ_CONCURRENCY$21 = 8;
|
|
10281
10429
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10282
10430
|
const problemFor$4 = (crate, message) => ({
|
|
10283
10431
|
file: crate.manifest,
|
|
10284
|
-
line: FIRST$
|
|
10285
|
-
column: FIRST$
|
|
10286
|
-
rule: RULE$
|
|
10432
|
+
line: FIRST$11,
|
|
10433
|
+
column: FIRST$11,
|
|
10434
|
+
rule: RULE$47,
|
|
10287
10435
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10288
10436
|
});
|
|
10289
10437
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10303,8 +10451,8 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
10303
10451
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
10304
10452
|
return Option.some({
|
|
10305
10453
|
file: crate.manifest,
|
|
10306
|
-
line: FIRST$
|
|
10307
|
-
column: FIRST$
|
|
10454
|
+
line: FIRST$11,
|
|
10455
|
+
column: FIRST$11,
|
|
10308
10456
|
rule: VERSION_RULE,
|
|
10309
10457
|
message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE$1} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
|
|
10310
10458
|
});
|
|
@@ -10315,11 +10463,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10315
10463
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10316
10464
|
const directories = yield* workspaceDirectories(root);
|
|
10317
10465
|
const crates = yield* cratesIn(root);
|
|
10318
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10466
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$21 });
|
|
10319
10467
|
return Array.getSomes(Array.flatten(found));
|
|
10320
10468
|
});
|
|
10321
10469
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10322
|
-
const RULE$
|
|
10470
|
+
const RULE$46 = "deploy-entry-pattern";
|
|
10323
10471
|
const FALLOW_KEYS = [
|
|
10324
10472
|
"entry",
|
|
10325
10473
|
"entryPoints",
|
|
@@ -10337,7 +10485,7 @@ const NEGATED = "!";
|
|
|
10337
10485
|
const ROOT_WORKSPACE = ".";
|
|
10338
10486
|
const WRAP_OFFSET$1 = 1;
|
|
10339
10487
|
const NO_OFFSET = 0;
|
|
10340
|
-
const READ_CONCURRENCY$
|
|
10488
|
+
const READ_CONCURRENCY$20 = 8;
|
|
10341
10489
|
const MESSAGE$12 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10342
10490
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10343
10491
|
const FALLOW = {
|
|
@@ -10390,7 +10538,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10390
10538
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10391
10539
|
file: path,
|
|
10392
10540
|
...positionOf(text.value)(start - kind.offset),
|
|
10393
|
-
rule: RULE$
|
|
10541
|
+
rule: RULE$46,
|
|
10394
10542
|
message: `${pattern} ${MESSAGE$12}`
|
|
10395
10543
|
})));
|
|
10396
10544
|
});
|
|
@@ -10419,21 +10567,21 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10419
10567
|
kind,
|
|
10420
10568
|
workspaces,
|
|
10421
10569
|
entries
|
|
10422
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10570
|
+
}), { concurrency: READ_CONCURRENCY$20 });
|
|
10423
10571
|
return Array.flatten(found);
|
|
10424
10572
|
});
|
|
10425
10573
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10426
|
-
const RULE$
|
|
10574
|
+
const RULE$45 = "listed-entry";
|
|
10427
10575
|
const ENTRY_KEYS = [
|
|
10428
10576
|
"entry",
|
|
10429
10577
|
"entryPoints",
|
|
10430
10578
|
"supportEntry"
|
|
10431
10579
|
];
|
|
10432
10580
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
10433
|
-
const WILDCARD$
|
|
10581
|
+
const WILDCARD$2 = /[*?{[]/u;
|
|
10434
10582
|
const SEPARATOR$11 = "/";
|
|
10435
10583
|
const WRAP_OFFSET = 1;
|
|
10436
|
-
const READ_CONCURRENCY$
|
|
10584
|
+
const READ_CONCURRENCY$19 = 8;
|
|
10437
10585
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10438
10586
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10439
10587
|
const entryPatternsIn = (node) => {
|
|
@@ -10443,7 +10591,7 @@ const entryPatternsIn = (node) => {
|
|
|
10443
10591
|
})));
|
|
10444
10592
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10445
10593
|
};
|
|
10446
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$
|
|
10594
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$2.test(text);
|
|
10447
10595
|
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10448
10596
|
const files = yield* RepositoryFiles;
|
|
10449
10597
|
const path = files.join(root, file);
|
|
@@ -10453,7 +10601,7 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10453
10601
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10454
10602
|
file: path,
|
|
10455
10603
|
...positionOf(text.value)(start),
|
|
10456
|
-
rule: RULE$
|
|
10604
|
+
rule: RULE$45,
|
|
10457
10605
|
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.`
|
|
10458
10606
|
})));
|
|
10459
10607
|
});
|
|
@@ -10461,15 +10609,15 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10461
10609
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10462
10610
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10463
10611
|
const directories = yield* workspaceDirectories(root);
|
|
10464
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$15(root, file, directories), { concurrency: READ_CONCURRENCY$
|
|
10612
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$15(root, file, directories), { concurrency: READ_CONCURRENCY$19 });
|
|
10465
10613
|
return Array.flatten(found);
|
|
10466
10614
|
});
|
|
10467
10615
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10468
|
-
const RULE$
|
|
10616
|
+
const RULE$44 = "root-workspace-path";
|
|
10469
10617
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10470
10618
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10471
10619
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10472
|
-
const FIRST$
|
|
10620
|
+
const FIRST$10 = 0;
|
|
10473
10621
|
const NEXT$2 = 1;
|
|
10474
10622
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10475
10623
|
const mentions = (directory) => (text) => {
|
|
@@ -10477,14 +10625,14 @@ const mentions = (directory) => (text) => {
|
|
|
10477
10625
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10478
10626
|
const before = parts[index] ?? "";
|
|
10479
10627
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10480
|
-
const following = String$1.slice(FIRST$
|
|
10628
|
+
const following = String$1.slice(FIRST$10, NEXT$2)(after);
|
|
10481
10629
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10482
10630
|
}));
|
|
10483
10631
|
};
|
|
10484
10632
|
const problemsIn$14 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10485
10633
|
file,
|
|
10486
10634
|
...positionOf(source)(found.start),
|
|
10487
|
-
rule: RULE$
|
|
10635
|
+
rule: RULE$44,
|
|
10488
10636
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
10489
10637
|
})));
|
|
10490
10638
|
/** @internal */
|
|
@@ -10498,10 +10646,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10498
10646
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$14(file, source.value, directories)));
|
|
10499
10647
|
});
|
|
10500
10648
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10501
|
-
const RULE$
|
|
10649
|
+
const RULE$43 = "hidden-verify";
|
|
10502
10650
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10503
|
-
const FIRST$
|
|
10504
|
-
const READ_CONCURRENCY$
|
|
10651
|
+
const FIRST$9 = 1;
|
|
10652
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10505
10653
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10506
10654
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10507
10655
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10510,21 +10658,21 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10510
10658
|
const verified = yield* hasVerifyTask(file);
|
|
10511
10659
|
return Option.some({
|
|
10512
10660
|
file,
|
|
10513
|
-
line: FIRST$
|
|
10514
|
-
column: FIRST$
|
|
10515
|
-
rule: RULE$
|
|
10661
|
+
line: FIRST$9,
|
|
10662
|
+
column: FIRST$9,
|
|
10663
|
+
rule: RULE$43,
|
|
10516
10664
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
10517
10665
|
}).pipe(Option.filter(() => verified));
|
|
10518
10666
|
});
|
|
10519
10667
|
/** @internal */
|
|
10520
10668
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10521
10669
|
const directories = yield* workspaceDirectories(root);
|
|
10522
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10670
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$18 });
|
|
10523
10671
|
return Array.getSomes(found);
|
|
10524
10672
|
});
|
|
10525
10673
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10526
|
-
const RULE$
|
|
10527
|
-
const READ_CONCURRENCY$
|
|
10674
|
+
const RULE$42 = "shared-uncached-task";
|
|
10675
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10528
10676
|
const SHARED = 2;
|
|
10529
10677
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10530
10678
|
const UncachedTask = Schema.Struct({
|
|
@@ -10566,19 +10714,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10566
10714
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10567
10715
|
file,
|
|
10568
10716
|
...position,
|
|
10569
|
-
rule: RULE$
|
|
10717
|
+
rule: RULE$42,
|
|
10570
10718
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
|
|
10571
10719
|
})));
|
|
10572
10720
|
};
|
|
10573
10721
|
/** @internal */
|
|
10574
10722
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10575
10723
|
const directories = yield* workspaceDirectories(root);
|
|
10576
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10724
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$17 });
|
|
10577
10725
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10578
10726
|
});
|
|
10579
10727
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10580
|
-
const RULE$
|
|
10581
|
-
const READ_CONCURRENCY$
|
|
10728
|
+
const RULE$41 = "unlocked-task";
|
|
10729
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10582
10730
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10583
10731
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10584
10732
|
const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array.findFirst(Array.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
|
|
@@ -10589,13 +10737,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10589
10737
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10590
10738
|
file,
|
|
10591
10739
|
...positionOf(source)(task.start),
|
|
10592
|
-
rule: RULE$
|
|
10740
|
+
rule: RULE$41,
|
|
10593
10741
|
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.`
|
|
10594
10742
|
})), Option.toArray)));
|
|
10595
10743
|
/** @internal */
|
|
10596
10744
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10597
10745
|
const directories = yield* workspaceDirectories(root);
|
|
10598
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10746
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10599
10747
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10600
10748
|
});
|
|
10601
10749
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10686,7 +10834,7 @@ const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
|
|
|
10686
10834
|
const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
|
|
10687
10835
|
const globsIn = (field, node) => pipe(itemsOf(node), Array.flatMap((item) => Option.toArray(stringOf(item))), Array.filter(isPositive), Array.flatMap(reference("glob", field)));
|
|
10688
10836
|
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
10689
|
-
const directoryOf$
|
|
10837
|
+
const directoryOf$2 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$2, text)), Option.getOrElse(() => base));
|
|
10690
10838
|
const located = (kind, field, base = ROOT$2) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
|
|
10691
10839
|
const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL$1)(text)));
|
|
10692
10840
|
const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(text, TOKEN_SEPARATOR), Array.filter((token) => SCRIPT.test(token)), Array.dedupe, Array.flatMap((token) => reference("script", field, base)({
|
|
@@ -10703,7 +10851,7 @@ const fileInputsIn = (field, step) => pipe(entriesOf$1(childOf("with")(step)), A
|
|
|
10703
10851
|
const stepReferences = (job, base) => (step, index) => {
|
|
10704
10852
|
const field = `jobs.${job}.steps[${index}]`;
|
|
10705
10853
|
const own = stringOf(childOf("working-directory")(step));
|
|
10706
|
-
const directory = directoryOf$
|
|
10854
|
+
const directory = directoryOf$2(own, base);
|
|
10707
10855
|
return [
|
|
10708
10856
|
...located("action", `${field}.uses`)(localUses(step)),
|
|
10709
10857
|
...located("directory", `${field}.working-directory`)(own),
|
|
@@ -10714,7 +10862,7 @@ const stepReferences = (job, base) => (step, index) => {
|
|
|
10714
10862
|
const jobReferences = (base) => ([job, node]) => {
|
|
10715
10863
|
const own = workingDirectoryOf(node);
|
|
10716
10864
|
const steps = itemsOf(childOf("steps")(node));
|
|
10717
|
-
const directory = directoryOf$
|
|
10865
|
+
const directory = directoryOf$2(own, base);
|
|
10718
10866
|
return [
|
|
10719
10867
|
...located("file", `jobs.${job}.uses`)(localUses(node)),
|
|
10720
10868
|
...located("directory", `jobs.${job}.defaults.run.working-directory`)(own),
|
|
@@ -10731,7 +10879,7 @@ const jobsOf = (source) => entriesOf$1(childOf("jobs")(parseDocument(source).con
|
|
|
10731
10879
|
const workflowReferences = (source) => {
|
|
10732
10880
|
const root = parseDocument(source).contents;
|
|
10733
10881
|
const workflowDefault = workingDirectoryOf(root);
|
|
10734
|
-
const base = directoryOf$
|
|
10882
|
+
const base = directoryOf$2(workflowDefault, ROOT$2);
|
|
10735
10883
|
return [
|
|
10736
10884
|
...pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(filtersOf)),
|
|
10737
10885
|
...located("directory", "defaults.run.working-directory")(workflowDefault),
|
|
@@ -10744,13 +10892,11 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10744
10892
|
/** @internal */
|
|
10745
10893
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10746
10894
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10747
|
-
const RULE$
|
|
10895
|
+
const RULE$40 = "workflow-path";
|
|
10748
10896
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10749
10897
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10750
|
-
const READ_CONCURRENCY$
|
|
10751
|
-
const WILDCARD$2 = /[*?[]/u;
|
|
10898
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10752
10899
|
const SEPARATOR$9 = "/";
|
|
10753
|
-
const FIRST$9 = 0;
|
|
10754
10900
|
const EXPECTED = {
|
|
10755
10901
|
action: "a directory with action.yml",
|
|
10756
10902
|
directory: "a directory",
|
|
@@ -10763,16 +10909,7 @@ const matchesAny = Effect.fn("matchesAny")(function* matchesAny(root, pathspecs)
|
|
|
10763
10909
|
const matched = yield* (yield* RepositoryFiles).matchingFiles(root, pathspecs);
|
|
10764
10910
|
return Array.isReadonlyArrayNonEmpty(matched);
|
|
10765
10911
|
});
|
|
10766
|
-
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
10767
|
-
const files = yield* RepositoryFiles;
|
|
10768
|
-
return yield* files.exists(files.join(root, path));
|
|
10769
|
-
});
|
|
10770
10912
|
const matchesGlob = (root, path) => matchesAny(root, [`:(glob)${path}`]);
|
|
10771
|
-
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
10772
|
-
const files = yield* RepositoryFiles;
|
|
10773
|
-
const directory = yield* files.isDirectory(files.join(root, path));
|
|
10774
|
-
return Option.getOrElse(directory, () => false);
|
|
10775
|
-
});
|
|
10776
10913
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
10777
10914
|
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$9}${name}`), { concurrency: 1 });
|
|
10778
10915
|
return pipe(found, Array.some(Boolean));
|
|
@@ -10789,17 +10926,6 @@ const RESOLVERS = {
|
|
|
10789
10926
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
10790
10927
|
})
|
|
10791
10928
|
};
|
|
10792
|
-
const staticPrefix = (path) => {
|
|
10793
|
-
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10794
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
|
|
10795
|
-
return prefix;
|
|
10796
|
-
};
|
|
10797
|
-
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
10798
|
-
const prefix = staticPrefix(path);
|
|
10799
|
-
if (String$1.isEmpty(prefix)) return false;
|
|
10800
|
-
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
10801
|
-
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10802
|
-
});
|
|
10803
10929
|
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$9}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$9}`)(path);
|
|
10804
10930
|
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
10805
10931
|
const prefix = staticPrefix(found.path);
|
|
@@ -10810,7 +10936,7 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10810
10936
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10811
10937
|
file,
|
|
10812
10938
|
...positionOf(source)(found.offset),
|
|
10813
|
-
rule: RULE$
|
|
10939
|
+
rule: RULE$40,
|
|
10814
10940
|
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.`
|
|
10815
10941
|
});
|
|
10816
10942
|
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -10825,7 +10951,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10825
10951
|
/** @internal */
|
|
10826
10952
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10827
10953
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10828
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$
|
|
10954
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$15 });
|
|
10829
10955
|
return Array.flatten(found);
|
|
10830
10956
|
});
|
|
10831
10957
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10837,7 +10963,7 @@ const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
|
10837
10963
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10838
10964
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10839
10965
|
const START$21 = 0;
|
|
10840
|
-
const READ_CONCURRENCY$
|
|
10966
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10841
10967
|
const SEPARATOR$8 = "/";
|
|
10842
10968
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10843
10969
|
const SPACE = " ";
|
|
@@ -10916,7 +11042,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10916
11042
|
name: stem,
|
|
10917
11043
|
source: text
|
|
10918
11044
|
})]), Option.getOrElse(() => []));
|
|
10919
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
11045
|
+
}), { concurrency: READ_CONCURRENCY$14 });
|
|
10920
11046
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf("name")(ACTION.exec(name)), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10921
11047
|
return [...Array.flatten(found), ...actions];
|
|
10922
11048
|
});
|
|
@@ -10925,6 +11051,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10925
11051
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
10926
11052
|
const found = yield* Effect.all([
|
|
10927
11053
|
checkCommandEntries(root),
|
|
11054
|
+
checkConfigPaths(root),
|
|
10928
11055
|
checkCrates(root),
|
|
10929
11056
|
checkDeployEntryPatterns(root),
|
|
10930
11057
|
checkFallowEntries(root),
|
|
@@ -11046,14 +11173,14 @@ const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(a
|
|
|
11046
11173
|
const EMPTY$1 = 0;
|
|
11047
11174
|
const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
|
|
11048
11175
|
const PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
|
|
11049
|
-
const PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
|
|
11176
|
+
const PeerMeta$1 = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
|
|
11050
11177
|
const InstalledManifest = Schema.Struct({
|
|
11051
11178
|
dependencies: DependencyMap,
|
|
11052
11179
|
optionalDependencies: DependencyMap,
|
|
11053
11180
|
peerDependencies: DependencyMap,
|
|
11054
|
-
peerDependenciesMeta: PeerMeta
|
|
11181
|
+
peerDependenciesMeta: PeerMeta$1
|
|
11055
11182
|
});
|
|
11056
|
-
const decodeManifest$
|
|
11183
|
+
const decodeManifest$5 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11057
11184
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11058
11185
|
const installedNames = (manifest) => [
|
|
11059
11186
|
...keysOf(manifest.dependencies),
|
|
@@ -11063,7 +11190,7 @@ const installedNames = (manifest) => [
|
|
|
11063
11190
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11064
11191
|
const files = yield* RepositoryFiles;
|
|
11065
11192
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11066
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11193
|
+
return pipe(text, Option.flatMap(decodeManifest$5), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11067
11194
|
});
|
|
11068
11195
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11069
11196
|
const files = yield* RepositoryFiles;
|
|
@@ -11269,7 +11396,7 @@ var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schem
|
|
|
11269
11396
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
11270
11397
|
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
11271
11398
|
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
11272
|
-
const isExternal = ({ bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && !Array.contains(bundled, packageNameOf(specifier));
|
|
11399
|
+
const isExternal = ({ declared, bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && (isBuiltin(specifier) || Array.contains(declared, packageNameOf(specifier)) && !Array.contains(bundled, packageNameOf(specifier)));
|
|
11273
11400
|
const consumerSource = ({ entry, member }) => Option.match(member, {
|
|
11274
11401
|
onNone: () => `export * from ${quote(entry)};\n`,
|
|
11275
11402
|
onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`
|
|
@@ -11327,14 +11454,25 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
|
|
|
11327
11454
|
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11328
11455
|
});
|
|
11329
11456
|
// src/features/check-tree-shaking/model/manifest.ts
|
|
11330
|
-
const
|
|
11457
|
+
const Versions = Schema.Record(Schema.String, Schema.String);
|
|
11458
|
+
const PeerMeta = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
|
|
11459
|
+
const Manifest$4 = Schema.Struct({
|
|
11331
11460
|
name: Schema.optional(Schema.String),
|
|
11332
11461
|
exports: Schema.optional(Schema.Unknown),
|
|
11333
11462
|
bin: Schema.optional(Schema.Unknown),
|
|
11334
11463
|
sideEffects: Schema.optional(Schema.Unknown),
|
|
11335
|
-
dependencies: Schema.optional(
|
|
11336
|
-
|
|
11337
|
-
|
|
11464
|
+
dependencies: Schema.optional(Versions),
|
|
11465
|
+
peerDependencies: Schema.optional(Versions),
|
|
11466
|
+
optionalDependencies: Schema.optional(Versions),
|
|
11467
|
+
peerDependenciesMeta: Schema.optional(Schema.Record(Schema.String, PeerMeta))
|
|
11468
|
+
});
|
|
11469
|
+
const runtimeDependenciesOf = ({ dependencies, peerDependencies, optionalDependencies }) => pipe([
|
|
11470
|
+
dependencies,
|
|
11471
|
+
peerDependencies,
|
|
11472
|
+
optionalDependencies
|
|
11473
|
+
], Array.flatMap(keysOf), Array.dedupe);
|
|
11474
|
+
const optionalPeersOf = ({ peerDependenciesMeta }) => pipe(Option.fromUndefinedOr(peerDependenciesMeta), Option.map(Record.filter(({ optional }) => optional === true)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11475
|
+
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$4));
|
|
11338
11476
|
const manifestOf$1 = (text) => decode(text);
|
|
11339
11477
|
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
11340
11478
|
const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
|
|
@@ -11361,22 +11499,25 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11361
11499
|
};
|
|
11362
11500
|
};
|
|
11363
11501
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11364
|
-
const RULE$
|
|
11502
|
+
const RULE$39 = "optional-peer";
|
|
11503
|
+
const REQUIRED_RULE = "required-peer";
|
|
11365
11504
|
const START$19 = 0;
|
|
11366
11505
|
const SINGLE = 1;
|
|
11367
11506
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11507
|
+
const PEER_META_KEY = "\"peerDependenciesMeta\"";
|
|
11368
11508
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11369
11509
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11370
|
-
const
|
|
11371
|
-
const section = Option.getOrElse(String$1.indexOf(
|
|
11510
|
+
const positionIn = (located, key, name) => {
|
|
11511
|
+
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$19);
|
|
11372
11512
|
const rest = String$1.slice(section)(located.source);
|
|
11373
|
-
return {
|
|
11374
|
-
file: located.file,
|
|
11375
|
-
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19)),
|
|
11376
|
-
rule: RULE$38,
|
|
11377
|
-
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
11378
|
-
};
|
|
11513
|
+
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19));
|
|
11379
11514
|
};
|
|
11515
|
+
const problemFor$3 = (located, name, importers) => ({
|
|
11516
|
+
file: located.file,
|
|
11517
|
+
...positionIn(located, DEPENDENCIES_KEY, name),
|
|
11518
|
+
rule: RULE$39,
|
|
11519
|
+
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
11520
|
+
});
|
|
11380
11521
|
const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
11381
11522
|
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
11382
11523
|
const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
|
|
@@ -11388,8 +11529,23 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11388
11529
|
return [problemFor$3(located, name, importers)];
|
|
11389
11530
|
}));
|
|
11390
11531
|
};
|
|
11532
|
+
const requiredPeerProblems = ({ located, optional, used }) => {
|
|
11533
|
+
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
11534
|
+
return pipe(optional, Array.flatMap((name) => {
|
|
11535
|
+
const bins = pipe(used, Array.filter((entry) => isBinEntry(entry.entry) && importsPackage(name)(entry)));
|
|
11536
|
+
const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array.isArrayNonEmpty(all) && pipe(all, Array.every(importsPackage(name)))), Option.getOrElse(() => []));
|
|
11537
|
+
const importers = Array.appendAll(bins, everyLibrary);
|
|
11538
|
+
if (!Array.isArrayNonEmpty(importers)) return [];
|
|
11539
|
+
return [{
|
|
11540
|
+
file: located.file,
|
|
11541
|
+
...positionIn(located, PEER_META_KEY, name),
|
|
11542
|
+
rule: REQUIRED_RULE,
|
|
11543
|
+
message: `${name} is an optional peer, but ${labelsOf(importers)} import it at startup, so installing the package without it breaks them. Move it to dependencies.`
|
|
11544
|
+
}];
|
|
11545
|
+
}));
|
|
11546
|
+
};
|
|
11391
11547
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11392
|
-
const RULE$
|
|
11548
|
+
const RULE$38 = "side-effects";
|
|
11393
11549
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11394
11550
|
const START$18 = 0;
|
|
11395
11551
|
const FIRST$8 = 1;
|
|
@@ -11441,13 +11597,13 @@ const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source),
|
|
|
11441
11597
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11442
11598
|
file,
|
|
11443
11599
|
...positionOf(source)(keyIndex$1(source)),
|
|
11444
|
-
rule: RULE$
|
|
11600
|
+
rule: RULE$38,
|
|
11445
11601
|
message: messageOf$4(worst, excesses.length)
|
|
11446
11602
|
})), Option.toArray);
|
|
11447
11603
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11448
|
-
const RULE$
|
|
11604
|
+
const RULE$37 = "top-level-effect";
|
|
11449
11605
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11450
|
-
const READ_CONCURRENCY$
|
|
11606
|
+
const READ_CONCURRENCY$13 = 16;
|
|
11451
11607
|
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.";
|
|
11452
11608
|
const STATEMENT_MESSAGE = "runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.";
|
|
11453
11609
|
const isEffect = (statement) => {
|
|
@@ -11461,7 +11617,7 @@ const messageOf$3 = (statement) => {
|
|
|
11461
11617
|
const problemsIn$12 = (api) => (file) => (source) => {
|
|
11462
11618
|
const retained = api.createSourceFile(file, source);
|
|
11463
11619
|
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$7({
|
|
11464
|
-
rule: RULE$
|
|
11620
|
+
rule: RULE$37,
|
|
11465
11621
|
message: messageOf$3(statement)
|
|
11466
11622
|
})(statement)));
|
|
11467
11623
|
retained.dispose();
|
|
@@ -11474,7 +11630,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11474
11630
|
const names = yield* files.ownedFiles(root);
|
|
11475
11631
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11476
11632
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11477
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$12(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$
|
|
11633
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$12(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$13 });
|
|
11478
11634
|
return Array.flatten(found);
|
|
11479
11635
|
}, Effect.scoped);
|
|
11480
11636
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11512,7 +11668,10 @@ const shapeOf = Effect.fn("shapeOf")(function* shapeOf({ workspace, manifest })
|
|
|
11512
11668
|
packEntries: workspace.packEntries
|
|
11513
11669
|
}), Array.dedupeWith((left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right)));
|
|
11514
11670
|
return {
|
|
11515
|
-
scope: {
|
|
11671
|
+
scope: {
|
|
11672
|
+
declared: runtimeDependenciesOf(manifest),
|
|
11673
|
+
bundled: workspace.alwaysBundle
|
|
11674
|
+
},
|
|
11516
11675
|
declared: declaredBy$1({
|
|
11517
11676
|
declared: manifest.sideEffects,
|
|
11518
11677
|
locator: {
|
|
@@ -11557,6 +11716,11 @@ const analyse = Effect.fn("analyse")(function* analyse(pack) {
|
|
|
11557
11716
|
located,
|
|
11558
11717
|
dependencies: manifest.dependencies,
|
|
11559
11718
|
used
|
|
11719
|
+
}),
|
|
11720
|
+
...requiredPeerProblems({
|
|
11721
|
+
located,
|
|
11722
|
+
optional: optionalPeersOf(manifest),
|
|
11723
|
+
used
|
|
11560
11724
|
})
|
|
11561
11725
|
];
|
|
11562
11726
|
});
|
|
@@ -11585,7 +11749,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11585
11749
|
return Array.flatten(found);
|
|
11586
11750
|
});
|
|
11587
11751
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11588
|
-
const RULE$
|
|
11752
|
+
const RULE$36 = "legacy-typescript";
|
|
11589
11753
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11590
11754
|
const COMPILER = "typescript";
|
|
11591
11755
|
const CURRENT_MAJOR = 7;
|
|
@@ -11616,12 +11780,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11616
11780
|
file,
|
|
11617
11781
|
line: lineOf$2(source)(legacy.id),
|
|
11618
11782
|
column: FIRST$7,
|
|
11619
|
-
rule: RULE$
|
|
11783
|
+
rule: RULE$36,
|
|
11620
11784
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11621
11785
|
})));
|
|
11622
11786
|
});
|
|
11623
11787
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11624
|
-
const RULE$
|
|
11788
|
+
const RULE$35 = "worker-bundle";
|
|
11625
11789
|
const BUNDLE_CONCURRENCY = 4;
|
|
11626
11790
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11627
11791
|
const CONDITIONS = [
|
|
@@ -11632,7 +11796,7 @@ const CONDITIONS = [
|
|
|
11632
11796
|
"module",
|
|
11633
11797
|
"default"
|
|
11634
11798
|
];
|
|
11635
|
-
const problemFor$2 = problemInFile(RULE$
|
|
11799
|
+
const problemFor$2 = problemInFile(RULE$35);
|
|
11636
11800
|
const problemOf$6 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11637
11801
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11638
11802
|
const built = yield* Effect.tryPromise({
|
|
@@ -11756,7 +11920,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11756
11920
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11757
11921
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11758
11922
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11759
|
-
const RULE$
|
|
11923
|
+
const RULE$34 = "hand-written-names";
|
|
11760
11924
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11761
11925
|
const nameListOf = (site) => {
|
|
11762
11926
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11771,7 +11935,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11771
11935
|
file,
|
|
11772
11936
|
line,
|
|
11773
11937
|
column,
|
|
11774
|
-
rule: RULE$
|
|
11938
|
+
rule: RULE$34,
|
|
11775
11939
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11776
11940
|
});
|
|
11777
11941
|
const problemOf$5 = ({ list, reason }) => listedProblem({
|
|
@@ -12452,13 +12616,13 @@ const MANIFEST$3 = "package.json";
|
|
|
12452
12616
|
const SEPARATOR$5 = "/";
|
|
12453
12617
|
const FIRST_SEGMENT = 1;
|
|
12454
12618
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12455
|
-
const decodeManifest$
|
|
12619
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(ManifestJson);
|
|
12456
12620
|
const prefixesOf = (file) => {
|
|
12457
12621
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12458
12622
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12459
12623
|
};
|
|
12460
12624
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12461
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12625
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$4), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12462
12626
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12463
12627
|
const files = yield* RepositoryFiles;
|
|
12464
12628
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12570,7 +12734,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12570
12734
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12571
12735
|
}, Effect.scoped);
|
|
12572
12736
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12573
|
-
const RULE$
|
|
12737
|
+
const RULE$33 = "namespace-destructuring";
|
|
12574
12738
|
const LOCAL = /^[.#/]/u;
|
|
12575
12739
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
12576
12740
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12586,7 +12750,7 @@ const destructuredName = (declaration) => {
|
|
|
12586
12750
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12587
12751
|
};
|
|
12588
12752
|
const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
12589
|
-
rule: RULE$
|
|
12753
|
+
rule: RULE$33,
|
|
12590
12754
|
message: messageOf$1(name)
|
|
12591
12755
|
})), Option.map((report) => report(declaration)));
|
|
12592
12756
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12594,7 +12758,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12594
12758
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$4(names)), Array.getSomes);
|
|
12595
12759
|
};
|
|
12596
12760
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12597
|
-
const RULE$
|
|
12761
|
+
const RULE$32 = "pass-through-wrapper";
|
|
12598
12762
|
const SINGLE_STATEMENT = 1;
|
|
12599
12763
|
const SINGLE_DECLARATION = 1;
|
|
12600
12764
|
const THIS_PARAMETER = "this";
|
|
@@ -12691,7 +12855,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12691
12855
|
const problemOf$3 = (checker) => (candidate) => {
|
|
12692
12856
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12693
12857
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
12694
|
-
rule: RULE$
|
|
12858
|
+
rule: RULE$32,
|
|
12695
12859
|
message: messageOf(forward.callee.getText())
|
|
12696
12860
|
})(candidate.name)));
|
|
12697
12861
|
};
|
|
@@ -12717,7 +12881,7 @@ var plugins = [{
|
|
|
12717
12881
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12718
12882
|
}];
|
|
12719
12883
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12720
|
-
const RULE$
|
|
12884
|
+
const RULE$31 = "known-plugins";
|
|
12721
12885
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12722
12886
|
const GITHUB$2 = "github";
|
|
12723
12887
|
const Source$1 = Schema.Struct({
|
|
@@ -12735,7 +12899,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12735
12899
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12736
12900
|
const MARKETPLACE = name;
|
|
12737
12901
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12738
|
-
const problem$1 = problemInFile(RULE$
|
|
12902
|
+
const problem$1 = problemInFile(RULE$31);
|
|
12739
12903
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12740
12904
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12741
12905
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12756,13 +12920,13 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12756
12920
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12757
12921
|
});
|
|
12758
12922
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12759
|
-
const RULE$
|
|
12923
|
+
const RULE$30 = "missing-hook";
|
|
12760
12924
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12761
12925
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12762
12926
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12763
12927
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12764
12928
|
const PLUGIN_ROOT = "..";
|
|
12765
|
-
const READ_CONCURRENCY$
|
|
12929
|
+
const READ_CONCURRENCY$12 = 16;
|
|
12766
12930
|
const START$17 = 0;
|
|
12767
12931
|
const referenceOf$2 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
12768
12932
|
path,
|
|
@@ -12781,7 +12945,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12781
12945
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12782
12946
|
file,
|
|
12783
12947
|
...positionOf(source)(index),
|
|
12784
|
-
rule: RULE$
|
|
12948
|
+
rule: RULE$30,
|
|
12785
12949
|
message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
|
|
12786
12950
|
})));
|
|
12787
12951
|
});
|
|
@@ -12805,7 +12969,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12805
12969
|
}];
|
|
12806
12970
|
return [];
|
|
12807
12971
|
}));
|
|
12808
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$
|
|
12972
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$12 });
|
|
12809
12973
|
return Array.flatten(found);
|
|
12810
12974
|
});
|
|
12811
12975
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12834,7 +12998,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12834
12998
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12835
12999
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12836
13000
|
// src/features/check-documented-commands/model/commands.ts
|
|
12837
|
-
const RULE$
|
|
13001
|
+
const RULE$29 = "documented-commands";
|
|
12838
13002
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12839
13003
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12840
13004
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12912,7 +13076,7 @@ const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph,
|
|
|
12912
13076
|
const problemsIn$10 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12913
13077
|
file: absolute(file),
|
|
12914
13078
|
...positionOf(text)(match.index ?? START$16),
|
|
12915
|
-
rule: RULE$
|
|
13079
|
+
rule: RULE$29,
|
|
12916
13080
|
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12917
13081
|
})), Option.toArray)));
|
|
12918
13082
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
@@ -12937,15 +13101,15 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12937
13101
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12938
13102
|
line: ONE$1,
|
|
12939
13103
|
column: ONE$1,
|
|
12940
|
-
rule: RULE$
|
|
13104
|
+
rule: RULE$29,
|
|
12941
13105
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12942
13106
|
}],
|
|
12943
13107
|
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12944
13108
|
});
|
|
12945
13109
|
});
|
|
12946
13110
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12947
|
-
const RULE$
|
|
12948
|
-
const FIRST_COLUMN$
|
|
13111
|
+
const RULE$28 = "legacy-web";
|
|
13112
|
+
const FIRST_COLUMN$4 = 1;
|
|
12949
13113
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12950
13114
|
const Finding = Schema.Struct({
|
|
12951
13115
|
file: Schema.String,
|
|
@@ -12982,8 +13146,8 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12982
13146
|
const problemOf = (guideId, ruleId) => ({ file, line, message }) => ({
|
|
12983
13147
|
file: files.join(root, file),
|
|
12984
13148
|
line,
|
|
12985
|
-
column: FIRST_COLUMN$
|
|
12986
|
-
rule: RULE$
|
|
13149
|
+
column: FIRST_COLUMN$4,
|
|
13150
|
+
rule: RULE$28,
|
|
12987
13151
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12988
13152
|
});
|
|
12989
13153
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -13053,8 +13217,8 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
13053
13217
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
13054
13218
|
const EXTENSION = /\.[^./]+$/u;
|
|
13055
13219
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13056
|
-
const READ_CONCURRENCY$
|
|
13057
|
-
const RULE$
|
|
13220
|
+
const READ_CONCURRENCY$11 = 64;
|
|
13221
|
+
const RULE$27 = "shell-script";
|
|
13058
13222
|
const MESSAGE$11 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
13059
13223
|
const HookSchema = Schema.Struct({
|
|
13060
13224
|
command: Schema.optional(Schema.String),
|
|
@@ -13086,12 +13250,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13086
13250
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
13087
13251
|
};
|
|
13088
13252
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13089
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
13090
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13253
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$11 });
|
|
13254
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$27)(files.join(root, name), MESSAGE$11)));
|
|
13091
13255
|
});
|
|
13092
13256
|
// src/shared/lib/workflow-files.ts
|
|
13093
13257
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
13094
|
-
const READ_CONCURRENCY$
|
|
13258
|
+
const READ_CONCURRENCY$10 = 16;
|
|
13095
13259
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
13096
13260
|
const files = yield* RepositoryFiles;
|
|
13097
13261
|
const names = yield* files.listedFiles(root);
|
|
@@ -13101,7 +13265,7 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13101
13265
|
file,
|
|
13102
13266
|
source
|
|
13103
13267
|
}))));
|
|
13104
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13268
|
+
}, { concurrency: READ_CONCURRENCY$10 });
|
|
13105
13269
|
return Array.getSomes(found);
|
|
13106
13270
|
});
|
|
13107
13271
|
// src/shared/lib/workflow-run.ts
|
|
@@ -13122,7 +13286,7 @@ const runScriptsOf = (source) => {
|
|
|
13122
13286
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13123
13287
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13124
13288
|
const COMMENT = "#";
|
|
13125
|
-
const RULE$
|
|
13289
|
+
const RULE$26 = "workflow-script";
|
|
13126
13290
|
const ONE_COMMAND = 1;
|
|
13127
13291
|
const MESSAGE$10 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
13128
13292
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -13133,7 +13297,7 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
13133
13297
|
};
|
|
13134
13298
|
const problemsIn$9 = (file) => (source) => {
|
|
13135
13299
|
const at = positionOf(source);
|
|
13136
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13300
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$26)(file, at(start), MESSAGE$10)));
|
|
13137
13301
|
};
|
|
13138
13302
|
/** @internal */
|
|
13139
13303
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
@@ -13263,7 +13427,7 @@ const AGENT_DOCS = [
|
|
|
13263
13427
|
":(glob)**/CLAUDE.md",
|
|
13264
13428
|
...EXCLUDED$4
|
|
13265
13429
|
];
|
|
13266
|
-
const READ_CONCURRENCY$
|
|
13430
|
+
const READ_CONCURRENCY$9 = 16;
|
|
13267
13431
|
const START$14 = 0;
|
|
13268
13432
|
const FIRST$5 = 1;
|
|
13269
13433
|
const LINE = "\n";
|
|
@@ -13334,7 +13498,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
13334
13498
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
13335
13499
|
});
|
|
13336
13500
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
13337
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13501
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$9 });
|
|
13338
13502
|
return Array.flatten(found);
|
|
13339
13503
|
});
|
|
13340
13504
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -13346,7 +13510,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
13346
13510
|
onSome: sourcesOf(file, name)
|
|
13347
13511
|
});
|
|
13348
13512
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
13349
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13513
|
+
}, { concurrency: READ_CONCURRENCY$9 });
|
|
13350
13514
|
return Array.flatten(found);
|
|
13351
13515
|
});
|
|
13352
13516
|
/** @internal */
|
|
@@ -13370,7 +13534,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13370
13534
|
return Array.flatten(found);
|
|
13371
13535
|
});
|
|
13372
13536
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13373
|
-
const RULE$
|
|
13537
|
+
const RULE$25 = "package-script";
|
|
13374
13538
|
const LIFECYCLE = [
|
|
13375
13539
|
"preinstall",
|
|
13376
13540
|
"install",
|
|
@@ -13393,12 +13557,12 @@ const LIFECYCLE = [
|
|
|
13393
13557
|
const problemOf$2 = ({ file, position, name }) => ({
|
|
13394
13558
|
file,
|
|
13395
13559
|
...position,
|
|
13396
|
-
rule: RULE$
|
|
13560
|
+
rule: RULE$25,
|
|
13397
13561
|
message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
|
|
13398
13562
|
});
|
|
13399
13563
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$2));
|
|
13400
13564
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13401
|
-
const RULE$
|
|
13565
|
+
const RULE$24 = "vite-plus-block";
|
|
13402
13566
|
const MARKER = Array.join([
|
|
13403
13567
|
"<!--",
|
|
13404
13568
|
"VITE PLUS START",
|
|
@@ -13411,7 +13575,7 @@ const problemIn = (file) => (source) => {
|
|
|
13411
13575
|
return Option.some({
|
|
13412
13576
|
file,
|
|
13413
13577
|
...positionOf(source)(index.value),
|
|
13414
|
-
rule: RULE$
|
|
13578
|
+
rule: RULE$24,
|
|
13415
13579
|
message: MESSAGE$9
|
|
13416
13580
|
});
|
|
13417
13581
|
};
|
|
@@ -13467,7 +13631,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13467
13631
|
})
|
|
13468
13632
|
});
|
|
13469
13633
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13470
|
-
const RULE$
|
|
13634
|
+
const RULE$22 = "publish-trigger";
|
|
13471
13635
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13472
13636
|
const MANUAL = "workflow_dispatch";
|
|
13473
13637
|
const TRIGGER_KEY = "on";
|
|
@@ -13487,18 +13651,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13487
13651
|
};
|
|
13488
13652
|
/** @internal */
|
|
13489
13653
|
const checkPublishTrigger = workflowCheck({
|
|
13490
|
-
rule: RULE$
|
|
13654
|
+
rule: RULE$22,
|
|
13491
13655
|
message: MESSAGE$7,
|
|
13492
13656
|
offsetsOf: publishTriggerOffsetsOf
|
|
13493
13657
|
});
|
|
13494
13658
|
// src/features/check-workflows/model/release-please.ts
|
|
13495
|
-
const RULE$
|
|
13659
|
+
const RULE$21 = "release-please";
|
|
13496
13660
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13497
13661
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13498
13662
|
const FIRST$4 = 1;
|
|
13499
13663
|
const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
13500
13664
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13501
|
-
rule: RULE$
|
|
13665
|
+
rule: RULE$21,
|
|
13502
13666
|
message: MESSAGE$6,
|
|
13503
13667
|
offsetsOf: scalarKeyOffsets({
|
|
13504
13668
|
name: "uses",
|
|
@@ -13512,7 +13676,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13512
13676
|
file: files.join(root, name),
|
|
13513
13677
|
line: FIRST$4,
|
|
13514
13678
|
column: FIRST$4,
|
|
13515
|
-
rule: RULE$
|
|
13679
|
+
rule: RULE$21,
|
|
13516
13680
|
message: MESSAGE$6
|
|
13517
13681
|
})));
|
|
13518
13682
|
});
|
|
@@ -13524,17 +13688,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13524
13688
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13525
13689
|
const CONCURRENCY_KEY = "concurrency";
|
|
13526
13690
|
const QUEUE_KEY = "queue";
|
|
13527
|
-
const RULE$
|
|
13691
|
+
const RULE$20 = "workflow-queue";
|
|
13528
13692
|
const MESSAGE$5 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
13529
13693
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13530
13694
|
/** @internal */
|
|
13531
13695
|
const checkWorkflowQueues = workflowCheck({
|
|
13532
|
-
rule: RULE$
|
|
13696
|
+
rule: RULE$20,
|
|
13533
13697
|
message: MESSAGE$5,
|
|
13534
13698
|
offsetsOf: queueOffsetsOf
|
|
13535
13699
|
});
|
|
13536
13700
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13537
|
-
const RULE$
|
|
13701
|
+
const RULE$19 = "workflow-commit";
|
|
13538
13702
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13539
13703
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13540
13704
|
const MESSAGE$4 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
@@ -13542,7 +13706,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
13542
13706
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13543
13707
|
/** @internal */
|
|
13544
13708
|
const checkWorkflowCommits = workflowCheck({
|
|
13545
|
-
rule: RULE$
|
|
13709
|
+
rule: RULE$19,
|
|
13546
13710
|
message: MESSAGE$4,
|
|
13547
13711
|
offsetsOf: commitOffsetsOf
|
|
13548
13712
|
});
|
|
@@ -13769,11 +13933,11 @@ const shebangReader = (source) => {
|
|
|
13769
13933
|
};
|
|
13770
13934
|
const readerOf = (name) => (source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13771
13935
|
// src/features/ban-comments/model/comments.ts
|
|
13772
|
-
const RULE$
|
|
13936
|
+
const RULE$18 = "comment";
|
|
13773
13937
|
const UNUSED_RULE$1 = "unused-comment-allowance";
|
|
13774
13938
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13775
13939
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13776
|
-
const READ_CONCURRENCY$
|
|
13940
|
+
const READ_CONCURRENCY$8 = 64;
|
|
13777
13941
|
const START$12 = 0;
|
|
13778
13942
|
const SHEBANG = "#!";
|
|
13779
13943
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
@@ -13810,7 +13974,7 @@ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but n
|
|
|
13810
13974
|
const problemOf$1 = (file, source) => ({ index }) => ({
|
|
13811
13975
|
file,
|
|
13812
13976
|
...positionOf(source)(index),
|
|
13813
|
-
rule: RULE$
|
|
13977
|
+
rule: RULE$18,
|
|
13814
13978
|
message: MESSAGE$3
|
|
13815
13979
|
});
|
|
13816
13980
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13869,7 +14033,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
13869
14033
|
problems: pipe(found, Array.filter(kept), Array.map(toProblem)),
|
|
13870
14034
|
used: usedAllowances(allowances, found)
|
|
13871
14035
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
13872
|
-
problems: [problemInFile(RULE$
|
|
14036
|
+
problems: [problemInFile(RULE$18)(file, `msch could not read the comments in this file: ${message}`)],
|
|
13873
14037
|
used: []
|
|
13874
14038
|
})))
|
|
13875
14039
|
});
|
|
@@ -13888,7 +14052,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13888
14052
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
13889
14053
|
onNone: () => Effect.succeed(NOTHING),
|
|
13890
14054
|
onSome: (source) => scan(entry, source)
|
|
13891
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
14055
|
+
}))), { concurrency: READ_CONCURRENCY$8 });
|
|
13892
14056
|
const used = HashSet.fromIterable(pipe(found, Array.flatMap(({ used: indexes }) => indexes)));
|
|
13893
14057
|
const unused = yield* unusedAllowances(root, settings, used);
|
|
13894
14058
|
return [...pipe(found, Array.flatMap(({ problems }) => problems)), ...unused];
|
|
@@ -13903,13 +14067,13 @@ const patternsBy = ({ spawn, command, toolVersions = [] }) => (entry) => {
|
|
|
13903
14067
|
return command;
|
|
13904
14068
|
};
|
|
13905
14069
|
const spawnPattern = (program) => new RegExp(String.raw`(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make)\(\s*|\$\(\s*|\$\s*(?=\x60))["'\x60](?:${program})(?=["'\x60\s])`, "gu");
|
|
13906
|
-
const FIRST_LINE$
|
|
13907
|
-
const FIRST_COLUMN$
|
|
14070
|
+
const FIRST_LINE$4 = 1;
|
|
14071
|
+
const FIRST_COLUMN$3 = 1;
|
|
13908
14072
|
const WHOLE_MATCH$1 = 0;
|
|
13909
14073
|
const fileProblem = (tool) => (entry) => ({
|
|
13910
14074
|
file: entry.file,
|
|
13911
|
-
line: FIRST_LINE$
|
|
13912
|
-
column: FIRST_COLUMN$
|
|
14075
|
+
line: FIRST_LINE$4,
|
|
14076
|
+
column: FIRST_COLUMN$3,
|
|
13913
14077
|
rule: tool.fileRule,
|
|
13914
14078
|
message: tool.fileMessage(entry)
|
|
13915
14079
|
});
|
|
@@ -13982,7 +14146,7 @@ const PYTHON = {
|
|
|
13982
14146
|
/** @internal */
|
|
13983
14147
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13984
14148
|
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13985
|
-
const RULE$
|
|
14149
|
+
const RULE$17 = "uncataloged-dependency";
|
|
13986
14150
|
const OWNED_ELSEWHERE = [
|
|
13987
14151
|
"catalog:",
|
|
13988
14152
|
"workspace:",
|
|
@@ -13995,8 +14159,8 @@ const MESSAGE$2 = "is a version written in this package.json. Add it to the cata
|
|
|
13995
14159
|
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13996
14160
|
const problemsIn$8 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13997
14161
|
file: entry.file,
|
|
13998
|
-
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13999
|
-
rule: RULE$
|
|
14162
|
+
...positionOf(source)(offsetIn$1(source)(manifestPattern(found))),
|
|
14163
|
+
rule: RULE$17,
|
|
14000
14164
|
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
14001
14165
|
})));
|
|
14002
14166
|
/** @internal */
|
|
@@ -14020,10 +14184,10 @@ const CATALOG_PROTOCOL = "catalog:";
|
|
|
14020
14184
|
const DEFAULT_CATALOG = "default";
|
|
14021
14185
|
const VERSION_SEPARATOR = "||";
|
|
14022
14186
|
const WILDCARD = "*";
|
|
14023
|
-
const FIRST_LINE$
|
|
14024
|
-
const FIRST_COLUMN$
|
|
14187
|
+
const FIRST_LINE$3 = 1;
|
|
14188
|
+
const FIRST_COLUMN$2 = 1;
|
|
14025
14189
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
14026
|
-
const READ_CONCURRENCY$
|
|
14190
|
+
const READ_CONCURRENCY$7 = 16;
|
|
14027
14191
|
const STALE_RULE = "stale-release-age-exclude";
|
|
14028
14192
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
14029
14193
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
@@ -14054,14 +14218,14 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
14054
14218
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
14055
14219
|
const files = yield* RepositoryFiles;
|
|
14056
14220
|
const listed = yield* files.listedFiles(root);
|
|
14057
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
14058
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
14221
|
+
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$7 });
|
|
14222
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$9(text))), Array.flatMap(referencesIn));
|
|
14059
14223
|
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
|
|
14060
14224
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
14061
14225
|
});
|
|
14062
14226
|
const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
|
|
14063
|
-
onNone: () => FIRST_LINE$
|
|
14064
|
-
onSome: (index) => index + FIRST_LINE$
|
|
14227
|
+
onNone: () => FIRST_LINE$3,
|
|
14228
|
+
onSome: (index) => index + FIRST_LINE$3
|
|
14065
14229
|
}));
|
|
14066
14230
|
const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
14067
14231
|
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
|
|
@@ -14069,7 +14233,7 @@ const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\
|
|
|
14069
14233
|
const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
14070
14234
|
file,
|
|
14071
14235
|
line: at(needle),
|
|
14072
|
-
column: FIRST_COLUMN$
|
|
14236
|
+
column: FIRST_COLUMN$2,
|
|
14073
14237
|
rule,
|
|
14074
14238
|
message: `\`${name}\` ${message}`
|
|
14075
14239
|
});
|
|
@@ -14169,14 +14333,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
14169
14333
|
];
|
|
14170
14334
|
});
|
|
14171
14335
|
// src/features/check-skills/model/published-skills.ts
|
|
14172
|
-
const RULE$
|
|
14336
|
+
const RULE$16 = "published-skills";
|
|
14173
14337
|
const KEYWORD = "tanstack-intent";
|
|
14174
14338
|
const SKILLS = "skills";
|
|
14175
14339
|
const MANIFEST_FILE = "package.json";
|
|
14176
14340
|
const SKILL_FILE$1 = "SKILL.md";
|
|
14177
14341
|
const SUCCEEDED = 0;
|
|
14178
14342
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14179
|
-
const problemAt$2 = problemInFile(RULE$
|
|
14343
|
+
const problemAt$2 = problemInFile(RULE$16);
|
|
14180
14344
|
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
|
|
14181
14345
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14182
14346
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -14213,7 +14377,7 @@ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPu
|
|
|
14213
14377
|
return Array.flatten(problems);
|
|
14214
14378
|
});
|
|
14215
14379
|
// src/features/check-skills/model/skill-files.ts
|
|
14216
|
-
const RULE$
|
|
14380
|
+
const RULE$15 = "skill-file";
|
|
14217
14381
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14218
14382
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14219
14383
|
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
@@ -14233,7 +14397,7 @@ const BLANK = /\s+/u;
|
|
|
14233
14397
|
const SEPARATOR$2 = "/";
|
|
14234
14398
|
const START$10 = 0;
|
|
14235
14399
|
const FIRST$3 = 1;
|
|
14236
|
-
const READ_CONCURRENCY$
|
|
14400
|
+
const READ_CONCURRENCY$6 = 16;
|
|
14237
14401
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
14238
14402
|
const Frontmatter = Schema.Struct({
|
|
14239
14403
|
name: Schema.optional(Schema.String),
|
|
@@ -14271,7 +14435,7 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
14271
14435
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
14272
14436
|
file: skill.file,
|
|
14273
14437
|
...positionOf(skill.source)(index),
|
|
14274
|
-
rule: RULE$
|
|
14438
|
+
rule: RULE$15,
|
|
14275
14439
|
message
|
|
14276
14440
|
})));
|
|
14277
14441
|
const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
@@ -14298,7 +14462,7 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
14298
14462
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14299
14463
|
file,
|
|
14300
14464
|
...positionOf(source)(index),
|
|
14301
|
-
rule: RULE$
|
|
14465
|
+
rule: RULE$15,
|
|
14302
14466
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14303
14467
|
})));
|
|
14304
14468
|
});
|
|
@@ -14309,12 +14473,12 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14309
14473
|
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
14310
14474
|
const text = yield* files.readFile(file);
|
|
14311
14475
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
14312
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
14476
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$6 });
|
|
14313
14477
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
14314
14478
|
file: files.join(root, entry),
|
|
14315
14479
|
line: FIRST$3,
|
|
14316
14480
|
column: FIRST$3,
|
|
14317
|
-
rule: RULE$
|
|
14481
|
+
rule: RULE$15,
|
|
14318
14482
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14319
14483
|
})));
|
|
14320
14484
|
return [
|
|
@@ -14331,7 +14495,7 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14331
14495
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
14332
14496
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
14333
14497
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
14334
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$
|
|
14498
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$6 });
|
|
14335
14499
|
return Array.flatten(found);
|
|
14336
14500
|
});
|
|
14337
14501
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -14392,9 +14556,8 @@ const cargoEntries = (text) => {
|
|
|
14392
14556
|
};
|
|
14393
14557
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14394
14558
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14395
|
-
const RULE$
|
|
14396
|
-
const
|
|
14397
|
-
const READ_CONCURRENCY$4 = 16;
|
|
14559
|
+
const RULE$14 = "version-downgrade";
|
|
14560
|
+
const READ_CONCURRENCY$5 = 16;
|
|
14398
14561
|
const READERS = [
|
|
14399
14562
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
14400
14563
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -14406,28 +14569,22 @@ const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(a
|
|
|
14406
14569
|
onNone: () => false,
|
|
14407
14570
|
onSome: ([old, current]) => semver.lt(current, old)
|
|
14408
14571
|
}));
|
|
14409
|
-
const FIRST_LINE$
|
|
14572
|
+
const FIRST_LINE$2 = 1;
|
|
14410
14573
|
const lineOf = (text, { name, spec }) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(name)(line) && String$1.includes(spec)(line)), Option.match({
|
|
14411
|
-
onNone: () => FIRST_LINE$
|
|
14412
|
-
onSome: (index) => index + FIRST_LINE$
|
|
14574
|
+
onNone: () => FIRST_LINE$2,
|
|
14575
|
+
onSome: (index) => index + FIRST_LINE$2
|
|
14413
14576
|
}));
|
|
14414
|
-
const message = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
|
|
14577
|
+
const message$1 = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
|
|
14415
14578
|
const downgradesIn = ({ file, text, before, after }) => {
|
|
14416
14579
|
const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
|
|
14417
14580
|
return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
|
|
14418
14581
|
file,
|
|
14419
14582
|
line: lineOf(text, entry),
|
|
14420
|
-
column: FIRST_LINE$
|
|
14421
|
-
rule: RULE$
|
|
14422
|
-
message: message(old, entry)
|
|
14583
|
+
column: FIRST_LINE$2,
|
|
14584
|
+
rule: RULE$14,
|
|
14585
|
+
message: message$1(old, entry)
|
|
14423
14586
|
})), Option.toArray)));
|
|
14424
14587
|
};
|
|
14425
|
-
const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
|
|
14426
|
-
const files = yield* RepositoryFiles;
|
|
14427
|
-
const configured = yield* Config.option(Config.String("VPA_BASE")).pipe(Effect.orDie);
|
|
14428
|
-
const base = Option.getOrElse(configured, () => DEFAULT_BASE);
|
|
14429
|
-
return yield* files.mergeBase(root, base);
|
|
14430
|
-
});
|
|
14431
14588
|
/** @internal */
|
|
14432
14589
|
const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(root) {
|
|
14433
14590
|
const files = yield* RepositoryFiles;
|
|
@@ -14444,7 +14601,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
14444
14601
|
before: read(before),
|
|
14445
14602
|
after: read(after)
|
|
14446
14603
|
})), Option.getOrElse(() => []));
|
|
14447
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
14604
|
+
}), { concurrency: READ_CONCURRENCY$5 });
|
|
14448
14605
|
return Array.flatten(found);
|
|
14449
14606
|
});
|
|
14450
14607
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -14456,7 +14613,7 @@ const CAP_RULE = "renovate-version-cap";
|
|
|
14456
14613
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14457
14614
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14458
14615
|
const START$9 = 0;
|
|
14459
|
-
const READ_CONCURRENCY$
|
|
14616
|
+
const READ_CONCURRENCY$4 = 16;
|
|
14460
14617
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14461
14618
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
14462
14619
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
@@ -14490,7 +14647,71 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14490
14647
|
onNone: () => [],
|
|
14491
14648
|
onSome: (source) => problemsIn$5(file, source)
|
|
14492
14649
|
})));
|
|
14493
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
14650
|
+
}, { concurrency: READ_CONCURRENCY$4 });
|
|
14651
|
+
return Array.flatten(found);
|
|
14652
|
+
});
|
|
14653
|
+
// src/features/check-version-downgrades/model/package-versions.ts
|
|
14654
|
+
const RULE$13 = "unbumped-package";
|
|
14655
|
+
const UNSHIPPED = /(?:\.test\.[\w.]+$|(?:^|\/)(?:fixtures|__tests__|tests?)\/|(?:^|\/)(?:AGENTS|CLAUDE|CHANGELOG)\.md$)/u;
|
|
14656
|
+
const UNVERSIONED = "0.0.0";
|
|
14657
|
+
const FIRST_LINE$1 = 1;
|
|
14658
|
+
const FIRST_COLUMN$1 = 1;
|
|
14659
|
+
const READ_CONCURRENCY$3 = 16;
|
|
14660
|
+
const Manifest$3 = Schema.fromJsonString(Schema.Struct({
|
|
14661
|
+
name: Schema.String,
|
|
14662
|
+
version: Schema.String,
|
|
14663
|
+
private: Schema.optional(Schema.Boolean)
|
|
14664
|
+
}));
|
|
14665
|
+
const LAST_SEGMENT$1 = /[^/]*$/u;
|
|
14666
|
+
const directoryOf$1 = (file) => String$1.replace(LAST_SEGMENT$1, "")(file);
|
|
14667
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(Manifest$3);
|
|
14668
|
+
const packageAt = (file, text) => pipe(decodeManifest$3(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED), Option.map(({ name, version }) => ({
|
|
14669
|
+
file,
|
|
14670
|
+
directory: directoryOf$1(file),
|
|
14671
|
+
name,
|
|
14672
|
+
version,
|
|
14673
|
+
text
|
|
14674
|
+
})));
|
|
14675
|
+
const versionAt = (name, text) => pipe(text, Option.flatMap(decodeManifest$3), Option.filter((manifest) => manifest.name === name), Option.map(({ version }) => version), Option.filter((version) => semver.valid(version) !== null));
|
|
14676
|
+
const versionLine = (text) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes("\"version\"")(line)), Option.match({
|
|
14677
|
+
onNone: () => FIRST_LINE$1,
|
|
14678
|
+
onSome: (index) => index + FIRST_LINE$1
|
|
14679
|
+
}));
|
|
14680
|
+
const shippedChange = (directory, changed) => pipe(changed, Array.some((name) => String$1.startsWith(directory)(name) && !UNSHIPPED.test(name)));
|
|
14681
|
+
const higher = (left, right) => {
|
|
14682
|
+
if (semver.gt(right, left)) return right;
|
|
14683
|
+
return left;
|
|
14684
|
+
};
|
|
14685
|
+
const floorOf$1 = (versions) => {
|
|
14686
|
+
let floor = Option.none();
|
|
14687
|
+
for (const version of Array.getSomes(versions)) floor = Option.match(floor, {
|
|
14688
|
+
onNone: () => Option.some(version),
|
|
14689
|
+
onSome: (lowest) => Option.some(higher(version, lowest))
|
|
14690
|
+
});
|
|
14691
|
+
return floor;
|
|
14692
|
+
};
|
|
14693
|
+
const message = ({ name, version }, floor) => `${name} changed, but its version ${version} is not above ${floor}, the version of the base or of main. Another change may already publish ${floor}. Bump the version above ${floor}.`;
|
|
14694
|
+
/** @internal */
|
|
14695
|
+
const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPackageVersions(root) {
|
|
14696
|
+
const files = yield* RepositoryFiles;
|
|
14697
|
+
const base = yield* baseRevision(root);
|
|
14698
|
+
if (Option.isNone(base)) return [];
|
|
14699
|
+
const tip = yield* baseName$1;
|
|
14700
|
+
const changed = yield* files.changedFiles(root, base.value);
|
|
14701
|
+
const manifests = yield* manifestTexts(root);
|
|
14702
|
+
const packages = pipe(manifests, Array.map(({ file, text }) => packageAt(file, text)));
|
|
14703
|
+
const found = yield* Effect.forEach(pipe(Array.getSomes(packages), Array.filter(({ directory }) => shippedChange(directory, changed))), (pack) => Effect.gen(function* compare() {
|
|
14704
|
+
const before = yield* files.readAtRevision(root, base.value, pack.file);
|
|
14705
|
+
const claimed = yield* files.readAtRevision(root, tip, pack.file);
|
|
14706
|
+
const floor = floorOf$1([versionAt(pack.name, before), versionAt(pack.name, claimed)]);
|
|
14707
|
+
return pipe(floor, Option.filter((lowest) => !semver.gt(pack.version, lowest)), Option.map((lowest) => ({
|
|
14708
|
+
file: files.join(root, pack.file),
|
|
14709
|
+
line: versionLine(pack.text),
|
|
14710
|
+
column: FIRST_COLUMN$1,
|
|
14711
|
+
rule: RULE$13,
|
|
14712
|
+
message: message(pack, lowest)
|
|
14713
|
+
})), Option.toArray);
|
|
14714
|
+
}), { concurrency: READ_CONCURRENCY$3 });
|
|
14494
14715
|
return Array.flatten(found);
|
|
14495
14716
|
});
|
|
14496
14717
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
@@ -14897,11 +15118,11 @@ const isRange = (specifier) => {
|
|
|
14897
15118
|
};
|
|
14898
15119
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14899
15120
|
file,
|
|
14900
|
-
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
15121
|
+
...positionOf(source)(offsetIn$1(source)(pattern(range))),
|
|
14901
15122
|
rule: RULE$8,
|
|
14902
15123
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14903
15124
|
})));
|
|
14904
|
-
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$
|
|
15125
|
+
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$2(name)}["']?:`, "mu");
|
|
14905
15126
|
const manifestProblems$2 = (entry, source) => problemsFor(entry.file, source, manifestPattern)(manifestSpecifiers(source));
|
|
14906
15127
|
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14907
15128
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
@@ -15410,6 +15631,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
15410
15631
|
checkAppliedPackages(root),
|
|
15411
15632
|
checkGitSubpath(root),
|
|
15412
15633
|
checkDowngrades(root),
|
|
15634
|
+
checkPackageVersions(root),
|
|
15413
15635
|
checkRenovateSettings(root),
|
|
15414
15636
|
checkCatalogEntries(root),
|
|
15415
15637
|
checkPackageRegistry(root)
|