@r_masseater/msch 0.65.1 → 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 +767 -506
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +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/{index-MUn1dolO.d.mts → index-CWZNFtdG.d.mts} +4 -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.d.mts +1 -1
- 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,18 +521,18 @@ 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
538
|
const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
|
|
@@ -538,13 +543,13 @@ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(r
|
|
|
538
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
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 */
|
|
@@ -553,13 +558,13 @@ const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRe
|
|
|
553
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
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 */
|
|
@@ -568,41 +573,41 @@ const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkType
|
|
|
568
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,38 +618,33 @@ 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/
|
|
617
|
-
const
|
|
618
|
-
const
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
const
|
|
626
|
-
|
|
627
|
-
const
|
|
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$22));
|
|
639
|
-
const SECTIONS = [
|
|
640
|
-
"dependencies",
|
|
641
|
-
"devDependencies",
|
|
642
|
-
"optionalDependencies"
|
|
643
|
-
];
|
|
621
|
+
// src/entities/package/model/published-manifest.ts
|
|
622
|
+
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
623
|
+
const PublishedManifestSchema = Schema.Struct({
|
|
624
|
+
name: Schema.optional(Schema.String),
|
|
625
|
+
private: Schema.optional(Schema.Boolean),
|
|
626
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
627
|
+
homepage: Schema.optional(Schema.Unknown),
|
|
628
|
+
repository: Schema.optional(Schema.Unknown)
|
|
629
|
+
});
|
|
630
|
+
const decodePublishedManifest = Schema.decodeUnknownOption(Schema.fromJsonString(PublishedManifestSchema));
|
|
631
|
+
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
632
|
+
const publishedManifestOf = (source) => pipe(source, Option.flatMap(decodePublishedManifest), Option.filter(isPublished$1));
|
|
644
633
|
/** @internal */
|
|
645
|
-
const
|
|
634
|
+
const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* scanPublishedManifests(root, problemsIn) {
|
|
635
|
+
const files = yield* RepositoryFiles;
|
|
636
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$8]);
|
|
637
|
+
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
638
|
+
name,
|
|
639
|
+
file: files.join(root, name)
|
|
640
|
+
}))), (entry, source) => pipe(publishedManifestOf(Option.some(source)), Option.map((manifest) => problemsIn({
|
|
641
|
+
entry,
|
|
642
|
+
source,
|
|
643
|
+
manifest
|
|
644
|
+
})), Option.getOrElse(() => [])));
|
|
645
|
+
});
|
|
646
646
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
647
|
-
const RULE$
|
|
647
|
+
const RULE$62 = "colocated-git-patterns";
|
|
648
648
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
649
649
|
const ROOT$3 = ".";
|
|
650
650
|
const NEGATION$1 = "!";
|
|
@@ -655,7 +655,7 @@ const LEADING_SLASHES = /^\/+/u;
|
|
|
655
655
|
const TRAILING_SLASHES = /\/+$/u;
|
|
656
656
|
const SPACES = /\s+/u;
|
|
657
657
|
const FIRST$22 = 1;
|
|
658
|
-
const READ_CONCURRENCY$
|
|
658
|
+
const READ_CONCURRENCY$34 = 16;
|
|
659
659
|
const withoutPrefix = (prefix, text) => {
|
|
660
660
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
661
661
|
return text;
|
|
@@ -691,7 +691,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
691
691
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
692
692
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
693
693
|
});
|
|
694
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
694
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$62)(entry.file, {
|
|
695
695
|
line: entry.line,
|
|
696
696
|
column: FIRST$22
|
|
697
697
|
}, message);
|
|
@@ -746,17 +746,17 @@ const repeated = (entries) => (entry) => {
|
|
|
746
746
|
/** @internal */
|
|
747
747
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
748
748
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
749
|
-
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 });
|
|
750
750
|
const entries = Array.flatten(read);
|
|
751
751
|
const workspaces = yield* workspaceDirectories(root);
|
|
752
|
-
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 });
|
|
753
753
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
754
754
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
755
755
|
});
|
|
756
756
|
// src/features/check-placement/model/colocated-tests.ts
|
|
757
|
-
const RULE$
|
|
757
|
+
const RULE$61 = "colocated-test";
|
|
758
758
|
const FIRST$21 = 1;
|
|
759
|
-
const READ_CONCURRENCY$
|
|
759
|
+
const READ_CONCURRENCY$33 = 64;
|
|
760
760
|
const ROOT_SUBPATH = ".";
|
|
761
761
|
const NAME_GROUP = "name";
|
|
762
762
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -769,20 +769,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
769
769
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
770
770
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
771
771
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
772
|
-
const EXCLUDED$
|
|
772
|
+
const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
773
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.";
|
|
774
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>.";
|
|
775
|
-
const Manifest$
|
|
775
|
+
const Manifest$7 = Schema.Struct({
|
|
776
776
|
name: Schema.optional(Schema.String),
|
|
777
777
|
exports: Schema.optional(Schema.Unknown)
|
|
778
778
|
});
|
|
779
|
-
const decodeManifest$
|
|
779
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
|
|
780
780
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
781
781
|
const problemFor$9 = (test, message) => ({
|
|
782
782
|
file: test.file,
|
|
783
783
|
line: FIRST$21,
|
|
784
784
|
column: FIRST$21,
|
|
785
|
-
rule: RULE$
|
|
785
|
+
rule: RULE$61,
|
|
786
786
|
message: `${test.base} ${message}`
|
|
787
787
|
});
|
|
788
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);
|
|
@@ -802,7 +802,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
802
802
|
if (Option.isNone(owner)) return [];
|
|
803
803
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
804
804
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
805
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
805
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(specifiersBeside({
|
|
806
806
|
join,
|
|
807
807
|
dirname: files.dirname,
|
|
808
808
|
directory: test.directory
|
|
@@ -830,7 +830,7 @@ const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
|
830
830
|
/** @internal */
|
|
831
831
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
832
832
|
const files = yield* RepositoryFiles;
|
|
833
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
833
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$7);
|
|
834
834
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
835
835
|
const context = {
|
|
836
836
|
root,
|
|
@@ -845,12 +845,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
845
845
|
directory: files.dirname(file)
|
|
846
846
|
};
|
|
847
847
|
}));
|
|
848
|
-
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 });
|
|
849
849
|
return Array.getSomes(found);
|
|
850
850
|
});
|
|
851
851
|
// src/shared/lib/agent-docs.ts
|
|
852
852
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
853
|
-
const READ_CONCURRENCY$
|
|
853
|
+
const READ_CONCURRENCY$32 = 16;
|
|
854
854
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
855
855
|
const files = yield* RepositoryFiles;
|
|
856
856
|
const listed = yield* files.listedFiles(root);
|
|
@@ -859,13 +859,13 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
859
859
|
const file = files.join(root, name);
|
|
860
860
|
const problemOf = Option.flatMap(problemIn(file));
|
|
861
861
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
862
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
862
|
+
}, { concurrency: READ_CONCURRENCY$32 });
|
|
863
863
|
return Array.getSomes(found);
|
|
864
864
|
});
|
|
865
865
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
866
866
|
const RECOMMENDED_LINES = 200;
|
|
867
867
|
const FIRST$20 = 1;
|
|
868
|
-
const RULE$
|
|
868
|
+
const RULE$60 = "agent-docs-length";
|
|
869
869
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
870
870
|
const problemFor$8 = (file) => (lines) => {
|
|
871
871
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -873,18 +873,18 @@ const problemFor$8 = (file) => (lines) => {
|
|
|
873
873
|
file,
|
|
874
874
|
line: 201,
|
|
875
875
|
column: FIRST$20,
|
|
876
|
-
rule: RULE$
|
|
876
|
+
rule: RULE$60,
|
|
877
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.`
|
|
878
878
|
});
|
|
879
879
|
};
|
|
880
880
|
/** @internal */
|
|
881
881
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
882
882
|
// src/features/check-placement/model/claude-link.ts
|
|
883
|
-
const RULE$
|
|
883
|
+
const RULE$59 = "claude-md-link";
|
|
884
884
|
const CLAUDE = "CLAUDE.md";
|
|
885
885
|
const AGENTS = "AGENTS.md";
|
|
886
886
|
const FIRST$19 = 1;
|
|
887
|
-
const READ_CONCURRENCY$
|
|
887
|
+
const READ_CONCURRENCY$31 = 16;
|
|
888
888
|
const MESSAGE$17 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
889
889
|
/** @internal */
|
|
890
890
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -899,20 +899,20 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
899
899
|
file: path,
|
|
900
900
|
line: FIRST$19,
|
|
901
901
|
column: FIRST$19,
|
|
902
|
-
rule: RULE$
|
|
902
|
+
rule: RULE$59,
|
|
903
903
|
message: MESSAGE$17
|
|
904
904
|
})));
|
|
905
905
|
});
|
|
906
906
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
907
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
907
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$31 });
|
|
908
908
|
return Array.getSomes(found);
|
|
909
909
|
});
|
|
910
910
|
// src/features/check-placement/model/dangling-links.ts
|
|
911
|
-
const RULE$
|
|
912
|
-
const SEPARATOR$
|
|
911
|
+
const RULE$58 = "dangling-link";
|
|
912
|
+
const SEPARATOR$21 = "/";
|
|
913
913
|
const FIRST$18 = 1;
|
|
914
|
-
const READ_CONCURRENCY$
|
|
915
|
-
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);
|
|
916
916
|
/** @internal */
|
|
917
917
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
918
918
|
const files = yield* RepositoryFiles;
|
|
@@ -924,18 +924,18 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
924
924
|
file,
|
|
925
925
|
line: FIRST$18,
|
|
926
926
|
column: FIRST$18,
|
|
927
|
-
rule: RULE$
|
|
927
|
+
rule: RULE$58,
|
|
928
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.`
|
|
929
929
|
})));
|
|
930
930
|
});
|
|
931
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
931
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$30 });
|
|
932
932
|
return Array.getSomes(found);
|
|
933
933
|
});
|
|
934
934
|
// src/features/check-placement/model/member-sources.ts
|
|
935
935
|
const ROOT_WORKSPACE$1 = ".";
|
|
936
936
|
const FIRST$17 = 1;
|
|
937
|
-
const SEPARATOR$
|
|
938
|
-
const EXCLUDED$
|
|
937
|
+
const SEPARATOR$20 = "/";
|
|
938
|
+
const EXCLUDED$6 = [
|
|
939
939
|
":(exclude,attr:linguist-vendored)",
|
|
940
940
|
":(exclude,attr:linguist-generated)",
|
|
941
941
|
":(exclude,attr:linguist-documentation)"
|
|
@@ -948,7 +948,7 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
948
948
|
const files = yield* RepositoryFiles;
|
|
949
949
|
return {
|
|
950
950
|
workspaces: yield* memberWorkspaces(root),
|
|
951
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$
|
|
951
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$6)
|
|
952
952
|
};
|
|
953
953
|
});
|
|
954
954
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
@@ -959,7 +959,7 @@ const fileProblem$1 = ({ file, rule, message }) => ({
|
|
|
959
959
|
rule,
|
|
960
960
|
message
|
|
961
961
|
});
|
|
962
|
-
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) => ({
|
|
963
963
|
workspace,
|
|
964
964
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
965
965
|
})));
|
|
@@ -982,9 +982,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
982
982
|
}));
|
|
983
983
|
});
|
|
984
984
|
// src/features/check-placement/model/deployed-readme.ts
|
|
985
|
-
const RULE$
|
|
986
|
-
const ROOT_DIRECTORY$
|
|
987
|
-
const READ_CONCURRENCY$
|
|
985
|
+
const RULE$57 = "deployed-readme";
|
|
986
|
+
const ROOT_DIRECTORY$4 = "";
|
|
987
|
+
const READ_CONCURRENCY$29 = 16;
|
|
988
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.";
|
|
989
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.";
|
|
990
990
|
const ADDRESS_KEYS = [
|
|
@@ -1022,14 +1022,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1022
1022
|
const readme = yield* readReadme({
|
|
1023
1023
|
root,
|
|
1024
1024
|
directory,
|
|
1025
|
-
rule: RULE$
|
|
1025
|
+
rule: RULE$57,
|
|
1026
1026
|
missingMessage: MISSING_MESSAGE$2
|
|
1027
1027
|
});
|
|
1028
1028
|
return Result.match(readme, {
|
|
1029
1029
|
onFailure: Option.some,
|
|
1030
1030
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
1031
1031
|
file,
|
|
1032
|
-
rule: RULE$
|
|
1032
|
+
rule: RULE$57,
|
|
1033
1033
|
message: NO_URL_MESSAGE
|
|
1034
1034
|
})))
|
|
1035
1035
|
});
|
|
@@ -1040,16 +1040,16 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
1040
1040
|
const listed = yield* files.listedFiles(root);
|
|
1041
1041
|
const directories = yield* workspaceDirectories(root);
|
|
1042
1042
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
1043
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
1044
|
-
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$
|
|
1045
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1043
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$29 });
|
|
1044
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array.dedupe);
|
|
1045
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$29 });
|
|
1046
1046
|
return Array.getSomes(found);
|
|
1047
1047
|
});
|
|
1048
1048
|
// src/features/check-placement/model/nested-docs.ts
|
|
1049
|
-
const RULE$
|
|
1049
|
+
const RULE$56 = "nested-docs";
|
|
1050
1050
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
1051
|
-
const SEPARATOR$
|
|
1052
|
-
const READ_CONCURRENCY$
|
|
1051
|
+
const SEPARATOR$19 = "/";
|
|
1052
|
+
const READ_CONCURRENCY$28 = 64;
|
|
1053
1053
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1054
1054
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1055
1055
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
@@ -1058,8 +1058,8 @@ const MISSING_RULE = "workspace-agents-md";
|
|
|
1058
1058
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1059
1059
|
const taggedError$6 = Schema.TaggedError;
|
|
1060
1060
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1061
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1062
|
-
const problemFor$7 = problemInFile(RULE$
|
|
1061
|
+
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
1062
|
+
const problemFor$7 = problemInFile(RULE$56);
|
|
1063
1063
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1064
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.";
|
|
1065
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.";
|
|
@@ -1106,7 +1106,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1106
1106
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
1107
1107
|
workspaceAgentDocs
|
|
1108
1108
|
};
|
|
1109
|
-
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 });
|
|
1110
1110
|
const missing = missingProblems({
|
|
1111
1111
|
required: workspaceAgentDocs,
|
|
1112
1112
|
directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
|
|
@@ -1116,15 +1116,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1116
1116
|
return [...Array.getSomes(found), ...missing];
|
|
1117
1117
|
});
|
|
1118
1118
|
// src/features/check-placement/model/published-readme.ts
|
|
1119
|
-
const RULE$
|
|
1120
|
-
const READ_CONCURRENCY$
|
|
1119
|
+
const RULE$55 = "published-readme";
|
|
1120
|
+
const READ_CONCURRENCY$27 = 16;
|
|
1121
1121
|
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1122
1122
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
1123
1123
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
1124
1124
|
const readme = yield* readReadme({
|
|
1125
1125
|
root,
|
|
1126
1126
|
directory,
|
|
1127
|
-
rule: RULE$
|
|
1127
|
+
rule: RULE$55,
|
|
1128
1128
|
missingMessage: MISSING_MESSAGE
|
|
1129
1129
|
});
|
|
1130
1130
|
return Result.match(readme, {
|
|
@@ -1135,7 +1135,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1135
1135
|
file,
|
|
1136
1136
|
line,
|
|
1137
1137
|
column,
|
|
1138
|
-
rule: RULE$
|
|
1138
|
+
rule: RULE$55,
|
|
1139
1139
|
message: MESSAGE$16
|
|
1140
1140
|
};
|
|
1141
1141
|
}))
|
|
@@ -1144,11 +1144,11 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1144
1144
|
/** @internal */
|
|
1145
1145
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
1146
1146
|
const projects = yield* publishedProjects(root);
|
|
1147
|
-
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 });
|
|
1148
1148
|
return Array.getSomes(found);
|
|
1149
1149
|
});
|
|
1150
1150
|
// src/features/check-placement/model/published-tests.ts
|
|
1151
|
-
const RULE$
|
|
1151
|
+
const RULE$54 = "published-tests";
|
|
1152
1152
|
const MANIFEST_FILE$2 = "package.json";
|
|
1153
1153
|
const FILE_START = 1;
|
|
1154
1154
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -1163,7 +1163,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1163
1163
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1164
1164
|
line: FILE_START,
|
|
1165
1165
|
column: FILE_START,
|
|
1166
|
-
rule: RULE$
|
|
1166
|
+
rule: RULE$54,
|
|
1167
1167
|
message: MESSAGE$15
|
|
1168
1168
|
});
|
|
1169
1169
|
});
|
|
@@ -1177,13 +1177,13 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1177
1177
|
return Array.getSomes(found);
|
|
1178
1178
|
});
|
|
1179
1179
|
// src/features/check-placement/model/root-docs.ts
|
|
1180
|
-
const RULE$
|
|
1181
|
-
const SEPARATOR$
|
|
1180
|
+
const RULE$53 = "root-docs";
|
|
1181
|
+
const SEPARATOR$18 = "/";
|
|
1182
1182
|
const FIRST$16 = 1;
|
|
1183
1183
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1184
1184
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1185
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.";
|
|
1186
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
1186
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1187
1187
|
/** @internal */
|
|
1188
1188
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1189
1189
|
const files = yield* RepositoryFiles;
|
|
@@ -1192,18 +1192,18 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1192
1192
|
file: files.join(root, name),
|
|
1193
1193
|
line: FIRST$16,
|
|
1194
1194
|
column: FIRST$16,
|
|
1195
|
-
rule: RULE$
|
|
1195
|
+
rule: RULE$53,
|
|
1196
1196
|
message: `${name} ${MESSAGE$14}`
|
|
1197
1197
|
})));
|
|
1198
1198
|
});
|
|
1199
1199
|
// src/features/check-placement/model/root-readme.ts
|
|
1200
|
-
const RULE$
|
|
1200
|
+
const RULE$52 = "root-readme";
|
|
1201
1201
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1202
|
-
const READ_CONCURRENCY$
|
|
1203
|
-
const START$
|
|
1202
|
+
const READ_CONCURRENCY$26 = 16;
|
|
1203
|
+
const START$24 = 0;
|
|
1204
1204
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1205
1205
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1206
|
-
const RELATIVE$
|
|
1206
|
+
const RELATIVE$2 = /^\.\//u;
|
|
1207
1207
|
const MarketplacePlugin = Schema.Struct({
|
|
1208
1208
|
name: Schema.optional(Schema.String),
|
|
1209
1209
|
source: Schema.Unknown
|
|
@@ -1214,9 +1214,9 @@ const NO_PLUGINS = {
|
|
|
1214
1214
|
names: []
|
|
1215
1215
|
};
|
|
1216
1216
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1217
|
-
const messageFor = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
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.`;
|
|
1218
1218
|
const pluginsOf = (plugins) => {
|
|
1219
|
-
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, "")));
|
|
1220
1220
|
const segments = pipe(directories, Array.map(baseName));
|
|
1221
1221
|
return {
|
|
1222
1222
|
directories,
|
|
@@ -1238,10 +1238,10 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1238
1238
|
onSome: () => [directory]
|
|
1239
1239
|
}));
|
|
1240
1240
|
const problemsIn$19 = (file, source, plugins) => (workspace) => {
|
|
1241
|
-
const message = messageFor(workspace.directory);
|
|
1241
|
+
const message = messageFor$1(workspace.directory);
|
|
1242
1242
|
const at = positionOf(source);
|
|
1243
1243
|
const pattern = patternFor(plugins)(workspace);
|
|
1244
|
-
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)));
|
|
1245
1245
|
};
|
|
1246
1246
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1247
1247
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
@@ -1258,7 +1258,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1258
1258
|
const named = yield* namedWorkspaces(root);
|
|
1259
1259
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1260
1260
|
const plugins = yield* marketplacePlugins(root);
|
|
1261
|
-
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 });
|
|
1262
1262
|
return Array.flatten(found);
|
|
1263
1263
|
});
|
|
1264
1264
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -1278,10 +1278,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1278
1278
|
return Array.flatten(found);
|
|
1279
1279
|
});
|
|
1280
1280
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1281
|
-
const RULE$
|
|
1281
|
+
const RULE$51 = "docs-mirror";
|
|
1282
1282
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1283
1283
|
const MIRROR_LIMIT = 3;
|
|
1284
|
-
const READ_CONCURRENCY$
|
|
1284
|
+
const READ_CONCURRENCY$25 = 16;
|
|
1285
1285
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
1286
1286
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
1287
1287
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -1303,7 +1303,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
1303
1303
|
file,
|
|
1304
1304
|
line,
|
|
1305
1305
|
column,
|
|
1306
|
-
rule: RULE$
|
|
1306
|
+
rule: RULE$51,
|
|
1307
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.`
|
|
1308
1308
|
};
|
|
1309
1309
|
}), Option.toArray);
|
|
@@ -1318,7 +1318,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
1318
1318
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
1319
1319
|
directory,
|
|
1320
1320
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
1321
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1321
|
+
}))), { concurrency: READ_CONCURRENCY$25 });
|
|
1322
1322
|
});
|
|
1323
1323
|
/** @internal */
|
|
1324
1324
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1331,11 +1331,11 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1331
1331
|
onNone: () => [],
|
|
1332
1332
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
1333
1333
|
})));
|
|
1334
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1334
|
+
}, { concurrency: READ_CONCURRENCY$25 });
|
|
1335
1335
|
return Array.flatten(found);
|
|
1336
1336
|
});
|
|
1337
1337
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1338
|
-
const RULE$
|
|
1338
|
+
const RULE$50 = "ignored-sources";
|
|
1339
1339
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1340
1340
|
const FIRST$15 = 1;
|
|
1341
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.";
|
|
@@ -1347,7 +1347,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1347
1347
|
file: files.join(root, file),
|
|
1348
1348
|
line: FIRST$15,
|
|
1349
1349
|
column: FIRST$15,
|
|
1350
|
-
rule: RULE$
|
|
1350
|
+
rule: RULE$50,
|
|
1351
1351
|
message: MESSAGE$13
|
|
1352
1352
|
})));
|
|
1353
1353
|
});
|
|
@@ -9895,7 +9895,7 @@ var english_verbs_default = [
|
|
|
9895
9895
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
9896
9896
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
9897
9897
|
const SEGMENT_RULE = "slice-segment-name";
|
|
9898
|
-
const SEPARATOR$
|
|
9898
|
+
const SEPARATOR$16 = "/";
|
|
9899
9899
|
const NEXT$3 = 1;
|
|
9900
9900
|
const WORD_SEPARATOR$1 = "-";
|
|
9901
9901
|
const MINIMUM_WORDS = 2;
|
|
@@ -9921,7 +9921,7 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
9921
9921
|
return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
|
|
9922
9922
|
};
|
|
9923
9923
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
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$
|
|
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}`));
|
|
9925
9925
|
const SLICE_LAYERS = [
|
|
9926
9926
|
"features",
|
|
9927
9927
|
"entities",
|
|
@@ -9929,26 +9929,26 @@ const SLICE_LAYERS = [
|
|
|
9929
9929
|
"pages"
|
|
9930
9930
|
];
|
|
9931
9931
|
const SLICE_DEPTHS = [3, 4];
|
|
9932
|
-
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$
|
|
9932
|
+
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$16);
|
|
9933
9933
|
const isInSliceLayer = (parts) => {
|
|
9934
9934
|
const [source, layer] = parts;
|
|
9935
|
-
return `${source}${SEPARATOR$
|
|
9935
|
+
return `${source}${SEPARATOR$16}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
|
|
9936
9936
|
};
|
|
9937
9937
|
const indexedSlice = (owned) => {
|
|
9938
|
-
const parts = String$1.split(owned.inner, SEPARATOR$
|
|
9938
|
+
const parts = String$1.split(owned.inner, SEPARATOR$16);
|
|
9939
9939
|
const depth = parts.length - NEXT$3;
|
|
9940
|
-
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)}`));
|
|
9941
9941
|
};
|
|
9942
9942
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
9943
|
-
const parts = String$1.split(inner, SEPARATOR$
|
|
9944
|
-
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)}`);
|
|
9945
9945
|
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
9946
|
-
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)}`));
|
|
9947
9947
|
};
|
|
9948
9948
|
const deployNamed = ({ workspace, inner }) => {
|
|
9949
9949
|
if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
|
|
9950
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
9951
|
-
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)}`));
|
|
9952
9952
|
};
|
|
9953
9953
|
/** @internal */
|
|
9954
9954
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -9991,8 +9991,8 @@ const LAYER_ITEMS = [
|
|
|
9991
9991
|
"attribute_item",
|
|
9992
9992
|
"inner_attribute_item"
|
|
9993
9993
|
];
|
|
9994
|
-
const READ_CONCURRENCY$
|
|
9995
|
-
const EXCLUDED$
|
|
9994
|
+
const READ_CONCURRENCY$24 = 64;
|
|
9995
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9996
9996
|
const NONE$1 = [];
|
|
9997
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.";
|
|
9998
9998
|
const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
|
|
@@ -10053,7 +10053,7 @@ const isRead = ({ inner }) => {
|
|
|
10053
10053
|
};
|
|
10054
10054
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
10055
10055
|
const files = yield* RepositoryFiles;
|
|
10056
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
10056
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$5);
|
|
10057
10057
|
const owner = crateOf(crateDirectories(listed));
|
|
10058
10058
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
10059
10059
|
...owned,
|
|
@@ -10067,17 +10067,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10067
10067
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$1;
|
|
10068
10068
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
10069
10069
|
const parse = parsedWith(language);
|
|
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$
|
|
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 });
|
|
10071
10071
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10072
10072
|
});
|
|
10073
10073
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10074
|
-
const RULE$
|
|
10074
|
+
const RULE$49 = "shadcn-ui-alias";
|
|
10075
10075
|
const FIRST$14 = 1;
|
|
10076
|
-
const problemOf$
|
|
10076
|
+
const problemOf$9 = (directory, { file, alias }) => ({
|
|
10077
10077
|
file,
|
|
10078
10078
|
line: FIRST$14,
|
|
10079
10079
|
column: FIRST$14,
|
|
10080
|
-
rule: RULE$
|
|
10080
|
+
rule: RULE$49,
|
|
10081
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/*".`
|
|
10082
10082
|
});
|
|
10083
10083
|
/** @internal */
|
|
@@ -10089,7 +10089,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
|
|
|
10089
10089
|
onNone: () => Effect.succeed(false),
|
|
10090
10090
|
onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
|
|
10091
10091
|
})) return Array.empty();
|
|
10092
|
-
return [problemOf$
|
|
10092
|
+
return [problemOf$9(directory, found.value)];
|
|
10093
10093
|
});
|
|
10094
10094
|
// src/features/check-placement/model/source-aliases.ts
|
|
10095
10095
|
const ALIAS_RULE = "source-alias";
|
|
@@ -10097,8 +10097,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
10097
10097
|
const SOURCE_TARGET = "./src/*";
|
|
10098
10098
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10099
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.`;
|
|
10100
|
-
const Manifest$
|
|
10101
|
-
const decodeManifest$
|
|
10100
|
+
const Manifest$6 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10101
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
10102
10102
|
const targetsOf = (target) => {
|
|
10103
10103
|
if (Predicate.isString(target)) return [target];
|
|
10104
10104
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10109,7 +10109,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10109
10109
|
const files = yield* RepositoryFiles;
|
|
10110
10110
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10111
10111
|
const text = yield* files.readFile(manifest);
|
|
10112
|
-
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}`)));
|
|
10113
10113
|
});
|
|
10114
10114
|
/** @internal */
|
|
10115
10115
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10140,19 +10140,19 @@ const SCRIPTS = "scripts-directory";
|
|
|
10140
10140
|
const BIN = "bin";
|
|
10141
10141
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
10142
10142
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
10143
|
-
const SEPARATOR$
|
|
10143
|
+
const SEPARATOR$15 = "/";
|
|
10144
10144
|
const CURRENT = "./";
|
|
10145
|
-
const READ_CONCURRENCY$
|
|
10145
|
+
const READ_CONCURRENCY$23 = 8;
|
|
10146
10146
|
const FIRST$13 = 1;
|
|
10147
10147
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
10148
10148
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
10149
10149
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
10150
|
-
const Manifest$
|
|
10150
|
+
const Manifest$5 = Schema.Struct({
|
|
10151
10151
|
bin: Schema.optional(Schema.Unknown),
|
|
10152
10152
|
main: Schema.optional(Schema.Unknown),
|
|
10153
10153
|
exports: Schema.optional(Schema.Unknown)
|
|
10154
10154
|
});
|
|
10155
|
-
const decodeManifest$
|
|
10155
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
10156
10156
|
const NO_ENTRIES = {
|
|
10157
10157
|
all: [],
|
|
10158
10158
|
bins: []
|
|
@@ -10177,22 +10177,22 @@ const entriesOf$2 = (manifest) => {
|
|
|
10177
10177
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10178
10178
|
const files = yield* RepositoryFiles;
|
|
10179
10179
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10180
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10180
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10181
10181
|
});
|
|
10182
10182
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10183
10183
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
10184
10184
|
const files = yield* RepositoryFiles;
|
|
10185
10185
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
10186
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
10186
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$15}${name}`), Array.filter(isCommand$1));
|
|
10187
10187
|
});
|
|
10188
10188
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
10189
10189
|
const files = yield* RepositoryFiles;
|
|
10190
10190
|
const listed = yield* files.listedFiles(root);
|
|
10191
10191
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
10192
|
-
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 });
|
|
10193
10193
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
10194
10194
|
});
|
|
10195
|
-
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));
|
|
10196
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 }) => ({
|
|
10197
10197
|
file,
|
|
10198
10198
|
...positionOf(source)(start),
|
|
@@ -10239,26 +10239,199 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10239
10239
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10240
10240
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10241
10241
|
const workflows = yield* workflowText(root);
|
|
10242
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$18(root, directory, workflows), { concurrency: READ_CONCURRENCY$
|
|
10243
|
-
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 });
|
|
10244
10244
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10245
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
|
+
});
|
|
10246
10419
|
// src/features/check-repository-layout/model/crates.ts
|
|
10247
|
-
const RULE$
|
|
10420
|
+
const RULE$47 = "unverified-crate";
|
|
10248
10421
|
const VERSION_RULE = "release-version";
|
|
10249
10422
|
const MANIFEST_FILE$1 = "package.json";
|
|
10250
10423
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10251
10424
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
10252
10425
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10253
10426
|
const SEPARATOR$12 = "/";
|
|
10254
|
-
const FIRST$
|
|
10255
|
-
const READ_CONCURRENCY$
|
|
10427
|
+
const FIRST$11 = 1;
|
|
10428
|
+
const READ_CONCURRENCY$21 = 8;
|
|
10256
10429
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10257
10430
|
const problemFor$4 = (crate, message) => ({
|
|
10258
10431
|
file: crate.manifest,
|
|
10259
|
-
line: FIRST$
|
|
10260
|
-
column: FIRST$
|
|
10261
|
-
rule: RULE$
|
|
10432
|
+
line: FIRST$11,
|
|
10433
|
+
column: FIRST$11,
|
|
10434
|
+
rule: RULE$47,
|
|
10262
10435
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10263
10436
|
});
|
|
10264
10437
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10278,8 +10451,8 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
10278
10451
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
10279
10452
|
return Option.some({
|
|
10280
10453
|
file: crate.manifest,
|
|
10281
|
-
line: FIRST$
|
|
10282
|
-
column: FIRST$
|
|
10454
|
+
line: FIRST$11,
|
|
10455
|
+
column: FIRST$11,
|
|
10283
10456
|
rule: VERSION_RULE,
|
|
10284
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.`
|
|
10285
10458
|
});
|
|
@@ -10290,11 +10463,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10290
10463
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10291
10464
|
const directories = yield* workspaceDirectories(root);
|
|
10292
10465
|
const crates = yield* cratesIn(root);
|
|
10293
|
-
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 });
|
|
10294
10467
|
return Array.getSomes(Array.flatten(found));
|
|
10295
10468
|
});
|
|
10296
10469
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10297
|
-
const RULE$
|
|
10470
|
+
const RULE$46 = "deploy-entry-pattern";
|
|
10298
10471
|
const FALLOW_KEYS = [
|
|
10299
10472
|
"entry",
|
|
10300
10473
|
"entryPoints",
|
|
@@ -10312,7 +10485,7 @@ const NEGATED = "!";
|
|
|
10312
10485
|
const ROOT_WORKSPACE = ".";
|
|
10313
10486
|
const WRAP_OFFSET$1 = 1;
|
|
10314
10487
|
const NO_OFFSET = 0;
|
|
10315
|
-
const READ_CONCURRENCY$
|
|
10488
|
+
const READ_CONCURRENCY$20 = 8;
|
|
10316
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.";
|
|
10317
10490
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10318
10491
|
const FALLOW = {
|
|
@@ -10349,7 +10522,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10349
10522
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10350
10523
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10351
10524
|
});
|
|
10352
|
-
const problemsIn$
|
|
10525
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10353
10526
|
const { root, file, kind, workspaces, entries } = request;
|
|
10354
10527
|
const files = yield* RepositoryFiles;
|
|
10355
10528
|
const path = files.join(root, file);
|
|
@@ -10365,7 +10538,7 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10365
10538
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10366
10539
|
file: path,
|
|
10367
10540
|
...positionOf(text.value)(start - kind.offset),
|
|
10368
|
-
rule: RULE$
|
|
10541
|
+
rule: RULE$46,
|
|
10369
10542
|
message: `${pattern} ${MESSAGE$12}`
|
|
10370
10543
|
})));
|
|
10371
10544
|
});
|
|
@@ -10388,27 +10561,27 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10388
10561
|
}];
|
|
10389
10562
|
return [];
|
|
10390
10563
|
}));
|
|
10391
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10564
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$16({
|
|
10392
10565
|
root,
|
|
10393
10566
|
file,
|
|
10394
10567
|
kind,
|
|
10395
10568
|
workspaces,
|
|
10396
10569
|
entries
|
|
10397
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10570
|
+
}), { concurrency: READ_CONCURRENCY$20 });
|
|
10398
10571
|
return Array.flatten(found);
|
|
10399
10572
|
});
|
|
10400
10573
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10401
|
-
const RULE$
|
|
10574
|
+
const RULE$45 = "listed-entry";
|
|
10402
10575
|
const ENTRY_KEYS = [
|
|
10403
10576
|
"entry",
|
|
10404
10577
|
"entryPoints",
|
|
10405
10578
|
"supportEntry"
|
|
10406
10579
|
];
|
|
10407
10580
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
10408
|
-
const WILDCARD$
|
|
10581
|
+
const WILDCARD$2 = /[*?{[]/u;
|
|
10409
10582
|
const SEPARATOR$11 = "/";
|
|
10410
10583
|
const WRAP_OFFSET = 1;
|
|
10411
|
-
const READ_CONCURRENCY$
|
|
10584
|
+
const READ_CONCURRENCY$19 = 8;
|
|
10412
10585
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10413
10586
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10414
10587
|
const entryPatternsIn = (node) => {
|
|
@@ -10418,8 +10591,8 @@ const entryPatternsIn = (node) => {
|
|
|
10418
10591
|
})));
|
|
10419
10592
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10420
10593
|
};
|
|
10421
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$
|
|
10422
|
-
const problemsIn$
|
|
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);
|
|
10595
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10423
10596
|
const files = yield* RepositoryFiles;
|
|
10424
10597
|
const path = files.join(root, file);
|
|
10425
10598
|
const text = yield* files.readFile(path);
|
|
@@ -10428,7 +10601,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10428
10601
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10429
10602
|
file: path,
|
|
10430
10603
|
...positionOf(text.value)(start),
|
|
10431
|
-
rule: RULE$
|
|
10604
|
+
rule: RULE$45,
|
|
10432
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.`
|
|
10433
10606
|
})));
|
|
10434
10607
|
});
|
|
@@ -10436,15 +10609,15 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10436
10609
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10437
10610
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10438
10611
|
const directories = yield* workspaceDirectories(root);
|
|
10439
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
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 });
|
|
10440
10613
|
return Array.flatten(found);
|
|
10441
10614
|
});
|
|
10442
10615
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10443
|
-
const RULE$
|
|
10616
|
+
const RULE$44 = "root-workspace-path";
|
|
10444
10617
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10445
10618
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10446
10619
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10447
|
-
const FIRST$
|
|
10620
|
+
const FIRST$10 = 0;
|
|
10448
10621
|
const NEXT$2 = 1;
|
|
10449
10622
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10450
10623
|
const mentions = (directory) => (text) => {
|
|
@@ -10452,14 +10625,14 @@ const mentions = (directory) => (text) => {
|
|
|
10452
10625
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10453
10626
|
const before = parts[index] ?? "";
|
|
10454
10627
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10455
|
-
const following = String$1.slice(FIRST$
|
|
10628
|
+
const following = String$1.slice(FIRST$10, NEXT$2)(after);
|
|
10456
10629
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10457
10630
|
}));
|
|
10458
10631
|
};
|
|
10459
|
-
const problemsIn$
|
|
10632
|
+
const problemsIn$14 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10460
10633
|
file,
|
|
10461
10634
|
...positionOf(source)(found.start),
|
|
10462
|
-
rule: RULE$
|
|
10635
|
+
rule: RULE$44,
|
|
10463
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.`
|
|
10464
10637
|
})));
|
|
10465
10638
|
/** @internal */
|
|
@@ -10470,13 +10643,13 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10470
10643
|
if (Option.isNone(source)) return [];
|
|
10471
10644
|
const directories = yield* workspaceDirectories(root);
|
|
10472
10645
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10473
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10646
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$14(file, source.value, directories)));
|
|
10474
10647
|
});
|
|
10475
10648
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10476
|
-
const RULE$
|
|
10649
|
+
const RULE$43 = "hidden-verify";
|
|
10477
10650
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10478
|
-
const FIRST$
|
|
10479
|
-
const READ_CONCURRENCY$
|
|
10651
|
+
const FIRST$9 = 1;
|
|
10652
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10480
10653
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10481
10654
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10482
10655
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10485,21 +10658,21 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10485
10658
|
const verified = yield* hasVerifyTask(file);
|
|
10486
10659
|
return Option.some({
|
|
10487
10660
|
file,
|
|
10488
|
-
line: FIRST$
|
|
10489
|
-
column: FIRST$
|
|
10490
|
-
rule: RULE$
|
|
10661
|
+
line: FIRST$9,
|
|
10662
|
+
column: FIRST$9,
|
|
10663
|
+
rule: RULE$43,
|
|
10491
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}.`
|
|
10492
10665
|
}).pipe(Option.filter(() => verified));
|
|
10493
10666
|
});
|
|
10494
10667
|
/** @internal */
|
|
10495
10668
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10496
10669
|
const directories = yield* workspaceDirectories(root);
|
|
10497
|
-
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 });
|
|
10498
10671
|
return Array.getSomes(found);
|
|
10499
10672
|
});
|
|
10500
10673
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10501
|
-
const RULE$
|
|
10502
|
-
const READ_CONCURRENCY$
|
|
10674
|
+
const RULE$42 = "shared-uncached-task";
|
|
10675
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10503
10676
|
const SHARED = 2;
|
|
10504
10677
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10505
10678
|
const UncachedTask = Schema.Struct({
|
|
@@ -10541,19 +10714,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10541
10714
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10542
10715
|
file,
|
|
10543
10716
|
...position,
|
|
10544
|
-
rule: RULE$
|
|
10717
|
+
rule: RULE$42,
|
|
10545
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.`
|
|
10546
10719
|
})));
|
|
10547
10720
|
};
|
|
10548
10721
|
/** @internal */
|
|
10549
10722
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10550
10723
|
const directories = yield* workspaceDirectories(root);
|
|
10551
|
-
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 });
|
|
10552
10725
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10553
10726
|
});
|
|
10554
10727
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10555
|
-
const RULE$
|
|
10556
|
-
const READ_CONCURRENCY$
|
|
10728
|
+
const RULE$41 = "unlocked-task";
|
|
10729
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10557
10730
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10558
10731
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10559
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))));
|
|
@@ -10564,13 +10737,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10564
10737
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10565
10738
|
file,
|
|
10566
10739
|
...positionOf(source)(task.start),
|
|
10567
|
-
rule: RULE$
|
|
10740
|
+
rule: RULE$41,
|
|
10568
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.`
|
|
10569
10742
|
})), Option.toArray)));
|
|
10570
10743
|
/** @internal */
|
|
10571
10744
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10572
10745
|
const directories = yield* workspaceDirectories(root);
|
|
10573
|
-
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 });
|
|
10574
10747
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10575
10748
|
});
|
|
10576
10749
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10661,7 +10834,7 @@ const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
|
|
|
10661
10834
|
const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
|
|
10662
10835
|
const globsIn = (field, node) => pipe(itemsOf(node), Array.flatMap((item) => Option.toArray(stringOf(item))), Array.filter(isPositive), Array.flatMap(reference("glob", field)));
|
|
10663
10836
|
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
10664
|
-
const directoryOf$
|
|
10837
|
+
const directoryOf$2 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$2, text)), Option.getOrElse(() => base));
|
|
10665
10838
|
const located = (kind, field, base = ROOT$2) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
|
|
10666
10839
|
const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL$1)(text)));
|
|
10667
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)({
|
|
@@ -10678,7 +10851,7 @@ const fileInputsIn = (field, step) => pipe(entriesOf$1(childOf("with")(step)), A
|
|
|
10678
10851
|
const stepReferences = (job, base) => (step, index) => {
|
|
10679
10852
|
const field = `jobs.${job}.steps[${index}]`;
|
|
10680
10853
|
const own = stringOf(childOf("working-directory")(step));
|
|
10681
|
-
const directory = directoryOf$
|
|
10854
|
+
const directory = directoryOf$2(own, base);
|
|
10682
10855
|
return [
|
|
10683
10856
|
...located("action", `${field}.uses`)(localUses(step)),
|
|
10684
10857
|
...located("directory", `${field}.working-directory`)(own),
|
|
@@ -10689,7 +10862,7 @@ const stepReferences = (job, base) => (step, index) => {
|
|
|
10689
10862
|
const jobReferences = (base) => ([job, node]) => {
|
|
10690
10863
|
const own = workingDirectoryOf(node);
|
|
10691
10864
|
const steps = itemsOf(childOf("steps")(node));
|
|
10692
|
-
const directory = directoryOf$
|
|
10865
|
+
const directory = directoryOf$2(own, base);
|
|
10693
10866
|
return [
|
|
10694
10867
|
...located("file", `jobs.${job}.uses`)(localUses(node)),
|
|
10695
10868
|
...located("directory", `jobs.${job}.defaults.run.working-directory`)(own),
|
|
@@ -10706,7 +10879,7 @@ const jobsOf = (source) => entriesOf$1(childOf("jobs")(parseDocument(source).con
|
|
|
10706
10879
|
const workflowReferences = (source) => {
|
|
10707
10880
|
const root = parseDocument(source).contents;
|
|
10708
10881
|
const workflowDefault = workingDirectoryOf(root);
|
|
10709
|
-
const base = directoryOf$
|
|
10882
|
+
const base = directoryOf$2(workflowDefault, ROOT$2);
|
|
10710
10883
|
return [
|
|
10711
10884
|
...pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(filtersOf)),
|
|
10712
10885
|
...located("directory", "defaults.run.working-directory")(workflowDefault),
|
|
@@ -10719,13 +10892,11 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10719
10892
|
/** @internal */
|
|
10720
10893
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10721
10894
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10722
|
-
const RULE$
|
|
10895
|
+
const RULE$40 = "workflow-path";
|
|
10723
10896
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10724
10897
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10725
|
-
const READ_CONCURRENCY$
|
|
10726
|
-
const WILDCARD$2 = /[*?[]/u;
|
|
10898
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10727
10899
|
const SEPARATOR$9 = "/";
|
|
10728
|
-
const FIRST$9 = 0;
|
|
10729
10900
|
const EXPECTED = {
|
|
10730
10901
|
action: "a directory with action.yml",
|
|
10731
10902
|
directory: "a directory",
|
|
@@ -10738,16 +10909,7 @@ const matchesAny = Effect.fn("matchesAny")(function* matchesAny(root, pathspecs)
|
|
|
10738
10909
|
const matched = yield* (yield* RepositoryFiles).matchingFiles(root, pathspecs);
|
|
10739
10910
|
return Array.isReadonlyArrayNonEmpty(matched);
|
|
10740
10911
|
});
|
|
10741
|
-
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
10742
|
-
const files = yield* RepositoryFiles;
|
|
10743
|
-
return yield* files.exists(files.join(root, path));
|
|
10744
|
-
});
|
|
10745
10912
|
const matchesGlob = (root, path) => matchesAny(root, [`:(glob)${path}`]);
|
|
10746
|
-
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
10747
|
-
const files = yield* RepositoryFiles;
|
|
10748
|
-
const directory = yield* files.isDirectory(files.join(root, path));
|
|
10749
|
-
return Option.getOrElse(directory, () => false);
|
|
10750
|
-
});
|
|
10751
10913
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
10752
10914
|
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$9}${name}`), { concurrency: 1 });
|
|
10753
10915
|
return pipe(found, Array.some(Boolean));
|
|
@@ -10764,17 +10926,6 @@ const RESOLVERS = {
|
|
|
10764
10926
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
10765
10927
|
})
|
|
10766
10928
|
};
|
|
10767
|
-
const staticPrefix = (path) => {
|
|
10768
|
-
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10769
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
|
|
10770
|
-
return prefix;
|
|
10771
|
-
};
|
|
10772
|
-
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
10773
|
-
const prefix = staticPrefix(path);
|
|
10774
|
-
if (String$1.isEmpty(prefix)) return false;
|
|
10775
|
-
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
10776
|
-
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10777
|
-
});
|
|
10778
10929
|
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$9}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$9}`)(path);
|
|
10779
10930
|
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
10780
10931
|
const prefix = staticPrefix(found.path);
|
|
@@ -10785,10 +10936,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10785
10936
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10786
10937
|
file,
|
|
10787
10938
|
...positionOf(source)(found.offset),
|
|
10788
|
-
rule: RULE$
|
|
10939
|
+
rule: RULE$40,
|
|
10789
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.`
|
|
10790
10941
|
});
|
|
10791
|
-
const problemsIn$
|
|
10942
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10792
10943
|
const files = yield* RepositoryFiles;
|
|
10793
10944
|
const file = files.join(root, workflow);
|
|
10794
10945
|
const source = yield* files.readFile(file);
|
|
@@ -10800,7 +10951,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10800
10951
|
/** @internal */
|
|
10801
10952
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10802
10953
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10803
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10954
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$15 });
|
|
10804
10955
|
return Array.flatten(found);
|
|
10805
10956
|
});
|
|
10806
10957
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10811,8 +10962,8 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10811
10962
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10812
10963
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10813
10964
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10814
|
-
const START$
|
|
10815
|
-
const READ_CONCURRENCY$
|
|
10965
|
+
const START$21 = 0;
|
|
10966
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10816
10967
|
const SEPARATOR$8 = "/";
|
|
10817
10968
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10818
10969
|
const SPACE = " ";
|
|
@@ -10842,7 +10993,7 @@ const namesIn$1 = (name, source) => {
|
|
|
10842
10993
|
return [
|
|
10843
10994
|
{
|
|
10844
10995
|
text: name,
|
|
10845
|
-
offset: START$
|
|
10996
|
+
offset: START$21
|
|
10846
10997
|
},
|
|
10847
10998
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10848
10999
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10891,7 +11042,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10891
11042
|
name: stem,
|
|
10892
11043
|
source: text
|
|
10893
11044
|
})]), Option.getOrElse(() => []));
|
|
10894
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
11045
|
+
}), { concurrency: READ_CONCURRENCY$14 });
|
|
10895
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(() => []))));
|
|
10896
11047
|
return [...Array.flatten(found), ...actions];
|
|
10897
11048
|
});
|
|
@@ -10900,6 +11051,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10900
11051
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
10901
11052
|
const found = yield* Effect.all([
|
|
10902
11053
|
checkCommandEntries(root),
|
|
11054
|
+
checkConfigPaths(root),
|
|
10903
11055
|
checkCrates(root),
|
|
10904
11056
|
checkDeployEntryPatterns(root),
|
|
10905
11057
|
checkFallowEntries(root),
|
|
@@ -11021,14 +11173,14 @@ const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(a
|
|
|
11021
11173
|
const EMPTY$1 = 0;
|
|
11022
11174
|
const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
|
|
11023
11175
|
const PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
|
|
11024
|
-
const PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
|
|
11176
|
+
const PeerMeta$1 = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
|
|
11025
11177
|
const InstalledManifest = Schema.Struct({
|
|
11026
11178
|
dependencies: DependencyMap,
|
|
11027
11179
|
optionalDependencies: DependencyMap,
|
|
11028
11180
|
peerDependencies: DependencyMap,
|
|
11029
|
-
peerDependenciesMeta: PeerMeta
|
|
11181
|
+
peerDependenciesMeta: PeerMeta$1
|
|
11030
11182
|
});
|
|
11031
|
-
const decodeManifest$
|
|
11183
|
+
const decodeManifest$5 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11032
11184
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11033
11185
|
const installedNames = (manifest) => [
|
|
11034
11186
|
...keysOf(manifest.dependencies),
|
|
@@ -11038,7 +11190,7 @@ const installedNames = (manifest) => [
|
|
|
11038
11190
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11039
11191
|
const files = yield* RepositoryFiles;
|
|
11040
11192
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11041
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11193
|
+
return pipe(text, Option.flatMap(decodeManifest$5), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11042
11194
|
});
|
|
11043
11195
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11044
11196
|
const files = yield* RepositoryFiles;
|
|
@@ -11100,11 +11252,11 @@ const LISTED_LARGEST = 5;
|
|
|
11100
11252
|
const SIZE_CONCURRENCY = 32;
|
|
11101
11253
|
const MEGABYTE = 1e6;
|
|
11102
11254
|
const MEGABYTE_DIGITS = 1;
|
|
11103
|
-
const START$
|
|
11255
|
+
const START$20 = 0;
|
|
11104
11256
|
const SINGLE_ENTRY = 1;
|
|
11105
11257
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11106
11258
|
const usageHint = (dependency, entryCount) => {
|
|
11107
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11259
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$20 && dependency.entries.length < entryCount)) return "";
|
|
11108
11260
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11109
11261
|
};
|
|
11110
11262
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11113,7 +11265,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11113
11265
|
const { workspace, total } = overrun;
|
|
11114
11266
|
const config = yield* files.readFile(workspace.configFile);
|
|
11115
11267
|
const source = Option.getOrElse(config, () => "");
|
|
11116
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11268
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$20);
|
|
11117
11269
|
return {
|
|
11118
11270
|
file: workspace.configFile,
|
|
11119
11271
|
...positionOf(source)(index),
|
|
@@ -11130,7 +11282,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11130
11282
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11131
11283
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11132
11284
|
const sizes = HashMap.fromIterable(measured);
|
|
11133
|
-
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11285
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$20)), Number$1.sumAll);
|
|
11134
11286
|
return {
|
|
11135
11287
|
closures,
|
|
11136
11288
|
sizeOf,
|
|
@@ -11163,11 +11315,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11163
11315
|
})];
|
|
11164
11316
|
});
|
|
11165
11317
|
const stackProblems = (file, source, dependencies) => {
|
|
11166
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
11318
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$20);
|
|
11167
11319
|
const rest = String$1.slice(section)(source);
|
|
11168
11320
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11169
11321
|
file,
|
|
11170
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11322
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$20)),
|
|
11171
11323
|
rule: STACK_DEPENDENCY,
|
|
11172
11324
|
message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
|
|
11173
11325
|
})));
|
|
@@ -11244,7 +11396,7 @@ var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schem
|
|
|
11244
11396
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
11245
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);
|
|
11246
11398
|
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
11247
|
-
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)));
|
|
11248
11400
|
const consumerSource = ({ entry, member }) => Option.match(member, {
|
|
11249
11401
|
onNone: () => `export * from ${quote(entry)};\n`,
|
|
11250
11402
|
onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`
|
|
@@ -11302,14 +11454,25 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
|
|
|
11302
11454
|
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11303
11455
|
});
|
|
11304
11456
|
// src/features/check-tree-shaking/model/manifest.ts
|
|
11305
|
-
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({
|
|
11306
11460
|
name: Schema.optional(Schema.String),
|
|
11307
11461
|
exports: Schema.optional(Schema.Unknown),
|
|
11308
11462
|
bin: Schema.optional(Schema.Unknown),
|
|
11309
11463
|
sideEffects: Schema.optional(Schema.Unknown),
|
|
11310
|
-
dependencies: Schema.optional(
|
|
11311
|
-
|
|
11312
|
-
|
|
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));
|
|
11313
11476
|
const manifestOf$1 = (text) => decode(text);
|
|
11314
11477
|
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
11315
11478
|
const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
|
|
@@ -11336,22 +11499,25 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11336
11499
|
};
|
|
11337
11500
|
};
|
|
11338
11501
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11339
|
-
const RULE$
|
|
11340
|
-
const
|
|
11502
|
+
const RULE$39 = "optional-peer";
|
|
11503
|
+
const REQUIRED_RULE = "required-peer";
|
|
11504
|
+
const START$19 = 0;
|
|
11341
11505
|
const SINGLE = 1;
|
|
11342
11506
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11507
|
+
const PEER_META_KEY = "\"peerDependenciesMeta\"";
|
|
11343
11508
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11344
11509
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11345
|
-
const
|
|
11346
|
-
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);
|
|
11347
11512
|
const rest = String$1.slice(section)(located.source);
|
|
11348
|
-
return {
|
|
11349
|
-
file: located.file,
|
|
11350
|
-
...positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$18)),
|
|
11351
|
-
rule: RULE$37,
|
|
11352
|
-
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.`
|
|
11353
|
-
};
|
|
11513
|
+
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19));
|
|
11354
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
|
+
});
|
|
11355
11521
|
const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
11356
11522
|
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
11357
11523
|
const bins = pipe(used, Array.filter(({ entry }) => isBinEntry(entry)));
|
|
@@ -11359,14 +11525,29 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11359
11525
|
return pipe(keysOf(dependencies), Array.flatMap((name) => {
|
|
11360
11526
|
const importers = pipe(libraries, Array.filter(importsPackage(name)));
|
|
11361
11527
|
const neededByBin = pipe(bins, Array.some(importsPackage(name)));
|
|
11362
|
-
if (!(importers.length > START$
|
|
11528
|
+
if (!(importers.length > START$19 && importers.length < libraries.length) || neededByBin) return [];
|
|
11363
11529
|
return [problemFor$3(located, name, importers)];
|
|
11364
11530
|
}));
|
|
11365
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
|
+
};
|
|
11366
11547
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11367
|
-
const RULE$
|
|
11548
|
+
const RULE$38 = "side-effects";
|
|
11368
11549
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11369
|
-
const START$
|
|
11550
|
+
const START$18 = 0;
|
|
11370
11551
|
const FIRST$8 = 1;
|
|
11371
11552
|
const LISTED_PACKAGES = 4;
|
|
11372
11553
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
@@ -11390,7 +11571,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
11390
11571
|
label: entry.label,
|
|
11391
11572
|
member,
|
|
11392
11573
|
...extra
|
|
11393
|
-
}, ({ modules }) => modules > START$
|
|
11574
|
+
}, ({ modules }) => modules > START$18);
|
|
11394
11575
|
});
|
|
11395
11576
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
11396
11577
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -11412,17 +11593,17 @@ const othersOf = (total) => {
|
|
|
11412
11593
|
};
|
|
11413
11594
|
const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
11414
11595
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
11415
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
11596
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$18));
|
|
11416
11597
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11417
11598
|
file,
|
|
11418
11599
|
...positionOf(source)(keyIndex$1(source)),
|
|
11419
|
-
rule: RULE$
|
|
11600
|
+
rule: RULE$38,
|
|
11420
11601
|
message: messageOf$4(worst, excesses.length)
|
|
11421
11602
|
})), Option.toArray);
|
|
11422
11603
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11423
|
-
const RULE$
|
|
11604
|
+
const RULE$37 = "top-level-effect";
|
|
11424
11605
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11425
|
-
const READ_CONCURRENCY$
|
|
11606
|
+
const READ_CONCURRENCY$13 = 16;
|
|
11426
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.";
|
|
11427
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.";
|
|
11428
11609
|
const isEffect = (statement) => {
|
|
@@ -11433,10 +11614,10 @@ const messageOf$3 = (statement) => {
|
|
|
11433
11614
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
11434
11615
|
return STATEMENT_MESSAGE;
|
|
11435
11616
|
};
|
|
11436
|
-
const problemsIn$
|
|
11617
|
+
const problemsIn$12 = (api) => (file) => (source) => {
|
|
11437
11618
|
const retained = api.createSourceFile(file, source);
|
|
11438
11619
|
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$7({
|
|
11439
|
-
rule: RULE$
|
|
11620
|
+
rule: RULE$37,
|
|
11440
11621
|
message: messageOf$3(statement)
|
|
11441
11622
|
})(statement)));
|
|
11442
11623
|
retained.dispose();
|
|
@@ -11449,7 +11630,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11449
11630
|
const names = yield* files.ownedFiles(root);
|
|
11450
11631
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11451
11632
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11452
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
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 });
|
|
11453
11634
|
return Array.flatten(found);
|
|
11454
11635
|
}, Effect.scoped);
|
|
11455
11636
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11487,7 +11668,10 @@ const shapeOf = Effect.fn("shapeOf")(function* shapeOf({ workspace, manifest })
|
|
|
11487
11668
|
packEntries: workspace.packEntries
|
|
11488
11669
|
}), Array.dedupeWith((left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right)));
|
|
11489
11670
|
return {
|
|
11490
|
-
scope: {
|
|
11671
|
+
scope: {
|
|
11672
|
+
declared: runtimeDependenciesOf(manifest),
|
|
11673
|
+
bundled: workspace.alwaysBundle
|
|
11674
|
+
},
|
|
11491
11675
|
declared: declaredBy$1({
|
|
11492
11676
|
declared: manifest.sideEffects,
|
|
11493
11677
|
locator: {
|
|
@@ -11532,6 +11716,11 @@ const analyse = Effect.fn("analyse")(function* analyse(pack) {
|
|
|
11532
11716
|
located,
|
|
11533
11717
|
dependencies: manifest.dependencies,
|
|
11534
11718
|
used
|
|
11719
|
+
}),
|
|
11720
|
+
...requiredPeerProblems({
|
|
11721
|
+
located,
|
|
11722
|
+
optional: optionalPeersOf(manifest),
|
|
11723
|
+
used
|
|
11535
11724
|
})
|
|
11536
11725
|
];
|
|
11537
11726
|
});
|
|
@@ -11560,7 +11749,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11560
11749
|
return Array.flatten(found);
|
|
11561
11750
|
});
|
|
11562
11751
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11563
|
-
const RULE$
|
|
11752
|
+
const RULE$36 = "legacy-typescript";
|
|
11564
11753
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11565
11754
|
const COMPILER = "typescript";
|
|
11566
11755
|
const CURRENT_MAJOR = 7;
|
|
@@ -11591,12 +11780,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11591
11780
|
file,
|
|
11592
11781
|
line: lineOf$2(source)(legacy.id),
|
|
11593
11782
|
column: FIRST$7,
|
|
11594
|
-
rule: RULE$
|
|
11783
|
+
rule: RULE$36,
|
|
11595
11784
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11596
11785
|
})));
|
|
11597
11786
|
});
|
|
11598
11787
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11599
|
-
const RULE$
|
|
11788
|
+
const RULE$35 = "worker-bundle";
|
|
11600
11789
|
const BUNDLE_CONCURRENCY = 4;
|
|
11601
11790
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11602
11791
|
const CONDITIONS = [
|
|
@@ -11607,7 +11796,7 @@ const CONDITIONS = [
|
|
|
11607
11796
|
"module",
|
|
11608
11797
|
"default"
|
|
11609
11798
|
];
|
|
11610
|
-
const problemFor$2 = problemInFile(RULE$
|
|
11799
|
+
const problemFor$2 = problemInFile(RULE$35);
|
|
11611
11800
|
const problemOf$6 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11612
11801
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11613
11802
|
const built = yield* Effect.tryPromise({
|
|
@@ -11731,7 +11920,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11731
11920
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11732
11921
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11733
11922
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11734
|
-
const RULE$
|
|
11923
|
+
const RULE$34 = "hand-written-names";
|
|
11735
11924
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11736
11925
|
const nameListOf = (site) => {
|
|
11737
11926
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11746,7 +11935,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11746
11935
|
file,
|
|
11747
11936
|
line,
|
|
11748
11937
|
column,
|
|
11749
|
-
rule: RULE$
|
|
11938
|
+
rule: RULE$34,
|
|
11750
11939
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11751
11940
|
});
|
|
11752
11941
|
const problemOf$5 = ({ list, reason }) => listedProblem({
|
|
@@ -12427,13 +12616,13 @@ const MANIFEST$3 = "package.json";
|
|
|
12427
12616
|
const SEPARATOR$5 = "/";
|
|
12428
12617
|
const FIRST_SEGMENT = 1;
|
|
12429
12618
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12430
|
-
const decodeManifest$
|
|
12619
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(ManifestJson);
|
|
12431
12620
|
const prefixesOf = (file) => {
|
|
12432
12621
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12433
12622
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12434
12623
|
};
|
|
12435
12624
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12436
|
-
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)));
|
|
12437
12626
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12438
12627
|
const files = yield* RepositoryFiles;
|
|
12439
12628
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12545,7 +12734,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12545
12734
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12546
12735
|
}, Effect.scoped);
|
|
12547
12736
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12548
|
-
const RULE$
|
|
12737
|
+
const RULE$33 = "namespace-destructuring";
|
|
12549
12738
|
const LOCAL = /^[.#/]/u;
|
|
12550
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.`;
|
|
12551
12740
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12561,7 +12750,7 @@ const destructuredName = (declaration) => {
|
|
|
12561
12750
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12562
12751
|
};
|
|
12563
12752
|
const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
12564
|
-
rule: RULE$
|
|
12753
|
+
rule: RULE$33,
|
|
12565
12754
|
message: messageOf$1(name)
|
|
12566
12755
|
})), Option.map((report) => report(declaration)));
|
|
12567
12756
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12569,7 +12758,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12569
12758
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$4(names)), Array.getSomes);
|
|
12570
12759
|
};
|
|
12571
12760
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12572
|
-
const RULE$
|
|
12761
|
+
const RULE$32 = "pass-through-wrapper";
|
|
12573
12762
|
const SINGLE_STATEMENT = 1;
|
|
12574
12763
|
const SINGLE_DECLARATION = 1;
|
|
12575
12764
|
const THIS_PARAMETER = "this";
|
|
@@ -12666,7 +12855,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12666
12855
|
const problemOf$3 = (checker) => (candidate) => {
|
|
12667
12856
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12668
12857
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
12669
|
-
rule: RULE$
|
|
12858
|
+
rule: RULE$32,
|
|
12670
12859
|
message: messageOf(forward.callee.getText())
|
|
12671
12860
|
})(candidate.name)));
|
|
12672
12861
|
};
|
|
@@ -12692,7 +12881,7 @@ var plugins = [{
|
|
|
12692
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."
|
|
12693
12882
|
}];
|
|
12694
12883
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12695
|
-
const RULE$
|
|
12884
|
+
const RULE$31 = "known-plugins";
|
|
12696
12885
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12697
12886
|
const GITHUB$2 = "github";
|
|
12698
12887
|
const Source$1 = Schema.Struct({
|
|
@@ -12710,7 +12899,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12710
12899
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12711
12900
|
const MARKETPLACE = name;
|
|
12712
12901
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12713
|
-
const problem$1 = problemInFile(RULE$
|
|
12902
|
+
const problem$1 = problemInFile(RULE$31);
|
|
12714
12903
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12715
12904
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12716
12905
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12731,20 +12920,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12731
12920
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12732
12921
|
});
|
|
12733
12922
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12734
|
-
const RULE$
|
|
12923
|
+
const RULE$30 = "missing-hook";
|
|
12735
12924
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12736
12925
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12737
12926
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12738
12927
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12739
12928
|
const PLUGIN_ROOT = "..";
|
|
12740
|
-
const READ_CONCURRENCY$
|
|
12741
|
-
const START$
|
|
12929
|
+
const READ_CONCURRENCY$12 = 16;
|
|
12930
|
+
const START$17 = 0;
|
|
12742
12931
|
const referenceOf$2 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
12743
12932
|
path,
|
|
12744
|
-
index: found.index ?? START$
|
|
12933
|
+
index: found.index ?? START$17
|
|
12745
12934
|
})), Option.toArray);
|
|
12746
12935
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$2));
|
|
12747
|
-
const problemsIn$
|
|
12936
|
+
const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12748
12937
|
const files = yield* RepositoryFiles;
|
|
12749
12938
|
const text = yield* files.readFile(file);
|
|
12750
12939
|
if (Option.isNone(text)) return [];
|
|
@@ -12756,7 +12945,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12756
12945
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12757
12946
|
file,
|
|
12758
12947
|
...positionOf(source)(index),
|
|
12759
|
-
rule: RULE$
|
|
12948
|
+
rule: RULE$30,
|
|
12760
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.`
|
|
12761
12950
|
})));
|
|
12762
12951
|
});
|
|
@@ -12780,7 +12969,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12780
12969
|
}];
|
|
12781
12970
|
return [];
|
|
12782
12971
|
}));
|
|
12783
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12972
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$12 });
|
|
12784
12973
|
return Array.flatten(found);
|
|
12785
12974
|
});
|
|
12786
12975
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12809,7 +12998,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12809
12998
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12810
12999
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12811
13000
|
// src/features/check-documented-commands/model/commands.ts
|
|
12812
|
-
const RULE$
|
|
13001
|
+
const RULE$29 = "documented-commands";
|
|
12813
13002
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12814
13003
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12815
13004
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12828,7 +13017,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
12828
13017
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12829
13018
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12830
13019
|
const ONE$1 = 1;
|
|
12831
|
-
const START$
|
|
13020
|
+
const START$16 = 0;
|
|
12832
13021
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12833
13022
|
const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
12834
13023
|
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -12884,11 +13073,11 @@ const whereOf = (scope, file) => {
|
|
|
12884
13073
|
return `the package that holds ${file}`;
|
|
12885
13074
|
};
|
|
12886
13075
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12887
|
-
const problemsIn$
|
|
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 }) => ({
|
|
12888
13077
|
file: absolute(file),
|
|
12889
|
-
...positionOf(text)(match.index ?? START$
|
|
12890
|
-
rule: RULE$
|
|
12891
|
-
message: `${match[START$
|
|
13078
|
+
...positionOf(text)(match.index ?? START$16),
|
|
13079
|
+
rule: RULE$29,
|
|
13080
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12892
13081
|
})), Option.toArray)));
|
|
12893
13082
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12894
13083
|
/** @internal */
|
|
@@ -12912,15 +13101,15 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12912
13101
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12913
13102
|
line: ONE$1,
|
|
12914
13103
|
column: ONE$1,
|
|
12915
|
-
rule: RULE$
|
|
13104
|
+
rule: RULE$29,
|
|
12916
13105
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12917
13106
|
}],
|
|
12918
|
-
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$
|
|
13107
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12919
13108
|
});
|
|
12920
13109
|
});
|
|
12921
13110
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12922
|
-
const RULE$
|
|
12923
|
-
const FIRST_COLUMN$
|
|
13111
|
+
const RULE$28 = "legacy-web";
|
|
13112
|
+
const FIRST_COLUMN$4 = 1;
|
|
12924
13113
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12925
13114
|
const Finding = Schema.Struct({
|
|
12926
13115
|
file: Schema.String,
|
|
@@ -12957,8 +13146,8 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12957
13146
|
const problemOf = (guideId, ruleId) => ({ file, line, message }) => ({
|
|
12958
13147
|
file: files.join(root, file),
|
|
12959
13148
|
line,
|
|
12960
|
-
column: FIRST_COLUMN$
|
|
12961
|
-
rule: RULE$
|
|
13149
|
+
column: FIRST_COLUMN$4,
|
|
13150
|
+
rule: RULE$28,
|
|
12962
13151
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12963
13152
|
});
|
|
12964
13153
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -13028,8 +13217,8 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
13028
13217
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
13029
13218
|
const EXTENSION = /\.[^./]+$/u;
|
|
13030
13219
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13031
|
-
const READ_CONCURRENCY$
|
|
13032
|
-
const RULE$
|
|
13220
|
+
const READ_CONCURRENCY$11 = 64;
|
|
13221
|
+
const RULE$27 = "shell-script";
|
|
13033
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.";
|
|
13034
13223
|
const HookSchema = Schema.Struct({
|
|
13035
13224
|
command: Schema.optional(Schema.String),
|
|
@@ -13061,12 +13250,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13061
13250
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
13062
13251
|
};
|
|
13063
13252
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13064
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
13065
|
-
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)));
|
|
13066
13255
|
});
|
|
13067
13256
|
// src/shared/lib/workflow-files.ts
|
|
13068
13257
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
13069
|
-
const READ_CONCURRENCY$
|
|
13258
|
+
const READ_CONCURRENCY$10 = 16;
|
|
13070
13259
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
13071
13260
|
const files = yield* RepositoryFiles;
|
|
13072
13261
|
const names = yield* files.listedFiles(root);
|
|
@@ -13076,13 +13265,13 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13076
13265
|
file,
|
|
13077
13266
|
source
|
|
13078
13267
|
}))));
|
|
13079
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13268
|
+
}, { concurrency: READ_CONCURRENCY$10 });
|
|
13080
13269
|
return Array.getSomes(found);
|
|
13081
13270
|
});
|
|
13082
13271
|
// src/shared/lib/workflow-run.ts
|
|
13083
13272
|
const RUN_KEY = "run";
|
|
13084
|
-
const START$
|
|
13085
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
13273
|
+
const START$15 = 0;
|
|
13274
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
13086
13275
|
const runScriptsOf = (source) => {
|
|
13087
13276
|
const found = [];
|
|
13088
13277
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -13097,7 +13286,7 @@ const runScriptsOf = (source) => {
|
|
|
13097
13286
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13098
13287
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13099
13288
|
const COMMENT = "#";
|
|
13100
|
-
const RULE$
|
|
13289
|
+
const RULE$26 = "workflow-script";
|
|
13101
13290
|
const ONE_COMMAND = 1;
|
|
13102
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.";
|
|
13103
13292
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -13106,14 +13295,14 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
13106
13295
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
13107
13296
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
13108
13297
|
};
|
|
13109
|
-
const problemsIn$
|
|
13298
|
+
const problemsIn$9 = (file) => (source) => {
|
|
13110
13299
|
const at = positionOf(source);
|
|
13111
|
-
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)));
|
|
13112
13301
|
};
|
|
13113
13302
|
/** @internal */
|
|
13114
13303
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
13115
13304
|
const workflows = yield* readWorkflows(root);
|
|
13116
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
13305
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$9(file)(source)));
|
|
13117
13306
|
});
|
|
13118
13307
|
// src/features/check-scripts/model/script-checks.ts
|
|
13119
13308
|
/** @internal */
|
|
@@ -13219,27 +13408,27 @@ const docSources = (file) => (source) => {
|
|
|
13219
13408
|
})));
|
|
13220
13409
|
};
|
|
13221
13410
|
// src/features/check-vite-plus/model/command-sources.ts
|
|
13222
|
-
const ROOT_DIRECTORY$
|
|
13411
|
+
const ROOT_DIRECTORY$3 = ".";
|
|
13223
13412
|
const COMMAND_KEY = "command";
|
|
13224
13413
|
const ARGUMENTS_KEY = "args";
|
|
13225
|
-
const EXCLUDED$
|
|
13226
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
13414
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13415
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$4];
|
|
13227
13416
|
const STEP_FILES = [
|
|
13228
13417
|
":(glob).github/workflows/*.yml",
|
|
13229
13418
|
":(glob).github/workflows/*.yaml",
|
|
13230
13419
|
":(glob)**/action.yml",
|
|
13231
13420
|
":(glob)**/action.yaml",
|
|
13232
|
-
...EXCLUDED$
|
|
13421
|
+
...EXCLUDED$4
|
|
13233
13422
|
];
|
|
13234
13423
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
13235
13424
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
13236
13425
|
const AGENT_DOCS = [
|
|
13237
13426
|
":(glob)**/AGENTS.md",
|
|
13238
13427
|
":(glob)**/CLAUDE.md",
|
|
13239
|
-
...EXCLUDED$
|
|
13428
|
+
...EXCLUDED$4
|
|
13240
13429
|
];
|
|
13241
|
-
const READ_CONCURRENCY$
|
|
13242
|
-
const START$
|
|
13430
|
+
const READ_CONCURRENCY$9 = 16;
|
|
13431
|
+
const START$14 = 0;
|
|
13243
13432
|
const FIRST$5 = 1;
|
|
13244
13433
|
const LINE = "\n";
|
|
13245
13434
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -13249,7 +13438,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
13249
13438
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
13250
13439
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13251
13440
|
const NO_SOURCES = [];
|
|
13252
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
13441
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
13253
13442
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
13254
13443
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
13255
13444
|
return {
|
|
@@ -13309,7 +13498,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
13309
13498
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
13310
13499
|
});
|
|
13311
13500
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
13312
|
-
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 });
|
|
13313
13502
|
return Array.flatten(found);
|
|
13314
13503
|
});
|
|
13315
13504
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -13321,7 +13510,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
13321
13510
|
onSome: sourcesOf(file, name)
|
|
13322
13511
|
});
|
|
13323
13512
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
13324
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13513
|
+
}, { concurrency: READ_CONCURRENCY$9 });
|
|
13325
13514
|
return Array.flatten(found);
|
|
13326
13515
|
});
|
|
13327
13516
|
/** @internal */
|
|
@@ -13340,12 +13529,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13340
13529
|
readSources(root, hooks, hookSources),
|
|
13341
13530
|
readSources(root, AGENT_FILES, agentSources),
|
|
13342
13531
|
readSources(root, docs, docSources),
|
|
13343
|
-
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$
|
|
13532
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$3, ...workspaces]))
|
|
13344
13533
|
], { concurrency: "unbounded" });
|
|
13345
13534
|
return Array.flatten(found);
|
|
13346
13535
|
});
|
|
13347
13536
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13348
|
-
const RULE$
|
|
13537
|
+
const RULE$25 = "package-script";
|
|
13349
13538
|
const LIFECYCLE = [
|
|
13350
13539
|
"preinstall",
|
|
13351
13540
|
"install",
|
|
@@ -13368,12 +13557,12 @@ const LIFECYCLE = [
|
|
|
13368
13557
|
const problemOf$2 = ({ file, position, name }) => ({
|
|
13369
13558
|
file,
|
|
13370
13559
|
...position,
|
|
13371
|
-
rule: RULE$
|
|
13560
|
+
rule: RULE$25,
|
|
13372
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.`
|
|
13373
13562
|
});
|
|
13374
13563
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$2));
|
|
13375
13564
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13376
|
-
const RULE$
|
|
13565
|
+
const RULE$24 = "vite-plus-block";
|
|
13377
13566
|
const MARKER = Array.join([
|
|
13378
13567
|
"<!--",
|
|
13379
13568
|
"VITE PLUS START",
|
|
@@ -13386,7 +13575,7 @@ const problemIn = (file) => (source) => {
|
|
|
13386
13575
|
return Option.some({
|
|
13387
13576
|
file,
|
|
13388
13577
|
...positionOf(source)(index.value),
|
|
13389
|
-
rule: RULE$
|
|
13578
|
+
rule: RULE$24,
|
|
13390
13579
|
message: MESSAGE$9
|
|
13391
13580
|
});
|
|
13392
13581
|
};
|
|
@@ -13442,7 +13631,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13442
13631
|
})
|
|
13443
13632
|
});
|
|
13444
13633
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13445
|
-
const RULE$
|
|
13634
|
+
const RULE$22 = "publish-trigger";
|
|
13446
13635
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13447
13636
|
const MANUAL = "workflow_dispatch";
|
|
13448
13637
|
const TRIGGER_KEY = "on";
|
|
@@ -13462,18 +13651,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13462
13651
|
};
|
|
13463
13652
|
/** @internal */
|
|
13464
13653
|
const checkPublishTrigger = workflowCheck({
|
|
13465
|
-
rule: RULE$
|
|
13654
|
+
rule: RULE$22,
|
|
13466
13655
|
message: MESSAGE$7,
|
|
13467
13656
|
offsetsOf: publishTriggerOffsetsOf
|
|
13468
13657
|
});
|
|
13469
13658
|
// src/features/check-workflows/model/release-please.ts
|
|
13470
|
-
const RULE$
|
|
13659
|
+
const RULE$21 = "release-please";
|
|
13471
13660
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13472
13661
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13473
13662
|
const FIRST$4 = 1;
|
|
13474
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.";
|
|
13475
13664
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13476
|
-
rule: RULE$
|
|
13665
|
+
rule: RULE$21,
|
|
13477
13666
|
message: MESSAGE$6,
|
|
13478
13667
|
offsetsOf: scalarKeyOffsets({
|
|
13479
13668
|
name: "uses",
|
|
@@ -13487,7 +13676,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13487
13676
|
file: files.join(root, name),
|
|
13488
13677
|
line: FIRST$4,
|
|
13489
13678
|
column: FIRST$4,
|
|
13490
|
-
rule: RULE$
|
|
13679
|
+
rule: RULE$21,
|
|
13491
13680
|
message: MESSAGE$6
|
|
13492
13681
|
})));
|
|
13493
13682
|
});
|
|
@@ -13499,17 +13688,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13499
13688
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13500
13689
|
const CONCURRENCY_KEY = "concurrency";
|
|
13501
13690
|
const QUEUE_KEY = "queue";
|
|
13502
|
-
const RULE$
|
|
13691
|
+
const RULE$20 = "workflow-queue";
|
|
13503
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.";
|
|
13504
13693
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13505
13694
|
/** @internal */
|
|
13506
13695
|
const checkWorkflowQueues = workflowCheck({
|
|
13507
|
-
rule: RULE$
|
|
13696
|
+
rule: RULE$20,
|
|
13508
13697
|
message: MESSAGE$5,
|
|
13509
13698
|
offsetsOf: queueOffsetsOf
|
|
13510
13699
|
});
|
|
13511
13700
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13512
|
-
const RULE$
|
|
13701
|
+
const RULE$19 = "workflow-commit";
|
|
13513
13702
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13514
13703
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13515
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.";
|
|
@@ -13517,7 +13706,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
13517
13706
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13518
13707
|
/** @internal */
|
|
13519
13708
|
const checkWorkflowCommits = workflowCheck({
|
|
13520
|
-
rule: RULE$
|
|
13709
|
+
rule: RULE$19,
|
|
13521
13710
|
message: MESSAGE$4,
|
|
13522
13711
|
offsetsOf: commitOffsetsOf
|
|
13523
13712
|
});
|
|
@@ -13628,7 +13817,7 @@ const COMMENT_NODES = [
|
|
|
13628
13817
|
"block_comment",
|
|
13629
13818
|
"multiline_comment"
|
|
13630
13819
|
];
|
|
13631
|
-
const START$
|
|
13820
|
+
const START$13 = 0;
|
|
13632
13821
|
const NEXT = 1;
|
|
13633
13822
|
const NONE = [];
|
|
13634
13823
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13678,7 +13867,7 @@ const markupComment = (source) => (node) => {
|
|
|
13678
13867
|
}];
|
|
13679
13868
|
};
|
|
13680
13869
|
const textComments = (grammars, grammar) => (text) => {
|
|
13681
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13870
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
13682
13871
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13683
13872
|
};
|
|
13684
13873
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13744,12 +13933,12 @@ const shebangReader = (source) => {
|
|
|
13744
13933
|
};
|
|
13745
13934
|
const readerOf = (name) => (source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13746
13935
|
// src/features/ban-comments/model/comments.ts
|
|
13747
|
-
const RULE$
|
|
13936
|
+
const RULE$18 = "comment";
|
|
13748
13937
|
const UNUSED_RULE$1 = "unused-comment-allowance";
|
|
13749
13938
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13750
13939
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13751
|
-
const READ_CONCURRENCY$
|
|
13752
|
-
const START$
|
|
13940
|
+
const READ_CONCURRENCY$8 = 64;
|
|
13941
|
+
const START$12 = 0;
|
|
13753
13942
|
const SHEBANG = "#!";
|
|
13754
13943
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
13755
13944
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
@@ -13771,11 +13960,11 @@ const taggedError$2 = Schema.TaggedError;
|
|
|
13771
13960
|
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
13772
13961
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13773
13962
|
const lineBefore = (source, index) => {
|
|
13774
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13963
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
13775
13964
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13776
13965
|
};
|
|
13777
13966
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13778
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13967
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
13779
13968
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13780
13969
|
const NOTHING = {
|
|
13781
13970
|
problems: [],
|
|
@@ -13785,7 +13974,7 @@ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but n
|
|
|
13785
13974
|
const problemOf$1 = (file, source) => ({ index }) => ({
|
|
13786
13975
|
file,
|
|
13787
13976
|
...positionOf(source)(index),
|
|
13788
|
-
rule: RULE$
|
|
13977
|
+
rule: RULE$18,
|
|
13789
13978
|
message: MESSAGE$3
|
|
13790
13979
|
});
|
|
13791
13980
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13822,7 +14011,7 @@ const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, sett
|
|
|
13822
14011
|
})), Array.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
13823
14012
|
});
|
|
13824
14013
|
const usedAllowances = (allowances, found) => pipe(allowances, Array.map((pattern, index) => [pattern, index]), Array.filter(([pattern]) => pipe(found, Array.some((comment) => pattern.test(valueOf(comment.text))))), Array.map(([, index]) => index));
|
|
13825
|
-
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$
|
|
14014
|
+
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$12));
|
|
13826
14015
|
const unusedAllowances = Effect.fn("unusedAllowances")(function* unusedAllowances(root, settings, used) {
|
|
13827
14016
|
const files = yield* RepositoryFiles;
|
|
13828
14017
|
const file = files.join(root, CONFIG_FILE$2);
|
|
@@ -13844,7 +14033,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
13844
14033
|
problems: pipe(found, Array.filter(kept), Array.map(toProblem)),
|
|
13845
14034
|
used: usedAllowances(allowances, found)
|
|
13846
14035
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
13847
|
-
problems: [problemInFile(RULE$
|
|
14036
|
+
problems: [problemInFile(RULE$18)(file, `msch could not read the comments in this file: ${message}`)],
|
|
13848
14037
|
used: []
|
|
13849
14038
|
})))
|
|
13850
14039
|
});
|
|
@@ -13863,7 +14052,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13863
14052
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
13864
14053
|
onNone: () => Effect.succeed(NOTHING),
|
|
13865
14054
|
onSome: (source) => scan(entry, source)
|
|
13866
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
14055
|
+
}))), { concurrency: READ_CONCURRENCY$8 });
|
|
13867
14056
|
const used = HashSet.fromIterable(pipe(found, Array.flatMap(({ used: indexes }) => indexes)));
|
|
13868
14057
|
const unused = yield* unusedAllowances(root, settings, used);
|
|
13869
14058
|
return [...pipe(found, Array.flatMap(({ problems }) => problems)), ...unused];
|
|
@@ -13878,13 +14067,13 @@ const patternsBy = ({ spawn, command, toolVersions = [] }) => (entry) => {
|
|
|
13878
14067
|
return command;
|
|
13879
14068
|
};
|
|
13880
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");
|
|
13881
|
-
const FIRST_LINE$
|
|
13882
|
-
const FIRST_COLUMN$
|
|
14070
|
+
const FIRST_LINE$4 = 1;
|
|
14071
|
+
const FIRST_COLUMN$3 = 1;
|
|
13883
14072
|
const WHOLE_MATCH$1 = 0;
|
|
13884
14073
|
const fileProblem = (tool) => (entry) => ({
|
|
13885
14074
|
file: entry.file,
|
|
13886
|
-
line: FIRST_LINE$
|
|
13887
|
-
column: FIRST_COLUMN$
|
|
14075
|
+
line: FIRST_LINE$4,
|
|
14076
|
+
column: FIRST_COLUMN$3,
|
|
13888
14077
|
rule: tool.fileRule,
|
|
13889
14078
|
message: tool.fileMessage(entry)
|
|
13890
14079
|
});
|
|
@@ -13957,21 +14146,21 @@ const PYTHON = {
|
|
|
13957
14146
|
/** @internal */
|
|
13958
14147
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13959
14148
|
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13960
|
-
const RULE$
|
|
14149
|
+
const RULE$17 = "uncataloged-dependency";
|
|
13961
14150
|
const OWNED_ELSEWHERE = [
|
|
13962
14151
|
"catalog:",
|
|
13963
14152
|
"workspace:",
|
|
13964
14153
|
"link:",
|
|
13965
14154
|
"file:"
|
|
13966
14155
|
];
|
|
13967
|
-
const ROOT_DIRECTORY$
|
|
14156
|
+
const ROOT_DIRECTORY$2 = ".";
|
|
13968
14157
|
const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
|
|
13969
14158
|
const MESSAGE$2 = "is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.";
|
|
13970
14159
|
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13971
|
-
const problemsIn$
|
|
14160
|
+
const problemsIn$8 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13972
14161
|
file: entry.file,
|
|
13973
|
-
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13974
|
-
rule: RULE$
|
|
14162
|
+
...positionOf(source)(offsetIn$1(source)(manifestPattern(found))),
|
|
14163
|
+
rule: RULE$17,
|
|
13975
14164
|
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
13976
14165
|
})));
|
|
13977
14166
|
/** @internal */
|
|
@@ -13979,14 +14168,14 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
|
|
|
13979
14168
|
const files = yield* RepositoryFiles;
|
|
13980
14169
|
const directories = yield* workspaceDirectories(root);
|
|
13981
14170
|
const installed = yield* pipe(directories, Effect.filter((directory) => files.exists(files.join(root, directory, PLUGIN_MANIFEST$1)).pipe(Effect.map((found) => !found))));
|
|
13982
|
-
const listed = pipe([ROOT_DIRECTORY$
|
|
14171
|
+
const listed = pipe([ROOT_DIRECTORY$2, ...installed], Array.map((directory) => {
|
|
13983
14172
|
const name = files.join(directory, MANIFEST_FILE$3);
|
|
13984
14173
|
return {
|
|
13985
14174
|
name,
|
|
13986
14175
|
file: files.join(root, name)
|
|
13987
14176
|
};
|
|
13988
14177
|
}));
|
|
13989
|
-
return yield* scanText(listed, problemsIn$
|
|
14178
|
+
return yield* scanText(listed, problemsIn$8);
|
|
13990
14179
|
});
|
|
13991
14180
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13992
14181
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
@@ -13995,10 +14184,10 @@ const CATALOG_PROTOCOL = "catalog:";
|
|
|
13995
14184
|
const DEFAULT_CATALOG = "default";
|
|
13996
14185
|
const VERSION_SEPARATOR = "||";
|
|
13997
14186
|
const WILDCARD = "*";
|
|
13998
|
-
const FIRST_LINE$
|
|
13999
|
-
const FIRST_COLUMN$
|
|
14187
|
+
const FIRST_LINE$3 = 1;
|
|
14188
|
+
const FIRST_COLUMN$2 = 1;
|
|
14000
14189
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
14001
|
-
const READ_CONCURRENCY$
|
|
14190
|
+
const READ_CONCURRENCY$7 = 16;
|
|
14002
14191
|
const STALE_RULE = "stale-release-age-exclude";
|
|
14003
14192
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
14004
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.";
|
|
@@ -14029,14 +14218,14 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
14029
14218
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
14030
14219
|
const files = yield* RepositoryFiles;
|
|
14031
14220
|
const listed = yield* files.listedFiles(root);
|
|
14032
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
14033
|
-
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));
|
|
14034
14223
|
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
|
|
14035
14224
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
14036
14225
|
});
|
|
14037
14226
|
const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
|
|
14038
|
-
onNone: () => FIRST_LINE$
|
|
14039
|
-
onSome: (index) => index + FIRST_LINE$
|
|
14227
|
+
onNone: () => FIRST_LINE$3,
|
|
14228
|
+
onSome: (index) => index + FIRST_LINE$3
|
|
14040
14229
|
}));
|
|
14041
14230
|
const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
14042
14231
|
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
|
|
@@ -14044,7 +14233,7 @@ const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\
|
|
|
14044
14233
|
const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
14045
14234
|
file,
|
|
14046
14235
|
line: at(needle),
|
|
14047
|
-
column: FIRST_COLUMN$
|
|
14236
|
+
column: FIRST_COLUMN$2,
|
|
14048
14237
|
rule,
|
|
14049
14238
|
message: `\`${name}\` ${message}`
|
|
14050
14239
|
});
|
|
@@ -14084,7 +14273,7 @@ const CONFIG_FILE$1 = "vite.config.ts";
|
|
|
14084
14273
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
14085
14274
|
const SOURCE = "masseater/skills";
|
|
14086
14275
|
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
14087
|
-
const START$
|
|
14276
|
+
const START$11 = 0;
|
|
14088
14277
|
const LOCAL_PREFIX = "./";
|
|
14089
14278
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
14090
14279
|
const Source = Schema.Struct({
|
|
@@ -14097,7 +14286,7 @@ const taggedError$1 = Schema.TaggedError;
|
|
|
14097
14286
|
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
14098
14287
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
14099
14288
|
file,
|
|
14100
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
14289
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
14101
14290
|
rule,
|
|
14102
14291
|
message
|
|
14103
14292
|
});
|
|
@@ -14144,14 +14333,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
14144
14333
|
];
|
|
14145
14334
|
});
|
|
14146
14335
|
// src/features/check-skills/model/published-skills.ts
|
|
14147
|
-
const RULE$
|
|
14336
|
+
const RULE$16 = "published-skills";
|
|
14148
14337
|
const KEYWORD = "tanstack-intent";
|
|
14149
14338
|
const SKILLS = "skills";
|
|
14150
14339
|
const MANIFEST_FILE = "package.json";
|
|
14151
14340
|
const SKILL_FILE$1 = "SKILL.md";
|
|
14152
14341
|
const SUCCEEDED = 0;
|
|
14153
14342
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14154
|
-
const problemAt$2 = problemInFile(RULE$
|
|
14343
|
+
const problemAt$2 = problemInFile(RULE$16);
|
|
14155
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))));
|
|
14156
14345
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14157
14346
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -14172,7 +14361,7 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
14172
14361
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
14173
14362
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
14174
14363
|
}, Effect.scoped);
|
|
14175
|
-
const problemsIn$
|
|
14364
|
+
const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
14176
14365
|
const files = yield* RepositoryFiles;
|
|
14177
14366
|
const directory = files.join(root, project.directory);
|
|
14178
14367
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
@@ -14184,11 +14373,11 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
14184
14373
|
/** @internal */
|
|
14185
14374
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
14186
14375
|
const projects = yield* publishedProjects(root);
|
|
14187
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
14376
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$7(root, project), { concurrency: 1 });
|
|
14188
14377
|
return Array.flatten(problems);
|
|
14189
14378
|
});
|
|
14190
14379
|
// src/features/check-skills/model/skill-files.ts
|
|
14191
|
-
const RULE$
|
|
14380
|
+
const RULE$15 = "skill-file";
|
|
14192
14381
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14193
14382
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14194
14383
|
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
@@ -14206,9 +14395,9 @@ const GITHUB = "https://github.com/";
|
|
|
14206
14395
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
14207
14396
|
const BLANK = /\s+/u;
|
|
14208
14397
|
const SEPARATOR$2 = "/";
|
|
14209
|
-
const START$
|
|
14398
|
+
const START$10 = 0;
|
|
14210
14399
|
const FIRST$3 = 1;
|
|
14211
|
-
const READ_CONCURRENCY$
|
|
14400
|
+
const READ_CONCURRENCY$6 = 16;
|
|
14212
14401
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
14213
14402
|
const Frontmatter = Schema.Struct({
|
|
14214
14403
|
name: Schema.optional(Schema.String),
|
|
@@ -14216,9 +14405,9 @@ const Frontmatter = Schema.Struct({
|
|
|
14216
14405
|
metadata: Schema.optional(Metadata)
|
|
14217
14406
|
});
|
|
14218
14407
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
14219
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
14408
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
14220
14409
|
const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
|
|
14221
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
14410
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
14222
14411
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
14223
14412
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
14224
14413
|
const bodyStart = bodyStartOf(source);
|
|
@@ -14246,16 +14435,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
14246
14435
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
14247
14436
|
file: skill.file,
|
|
14248
14437
|
...positionOf(skill.source)(index),
|
|
14249
|
-
rule: RULE$
|
|
14438
|
+
rule: RULE$15,
|
|
14250
14439
|
message
|
|
14251
14440
|
})));
|
|
14252
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) => ({
|
|
14253
14442
|
target,
|
|
14254
|
-
index: found.index ?? START$
|
|
14443
|
+
index: found.index ?? START$10
|
|
14255
14444
|
})), Option.toArray);
|
|
14256
14445
|
const rangeOf$1 = (found) => {
|
|
14257
|
-
const start = found.index ?? START$
|
|
14258
|
-
return [start, start + found[START$
|
|
14446
|
+
const start = found.index ?? START$10;
|
|
14447
|
+
return [start, start + found[START$10].length];
|
|
14259
14448
|
};
|
|
14260
14449
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
14261
14450
|
const linksIn$1 = (source) => {
|
|
@@ -14273,23 +14462,23 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
14273
14462
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14274
14463
|
file,
|
|
14275
14464
|
...positionOf(source)(index),
|
|
14276
|
-
rule: RULE$
|
|
14465
|
+
rule: RULE$15,
|
|
14277
14466
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14278
14467
|
})));
|
|
14279
14468
|
});
|
|
14280
|
-
const problemsIn$
|
|
14469
|
+
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
14281
14470
|
const files = yield* RepositoryFiles;
|
|
14282
14471
|
const file = files.join(root, name);
|
|
14283
14472
|
const directory = files.dirname(name);
|
|
14284
14473
|
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
14285
14474
|
const text = yield* files.readFile(file);
|
|
14286
14475
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
14287
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
14476
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$6 });
|
|
14288
14477
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
14289
14478
|
file: files.join(root, entry),
|
|
14290
14479
|
line: FIRST$3,
|
|
14291
14480
|
column: FIRST$3,
|
|
14292
|
-
rule: RULE$
|
|
14481
|
+
rule: RULE$15,
|
|
14293
14482
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14294
14483
|
})));
|
|
14295
14484
|
return [
|
|
@@ -14306,7 +14495,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14306
14495
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
14307
14496
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
14308
14497
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
14309
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
14498
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$6 });
|
|
14310
14499
|
return Array.flatten(found);
|
|
14311
14500
|
});
|
|
14312
14501
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -14367,9 +14556,8 @@ const cargoEntries = (text) => {
|
|
|
14367
14556
|
};
|
|
14368
14557
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14369
14558
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14370
|
-
const RULE$
|
|
14371
|
-
const
|
|
14372
|
-
const READ_CONCURRENCY$4 = 16;
|
|
14559
|
+
const RULE$14 = "version-downgrade";
|
|
14560
|
+
const READ_CONCURRENCY$5 = 16;
|
|
14373
14561
|
const READERS = [
|
|
14374
14562
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
14375
14563
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -14381,28 +14569,22 @@ const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(a
|
|
|
14381
14569
|
onNone: () => false,
|
|
14382
14570
|
onSome: ([old, current]) => semver.lt(current, old)
|
|
14383
14571
|
}));
|
|
14384
|
-
const FIRST_LINE$
|
|
14572
|
+
const FIRST_LINE$2 = 1;
|
|
14385
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({
|
|
14386
|
-
onNone: () => FIRST_LINE$
|
|
14387
|
-
onSome: (index) => index + FIRST_LINE$
|
|
14574
|
+
onNone: () => FIRST_LINE$2,
|
|
14575
|
+
onSome: (index) => index + FIRST_LINE$2
|
|
14388
14576
|
}));
|
|
14389
|
-
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.`;
|
|
14390
14578
|
const downgradesIn = ({ file, text, before, after }) => {
|
|
14391
14579
|
const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
|
|
14392
14580
|
return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
|
|
14393
14581
|
file,
|
|
14394
14582
|
line: lineOf(text, entry),
|
|
14395
|
-
column: FIRST_LINE$
|
|
14396
|
-
rule: RULE$
|
|
14397
|
-
message: message(old, entry)
|
|
14583
|
+
column: FIRST_LINE$2,
|
|
14584
|
+
rule: RULE$14,
|
|
14585
|
+
message: message$1(old, entry)
|
|
14398
14586
|
})), Option.toArray)));
|
|
14399
14587
|
};
|
|
14400
|
-
const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
|
|
14401
|
-
const files = yield* RepositoryFiles;
|
|
14402
|
-
const configured = yield* Config.option(Config.String("VPA_BASE")).pipe(Effect.orDie);
|
|
14403
|
-
const base = Option.getOrElse(configured, () => DEFAULT_BASE);
|
|
14404
|
-
return yield* files.mergeBase(root, base);
|
|
14405
|
-
});
|
|
14406
14588
|
/** @internal */
|
|
14407
14589
|
const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(root) {
|
|
14408
14590
|
const files = yield* RepositoryFiles;
|
|
@@ -14419,7 +14601,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
14419
14601
|
before: read(before),
|
|
14420
14602
|
after: read(after)
|
|
14421
14603
|
})), Option.getOrElse(() => []));
|
|
14422
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
14604
|
+
}), { concurrency: READ_CONCURRENCY$5 });
|
|
14423
14605
|
return Array.flatten(found);
|
|
14424
14606
|
});
|
|
14425
14607
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -14430,13 +14612,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
14430
14612
|
const CAP_RULE = "renovate-version-cap";
|
|
14431
14613
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14432
14614
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14433
|
-
const START$
|
|
14434
|
-
const READ_CONCURRENCY$
|
|
14615
|
+
const START$9 = 0;
|
|
14616
|
+
const READ_CONCURRENCY$4 = 16;
|
|
14435
14617
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14436
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.";
|
|
14437
14619
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
14438
14620
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
14439
|
-
const problemsIn$
|
|
14621
|
+
const problemsIn$5 = (file, source) => {
|
|
14440
14622
|
const at = positionOf(source);
|
|
14441
14623
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
14442
14624
|
file,
|
|
@@ -14449,7 +14631,7 @@ const problemsIn$6 = (file, source) => {
|
|
|
14449
14631
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
14450
14632
|
...pipe([{
|
|
14451
14633
|
file,
|
|
14452
|
-
...at(START$
|
|
14634
|
+
...at(START$9),
|
|
14453
14635
|
rule: PRESET_RULE,
|
|
14454
14636
|
message: PRESET_MESSAGE
|
|
14455
14637
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -14463,30 +14645,94 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14463
14645
|
const file = files.join(root, name);
|
|
14464
14646
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14465
14647
|
onNone: () => [],
|
|
14466
|
-
onSome: (source) => problemsIn$
|
|
14648
|
+
onSome: (source) => problemsIn$5(file, source)
|
|
14467
14649
|
})));
|
|
14468
|
-
}, { 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 });
|
|
14469
14715
|
return Array.flatten(found);
|
|
14470
14716
|
});
|
|
14471
14717
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
14472
14718
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
14473
14719
|
const NUL = "\0";
|
|
14474
|
-
const START$
|
|
14720
|
+
const START$8 = 0;
|
|
14475
14721
|
const HEX = 16;
|
|
14476
14722
|
const CODE_POINT_WIDTH = 4;
|
|
14477
14723
|
const READ_CONCURRENCY$2 = 64;
|
|
14478
|
-
const RULE$
|
|
14479
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
14724
|
+
const RULE$12 = "hidden-unicode";
|
|
14725
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$8)(character), Option.getOrElse(() => START$8), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
14480
14726
|
const problemOf = (file, source) => (found) => {
|
|
14481
|
-
const hex = hexOf(found[START$
|
|
14727
|
+
const hex = hexOf(found[START$8]);
|
|
14482
14728
|
return {
|
|
14483
14729
|
file,
|
|
14484
|
-
...positionOf(source)(found.index ?? START$
|
|
14485
|
-
rule: RULE$
|
|
14730
|
+
...positionOf(source)(found.index ?? START$8),
|
|
14731
|
+
rule: RULE$12,
|
|
14486
14732
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
14487
14733
|
};
|
|
14488
14734
|
};
|
|
14489
|
-
const problemsIn$
|
|
14735
|
+
const problemsIn$4 = (file, source) => {
|
|
14490
14736
|
if (String$1.includes(NUL)(source)) return [];
|
|
14491
14737
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
|
|
14492
14738
|
};
|
|
@@ -14498,7 +14744,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14498
14744
|
const file = files.join(root, name);
|
|
14499
14745
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
14500
14746
|
onNone: () => [],
|
|
14501
|
-
onSome: (source) => problemsIn$
|
|
14747
|
+
onSome: (source) => problemsIn$4(file, source)
|
|
14502
14748
|
})));
|
|
14503
14749
|
}, { concurrency: READ_CONCURRENCY$2 });
|
|
14504
14750
|
return Array.flatten(found);
|
|
@@ -14506,7 +14752,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
14506
14752
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
14507
14753
|
const MSCH = "@r_masseater/msch";
|
|
14508
14754
|
const SCOPE$1 = "@r_masseater/";
|
|
14509
|
-
const RULE$
|
|
14755
|
+
const RULE$11 = "applied-package";
|
|
14510
14756
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
14511
14757
|
const NOT_FOUND = -1;
|
|
14512
14758
|
const SEPARATOR$1 = "/";
|
|
@@ -14551,7 +14797,7 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
14551
14797
|
const problemAt$1 = (file, source) => (index, name) => ({
|
|
14552
14798
|
file,
|
|
14553
14799
|
...positionOf(source)(index),
|
|
14554
|
-
rule: RULE$
|
|
14800
|
+
rule: RULE$11,
|
|
14555
14801
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
14556
14802
|
});
|
|
14557
14803
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
@@ -14606,7 +14852,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14606
14852
|
return yield* appliedPackageProblems(root, applied);
|
|
14607
14853
|
});
|
|
14608
14854
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14609
|
-
const RULE$
|
|
14855
|
+
const RULE$10 = "replaced-tool";
|
|
14610
14856
|
const FIRST$2 = 1;
|
|
14611
14857
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14612
14858
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
@@ -14687,7 +14933,7 @@ const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ patte
|
|
|
14687
14933
|
file,
|
|
14688
14934
|
line: FIRST$2,
|
|
14689
14935
|
column: FIRST$2,
|
|
14690
|
-
rule: RULE$
|
|
14936
|
+
rule: RULE$10,
|
|
14691
14937
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14692
14938
|
})));
|
|
14693
14939
|
/** @internal */
|
|
@@ -14721,7 +14967,7 @@ const SETUP_PATTERNS = [
|
|
|
14721
14967
|
];
|
|
14722
14968
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14723
14969
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14724
|
-
const START$
|
|
14970
|
+
const START$7 = 0;
|
|
14725
14971
|
const LAST_SEGMENT = 1;
|
|
14726
14972
|
const FIRST_LINE = 1;
|
|
14727
14973
|
const FIRST_COLUMN = 1;
|
|
@@ -14790,7 +15036,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14790
15036
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14791
15037
|
return directoriesOf(roots);
|
|
14792
15038
|
});
|
|
14793
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
15039
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$7), (end) => String$1.slice(START$7, end)(name));
|
|
14794
15040
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14795
15041
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14796
15042
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14826,11 +15072,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14826
15072
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14827
15073
|
});
|
|
14828
15074
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
14829
|
-
const RULE$
|
|
15075
|
+
const RULE$9 = "effect-diagnostics-once";
|
|
14830
15076
|
const PLUGIN = "@effect/language-service";
|
|
14831
15077
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
14832
|
-
const EXCLUDED$
|
|
14833
|
-
const START$
|
|
15078
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
15079
|
+
const START$6 = 0;
|
|
14834
15080
|
const Plugin = Schema.Struct({
|
|
14835
15081
|
name: Schema.optional(Schema.String),
|
|
14836
15082
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -14841,28 +15087,28 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
14841
15087
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
14842
15088
|
const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
|
|
14843
15089
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
14844
|
-
const problemsIn$
|
|
15090
|
+
const problemsIn$3 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
14845
15091
|
file: entry.file,
|
|
14846
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
14847
|
-
rule: RULE$
|
|
15092
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$6))),
|
|
15093
|
+
rule: RULE$9,
|
|
14848
15094
|
message: MESSAGE$1
|
|
14849
15095
|
})), Option.toArray);
|
|
14850
15096
|
/** @internal */
|
|
14851
15097
|
const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* checkEffectDiagnostics(root) {
|
|
14852
15098
|
const files = yield* RepositoryFiles;
|
|
14853
|
-
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$
|
|
15099
|
+
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$3]);
|
|
14854
15100
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
14855
15101
|
name,
|
|
14856
15102
|
file: files.join(root, name)
|
|
14857
|
-
}))), problemsIn$
|
|
15103
|
+
}))), problemsIn$3);
|
|
14858
15104
|
});
|
|
14859
15105
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
14860
|
-
const RULE$
|
|
15106
|
+
const RULE$8 = "version-range";
|
|
14861
15107
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
14862
15108
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
14863
15109
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
14864
15110
|
const PATH_LIKE = "/";
|
|
14865
|
-
const EXCLUDED$
|
|
15111
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14866
15112
|
const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
|
|
14867
15113
|
const versionOf = (specifier) => Option.getOrElse(groupOf("version")(ALIAS.exec(specifier)), () => specifier);
|
|
14868
15114
|
/** @internal */
|
|
@@ -14872,11 +15118,11 @@ const isRange = (specifier) => {
|
|
|
14872
15118
|
};
|
|
14873
15119
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14874
15120
|
file,
|
|
14875
|
-
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
14876
|
-
rule: RULE$
|
|
15121
|
+
...positionOf(source)(offsetIn$1(source)(pattern(range))),
|
|
15122
|
+
rule: RULE$8,
|
|
14877
15123
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14878
15124
|
})));
|
|
14879
|
-
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$
|
|
15125
|
+
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$2(name)}["']?:`, "mu");
|
|
14880
15126
|
const manifestProblems$2 = (entry, source) => problemsFor(entry.file, source, manifestPattern)(manifestSpecifiers(source));
|
|
14881
15127
|
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14882
15128
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
@@ -14892,7 +15138,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14892
15138
|
/** @internal */
|
|
14893
15139
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
14894
15140
|
const files = yield* RepositoryFiles;
|
|
14895
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
15141
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14896
15142
|
const listed = pipe(manifests, Array.map((name) => ({
|
|
14897
15143
|
name,
|
|
14898
15144
|
file: files.join(root, name)
|
|
@@ -14902,32 +15148,25 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14902
15148
|
return [...fromManifests, ...fromCatalogs];
|
|
14903
15149
|
});
|
|
14904
15150
|
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14905
|
-
const RULE$
|
|
15151
|
+
const RULE$7 = "pack-publint";
|
|
14906
15152
|
const CONFIG_FILE = "vite.config.ts";
|
|
14907
15153
|
const PACK_KEY = "pack:";
|
|
14908
|
-
const START$
|
|
15154
|
+
const START$5 = 0;
|
|
14909
15155
|
const READ_CONCURRENCY$1 = 16;
|
|
14910
|
-
const EXCLUDED$
|
|
14911
|
-
const Manifest$4 = Schema.Struct({
|
|
14912
|
-
private: Schema.optional(Schema.Boolean),
|
|
14913
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14914
|
-
});
|
|
14915
|
-
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
15156
|
+
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14916
15157
|
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14917
15158
|
const isStrict = Schema.is(StrictPack);
|
|
14918
15159
|
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
14919
15160
|
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
14920
15161
|
const taggedError = Schema.TaggedError;
|
|
14921
15162
|
var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
14922
|
-
const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14923
15163
|
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14924
15164
|
const problemFor = (file, source) => ({
|
|
14925
15165
|
file,
|
|
14926
|
-
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$
|
|
14927
|
-
rule: RULE$
|
|
15166
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$5)),
|
|
15167
|
+
rule: RULE$7,
|
|
14928
15168
|
message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
|
|
14929
15169
|
});
|
|
14930
|
-
const publishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$4), Option.filter(isPublished$2));
|
|
14931
15170
|
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14932
15171
|
const config = yield* Effect.tryPromise({
|
|
14933
15172
|
try: () => resolveConfigFromFile(configFile),
|
|
@@ -14941,50 +15180,21 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
|
|
|
14941
15180
|
if (yield* strictPublintIn(configFile)) return [];
|
|
14942
15181
|
return [problemFor(configFile, source.value)];
|
|
14943
15182
|
});
|
|
14944
|
-
const problemsIn$
|
|
15183
|
+
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14945
15184
|
const files = yield* RepositoryFiles;
|
|
14946
15185
|
const source = yield* files.readFile(files.join(root, manifestName));
|
|
14947
|
-
const manifest =
|
|
15186
|
+
const manifest = publishedManifestOf(source);
|
|
14948
15187
|
if (Option.isNone(manifest)) return [];
|
|
14949
15188
|
return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14950
15189
|
});
|
|
14951
15190
|
/** @internal */
|
|
14952
15191
|
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14953
|
-
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14954
|
-
const found = yield* Effect.forEach(manifests, (name) => problemsIn$
|
|
15192
|
+
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
15193
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14955
15194
|
return Array.flatten(found);
|
|
14956
15195
|
});
|
|
14957
|
-
// src/features/check-package-scope/model/package-scope.ts
|
|
14958
|
-
const RULE$5 = "package-scope";
|
|
14959
|
-
const SCOPE = "@r_masseater/";
|
|
14960
|
-
const NAME_KEY = "\"name\"";
|
|
14961
|
-
const START$3 = 0;
|
|
14962
|
-
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14963
|
-
const Manifest$3 = Schema.Struct({
|
|
14964
|
-
name: Schema.optional(Schema.String),
|
|
14965
|
-
private: Schema.optional(Schema.Boolean),
|
|
14966
|
-
publishConfig: Schema.optional(Schema.Unknown)
|
|
14967
|
-
});
|
|
14968
|
-
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
14969
|
-
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14970
|
-
const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
14971
|
-
const problemsIn$2 = (entry, source) => pipe(decodeManifest$3(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
|
|
14972
|
-
file: entry.file,
|
|
14973
|
-
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3))),
|
|
14974
|
-
rule: RULE$5,
|
|
14975
|
-
message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
|
|
14976
|
-
})), Option.toArray);
|
|
14977
|
-
/** @internal */
|
|
14978
|
-
const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageScope(root) {
|
|
14979
|
-
const files = yield* RepositoryFiles;
|
|
14980
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
14981
|
-
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
14982
|
-
name,
|
|
14983
|
-
file: files.join(root, name)
|
|
14984
|
-
}))), problemsIn$2);
|
|
14985
|
-
});
|
|
14986
15196
|
// src/features/check-plugin-marketplace/model/plugin-marketplace.ts
|
|
14987
|
-
const RULE$
|
|
15197
|
+
const RULE$6 = "plugin-marketplace";
|
|
14988
15198
|
const PLUGIN_DIRECTORY = ".claude-plugin";
|
|
14989
15199
|
const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
|
|
14990
15200
|
const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
|
|
@@ -15040,7 +15250,7 @@ const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
|
15040
15250
|
description: Option.getOrElse(project.description, () => "")
|
|
15041
15251
|
})));
|
|
15042
15252
|
});
|
|
15043
|
-
const problem = problemInFile(RULE$
|
|
15253
|
+
const problem = problemInFile(RULE$6);
|
|
15044
15254
|
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
15045
15255
|
const projects = yield* workspaceProjects(root);
|
|
15046
15256
|
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
@@ -15084,6 +15294,56 @@ const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* che
|
|
|
15084
15294
|
});
|
|
15085
15295
|
return yield* rewrite(file, `${text}\n`);
|
|
15086
15296
|
});
|
|
15297
|
+
// src/features/check-published-manifest/model/package-homepage.ts
|
|
15298
|
+
const RULE$5 = "package-homepage";
|
|
15299
|
+
const BRANCH = "main";
|
|
15300
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
15301
|
+
const START$4 = 0;
|
|
15302
|
+
const KEYS = [
|
|
15303
|
+
"\"homepage\"",
|
|
15304
|
+
"\"repository\"",
|
|
15305
|
+
"\"name\""
|
|
15306
|
+
];
|
|
15307
|
+
const RepositoryObject = Schema.Struct({
|
|
15308
|
+
url: Schema.String,
|
|
15309
|
+
directory: Schema.optional(Schema.String)
|
|
15310
|
+
});
|
|
15311
|
+
const decodeRepository = Schema.decodeUnknownOption(RepositoryObject);
|
|
15312
|
+
const repositoryMissing = (directory) => `Published packages declare \`repository\` as \`{ "type": "git", "url": "git+https://github.com/<owner>/<repository>.git", "directory": "${directory}" }\` so that npm and \`npm repo\` link to the source.`;
|
|
15313
|
+
const directoryWrong = (directory) => `In a monorepo \`repository.directory\` names the package directory, so npm links to the package and not to the repository root. Set it to "${directory}".`;
|
|
15314
|
+
const homepageWrong = (homepage) => `\`homepage\` is the link npm shows as the package's home, and the repository root is not the package. Set it to "${homepage}".`;
|
|
15315
|
+
const repositoryUrlOf = (url) => pipe(url, String$1.replace(/^git\+/u, ""), String$1.replace(/\.git$/u, ""));
|
|
15316
|
+
const homepageOf = (url, directory) => `${repositoryUrlOf(url)}/tree/${BRANCH}/${directory}#readme`;
|
|
15317
|
+
const repositoryMessages = (manifest, directory) => (repository) => {
|
|
15318
|
+
const expected = homepageOf(repository.url, directory);
|
|
15319
|
+
const wrongDirectory = directoryWrong(directory);
|
|
15320
|
+
const wrongHomepage = homepageWrong(expected);
|
|
15321
|
+
return Array.getSomes([Option.liftPredicate(wrongDirectory, () => repository.directory !== directory), Option.liftPredicate(wrongHomepage, () => manifest.homepage !== expected)]);
|
|
15322
|
+
};
|
|
15323
|
+
const messagesOf = (manifest, directory) => pipe(decodeRepository(manifest.repository), Option.match({
|
|
15324
|
+
onNone: () => [repositoryMissing(directory)],
|
|
15325
|
+
onSome: repositoryMessages(manifest, directory)
|
|
15326
|
+
}));
|
|
15327
|
+
const firstKeyIndex = (source) => pipe(KEYS, Array.findFirst((key) => String$1.includes(key)(source)), Option.flatMap((key) => String$1.indexOf(key)(source)), Option.getOrElse(() => START$4));
|
|
15328
|
+
/** @internal */
|
|
15329
|
+
const homepageProblems = (dirname) => ({ entry, source, manifest }) => pipe(Option.some(dirname(entry.name)), Option.filter((directory) => directory !== ROOT_DIRECTORY$1), Option.map((directory) => messagesOf(manifest, directory)), Option.getOrElse(() => []), Array.map((message) => problemAtIndex(RULE$5)(entry.file, source)(firstKeyIndex(source), message)));
|
|
15330
|
+
// src/features/check-published-manifest/model/package-scope.ts
|
|
15331
|
+
const RULE$4 = "package-scope";
|
|
15332
|
+
const SCOPE = "@r_masseater/";
|
|
15333
|
+
const NAME_KEY = "\"name\"";
|
|
15334
|
+
const START$3 = 0;
|
|
15335
|
+
const unscopedName = ({ manifest }) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
15336
|
+
const nameIndex = (source) => pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$3));
|
|
15337
|
+
const messageFor = (name) => `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`;
|
|
15338
|
+
/** @internal */
|
|
15339
|
+
const scopeProblems = (found) => pipe(unscopedName(found), Option.map((name) => problemAtIndex(RULE$4)(found.entry.file, found.source)(nameIndex(found.source), messageFor(name))), Option.toArray);
|
|
15340
|
+
// src/features/check-published-manifest/model/published-manifests.ts
|
|
15341
|
+
/** @internal */
|
|
15342
|
+
const checkPublishedManifests = Effect.fn("checkPublishedManifests")(function* checkPublishedManifests(root) {
|
|
15343
|
+
const files = yield* RepositoryFiles;
|
|
15344
|
+
const homepage = homepageProblems(files.dirname);
|
|
15345
|
+
return yield* scanPublishedManifests(root, (found) => [...scopeProblems(found), ...homepage(found)]);
|
|
15346
|
+
});
|
|
15087
15347
|
// src/features/check-runtime-version/model/node-version.ts
|
|
15088
15348
|
const RULE$3 = "node-version";
|
|
15089
15349
|
const MINIMUM = 26;
|
|
@@ -15342,7 +15602,7 @@ const checkWorkspaceDescriptions = Effect.fn("checkWorkspaceDescriptions")(funct
|
|
|
15342
15602
|
const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
|
|
15343
15603
|
const found = yield* Effect.all([
|
|
15344
15604
|
checkNodeVersion(root),
|
|
15345
|
-
|
|
15605
|
+
checkPublishedManifests(root),
|
|
15346
15606
|
checkPackSettings(root),
|
|
15347
15607
|
checkUnusedWorkspaces(root),
|
|
15348
15608
|
checkExactVersions(root),
|
|
@@ -15371,6 +15631,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
15371
15631
|
checkAppliedPackages(root),
|
|
15372
15632
|
checkGitSubpath(root),
|
|
15373
15633
|
checkDowngrades(root),
|
|
15634
|
+
checkPackageVersions(root),
|
|
15374
15635
|
checkRenovateSettings(root),
|
|
15375
15636
|
checkCatalogEntries(root),
|
|
15376
15637
|
checkPackageRegistry(root)
|