@r_masseater/msch 0.66.0 → 0.69.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 +600 -370
- package/dist/cli.mjs.map +1 -1
- package/dist/config.mjs +5 -1
- package/dist/config.mjs.map +1 -1
- package/dist/{dependencies-BDQ7XSwU.mjs → dependencies-C3kCe35Q.mjs} +21 -21
- package/dist/dependencies-C3kCe35Q.mjs.map +1 -0
- package/dist/exits.mjs +4 -4
- package/dist/{ignored-directories-DurTKTTN.mjs → ignored-directories-BW8gCBE1.mjs} +2 -2
- package/dist/{ignored-directories-DurTKTTN.mjs.map → ignored-directories-BW8gCBE1.mjs.map} +1 -1
- package/dist/{lookup-report-CPR_cj8F.mjs → lookup-report-D1VTEK5k.mjs} +3 -3
- package/dist/{lookup-report-CPR_cj8F.mjs.map → lookup-report-D1VTEK5k.mjs.map} +1 -1
- package/dist/manifest-texts-K650kDy8.mjs +59 -0
- package/dist/manifest-texts-K650kDy8.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -2
- package/dist/{pass-records-DdiDtl_g.mjs → pass-records-kbx5VgwI.mjs} +4 -4
- package/dist/{pass-records-DdiDtl_g.mjs.map → pass-records-kbx5VgwI.mjs.map} +1 -1
- package/dist/{problem-glqVxx3h.mjs → problem-Ciud2WGj.mjs} +2 -2
- package/dist/{problem-glqVxx3h.mjs.map → problem-Ciud2WGj.mjs.map} +1 -1
- package/dist/publish.mjs +55 -8
- package/dist/publish.mjs.map +1 -1
- package/dist/{published-DnkuW2Tw.mjs → published-CpfXkChq.mjs} +3 -3
- package/dist/{published-DnkuW2Tw.mjs.map → published-CpfXkChq.mjs.map} +1 -1
- package/dist/published.d.mts +1 -0
- package/dist/published.mjs +136 -0
- package/dist/published.mjs.map +1 -0
- package/dist/refs.mjs +3 -3
- package/dist/{repository-files-mOPItI5o.mjs → repository-files-C2gVviac.mjs} +44 -22
- package/dist/repository-files-C2gVviac.mjs.map +1 -0
- package/dist/{runtime-mDBC8Yey.mjs → runtime-1exMm81b.mjs} +2 -2
- package/dist/{runtime-mDBC8Yey.mjs.map → runtime-1exMm81b.mjs.map} +1 -1
- package/dist/{syntax-A3ga4Ksb.mjs → syntax-Dx4HQIK-.mjs} +2 -2
- package/dist/{syntax-A3ga4Ksb.mjs.map → syntax-Dx4HQIK-.mjs.map} +1 -1
- package/dist/{upstream-exits-Bv2E-QO6.mjs → upstream-exits-Clnl4-G5.mjs} +4 -4
- package/dist/{upstream-exits-Bv2E-QO6.mjs.map → upstream-exits-Clnl4-G5.mjs.map} +1 -1
- package/dist/wake.mjs +1 -1
- package/dist/workspace-manifest-BC-1cRIJ.mjs +20 -0
- package/dist/workspace-manifest-BC-1cRIJ.mjs.map +1 -0
- package/dist/workspace-settings.mjs +4 -4
- package/package.json +7 -7
- package/skills/msch-checks/SKILL.md +7 -1
- package/skills/msch-publishing/SKILL.md +7 -6
- 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-CpfXkChq.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-kbx5VgwI.mjs";
|
|
5
|
+
import { a as groupOf, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-C2gVviac.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-Clnl4-G5.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-C3kCe35Q.mjs";
|
|
9
|
+
import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-Ciud2WGj.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-Dx4HQIK-.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-K650kDy8.mjs";
|
|
14
|
+
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-1exMm81b.mjs";
|
|
13
15
|
import "./cli-contract-D7btWrEu.mjs";
|
|
14
16
|
import { builtinModules } from "node:module";
|
|
15
17
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
16
|
-
import { Array, Boolean as Boolean$1,
|
|
18
|
+
import { Array, Boolean as Boolean$1, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
17
19
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
18
20
|
import { ChildProcess } from "effect/process";
|
|
19
21
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
20
22
|
import { parse as parse$1 } from "@pnpm/deps.path";
|
|
21
23
|
import { fileURLToPath } from "node:url";
|
|
24
|
+
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
22
25
|
import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
|
|
23
26
|
import { rolldown } from "vite/rolldown";
|
|
24
27
|
import { stripVTControlCharacters } from "node:util";
|
|
@@ -30,7 +33,6 @@ import { isComment, isTag, isText } from "domhandler";
|
|
|
30
33
|
import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
|
|
31
34
|
import { DockerfileParser } from "dockerfile-ast";
|
|
32
35
|
import { parse as parse$3 } from "sql-parser-cst";
|
|
33
|
-
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
34
36
|
import { findSkillFiles } from "@tanstack/intent";
|
|
35
37
|
// src/entities/workspace/model/run-tasks.ts
|
|
36
38
|
const TaskProperty = Schema.Struct({
|
|
@@ -84,7 +86,8 @@ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(r
|
|
|
84
86
|
return pipe(projects, Array.map(namedIn((directory) => files.basename(directory))));
|
|
85
87
|
});
|
|
86
88
|
// src/entities/workspace/model/cargo-crates.ts
|
|
87
|
-
const SEPARATOR$
|
|
89
|
+
const SEPARATOR$22 = "/";
|
|
90
|
+
const SUCCESS$1 = 0;
|
|
88
91
|
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
89
92
|
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
90
93
|
const CrateEntry = Schema.Struct({
|
|
@@ -105,7 +108,7 @@ const crateOf$1 = (crate) => ({
|
|
|
105
108
|
});
|
|
106
109
|
/** @internal */
|
|
107
110
|
const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
108
|
-
const
|
|
111
|
+
const handle = yield* ChildProcess.make("cargo", [
|
|
109
112
|
"metadata",
|
|
110
113
|
"--no-deps",
|
|
111
114
|
"--format-version",
|
|
@@ -115,13 +118,15 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
115
118
|
cwd: root,
|
|
116
119
|
extendEnv: true,
|
|
117
120
|
stdin: "ignore"
|
|
118
|
-
})
|
|
121
|
+
});
|
|
122
|
+
const output = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
123
|
+
if ((yield* handle.exitCode) !== SUCCESS$1) return [];
|
|
119
124
|
const list = yield* decodeCrateList(output);
|
|
120
125
|
return pipe(list.packages, Array.map(crateOf$1));
|
|
121
126
|
}, Effect.scoped);
|
|
122
127
|
/** @internal */
|
|
123
128
|
const owningWorkspace = (directories) => (directory) => {
|
|
124
|
-
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
129
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$22}`)(directory)));
|
|
125
130
|
return Array.last(Array.sort(owners, String$1.Order));
|
|
126
131
|
};
|
|
127
132
|
// src/features/check-overrides/model/override-findings.ts
|
|
@@ -341,11 +346,11 @@ const judge = (baseline) => (key, candidate) => {
|
|
|
341
346
|
};
|
|
342
347
|
const BASELINE_PROBE = "msch-baseline-probe";
|
|
343
348
|
const REMOVED_DEPENDENCY = "-";
|
|
344
|
-
const QUOTES = ["\"", "'"];
|
|
349
|
+
const QUOTES$1 = ["\"", "'"];
|
|
345
350
|
const PREVIOUS = 1;
|
|
346
351
|
const keyStart = (source) => (index) => {
|
|
347
352
|
const before = String$1.slice(index - PREVIOUS, index)(source);
|
|
348
|
-
return index - Number(Array.contains(QUOTES, before)) * PREVIOUS;
|
|
353
|
+
return index - Number(Array.contains(QUOTES$1, before)) * PREVIOUS;
|
|
349
354
|
};
|
|
350
355
|
const overrideKeysOf = (source) => (overrides) => {
|
|
351
356
|
const at = positionOf(source);
|
|
@@ -360,10 +365,10 @@ const withBaselineProbe = (overrides) => ({
|
|
|
360
365
|
[BASELINE_PROBE]: REMOVED_DEPENDENCY
|
|
361
366
|
});
|
|
362
367
|
// src/features/check-overrides/model/overrides.ts
|
|
363
|
-
const WORKSPACE_FILE$
|
|
368
|
+
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
364
369
|
const RESOLUTION_FILES = [
|
|
365
370
|
"*package.json",
|
|
366
|
-
WORKSPACE_FILE$
|
|
371
|
+
WORKSPACE_FILE$6,
|
|
367
372
|
"pnpm-lock.yaml",
|
|
368
373
|
".npmrc",
|
|
369
374
|
"patches/*"
|
|
@@ -465,7 +470,7 @@ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace,
|
|
|
465
470
|
const { root, overrides } = workspace;
|
|
466
471
|
const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));
|
|
467
472
|
const judgeAgainstBaseline = judge(baseline);
|
|
468
|
-
const file = path.join(root, WORKSPACE_FILE$
|
|
473
|
+
const file = path.join(root, WORKSPACE_FILE$6);
|
|
469
474
|
const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(Effect.map((candidate) => overrideProblem({
|
|
470
475
|
...located,
|
|
471
476
|
file
|
|
@@ -477,7 +482,7 @@ const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace,
|
|
|
477
482
|
const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
|
|
478
483
|
const fs = yield* FileSystem.FileSystem;
|
|
479
484
|
const path = yield* Path.Path;
|
|
480
|
-
const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$
|
|
485
|
+
const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$6)).pipe(Effect.option);
|
|
481
486
|
const manifest = yield* workspaceManifest(root);
|
|
482
487
|
const overrides = pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)), Option.getOrElse(() => ({})));
|
|
483
488
|
const keys = pipe(source, Option.map((text) => overrideKeysOf(text)(overrides)), Option.getOrElse(() => []));
|
|
@@ -493,7 +498,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
493
498
|
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
494
499
|
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
495
500
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
496
|
-
const READ_CONCURRENCY$
|
|
501
|
+
const READ_CONCURRENCY$35 = 64;
|
|
497
502
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
498
503
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
499
504
|
/** @internal */
|
|
@@ -516,93 +521,93 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
516
521
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
517
522
|
onNone: () => [],
|
|
518
523
|
onSome: (source) => problemsIn(entry, source)
|
|
519
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
524
|
+
}))), { concurrency: READ_CONCURRENCY$35 });
|
|
520
525
|
return Array.flatten(found);
|
|
521
526
|
});
|
|
522
527
|
// src/features/check-overrides/model/git-subpath.ts
|
|
523
528
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
524
529
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
525
|
-
const RULE$
|
|
530
|
+
const RULE$66 = "git-subpath-dependency";
|
|
526
531
|
const WHOLE_MATCH$4 = 0;
|
|
527
532
|
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
528
533
|
file,
|
|
529
534
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
530
|
-
rule: RULE$
|
|
535
|
+
rule: RULE$66,
|
|
531
536
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
532
537
|
});
|
|
533
|
-
const problemsIn$
|
|
538
|
+
const problemsIn$22 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
|
|
534
539
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
535
540
|
/** @internal */
|
|
536
541
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
537
542
|
const listed = yield* listedFiles(root);
|
|
538
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
543
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$22);
|
|
539
544
|
});
|
|
540
545
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
541
|
-
const RULE$
|
|
546
|
+
const RULE$65 = "unnamed-restriction";
|
|
542
547
|
const WHOLE_MATCH$3 = 0;
|
|
543
548
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
544
|
-
const problemsIn$
|
|
549
|
+
const problemsIn$21 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
545
550
|
file: entry.file,
|
|
546
551
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
547
|
-
rule: RULE$
|
|
552
|
+
rule: RULE$65,
|
|
548
553
|
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
549
554
|
})));
|
|
550
555
|
/** @internal */
|
|
551
556
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
552
557
|
const listed = yield* listedFiles(root);
|
|
553
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
558
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$21);
|
|
554
559
|
});
|
|
555
560
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
556
|
-
const RULE$
|
|
561
|
+
const RULE$64 = "named-type-exemption";
|
|
557
562
|
const WHOLE_MATCH$2 = 0;
|
|
558
563
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
559
|
-
const problemsIn$
|
|
564
|
+
const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
560
565
|
file: entry.file,
|
|
561
566
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
562
|
-
rule: RULE$
|
|
567
|
+
rule: RULE$64,
|
|
563
568
|
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
564
569
|
})));
|
|
565
570
|
/** @internal */
|
|
566
571
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
567
572
|
const listed = yield* listedFiles(root);
|
|
568
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
573
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$20);
|
|
569
574
|
});
|
|
570
575
|
// src/features/check-overrides/model/package-registry.ts
|
|
571
|
-
const RULE$
|
|
576
|
+
const RULE$63 = "package-registry";
|
|
572
577
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
573
578
|
const TRAILING_SLASH = /\/$/u;
|
|
574
|
-
const WORKSPACE_FILE$
|
|
579
|
+
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
575
580
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
576
581
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
577
582
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
578
|
-
const START$
|
|
583
|
+
const START$25 = 0;
|
|
579
584
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
580
585
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
581
586
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
582
587
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
583
588
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
584
|
-
const offsetIn
|
|
589
|
+
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$25));
|
|
585
590
|
const workspaceProblem = (file, source, registry) => ({
|
|
586
591
|
file,
|
|
587
|
-
...positionOf(source)(offsetIn
|
|
588
|
-
rule: RULE$
|
|
592
|
+
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
593
|
+
rule: RULE$63,
|
|
589
594
|
message: Option.match(registry, {
|
|
590
|
-
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$
|
|
595
|
+
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
591
596
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
592
597
|
})
|
|
593
598
|
});
|
|
594
599
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf("value")(found), isGuarded)), Array.map((found) => ({
|
|
595
600
|
file: entry.file,
|
|
596
|
-
...positionOf(source)(found.index ?? START$
|
|
597
|
-
rule: RULE$
|
|
598
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
601
|
+
...positionOf(source)(found.index ?? START$25),
|
|
602
|
+
rule: RULE$63,
|
|
603
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$25])}\`. Remove the line.`
|
|
599
604
|
})));
|
|
600
605
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
601
606
|
const files = yield* RepositoryFiles;
|
|
602
607
|
const manifest = yield* workspaceManifest(root);
|
|
603
608
|
if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) return [];
|
|
604
609
|
const registry = registryOf(manifest.value);
|
|
605
|
-
const file = files.join(root, WORKSPACE_FILE$
|
|
610
|
+
const file = files.join(root, WORKSPACE_FILE$5);
|
|
606
611
|
const read = yield* files.readFile(file);
|
|
607
612
|
const source = Option.getOrElse(read, () => "");
|
|
608
613
|
return [workspaceProblem(file, source, registry)];
|
|
@@ -613,36 +618,8 @@ 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 FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
619
|
-
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
620
|
-
const decodeJson$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
621
|
-
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
622
|
-
/** @internal */
|
|
623
|
-
const decodeManifest$8 = (source) => decodeJson$2(source);
|
|
624
|
-
/** @internal */
|
|
625
|
-
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
626
|
-
/** @internal */
|
|
627
|
-
const namedCatalogsOf = (settings) => Record.toEntries(fieldsOf(settings["catalogs"]));
|
|
628
|
-
/** @internal */
|
|
629
|
-
const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString$2(value), Option.map((specifier) => ({
|
|
630
|
-
name,
|
|
631
|
-
specifier
|
|
632
|
-
})), Option.toArray)));
|
|
633
|
-
/** @internal */
|
|
634
|
-
const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
635
|
-
/** @internal */
|
|
636
|
-
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
637
|
-
/** @internal */
|
|
638
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$23));
|
|
639
|
-
const SECTIONS = [
|
|
640
|
-
"dependencies",
|
|
641
|
-
"devDependencies",
|
|
642
|
-
"optionalDependencies"
|
|
643
|
-
];
|
|
644
|
-
/** @internal */
|
|
645
|
-
const manifestSpecifiers = (source) => pipe(decodeJson$2(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])))), Option.getOrElse(() => []));
|
|
621
|
+
// src/entities/package/model/stack-catalog.ts
|
|
622
|
+
const STACK_CATALOG = "catalog:stack";
|
|
646
623
|
// src/entities/package/model/published-manifest.ts
|
|
647
624
|
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
648
625
|
const PublishedManifestSchema = Schema.Struct({
|
|
@@ -669,7 +646,7 @@ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* sca
|
|
|
669
646
|
})), Option.getOrElse(() => [])));
|
|
670
647
|
});
|
|
671
648
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
672
|
-
const RULE$
|
|
649
|
+
const RULE$62 = "colocated-git-patterns";
|
|
673
650
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
674
651
|
const ROOT$3 = ".";
|
|
675
652
|
const NEGATION$1 = "!";
|
|
@@ -680,7 +657,7 @@ const LEADING_SLASHES = /^\/+/u;
|
|
|
680
657
|
const TRAILING_SLASHES = /\/+$/u;
|
|
681
658
|
const SPACES = /\s+/u;
|
|
682
659
|
const FIRST$22 = 1;
|
|
683
|
-
const READ_CONCURRENCY$
|
|
660
|
+
const READ_CONCURRENCY$34 = 16;
|
|
684
661
|
const withoutPrefix = (prefix, text) => {
|
|
685
662
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
686
663
|
return text;
|
|
@@ -716,7 +693,7 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
716
693
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
717
694
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
718
695
|
});
|
|
719
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
696
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$62)(entry.file, {
|
|
720
697
|
line: entry.line,
|
|
721
698
|
column: FIRST$22
|
|
722
699
|
}, message);
|
|
@@ -771,17 +748,17 @@ const repeated = (entries) => (entry) => {
|
|
|
771
748
|
/** @internal */
|
|
772
749
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
773
750
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
774
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
751
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$34 });
|
|
775
752
|
const entries = Array.flatten(read);
|
|
776
753
|
const workspaces = yield* workspaceDirectories(root);
|
|
777
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
754
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$34 });
|
|
778
755
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
779
756
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
780
757
|
});
|
|
781
758
|
// src/features/check-placement/model/colocated-tests.ts
|
|
782
|
-
const RULE$
|
|
759
|
+
const RULE$61 = "colocated-test";
|
|
783
760
|
const FIRST$21 = 1;
|
|
784
|
-
const READ_CONCURRENCY$
|
|
761
|
+
const READ_CONCURRENCY$33 = 64;
|
|
785
762
|
const ROOT_SUBPATH = ".";
|
|
786
763
|
const NAME_GROUP = "name";
|
|
787
764
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -797,17 +774,17 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
|
|
|
797
774
|
const EXCLUDED$7 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
798
775
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
799
776
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
800
|
-
const Manifest$
|
|
777
|
+
const Manifest$7 = Schema.Struct({
|
|
801
778
|
name: Schema.optional(Schema.String),
|
|
802
779
|
exports: Schema.optional(Schema.Unknown)
|
|
803
780
|
});
|
|
804
|
-
const decodeManifest$
|
|
781
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$7));
|
|
805
782
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
806
783
|
const problemFor$9 = (test, message) => ({
|
|
807
784
|
file: test.file,
|
|
808
785
|
line: FIRST$21,
|
|
809
786
|
column: FIRST$21,
|
|
810
|
-
rule: RULE$
|
|
787
|
+
rule: RULE$61,
|
|
811
788
|
message: `${test.base} ${message}`
|
|
812
789
|
});
|
|
813
790
|
const groupsOf$1 = (source, pattern, group) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array.getSomes);
|
|
@@ -827,7 +804,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
827
804
|
if (Option.isNone(owner)) return [];
|
|
828
805
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
829
806
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
830
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
807
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(specifiersBeside({
|
|
831
808
|
join,
|
|
832
809
|
dirname: files.dirname,
|
|
833
810
|
directory: test.directory
|
|
@@ -870,12 +847,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
870
847
|
directory: files.dirname(file)
|
|
871
848
|
};
|
|
872
849
|
}));
|
|
873
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$
|
|
850
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$33 });
|
|
874
851
|
return Array.getSomes(found);
|
|
875
852
|
});
|
|
876
853
|
// src/shared/lib/agent-docs.ts
|
|
877
854
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
878
|
-
const READ_CONCURRENCY$
|
|
855
|
+
const READ_CONCURRENCY$32 = 16;
|
|
879
856
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
880
857
|
const files = yield* RepositoryFiles;
|
|
881
858
|
const listed = yield* files.listedFiles(root);
|
|
@@ -884,13 +861,13 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
884
861
|
const file = files.join(root, name);
|
|
885
862
|
const problemOf = Option.flatMap(problemIn(file));
|
|
886
863
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
887
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
864
|
+
}, { concurrency: READ_CONCURRENCY$32 });
|
|
888
865
|
return Array.getSomes(found);
|
|
889
866
|
});
|
|
890
867
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
891
868
|
const RECOMMENDED_LINES = 200;
|
|
892
869
|
const FIRST$20 = 1;
|
|
893
|
-
const RULE$
|
|
870
|
+
const RULE$60 = "agent-docs-length";
|
|
894
871
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
895
872
|
const problemFor$8 = (file) => (lines) => {
|
|
896
873
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -898,18 +875,18 @@ const problemFor$8 = (file) => (lines) => {
|
|
|
898
875
|
file,
|
|
899
876
|
line: 201,
|
|
900
877
|
column: FIRST$20,
|
|
901
|
-
rule: RULE$
|
|
878
|
+
rule: RULE$60,
|
|
902
879
|
message: `has ${String(lines)} lines. Claude Code recommends under ${String(RECOMMENDED_LINES)} lines per file: longer files cost context and are followed less reliably. Cut what the code already tells, and move rules shared across repositories into skills.`
|
|
903
880
|
});
|
|
904
881
|
};
|
|
905
882
|
/** @internal */
|
|
906
883
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
907
884
|
// src/features/check-placement/model/claude-link.ts
|
|
908
|
-
const RULE$
|
|
885
|
+
const RULE$59 = "claude-md-link";
|
|
909
886
|
const CLAUDE = "CLAUDE.md";
|
|
910
887
|
const AGENTS = "AGENTS.md";
|
|
911
888
|
const FIRST$19 = 1;
|
|
912
|
-
const READ_CONCURRENCY$
|
|
889
|
+
const READ_CONCURRENCY$31 = 16;
|
|
913
890
|
const MESSAGE$17 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
914
891
|
/** @internal */
|
|
915
892
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -924,20 +901,20 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
924
901
|
file: path,
|
|
925
902
|
line: FIRST$19,
|
|
926
903
|
column: FIRST$19,
|
|
927
|
-
rule: RULE$
|
|
904
|
+
rule: RULE$59,
|
|
928
905
|
message: MESSAGE$17
|
|
929
906
|
})));
|
|
930
907
|
});
|
|
931
908
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
932
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
909
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$31 });
|
|
933
910
|
return Array.getSomes(found);
|
|
934
911
|
});
|
|
935
912
|
// src/features/check-placement/model/dangling-links.ts
|
|
936
|
-
const RULE$
|
|
937
|
-
const SEPARATOR$
|
|
913
|
+
const RULE$58 = "dangling-link";
|
|
914
|
+
const SEPARATOR$21 = "/";
|
|
938
915
|
const FIRST$18 = 1;
|
|
939
|
-
const READ_CONCURRENCY$
|
|
940
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
916
|
+
const READ_CONCURRENCY$30 = 16;
|
|
917
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$21}`)(name);
|
|
941
918
|
/** @internal */
|
|
942
919
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
943
920
|
const files = yield* RepositoryFiles;
|
|
@@ -949,17 +926,17 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
949
926
|
file,
|
|
950
927
|
line: FIRST$18,
|
|
951
928
|
column: FIRST$18,
|
|
952
|
-
rule: RULE$
|
|
929
|
+
rule: RULE$58,
|
|
953
930
|
message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
|
|
954
931
|
})));
|
|
955
932
|
});
|
|
956
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
933
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$30 });
|
|
957
934
|
return Array.getSomes(found);
|
|
958
935
|
});
|
|
959
936
|
// src/features/check-placement/model/member-sources.ts
|
|
960
937
|
const ROOT_WORKSPACE$1 = ".";
|
|
961
938
|
const FIRST$17 = 1;
|
|
962
|
-
const SEPARATOR$
|
|
939
|
+
const SEPARATOR$20 = "/";
|
|
963
940
|
const EXCLUDED$6 = [
|
|
964
941
|
":(exclude,attr:linguist-vendored)",
|
|
965
942
|
":(exclude,attr:linguist-generated)",
|
|
@@ -984,7 +961,7 @@ const fileProblem$1 = ({ file, rule, message }) => ({
|
|
|
984
961
|
rule,
|
|
985
962
|
message
|
|
986
963
|
});
|
|
987
|
-
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$
|
|
964
|
+
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$20}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
988
965
|
workspace,
|
|
989
966
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
990
967
|
})));
|
|
@@ -1007,9 +984,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
1007
984
|
}));
|
|
1008
985
|
});
|
|
1009
986
|
// src/features/check-placement/model/deployed-readme.ts
|
|
1010
|
-
const RULE$
|
|
987
|
+
const RULE$57 = "deployed-readme";
|
|
1011
988
|
const ROOT_DIRECTORY$4 = "";
|
|
1012
|
-
const READ_CONCURRENCY$
|
|
989
|
+
const READ_CONCURRENCY$29 = 16;
|
|
1013
990
|
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
1014
991
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
1015
992
|
const ADDRESS_KEYS = [
|
|
@@ -1047,14 +1024,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1047
1024
|
const readme = yield* readReadme({
|
|
1048
1025
|
root,
|
|
1049
1026
|
directory,
|
|
1050
|
-
rule: RULE$
|
|
1027
|
+
rule: RULE$57,
|
|
1051
1028
|
missingMessage: MISSING_MESSAGE$2
|
|
1052
1029
|
});
|
|
1053
1030
|
return Result.match(readme, {
|
|
1054
1031
|
onFailure: Option.some,
|
|
1055
1032
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
1056
1033
|
file,
|
|
1057
|
-
rule: RULE$
|
|
1034
|
+
rule: RULE$57,
|
|
1058
1035
|
message: NO_URL_MESSAGE
|
|
1059
1036
|
})))
|
|
1060
1037
|
});
|
|
@@ -1065,16 +1042,16 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
1065
1042
|
const listed = yield* files.listedFiles(root);
|
|
1066
1043
|
const directories = yield* workspaceDirectories(root);
|
|
1067
1044
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
1068
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
1045
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$29 });
|
|
1069
1046
|
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array.dedupe);
|
|
1070
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1047
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$29 });
|
|
1071
1048
|
return Array.getSomes(found);
|
|
1072
1049
|
});
|
|
1073
1050
|
// src/features/check-placement/model/nested-docs.ts
|
|
1074
|
-
const RULE$
|
|
1051
|
+
const RULE$56 = "nested-docs";
|
|
1075
1052
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
1076
|
-
const SEPARATOR$
|
|
1077
|
-
const READ_CONCURRENCY$
|
|
1053
|
+
const SEPARATOR$19 = "/";
|
|
1054
|
+
const READ_CONCURRENCY$28 = 64;
|
|
1078
1055
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1079
1056
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1080
1057
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
@@ -1083,8 +1060,8 @@ const MISSING_RULE = "workspace-agents-md";
|
|
|
1083
1060
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1084
1061
|
const taggedError$6 = Schema.TaggedError;
|
|
1085
1062
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1086
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1087
|
-
const problemFor$7 = problemInFile(RULE$
|
|
1063
|
+
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
1064
|
+
const problemFor$7 = problemInFile(RULE$56);
|
|
1088
1065
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1089
1066
|
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
1090
1067
|
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
@@ -1131,7 +1108,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1131
1108
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
1132
1109
|
workspaceAgentDocs
|
|
1133
1110
|
};
|
|
1134
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
1111
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$28 });
|
|
1135
1112
|
const missing = missingProblems({
|
|
1136
1113
|
required: workspaceAgentDocs,
|
|
1137
1114
|
directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
|
|
@@ -1141,15 +1118,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1141
1118
|
return [...Array.getSomes(found), ...missing];
|
|
1142
1119
|
});
|
|
1143
1120
|
// src/features/check-placement/model/published-readme.ts
|
|
1144
|
-
const RULE$
|
|
1145
|
-
const READ_CONCURRENCY$
|
|
1121
|
+
const RULE$55 = "published-readme";
|
|
1122
|
+
const READ_CONCURRENCY$27 = 16;
|
|
1146
1123
|
const MESSAGE$16 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
1147
1124
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
1148
1125
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
1149
1126
|
const readme = yield* readReadme({
|
|
1150
1127
|
root,
|
|
1151
1128
|
directory,
|
|
1152
|
-
rule: RULE$
|
|
1129
|
+
rule: RULE$55,
|
|
1153
1130
|
missingMessage: MISSING_MESSAGE
|
|
1154
1131
|
});
|
|
1155
1132
|
return Result.match(readme, {
|
|
@@ -1160,7 +1137,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1160
1137
|
file,
|
|
1161
1138
|
line,
|
|
1162
1139
|
column,
|
|
1163
|
-
rule: RULE$
|
|
1140
|
+
rule: RULE$55,
|
|
1164
1141
|
message: MESSAGE$16
|
|
1165
1142
|
};
|
|
1166
1143
|
}))
|
|
@@ -1169,11 +1146,11 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
1169
1146
|
/** @internal */
|
|
1170
1147
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
1171
1148
|
const projects = yield* publishedProjects(root);
|
|
1172
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$
|
|
1149
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$27 });
|
|
1173
1150
|
return Array.getSomes(found);
|
|
1174
1151
|
});
|
|
1175
1152
|
// src/features/check-placement/model/published-tests.ts
|
|
1176
|
-
const RULE$
|
|
1153
|
+
const RULE$54 = "published-tests";
|
|
1177
1154
|
const MANIFEST_FILE$2 = "package.json";
|
|
1178
1155
|
const FILE_START = 1;
|
|
1179
1156
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -1188,7 +1165,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
1188
1165
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
1189
1166
|
line: FILE_START,
|
|
1190
1167
|
column: FILE_START,
|
|
1191
|
-
rule: RULE$
|
|
1168
|
+
rule: RULE$54,
|
|
1192
1169
|
message: MESSAGE$15
|
|
1193
1170
|
});
|
|
1194
1171
|
});
|
|
@@ -1202,13 +1179,13 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
1202
1179
|
return Array.getSomes(found);
|
|
1203
1180
|
});
|
|
1204
1181
|
// src/features/check-placement/model/root-docs.ts
|
|
1205
|
-
const RULE$
|
|
1206
|
-
const SEPARATOR$
|
|
1182
|
+
const RULE$53 = "root-docs";
|
|
1183
|
+
const SEPARATOR$18 = "/";
|
|
1207
1184
|
const FIRST$16 = 1;
|
|
1208
1185
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1209
1186
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1210
1187
|
const MESSAGE$14 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
1211
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
1188
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1212
1189
|
/** @internal */
|
|
1213
1190
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1214
1191
|
const files = yield* RepositoryFiles;
|
|
@@ -1217,18 +1194,18 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1217
1194
|
file: files.join(root, name),
|
|
1218
1195
|
line: FIRST$16,
|
|
1219
1196
|
column: FIRST$16,
|
|
1220
|
-
rule: RULE$
|
|
1197
|
+
rule: RULE$53,
|
|
1221
1198
|
message: `${name} ${MESSAGE$14}`
|
|
1222
1199
|
})));
|
|
1223
1200
|
});
|
|
1224
1201
|
// src/features/check-placement/model/root-readme.ts
|
|
1225
|
-
const RULE$
|
|
1202
|
+
const RULE$52 = "root-readme";
|
|
1226
1203
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1227
|
-
const READ_CONCURRENCY$
|
|
1228
|
-
const START$
|
|
1204
|
+
const READ_CONCURRENCY$26 = 16;
|
|
1205
|
+
const START$24 = 0;
|
|
1229
1206
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1230
1207
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
1231
|
-
const RELATIVE$
|
|
1208
|
+
const RELATIVE$2 = /^\.\//u;
|
|
1232
1209
|
const MarketplacePlugin = Schema.Struct({
|
|
1233
1210
|
name: Schema.optional(Schema.String),
|
|
1234
1211
|
source: Schema.Unknown
|
|
@@ -1241,7 +1218,7 @@ const NO_PLUGINS = {
|
|
|
1241
1218
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1242
1219
|
const messageFor$1 = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1243
1220
|
const pluginsOf = (plugins) => {
|
|
1244
|
-
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$
|
|
1221
|
+
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$2, "")));
|
|
1245
1222
|
const segments = pipe(directories, Array.map(baseName));
|
|
1246
1223
|
return {
|
|
1247
1224
|
directories,
|
|
@@ -1262,17 +1239,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
1262
1239
|
onNone: () => ownNames(plugins, names),
|
|
1263
1240
|
onSome: () => [directory]
|
|
1264
1241
|
}));
|
|
1265
|
-
const problemsIn$
|
|
1242
|
+
const problemsIn$19 = (file, source, plugins) => (workspace) => {
|
|
1266
1243
|
const message = messageFor$1(workspace.directory);
|
|
1267
1244
|
const at = positionOf(source);
|
|
1268
1245
|
const pattern = patternFor(plugins)(workspace);
|
|
1269
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$
|
|
1246
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$52)(file, at(found.index ?? START$24), message)));
|
|
1270
1247
|
};
|
|
1271
1248
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1272
1249
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1273
1250
|
return pipe(text, Option.match({
|
|
1274
1251
|
onNone: () => [],
|
|
1275
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1252
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$19(file, source, plugins)))
|
|
1276
1253
|
}));
|
|
1277
1254
|
});
|
|
1278
1255
|
/** @internal */
|
|
@@ -1283,7 +1260,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1283
1260
|
const named = yield* namedWorkspaces(root);
|
|
1284
1261
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1285
1262
|
const plugins = yield* marketplacePlugins(root);
|
|
1286
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
1263
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$26 });
|
|
1287
1264
|
return Array.flatten(found);
|
|
1288
1265
|
});
|
|
1289
1266
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -1303,10 +1280,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1303
1280
|
return Array.flatten(found);
|
|
1304
1281
|
});
|
|
1305
1282
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1306
|
-
const RULE$
|
|
1283
|
+
const RULE$51 = "docs-mirror";
|
|
1307
1284
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1308
1285
|
const MIRROR_LIMIT = 3;
|
|
1309
|
-
const READ_CONCURRENCY$
|
|
1286
|
+
const READ_CONCURRENCY$25 = 16;
|
|
1310
1287
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
1311
1288
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
1312
1289
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -1328,7 +1305,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
1328
1305
|
file,
|
|
1329
1306
|
line,
|
|
1330
1307
|
column,
|
|
1331
|
-
rule: RULE$
|
|
1308
|
+
rule: RULE$51,
|
|
1332
1309
|
message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`
|
|
1333
1310
|
};
|
|
1334
1311
|
}), Option.toArray);
|
|
@@ -1343,7 +1320,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
1343
1320
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
1344
1321
|
directory,
|
|
1345
1322
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
1346
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1323
|
+
}))), { concurrency: READ_CONCURRENCY$25 });
|
|
1347
1324
|
});
|
|
1348
1325
|
/** @internal */
|
|
1349
1326
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1356,11 +1333,11 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1356
1333
|
onNone: () => [],
|
|
1357
1334
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
1358
1335
|
})));
|
|
1359
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1336
|
+
}, { concurrency: READ_CONCURRENCY$25 });
|
|
1360
1337
|
return Array.flatten(found);
|
|
1361
1338
|
});
|
|
1362
1339
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1363
|
-
const RULE$
|
|
1340
|
+
const RULE$50 = "ignored-sources";
|
|
1364
1341
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1365
1342
|
const FIRST$15 = 1;
|
|
1366
1343
|
const MESSAGE$13 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
@@ -1372,7 +1349,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1372
1349
|
file: files.join(root, file),
|
|
1373
1350
|
line: FIRST$15,
|
|
1374
1351
|
column: FIRST$15,
|
|
1375
|
-
rule: RULE$
|
|
1352
|
+
rule: RULE$50,
|
|
1376
1353
|
message: MESSAGE$13
|
|
1377
1354
|
})));
|
|
1378
1355
|
});
|
|
@@ -9920,7 +9897,7 @@ var english_verbs_default = [
|
|
|
9920
9897
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
9921
9898
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
9922
9899
|
const SEGMENT_RULE = "slice-segment-name";
|
|
9923
|
-
const SEPARATOR$
|
|
9900
|
+
const SEPARATOR$16 = "/";
|
|
9924
9901
|
const NEXT$3 = 1;
|
|
9925
9902
|
const WORD_SEPARATOR$1 = "-";
|
|
9926
9903
|
const MINIMUM_WORDS = 2;
|
|
@@ -9946,7 +9923,7 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
9946
9923
|
return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
|
|
9947
9924
|
};
|
|
9948
9925
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
9949
|
-
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$
|
|
9926
|
+
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$16))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$16}${FEATURES$1}${slice}`));
|
|
9950
9927
|
const SLICE_LAYERS = [
|
|
9951
9928
|
"features",
|
|
9952
9929
|
"entities",
|
|
@@ -9954,26 +9931,26 @@ const SLICE_LAYERS = [
|
|
|
9954
9931
|
"pages"
|
|
9955
9932
|
];
|
|
9956
9933
|
const SLICE_DEPTHS = [3, 4];
|
|
9957
|
-
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$
|
|
9934
|
+
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$16);
|
|
9958
9935
|
const isInSliceLayer = (parts) => {
|
|
9959
9936
|
const [source, layer] = parts;
|
|
9960
|
-
return `${source}${SEPARATOR$
|
|
9937
|
+
return `${source}${SEPARATOR$16}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
|
|
9961
9938
|
};
|
|
9962
9939
|
const indexedSlice = (owned) => {
|
|
9963
|
-
const parts = String$1.split(owned.inner, SEPARATOR$
|
|
9940
|
+
const parts = String$1.split(owned.inner, SEPARATOR$16);
|
|
9964
9941
|
const depth = parts.length - NEXT$3;
|
|
9965
|
-
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$
|
|
9942
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$16}${pathPrefix(parts, depth)}`));
|
|
9966
9943
|
};
|
|
9967
9944
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
9968
|
-
const parts = String$1.split(inner, SEPARATOR$
|
|
9969
|
-
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$
|
|
9945
|
+
const parts = String$1.split(inner, SEPARATOR$16);
|
|
9946
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$16}${pathPrefix(parts, depth)}`);
|
|
9970
9947
|
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
9971
|
-
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$
|
|
9948
|
+
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$16}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
9972
9949
|
};
|
|
9973
9950
|
const deployNamed = ({ workspace, inner }) => {
|
|
9974
9951
|
if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
|
|
9975
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
9976
|
-
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$
|
|
9952
|
+
const segments = String$1.split(inner, SEPARATOR$16);
|
|
9953
|
+
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$16}${Array.join(Array.take(segments, index + NEXT$3), SEPARATOR$16)}`));
|
|
9977
9954
|
};
|
|
9978
9955
|
/** @internal */
|
|
9979
9956
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -10016,7 +9993,7 @@ const LAYER_ITEMS = [
|
|
|
10016
9993
|
"attribute_item",
|
|
10017
9994
|
"inner_attribute_item"
|
|
10018
9995
|
];
|
|
10019
|
-
const READ_CONCURRENCY$
|
|
9996
|
+
const READ_CONCURRENCY$24 = 64;
|
|
10020
9997
|
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
10021
9998
|
const NONE$1 = [];
|
|
10022
9999
|
const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
|
|
@@ -10092,17 +10069,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
10092
10069
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$1;
|
|
10093
10070
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
10094
10071
|
const parse = parsedWith(language);
|
|
10095
|
-
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$
|
|
10072
|
+
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$24 });
|
|
10096
10073
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
10097
10074
|
});
|
|
10098
10075
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
10099
|
-
const RULE$
|
|
10076
|
+
const RULE$49 = "shadcn-ui-alias";
|
|
10100
10077
|
const FIRST$14 = 1;
|
|
10101
|
-
const problemOf$
|
|
10078
|
+
const problemOf$9 = (directory, { file, alias }) => ({
|
|
10102
10079
|
file,
|
|
10103
10080
|
line: FIRST$14,
|
|
10104
10081
|
column: FIRST$14,
|
|
10105
|
-
rule: RULE$
|
|
10082
|
+
rule: RULE$49,
|
|
10106
10083
|
message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
|
|
10107
10084
|
});
|
|
10108
10085
|
/** @internal */
|
|
@@ -10114,7 +10091,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
|
|
|
10114
10091
|
onNone: () => Effect.succeed(false),
|
|
10115
10092
|
onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
|
|
10116
10093
|
})) return Array.empty();
|
|
10117
|
-
return [problemOf$
|
|
10094
|
+
return [problemOf$9(directory, found.value)];
|
|
10118
10095
|
});
|
|
10119
10096
|
// src/features/check-placement/model/source-aliases.ts
|
|
10120
10097
|
const ALIAS_RULE = "source-alias";
|
|
@@ -10122,8 +10099,8 @@ const SOURCE_ALIAS = "#/*";
|
|
|
10122
10099
|
const SOURCE_TARGET = "./src/*";
|
|
10123
10100
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
10124
10101
|
const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
|
|
10125
|
-
const Manifest$
|
|
10126
|
-
const decodeManifest$
|
|
10102
|
+
const Manifest$6 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
10103
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
10127
10104
|
const targetsOf = (target) => {
|
|
10128
10105
|
if (Predicate.isString(target)) return [target];
|
|
10129
10106
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -10134,7 +10111,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
10134
10111
|
const files = yield* RepositoryFiles;
|
|
10135
10112
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
10136
10113
|
const text = yield* files.readFile(manifest);
|
|
10137
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10114
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemInFile(ALIAS_RULE)(manifest, `"${key}" ${ALIAS_MESSAGE}`)));
|
|
10138
10115
|
});
|
|
10139
10116
|
/** @internal */
|
|
10140
10117
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -10165,19 +10142,19 @@ const SCRIPTS = "scripts-directory";
|
|
|
10165
10142
|
const BIN = "bin";
|
|
10166
10143
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
10167
10144
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
10168
|
-
const SEPARATOR$
|
|
10145
|
+
const SEPARATOR$15 = "/";
|
|
10169
10146
|
const CURRENT = "./";
|
|
10170
|
-
const READ_CONCURRENCY$
|
|
10147
|
+
const READ_CONCURRENCY$23 = 8;
|
|
10171
10148
|
const FIRST$13 = 1;
|
|
10172
10149
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
10173
10150
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
10174
10151
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
10175
|
-
const Manifest$
|
|
10152
|
+
const Manifest$5 = Schema.Struct({
|
|
10176
10153
|
bin: Schema.optional(Schema.Unknown),
|
|
10177
10154
|
main: Schema.optional(Schema.Unknown),
|
|
10178
10155
|
exports: Schema.optional(Schema.Unknown)
|
|
10179
10156
|
});
|
|
10180
|
-
const decodeManifest$
|
|
10157
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
10181
10158
|
const NO_ENTRIES = {
|
|
10182
10159
|
all: [],
|
|
10183
10160
|
bins: []
|
|
@@ -10202,22 +10179,22 @@ const entriesOf$2 = (manifest) => {
|
|
|
10202
10179
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10203
10180
|
const files = yield* RepositoryFiles;
|
|
10204
10181
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
10205
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10182
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10206
10183
|
});
|
|
10207
10184
|
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
10208
10185
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
10209
10186
|
const files = yield* RepositoryFiles;
|
|
10210
10187
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
10211
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
10188
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$15}${name}`), Array.filter(isCommand$1));
|
|
10212
10189
|
});
|
|
10213
10190
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
10214
10191
|
const files = yield* RepositoryFiles;
|
|
10215
10192
|
const listed = yield* files.listedFiles(root);
|
|
10216
10193
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
10217
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
10194
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$23 });
|
|
10218
10195
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
10219
10196
|
});
|
|
10220
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
10197
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$15));
|
|
10221
10198
|
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND$1.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
10222
10199
|
file,
|
|
10223
10200
|
...positionOf(source)(start),
|
|
@@ -10225,7 +10202,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10225
10202
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
10226
10203
|
})));
|
|
10227
10204
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10228
|
-
const problemsIn$
|
|
10205
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10229
10206
|
const files = yield* RepositoryFiles;
|
|
10230
10207
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10231
10208
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10264,26 +10241,199 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10264
10241
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10265
10242
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10266
10243
|
const workflows = yield* workflowText(root);
|
|
10267
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
10268
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10244
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$18(root, directory, workflows), { concurrency: READ_CONCURRENCY$23 });
|
|
10245
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$23 });
|
|
10269
10246
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10270
10247
|
});
|
|
10248
|
+
// src/features/check-repository-layout/model/path-mention.ts
|
|
10249
|
+
const START$23 = 0;
|
|
10250
|
+
const QUOTES = ["\"", "'"];
|
|
10251
|
+
const firstIndex = (source, needles) => {
|
|
10252
|
+
const found = pipe(needles, Array.flatMap((needle) => Option.toArray(String$1.indexOf(needle)(source))));
|
|
10253
|
+
return Array.head(Array.sort(found, Order.Number));
|
|
10254
|
+
};
|
|
10255
|
+
const quoted$1 = (text) => pipe(QUOTES, Array.map((quote) => `${quote}${text}${quote}`));
|
|
10256
|
+
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted$1(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$23));
|
|
10257
|
+
// src/features/check-repository-layout/model/cargo-paths.ts
|
|
10258
|
+
const MEMBER_LISTS = [
|
|
10259
|
+
"members",
|
|
10260
|
+
"exclude",
|
|
10261
|
+
"default-members"
|
|
10262
|
+
];
|
|
10263
|
+
const DEPENDENCY_TABLES = [
|
|
10264
|
+
"dependencies",
|
|
10265
|
+
"dev-dependencies",
|
|
10266
|
+
"build-dependencies"
|
|
10267
|
+
];
|
|
10268
|
+
const WORKSPACE = "workspace";
|
|
10269
|
+
const PATCH = "patch";
|
|
10270
|
+
const PATCH_DEPTH = 2;
|
|
10271
|
+
const WORKSPACE_DEPTH = 1;
|
|
10272
|
+
const START$22 = 0;
|
|
10273
|
+
const WILDCARD$5 = /[*?[]/u;
|
|
10274
|
+
const KEY_SEPARATOR = ".";
|
|
10275
|
+
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
10276
|
+
const decodeStrings$1 = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
10277
|
+
const decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));
|
|
10278
|
+
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));
|
|
10279
|
+
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array.get(trail, START$22).pipe(Option.exists((name) => name === WORKSPACE)) && Array.contains(MEMBER_LISTS, key);
|
|
10280
|
+
const namedPaths = (trail, key, value) => {
|
|
10281
|
+
const field = Array.join([...trail, key], KEY_SEPARATOR);
|
|
10282
|
+
if (listsMembers(trail, key)) return pipe(decodeStrings$1(value), Option.getOrElse(() => []), Array.filter((member) => !WILDCARD$5.test(member)), Array.map((member) => ({
|
|
10283
|
+
field,
|
|
10284
|
+
target: member
|
|
10285
|
+
})));
|
|
10286
|
+
if (declaresPath(trail)) return pipe(decodePath(value), Option.toArray, Array.map(({ path }) => ({
|
|
10287
|
+
field: `${field}${KEY_SEPARATOR}path`,
|
|
10288
|
+
target: path
|
|
10289
|
+
})));
|
|
10290
|
+
return [];
|
|
10291
|
+
};
|
|
10292
|
+
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)]));
|
|
10293
|
+
/** @internal */
|
|
10294
|
+
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 }) => ({
|
|
10295
|
+
field,
|
|
10296
|
+
text: target,
|
|
10297
|
+
candidates: [target],
|
|
10298
|
+
index: indexOfText(source)(target)
|
|
10299
|
+
})));
|
|
10300
|
+
// src/features/check-repository-layout/model/path-existence.ts
|
|
10301
|
+
const WILDCARD$4 = /[*?[]/u;
|
|
10302
|
+
const SEPARATOR$14 = "/";
|
|
10303
|
+
const FIRST$12 = 0;
|
|
10304
|
+
/** @internal */
|
|
10305
|
+
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
10306
|
+
const files = yield* RepositoryFiles;
|
|
10307
|
+
return yield* files.exists(files.join(root, path));
|
|
10308
|
+
});
|
|
10309
|
+
/** @internal */
|
|
10310
|
+
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
10311
|
+
const files = yield* RepositoryFiles;
|
|
10312
|
+
const directory = yield* files.isDirectory(files.join(root, path));
|
|
10313
|
+
return Option.getOrElse(directory, () => false);
|
|
10314
|
+
});
|
|
10315
|
+
/** @internal */
|
|
10316
|
+
const staticPrefix = (path) => {
|
|
10317
|
+
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$4));
|
|
10318
|
+
if (String$1.endsWith(SEPARATOR$14)(prefix)) return String$1.slice(FIRST$12, -1)(prefix);
|
|
10319
|
+
return prefix;
|
|
10320
|
+
};
|
|
10321
|
+
/** @internal */
|
|
10322
|
+
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
10323
|
+
const prefix = staticPrefix(path);
|
|
10324
|
+
if (String$1.isEmpty(prefix)) return false;
|
|
10325
|
+
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR$14}`]);
|
|
10326
|
+
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10327
|
+
});
|
|
10328
|
+
// src/features/check-repository-layout/model/tsconfig-paths.ts
|
|
10329
|
+
const WRAP_OFFSET$2 = 1;
|
|
10330
|
+
const WILDCARD$3 = /[*?[{]/u;
|
|
10331
|
+
const SEPARATOR$13 = "/";
|
|
10332
|
+
const RELATIVE$1 = ".";
|
|
10333
|
+
const JSON_EXTENSION = ".json";
|
|
10334
|
+
const isObject = (node) => Predicate.isReadonlyObject(node) && node["type"] === "ObjectExpression";
|
|
10335
|
+
const firstObject = (node) => {
|
|
10336
|
+
if (isObject(node)) return Option.some(node);
|
|
10337
|
+
return pipe(childrenOf$1(node), Array.findFirst(firstObject));
|
|
10338
|
+
};
|
|
10339
|
+
const leadingDirectory = (pattern) => pipe(String$1.split(pattern, SEPARATOR$13), Array.takeWhile((segment) => !WILDCARD$3.test(segment)), Array.join(SEPARATOR$13));
|
|
10340
|
+
const listed$2 = (root) => (name, candidatesOf, valuesOf = stringsIn) => pipe(propertyValue(name)(root), Option.toArray, Array.flatMap(valuesOf), Array.map(({ text, start }) => ({
|
|
10341
|
+
field: name,
|
|
10342
|
+
text,
|
|
10343
|
+
candidates: candidatesOf(text),
|
|
10344
|
+
index: start - WRAP_OFFSET$2
|
|
10345
|
+
})), Array.filter(({ candidates }) => Array.isReadonlyArrayNonEmpty(candidates)));
|
|
10346
|
+
const objectsIn = (node) => [...Array.filter([node], isObject), ...pipe(childrenOf$1(node), Array.flatMap(objectsIn))];
|
|
10347
|
+
const referencedPaths = (references) => pipe(objectsIn(references), Array.flatMap((reference) => Option.toArray(propertyValue("path")(reference))), Array.flatMap(stringsIn));
|
|
10348
|
+
const exactly = (text) => [text];
|
|
10349
|
+
const relativeConfig = (text) => {
|
|
10350
|
+
if (String$1.startsWith(RELATIVE$1)(text)) return [text, `${text}${JSON_EXTENSION}`];
|
|
10351
|
+
return [];
|
|
10352
|
+
};
|
|
10353
|
+
const patternRoot = (text) => pipe([leadingDirectory(text)], Array.filter(String$1.isNonEmpty));
|
|
10354
|
+
/** @internal */
|
|
10355
|
+
const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMentions(file, source) {
|
|
10356
|
+
const program = (yield* Effect.promise(() => parse(`${file}.ts`, `(${source})`, { lang: "ts" }))).program;
|
|
10357
|
+
const root = firstObject(program);
|
|
10358
|
+
return pipe(root, Option.toArray, Array.flatMap((object) => Array.flatten([
|
|
10359
|
+
listed$2(object)("references", exactly, referencedPaths),
|
|
10360
|
+
listed$2(object)("extends", relativeConfig),
|
|
10361
|
+
listed$2(object)("files", exactly),
|
|
10362
|
+
listed$2(object)("include", patternRoot)
|
|
10363
|
+
])));
|
|
10364
|
+
});
|
|
10365
|
+
// src/features/check-repository-layout/model/config-paths.ts
|
|
10366
|
+
const RULE$48 = "config-path";
|
|
10367
|
+
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
10368
|
+
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
10369
|
+
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
10370
|
+
const OUTSIDE = "..";
|
|
10371
|
+
const READ_CONCURRENCY$22 = 8;
|
|
10372
|
+
const isMissing$2 = Effect.fn("isMissing")(function* isMissing(root, file, mention) {
|
|
10373
|
+
const files = yield* RepositoryFiles;
|
|
10374
|
+
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)));
|
|
10375
|
+
if (!Array.isReadonlyArrayNonEmpty(relatives)) return false;
|
|
10376
|
+
const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), { concurrency: READ_CONCURRENCY$22 });
|
|
10377
|
+
if (pipe(present, Array.some(Boolean))) return false;
|
|
10378
|
+
const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), { concurrency: READ_CONCURRENCY$22 });
|
|
10379
|
+
return !pipe(ignored, Array.some(Boolean));
|
|
10380
|
+
});
|
|
10381
|
+
const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
10382
|
+
const problemOf$8 = (file, source) => (mention) => ({
|
|
10383
|
+
file,
|
|
10384
|
+
...positionOf(source)(mention.index),
|
|
10385
|
+
rule: RULE$48,
|
|
10386
|
+
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
10387
|
+
});
|
|
10388
|
+
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
10389
|
+
if (CARGO_MANIFEST.test(file)) return cargoMentions(source);
|
|
10390
|
+
return yield* tsconfigMentions(file, source);
|
|
10391
|
+
});
|
|
10392
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, name) {
|
|
10393
|
+
const files = yield* RepositoryFiles;
|
|
10394
|
+
const file = files.join(root, name);
|
|
10395
|
+
const source = yield* files.readFile(file);
|
|
10396
|
+
if (Option.isNone(source)) return [];
|
|
10397
|
+
const mentions = yield* mentionsIn(file, source.value);
|
|
10398
|
+
const missing = yield* Effect.filter(mentions, (mention) => isMissing$2(root, file, mention), { concurrency: READ_CONCURRENCY$22 });
|
|
10399
|
+
return pipe(Array.sort(missing, byIndex), Array.map(problemOf$8(file, source.value)));
|
|
10400
|
+
});
|
|
10401
|
+
const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatterns(root) {
|
|
10402
|
+
const files = yield* RepositoryFiles;
|
|
10403
|
+
const file = files.join(root, WORKSPACE_FILE$4);
|
|
10404
|
+
const source = yield* files.readFile(file);
|
|
10405
|
+
if (Option.isNone(source)) return [];
|
|
10406
|
+
const patterns = yield* unmatchedWorkspacePatterns(root);
|
|
10407
|
+
return pipe(patterns, Array.map((pattern) => ({
|
|
10408
|
+
file,
|
|
10409
|
+
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
10410
|
+
rule: RULE$48,
|
|
10411
|
+
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
10412
|
+
})));
|
|
10413
|
+
});
|
|
10414
|
+
/** @internal */
|
|
10415
|
+
const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPaths(root) {
|
|
10416
|
+
const owned = yield* (yield* RepositoryFiles).ownedFiles(root);
|
|
10417
|
+
const configs = pipe(owned, Array.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)));
|
|
10418
|
+
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$17(root, name), { concurrency: READ_CONCURRENCY$22 }), unmatchedPatterns(root)], { concurrency: "unbounded" });
|
|
10419
|
+
return [...Array.flatten(found), ...patterns];
|
|
10420
|
+
});
|
|
10271
10421
|
// src/features/check-repository-layout/model/crates.ts
|
|
10272
|
-
const RULE$
|
|
10422
|
+
const RULE$47 = "unverified-crate";
|
|
10273
10423
|
const VERSION_RULE = "release-version";
|
|
10274
10424
|
const MANIFEST_FILE$1 = "package.json";
|
|
10275
10425
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10276
10426
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
10277
10427
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10278
10428
|
const SEPARATOR$12 = "/";
|
|
10279
|
-
const FIRST$
|
|
10280
|
-
const READ_CONCURRENCY$
|
|
10429
|
+
const FIRST$11 = 1;
|
|
10430
|
+
const READ_CONCURRENCY$21 = 8;
|
|
10281
10431
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10282
10432
|
const problemFor$4 = (crate, message) => ({
|
|
10283
10433
|
file: crate.manifest,
|
|
10284
|
-
line: FIRST$
|
|
10285
|
-
column: FIRST$
|
|
10286
|
-
rule: RULE$
|
|
10434
|
+
line: FIRST$11,
|
|
10435
|
+
column: FIRST$11,
|
|
10436
|
+
rule: RULE$47,
|
|
10287
10437
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10288
10438
|
});
|
|
10289
10439
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10303,8 +10453,8 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
10303
10453
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
10304
10454
|
return Option.some({
|
|
10305
10455
|
file: crate.manifest,
|
|
10306
|
-
line: FIRST$
|
|
10307
|
-
column: FIRST$
|
|
10456
|
+
line: FIRST$11,
|
|
10457
|
+
column: FIRST$11,
|
|
10308
10458
|
rule: VERSION_RULE,
|
|
10309
10459
|
message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE$1} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
|
|
10310
10460
|
});
|
|
@@ -10315,11 +10465,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10315
10465
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10316
10466
|
const directories = yield* workspaceDirectories(root);
|
|
10317
10467
|
const crates = yield* cratesIn(root);
|
|
10318
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10468
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$21 });
|
|
10319
10469
|
return Array.getSomes(Array.flatten(found));
|
|
10320
10470
|
});
|
|
10321
10471
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10322
|
-
const RULE$
|
|
10472
|
+
const RULE$46 = "deploy-entry-pattern";
|
|
10323
10473
|
const FALLOW_KEYS = [
|
|
10324
10474
|
"entry",
|
|
10325
10475
|
"entryPoints",
|
|
@@ -10337,7 +10487,7 @@ const NEGATED = "!";
|
|
|
10337
10487
|
const ROOT_WORKSPACE = ".";
|
|
10338
10488
|
const WRAP_OFFSET$1 = 1;
|
|
10339
10489
|
const NO_OFFSET = 0;
|
|
10340
|
-
const READ_CONCURRENCY$
|
|
10490
|
+
const READ_CONCURRENCY$20 = 8;
|
|
10341
10491
|
const MESSAGE$12 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10342
10492
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10343
10493
|
const FALLOW = {
|
|
@@ -10390,7 +10540,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10390
10540
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10391
10541
|
file: path,
|
|
10392
10542
|
...positionOf(text.value)(start - kind.offset),
|
|
10393
|
-
rule: RULE$
|
|
10543
|
+
rule: RULE$46,
|
|
10394
10544
|
message: `${pattern} ${MESSAGE$12}`
|
|
10395
10545
|
})));
|
|
10396
10546
|
});
|
|
@@ -10419,21 +10569,21 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10419
10569
|
kind,
|
|
10420
10570
|
workspaces,
|
|
10421
10571
|
entries
|
|
10422
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10572
|
+
}), { concurrency: READ_CONCURRENCY$20 });
|
|
10423
10573
|
return Array.flatten(found);
|
|
10424
10574
|
});
|
|
10425
10575
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10426
|
-
const RULE$
|
|
10576
|
+
const RULE$45 = "listed-entry";
|
|
10427
10577
|
const ENTRY_KEYS = [
|
|
10428
10578
|
"entry",
|
|
10429
10579
|
"entryPoints",
|
|
10430
10580
|
"supportEntry"
|
|
10431
10581
|
];
|
|
10432
10582
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
10433
|
-
const WILDCARD$
|
|
10583
|
+
const WILDCARD$2 = /[*?{[]/u;
|
|
10434
10584
|
const SEPARATOR$11 = "/";
|
|
10435
10585
|
const WRAP_OFFSET = 1;
|
|
10436
|
-
const READ_CONCURRENCY$
|
|
10586
|
+
const READ_CONCURRENCY$19 = 8;
|
|
10437
10587
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10438
10588
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10439
10589
|
const entryPatternsIn = (node) => {
|
|
@@ -10443,7 +10593,7 @@ const entryPatternsIn = (node) => {
|
|
|
10443
10593
|
})));
|
|
10444
10594
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10445
10595
|
};
|
|
10446
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$
|
|
10596
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$2.test(text);
|
|
10447
10597
|
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10448
10598
|
const files = yield* RepositoryFiles;
|
|
10449
10599
|
const path = files.join(root, file);
|
|
@@ -10453,7 +10603,7 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10453
10603
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10454
10604
|
file: path,
|
|
10455
10605
|
...positionOf(text.value)(start),
|
|
10456
|
-
rule: RULE$
|
|
10606
|
+
rule: RULE$45,
|
|
10457
10607
|
message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`
|
|
10458
10608
|
})));
|
|
10459
10609
|
});
|
|
@@ -10461,15 +10611,15 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10461
10611
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10462
10612
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10463
10613
|
const directories = yield* workspaceDirectories(root);
|
|
10464
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$15(root, file, directories), { concurrency: READ_CONCURRENCY$
|
|
10614
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$15(root, file, directories), { concurrency: READ_CONCURRENCY$19 });
|
|
10465
10615
|
return Array.flatten(found);
|
|
10466
10616
|
});
|
|
10467
10617
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10468
|
-
const RULE$
|
|
10618
|
+
const RULE$44 = "root-workspace-path";
|
|
10469
10619
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10470
10620
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10471
10621
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10472
|
-
const FIRST$
|
|
10622
|
+
const FIRST$10 = 0;
|
|
10473
10623
|
const NEXT$2 = 1;
|
|
10474
10624
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10475
10625
|
const mentions = (directory) => (text) => {
|
|
@@ -10477,14 +10627,14 @@ const mentions = (directory) => (text) => {
|
|
|
10477
10627
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10478
10628
|
const before = parts[index] ?? "";
|
|
10479
10629
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10480
|
-
const following = String$1.slice(FIRST$
|
|
10630
|
+
const following = String$1.slice(FIRST$10, NEXT$2)(after);
|
|
10481
10631
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10482
10632
|
}));
|
|
10483
10633
|
};
|
|
10484
10634
|
const problemsIn$14 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10485
10635
|
file,
|
|
10486
10636
|
...positionOf(source)(found.start),
|
|
10487
|
-
rule: RULE$
|
|
10637
|
+
rule: RULE$44,
|
|
10488
10638
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
10489
10639
|
})));
|
|
10490
10640
|
/** @internal */
|
|
@@ -10498,10 +10648,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10498
10648
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$14(file, source.value, directories)));
|
|
10499
10649
|
});
|
|
10500
10650
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10501
|
-
const RULE$
|
|
10651
|
+
const RULE$43 = "hidden-verify";
|
|
10502
10652
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10503
|
-
const FIRST$
|
|
10504
|
-
const READ_CONCURRENCY$
|
|
10653
|
+
const FIRST$9 = 1;
|
|
10654
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10505
10655
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10506
10656
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10507
10657
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10510,21 +10660,21 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10510
10660
|
const verified = yield* hasVerifyTask(file);
|
|
10511
10661
|
return Option.some({
|
|
10512
10662
|
file,
|
|
10513
|
-
line: FIRST$
|
|
10514
|
-
column: FIRST$
|
|
10515
|
-
rule: RULE$
|
|
10663
|
+
line: FIRST$9,
|
|
10664
|
+
column: FIRST$9,
|
|
10665
|
+
rule: RULE$43,
|
|
10516
10666
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
10517
10667
|
}).pipe(Option.filter(() => verified));
|
|
10518
10668
|
});
|
|
10519
10669
|
/** @internal */
|
|
10520
10670
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10521
10671
|
const directories = yield* workspaceDirectories(root);
|
|
10522
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10672
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$18 });
|
|
10523
10673
|
return Array.getSomes(found);
|
|
10524
10674
|
});
|
|
10525
10675
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10526
|
-
const RULE$
|
|
10527
|
-
const READ_CONCURRENCY$
|
|
10676
|
+
const RULE$42 = "shared-uncached-task";
|
|
10677
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10528
10678
|
const SHARED = 2;
|
|
10529
10679
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10530
10680
|
const UncachedTask = Schema.Struct({
|
|
@@ -10566,19 +10716,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10566
10716
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10567
10717
|
file,
|
|
10568
10718
|
...position,
|
|
10569
|
-
rule: RULE$
|
|
10719
|
+
rule: RULE$42,
|
|
10570
10720
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array.join(directories, ", ")}. Write it once in a shared helper and spread it into each run.tasks, so that a change to it reaches every workspace.`
|
|
10571
10721
|
})));
|
|
10572
10722
|
};
|
|
10573
10723
|
/** @internal */
|
|
10574
10724
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10575
10725
|
const directories = yield* workspaceDirectories(root);
|
|
10576
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10726
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$17 });
|
|
10577
10727
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10578
10728
|
});
|
|
10579
10729
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10580
|
-
const RULE$
|
|
10581
|
-
const READ_CONCURRENCY$
|
|
10730
|
+
const RULE$41 = "unlocked-task";
|
|
10731
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10582
10732
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10583
10733
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10584
10734
|
const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array.findFirst(Array.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
|
|
@@ -10589,13 +10739,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10589
10739
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10590
10740
|
file,
|
|
10591
10741
|
...positionOf(source)(task.start),
|
|
10592
|
-
rule: RULE$
|
|
10742
|
+
rule: RULE$41,
|
|
10593
10743
|
message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
|
|
10594
10744
|
})), Option.toArray)));
|
|
10595
10745
|
/** @internal */
|
|
10596
10746
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10597
10747
|
const directories = yield* workspaceDirectories(root);
|
|
10598
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10748
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10599
10749
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10600
10750
|
});
|
|
10601
10751
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10686,7 +10836,7 @@ const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
|
|
|
10686
10836
|
const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
|
|
10687
10837
|
const globsIn = (field, node) => pipe(itemsOf(node), Array.flatMap((item) => Option.toArray(stringOf(item))), Array.filter(isPositive), Array.flatMap(reference("glob", field)));
|
|
10688
10838
|
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
10689
|
-
const directoryOf$
|
|
10839
|
+
const directoryOf$2 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$2, text)), Option.getOrElse(() => base));
|
|
10690
10840
|
const located = (kind, field, base = ROOT$2) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
|
|
10691
10841
|
const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL$1)(text)));
|
|
10692
10842
|
const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(text, TOKEN_SEPARATOR), Array.filter((token) => SCRIPT.test(token)), Array.dedupe, Array.flatMap((token) => reference("script", field, base)({
|
|
@@ -10703,7 +10853,7 @@ const fileInputsIn = (field, step) => pipe(entriesOf$1(childOf("with")(step)), A
|
|
|
10703
10853
|
const stepReferences = (job, base) => (step, index) => {
|
|
10704
10854
|
const field = `jobs.${job}.steps[${index}]`;
|
|
10705
10855
|
const own = stringOf(childOf("working-directory")(step));
|
|
10706
|
-
const directory = directoryOf$
|
|
10856
|
+
const directory = directoryOf$2(own, base);
|
|
10707
10857
|
return [
|
|
10708
10858
|
...located("action", `${field}.uses`)(localUses(step)),
|
|
10709
10859
|
...located("directory", `${field}.working-directory`)(own),
|
|
@@ -10714,7 +10864,7 @@ const stepReferences = (job, base) => (step, index) => {
|
|
|
10714
10864
|
const jobReferences = (base) => ([job, node]) => {
|
|
10715
10865
|
const own = workingDirectoryOf(node);
|
|
10716
10866
|
const steps = itemsOf(childOf("steps")(node));
|
|
10717
|
-
const directory = directoryOf$
|
|
10867
|
+
const directory = directoryOf$2(own, base);
|
|
10718
10868
|
return [
|
|
10719
10869
|
...located("file", `jobs.${job}.uses`)(localUses(node)),
|
|
10720
10870
|
...located("directory", `jobs.${job}.defaults.run.working-directory`)(own),
|
|
@@ -10731,7 +10881,7 @@ const jobsOf = (source) => entriesOf$1(childOf("jobs")(parseDocument(source).con
|
|
|
10731
10881
|
const workflowReferences = (source) => {
|
|
10732
10882
|
const root = parseDocument(source).contents;
|
|
10733
10883
|
const workflowDefault = workingDirectoryOf(root);
|
|
10734
|
-
const base = directoryOf$
|
|
10884
|
+
const base = directoryOf$2(workflowDefault, ROOT$2);
|
|
10735
10885
|
return [
|
|
10736
10886
|
...pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(filtersOf)),
|
|
10737
10887
|
...located("directory", "defaults.run.working-directory")(workflowDefault),
|
|
@@ -10744,13 +10894,11 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10744
10894
|
/** @internal */
|
|
10745
10895
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10746
10896
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10747
|
-
const RULE$
|
|
10897
|
+
const RULE$40 = "workflow-path";
|
|
10748
10898
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10749
10899
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10750
|
-
const READ_CONCURRENCY$
|
|
10751
|
-
const WILDCARD$2 = /[*?[]/u;
|
|
10900
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10752
10901
|
const SEPARATOR$9 = "/";
|
|
10753
|
-
const FIRST$9 = 0;
|
|
10754
10902
|
const EXPECTED = {
|
|
10755
10903
|
action: "a directory with action.yml",
|
|
10756
10904
|
directory: "a directory",
|
|
@@ -10763,16 +10911,7 @@ const matchesAny = Effect.fn("matchesAny")(function* matchesAny(root, pathspecs)
|
|
|
10763
10911
|
const matched = yield* (yield* RepositoryFiles).matchingFiles(root, pathspecs);
|
|
10764
10912
|
return Array.isReadonlyArrayNonEmpty(matched);
|
|
10765
10913
|
});
|
|
10766
|
-
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
10767
|
-
const files = yield* RepositoryFiles;
|
|
10768
|
-
return yield* files.exists(files.join(root, path));
|
|
10769
|
-
});
|
|
10770
10914
|
const matchesGlob = (root, path) => matchesAny(root, [`:(glob)${path}`]);
|
|
10771
|
-
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
10772
|
-
const files = yield* RepositoryFiles;
|
|
10773
|
-
const directory = yield* files.isDirectory(files.join(root, path));
|
|
10774
|
-
return Option.getOrElse(directory, () => false);
|
|
10775
|
-
});
|
|
10776
10915
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
10777
10916
|
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$9}${name}`), { concurrency: 1 });
|
|
10778
10917
|
return pipe(found, Array.some(Boolean));
|
|
@@ -10789,17 +10928,6 @@ const RESOLVERS = {
|
|
|
10789
10928
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
10790
10929
|
})
|
|
10791
10930
|
};
|
|
10792
|
-
const staticPrefix = (path) => {
|
|
10793
|
-
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10794
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
|
|
10795
|
-
return prefix;
|
|
10796
|
-
};
|
|
10797
|
-
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
10798
|
-
const prefix = staticPrefix(path);
|
|
10799
|
-
if (String$1.isEmpty(prefix)) return false;
|
|
10800
|
-
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
10801
|
-
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10802
|
-
});
|
|
10803
10931
|
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$9}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$9}`)(path);
|
|
10804
10932
|
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
10805
10933
|
const prefix = staticPrefix(found.path);
|
|
@@ -10810,7 +10938,7 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
10810
10938
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10811
10939
|
file,
|
|
10812
10940
|
...positionOf(source)(found.offset),
|
|
10813
|
-
rule: RULE$
|
|
10941
|
+
rule: RULE$40,
|
|
10814
10942
|
message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`
|
|
10815
10943
|
});
|
|
10816
10944
|
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -10825,7 +10953,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10825
10953
|
/** @internal */
|
|
10826
10954
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10827
10955
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10828
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$
|
|
10956
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$13(root, workflow), { concurrency: READ_CONCURRENCY$15 });
|
|
10829
10957
|
return Array.flatten(found);
|
|
10830
10958
|
});
|
|
10831
10959
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10837,7 +10965,7 @@ const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
|
10837
10965
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10838
10966
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10839
10967
|
const START$21 = 0;
|
|
10840
|
-
const READ_CONCURRENCY$
|
|
10968
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10841
10969
|
const SEPARATOR$8 = "/";
|
|
10842
10970
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10843
10971
|
const SPACE = " ";
|
|
@@ -10916,7 +11044,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10916
11044
|
name: stem,
|
|
10917
11045
|
source: text
|
|
10918
11046
|
})]), Option.getOrElse(() => []));
|
|
10919
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
11047
|
+
}), { concurrency: READ_CONCURRENCY$14 });
|
|
10920
11048
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf("name")(ACTION.exec(name)), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10921
11049
|
return [...Array.flatten(found), ...actions];
|
|
10922
11050
|
});
|
|
@@ -10925,6 +11053,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10925
11053
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
10926
11054
|
const found = yield* Effect.all([
|
|
10927
11055
|
checkCommandEntries(root),
|
|
11056
|
+
checkConfigPaths(root),
|
|
10928
11057
|
checkCrates(root),
|
|
10929
11058
|
checkDeployEntryPatterns(root),
|
|
10930
11059
|
checkFallowEntries(root),
|
|
@@ -11046,14 +11175,14 @@ const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(a
|
|
|
11046
11175
|
const EMPTY$1 = 0;
|
|
11047
11176
|
const DependencyMap = Schema.optional(Schema.Record(Schema.String, Schema.String));
|
|
11048
11177
|
const PeerMetaEntry = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
|
|
11049
|
-
const PeerMeta = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
|
|
11178
|
+
const PeerMeta$1 = Schema.optional(Schema.Record(Schema.String, PeerMetaEntry));
|
|
11050
11179
|
const InstalledManifest = Schema.Struct({
|
|
11051
11180
|
dependencies: DependencyMap,
|
|
11052
11181
|
optionalDependencies: DependencyMap,
|
|
11053
11182
|
peerDependencies: DependencyMap,
|
|
11054
|
-
peerDependenciesMeta: PeerMeta
|
|
11183
|
+
peerDependenciesMeta: PeerMeta$1
|
|
11055
11184
|
});
|
|
11056
|
-
const decodeManifest$
|
|
11185
|
+
const decodeManifest$5 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11057
11186
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11058
11187
|
const installedNames = (manifest) => [
|
|
11059
11188
|
...keysOf(manifest.dependencies),
|
|
@@ -11063,7 +11192,7 @@ const installedNames = (manifest) => [
|
|
|
11063
11192
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11064
11193
|
const files = yield* RepositoryFiles;
|
|
11065
11194
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11066
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11195
|
+
return pipe(text, Option.flatMap(decodeManifest$5), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11067
11196
|
});
|
|
11068
11197
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11069
11198
|
const files = yield* RepositoryFiles;
|
|
@@ -11118,7 +11247,6 @@ const installedSize = (directory) => {
|
|
|
11118
11247
|
// src/features/measure-install-size/model/install-size.ts
|
|
11119
11248
|
const INSTALL_SIZE = "install-size";
|
|
11120
11249
|
const STACK_DEPENDENCY = "stack-dependency";
|
|
11121
|
-
const STACK_CATALOG = "catalog:stack";
|
|
11122
11250
|
const BUDGET_KEY = "installSize";
|
|
11123
11251
|
const DEPENDENCIES_KEY$1 = "\"dependencies\"";
|
|
11124
11252
|
const LISTED_LARGEST = 5;
|
|
@@ -11143,7 +11271,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11143
11271
|
file: workspace.configFile,
|
|
11144
11272
|
...positionOf(source)(index),
|
|
11145
11273
|
rule: INSTALL_SIZE,
|
|
11146
|
-
message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed$1(overrun)}. Make a dependency imported only from some entries an optional peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`
|
|
11274
|
+
message: `installing this package adds ${megabytes(total)} of dependencies besides its peers, over the ${workspace.installSize} in msch.publish.installSize. Largest: ${listed$1(overrun)}. Make a dependency imported only from some library entries an optional peer, make one that a bin needs at startup a required peer, move one that the installing project already has to peerDependencies, or replace a heavy one. Raise installSize only when none of these applies.`
|
|
11147
11275
|
};
|
|
11148
11276
|
});
|
|
11149
11277
|
const measure = Effect.fn("measure")(function* measure({ workspace, provided }, direct) {
|
|
@@ -11269,7 +11397,7 @@ var BundleFailed = class extends taggedError$5()("BundleFailed", { detail: Schem
|
|
|
11269
11397
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
11270
11398
|
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
11271
11399
|
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
11272
|
-
const isExternal = ({ bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && !Array.contains(bundled, packageNameOf(specifier));
|
|
11400
|
+
const isExternal = ({ declared, bundled }) => (specifier, importer) => Predicate.isNotUndefined(importer) && isBare(specifier) && (isBuiltin(specifier) || Array.contains(declared, packageNameOf(specifier)) && !Array.contains(bundled, packageNameOf(specifier)));
|
|
11273
11401
|
const consumerSource = ({ entry, member }) => Option.match(member, {
|
|
11274
11402
|
onNone: () => `export * from ${quote(entry)};\n`,
|
|
11275
11403
|
onSome: (name) => `import * as ${NAMESPACE} from ${quote(entry)};\nglobalThis.used = ${NAMESPACE}[${quote(name)}];\n`
|
|
@@ -11327,14 +11455,27 @@ const exportNamesOf = Effect.fn("exportNamesOf")(function* exportNamesOf(scope,
|
|
|
11327
11455
|
return pipe(chunks, Array.flatMap((chunk) => chunk.exports), Array.dedupe);
|
|
11328
11456
|
});
|
|
11329
11457
|
// src/features/check-tree-shaking/model/manifest.ts
|
|
11330
|
-
const
|
|
11458
|
+
const Versions = Schema.Record(Schema.String, Schema.String);
|
|
11459
|
+
const PeerMeta = Schema.Struct({ optional: Schema.optional(Schema.Boolean) });
|
|
11460
|
+
const Manifest$4 = Schema.Struct({
|
|
11331
11461
|
name: Schema.optional(Schema.String),
|
|
11332
11462
|
exports: Schema.optional(Schema.Unknown),
|
|
11333
11463
|
bin: Schema.optional(Schema.Unknown),
|
|
11334
11464
|
sideEffects: Schema.optional(Schema.Unknown),
|
|
11335
|
-
dependencies: Schema.optional(
|
|
11336
|
-
|
|
11337
|
-
|
|
11465
|
+
dependencies: Schema.optional(Versions),
|
|
11466
|
+
devDependencies: Schema.optional(Versions),
|
|
11467
|
+
peerDependencies: Schema.optional(Versions),
|
|
11468
|
+
optionalDependencies: Schema.optional(Versions),
|
|
11469
|
+
peerDependenciesMeta: Schema.optional(Schema.Record(Schema.String, PeerMeta))
|
|
11470
|
+
});
|
|
11471
|
+
const runtimeDependenciesOf = ({ dependencies, peerDependencies, optionalDependencies }) => pipe([
|
|
11472
|
+
dependencies,
|
|
11473
|
+
peerDependencies,
|
|
11474
|
+
optionalDependencies
|
|
11475
|
+
], Array.flatMap(keysOf), Array.dedupe);
|
|
11476
|
+
const optionalPeersOf = ({ peerDependenciesMeta }) => pipe(Option.fromUndefinedOr(peerDependenciesMeta), Option.map(Record.filter(({ optional }) => optional === true)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11477
|
+
const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11478
|
+
const decode = Schema.decodeOption(Schema.fromJsonString(Manifest$4));
|
|
11338
11479
|
const manifestOf$1 = (text) => decode(text);
|
|
11339
11480
|
const isFileList = Schema.is(Schema.Array(Schema.String));
|
|
11340
11481
|
const sourcesOf$1 = (workspace, target) => pipe(workspace.packEntries, Array.filter((entry) => entry.name === entryNameOf(target)), Array.map((entry) => entry.source));
|
|
@@ -11361,21 +11502,28 @@ const declaredBy$1 = ({ declared, locator }) => {
|
|
|
11361
11502
|
};
|
|
11362
11503
|
};
|
|
11363
11504
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
11364
|
-
const RULE$
|
|
11505
|
+
const RULE$39 = "optional-peer";
|
|
11506
|
+
const REQUIRED_RULE = "required-peer";
|
|
11365
11507
|
const START$19 = 0;
|
|
11366
11508
|
const SINGLE = 1;
|
|
11367
11509
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
11510
|
+
const PEER_META_KEY = "\"peerDependenciesMeta\"";
|
|
11368
11511
|
const importsPackage = (name) => ({ packages }) => Array.contains(packages, name);
|
|
11369
11512
|
const labelsOf = (importers) => pipe(importers, Array.map(({ entry }) => `\`${entry.label}\``), Array.dedupe, Array.join(", "));
|
|
11370
|
-
const
|
|
11371
|
-
const section = Option.getOrElse(String$1.indexOf(
|
|
11513
|
+
const positionIn = (located, key, name) => {
|
|
11514
|
+
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$19);
|
|
11372
11515
|
const rest = String$1.slice(section)(located.source);
|
|
11373
|
-
return {
|
|
11374
|
-
|
|
11375
|
-
|
|
11376
|
-
|
|
11377
|
-
|
|
11378
|
-
|
|
11516
|
+
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$19));
|
|
11517
|
+
};
|
|
11518
|
+
const problemFor$3 = (located, name, importers) => ({
|
|
11519
|
+
file: located.file,
|
|
11520
|
+
...positionIn(located, DEPENDENCIES_KEY, name),
|
|
11521
|
+
rule: RULE$39,
|
|
11522
|
+
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.`
|
|
11523
|
+
});
|
|
11524
|
+
const requiredPeerAdvice = (fromStack) => {
|
|
11525
|
+
if (fromStack) return "Make it a required peer by removing it from peerDependenciesMeta; it comes from the stack catalog, so every project that installs this package already has it.";
|
|
11526
|
+
return "Make it a required peer by removing it from peerDependenciesMeta when every project that installs this package already has it, or move it to dependencies, which count toward msch.publish.installSize.";
|
|
11379
11527
|
};
|
|
11380
11528
|
const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
11381
11529
|
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
@@ -11388,8 +11536,23 @@ const optionalPeerProblems = ({ located, dependencies, used }) => {
|
|
|
11388
11536
|
return [problemFor$3(located, name, importers)];
|
|
11389
11537
|
}));
|
|
11390
11538
|
};
|
|
11539
|
+
const requiredPeerProblems = ({ located, optional, stack, used }) => {
|
|
11540
|
+
const libraries = pipe(used, Array.filter(({ entry }) => !isBinEntry(entry)));
|
|
11541
|
+
return pipe(optional, Array.flatMap((name) => {
|
|
11542
|
+
const bins = pipe(used, Array.filter((entry) => isBinEntry(entry.entry) && importsPackage(name)(entry)));
|
|
11543
|
+
const everyLibrary = pipe(libraries, Option.liftPredicate((all) => Array.isArrayNonEmpty(all) && pipe(all, Array.every(importsPackage(name)))), Option.getOrElse(() => []));
|
|
11544
|
+
const importers = Array.appendAll(bins, everyLibrary);
|
|
11545
|
+
if (!Array.isArrayNonEmpty(importers)) return [];
|
|
11546
|
+
return [{
|
|
11547
|
+
file: located.file,
|
|
11548
|
+
...positionIn(located, PEER_META_KEY, name),
|
|
11549
|
+
rule: REQUIRED_RULE,
|
|
11550
|
+
message: `${name} is an optional peer, but ${labelsOf(importers)} import it at startup, so installing the package without it breaks them. ${requiredPeerAdvice(Array.contains(stack, name))}`
|
|
11551
|
+
}];
|
|
11552
|
+
}));
|
|
11553
|
+
};
|
|
11391
11554
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
11392
|
-
const RULE$
|
|
11555
|
+
const RULE$38 = "side-effects";
|
|
11393
11556
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
11394
11557
|
const START$18 = 0;
|
|
11395
11558
|
const FIRST$8 = 1;
|
|
@@ -11441,13 +11604,13 @@ const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source),
|
|
|
11441
11604
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array.sortBy(largest), Array.head, Option.map((worst) => ({
|
|
11442
11605
|
file,
|
|
11443
11606
|
...positionOf(source)(keyIndex$1(source)),
|
|
11444
|
-
rule: RULE$
|
|
11607
|
+
rule: RULE$38,
|
|
11445
11608
|
message: messageOf$4(worst, excesses.length)
|
|
11446
11609
|
})), Option.toArray);
|
|
11447
11610
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
11448
|
-
const RULE$
|
|
11611
|
+
const RULE$37 = "top-level-effect";
|
|
11449
11612
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
11450
|
-
const READ_CONCURRENCY$
|
|
11613
|
+
const READ_CONCURRENCY$13 = 16;
|
|
11451
11614
|
const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
|
|
11452
11615
|
const STATEMENT_MESSAGE = "runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.";
|
|
11453
11616
|
const isEffect = (statement) => {
|
|
@@ -11461,7 +11624,7 @@ const messageOf$3 = (statement) => {
|
|
|
11461
11624
|
const problemsIn$12 = (api) => (file) => (source) => {
|
|
11462
11625
|
const retained = api.createSourceFile(file, source);
|
|
11463
11626
|
const problems = pipe(retained.sourceFile.statements, Array.fromIterable, Array.filter(isEffect), Array.map((statement) => problemAt$7({
|
|
11464
|
-
rule: RULE$
|
|
11627
|
+
rule: RULE$37,
|
|
11465
11628
|
message: messageOf$3(statement)
|
|
11466
11629
|
})(statement)));
|
|
11467
11630
|
retained.dispose();
|
|
@@ -11474,7 +11637,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
11474
11637
|
const names = yield* files.ownedFiles(root);
|
|
11475
11638
|
const owned = new Set(pipe(names, Array.map((name) => files.join(root, name))));
|
|
11476
11639
|
const sources = pipe(modules, Array.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
11477
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$12(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$
|
|
11640
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$12(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$13 });
|
|
11478
11641
|
return Array.flatten(found);
|
|
11479
11642
|
}, Effect.scoped);
|
|
11480
11643
|
// src/features/check-tree-shaking/model/usage.ts
|
|
@@ -11512,7 +11675,10 @@ const shapeOf = Effect.fn("shapeOf")(function* shapeOf({ workspace, manifest })
|
|
|
11512
11675
|
packEntries: workspace.packEntries
|
|
11513
11676
|
}), Array.dedupeWith((left, right) => left.source === right.source && isBinEntry(left) === isBinEntry(right)));
|
|
11514
11677
|
return {
|
|
11515
|
-
scope: {
|
|
11678
|
+
scope: {
|
|
11679
|
+
declared: runtimeDependenciesOf(manifest),
|
|
11680
|
+
bundled: workspace.alwaysBundle
|
|
11681
|
+
},
|
|
11516
11682
|
declared: declaredBy$1({
|
|
11517
11683
|
declared: manifest.sideEffects,
|
|
11518
11684
|
locator: {
|
|
@@ -11557,6 +11723,12 @@ const analyse = Effect.fn("analyse")(function* analyse(pack) {
|
|
|
11557
11723
|
located,
|
|
11558
11724
|
dependencies: manifest.dependencies,
|
|
11559
11725
|
used
|
|
11726
|
+
}),
|
|
11727
|
+
...requiredPeerProblems({
|
|
11728
|
+
located,
|
|
11729
|
+
optional: optionalPeersOf(manifest),
|
|
11730
|
+
stack: stackPackagesOf(manifest),
|
|
11731
|
+
used
|
|
11560
11732
|
})
|
|
11561
11733
|
];
|
|
11562
11734
|
});
|
|
@@ -11585,7 +11757,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
11585
11757
|
return Array.flatten(found);
|
|
11586
11758
|
});
|
|
11587
11759
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11588
|
-
const RULE$
|
|
11760
|
+
const RULE$36 = "legacy-typescript";
|
|
11589
11761
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
11590
11762
|
const COMPILER = "typescript";
|
|
11591
11763
|
const CURRENT_MAJOR = 7;
|
|
@@ -11616,12 +11788,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
11616
11788
|
file,
|
|
11617
11789
|
line: lineOf$2(source)(legacy.id),
|
|
11618
11790
|
column: FIRST$7,
|
|
11619
|
-
rule: RULE$
|
|
11791
|
+
rule: RULE$36,
|
|
11620
11792
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11621
11793
|
})));
|
|
11622
11794
|
});
|
|
11623
11795
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11624
|
-
const RULE$
|
|
11796
|
+
const RULE$35 = "worker-bundle";
|
|
11625
11797
|
const BUNDLE_CONCURRENCY = 4;
|
|
11626
11798
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11627
11799
|
const CONDITIONS = [
|
|
@@ -11632,7 +11804,7 @@ const CONDITIONS = [
|
|
|
11632
11804
|
"module",
|
|
11633
11805
|
"default"
|
|
11634
11806
|
];
|
|
11635
|
-
const problemFor$2 = problemInFile(RULE$
|
|
11807
|
+
const problemFor$2 = problemInFile(RULE$35);
|
|
11636
11808
|
const problemOf$6 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
11637
11809
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11638
11810
|
const built = yield* Effect.tryPromise({
|
|
@@ -11756,7 +11928,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11756
11928
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11757
11929
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11758
11930
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11759
|
-
const RULE$
|
|
11931
|
+
const RULE$34 = "hand-written-names";
|
|
11760
11932
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11761
11933
|
const nameListOf = (site) => {
|
|
11762
11934
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11771,7 +11943,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
11771
11943
|
file,
|
|
11772
11944
|
line,
|
|
11773
11945
|
column,
|
|
11774
|
-
rule: RULE$
|
|
11946
|
+
rule: RULE$34,
|
|
11775
11947
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11776
11948
|
});
|
|
11777
11949
|
const problemOf$5 = ({ list, reason }) => listedProblem({
|
|
@@ -12452,13 +12624,13 @@ const MANIFEST$3 = "package.json";
|
|
|
12452
12624
|
const SEPARATOR$5 = "/";
|
|
12453
12625
|
const FIRST_SEGMENT = 1;
|
|
12454
12626
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12455
|
-
const decodeManifest$
|
|
12627
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(ManifestJson);
|
|
12456
12628
|
const prefixesOf = (file) => {
|
|
12457
12629
|
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
12458
12630
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12459
12631
|
};
|
|
12460
12632
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12461
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12633
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$4), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12462
12634
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12463
12635
|
const files = yield* RepositoryFiles;
|
|
12464
12636
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12570,7 +12742,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12570
12742
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12571
12743
|
}, Effect.scoped);
|
|
12572
12744
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12573
|
-
const RULE$
|
|
12745
|
+
const RULE$33 = "namespace-destructuring";
|
|
12574
12746
|
const LOCAL = /^[.#/]/u;
|
|
12575
12747
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
12576
12748
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12586,7 +12758,7 @@ const destructuredName = (declaration) => {
|
|
|
12586
12758
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12587
12759
|
};
|
|
12588
12760
|
const problemOf$4 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
12589
|
-
rule: RULE$
|
|
12761
|
+
rule: RULE$33,
|
|
12590
12762
|
message: messageOf$1(name)
|
|
12591
12763
|
})), Option.map((report) => report(declaration)));
|
|
12592
12764
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12594,7 +12766,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12594
12766
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$4(names)), Array.getSomes);
|
|
12595
12767
|
};
|
|
12596
12768
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12597
|
-
const RULE$
|
|
12769
|
+
const RULE$32 = "pass-through-wrapper";
|
|
12598
12770
|
const SINGLE_STATEMENT = 1;
|
|
12599
12771
|
const SINGLE_DECLARATION = 1;
|
|
12600
12772
|
const THIS_PARAMETER = "this";
|
|
@@ -12691,7 +12863,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12691
12863
|
const problemOf$3 = (checker) => (candidate) => {
|
|
12692
12864
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12693
12865
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
12694
|
-
rule: RULE$
|
|
12866
|
+
rule: RULE$32,
|
|
12695
12867
|
message: messageOf(forward.callee.getText())
|
|
12696
12868
|
})(candidate.name)));
|
|
12697
12869
|
};
|
|
@@ -12717,7 +12889,7 @@ var plugins = [{
|
|
|
12717
12889
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12718
12890
|
}];
|
|
12719
12891
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12720
|
-
const RULE$
|
|
12892
|
+
const RULE$31 = "known-plugins";
|
|
12721
12893
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12722
12894
|
const GITHUB$2 = "github";
|
|
12723
12895
|
const Source$1 = Schema.Struct({
|
|
@@ -12735,7 +12907,7 @@ const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
12735
12907
|
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12736
12908
|
const MARKETPLACE = name;
|
|
12737
12909
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12738
|
-
const problem$1 = problemInFile(RULE$
|
|
12910
|
+
const problem$1 = problemInFile(RULE$31);
|
|
12739
12911
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12740
12912
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12741
12913
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12756,13 +12928,13 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12756
12928
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12757
12929
|
});
|
|
12758
12930
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12759
|
-
const RULE$
|
|
12931
|
+
const RULE$30 = "missing-hook";
|
|
12760
12932
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12761
12933
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12762
12934
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12763
12935
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12764
12936
|
const PLUGIN_ROOT = "..";
|
|
12765
|
-
const READ_CONCURRENCY$
|
|
12937
|
+
const READ_CONCURRENCY$12 = 16;
|
|
12766
12938
|
const START$17 = 0;
|
|
12767
12939
|
const referenceOf$2 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
12768
12940
|
path,
|
|
@@ -12781,7 +12953,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12781
12953
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12782
12954
|
file,
|
|
12783
12955
|
...positionOf(source)(index),
|
|
12784
|
-
rule: RULE$
|
|
12956
|
+
rule: RULE$30,
|
|
12785
12957
|
message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
|
|
12786
12958
|
})));
|
|
12787
12959
|
});
|
|
@@ -12805,7 +12977,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12805
12977
|
}];
|
|
12806
12978
|
return [];
|
|
12807
12979
|
}));
|
|
12808
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$
|
|
12980
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$12 });
|
|
12809
12981
|
return Array.flatten(found);
|
|
12810
12982
|
});
|
|
12811
12983
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -12834,7 +13006,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
12834
13006
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12835
13007
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12836
13008
|
// src/features/check-documented-commands/model/commands.ts
|
|
12837
|
-
const RULE$
|
|
13009
|
+
const RULE$29 = "documented-commands";
|
|
12838
13010
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12839
13011
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12840
13012
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -12912,7 +13084,7 @@ const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph,
|
|
|
12912
13084
|
const problemsIn$10 = (graph, absolute, { file, text }) => pipe(Array.fromIterable(String$1.matchAll(COMMAND)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
12913
13085
|
file: absolute(file),
|
|
12914
13086
|
...positionOf(text)(match.index ?? START$16),
|
|
12915
|
-
rule: RULE$
|
|
13087
|
+
rule: RULE$29,
|
|
12916
13088
|
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12917
13089
|
})), Option.toArray)));
|
|
12918
13090
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
@@ -12937,15 +13109,15 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
12937
13109
|
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12938
13110
|
line: ONE$1,
|
|
12939
13111
|
column: ONE$1,
|
|
12940
|
-
rule: RULE$
|
|
13112
|
+
rule: RULE$29,
|
|
12941
13113
|
message: "msch could not list the tasks with `vp run --json`"
|
|
12942
13114
|
}],
|
|
12943
13115
|
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12944
13116
|
});
|
|
12945
13117
|
});
|
|
12946
13118
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12947
|
-
const RULE$
|
|
12948
|
-
const FIRST_COLUMN$
|
|
13119
|
+
const RULE$28 = "legacy-web";
|
|
13120
|
+
const FIRST_COLUMN$4 = 1;
|
|
12949
13121
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12950
13122
|
const Finding = Schema.Struct({
|
|
12951
13123
|
file: Schema.String,
|
|
@@ -12982,8 +13154,8 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
12982
13154
|
const problemOf = (guideId, ruleId) => ({ file, line, message }) => ({
|
|
12983
13155
|
file: files.join(root, file),
|
|
12984
13156
|
line,
|
|
12985
|
-
column: FIRST_COLUMN$
|
|
12986
|
-
rule: RULE$
|
|
13157
|
+
column: FIRST_COLUMN$4,
|
|
13158
|
+
rule: RULE$28,
|
|
12987
13159
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12988
13160
|
});
|
|
12989
13161
|
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
@@ -13053,8 +13225,8 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
13053
13225
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
13054
13226
|
const EXTENSION = /\.[^./]+$/u;
|
|
13055
13227
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
13056
|
-
const READ_CONCURRENCY$
|
|
13057
|
-
const RULE$
|
|
13228
|
+
const READ_CONCURRENCY$11 = 64;
|
|
13229
|
+
const RULE$27 = "shell-script";
|
|
13058
13230
|
const MESSAGE$11 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
13059
13231
|
const HookSchema = Schema.Struct({
|
|
13060
13232
|
command: Schema.optional(Schema.String),
|
|
@@ -13086,12 +13258,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
13086
13258
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
13087
13259
|
};
|
|
13088
13260
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
13089
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
13090
|
-
return pipe(shell, Array.map((name) => problemInFile(RULE$
|
|
13261
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$11 });
|
|
13262
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$27)(files.join(root, name), MESSAGE$11)));
|
|
13091
13263
|
});
|
|
13092
13264
|
// src/shared/lib/workflow-files.ts
|
|
13093
13265
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
13094
|
-
const READ_CONCURRENCY$
|
|
13266
|
+
const READ_CONCURRENCY$10 = 16;
|
|
13095
13267
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
13096
13268
|
const files = yield* RepositoryFiles;
|
|
13097
13269
|
const names = yield* files.listedFiles(root);
|
|
@@ -13101,7 +13273,7 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
13101
13273
|
file,
|
|
13102
13274
|
source
|
|
13103
13275
|
}))));
|
|
13104
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13276
|
+
}, { concurrency: READ_CONCURRENCY$10 });
|
|
13105
13277
|
return Array.getSomes(found);
|
|
13106
13278
|
});
|
|
13107
13279
|
// src/shared/lib/workflow-run.ts
|
|
@@ -13122,7 +13294,7 @@ const runScriptsOf = (source) => {
|
|
|
13122
13294
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
13123
13295
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
13124
13296
|
const COMMENT = "#";
|
|
13125
|
-
const RULE$
|
|
13297
|
+
const RULE$26 = "workflow-script";
|
|
13126
13298
|
const ONE_COMMAND = 1;
|
|
13127
13299
|
const MESSAGE$10 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
13128
13300
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -13133,7 +13305,7 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
13133
13305
|
};
|
|
13134
13306
|
const problemsIn$9 = (file) => (source) => {
|
|
13135
13307
|
const at = positionOf(source);
|
|
13136
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$
|
|
13308
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$26)(file, at(start), MESSAGE$10)));
|
|
13137
13309
|
};
|
|
13138
13310
|
/** @internal */
|
|
13139
13311
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
@@ -13263,7 +13435,7 @@ const AGENT_DOCS = [
|
|
|
13263
13435
|
":(glob)**/CLAUDE.md",
|
|
13264
13436
|
...EXCLUDED$4
|
|
13265
13437
|
];
|
|
13266
|
-
const READ_CONCURRENCY$
|
|
13438
|
+
const READ_CONCURRENCY$9 = 16;
|
|
13267
13439
|
const START$14 = 0;
|
|
13268
13440
|
const FIRST$5 = 1;
|
|
13269
13441
|
const LINE = "\n";
|
|
@@ -13334,7 +13506,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
13334
13506
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
13335
13507
|
});
|
|
13336
13508
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
13337
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13509
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$9 });
|
|
13338
13510
|
return Array.flatten(found);
|
|
13339
13511
|
});
|
|
13340
13512
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -13346,7 +13518,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
13346
13518
|
onSome: sourcesOf(file, name)
|
|
13347
13519
|
});
|
|
13348
13520
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
13349
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13521
|
+
}, { concurrency: READ_CONCURRENCY$9 });
|
|
13350
13522
|
return Array.flatten(found);
|
|
13351
13523
|
});
|
|
13352
13524
|
/** @internal */
|
|
@@ -13370,7 +13542,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
13370
13542
|
return Array.flatten(found);
|
|
13371
13543
|
});
|
|
13372
13544
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
13373
|
-
const RULE$
|
|
13545
|
+
const RULE$25 = "package-script";
|
|
13374
13546
|
const LIFECYCLE = [
|
|
13375
13547
|
"preinstall",
|
|
13376
13548
|
"install",
|
|
@@ -13393,12 +13565,12 @@ const LIFECYCLE = [
|
|
|
13393
13565
|
const problemOf$2 = ({ file, position, name }) => ({
|
|
13394
13566
|
file,
|
|
13395
13567
|
...position,
|
|
13396
|
-
rule: RULE$
|
|
13568
|
+
rule: RULE$25,
|
|
13397
13569
|
message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
|
|
13398
13570
|
});
|
|
13399
13571
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$2));
|
|
13400
13572
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
13401
|
-
const RULE$
|
|
13573
|
+
const RULE$24 = "vite-plus-block";
|
|
13402
13574
|
const MARKER = Array.join([
|
|
13403
13575
|
"<!--",
|
|
13404
13576
|
"VITE PLUS START",
|
|
@@ -13411,7 +13583,7 @@ const problemIn = (file) => (source) => {
|
|
|
13411
13583
|
return Option.some({
|
|
13412
13584
|
file,
|
|
13413
13585
|
...positionOf(source)(index.value),
|
|
13414
|
-
rule: RULE$
|
|
13586
|
+
rule: RULE$24,
|
|
13415
13587
|
message: MESSAGE$9
|
|
13416
13588
|
});
|
|
13417
13589
|
};
|
|
@@ -13467,11 +13639,11 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
13467
13639
|
})
|
|
13468
13640
|
});
|
|
13469
13641
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
13470
|
-
const RULE$
|
|
13642
|
+
const RULE$22 = "publish-trigger";
|
|
13471
13643
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
13472
13644
|
const MANUAL = "workflow_dispatch";
|
|
13473
13645
|
const TRIGGER_KEY = "on";
|
|
13474
|
-
const MESSAGE$7 = "publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`.
|
|
13646
|
+
const MESSAGE$7 = "publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch-publish dispatch`.";
|
|
13475
13647
|
const triggersOf = (node) => {
|
|
13476
13648
|
if (isScalar(node)) return [String(node.value)];
|
|
13477
13649
|
if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
|
|
@@ -13487,18 +13659,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
13487
13659
|
};
|
|
13488
13660
|
/** @internal */
|
|
13489
13661
|
const checkPublishTrigger = workflowCheck({
|
|
13490
|
-
rule: RULE$
|
|
13662
|
+
rule: RULE$22,
|
|
13491
13663
|
message: MESSAGE$7,
|
|
13492
13664
|
offsetsOf: publishTriggerOffsetsOf
|
|
13493
13665
|
});
|
|
13494
13666
|
// src/features/check-workflows/model/release-please.ts
|
|
13495
|
-
const RULE$
|
|
13667
|
+
const RULE$21 = "release-please";
|
|
13496
13668
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
13497
13669
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
13498
13670
|
const FIRST$4 = 1;
|
|
13499
13671
|
const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
13500
13672
|
const checkReleasePleaseSteps = workflowCheck({
|
|
13501
|
-
rule: RULE$
|
|
13673
|
+
rule: RULE$21,
|
|
13502
13674
|
message: MESSAGE$6,
|
|
13503
13675
|
offsetsOf: scalarKeyOffsets({
|
|
13504
13676
|
name: "uses",
|
|
@@ -13512,7 +13684,7 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
13512
13684
|
file: files.join(root, name),
|
|
13513
13685
|
line: FIRST$4,
|
|
13514
13686
|
column: FIRST$4,
|
|
13515
|
-
rule: RULE$
|
|
13687
|
+
rule: RULE$21,
|
|
13516
13688
|
message: MESSAGE$6
|
|
13517
13689
|
})));
|
|
13518
13690
|
});
|
|
@@ -13524,17 +13696,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
13524
13696
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
13525
13697
|
const CONCURRENCY_KEY = "concurrency";
|
|
13526
13698
|
const QUEUE_KEY = "queue";
|
|
13527
|
-
const RULE$
|
|
13699
|
+
const RULE$20 = "workflow-queue";
|
|
13528
13700
|
const MESSAGE$5 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
13529
13701
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
13530
13702
|
/** @internal */
|
|
13531
13703
|
const checkWorkflowQueues = workflowCheck({
|
|
13532
|
-
rule: RULE$
|
|
13704
|
+
rule: RULE$20,
|
|
13533
13705
|
message: MESSAGE$5,
|
|
13534
13706
|
offsetsOf: queueOffsetsOf
|
|
13535
13707
|
});
|
|
13536
13708
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
13537
|
-
const RULE$
|
|
13709
|
+
const RULE$19 = "workflow-commit";
|
|
13538
13710
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
13539
13711
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
13540
13712
|
const MESSAGE$4 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
@@ -13542,7 +13714,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
13542
13714
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
13543
13715
|
/** @internal */
|
|
13544
13716
|
const checkWorkflowCommits = workflowCheck({
|
|
13545
|
-
rule: RULE$
|
|
13717
|
+
rule: RULE$19,
|
|
13546
13718
|
message: MESSAGE$4,
|
|
13547
13719
|
offsetsOf: commitOffsetsOf
|
|
13548
13720
|
});
|
|
@@ -13769,11 +13941,11 @@ const shebangReader = (source) => {
|
|
|
13769
13941
|
};
|
|
13770
13942
|
const readerOf = (name) => (source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13771
13943
|
// src/features/ban-comments/model/comments.ts
|
|
13772
|
-
const RULE$
|
|
13944
|
+
const RULE$18 = "comment";
|
|
13773
13945
|
const UNUSED_RULE$1 = "unused-comment-allowance";
|
|
13774
13946
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
13775
13947
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13776
|
-
const READ_CONCURRENCY$
|
|
13948
|
+
const READ_CONCURRENCY$8 = 64;
|
|
13777
13949
|
const START$12 = 0;
|
|
13778
13950
|
const SHEBANG = "#!";
|
|
13779
13951
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
@@ -13810,7 +13982,7 @@ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but n
|
|
|
13810
13982
|
const problemOf$1 = (file, source) => ({ index }) => ({
|
|
13811
13983
|
file,
|
|
13812
13984
|
...positionOf(source)(index),
|
|
13813
|
-
rule: RULE$
|
|
13985
|
+
rule: RULE$18,
|
|
13814
13986
|
message: MESSAGE$3
|
|
13815
13987
|
});
|
|
13816
13988
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13869,7 +14041,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
13869
14041
|
problems: pipe(found, Array.filter(kept), Array.map(toProblem)),
|
|
13870
14042
|
used: usedAllowances(allowances, found)
|
|
13871
14043
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
13872
|
-
problems: [problemInFile(RULE$
|
|
14044
|
+
problems: [problemInFile(RULE$18)(file, `msch could not read the comments in this file: ${message}`)],
|
|
13873
14045
|
used: []
|
|
13874
14046
|
})))
|
|
13875
14047
|
});
|
|
@@ -13888,7 +14060,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13888
14060
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
13889
14061
|
onNone: () => Effect.succeed(NOTHING),
|
|
13890
14062
|
onSome: (source) => scan(entry, source)
|
|
13891
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
14063
|
+
}))), { concurrency: READ_CONCURRENCY$8 });
|
|
13892
14064
|
const used = HashSet.fromIterable(pipe(found, Array.flatMap(({ used: indexes }) => indexes)));
|
|
13893
14065
|
const unused = yield* unusedAllowances(root, settings, used);
|
|
13894
14066
|
return [...pipe(found, Array.flatMap(({ problems }) => problems)), ...unused];
|
|
@@ -13903,13 +14075,13 @@ const patternsBy = ({ spawn, command, toolVersions = [] }) => (entry) => {
|
|
|
13903
14075
|
return command;
|
|
13904
14076
|
};
|
|
13905
14077
|
const spawnPattern = (program) => new RegExp(String.raw`(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make)\(\s*|\$\(\s*|\$\s*(?=\x60))["'\x60](?:${program})(?=["'\x60\s])`, "gu");
|
|
13906
|
-
const FIRST_LINE$
|
|
13907
|
-
const FIRST_COLUMN$
|
|
14078
|
+
const FIRST_LINE$4 = 1;
|
|
14079
|
+
const FIRST_COLUMN$3 = 1;
|
|
13908
14080
|
const WHOLE_MATCH$1 = 0;
|
|
13909
14081
|
const fileProblem = (tool) => (entry) => ({
|
|
13910
14082
|
file: entry.file,
|
|
13911
|
-
line: FIRST_LINE$
|
|
13912
|
-
column: FIRST_COLUMN$
|
|
14083
|
+
line: FIRST_LINE$4,
|
|
14084
|
+
column: FIRST_COLUMN$3,
|
|
13913
14085
|
rule: tool.fileRule,
|
|
13914
14086
|
message: tool.fileMessage(entry)
|
|
13915
14087
|
});
|
|
@@ -13982,7 +14154,7 @@ const PYTHON = {
|
|
|
13982
14154
|
/** @internal */
|
|
13983
14155
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13984
14156
|
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
13985
|
-
const RULE$
|
|
14157
|
+
const RULE$17 = "uncataloged-dependency";
|
|
13986
14158
|
const OWNED_ELSEWHERE = [
|
|
13987
14159
|
"catalog:",
|
|
13988
14160
|
"workspace:",
|
|
@@ -13995,8 +14167,8 @@ const MESSAGE$2 = "is a version written in this package.json. Add it to the cata
|
|
|
13995
14167
|
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
13996
14168
|
const problemsIn$8 = (entry, source) => pipe(manifestSpecifiers(source), Array.filter((found) => !isOwnedElsewhere(found)), Array.map((found) => ({
|
|
13997
14169
|
file: entry.file,
|
|
13998
|
-
...positionOf(source)(offsetIn(source)(manifestPattern(found))),
|
|
13999
|
-
rule: RULE$
|
|
14170
|
+
...positionOf(source)(offsetIn$1(source)(manifestPattern(found))),
|
|
14171
|
+
rule: RULE$17,
|
|
14000
14172
|
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$2}`
|
|
14001
14173
|
})));
|
|
14002
14174
|
/** @internal */
|
|
@@ -14020,10 +14192,10 @@ const CATALOG_PROTOCOL = "catalog:";
|
|
|
14020
14192
|
const DEFAULT_CATALOG = "default";
|
|
14021
14193
|
const VERSION_SEPARATOR = "||";
|
|
14022
14194
|
const WILDCARD = "*";
|
|
14023
|
-
const FIRST_LINE$
|
|
14024
|
-
const FIRST_COLUMN$
|
|
14195
|
+
const FIRST_LINE$3 = 1;
|
|
14196
|
+
const FIRST_COLUMN$2 = 1;
|
|
14025
14197
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
14026
|
-
const READ_CONCURRENCY$
|
|
14198
|
+
const READ_CONCURRENCY$7 = 16;
|
|
14027
14199
|
const STALE_RULE = "stale-release-age-exclude";
|
|
14028
14200
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
14029
14201
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
@@ -14054,14 +14226,14 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
14054
14226
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
14055
14227
|
const files = yield* RepositoryFiles;
|
|
14056
14228
|
const listed = yield* files.listedFiles(root);
|
|
14057
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$2.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
14058
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
14229
|
+
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 });
|
|
14230
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$9(text))), Array.flatMap(referencesIn));
|
|
14059
14231
|
const fromOverrides = pipe(fieldsOf(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf$1));
|
|
14060
14232
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
14061
14233
|
});
|
|
14062
14234
|
const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
|
|
14063
|
-
onNone: () => FIRST_LINE$
|
|
14064
|
-
onSome: (index) => index + FIRST_LINE$
|
|
14235
|
+
onNone: () => FIRST_LINE$3,
|
|
14236
|
+
onSome: (index) => index + FIRST_LINE$3
|
|
14065
14237
|
}));
|
|
14066
14238
|
const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
14067
14239
|
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
|
|
@@ -14069,7 +14241,7 @@ const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\
|
|
|
14069
14241
|
const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
14070
14242
|
file,
|
|
14071
14243
|
line: at(needle),
|
|
14072
|
-
column: FIRST_COLUMN$
|
|
14244
|
+
column: FIRST_COLUMN$2,
|
|
14073
14245
|
rule,
|
|
14074
14246
|
message: `\`${name}\` ${message}`
|
|
14075
14247
|
});
|
|
@@ -14169,14 +14341,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
14169
14341
|
];
|
|
14170
14342
|
});
|
|
14171
14343
|
// src/features/check-skills/model/published-skills.ts
|
|
14172
|
-
const RULE$
|
|
14344
|
+
const RULE$16 = "published-skills";
|
|
14173
14345
|
const KEYWORD = "tanstack-intent";
|
|
14174
14346
|
const SKILLS = "skills";
|
|
14175
14347
|
const MANIFEST_FILE = "package.json";
|
|
14176
14348
|
const SKILL_FILE$1 = "SKILL.md";
|
|
14177
14349
|
const SUCCEEDED = 0;
|
|
14178
14350
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
14179
|
-
const problemAt$2 = problemInFile(RULE$
|
|
14351
|
+
const problemAt$2 = problemInFile(RULE$16);
|
|
14180
14352
|
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
|
|
14181
14353
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
14182
14354
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -14213,7 +14385,7 @@ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPu
|
|
|
14213
14385
|
return Array.flatten(problems);
|
|
14214
14386
|
});
|
|
14215
14387
|
// src/features/check-skills/model/skill-files.ts
|
|
14216
|
-
const RULE$
|
|
14388
|
+
const RULE$15 = "skill-file";
|
|
14217
14389
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
14218
14390
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
14219
14391
|
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
@@ -14233,7 +14405,7 @@ const BLANK = /\s+/u;
|
|
|
14233
14405
|
const SEPARATOR$2 = "/";
|
|
14234
14406
|
const START$10 = 0;
|
|
14235
14407
|
const FIRST$3 = 1;
|
|
14236
|
-
const READ_CONCURRENCY$
|
|
14408
|
+
const READ_CONCURRENCY$6 = 16;
|
|
14237
14409
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
14238
14410
|
const Frontmatter = Schema.Struct({
|
|
14239
14411
|
name: Schema.optional(Schema.String),
|
|
@@ -14271,7 +14443,7 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
14271
14443
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
14272
14444
|
file: skill.file,
|
|
14273
14445
|
...positionOf(skill.source)(index),
|
|
14274
|
-
rule: RULE$
|
|
14446
|
+
rule: RULE$15,
|
|
14275
14447
|
message
|
|
14276
14448
|
})));
|
|
14277
14449
|
const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
@@ -14298,7 +14470,7 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
14298
14470
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
14299
14471
|
file,
|
|
14300
14472
|
...positionOf(source)(index),
|
|
14301
|
-
rule: RULE$
|
|
14473
|
+
rule: RULE$15,
|
|
14302
14474
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
14303
14475
|
})));
|
|
14304
14476
|
});
|
|
@@ -14309,12 +14481,12 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14309
14481
|
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
14310
14482
|
const text = yield* files.readFile(file);
|
|
14311
14483
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
14312
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
14484
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$6 });
|
|
14313
14485
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
14314
14486
|
file: files.join(root, entry),
|
|
14315
14487
|
line: FIRST$3,
|
|
14316
14488
|
column: FIRST$3,
|
|
14317
|
-
rule: RULE$
|
|
14489
|
+
rule: RULE$15,
|
|
14318
14490
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
14319
14491
|
})));
|
|
14320
14492
|
return [
|
|
@@ -14331,7 +14503,7 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
14331
14503
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
14332
14504
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
14333
14505
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
14334
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$
|
|
14506
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$6(root, listed, name), { concurrency: READ_CONCURRENCY$6 });
|
|
14335
14507
|
return Array.flatten(found);
|
|
14336
14508
|
});
|
|
14337
14509
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -14392,9 +14564,8 @@ const cargoEntries = (text) => {
|
|
|
14392
14564
|
};
|
|
14393
14565
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
14394
14566
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
14395
|
-
const RULE$
|
|
14396
|
-
const
|
|
14397
|
-
const READ_CONCURRENCY$4 = 16;
|
|
14567
|
+
const RULE$14 = "version-downgrade";
|
|
14568
|
+
const READ_CONCURRENCY$5 = 16;
|
|
14398
14569
|
const READERS = [
|
|
14399
14570
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
14400
14571
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -14406,28 +14577,22 @@ const isLower = (before, after) => pipe(Option.all([lowestOf(before), lowestOf(a
|
|
|
14406
14577
|
onNone: () => false,
|
|
14407
14578
|
onSome: ([old, current]) => semver.lt(current, old)
|
|
14408
14579
|
}));
|
|
14409
|
-
const FIRST_LINE$
|
|
14580
|
+
const FIRST_LINE$2 = 1;
|
|
14410
14581
|
const lineOf = (text, { name, spec }) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes(name)(line) && String$1.includes(spec)(line)), Option.match({
|
|
14411
|
-
onNone: () => FIRST_LINE$
|
|
14412
|
-
onSome: (index) => index + FIRST_LINE$
|
|
14582
|
+
onNone: () => FIRST_LINE$2,
|
|
14583
|
+
onSome: (index) => index + FIRST_LINE$2
|
|
14413
14584
|
}));
|
|
14414
|
-
const message = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
|
|
14585
|
+
const message$1 = (before, after) => `lowers ${after.key} from ${before.spec} to ${after.spec}. Never downgrade a dependency, toolchain or engine: fix what broke on the new version instead, or ask the owner.`;
|
|
14415
14586
|
const downgradesIn = ({ file, text, before, after }) => {
|
|
14416
14587
|
const previous = Record.fromEntries(pipe(before, Array.map((entry) => [entry.key, entry])));
|
|
14417
14588
|
return pipe(after, Array.flatMap((entry) => pipe(Record.get(previous, entry.key), Option.filter((old) => isLower(old.spec, entry.spec)), Option.map((old) => ({
|
|
14418
14589
|
file,
|
|
14419
14590
|
line: lineOf(text, entry),
|
|
14420
|
-
column: FIRST_LINE$
|
|
14421
|
-
rule: RULE$
|
|
14422
|
-
message: message(old, entry)
|
|
14591
|
+
column: FIRST_LINE$2,
|
|
14592
|
+
rule: RULE$14,
|
|
14593
|
+
message: message$1(old, entry)
|
|
14423
14594
|
})), Option.toArray)));
|
|
14424
14595
|
};
|
|
14425
|
-
const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
|
|
14426
|
-
const files = yield* RepositoryFiles;
|
|
14427
|
-
const configured = yield* Config.option(Config.String("VPA_BASE")).pipe(Effect.orDie);
|
|
14428
|
-
const base = Option.getOrElse(configured, () => DEFAULT_BASE);
|
|
14429
|
-
return yield* files.mergeBase(root, base);
|
|
14430
|
-
});
|
|
14431
14596
|
/** @internal */
|
|
14432
14597
|
const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(root) {
|
|
14433
14598
|
const files = yield* RepositoryFiles;
|
|
@@ -14444,7 +14609,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
14444
14609
|
before: read(before),
|
|
14445
14610
|
after: read(after)
|
|
14446
14611
|
})), Option.getOrElse(() => []));
|
|
14447
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
14612
|
+
}), { concurrency: READ_CONCURRENCY$5 });
|
|
14448
14613
|
return Array.flatten(found);
|
|
14449
14614
|
});
|
|
14450
14615
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -14456,7 +14621,7 @@ const CAP_RULE = "renovate-version-cap";
|
|
|
14456
14621
|
const PRESET_RULE = "renovate-msch-preset";
|
|
14457
14622
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
14458
14623
|
const START$9 = 0;
|
|
14459
|
-
const READ_CONCURRENCY$
|
|
14624
|
+
const READ_CONCURRENCY$4 = 16;
|
|
14460
14625
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
14461
14626
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
14462
14627
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
@@ -14490,7 +14655,71 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
14490
14655
|
onNone: () => [],
|
|
14491
14656
|
onSome: (source) => problemsIn$5(file, source)
|
|
14492
14657
|
})));
|
|
14493
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
14658
|
+
}, { concurrency: READ_CONCURRENCY$4 });
|
|
14659
|
+
return Array.flatten(found);
|
|
14660
|
+
});
|
|
14661
|
+
// src/features/check-version-downgrades/model/package-versions.ts
|
|
14662
|
+
const RULE$13 = "unbumped-package";
|
|
14663
|
+
const UNSHIPPED = /(?:\.test\.[\w.]+$|(?:^|\/)(?:fixtures|__tests__|tests?)\/|(?:^|\/)(?:AGENTS|CLAUDE|CHANGELOG)\.md$)/u;
|
|
14664
|
+
const UNVERSIONED = "0.0.0";
|
|
14665
|
+
const FIRST_LINE$1 = 1;
|
|
14666
|
+
const FIRST_COLUMN$1 = 1;
|
|
14667
|
+
const READ_CONCURRENCY$3 = 16;
|
|
14668
|
+
const Manifest$3 = Schema.fromJsonString(Schema.Struct({
|
|
14669
|
+
name: Schema.String,
|
|
14670
|
+
version: Schema.String,
|
|
14671
|
+
private: Schema.optional(Schema.Boolean)
|
|
14672
|
+
}));
|
|
14673
|
+
const LAST_SEGMENT$1 = /[^/]*$/u;
|
|
14674
|
+
const directoryOf$1 = (file) => String$1.replace(LAST_SEGMENT$1, "")(file);
|
|
14675
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(Manifest$3);
|
|
14676
|
+
const packageAt = (file, text) => pipe(decodeManifest$3(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED), Option.map(({ name, version }) => ({
|
|
14677
|
+
file,
|
|
14678
|
+
directory: directoryOf$1(file),
|
|
14679
|
+
name,
|
|
14680
|
+
version,
|
|
14681
|
+
text
|
|
14682
|
+
})));
|
|
14683
|
+
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));
|
|
14684
|
+
const versionLine = (text) => pipe(String$1.split(text, "\n"), Array.findFirstIndex((line) => String$1.includes("\"version\"")(line)), Option.match({
|
|
14685
|
+
onNone: () => FIRST_LINE$1,
|
|
14686
|
+
onSome: (index) => index + FIRST_LINE$1
|
|
14687
|
+
}));
|
|
14688
|
+
const shippedChange = (directory, changed) => pipe(changed, Array.some((name) => String$1.startsWith(directory)(name) && !UNSHIPPED.test(name)));
|
|
14689
|
+
const higher = (left, right) => {
|
|
14690
|
+
if (semver.gt(right, left)) return right;
|
|
14691
|
+
return left;
|
|
14692
|
+
};
|
|
14693
|
+
const floorOf$1 = (versions) => {
|
|
14694
|
+
let floor = Option.none();
|
|
14695
|
+
for (const version of Array.getSomes(versions)) floor = Option.match(floor, {
|
|
14696
|
+
onNone: () => Option.some(version),
|
|
14697
|
+
onSome: (lowest) => Option.some(higher(version, lowest))
|
|
14698
|
+
});
|
|
14699
|
+
return floor;
|
|
14700
|
+
};
|
|
14701
|
+
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}.`;
|
|
14702
|
+
/** @internal */
|
|
14703
|
+
const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPackageVersions(root) {
|
|
14704
|
+
const files = yield* RepositoryFiles;
|
|
14705
|
+
const base = yield* baseRevision(root);
|
|
14706
|
+
if (Option.isNone(base)) return [];
|
|
14707
|
+
const tip = yield* baseName$1;
|
|
14708
|
+
const changed = yield* files.changedFiles(root, base.value);
|
|
14709
|
+
const manifests = yield* manifestTexts(root);
|
|
14710
|
+
const packages = pipe(manifests, Array.map(({ file, text }) => packageAt(file, text)));
|
|
14711
|
+
const found = yield* Effect.forEach(pipe(Array.getSomes(packages), Array.filter(({ directory }) => shippedChange(directory, changed))), (pack) => Effect.gen(function* compare() {
|
|
14712
|
+
const before = yield* files.readAtRevision(root, base.value, pack.file);
|
|
14713
|
+
const claimed = yield* files.readAtRevision(root, tip, pack.file);
|
|
14714
|
+
const floor = floorOf$1([versionAt(pack.name, before), versionAt(pack.name, claimed)]);
|
|
14715
|
+
return pipe(floor, Option.filter((lowest) => !semver.gt(pack.version, lowest)), Option.map((lowest) => ({
|
|
14716
|
+
file: files.join(root, pack.file),
|
|
14717
|
+
line: versionLine(pack.text),
|
|
14718
|
+
column: FIRST_COLUMN$1,
|
|
14719
|
+
rule: RULE$13,
|
|
14720
|
+
message: message(pack, lowest)
|
|
14721
|
+
})), Option.toArray);
|
|
14722
|
+
}), { concurrency: READ_CONCURRENCY$3 });
|
|
14494
14723
|
return Array.flatten(found);
|
|
14495
14724
|
});
|
|
14496
14725
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
@@ -14897,11 +15126,11 @@ const isRange = (specifier) => {
|
|
|
14897
15126
|
};
|
|
14898
15127
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
14899
15128
|
file,
|
|
14900
|
-
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
15129
|
+
...positionOf(source)(offsetIn$1(source)(pattern(range))),
|
|
14901
15130
|
rule: RULE$8,
|
|
14902
15131
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
14903
15132
|
})));
|
|
14904
|
-
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$
|
|
15133
|
+
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$2(name)}["']?:`, "mu");
|
|
14905
15134
|
const manifestProblems$2 = (entry, source) => problemsFor(entry.file, source, manifestPattern)(manifestSpecifiers(source));
|
|
14906
15135
|
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14907
15136
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
@@ -15410,6 +15639,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
15410
15639
|
checkAppliedPackages(root),
|
|
15411
15640
|
checkGitSubpath(root),
|
|
15412
15641
|
checkDowngrades(root),
|
|
15642
|
+
checkPackageVersions(root),
|
|
15413
15643
|
checkRenovateSettings(root),
|
|
15414
15644
|
checkCatalogEntries(root),
|
|
15415
15645
|
checkPackageRegistry(root)
|