@r_masseater/msch 0.50.0 → 0.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cargo-inputs.mjs +1 -1
- package/dist/changed.mjs +2 -2
- package/dist/cli.mjs +871 -566
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +10 -6
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-B1Xy1brk.mjs → define-lint-preset-CecEvjVf.mjs} +96 -1
- package/dist/define-lint-preset-CecEvjVf.mjs.map +1 -0
- package/dist/{dependencies-DbwLA4nT.mjs → dependencies-DCJv7YcW.mjs} +5 -2
- package/dist/dependencies-DCJv7YcW.mjs.map +1 -0
- package/dist/{index-DL7PSp7j.d.mts → index-B2X8WhBt.d.mts} +41 -2
- package/dist/{index-DdJXnW1q.d.mts → index-BZIBqvmt.d.mts} +18 -7
- package/dist/lint-rules.mjs +247 -6
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/oxlint.mjs +3 -7
- package/dist/oxlint.mjs.map +1 -1
- package/dist/{package-BKpgZyaV.mjs → package-LeBO9czg.mjs} +2 -2
- package/dist/{package-BKpgZyaV.mjs.map → package-LeBO9czg.mjs.map} +1 -1
- package/dist/{problem-D8mlJc3T.mjs → problem-CzOlOb5f.mjs} +10 -2
- package/dist/problem-CzOlOb5f.mjs.map +1 -0
- package/dist/{project-CR2jzkij.mjs → project-C4uzq7_4.mjs} +2 -2
- package/dist/{project-CR2jzkij.mjs.map → project-C4uzq7_4.mjs.map} +1 -1
- package/dist/publish.mjs +1 -1
- package/dist/publish.mjs.map +1 -1
- package/dist/started-once-muJbvD_I.mjs +8 -0
- package/dist/started-once-muJbvD_I.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +2 -2
- package/dist/workspace-settings.mjs +83 -42
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +14 -12
- package/skills/msch-checks/SKILL.md +1 -1
- package/skills/workspace-settings/SKILL.md +1 -0
- package/src/app/vite.d.ts +3 -2
- package/dist/define-lint-preset-B1Xy1brk.mjs.map +0 -1
- package/dist/dependencies-DbwLA4nT.mjs.map +0 -1
- package/dist/problem-D8mlJc3T.mjs.map +0 -1
- package/dist/started-once-CkTooI_o.mjs +0 -13
- package/dist/started-once-CkTooI_o.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as propertyValue, C as RUN_TASKS,
|
|
3
|
-
import { C as valueKey, S as schemaTypeOf, _ as formatValues, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as recordsIn, l as mentions$1, m as isObjectType, n as contentKey, o as projectInputs, p as describeLibraryType, r as keepOnly, t as implementationFingerprint, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./project-
|
|
2
|
+
import { B as propertyValue, C as RUN_TASKS, E as hasVerifyTask, F as KeySchema, I as childrenOf$1, L as keyName, P as workspaceConfigOf, R as literalOf, T as definesTask, V as stringsIn, _ as publishedProjects, a as cratesIn, b as workspaceManifest, c as workspaceLinks, d as deployEntries, f as namedWorkspaces, h as shadcnUiOf, l as lockedGraph, o as owningWorkspace, p as patternOf$1, r as readManifest, t as MANIFEST_FILE$3, u as lockedPackages, v as workspaceDirectories, w as VERIFY_TASK, x as runTasksOf, y as workspaceProjects, z as nestedValues } from "./dependencies-DCJv7YcW.mjs";
|
|
3
|
+
import { C as valueKey, S as schemaTypeOf, _ as formatValues, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as recordsIn, l as mentions$1, m as isObjectType, n as contentKey, o as projectInputs, p as describeLibraryType, r as keepOnly, t as implementationFingerprint, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./project-C4uzq7_4.mjs";
|
|
4
4
|
import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
|
|
5
5
|
import { a as isRecord, c as isScannedText, d as presentFiles, f as scanText, i as collectNodes, l as isToolVersions, n as checkUpstreamExits, o as tomlSourceComments, p as positionOf, s as yamlSourceComments, t as checkScatteredDeviations, u as listedFiles } from "./check-upstream-exits-DYxWDyHC.mjs";
|
|
6
|
-
import { a as publicEntriesOf, i as EntryManifestJson, r as publishedWorkspaces } from "./package-
|
|
6
|
+
import { a as publicEntriesOf, i as EntryManifestJson, r as publishedWorkspaces } from "./package-LeBO9czg.mjs";
|
|
7
|
+
import { a as problemInFile, i as problemAt$8, o as sortProblems, r as formatProblem, t as ProblemList } from "./problem-CzOlOb5f.mjs";
|
|
7
8
|
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-CXgB6xpE.mjs";
|
|
8
|
-
import { t as startedOnce } from "./started-once-
|
|
9
|
+
import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
|
|
9
10
|
import { $ as isSpreadElement, A as isBlock, B as isInterfaceDeclaration, C as getJSDocTags, D as isArrayLiteralExpression, E as getTextOfJSDocComment, F as isExportDeclaration, G as isObjectLiteralExpression, H as isModuleDeclaration, I as isFunctionDeclaration, J as isPropertyAssignment, K as isParenthesizedExpression, L as isFunctionExpression, M as isClassDeclaration, N as isElementAccessExpression, O as isArrowFunction, P as isEnumDeclaration, Q as isSourceFile, R as isIdentifier, S as SyntaxKind, T as getNameOfDeclaration, U as isNewExpression, V as isModuleBlock, W as isNumericLiteral, X as isSatisfiesExpression, Y as isReturnStatement, Z as isSignatureDeclaration, _ as uniqueByReference, a as descendantsOf, at as isVariableDeclaration, c as isGenericDeclaration, d as lineOf$3, et as isStringLiteral, f as packageOf$1, g as symbolAt, i as declarationsOf, it as isUnionTypeNode, j as isCallExpression, k as isBinaryExpression, l as isInsideAny, m as referencedSymbols, n as columnOf, nt as isTypeLiteralNode, o as importedModulesOf, ot as isVariableDeclarationList, p as propertyNamesOf, q as isPropertyAccessExpression, r as contains, rt as isTypeReferenceNode, s as isExternalDeclaration, st as isVariableStatement, t as childrenOf$2, tt as isTypeAliasDeclaration, u as isTypeDeclaration, x as SignatureKind, z as isImportDeclaration } from "./syntax-3AJkpCcs.mjs";
|
|
10
|
-
import { a as sortProblems, i as problemAt$9, r as formatProblem, t as ProblemList } from "./problem-D8mlJc3T.mjs";
|
|
11
11
|
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-DFsdNYI0.mjs";
|
|
12
12
|
import "./cli-contract-D7btWrEu.mjs";
|
|
13
13
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
14
|
-
import { Array, Config, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
14
|
+
import { Array, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
15
15
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
16
16
|
import { ChildProcess } from "effect/process";
|
|
17
17
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -226,8 +226,8 @@ const RESOLUTION_FILES = [
|
|
|
226
226
|
];
|
|
227
227
|
const RESOLUTION_CONCURRENCY = 4;
|
|
228
228
|
const SUCCEEDED$1 = 0;
|
|
229
|
-
const taggedError$
|
|
230
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
229
|
+
const taggedError$7 = Schema.TaggedError;
|
|
230
|
+
var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
|
|
231
231
|
override: Schema.String,
|
|
232
232
|
output: Schema.String
|
|
233
233
|
}) {};
|
|
@@ -348,55 +348,55 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
348
348
|
// src/features/check-overrides/model/git-subpath.ts
|
|
349
349
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
350
350
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
351
|
-
const RULE$
|
|
351
|
+
const RULE$57 = "git-subpath-dependency";
|
|
352
352
|
const WHOLE_MATCH$3 = 0;
|
|
353
|
-
const problemAt$
|
|
353
|
+
const problemAt$7 = ({ file }, source) => (found) => ({
|
|
354
354
|
file,
|
|
355
355
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
356
|
-
rule: RULE$
|
|
356
|
+
rule: RULE$57,
|
|
357
357
|
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$3])}\`.`
|
|
358
358
|
});
|
|
359
|
-
const problemsIn$
|
|
359
|
+
const problemsIn$19 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$7(entry, source)));
|
|
360
360
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
361
361
|
/** @internal */
|
|
362
362
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
363
363
|
const listed = yield* listedFiles(root);
|
|
364
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
364
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$19);
|
|
365
365
|
});
|
|
366
366
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
367
|
-
const RULE$
|
|
367
|
+
const RULE$56 = "unnamed-restriction";
|
|
368
368
|
const WHOLE_MATCH$2 = 0;
|
|
369
369
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
370
|
-
const problemsIn$
|
|
370
|
+
const problemsIn$18 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
371
371
|
file: entry.file,
|
|
372
372
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
373
|
-
rule: RULE$
|
|
373
|
+
rule: RULE$56,
|
|
374
374
|
message: `${found[WHOLE_MATCH$2]} 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.`
|
|
375
375
|
})));
|
|
376
376
|
/** @internal */
|
|
377
377
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
378
378
|
const listed = yield* listedFiles(root);
|
|
379
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
379
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$18);
|
|
380
380
|
});
|
|
381
381
|
// src/features/check-overrides/model/package-registry.ts
|
|
382
|
-
const RULE$
|
|
382
|
+
const RULE$55 = "package-registry";
|
|
383
383
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
384
384
|
const TRAILING_SLASH = /\/$/u;
|
|
385
385
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
386
386
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
387
387
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
388
388
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
389
|
-
const START$
|
|
389
|
+
const START$21 = 0;
|
|
390
390
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
391
391
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
392
392
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
393
393
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
394
394
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
395
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
395
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$21));
|
|
396
396
|
const workspaceProblem = (file, source, registry) => ({
|
|
397
397
|
file,
|
|
398
398
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
399
|
-
rule: RULE$
|
|
399
|
+
rule: RULE$55,
|
|
400
400
|
message: Option.match(registry, {
|
|
401
401
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
402
402
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -404,9 +404,9 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
404
404
|
});
|
|
405
405
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
|
|
406
406
|
file: entry.file,
|
|
407
|
-
...positionOf(source)(found.index ?? START$
|
|
408
|
-
rule: RULE$
|
|
409
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
407
|
+
...positionOf(source)(found.index ?? START$21),
|
|
408
|
+
rule: RULE$55,
|
|
409
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$21])}\`. Remove the line.`
|
|
410
410
|
})));
|
|
411
411
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
412
412
|
const files = yield* RepositoryFiles;
|
|
@@ -425,36 +425,36 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
425
425
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
426
426
|
});
|
|
427
427
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
428
|
-
const RULE$
|
|
428
|
+
const RULE$54 = "colocated-git-patterns";
|
|
429
429
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
430
|
-
const ROOT$
|
|
431
|
-
const SEPARATOR$
|
|
430
|
+
const ROOT$3 = ".";
|
|
431
|
+
const SEPARATOR$22 = "/";
|
|
432
432
|
const NEGATION$1 = "!";
|
|
433
433
|
const COMMENT$1 = "#";
|
|
434
434
|
const ANY_DEPTH = "**";
|
|
435
|
-
const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$
|
|
435
|
+
const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$22}`;
|
|
436
436
|
const LEADING_SLASHES = /^\/+/u;
|
|
437
437
|
const TRAILING_SLASHES = /\/+$/u;
|
|
438
438
|
const SPACES = /\s+/u;
|
|
439
|
-
const FIRST$
|
|
440
|
-
const READ_CONCURRENCY$
|
|
441
|
-
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$
|
|
439
|
+
const FIRST$21 = 1;
|
|
440
|
+
const READ_CONCURRENCY$31 = 16;
|
|
441
|
+
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$3 || String$1.startsWith(`${directory}${SEPARATOR$22}`)(inner));
|
|
442
442
|
const withoutPrefix = (prefix, text) => {
|
|
443
443
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
444
444
|
return text;
|
|
445
445
|
};
|
|
446
446
|
const isAnchored = (pattern) => {
|
|
447
447
|
const body = withoutPrefix(NEGATION$1, pattern);
|
|
448
|
-
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$
|
|
448
|
+
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$22));
|
|
449
449
|
};
|
|
450
450
|
const segmentsOf = ({ directory, pattern }) => {
|
|
451
451
|
const body = withoutPrefix(NEGATION$1, pattern);
|
|
452
452
|
const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
|
|
453
|
-
const own = String$1.split(SEPARATOR$
|
|
454
|
-
if (directory === ROOT$
|
|
455
|
-
return [...String$1.split(SEPARATOR$
|
|
453
|
+
const own = String$1.split(SEPARATOR$22)(trimmed);
|
|
454
|
+
if (directory === ROOT$3) return own;
|
|
455
|
+
return [...String$1.split(SEPARATOR$22)(directory), ...own];
|
|
456
456
|
};
|
|
457
|
-
const depthOf = (directory) => String$1.split(SEPARATOR$
|
|
457
|
+
const depthOf = (directory) => String$1.split(SEPARATOR$22)(directory).length;
|
|
458
458
|
const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
459
459
|
const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
|
|
460
460
|
if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT$1)(pattern)) return Option.none();
|
|
@@ -462,7 +462,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
|
462
462
|
file,
|
|
463
463
|
kind,
|
|
464
464
|
directory,
|
|
465
|
-
line: index + FIRST$
|
|
465
|
+
line: index + FIRST$21,
|
|
466
466
|
pattern,
|
|
467
467
|
values: Array.join(values, " ")
|
|
468
468
|
});
|
|
@@ -474,15 +474,15 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
474
474
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
475
475
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
476
476
|
});
|
|
477
|
-
const problemAt$
|
|
477
|
+
const problemAt$6 = (entry, message) => ({
|
|
478
478
|
file: entry.file,
|
|
479
479
|
line: entry.line,
|
|
480
|
-
column: FIRST$
|
|
481
|
-
rule: RULE$
|
|
480
|
+
column: FIRST$21,
|
|
481
|
+
rule: RULE$54,
|
|
482
482
|
message
|
|
483
483
|
});
|
|
484
484
|
const misplacedMessage = (kind, workspaces) => {
|
|
485
|
-
if (workspaces.length === FIRST$
|
|
485
|
+
if (workspaces.length === FIRST$21) {
|
|
486
486
|
const workspace = Array.join(workspaces, "");
|
|
487
487
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
488
488
|
}
|
|
@@ -492,7 +492,7 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
|
|
|
492
492
|
const files = yield* RepositoryFiles;
|
|
493
493
|
const leading = Array.take(segments, depth);
|
|
494
494
|
if (Array.contains(leading, ANY_DEPTH)) return [];
|
|
495
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$
|
|
495
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$22)}${SEPARATOR$22}${MANIFEST_FILE$3}`]);
|
|
496
496
|
return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
|
|
497
497
|
});
|
|
498
498
|
const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
|
|
@@ -508,41 +508,41 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
|
|
|
508
508
|
if (!isAnchored(entry.pattern)) return Option.none();
|
|
509
509
|
const deepest = yield* matchedWorkspaces(root, workspaces, entry);
|
|
510
510
|
if (Array.isReadonlyArrayEmpty(deepest)) return Option.none();
|
|
511
|
-
return Option.some(problemAt$
|
|
511
|
+
return Option.some(problemAt$6(entry, misplacedMessage(entry.kind, deepest)));
|
|
512
512
|
});
|
|
513
513
|
const isFloating = (pattern) => !String$1.startsWith(NEGATION$1)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
|
|
514
514
|
const ownLevelName = (pattern) => {
|
|
515
515
|
if (isFloating(pattern)) return Option.some(pattern);
|
|
516
|
-
const name = withoutPrefix(SEPARATOR$
|
|
516
|
+
const name = withoutPrefix(SEPARATOR$22, pattern);
|
|
517
517
|
return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));
|
|
518
518
|
};
|
|
519
519
|
const sameName = (outer, name) => {
|
|
520
520
|
if (outer === name) return true;
|
|
521
|
-
return String$1.endsWith(SEPARATOR$
|
|
521
|
+
return String$1.endsWith(SEPARATOR$22)(name) && `${outer}${SEPARATOR$22}` === name;
|
|
522
522
|
};
|
|
523
523
|
const coveredBy = (entry, name) => (outer) => outer.kind === entry.kind && outer.values === entry.values && isFloating(outer.pattern) && isInside(outer.directory)(entry.directory) && sameName(outer.pattern, name);
|
|
524
524
|
const outerName = ({ directory, kind }) => {
|
|
525
|
-
if (directory === ROOT$
|
|
525
|
+
if (directory === ROOT$3) return `the root ${kind}`;
|
|
526
526
|
return `${directory}/${kind}`;
|
|
527
527
|
};
|
|
528
528
|
const repeated = (entries) => (entry) => {
|
|
529
529
|
const outer = pipe(ownLevelName(entry.pattern), Option.flatMap((name) => pipe(entries, Array.findFirst(coveredBy(entry, name)))));
|
|
530
|
-
return pipe(outer, Option.map((found) => problemAt$
|
|
530
|
+
return pipe(outer, Option.map((found) => problemAt$6(entry, `repeats ${found.pattern} from ${outerName(found)}, which already applies here. Delete it.`)));
|
|
531
531
|
};
|
|
532
532
|
/** @internal */
|
|
533
533
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
534
534
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
535
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
535
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$31 });
|
|
536
536
|
const entries = Array.flatten(read);
|
|
537
537
|
const workspaces = yield* workspaceDirectories(root);
|
|
538
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
538
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$31 });
|
|
539
539
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
540
540
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
541
541
|
});
|
|
542
542
|
// src/features/check-placement/model/colocated-tests.ts
|
|
543
|
-
const RULE$
|
|
544
|
-
const FIRST$
|
|
545
|
-
const READ_CONCURRENCY$
|
|
543
|
+
const RULE$53 = "colocated-test";
|
|
544
|
+
const FIRST$20 = 1;
|
|
545
|
+
const READ_CONCURRENCY$30 = 64;
|
|
546
546
|
const ROOT_SUBPATH = ".";
|
|
547
547
|
const NAME_GROUP = "name";
|
|
548
548
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -555,20 +555,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
555
555
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
556
556
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
557
557
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
558
|
-
const EXCLUDED$
|
|
558
|
+
const EXCLUDED$8 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
559
559
|
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.";
|
|
560
560
|
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>.";
|
|
561
|
-
const Manifest$
|
|
561
|
+
const Manifest$6 = Schema.Struct({
|
|
562
562
|
name: Schema.optional(Schema.String),
|
|
563
563
|
exports: Schema.optional(Schema.Unknown)
|
|
564
564
|
});
|
|
565
|
-
const decodeManifest$
|
|
565
|
+
const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
566
566
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
567
567
|
const problemFor$7 = (test, message) => ({
|
|
568
568
|
file: test.file,
|
|
569
|
-
line: FIRST$
|
|
570
|
-
column: FIRST$
|
|
571
|
-
rule: RULE$
|
|
569
|
+
line: FIRST$20,
|
|
570
|
+
column: FIRST$20,
|
|
571
|
+
rule: RULE$53,
|
|
572
572
|
message: `${test.base} ${message}`
|
|
573
573
|
});
|
|
574
574
|
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);
|
|
@@ -588,7 +588,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
588
588
|
if (Option.isNone(owner)) return [];
|
|
589
589
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
590
590
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
591
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
591
|
+
return pipe(text, Option.flatMap(decodeManifest$10), Option.map(specifiersBeside({
|
|
592
592
|
join,
|
|
593
593
|
dirname: files.dirname,
|
|
594
594
|
directory: test.directory
|
|
@@ -607,7 +607,7 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
607
607
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
608
608
|
});
|
|
609
609
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
610
|
-
const problemIn$
|
|
610
|
+
const problemIn$7 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
611
611
|
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$7(test, DIRECTORY_MESSAGE));
|
|
612
612
|
if (!TEST_FILE$2.test(test.name)) return Option.none();
|
|
613
613
|
if (yield* refersIn(context, test)) return Option.none();
|
|
@@ -616,7 +616,7 @@ const problemIn$6 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
|
616
616
|
/** @internal */
|
|
617
617
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
618
618
|
const files = yield* RepositoryFiles;
|
|
619
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
619
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$8);
|
|
620
620
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
621
621
|
const context = {
|
|
622
622
|
root,
|
|
@@ -631,12 +631,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
631
631
|
directory: files.dirname(file)
|
|
632
632
|
};
|
|
633
633
|
}));
|
|
634
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$
|
|
634
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$7(context, test), { concurrency: READ_CONCURRENCY$30 });
|
|
635
635
|
return Array.getSomes(found);
|
|
636
636
|
});
|
|
637
637
|
// src/shared/lib/agent-docs.ts
|
|
638
638
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
639
|
-
const READ_CONCURRENCY$
|
|
639
|
+
const READ_CONCURRENCY$29 = 16;
|
|
640
640
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
641
641
|
const files = yield* RepositoryFiles;
|
|
642
642
|
const listed = yield* files.listedFiles(root);
|
|
@@ -645,32 +645,32 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
645
645
|
const file = files.join(root, name);
|
|
646
646
|
const problemOf = Option.flatMap(problemIn(file));
|
|
647
647
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
648
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
648
|
+
}, { concurrency: READ_CONCURRENCY$29 });
|
|
649
649
|
return Array.getSomes(found);
|
|
650
650
|
});
|
|
651
651
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
652
652
|
const RECOMMENDED_LINES = 200;
|
|
653
|
-
const FIRST$
|
|
654
|
-
const RULE$
|
|
653
|
+
const FIRST$19 = 1;
|
|
654
|
+
const RULE$52 = "agent-docs-length";
|
|
655
655
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
656
656
|
const problemFor$6 = (file) => (lines) => {
|
|
657
657
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
658
658
|
return Option.some({
|
|
659
659
|
file,
|
|
660
660
|
line: 201,
|
|
661
|
-
column: FIRST$
|
|
662
|
-
rule: RULE$
|
|
661
|
+
column: FIRST$19,
|
|
662
|
+
rule: RULE$52,
|
|
663
663
|
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.`
|
|
664
664
|
});
|
|
665
665
|
};
|
|
666
666
|
/** @internal */
|
|
667
667
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$6(file)(lineCount(source)));
|
|
668
668
|
// src/features/check-placement/model/claude-link.ts
|
|
669
|
-
const RULE$
|
|
669
|
+
const RULE$51 = "claude-md-link";
|
|
670
670
|
const CLAUDE = "CLAUDE.md";
|
|
671
671
|
const AGENTS = "AGENTS.md";
|
|
672
|
-
const FIRST$
|
|
673
|
-
const READ_CONCURRENCY$
|
|
672
|
+
const FIRST$18 = 1;
|
|
673
|
+
const READ_CONCURRENCY$28 = 16;
|
|
674
674
|
const MESSAGE$16 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
675
675
|
/** @internal */
|
|
676
676
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -683,22 +683,22 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
683
683
|
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
684
684
|
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
685
685
|
file: path,
|
|
686
|
-
line: FIRST$
|
|
687
|
-
column: FIRST$
|
|
688
|
-
rule: RULE$
|
|
686
|
+
line: FIRST$18,
|
|
687
|
+
column: FIRST$18,
|
|
688
|
+
rule: RULE$51,
|
|
689
689
|
message: MESSAGE$16
|
|
690
690
|
})));
|
|
691
691
|
});
|
|
692
692
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
693
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
693
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$28 });
|
|
694
694
|
return Array.getSomes(found);
|
|
695
695
|
});
|
|
696
696
|
// src/features/check-placement/model/dangling-links.ts
|
|
697
|
-
const RULE$
|
|
698
|
-
const SEPARATOR$
|
|
699
|
-
const FIRST$
|
|
700
|
-
const READ_CONCURRENCY$
|
|
701
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
697
|
+
const RULE$50 = "dangling-link";
|
|
698
|
+
const SEPARATOR$21 = "/";
|
|
699
|
+
const FIRST$17 = 1;
|
|
700
|
+
const READ_CONCURRENCY$27 = 16;
|
|
701
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$21}`)(name);
|
|
702
702
|
/** @internal */
|
|
703
703
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
704
704
|
const files = yield* RepositoryFiles;
|
|
@@ -708,35 +708,142 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
708
708
|
const link = yield* files.readLink(file);
|
|
709
709
|
return pipe(link, Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))), Option.filter((target) => !pipe(listed, Array.some(holds(target)))), Option.map((target) => ({
|
|
710
710
|
file,
|
|
711
|
-
line: FIRST$
|
|
712
|
-
column: FIRST$
|
|
713
|
-
rule: RULE$
|
|
711
|
+
line: FIRST$17,
|
|
712
|
+
column: FIRST$17,
|
|
713
|
+
rule: RULE$50,
|
|
714
714
|
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.`
|
|
715
715
|
})));
|
|
716
716
|
});
|
|
717
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
717
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$27 });
|
|
718
|
+
return Array.getSomes(found);
|
|
719
|
+
});
|
|
720
|
+
// src/features/check-placement/model/member-sources.ts
|
|
721
|
+
const ROOT_WORKSPACE$1 = ".";
|
|
722
|
+
const FIRST$16 = 1;
|
|
723
|
+
const SEPARATOR$20 = "/";
|
|
724
|
+
const EXCLUDED$7 = [
|
|
725
|
+
":(exclude,attr:linguist-vendored)",
|
|
726
|
+
":(exclude,attr:linguist-generated)",
|
|
727
|
+
":(exclude,attr:linguist-documentation)"
|
|
728
|
+
];
|
|
729
|
+
const memberWorkspaces = Effect.fn("memberWorkspaces")(function* memberWorkspaces(root) {
|
|
730
|
+
const declared = yield* workspaceDirectories(root);
|
|
731
|
+
return pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE$1));
|
|
732
|
+
});
|
|
733
|
+
const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
734
|
+
const files = yield* RepositoryFiles;
|
|
735
|
+
return {
|
|
736
|
+
workspaces: yield* memberWorkspaces(root),
|
|
737
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$7)
|
|
738
|
+
};
|
|
739
|
+
});
|
|
740
|
+
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
741
|
+
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
742
|
+
file,
|
|
743
|
+
line: FIRST$16,
|
|
744
|
+
column: FIRST$16,
|
|
745
|
+
rule,
|
|
746
|
+
message
|
|
747
|
+
});
|
|
748
|
+
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) => ({
|
|
749
|
+
workspace,
|
|
750
|
+
inner: String$1.slice(workspace.length + 1)(name)
|
|
751
|
+
})));
|
|
752
|
+
// src/features/check-placement/model/readme-file.ts
|
|
753
|
+
const README_FILE = "README.md";
|
|
754
|
+
const readReadme = Effect.fn("readReadme")(function* readReadme({ root, directory, rule, missingMessage }) {
|
|
755
|
+
const files = yield* RepositoryFiles;
|
|
756
|
+
const file = files.join(root, directory, README_FILE);
|
|
757
|
+
const text = yield* files.readFile(file);
|
|
758
|
+
return pipe(text, Option.match({
|
|
759
|
+
onNone: () => Result.fail(fileProblem$1({
|
|
760
|
+
file,
|
|
761
|
+
rule,
|
|
762
|
+
message: missingMessage
|
|
763
|
+
})),
|
|
764
|
+
onSome: (source) => Result.succeed({
|
|
765
|
+
file,
|
|
766
|
+
source
|
|
767
|
+
})
|
|
768
|
+
}));
|
|
769
|
+
});
|
|
770
|
+
// src/features/check-placement/model/deployed-readme.ts
|
|
771
|
+
const RULE$49 = "deployed-readme";
|
|
772
|
+
const ROOT_DIRECTORY$2 = "";
|
|
773
|
+
const READ_CONCURRENCY$26 = 16;
|
|
774
|
+
const MISSING_MESSAGE$1 = "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.";
|
|
775
|
+
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.";
|
|
776
|
+
const ADDRESS_KEYS = [
|
|
777
|
+
"domain",
|
|
778
|
+
"domains",
|
|
779
|
+
"routes",
|
|
780
|
+
"hostname"
|
|
781
|
+
];
|
|
782
|
+
const URL_KEY = "url";
|
|
783
|
+
const STACK_FILE = /(?:^|\/)alchemy\.(?![^/]*\.test\.)[^/]+\.[cm]?ts$/u;
|
|
784
|
+
const ALCHEMY_IMPORT = /from\s+["'](?:alchemy|@alchemy\.run)(?:\/[^"']*)?["']/u;
|
|
785
|
+
const URL_PATTERN = /https:\/\/[^\s)>\]]+/u;
|
|
786
|
+
const decodeKey$2 = Schema.decodeUnknownOption(KeySchema);
|
|
787
|
+
const propertyNamed = (names) => (node) => Predicate.isReadonlyObject(node) && node["type"] === "Property" && pipe(decodeKey$2(node["key"]), Option.exists((key) => Array.contains(names, keyName(key))));
|
|
788
|
+
const isAddressProperty = propertyNamed(ADDRESS_KEYS);
|
|
789
|
+
const isUrlProperty = propertyNamed([URL_KEY]);
|
|
790
|
+
const ReturnedObject = Schema.Struct({
|
|
791
|
+
type: Schema.Literal("ReturnStatement"),
|
|
792
|
+
argument: Schema.Struct({
|
|
793
|
+
type: Schema.Literal("ObjectExpression"),
|
|
794
|
+
properties: Schema.Array(Schema.Unknown)
|
|
795
|
+
})
|
|
796
|
+
});
|
|
797
|
+
const decodeReturnedObject = Schema.decodeUnknownOption(ReturnedObject);
|
|
798
|
+
const returnsUrl = (node) => pipe(decodeReturnedObject(node), Option.exists(({ argument }) => pipe(argument.properties, Array.some(isUrlProperty))));
|
|
799
|
+
const servesAddress = (node) => isAddressProperty(node) || returnsUrl(node) || pipe(childrenOf$1(node), Array.some(servesAddress));
|
|
800
|
+
const deploysTo = Effect.fn("deploysTo")(function* deploysTo(root, file) {
|
|
801
|
+
const files = yield* RepositoryFiles;
|
|
802
|
+
const text = yield* files.readFile(files.join(root, file));
|
|
803
|
+
if (Option.isNone(text) || !ALCHEMY_IMPORT.test(text.value)) return false;
|
|
804
|
+
const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: "ts" }));
|
|
805
|
+
return servesAddress(parsed.program);
|
|
806
|
+
});
|
|
807
|
+
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
808
|
+
const readme = yield* readReadme({
|
|
809
|
+
root,
|
|
810
|
+
directory,
|
|
811
|
+
rule: RULE$49,
|
|
812
|
+
missingMessage: MISSING_MESSAGE$1
|
|
813
|
+
});
|
|
814
|
+
return Result.match(readme, {
|
|
815
|
+
onFailure: Option.some,
|
|
816
|
+
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
817
|
+
file,
|
|
818
|
+
rule: RULE$49,
|
|
819
|
+
message: NO_URL_MESSAGE
|
|
820
|
+
})))
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
/** @internal */
|
|
824
|
+
const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDeployedReadme(root) {
|
|
825
|
+
const files = yield* RepositoryFiles;
|
|
826
|
+
const listed = yield* files.listedFiles(root);
|
|
827
|
+
const directories = yield* workspaceDirectories(root);
|
|
828
|
+
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
829
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$26 });
|
|
830
|
+
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$2))), Array.dedupe);
|
|
831
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$6(root, directory), { concurrency: READ_CONCURRENCY$26 });
|
|
718
832
|
return Array.getSomes(found);
|
|
719
833
|
});
|
|
720
834
|
// src/features/check-placement/model/nested-docs.ts
|
|
721
|
-
const RULE$
|
|
722
|
-
const CONFIG_FILE$
|
|
835
|
+
const RULE$48 = "nested-docs";
|
|
836
|
+
const CONFIG_FILE$7 = "vite.config.ts";
|
|
723
837
|
const SEPARATOR$19 = "/";
|
|
724
|
-
const
|
|
725
|
-
const READ_CONCURRENCY$24 = 64;
|
|
838
|
+
const READ_CONCURRENCY$25 = 64;
|
|
726
839
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
727
840
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
728
841
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
729
842
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
730
|
-
const taggedError$
|
|
731
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
843
|
+
const taggedError$6 = Schema.TaggedError;
|
|
844
|
+
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
732
845
|
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
733
|
-
const problemFor$5 = (
|
|
734
|
-
file,
|
|
735
|
-
line: FIRST$22,
|
|
736
|
-
column: FIRST$22,
|
|
737
|
-
rule: RULE$45,
|
|
738
|
-
message
|
|
739
|
-
});
|
|
846
|
+
const problemFor$5 = problemInFile(RULE$48);
|
|
740
847
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
741
848
|
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.";
|
|
742
849
|
const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
|
|
@@ -762,7 +869,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, na
|
|
|
762
869
|
});
|
|
763
870
|
const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
|
|
764
871
|
const files = yield* RepositoryFiles;
|
|
765
|
-
const file = files.join(root, CONFIG_FILE$
|
|
872
|
+
const file = files.join(root, CONFIG_FILE$7);
|
|
766
873
|
if (!(yield* files.exists(file))) return false;
|
|
767
874
|
const config = yield* Effect.tryPromise({
|
|
768
875
|
try: () => resolveConfigFromFile(file),
|
|
@@ -781,46 +888,43 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
781
888
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
782
889
|
workspaceAgentDocs
|
|
783
890
|
};
|
|
784
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
891
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$25 });
|
|
785
892
|
return Array.getSomes(found);
|
|
786
893
|
});
|
|
787
894
|
// src/features/check-placement/model/published-readme.ts
|
|
788
|
-
const RULE$
|
|
789
|
-
const
|
|
790
|
-
const READ_CONCURRENCY$23 = 16;
|
|
895
|
+
const RULE$47 = "published-readme";
|
|
896
|
+
const READ_CONCURRENCY$24 = 16;
|
|
791
897
|
const MESSAGE$15 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
792
898
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
793
|
-
const FILE_START$1 = 1;
|
|
794
899
|
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
795
|
-
const
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
900
|
+
const readme = yield* readReadme({
|
|
901
|
+
root,
|
|
902
|
+
directory,
|
|
903
|
+
rule: RULE$47,
|
|
904
|
+
missingMessage: MISSING_MESSAGE
|
|
905
|
+
});
|
|
906
|
+
return Result.match(readme, {
|
|
907
|
+
onFailure: Option.some,
|
|
908
|
+
onSuccess: ({ file, source }) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
909
|
+
const { line, column } = positionOf(source)(found.index);
|
|
910
|
+
return {
|
|
911
|
+
file,
|
|
912
|
+
line,
|
|
913
|
+
column,
|
|
914
|
+
rule: RULE$47,
|
|
915
|
+
message: MESSAGE$15
|
|
916
|
+
};
|
|
917
|
+
}))
|
|
804
918
|
});
|
|
805
|
-
return pipe(text, Option.flatMap((source) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
806
|
-
const { line, column } = positionOf(source)(found.index);
|
|
807
|
-
return {
|
|
808
|
-
file,
|
|
809
|
-
line,
|
|
810
|
-
column,
|
|
811
|
-
rule: RULE$44,
|
|
812
|
-
message: MESSAGE$15
|
|
813
|
-
};
|
|
814
|
-
}))));
|
|
815
919
|
});
|
|
816
920
|
/** @internal */
|
|
817
921
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
818
922
|
const projects = yield* publishedProjects(root);
|
|
819
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$
|
|
923
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$24 });
|
|
820
924
|
return Array.getSomes(found);
|
|
821
925
|
});
|
|
822
926
|
// src/features/check-placement/model/published-tests.ts
|
|
823
|
-
const RULE$
|
|
927
|
+
const RULE$46 = "published-tests";
|
|
824
928
|
const MANIFEST_FILE$2 = "package.json";
|
|
825
929
|
const FILE_START = 1;
|
|
826
930
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
@@ -835,7 +939,7 @@ const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
835
939
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
836
940
|
line: FILE_START,
|
|
837
941
|
column: FILE_START,
|
|
838
|
-
rule: RULE$
|
|
942
|
+
rule: RULE$46,
|
|
839
943
|
message: MESSAGE$14
|
|
840
944
|
});
|
|
841
945
|
});
|
|
@@ -849,9 +953,9 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
849
953
|
return Array.getSomes(found);
|
|
850
954
|
});
|
|
851
955
|
// src/features/check-placement/model/root-docs.ts
|
|
852
|
-
const RULE$
|
|
956
|
+
const RULE$45 = "root-docs";
|
|
853
957
|
const SEPARATOR$18 = "/";
|
|
854
|
-
const FIRST$
|
|
958
|
+
const FIRST$15 = 1;
|
|
855
959
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
856
960
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
857
961
|
const MESSAGE$13 = "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.";
|
|
@@ -862,17 +966,17 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
862
966
|
const names = yield* files.listedFiles(root);
|
|
863
967
|
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
864
968
|
file: files.join(root, name),
|
|
865
|
-
line: FIRST$
|
|
866
|
-
column: FIRST$
|
|
867
|
-
rule: RULE$
|
|
969
|
+
line: FIRST$15,
|
|
970
|
+
column: FIRST$15,
|
|
971
|
+
rule: RULE$45,
|
|
868
972
|
message: `${name} ${MESSAGE$13}`
|
|
869
973
|
})));
|
|
870
974
|
});
|
|
871
975
|
// src/features/check-placement/model/root-readme.ts
|
|
872
|
-
const RULE$
|
|
976
|
+
const RULE$44 = "root-readme";
|
|
873
977
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
874
|
-
const READ_CONCURRENCY$
|
|
875
|
-
const START$
|
|
978
|
+
const READ_CONCURRENCY$23 = 16;
|
|
979
|
+
const START$20 = 0;
|
|
876
980
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
877
981
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
878
982
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -911,14 +1015,14 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
911
1015
|
onNone: () => ownNames(plugins, names),
|
|
912
1016
|
onSome: () => [directory]
|
|
913
1017
|
}));
|
|
914
|
-
const problemsIn$
|
|
1018
|
+
const problemsIn$17 = (file, source, plugins) => (workspace) => {
|
|
915
1019
|
const message = messageFor(workspace.directory);
|
|
916
1020
|
const at = positionOf(source);
|
|
917
1021
|
const pattern = patternFor(plugins)(workspace);
|
|
918
1022
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
919
1023
|
file,
|
|
920
|
-
...at(found.index ?? START$
|
|
921
|
-
rule: RULE$
|
|
1024
|
+
...at(found.index ?? START$20),
|
|
1025
|
+
rule: RULE$44,
|
|
922
1026
|
message
|
|
923
1027
|
})));
|
|
924
1028
|
};
|
|
@@ -926,7 +1030,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
|
|
|
926
1030
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
927
1031
|
return pipe(text, Option.match({
|
|
928
1032
|
onNone: () => [],
|
|
929
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1033
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$17(file, source, plugins)))
|
|
930
1034
|
}));
|
|
931
1035
|
});
|
|
932
1036
|
/** @internal */
|
|
@@ -937,7 +1041,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
937
1041
|
const named = yield* namedWorkspaces(root);
|
|
938
1042
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
939
1043
|
const plugins = yield* marketplacePlugins(root);
|
|
940
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
1044
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$23 });
|
|
941
1045
|
return Array.flatten(found);
|
|
942
1046
|
});
|
|
943
1047
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -951,15 +1055,16 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
951
1055
|
checkAgentDocsLength(root),
|
|
952
1056
|
checkDanglingLinks(root),
|
|
953
1057
|
checkPublishedReadme(root),
|
|
1058
|
+
checkDeployedReadme(root),
|
|
954
1059
|
checkPublishedTests(root)
|
|
955
1060
|
], { concurrency: "unbounded" });
|
|
956
1061
|
return Array.flatten(found);
|
|
957
1062
|
});
|
|
958
1063
|
// src/features/check-placement/model/docs-mirror.ts
|
|
959
|
-
const RULE$
|
|
1064
|
+
const RULE$43 = "docs-mirror";
|
|
960
1065
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
961
1066
|
const MIRROR_LIMIT = 3;
|
|
962
|
-
const READ_CONCURRENCY$
|
|
1067
|
+
const READ_CONCURRENCY$22 = 16;
|
|
963
1068
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
964
1069
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
965
1070
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -973,7 +1078,7 @@ const firstMention = (source, workspace) => {
|
|
|
973
1078
|
const mentions = pipe(workspace.names, Array.flatMap(mentionOf(source, workspace.directory)));
|
|
974
1079
|
return Array.head(Array.sort(mentions, byOffset));
|
|
975
1080
|
};
|
|
976
|
-
const ownerOf$
|
|
1081
|
+
const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
|
|
977
1082
|
const describe = (mentions) => pipe(mentions, Array.map(({ directory }) => `\`${directory}\``), Array.join(", "));
|
|
978
1083
|
const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
|
|
979
1084
|
const { line, column } = positionOf(source)(offset);
|
|
@@ -981,11 +1086,11 @@ const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
981
1086
|
file,
|
|
982
1087
|
line,
|
|
983
1088
|
column,
|
|
984
|
-
rule: RULE$
|
|
1089
|
+
rule: RULE$43,
|
|
985
1090
|
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.`
|
|
986
1091
|
};
|
|
987
1092
|
}), Option.toArray);
|
|
988
|
-
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$
|
|
1093
|
+
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$3(doc)(workspace)));
|
|
989
1094
|
const problemIn$3 = (workspaces) => (doc, file, source) => {
|
|
990
1095
|
const mentions = pipe(othersIn(doc, workspaces), Array.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
|
|
991
1096
|
return problemFor$3(file, source, Array.sort(mentions, byOffset));
|
|
@@ -996,7 +1101,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
996
1101
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
997
1102
|
directory,
|
|
998
1103
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
999
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1104
|
+
}))), { concurrency: READ_CONCURRENCY$22 });
|
|
1000
1105
|
});
|
|
1001
1106
|
/** @internal */
|
|
1002
1107
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1009,13 +1114,13 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1009
1114
|
onNone: () => [],
|
|
1010
1115
|
onSome: (text) => problemIn$3(workspaces)(doc, file, text)
|
|
1011
1116
|
})));
|
|
1012
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1117
|
+
}, { concurrency: READ_CONCURRENCY$22 });
|
|
1013
1118
|
return Array.flatten(found);
|
|
1014
1119
|
});
|
|
1015
1120
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1016
|
-
const RULE$
|
|
1121
|
+
const RULE$42 = "ignored-sources";
|
|
1017
1122
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1018
|
-
const FIRST$
|
|
1123
|
+
const FIRST$14 = 1;
|
|
1019
1124
|
const MESSAGE$12 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
1020
1125
|
/** @internal */
|
|
1021
1126
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
@@ -1023,44 +1128,12 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1023
1128
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
1024
1129
|
return pipe(ignored, Array.map((file) => ({
|
|
1025
1130
|
file: files.join(root, file),
|
|
1026
|
-
line: FIRST$
|
|
1027
|
-
column: FIRST$
|
|
1028
|
-
rule: RULE$
|
|
1131
|
+
line: FIRST$14,
|
|
1132
|
+
column: FIRST$14,
|
|
1133
|
+
rule: RULE$42,
|
|
1029
1134
|
message: MESSAGE$12
|
|
1030
1135
|
})));
|
|
1031
1136
|
});
|
|
1032
|
-
// src/features/check-placement/model/member-sources.ts
|
|
1033
|
-
const ROOT_WORKSPACE$1 = ".";
|
|
1034
|
-
const FIRST$19 = 1;
|
|
1035
|
-
const SEPARATOR$16 = "/";
|
|
1036
|
-
const EXCLUDED$6 = [
|
|
1037
|
-
":(exclude,attr:linguist-vendored)",
|
|
1038
|
-
":(exclude,attr:linguist-generated)",
|
|
1039
|
-
":(exclude,attr:linguist-documentation)"
|
|
1040
|
-
];
|
|
1041
|
-
const memberWorkspaces = Effect.fn("memberWorkspaces")(function* memberWorkspaces(root) {
|
|
1042
|
-
const declared = yield* workspaceDirectories(root);
|
|
1043
|
-
return pipe(declared, Array.filter((workspace) => workspace !== ROOT_WORKSPACE$1));
|
|
1044
|
-
});
|
|
1045
|
-
const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
1046
|
-
const files = yield* RepositoryFiles;
|
|
1047
|
-
return {
|
|
1048
|
-
workspaces: yield* memberWorkspaces(root),
|
|
1049
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$6)
|
|
1050
|
-
};
|
|
1051
|
-
});
|
|
1052
|
-
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1053
|
-
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
1054
|
-
file,
|
|
1055
|
-
line: FIRST$19,
|
|
1056
|
-
column: FIRST$19,
|
|
1057
|
-
rule,
|
|
1058
|
-
message
|
|
1059
|
-
});
|
|
1060
|
-
const ownerOf$3 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$16}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
1061
|
-
workspace,
|
|
1062
|
-
inner: String$1.slice(workspace.length + 1)(name)
|
|
1063
|
-
})));
|
|
1064
1137
|
// src/features/check-placement/model/public-entries.ts
|
|
1065
1138
|
const ENTRY_RULE$3 = "public-entry";
|
|
1066
1139
|
const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
|
|
@@ -1088,8 +1161,8 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
|
|
|
1088
1161
|
return Array.flatten(entries);
|
|
1089
1162
|
});
|
|
1090
1163
|
// src/shared/lib/tree-sitter.ts
|
|
1091
|
-
const taggedError$
|
|
1092
|
-
var GrammarUnreadable = class extends taggedError$
|
|
1164
|
+
const taggedError$5 = Schema.TaggedError;
|
|
1165
|
+
var GrammarUnreadable = class extends taggedError$5()("GrammarUnreadable", {
|
|
1093
1166
|
grammar: Schema.String,
|
|
1094
1167
|
message: Schema.String
|
|
1095
1168
|
}) {};
|
|
@@ -9638,39 +9711,81 @@ var english_verbs_default = [
|
|
|
9638
9711
|
// src/features/check-placement/model/source-names.ts
|
|
9639
9712
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
9640
9713
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
9641
|
-
const
|
|
9714
|
+
const SEGMENT_RULE = "slice-segment-name";
|
|
9715
|
+
const SEPARATOR$15 = "/";
|
|
9642
9716
|
const NEXT$3 = 1;
|
|
9643
9717
|
const WORD_SEPARATOR$1 = "-";
|
|
9644
9718
|
const MINIMUM_WORDS = 2;
|
|
9645
9719
|
const FEATURES$1 = "src/features/";
|
|
9646
9720
|
const SOURCE$1 = "src/";
|
|
9721
|
+
const SEGMENTS = /* @__PURE__ */ new Set([
|
|
9722
|
+
"ui",
|
|
9723
|
+
"model",
|
|
9724
|
+
"api",
|
|
9725
|
+
"lib",
|
|
9726
|
+
"config",
|
|
9727
|
+
"@x"
|
|
9728
|
+
]);
|
|
9647
9729
|
const DEPLOY_MARKER = /(?:^|[.-])entrypoints?(?=[.-]|$)|\.worker(?=\.)/iu;
|
|
9730
|
+
const INDEX = /\/index(?:\.[a-z]+)*\.[cm]?[jt]sx?$/u;
|
|
9648
9731
|
const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
|
|
9649
9732
|
const VERBS = new Set(english_verbs_default);
|
|
9650
9733
|
const SLICE_MESSAGE$1 = "is not named <verb>-<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check-layout, sync-manuscripts).";
|
|
9734
|
+
const SEGMENT_MESSAGE = "is a folder in a slice that is not one of the segments ui, model, api, lib or config. Name the segment after its purpose and put the code in one of them; a segment that grows holds folders of its own.";
|
|
9651
9735
|
const ENTRY_MESSAGE$1 = "is named after where it is deployed. Name it after what the code does; the Alchemy resource that deploys it decides which file is the entry.";
|
|
9652
9736
|
const isVerbObjectBy = (separator) => (slice) => {
|
|
9653
9737
|
const words = String$1.split(slice, separator);
|
|
9654
9738
|
return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
|
|
9655
9739
|
};
|
|
9656
9740
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
9657
|
-
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$
|
|
9741
|
+
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$15))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$15}${FEATURES$1}${slice}`));
|
|
9742
|
+
const SLICE_LAYERS = [
|
|
9743
|
+
"features",
|
|
9744
|
+
"entities",
|
|
9745
|
+
"widgets",
|
|
9746
|
+
"pages"
|
|
9747
|
+
];
|
|
9748
|
+
const SLICE_DEPTHS = [3, 4];
|
|
9749
|
+
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$15);
|
|
9750
|
+
const isInSliceLayer = (parts) => {
|
|
9751
|
+
const [source, layer] = parts;
|
|
9752
|
+
return `${source}${SEPARATOR$15}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
|
|
9753
|
+
};
|
|
9754
|
+
const indexedSlice = (owned) => {
|
|
9755
|
+
const parts = String$1.split(owned.inner, SEPARATOR$15);
|
|
9756
|
+
const depth = parts.length - NEXT$3;
|
|
9757
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$15}${pathPrefix(parts, depth)}`));
|
|
9758
|
+
};
|
|
9759
|
+
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
9760
|
+
const parts = String$1.split(inner, SEPARATOR$15);
|
|
9761
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$15}${pathPrefix(parts, depth)}`);
|
|
9762
|
+
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
9763
|
+
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$15}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
9764
|
+
};
|
|
9658
9765
|
const deployNamed = ({ workspace, inner }) => {
|
|
9659
9766
|
if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
|
|
9660
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
9661
|
-
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$
|
|
9767
|
+
const segments = String$1.split(inner, SEPARATOR$15);
|
|
9768
|
+
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$15}${Array.join(Array.take(segments, index + NEXT$3), SEPARATOR$15)}`));
|
|
9662
9769
|
};
|
|
9663
9770
|
/** @internal */
|
|
9664
9771
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
9665
9772
|
const files = yield* RepositoryFiles;
|
|
9666
9773
|
const { workspaces, listed } = yield* memberSources(root);
|
|
9667
|
-
const owned = pipe(listed, Array.map(ownerOf$
|
|
9774
|
+
const owned = pipe(listed, Array.map(ownerOf$4(workspaces)), Array.getSomes);
|
|
9775
|
+
const slices = new Set(pipe(owned, Array.map(indexedSlice), Array.getSomes));
|
|
9668
9776
|
const report = (rule, message) => (found) => pipe(Array.dedupe(found), Array.map((name) => fileProblem$1({
|
|
9669
9777
|
file: files.join(root, name),
|
|
9670
9778
|
rule,
|
|
9671
9779
|
message
|
|
9672
9780
|
})));
|
|
9673
|
-
|
|
9781
|
+
const misnamedSlices = pipe(owned, Array.map(misnamedSlice$1), Array.getSomes);
|
|
9782
|
+
const misnamedSegments = pipe(owned, Array.map(misnamedSegment(slices)), Array.getSomes);
|
|
9783
|
+
const deployNames = pipe(owned, Array.map(deployNamed), Array.getSomes);
|
|
9784
|
+
return [
|
|
9785
|
+
...report(SLICE_RULE$1, SLICE_MESSAGE$1)(misnamedSlices),
|
|
9786
|
+
...report(SEGMENT_RULE, SEGMENT_MESSAGE)(misnamedSegments),
|
|
9787
|
+
...report(ENTRY_RULE$2, ENTRY_MESSAGE$1)(deployNames)
|
|
9788
|
+
];
|
|
9674
9789
|
});
|
|
9675
9790
|
// src/features/check-placement/model/rust-modules.ts
|
|
9676
9791
|
const LAYERED_RULE = "layered-source";
|
|
@@ -9693,8 +9808,8 @@ const LAYER_ITEMS = [
|
|
|
9693
9808
|
"attribute_item",
|
|
9694
9809
|
"inner_attribute_item"
|
|
9695
9810
|
];
|
|
9696
|
-
const READ_CONCURRENCY$
|
|
9697
|
-
const EXCLUDED$
|
|
9811
|
+
const READ_CONCURRENCY$21 = 64;
|
|
9812
|
+
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9698
9813
|
const NONE$2 = [];
|
|
9699
9814
|
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.";
|
|
9700
9815
|
const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
|
|
@@ -9761,7 +9876,7 @@ const isRead = ({ inner }) => {
|
|
|
9761
9876
|
};
|
|
9762
9877
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
9763
9878
|
const files = yield* RepositoryFiles;
|
|
9764
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
9879
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$6);
|
|
9765
9880
|
const owner = crateOf(crateDirectories(listed));
|
|
9766
9881
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
9767
9882
|
...owned,
|
|
@@ -9775,17 +9890,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
9775
9890
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
|
|
9776
9891
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
9777
9892
|
const parse = parsedWith(language);
|
|
9778
|
-
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$
|
|
9893
|
+
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$21 });
|
|
9779
9894
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
9780
9895
|
});
|
|
9781
9896
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
9782
|
-
const RULE$
|
|
9783
|
-
const FIRST$
|
|
9897
|
+
const RULE$41 = "shadcn-ui-alias";
|
|
9898
|
+
const FIRST$13 = 1;
|
|
9784
9899
|
const problemOf$8 = (directory, { file, alias }) => ({
|
|
9785
9900
|
file,
|
|
9786
|
-
line: FIRST$
|
|
9787
|
-
column: FIRST$
|
|
9788
|
-
rule: RULE$
|
|
9901
|
+
line: FIRST$13,
|
|
9902
|
+
column: FIRST$13,
|
|
9903
|
+
rule: RULE$41,
|
|
9789
9904
|
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/*".`
|
|
9790
9905
|
});
|
|
9791
9906
|
/** @internal */
|
|
@@ -9801,20 +9916,12 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
|
|
|
9801
9916
|
});
|
|
9802
9917
|
// src/features/check-placement/model/source-aliases.ts
|
|
9803
9918
|
const ALIAS_RULE = "source-alias";
|
|
9804
|
-
const FIRST$17 = 1;
|
|
9805
9919
|
const SOURCE_ALIAS = "#/*";
|
|
9806
9920
|
const SOURCE_TARGET = "./src/*";
|
|
9807
9921
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
9808
9922
|
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.`;
|
|
9809
|
-
const Manifest$
|
|
9810
|
-
const decodeManifest$
|
|
9811
|
-
const problemAt$6 = (file, rule, message) => ({
|
|
9812
|
-
file,
|
|
9813
|
-
line: FIRST$17,
|
|
9814
|
-
column: FIRST$17,
|
|
9815
|
-
rule,
|
|
9816
|
-
message
|
|
9817
|
-
});
|
|
9923
|
+
const Manifest$5 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
9924
|
+
const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
9818
9925
|
const targetsOf = (target) => {
|
|
9819
9926
|
if (Predicate.isString(target)) return [target];
|
|
9820
9927
|
if (Predicate.isObject(target)) return pipe(Record.values(target), Array.flatMap(targetsOf));
|
|
@@ -9825,7 +9932,7 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
9825
9932
|
const files = yield* RepositoryFiles;
|
|
9826
9933
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
9827
9934
|
const text = yield* files.readFile(manifest);
|
|
9828
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
9935
|
+
return pipe(text, Option.flatMap(decodeManifest$9), 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}`)));
|
|
9829
9936
|
});
|
|
9830
9937
|
/** @internal */
|
|
9831
9938
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -9856,20 +9963,20 @@ const SCRIPTS = "scripts-directory";
|
|
|
9856
9963
|
const BIN = "bin";
|
|
9857
9964
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
9858
9965
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
9859
|
-
const SEPARATOR$
|
|
9966
|
+
const SEPARATOR$14 = "/";
|
|
9860
9967
|
const CURRENT = "./";
|
|
9861
|
-
const READ_CONCURRENCY$
|
|
9862
|
-
const FIRST$
|
|
9968
|
+
const READ_CONCURRENCY$20 = 8;
|
|
9969
|
+
const FIRST$12 = 1;
|
|
9863
9970
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
9864
|
-
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9971
|
+
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9865
9972
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
9866
|
-
const Manifest$
|
|
9973
|
+
const Manifest$4 = Schema.Struct({
|
|
9867
9974
|
bin: Schema.optional(Schema.Unknown),
|
|
9868
9975
|
main: Schema.optional(Schema.Unknown),
|
|
9869
9976
|
exports: Schema.optional(Schema.Unknown)
|
|
9870
9977
|
});
|
|
9871
9978
|
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
9872
|
-
const decodeManifest$
|
|
9979
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
9873
9980
|
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
9874
9981
|
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
9875
9982
|
const NO_ENTRIES = {
|
|
@@ -9896,30 +10003,30 @@ const entriesOf$2 = (manifest) => {
|
|
|
9896
10003
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
9897
10004
|
const files = yield* RepositoryFiles;
|
|
9898
10005
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
9899
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10006
|
+
return pipe(text, Option.flatMap(decodeManifest$8), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
9900
10007
|
});
|
|
9901
|
-
const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
10008
|
+
const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
9902
10009
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
9903
10010
|
const files = yield* RepositoryFiles;
|
|
9904
10011
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
9905
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
10012
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$14}${name}`), Array.filter(isCommand$1));
|
|
9906
10013
|
});
|
|
9907
10014
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
9908
10015
|
const files = yield* RepositoryFiles;
|
|
9909
10016
|
const listed = yield* files.listedFiles(root);
|
|
9910
10017
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
9911
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
10018
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$20 });
|
|
9912
10019
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
9913
10020
|
});
|
|
9914
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
9915
|
-
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
10021
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$14));
|
|
10022
|
+
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND$1.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
9916
10023
|
file,
|
|
9917
10024
|
...positionOf(source)(start),
|
|
9918
10025
|
rule: OUTSIDE_BIN,
|
|
9919
10026
|
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.`
|
|
9920
10027
|
})));
|
|
9921
10028
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
9922
|
-
const problemsIn$
|
|
10029
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
9923
10030
|
const files = yield* RepositoryFiles;
|
|
9924
10031
|
const config = yield* workspaceConfigOf(root, directory);
|
|
9925
10032
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -9935,8 +10042,8 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
9935
10042
|
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
9936
10043
|
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
9937
10044
|
file: files.join(root, directory, path),
|
|
9938
|
-
line: FIRST$
|
|
9939
|
-
column: FIRST$
|
|
10045
|
+
line: FIRST$12,
|
|
10046
|
+
column: FIRST$12,
|
|
9940
10047
|
rule: UNRUN,
|
|
9941
10048
|
message: `No task, package.json bin or workflow runs ${workspacePath(directory, path)}. Files in ${BIN}/ are entry points for fallow, so an unused one is never reported. Run it from a task or delete it.`
|
|
9942
10049
|
})));
|
|
@@ -9948,8 +10055,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
9948
10055
|
const isDirectory = yield* files.isDirectory(file);
|
|
9949
10056
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
9950
10057
|
file,
|
|
9951
|
-
line: FIRST$
|
|
9952
|
-
column: FIRST$
|
|
10058
|
+
line: FIRST$12,
|
|
10059
|
+
column: FIRST$12,
|
|
9953
10060
|
rule: SCRIPTS,
|
|
9954
10061
|
message: `${workspacePath(directory, SCRIPTS_DIRECTORY)} is a scripts directory. Put each command at ${BIN}/<name>.ts and the code that it shares in the package's own source, so that every workspace runs its commands the same way.`
|
|
9955
10062
|
})));
|
|
@@ -9958,47 +10065,47 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
9958
10065
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
9959
10066
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
9960
10067
|
const workflows = yield* workflowText(root);
|
|
9961
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
9962
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10068
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$16(root, directory, workflows), { concurrency: READ_CONCURRENCY$20 });
|
|
10069
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$20 });
|
|
9963
10070
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
9964
10071
|
});
|
|
9965
10072
|
// src/features/check-repository-layout/model/crates.ts
|
|
9966
|
-
const RULE$
|
|
10073
|
+
const RULE$40 = "unverified-crate";
|
|
9967
10074
|
const VERSION_RULE = "release-version";
|
|
9968
10075
|
const MANIFEST_FILE$1 = "package.json";
|
|
9969
10076
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
9970
10077
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
9971
|
-
const CONFIG_FILE$
|
|
9972
|
-
const SEPARATOR$
|
|
9973
|
-
const FIRST$
|
|
9974
|
-
const READ_CONCURRENCY$
|
|
10078
|
+
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10079
|
+
const SEPARATOR$13 = "/";
|
|
10080
|
+
const FIRST$11 = 1;
|
|
10081
|
+
const READ_CONCURRENCY$19 = 8;
|
|
9975
10082
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
9976
10083
|
const problemFor$2 = (crate, message) => ({
|
|
9977
10084
|
file: crate.manifest,
|
|
9978
|
-
line: FIRST$
|
|
9979
|
-
column: FIRST$
|
|
9980
|
-
rule: RULE$
|
|
10085
|
+
line: FIRST$11,
|
|
10086
|
+
column: FIRST$11,
|
|
10087
|
+
rule: RULE$40,
|
|
9981
10088
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
9982
10089
|
});
|
|
9983
10090
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
9984
10091
|
const files = yield* RepositoryFiles;
|
|
9985
10092
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
9986
10093
|
if (Option.isNone(workspace)) return Option.some(problemFor$2(crate, "is outside every workspace package"));
|
|
9987
|
-
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$
|
|
9988
|
-
return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$
|
|
10094
|
+
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
|
|
10095
|
+
return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
|
|
9989
10096
|
});
|
|
9990
10097
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
9991
10098
|
const files = yield* RepositoryFiles;
|
|
9992
10099
|
const directory = files.relative(root, files.dirname(crate.manifest));
|
|
9993
|
-
const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
10100
|
+
const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13))), Array.contains(directory))));
|
|
9994
10101
|
if (Option.isNone(workspace)) return Option.none();
|
|
9995
10102
|
const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE$1));
|
|
9996
10103
|
const version = pipe(text, Option.flatMap(Schema.decodeOption(PackageVersion)), Option.map((manifest) => manifest.version));
|
|
9997
10104
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
9998
10105
|
return Option.some({
|
|
9999
10106
|
file: crate.manifest,
|
|
10000
|
-
line: FIRST$
|
|
10001
|
-
column: FIRST$
|
|
10107
|
+
line: FIRST$11,
|
|
10108
|
+
column: FIRST$11,
|
|
10002
10109
|
rule: VERSION_RULE,
|
|
10003
10110
|
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.`
|
|
10004
10111
|
});
|
|
@@ -10009,11 +10116,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10009
10116
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10010
10117
|
const directories = yield* workspaceDirectories(root);
|
|
10011
10118
|
const crates = yield* cratesIn(root);
|
|
10012
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10119
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$19 });
|
|
10013
10120
|
return Array.getSomes(Array.flatten(found));
|
|
10014
10121
|
});
|
|
10015
10122
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10016
|
-
const RULE$
|
|
10123
|
+
const RULE$39 = "deploy-entry-pattern";
|
|
10017
10124
|
const FALLOW_KEYS = [
|
|
10018
10125
|
"entry",
|
|
10019
10126
|
"entryPoints",
|
|
@@ -10031,7 +10138,7 @@ const NEGATED = "!";
|
|
|
10031
10138
|
const ROOT_WORKSPACE = ".";
|
|
10032
10139
|
const WRAP_OFFSET$1 = 1;
|
|
10033
10140
|
const NO_OFFSET = 0;
|
|
10034
|
-
const READ_CONCURRENCY$
|
|
10141
|
+
const READ_CONCURRENCY$18 = 8;
|
|
10035
10142
|
const MESSAGE$11 = "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.";
|
|
10036
10143
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10037
10144
|
const FALLOW = {
|
|
@@ -10068,7 +10175,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10068
10175
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10069
10176
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10070
10177
|
});
|
|
10071
|
-
const problemsIn$
|
|
10178
|
+
const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10072
10179
|
const { root, file, kind, workspaces, entries } = request;
|
|
10073
10180
|
const files = yield* RepositoryFiles;
|
|
10074
10181
|
const path = files.join(root, file);
|
|
@@ -10084,7 +10191,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10084
10191
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10085
10192
|
file: path,
|
|
10086
10193
|
...positionOf(text.value)(start - kind.offset),
|
|
10087
|
-
rule: RULE$
|
|
10194
|
+
rule: RULE$39,
|
|
10088
10195
|
message: `${pattern} ${MESSAGE$11}`
|
|
10089
10196
|
})));
|
|
10090
10197
|
});
|
|
@@ -10107,17 +10214,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10107
10214
|
}];
|
|
10108
10215
|
return [];
|
|
10109
10216
|
}));
|
|
10110
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10217
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$15({
|
|
10111
10218
|
root,
|
|
10112
10219
|
file,
|
|
10113
10220
|
kind,
|
|
10114
10221
|
workspaces,
|
|
10115
10222
|
entries
|
|
10116
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10223
|
+
}), { concurrency: READ_CONCURRENCY$18 });
|
|
10117
10224
|
return Array.flatten(found);
|
|
10118
10225
|
});
|
|
10119
10226
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10120
|
-
const RULE$
|
|
10227
|
+
const RULE$38 = "listed-entry";
|
|
10121
10228
|
const ENTRY_KEYS = [
|
|
10122
10229
|
"entry",
|
|
10123
10230
|
"entryPoints",
|
|
@@ -10125,9 +10232,9 @@ const ENTRY_KEYS = [
|
|
|
10125
10232
|
];
|
|
10126
10233
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
10127
10234
|
const WILDCARD$3 = /[*?{[]/u;
|
|
10128
|
-
const SEPARATOR$
|
|
10235
|
+
const SEPARATOR$12 = "/";
|
|
10129
10236
|
const WRAP_OFFSET = 1;
|
|
10130
|
-
const READ_CONCURRENCY$
|
|
10237
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10131
10238
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10132
10239
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10133
10240
|
const entryPatternsIn = (node) => {
|
|
@@ -10137,8 +10244,8 @@ const entryPatternsIn = (node) => {
|
|
|
10137
10244
|
})));
|
|
10138
10245
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10139
10246
|
};
|
|
10140
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$
|
|
10141
|
-
const problemsIn$
|
|
10247
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$12}`)(text))) || String$1.includes(SEPARATOR$12)(text) && !WILDCARD$3.test(text);
|
|
10248
|
+
const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10142
10249
|
const files = yield* RepositoryFiles;
|
|
10143
10250
|
const path = files.join(root, file);
|
|
10144
10251
|
const text = yield* files.readFile(path);
|
|
@@ -10147,7 +10254,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10147
10254
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10148
10255
|
file: path,
|
|
10149
10256
|
...positionOf(text.value)(start),
|
|
10150
|
-
rule: RULE$
|
|
10257
|
+
rule: RULE$38,
|
|
10151
10258
|
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.`
|
|
10152
10259
|
})));
|
|
10153
10260
|
});
|
|
@@ -10155,15 +10262,15 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10155
10262
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10156
10263
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10157
10264
|
const directories = yield* workspaceDirectories(root);
|
|
10158
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10265
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$14(root, file, directories), { concurrency: READ_CONCURRENCY$17 });
|
|
10159
10266
|
return Array.flatten(found);
|
|
10160
10267
|
});
|
|
10161
10268
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10162
|
-
const RULE$
|
|
10163
|
-
const CONFIG_FILE$
|
|
10269
|
+
const RULE$37 = "root-workspace-path";
|
|
10270
|
+
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10164
10271
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10165
10272
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10166
|
-
const FIRST$
|
|
10273
|
+
const FIRST$10 = 0;
|
|
10167
10274
|
const NEXT$2 = 1;
|
|
10168
10275
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10169
10276
|
const mentions = (directory) => (text) => {
|
|
@@ -10171,31 +10278,31 @@ const mentions = (directory) => (text) => {
|
|
|
10171
10278
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10172
10279
|
const before = parts[index] ?? "";
|
|
10173
10280
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10174
|
-
const following = String$1.slice(FIRST$
|
|
10281
|
+
const following = String$1.slice(FIRST$10, NEXT$2)(after);
|
|
10175
10282
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10176
10283
|
}));
|
|
10177
10284
|
};
|
|
10178
|
-
const problemsIn$
|
|
10285
|
+
const problemsIn$13 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10179
10286
|
file,
|
|
10180
10287
|
...positionOf(source)(found.start),
|
|
10181
|
-
rule: RULE$
|
|
10182
|
-
message: `${directory} is a workspace. The root ${CONFIG_FILE$
|
|
10288
|
+
rule: RULE$37,
|
|
10289
|
+
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.`
|
|
10183
10290
|
})));
|
|
10184
10291
|
/** @internal */
|
|
10185
10292
|
const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
|
|
10186
10293
|
const files = yield* RepositoryFiles;
|
|
10187
|
-
const file = files.join(root, CONFIG_FILE$
|
|
10294
|
+
const file = files.join(root, CONFIG_FILE$5);
|
|
10188
10295
|
const source = yield* files.readFile(file);
|
|
10189
10296
|
if (Option.isNone(source)) return [];
|
|
10190
10297
|
const directories = yield* workspaceDirectories(root);
|
|
10191
10298
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10192
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10299
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$13(file, source.value, directories)));
|
|
10193
10300
|
});
|
|
10194
10301
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10195
|
-
const RULE$
|
|
10196
|
-
const CONFIG_FILE$
|
|
10197
|
-
const FIRST$
|
|
10198
|
-
const READ_CONCURRENCY$
|
|
10302
|
+
const RULE$36 = "hidden-verify";
|
|
10303
|
+
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10304
|
+
const FIRST$9 = 1;
|
|
10305
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10199
10306
|
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10200
10307
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10201
10308
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -10204,21 +10311,21 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10204
10311
|
const verified = yield* hasVerifyTask(file);
|
|
10205
10312
|
return Option.some({
|
|
10206
10313
|
file,
|
|
10207
|
-
line: FIRST$
|
|
10208
|
-
column: FIRST$
|
|
10209
|
-
rule: RULE$
|
|
10210
|
-
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$
|
|
10314
|
+
line: FIRST$9,
|
|
10315
|
+
column: FIRST$9,
|
|
10316
|
+
rule: RULE$36,
|
|
10317
|
+
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}.`
|
|
10211
10318
|
}).pipe(Option.filter(() => verified));
|
|
10212
10319
|
});
|
|
10213
10320
|
/** @internal */
|
|
10214
10321
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10215
10322
|
const directories = yield* workspaceDirectories(root);
|
|
10216
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10323
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10217
10324
|
return Array.getSomes(found);
|
|
10218
10325
|
});
|
|
10219
10326
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10220
|
-
const RULE$
|
|
10221
|
-
const READ_CONCURRENCY$
|
|
10327
|
+
const RULE$35 = "shared-uncached-task";
|
|
10328
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10222
10329
|
const SHARED = 2;
|
|
10223
10330
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10224
10331
|
const UncachedTask = Schema.Struct({
|
|
@@ -10260,19 +10367,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
10260
10367
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10261
10368
|
file,
|
|
10262
10369
|
...position,
|
|
10263
|
-
rule: RULE$
|
|
10370
|
+
rule: RULE$35,
|
|
10264
10371
|
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.`
|
|
10265
10372
|
})));
|
|
10266
10373
|
};
|
|
10267
10374
|
/** @internal */
|
|
10268
10375
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10269
10376
|
const directories = yield* workspaceDirectories(root);
|
|
10270
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10377
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$15 });
|
|
10271
10378
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10272
10379
|
});
|
|
10273
10380
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10274
|
-
const RULE$
|
|
10275
|
-
const READ_CONCURRENCY$
|
|
10381
|
+
const RULE$34 = "unlocked-task";
|
|
10382
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10276
10383
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10277
10384
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10278
10385
|
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))));
|
|
@@ -10283,13 +10390,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10283
10390
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10284
10391
|
file,
|
|
10285
10392
|
...positionOf(source)(task.start),
|
|
10286
|
-
rule: RULE$
|
|
10393
|
+
rule: RULE$34,
|
|
10287
10394
|
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.`
|
|
10288
10395
|
})), Option.toArray)));
|
|
10289
10396
|
/** @internal */
|
|
10290
10397
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10291
10398
|
const directories = yield* workspaceDirectories(root);
|
|
10292
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10399
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$14 });
|
|
10293
10400
|
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10294
10401
|
});
|
|
10295
10402
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -10335,10 +10442,10 @@ const scalarsIn = (source) => {
|
|
|
10335
10442
|
return found;
|
|
10336
10443
|
};
|
|
10337
10444
|
// src/features/check-repository-layout/model/workflow-references.ts
|
|
10338
|
-
const ROOT$
|
|
10445
|
+
const ROOT$2 = ".";
|
|
10339
10446
|
const LOCAL$1 = "./";
|
|
10340
10447
|
const NEGATION = "!";
|
|
10341
|
-
const SEPARATOR$
|
|
10448
|
+
const SEPARATOR$11 = "/";
|
|
10342
10449
|
const LINE$1 = "\n";
|
|
10343
10450
|
const UNRESOLVED_MARKERS = [
|
|
10344
10451
|
"${{",
|
|
@@ -10364,10 +10471,10 @@ const withoutLocal = (path) => {
|
|
|
10364
10471
|
};
|
|
10365
10472
|
const joinPath = (base, path) => {
|
|
10366
10473
|
const relative = withoutLocal(String$1.trim(path));
|
|
10367
|
-
if (base === ROOT$
|
|
10368
|
-
return `${base}${SEPARATOR$
|
|
10474
|
+
if (base === ROOT$2) return relative;
|
|
10475
|
+
return `${base}${SEPARATOR$11}${relative}`;
|
|
10369
10476
|
};
|
|
10370
|
-
const reference = (kind, field, base = ROOT$
|
|
10477
|
+
const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
|
|
10371
10478
|
const path = String$1.trim(text);
|
|
10372
10479
|
if (!isLiteralPath(path) || !isLiteralPath(base)) return [];
|
|
10373
10480
|
return [{
|
|
@@ -10380,8 +10487,8 @@ const reference = (kind, field, base = ROOT$1) => ({ text, offset }) => {
|
|
|
10380
10487
|
const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
|
|
10381
10488
|
const globsIn = (field, node) => pipe(itemsOf(node), Array.flatMap((item) => Option.toArray(stringOf(item))), Array.filter(isPositive), Array.flatMap(reference("glob", field)));
|
|
10382
10489
|
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
10383
|
-
const directoryOf$1 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$
|
|
10384
|
-
const located = (kind, field, base = ROOT$
|
|
10490
|
+
const directoryOf$1 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$2, text)), Option.getOrElse(() => base));
|
|
10491
|
+
const located = (kind, field, base = ROOT$2) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
|
|
10385
10492
|
const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL$1)(text)));
|
|
10386
10493
|
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)({
|
|
10387
10494
|
text: token,
|
|
@@ -10425,7 +10532,7 @@ const jobsOf = (source) => entriesOf$1(childOf("jobs")(parseDocument(source).con
|
|
|
10425
10532
|
const workflowReferences = (source) => {
|
|
10426
10533
|
const root = parseDocument(source).contents;
|
|
10427
10534
|
const workflowDefault = workingDirectoryOf(root);
|
|
10428
|
-
const base = directoryOf$1(workflowDefault, ROOT$
|
|
10535
|
+
const base = directoryOf$1(workflowDefault, ROOT$2);
|
|
10429
10536
|
return [
|
|
10430
10537
|
...pipe(entriesOf$1(childOf("on")(root)), Array.flatMap(filtersOf)),
|
|
10431
10538
|
...located("directory", "defaults.run.working-directory")(workflowDefault),
|
|
@@ -10434,17 +10541,17 @@ const workflowReferences = (source) => {
|
|
|
10434
10541
|
];
|
|
10435
10542
|
};
|
|
10436
10543
|
const pathInputOf = (step) => childOf("path")(childOf("with")(step));
|
|
10437
|
-
const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf), Array.map(({ text }) => joinPath(ROOT$
|
|
10544
|
+
const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array.flatMap(linesOf), Array.map(({ text }) => joinPath(ROOT$2, text)), Array.filter(isLiteralPath));
|
|
10438
10545
|
/** @internal */
|
|
10439
10546
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10440
10547
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10441
|
-
const RULE$
|
|
10548
|
+
const RULE$33 = "workflow-path";
|
|
10442
10549
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10443
10550
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10444
|
-
const READ_CONCURRENCY$
|
|
10551
|
+
const READ_CONCURRENCY$13 = 8;
|
|
10445
10552
|
const WILDCARD$2 = /[*?[]/u;
|
|
10446
|
-
const SEPARATOR$
|
|
10447
|
-
const FIRST$
|
|
10553
|
+
const SEPARATOR$10 = "/";
|
|
10554
|
+
const FIRST$8 = 0;
|
|
10448
10555
|
const EXPECTED = {
|
|
10449
10556
|
action: "a directory with action.yml",
|
|
10450
10557
|
directory: "a directory",
|
|
@@ -10468,10 +10575,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
|
|
|
10468
10575
|
return Option.getOrElse(directory, () => false);
|
|
10469
10576
|
});
|
|
10470
10577
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
10471
|
-
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$
|
|
10578
|
+
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$10}${name}`), { concurrency: 1 });
|
|
10472
10579
|
return pipe(found, Array.some(Boolean));
|
|
10473
10580
|
});
|
|
10474
|
-
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$
|
|
10581
|
+
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$10))}`;
|
|
10475
10582
|
const RESOLVERS = {
|
|
10476
10583
|
action: hasAction,
|
|
10477
10584
|
directory: isDirectoryAt,
|
|
@@ -10479,13 +10586,13 @@ const RESOLVERS = {
|
|
|
10479
10586
|
glob: matchesGlob,
|
|
10480
10587
|
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
10481
10588
|
if (yield* existsAt(root, path)) return true;
|
|
10482
|
-
const segments = String$1.split(path, SEPARATOR$
|
|
10589
|
+
const segments = String$1.split(path, SEPARATOR$10);
|
|
10483
10590
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
10484
10591
|
})
|
|
10485
10592
|
};
|
|
10486
10593
|
const staticPrefix = (path) => {
|
|
10487
10594
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10488
|
-
if (String$1.endsWith(SEPARATOR$
|
|
10595
|
+
if (String$1.endsWith(SEPARATOR$10)(prefix)) return String$1.slice(FIRST$8, -1)(prefix);
|
|
10489
10596
|
return prefix;
|
|
10490
10597
|
};
|
|
10491
10598
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -10494,8 +10601,8 @@ const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
|
10494
10601
|
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
10495
10602
|
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10496
10603
|
});
|
|
10497
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$
|
|
10498
|
-
const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
10604
|
+
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$10}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$10}`)(path);
|
|
10605
|
+
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
10499
10606
|
const prefix = staticPrefix(found.path);
|
|
10500
10607
|
if (pipe(produced, Array.some(overlaps(prefix)))) return false;
|
|
10501
10608
|
if (yield* RESOLVERS[found.kind](root, found.path)) return false;
|
|
@@ -10504,22 +10611,22 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
10504
10611
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10505
10612
|
file,
|
|
10506
10613
|
...positionOf(source)(found.offset),
|
|
10507
|
-
rule: RULE$
|
|
10614
|
+
rule: RULE$33,
|
|
10508
10615
|
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.`
|
|
10509
10616
|
});
|
|
10510
|
-
const problemsIn$
|
|
10617
|
+
const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10511
10618
|
const files = yield* RepositoryFiles;
|
|
10512
10619
|
const file = files.join(root, workflow);
|
|
10513
10620
|
const source = yield* files.readFile(file);
|
|
10514
10621
|
if (Option.isNone(source)) return [];
|
|
10515
10622
|
const produced = producedPaths(source.value);
|
|
10516
|
-
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
|
|
10623
|
+
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing$1(root, produced, found));
|
|
10517
10624
|
return pipe(missing, Array.map(problemOf$7(file, source.value)));
|
|
10518
10625
|
});
|
|
10519
10626
|
/** @internal */
|
|
10520
10627
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10521
10628
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10522
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10629
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$12(root, workflow), { concurrency: READ_CONCURRENCY$13 });
|
|
10523
10630
|
return Array.flatten(found);
|
|
10524
10631
|
});
|
|
10525
10632
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10530,9 +10637,9 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10530
10637
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10531
10638
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10532
10639
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10533
|
-
const START$
|
|
10534
|
-
const READ_CONCURRENCY$
|
|
10535
|
-
const SEPARATOR$
|
|
10640
|
+
const START$19 = 0;
|
|
10641
|
+
const READ_CONCURRENCY$12 = 8;
|
|
10642
|
+
const SEPARATOR$9 = "/";
|
|
10536
10643
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10537
10644
|
const SPACE = " ";
|
|
10538
10645
|
const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
|
|
@@ -10554,14 +10661,14 @@ const pathFiltersIn = (file, source) => {
|
|
|
10554
10661
|
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
10555
10662
|
};
|
|
10556
10663
|
const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ names }) => Array.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf$1(names))(text))), Option.map(({ directory }) => directory));
|
|
10557
|
-
const named = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
10558
|
-
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$
|
|
10664
|
+
const named$1 = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
10665
|
+
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$9}`)(path)), Option.map(({ directory }) => directory));
|
|
10559
10666
|
const namesIn = (name, source) => {
|
|
10560
10667
|
const root = parseDocument(source).contents;
|
|
10561
10668
|
return [
|
|
10562
10669
|
{
|
|
10563
10670
|
text: name,
|
|
10564
|
-
offset: START$
|
|
10671
|
+
offset: START$19
|
|
10565
10672
|
},
|
|
10566
10673
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10567
10674
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10577,7 +10684,7 @@ const packagesIn = (workspaces, { file, name, source }) => {
|
|
|
10577
10684
|
file,
|
|
10578
10685
|
source
|
|
10579
10686
|
};
|
|
10580
|
-
const fromNames = pipe(namesIn(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named(workspaces, text))));
|
|
10687
|
+
const fromNames = pipe(namesIn(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
|
|
10581
10688
|
const referenced = pipe(workflowReferences(source), Array.filter(({ field }) => !String$1.startsWith("on.")(field)), Array.flatMap(({ field, path, offset }) => reported(where, offset, field)(containing(workspaces, path))));
|
|
10582
10689
|
const filtered = pipe(filtersIn(source), Array.flatMap(({ text, offset }) => reported(where, offset, `--filter ${text}`)(matching(workspaces, text))));
|
|
10583
10690
|
return [
|
|
@@ -10586,7 +10693,7 @@ const packagesIn = (workspaces, { file, name, source }) => {
|
|
|
10586
10693
|
...filtered
|
|
10587
10694
|
];
|
|
10588
10695
|
};
|
|
10589
|
-
const actionProblems = (workspaces, file, name) => pipe(named(workspaces, name), Option.map((directory) => ({
|
|
10696
|
+
const actionProblems = (workspaces, file, name) => pipe(named$1(workspaces, name), Option.map((directory) => ({
|
|
10590
10697
|
file,
|
|
10591
10698
|
line: 1,
|
|
10592
10699
|
column: 1,
|
|
@@ -10611,7 +10718,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10611
10718
|
name: stem,
|
|
10612
10719
|
source: text
|
|
10613
10720
|
})]), Option.getOrElse(() => []));
|
|
10614
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10721
|
+
}), { concurrency: READ_CONCURRENCY$12 });
|
|
10615
10722
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10616
10723
|
return [...Array.flatten(found), ...actions];
|
|
10617
10724
|
});
|
|
@@ -10631,12 +10738,12 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10631
10738
|
return Array.flatten(found);
|
|
10632
10739
|
});
|
|
10633
10740
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
10634
|
-
const RULE$
|
|
10741
|
+
const RULE$32 = "legacy-typescript";
|
|
10635
10742
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
10636
10743
|
const COMPILER = "typescript";
|
|
10637
10744
|
const CURRENT_MAJOR = 7;
|
|
10638
10745
|
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
10639
|
-
const FIRST$
|
|
10746
|
+
const FIRST$7 = 1;
|
|
10640
10747
|
const legacyOf = (id) => {
|
|
10641
10748
|
const { name, version } = parse$1(id);
|
|
10642
10749
|
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
@@ -10647,8 +10754,8 @@ const legacyOf = (id) => {
|
|
|
10647
10754
|
};
|
|
10648
10755
|
const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
|
|
10649
10756
|
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
10650
|
-
onNone: () => FIRST$
|
|
10651
|
-
onSome: (index) => index + FIRST$
|
|
10757
|
+
onNone: () => FIRST$7,
|
|
10758
|
+
onSome: (index) => index + FIRST$7
|
|
10652
10759
|
}));
|
|
10653
10760
|
const messageOf$2 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array.join(dependents, ", ")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;
|
|
10654
10761
|
/** @internal */
|
|
@@ -10661,8 +10768,8 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
10661
10768
|
return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
|
|
10662
10769
|
file,
|
|
10663
10770
|
line: lineOf$2(source)(legacy.id),
|
|
10664
|
-
column: FIRST$
|
|
10665
|
-
rule: RULE$
|
|
10771
|
+
column: FIRST$7,
|
|
10772
|
+
rule: RULE$32,
|
|
10666
10773
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
10667
10774
|
})));
|
|
10668
10775
|
});
|
|
@@ -10671,7 +10778,7 @@ const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
|
10671
10778
|
const SUBPATH_IMPORT = "#";
|
|
10672
10779
|
const WILDCARD$1 = "*";
|
|
10673
10780
|
const SCOPE$2 = "@";
|
|
10674
|
-
const SEPARATOR$
|
|
10781
|
+
const SEPARATOR$8 = "/";
|
|
10675
10782
|
const SOURCE_SUFFIXES = [
|
|
10676
10783
|
"",
|
|
10677
10784
|
".ts",
|
|
@@ -10683,9 +10790,9 @@ const PLAIN_SEGMENTS = 1;
|
|
|
10683
10790
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
10684
10791
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
10685
10792
|
const packageNameOf = (specifier) => {
|
|
10686
|
-
const segments = String$1.split(specifier, SEPARATOR$
|
|
10687
|
-
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$
|
|
10688
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$
|
|
10793
|
+
const segments = String$1.split(specifier, SEPARATOR$8);
|
|
10794
|
+
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$8));
|
|
10795
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$8));
|
|
10689
10796
|
};
|
|
10690
10797
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
10691
10798
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -10780,7 +10887,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
10780
10887
|
peerDependencies: DependencyMap,
|
|
10781
10888
|
peerDependenciesMeta: PeerMeta
|
|
10782
10889
|
});
|
|
10783
|
-
const decodeManifest$
|
|
10890
|
+
const decodeManifest$7 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
10784
10891
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
10785
10892
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
10786
10893
|
const installedNames = (manifest) => [
|
|
@@ -10791,7 +10898,7 @@ const installedNames = (manifest) => [
|
|
|
10791
10898
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
10792
10899
|
const files = yield* RepositoryFiles;
|
|
10793
10900
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
10794
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10901
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
10795
10902
|
});
|
|
10796
10903
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
10797
10904
|
const files = yield* RepositoryFiles;
|
|
@@ -10853,11 +10960,11 @@ const LISTED_LARGEST = 5;
|
|
|
10853
10960
|
const SIZE_CONCURRENCY = 32;
|
|
10854
10961
|
const MEGABYTE = 1e6;
|
|
10855
10962
|
const MEGABYTE_DIGITS = 1;
|
|
10856
|
-
const START$
|
|
10963
|
+
const START$18 = 0;
|
|
10857
10964
|
const SINGLE_ENTRY = 1;
|
|
10858
10965
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
10859
10966
|
const usageHint = (dependency, entryCount) => {
|
|
10860
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
10967
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$18 && dependency.entries.length < entryCount)) return "";
|
|
10861
10968
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
10862
10969
|
};
|
|
10863
10970
|
const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -10866,7 +10973,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
10866
10973
|
const { workspace, total } = overrun;
|
|
10867
10974
|
const config = yield* files.readFile(workspace.configFile);
|
|
10868
10975
|
const source = Option.getOrElse(config, () => "");
|
|
10869
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
10976
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$18);
|
|
10870
10977
|
return {
|
|
10871
10978
|
file: workspace.configFile,
|
|
10872
10979
|
...positionOf(source)(index),
|
|
@@ -10883,7 +10990,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
10883
10990
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
10884
10991
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
10885
10992
|
const sizes = HashMap.fromIterable(measured);
|
|
10886
|
-
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
10993
|
+
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$18))));
|
|
10887
10994
|
return {
|
|
10888
10995
|
closures,
|
|
10889
10996
|
sizeOf,
|
|
@@ -10916,11 +11023,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
10916
11023
|
})];
|
|
10917
11024
|
});
|
|
10918
11025
|
const stackProblems = (file, source, dependencies) => {
|
|
10919
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$
|
|
11026
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$18);
|
|
10920
11027
|
const rest = String$1.slice(section)(source);
|
|
10921
11028
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
10922
11029
|
file,
|
|
10923
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11030
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$18)),
|
|
10924
11031
|
rule: STACK_DEPENDENCY,
|
|
10925
11032
|
message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
|
|
10926
11033
|
})));
|
|
@@ -11036,11 +11143,11 @@ const isDefinition = (node) => {
|
|
|
11036
11143
|
return isModuleConstant(node);
|
|
11037
11144
|
};
|
|
11038
11145
|
const isTyped = (checker) => (node) => Option.fromUndefinedOr(checker.getContextualType(node)).pipe(Option.flatMap(finiteValuesOf(checker)), Option.isSome);
|
|
11039
|
-
const specifierOf = (statement) => {
|
|
11146
|
+
const specifierOf$1 = (statement) => {
|
|
11040
11147
|
if (!isImportDeclaration(statement) && !isExportDeclaration(statement)) return Option.none();
|
|
11041
11148
|
return Option.fromUndefinedOr(statement.moduleSpecifier).pipe(Option.filter(isStringLiteral));
|
|
11042
11149
|
};
|
|
11043
|
-
const importedFilesOf = (checker) => (sourceFile) => pipe(sourceFile.statements, Array.map(specifierOf), Array.getSomes, Array.flatMap((specifier) => pipe(Option.fromUndefinedOr(checker.getSymbolAtLocation(specifier)), Option.flatMap((symbol) => Array.head(declarationsOf(symbol))), Option.map((declaration) => declaration.getSourceFile().fileName), Option.toArray)), Array.dedupe);
|
|
11150
|
+
const importedFilesOf = (checker) => (sourceFile) => pipe(sourceFile.statements, Array.map(specifierOf$1), Array.getSomes, Array.flatMap((specifier) => pipe(Option.fromUndefinedOr(checker.getSymbolAtLocation(specifier)), Option.flatMap((symbol) => Array.head(declarationsOf(symbol))), Option.map((declaration) => declaration.getSourceFile().fileName), Option.toArray)), Array.dedupe);
|
|
11044
11151
|
const freeLiteralsIn = (checker) => (sourceFile, excluded) => pipe(descendantsOf(sourceFile), Array.filter((node) => isStringLiteral(node)), Array.filter((node) => NAME.test(node.text)), Array.filter(isDefinition), Array.filter((node) => !isModuleSpecifier(node)), Array.filter((node) => !isInsideAny(excluded)(node) && !isTyped(checker)(node)), Array.map((node) => node.text), Array.dedupe);
|
|
11045
11152
|
const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Array.map((sourceFile) => ({
|
|
11046
11153
|
file: sourceFile.fileName,
|
|
@@ -11079,7 +11186,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
11079
11186
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
11080
11187
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
11081
11188
|
};
|
|
11082
|
-
const annotationProblem = (message) => problemAt$
|
|
11189
|
+
const annotationProblem = (message) => problemAt$8({
|
|
11083
11190
|
rule: "owner-annotation",
|
|
11084
11191
|
message
|
|
11085
11192
|
});
|
|
@@ -11216,7 +11323,7 @@ const shapeProblem = (site, matches) => {
|
|
|
11216
11323
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
11217
11324
|
onSome: () => "Use the library type instead of copying it."
|
|
11218
11325
|
});
|
|
11219
|
-
return problemAt$
|
|
11326
|
+
return problemAt$8({
|
|
11220
11327
|
rule: "library-shape",
|
|
11221
11328
|
message: `This shape copies ${shown}. ${advice}`
|
|
11222
11329
|
})(site.node);
|
|
@@ -11321,7 +11428,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
11321
11428
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
11322
11429
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
11323
11430
|
const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;
|
|
11324
|
-
return verdict([problemAt$
|
|
11431
|
+
return verdict([problemAt$8({
|
|
11325
11432
|
rule: "owner-extension",
|
|
11326
11433
|
message
|
|
11327
11434
|
})(site.node)], []);
|
|
@@ -11343,7 +11450,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
11343
11450
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
11344
11451
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
11345
11452
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
11346
|
-
return verdict([problemAt$
|
|
11453
|
+
return verdict([problemAt$8({
|
|
11347
11454
|
rule: "owner-value-set",
|
|
11348
11455
|
message
|
|
11349
11456
|
})(site.node)], []);
|
|
@@ -11351,7 +11458,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
11351
11458
|
const candidates = libraryCandidates(context)(site);
|
|
11352
11459
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
11353
11460
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
11354
|
-
return verdict([problemAt$
|
|
11461
|
+
return verdict([problemAt$8({
|
|
11355
11462
|
rule: "library-value-set",
|
|
11356
11463
|
message
|
|
11357
11464
|
})(site.node)], []);
|
|
@@ -11382,7 +11489,7 @@ const isValuePosition = (node) => {
|
|
|
11382
11489
|
const { parent } = node;
|
|
11383
11490
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
11384
11491
|
};
|
|
11385
|
-
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$
|
|
11492
|
+
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array.map(String)))))), Option.filter((owners) => Array.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$8({
|
|
11386
11493
|
rule: "owned-literal",
|
|
11387
11494
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
11388
11495
|
})(literal)));
|
|
@@ -11576,7 +11683,7 @@ const duplicateProblems = (relative) => (sites) => {
|
|
|
11576
11683
|
}))));
|
|
11577
11684
|
};
|
|
11578
11685
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11579
|
-
const RULE$
|
|
11686
|
+
const RULE$31 = "hand-written-names";
|
|
11580
11687
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11581
11688
|
const nameListOf = (site) => {
|
|
11582
11689
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11591,7 +11698,7 @@ const problemOf$6 = ({ list, reason }) => ({
|
|
|
11591
11698
|
file: list.site.file,
|
|
11592
11699
|
line: list.site.line,
|
|
11593
11700
|
column: list.site.column,
|
|
11594
|
-
rule: RULE$
|
|
11701
|
+
rule: RULE$31,
|
|
11595
11702
|
message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
|
|
11596
11703
|
});
|
|
11597
11704
|
// src/features/check-value-owners/model/declared-names.ts
|
|
@@ -11632,8 +11739,8 @@ const declaredNameProblem = ({ literals, relative }) => {
|
|
|
11632
11739
|
const PATH_PREFIX = /^(?:!|\.\/)+/u;
|
|
11633
11740
|
const GLOB = /[*?{[]/u;
|
|
11634
11741
|
const EXTENSION$1 = /\.[^./]+$/u;
|
|
11635
|
-
const SEPARATOR$
|
|
11636
|
-
const ROOT = ".";
|
|
11742
|
+
const SEPARATOR$7 = "/";
|
|
11743
|
+
const ROOT$1 = ".";
|
|
11637
11744
|
const namedPath = (repository, file) => (name) => {
|
|
11638
11745
|
const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
|
|
11639
11746
|
if (GLOB.test(bare) || String$1.isEmpty(bare)) return Option.none();
|
|
@@ -11641,14 +11748,14 @@ const namedPath = (repository, file) => (name) => {
|
|
|
11641
11748
|
return pipe([fromFile, bare], Array.findFirst((path) => HashSet.has(repository.paths, path)));
|
|
11642
11749
|
};
|
|
11643
11750
|
const kindOf = (repository) => (path) => {
|
|
11644
|
-
if (HashSet.has(repository.directories, path)) return SEPARATOR$
|
|
11751
|
+
if (HashSet.has(repository.directories, path)) return SEPARATOR$7;
|
|
11645
11752
|
return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array.head), Option.getOrElse(() => path));
|
|
11646
11753
|
};
|
|
11647
11754
|
const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
|
|
11648
11755
|
const coversDirectory = (repository) => (group) => pipe(Array.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
|
|
11649
|
-
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$
|
|
11756
|
+
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$7}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
|
|
11650
11757
|
const directoryLabel = (directory) => {
|
|
11651
|
-
if (directory === ROOT) return "the repository root";
|
|
11758
|
+
if (directory === ROOT$1) return "the repository root";
|
|
11652
11759
|
return directory;
|
|
11653
11760
|
};
|
|
11654
11761
|
const listedPathProblem = (repository) => (list) => {
|
|
@@ -11697,16 +11804,16 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
|
|
|
11697
11804
|
};
|
|
11698
11805
|
// src/features/check-value-owners/model/repository-names.ts
|
|
11699
11806
|
const MANIFEST$2 = "package.json";
|
|
11700
|
-
const SEPARATOR$
|
|
11807
|
+
const SEPARATOR$6 = "/";
|
|
11701
11808
|
const FIRST_SEGMENT = 1;
|
|
11702
11809
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
11703
|
-
const decodeManifest$
|
|
11810
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(ManifestJson);
|
|
11704
11811
|
const prefixesOf = (file) => {
|
|
11705
|
-
const segments = pipe(file, String$1.split(SEPARATOR$
|
|
11706
|
-
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$
|
|
11812
|
+
const segments = pipe(file, String$1.split(SEPARATOR$6));
|
|
11813
|
+
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$6))));
|
|
11707
11814
|
};
|
|
11708
11815
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
11709
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
11816
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
11710
11817
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
11711
11818
|
const files = yield* RepositoryFiles;
|
|
11712
11819
|
const listed = yield* files.listedFiles(root);
|
|
@@ -11729,7 +11836,7 @@ const scanOwners = Effect.fn("scanOwners")(function* scanOwners(workspace, confi
|
|
|
11729
11836
|
const scans = yield* Effect.forEach(ownerConfigs, (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))), { concurrency: 1 });
|
|
11730
11837
|
return combineOwnerScans(Array.getSomes(scans));
|
|
11731
11838
|
});
|
|
11732
|
-
const scopeOf = (project, configPath) => ({
|
|
11839
|
+
const scopeOf$1 = (project, configPath) => ({
|
|
11733
11840
|
name: Option.getOrElse(project.packageName, () => configPath),
|
|
11734
11841
|
dependencies: project.workspaceDependencies
|
|
11735
11842
|
});
|
|
@@ -11738,7 +11845,7 @@ const freshAnalysis = ({ workspace, owners, sourceChecks }) => (configPath) => w
|
|
|
11738
11845
|
owners,
|
|
11739
11846
|
sourceChecks
|
|
11740
11847
|
})(project);
|
|
11741
|
-
const scope = scopeOf(project, configPath);
|
|
11848
|
+
const scope = scopeOf$1(project, configPath);
|
|
11742
11849
|
return {
|
|
11743
11850
|
problems: analysis.problems,
|
|
11744
11851
|
unowned: pipe(analysis.unowned, Array.map(unownedSiteOf(scope))),
|
|
@@ -11818,7 +11925,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
11818
11925
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
11819
11926
|
}, Effect.scoped);
|
|
11820
11927
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
11821
|
-
const RULE$
|
|
11928
|
+
const RULE$30 = "namespace-destructuring";
|
|
11822
11929
|
const LOCAL = /^[.#/]/u;
|
|
11823
11930
|
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.`;
|
|
11824
11931
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -11833,8 +11940,8 @@ const destructuredName = (declaration) => {
|
|
|
11833
11940
|
if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
|
|
11834
11941
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
11835
11942
|
};
|
|
11836
|
-
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$
|
|
11837
|
-
rule: RULE$
|
|
11943
|
+
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$8({
|
|
11944
|
+
rule: RULE$30,
|
|
11838
11945
|
message: messageOf$1(name)
|
|
11839
11946
|
})), Option.map((report) => report(declaration)));
|
|
11840
11947
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -11842,7 +11949,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
11842
11949
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
11843
11950
|
};
|
|
11844
11951
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
11845
|
-
const RULE$
|
|
11952
|
+
const RULE$29 = "pass-through-wrapper";
|
|
11846
11953
|
const SINGLE_STATEMENT = 1;
|
|
11847
11954
|
const SINGLE_DECLARATION = 1;
|
|
11848
11955
|
const THIS_PARAMETER = "this";
|
|
@@ -11938,8 +12045,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
11938
12045
|
};
|
|
11939
12046
|
const problemOf$4 = (checker) => (candidate) => {
|
|
11940
12047
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
11941
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
11942
|
-
rule: RULE$
|
|
12048
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$8({
|
|
12049
|
+
rule: RULE$29,
|
|
11943
12050
|
message: messageOf(forward.callee.getText())
|
|
11944
12051
|
})(candidate.name)));
|
|
11945
12052
|
};
|
|
@@ -11971,9 +12078,8 @@ var repository = {
|
|
|
11971
12078
|
"directory": "libs/msch"
|
|
11972
12079
|
};
|
|
11973
12080
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
11974
|
-
const RULE$
|
|
12081
|
+
const RULE$28 = "known-plugins";
|
|
11975
12082
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
11976
|
-
const FIRST$10 = 1;
|
|
11977
12083
|
const GITHUB$2 = "github";
|
|
11978
12084
|
const REPOSITORY = /github\.com\/(?<repository>[\w.-]+\/[\w.-]+?)(?:\.git)?$/u;
|
|
11979
12085
|
const Source$1 = Schema.Struct({
|
|
@@ -11992,13 +12098,7 @@ const repositoryOf = (url) => pipe(String$1.match(REPOSITORY)(url), Option.flatM
|
|
|
11992
12098
|
const REPOSITORY_NAME = repositoryOf(repository.url);
|
|
11993
12099
|
const MARKETPLACE = name;
|
|
11994
12100
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
11995
|
-
const problem$1 = (
|
|
11996
|
-
file,
|
|
11997
|
-
line: FIRST$10,
|
|
11998
|
-
column: FIRST$10,
|
|
11999
|
-
rule: RULE$25,
|
|
12000
|
-
message
|
|
12001
|
-
});
|
|
12101
|
+
const problem$1 = problemInFile(RULE$28);
|
|
12002
12102
|
const fromGithub = ({ source }) => source.source === GITHUB$2 && source.repo === REPOSITORY_NAME;
|
|
12003
12103
|
const marketplaceKnown = (settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(MARKETPLACE)), Option.exists(fromGithub));
|
|
12004
12104
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
@@ -12019,20 +12119,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
12019
12119
|
return [...marketplaceProblems(file, settings), ...pluginProblems(file, settings)];
|
|
12020
12120
|
});
|
|
12021
12121
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12022
|
-
const RULE$
|
|
12122
|
+
const RULE$27 = "missing-hook";
|
|
12023
12123
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12024
12124
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12025
12125
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12026
12126
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12027
12127
|
const PLUGIN_ROOT = "..";
|
|
12028
|
-
const READ_CONCURRENCY$
|
|
12029
|
-
const START$
|
|
12128
|
+
const READ_CONCURRENCY$11 = 16;
|
|
12129
|
+
const START$17 = 0;
|
|
12030
12130
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12031
12131
|
path,
|
|
12032
|
-
index: found.index ?? START$
|
|
12132
|
+
index: found.index ?? START$17
|
|
12033
12133
|
})), Option.toArray);
|
|
12034
12134
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12035
|
-
const problemsIn$
|
|
12135
|
+
const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12036
12136
|
const files = yield* RepositoryFiles;
|
|
12037
12137
|
const text = yield* files.readFile(file);
|
|
12038
12138
|
if (Option.isNone(text)) return [];
|
|
@@ -12044,7 +12144,7 @@ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12044
12144
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12045
12145
|
file,
|
|
12046
12146
|
...positionOf(source)(index),
|
|
12047
|
-
rule: RULE$
|
|
12147
|
+
rule: RULE$27,
|
|
12048
12148
|
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.`
|
|
12049
12149
|
})));
|
|
12050
12150
|
});
|
|
@@ -12068,14 +12168,194 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12068
12168
|
}];
|
|
12069
12169
|
return [];
|
|
12070
12170
|
}));
|
|
12071
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12171
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$11, { concurrency: READ_CONCURRENCY$11 });
|
|
12072
12172
|
return Array.flatten(found);
|
|
12073
12173
|
});
|
|
12174
|
+
// src/features/check-documented-commands/model/task-graph.ts
|
|
12175
|
+
const SUCCESS = 0;
|
|
12176
|
+
const PackageSchema = Schema.Struct({ name: Schema.optional(Schema.String) });
|
|
12177
|
+
const TaskSchema = Schema.Struct({
|
|
12178
|
+
package: Schema.String,
|
|
12179
|
+
name: Schema.String
|
|
12180
|
+
});
|
|
12181
|
+
const TaskGraphSchema = Schema.Struct({
|
|
12182
|
+
packages: Schema.Record(Schema.String, PackageSchema),
|
|
12183
|
+
tasks: Schema.Record(Schema.String, TaskSchema)
|
|
12184
|
+
});
|
|
12185
|
+
const decodeGraph = Schema.decodeUnknownOption(Schema.fromJsonString(TaskGraphSchema));
|
|
12186
|
+
/** @internal */
|
|
12187
|
+
const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
12188
|
+
const handle = yield* ChildProcess.make("vp", ["run", "--json"], {
|
|
12189
|
+
cwd: root,
|
|
12190
|
+
extendEnv: true,
|
|
12191
|
+
stdin: "ignore",
|
|
12192
|
+
stderr: "ignore"
|
|
12193
|
+
});
|
|
12194
|
+
const text = yield* handle.stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
12195
|
+
const code = yield* handle.exitCode;
|
|
12196
|
+
return pipe(Option.liftPredicate(text, () => Number(code) === SUCCESS), Option.flatMap(decodeGraph));
|
|
12197
|
+
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
12198
|
+
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
12199
|
+
// src/features/check-documented-commands/model/commands.ts
|
|
12200
|
+
const RULE$26 = "documented-commands";
|
|
12201
|
+
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
12202
|
+
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
12203
|
+
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
12204
|
+
const COMMAND_START = "`vp run ";
|
|
12205
|
+
const ARGS = "args";
|
|
12206
|
+
const PLACEHOLDER = /[<>*{}$]/u;
|
|
12207
|
+
const WHITESPACE = /\s+/u;
|
|
12208
|
+
const ROOT = ".";
|
|
12209
|
+
const SEPARATOR$5 = "/";
|
|
12210
|
+
const END_OF_OPTIONS = "--";
|
|
12211
|
+
const FLAG = "-";
|
|
12212
|
+
const TASK_SEPARATOR$1 = "#";
|
|
12213
|
+
const LOCAL_PREFIX$1 = "./";
|
|
12214
|
+
const FILTER_FLAGS = /* @__PURE__ */ new Set(["--filter", "-F"]);
|
|
12215
|
+
const FILTER_ASSIGNMENT = "--filter=";
|
|
12216
|
+
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
12217
|
+
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
12218
|
+
const ONE$1 = 1;
|
|
12219
|
+
const START$16 = 0;
|
|
12220
|
+
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
12221
|
+
const filterOf = (tokens) => pipe(tokens, Array.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
12222
|
+
const follows = (tokens) => (index) => pipe(Array.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
12223
|
+
const specifierOf = (tokens) => pipe(tokens, Array.findFirstIndex((token, index) => !String$1.startsWith(FLAG)(token) && !follows(tokens)(index)), Option.flatMap((index) => Array.get(tokens, index)));
|
|
12224
|
+
const hasAny = (flags) => (tokens) => pipe(tokens, Array.some((token) => flags.has(token)));
|
|
12225
|
+
const scopeOf = (tokens) => {
|
|
12226
|
+
const filter = filterOf(tokens);
|
|
12227
|
+
if (Option.isSome(filter)) return {
|
|
12228
|
+
kind: "package",
|
|
12229
|
+
name: filter.value
|
|
12230
|
+
};
|
|
12231
|
+
if (hasAny(RECURSIVE_FLAGS)(tokens)) return { kind: "anywhere" };
|
|
12232
|
+
if (hasAny(ROOT_FLAGS)(tokens)) return { kind: "root" };
|
|
12233
|
+
return { kind: "here" };
|
|
12234
|
+
};
|
|
12235
|
+
const invocationOf = (tokens) => (specifier) => {
|
|
12236
|
+
const [owner, ...rest] = String$1.split(specifier, TASK_SEPARATOR$1);
|
|
12237
|
+
return pipe(Array.head(rest), Option.match({
|
|
12238
|
+
onNone: () => ({
|
|
12239
|
+
task: specifier,
|
|
12240
|
+
scope: scopeOf(tokens)
|
|
12241
|
+
}),
|
|
12242
|
+
onSome: (task) => ({
|
|
12243
|
+
task,
|
|
12244
|
+
scope: {
|
|
12245
|
+
kind: "package",
|
|
12246
|
+
name: owner
|
|
12247
|
+
}
|
|
12248
|
+
})
|
|
12249
|
+
}));
|
|
12250
|
+
};
|
|
12251
|
+
const parsed = (args) => {
|
|
12252
|
+
const tokens = optionsOf(args);
|
|
12253
|
+
return pipe(specifierOf(tokens), Option.filter(() => !pipe(tokens, Array.some((token) => PLACEHOLDER.test(token)))), Option.map(invocationOf(tokens)));
|
|
12254
|
+
};
|
|
12255
|
+
const ancestorsOf$1 = (file) => {
|
|
12256
|
+
const parts = pipe(String$1.split(file, SEPARATOR$5), Array.dropRight(ONE$1));
|
|
12257
|
+
return [...Array.makeBy(parts.length, (index) => pipe(parts, Array.take(parts.length - index), Array.join(SEPARATOR$5))), ROOT];
|
|
12258
|
+
};
|
|
12259
|
+
const named = (graph, name) => (directory) => directory === String$1.replace(LOCAL_PREFIX$1, "")(name) || pipe(Record.get(graph.packages, directory), Option.exists((found) => found.name === name));
|
|
12260
|
+
const packagesOf = (graph, file) => (scope) => {
|
|
12261
|
+
const directories = Record.keys(graph.packages);
|
|
12262
|
+
if (scope.kind === "anywhere") return directories;
|
|
12263
|
+
if (scope.kind === "root") return [ROOT];
|
|
12264
|
+
if (scope.kind === "package") return pipe(directories, Array.filter(named(graph, scope.name)));
|
|
12265
|
+
return pipe(ancestorsOf$1(file), Array.findFirst((directory) => Record.has(graph.packages, directory)), Option.toArray);
|
|
12266
|
+
};
|
|
12267
|
+
const hasTask = (graph, task) => (directory) => pipe(Record.values(graph.tasks), Array.some((found) => found.package === directory && found.name === task));
|
|
12268
|
+
const whereOf = (scope, file) => {
|
|
12269
|
+
if (scope.kind === "anywhere") return "any package";
|
|
12270
|
+
if (scope.kind === "root") return "the workspace root";
|
|
12271
|
+
if (scope.kind === "package") return `package ${scope.name}`;
|
|
12272
|
+
return `the package that holds ${file}`;
|
|
12273
|
+
};
|
|
12274
|
+
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array.some(hasTask(graph, task)));
|
|
12275
|
+
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 }) => ({
|
|
12276
|
+
file: absolute(file),
|
|
12277
|
+
...positionOf(text)(match.index ?? START$16),
|
|
12278
|
+
rule: RULE$26,
|
|
12279
|
+
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12280
|
+
})), Option.toArray)));
|
|
12281
|
+
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$5), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12282
|
+
/** @internal */
|
|
12283
|
+
const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* checkDocumentedCommands(root) {
|
|
12284
|
+
const files = yield* RepositoryFiles;
|
|
12285
|
+
const listed = yield* files.trackedFiles(root, DOCUMENTS);
|
|
12286
|
+
const documents = yield* Effect.forEach(pipe(listed, Array.filter(isDocument)), (file) => files.readFile(files.join(root, file)).pipe(Effect.map(Option.map((text) => ({
|
|
12287
|
+
file,
|
|
12288
|
+
text
|
|
12289
|
+
})))), { concurrency: "unbounded" });
|
|
12290
|
+
const commanded = pipe(Array.getSomes(documents), Array.filter(({ text }) => String$1.includes(COMMAND_START)(text)));
|
|
12291
|
+
if (!Array.isReadonlyArrayNonEmpty(commanded)) return [];
|
|
12292
|
+
const given = yield* GivenTaskGraph;
|
|
12293
|
+
const graph = yield* Option.match(given, {
|
|
12294
|
+
onNone: () => listedTasks(root),
|
|
12295
|
+
onSome: Effect.succeedSome
|
|
12296
|
+
});
|
|
12297
|
+
const absolute = (file) => files.join(root, file);
|
|
12298
|
+
return Option.match(graph, {
|
|
12299
|
+
onNone: () => [{
|
|
12300
|
+
file: absolute(Array.headNonEmpty(commanded).file),
|
|
12301
|
+
line: ONE$1,
|
|
12302
|
+
column: ONE$1,
|
|
12303
|
+
rule: RULE$26,
|
|
12304
|
+
message: "msch could not list the tasks with `vp run --json`"
|
|
12305
|
+
}],
|
|
12306
|
+
onSome: (found) => pipe(commanded, Array.flatMap((document) => problemsIn$10(found, absolute, document)))
|
|
12307
|
+
});
|
|
12308
|
+
});
|
|
12309
|
+
// src/features/check-legacy-web/model/legacy-web.ts
|
|
12310
|
+
const RULE$25 = "legacy-web";
|
|
12311
|
+
const FIRST_COLUMN$3 = 1;
|
|
12312
|
+
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
12313
|
+
const Finding = Schema.Struct({
|
|
12314
|
+
file: Schema.String,
|
|
12315
|
+
line: Schema.Int,
|
|
12316
|
+
message: Schema.String
|
|
12317
|
+
});
|
|
12318
|
+
const Rule = Schema.Struct({
|
|
12319
|
+
ruleId: Schema.String,
|
|
12320
|
+
findings: Schema.Array(Finding)
|
|
12321
|
+
});
|
|
12322
|
+
const Guide = Schema.Struct({
|
|
12323
|
+
guideId: Schema.String,
|
|
12324
|
+
rules: Schema.Array(Rule)
|
|
12325
|
+
});
|
|
12326
|
+
const Scan = Schema.fromJsonString(Schema.Struct({ guides: Schema.Array(Guide) }));
|
|
12327
|
+
const scanOutput = Effect.fn("scanOutput")(function* scanOutput(root) {
|
|
12328
|
+
return yield* (yield* ChildProcess.make("node", [
|
|
12329
|
+
SCANNER,
|
|
12330
|
+
"legacy-scan",
|
|
12331
|
+
".",
|
|
12332
|
+
"--json"
|
|
12333
|
+
], {
|
|
12334
|
+
cwd: root,
|
|
12335
|
+
extendEnv: true,
|
|
12336
|
+
env: { DISABLE_TELEMETRY: "1" },
|
|
12337
|
+
stdin: "ignore"
|
|
12338
|
+
})).stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
12339
|
+
}, Effect.scoped);
|
|
12340
|
+
/** @internal */
|
|
12341
|
+
const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root) {
|
|
12342
|
+
const files = yield* RepositoryFiles;
|
|
12343
|
+
const output = yield* scanOutput(root).pipe(Effect.orDie);
|
|
12344
|
+
const scan = yield* Schema.decodeEffect(Scan)(output).pipe(Effect.orDie);
|
|
12345
|
+
const problemOf = (guideId, ruleId) => ({ file, line, message }) => ({
|
|
12346
|
+
file: files.join(root, file),
|
|
12347
|
+
line,
|
|
12348
|
+
column: FIRST_COLUMN$3,
|
|
12349
|
+
rule: RULE$25,
|
|
12350
|
+
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
12351
|
+
});
|
|
12352
|
+
return pipe(scan.guides, Array.flatMap(({ guideId, rules }) => pipe(rules, Array.flatMap(({ ruleId, findings }) => pipe(findings, Array.map(problemOf(guideId, ruleId)))))));
|
|
12353
|
+
});
|
|
12074
12354
|
// src/shared/lib/section-check.ts
|
|
12075
|
-
const taggedError$
|
|
12076
|
-
var SectionConfigUnreadable = class extends taggedError$
|
|
12077
|
-
const CONFIG_FILE$
|
|
12078
|
-
const FIRST$
|
|
12355
|
+
const taggedError$4 = Schema.TaggedError;
|
|
12356
|
+
var SectionConfigUnreadable = class extends taggedError$4()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
12357
|
+
const CONFIG_FILE$3 = "vite.config.ts";
|
|
12358
|
+
const FIRST$6 = 1;
|
|
12079
12359
|
const ONE = 1;
|
|
12080
12360
|
const diagnostics = Metric.counter("lint.diagnostics", { description: "Diagnostics that each lint rule reported, before msch keeps only the errors" });
|
|
12081
12361
|
const countDiagnostics = (check, found) => Effect.forEach(found, (diagnostic) => Metric.update(Metric.withAttributes(diagnostics, {
|
|
@@ -12094,16 +12374,9 @@ const sectionAt = (file, pick) => Effect.gen(function* readSection() {
|
|
|
12094
12374
|
}).pipe(Effect.option);
|
|
12095
12375
|
return pipe(config, Option.map(pick));
|
|
12096
12376
|
});
|
|
12097
|
-
const failureAt = (file, rule, message) => [{
|
|
12098
|
-
file,
|
|
12099
|
-
line: FIRST$9,
|
|
12100
|
-
column: FIRST$9,
|
|
12101
|
-
rule,
|
|
12102
|
-
message
|
|
12103
|
-
}];
|
|
12104
12377
|
const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
12105
12378
|
const files = yield* RepositoryFiles;
|
|
12106
|
-
const configFile = files.join(root, CONFIG_FILE$
|
|
12379
|
+
const configFile = files.join(root, CONFIG_FILE$3);
|
|
12107
12380
|
const section = yield* sectionAt(configFile, check.pick);
|
|
12108
12381
|
if (Option.isNone(section)) return [];
|
|
12109
12382
|
const config = section.value;
|
|
@@ -12119,11 +12392,11 @@ const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
|
12119
12392
|
onSuccess: (found) => countDiagnostics(check.name, found)
|
|
12120
12393
|
});
|
|
12121
12394
|
return Result.match(linted, {
|
|
12122
|
-
onFailure: (failure) =>
|
|
12395
|
+
onFailure: (failure) => [problemInFile(check.rule)(configFile, failure.message)],
|
|
12123
12396
|
onSuccess: (found) => pipe(found, Array.filter(({ severity }) => severity === "error"), Array.map((diagnostic) => ({
|
|
12124
12397
|
file: files.join(root, diagnostic.path),
|
|
12125
12398
|
line: diagnostic.line,
|
|
12126
|
-
column: diagnostic.column ?? FIRST$
|
|
12399
|
+
column: diagnostic.column ?? FIRST$6,
|
|
12127
12400
|
rule: check.rule,
|
|
12128
12401
|
message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`
|
|
12129
12402
|
})))
|
|
@@ -12143,9 +12416,8 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
12143
12416
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
12144
12417
|
const EXTENSION = /\.[^./]+$/u;
|
|
12145
12418
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
12146
|
-
const READ_CONCURRENCY$
|
|
12147
|
-
const
|
|
12148
|
-
const RULE$23 = "shell-script";
|
|
12419
|
+
const READ_CONCURRENCY$10 = 64;
|
|
12420
|
+
const RULE$24 = "shell-script";
|
|
12149
12421
|
const MESSAGE$10 = "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.";
|
|
12150
12422
|
const HookSchema = Schema.Struct({
|
|
12151
12423
|
command: Schema.optional(Schema.String),
|
|
@@ -12164,13 +12436,6 @@ const sessionStartCommands = (source) => {
|
|
|
12164
12436
|
};
|
|
12165
12437
|
const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.getOrElse(() => name));
|
|
12166
12438
|
const hasExtension = (name) => EXTENSION.test(baseName(name));
|
|
12167
|
-
const problemFor$1 = (file) => ({
|
|
12168
|
-
file,
|
|
12169
|
-
line: FIRST$8,
|
|
12170
|
-
column: FIRST$8,
|
|
12171
|
-
rule: RULE$23,
|
|
12172
|
-
message: MESSAGE$10
|
|
12173
|
-
});
|
|
12174
12439
|
/** @internal */
|
|
12175
12440
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
12176
12441
|
const files = yield* RepositoryFiles;
|
|
@@ -12185,12 +12450,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
12185
12450
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
12186
12451
|
};
|
|
12187
12452
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
12188
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
12189
|
-
return pipe(shell, Array.map((name) =>
|
|
12453
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$10 });
|
|
12454
|
+
return pipe(shell, Array.map((name) => problemInFile(RULE$24)(files.join(root, name), MESSAGE$10)));
|
|
12190
12455
|
});
|
|
12191
12456
|
// src/shared/lib/workflow-files.ts
|
|
12192
12457
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
12193
|
-
const READ_CONCURRENCY$
|
|
12458
|
+
const READ_CONCURRENCY$9 = 16;
|
|
12194
12459
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
12195
12460
|
const files = yield* RepositoryFiles;
|
|
12196
12461
|
const names = yield* files.listedFiles(root);
|
|
@@ -12200,13 +12465,13 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
12200
12465
|
file,
|
|
12201
12466
|
source
|
|
12202
12467
|
}))));
|
|
12203
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
12468
|
+
}, { concurrency: READ_CONCURRENCY$9 });
|
|
12204
12469
|
return Array.getSomes(found);
|
|
12205
12470
|
});
|
|
12206
12471
|
// src/shared/lib/workflow-run.ts
|
|
12207
12472
|
const RUN_KEY = "run";
|
|
12208
|
-
const START$
|
|
12209
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
12473
|
+
const START$15 = 0;
|
|
12474
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$15));
|
|
12210
12475
|
const runScriptsOf = (source) => {
|
|
12211
12476
|
const found = [];
|
|
12212
12477
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -12221,7 +12486,7 @@ const runScriptsOf = (source) => {
|
|
|
12221
12486
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
12222
12487
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12223
12488
|
const COMMENT = "#";
|
|
12224
|
-
const RULE$
|
|
12489
|
+
const RULE$23 = "workflow-script";
|
|
12225
12490
|
const ONE_COMMAND = 1;
|
|
12226
12491
|
const MESSAGE$9 = "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.";
|
|
12227
12492
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -12230,19 +12495,19 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
12230
12495
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
12231
12496
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
12232
12497
|
};
|
|
12233
|
-
const problemsIn$
|
|
12498
|
+
const problemsIn$9 = (file) => (source) => {
|
|
12234
12499
|
const at = positionOf(source);
|
|
12235
12500
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
12236
12501
|
file,
|
|
12237
12502
|
...at(start),
|
|
12238
|
-
rule: RULE$
|
|
12503
|
+
rule: RULE$23,
|
|
12239
12504
|
message: MESSAGE$9
|
|
12240
12505
|
})));
|
|
12241
12506
|
};
|
|
12242
12507
|
/** @internal */
|
|
12243
12508
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
12244
12509
|
const workflows = yield* readWorkflows(root);
|
|
12245
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
12510
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$9(file)(source)));
|
|
12246
12511
|
});
|
|
12247
12512
|
// src/features/check-scripts/model/script-checks.ts
|
|
12248
12513
|
/** @internal */
|
|
@@ -12348,25 +12613,25 @@ const docSources = (file) => (source) => {
|
|
|
12348
12613
|
const ROOT_DIRECTORY$1 = ".";
|
|
12349
12614
|
const COMMAND_KEY = "command";
|
|
12350
12615
|
const ARGUMENTS_KEY = "args";
|
|
12351
|
-
const EXCLUDED$
|
|
12352
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
12616
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12617
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$5];
|
|
12353
12618
|
const STEP_FILES = [
|
|
12354
12619
|
":(glob).github/workflows/*.yml",
|
|
12355
12620
|
":(glob).github/workflows/*.yaml",
|
|
12356
12621
|
":(glob)**/action.yml",
|
|
12357
12622
|
":(glob)**/action.yaml",
|
|
12358
|
-
...EXCLUDED$
|
|
12623
|
+
...EXCLUDED$5
|
|
12359
12624
|
];
|
|
12360
12625
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
12361
12626
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
12362
12627
|
const AGENT_DOCS = [
|
|
12363
12628
|
":(glob)**/AGENTS.md",
|
|
12364
12629
|
":(glob)**/CLAUDE.md",
|
|
12365
|
-
...EXCLUDED$
|
|
12630
|
+
...EXCLUDED$5
|
|
12366
12631
|
];
|
|
12367
|
-
const READ_CONCURRENCY$
|
|
12368
|
-
const START$
|
|
12369
|
-
const FIRST$
|
|
12632
|
+
const READ_CONCURRENCY$8 = 16;
|
|
12633
|
+
const START$14 = 0;
|
|
12634
|
+
const FIRST$5 = 1;
|
|
12370
12635
|
const LINE = "\n";
|
|
12371
12636
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
12372
12637
|
const decodeCommandText = Schema.decodeUnknownOption(CommandText);
|
|
@@ -12375,7 +12640,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
12375
12640
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
12376
12641
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12377
12642
|
const NO_SOURCES = [];
|
|
12378
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
12643
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$14));
|
|
12379
12644
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
12380
12645
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
12381
12646
|
return {
|
|
@@ -12397,8 +12662,8 @@ const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE
|
|
|
12397
12662
|
kind: "hook",
|
|
12398
12663
|
file,
|
|
12399
12664
|
position: {
|
|
12400
|
-
line: index + FIRST$
|
|
12401
|
-
column: FIRST$
|
|
12665
|
+
line: index + FIRST$5,
|
|
12666
|
+
column: FIRST$5
|
|
12402
12667
|
},
|
|
12403
12668
|
name,
|
|
12404
12669
|
text
|
|
@@ -12435,7 +12700,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
12435
12700
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
12436
12701
|
});
|
|
12437
12702
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
12438
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
12703
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$8 });
|
|
12439
12704
|
return Array.flatten(found);
|
|
12440
12705
|
});
|
|
12441
12706
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -12447,7 +12712,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
12447
12712
|
onSome: sourcesOf(file, name)
|
|
12448
12713
|
});
|
|
12449
12714
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
12450
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
12715
|
+
}, { concurrency: READ_CONCURRENCY$8 });
|
|
12451
12716
|
return Array.flatten(found);
|
|
12452
12717
|
});
|
|
12453
12718
|
/** @internal */
|
|
@@ -12471,7 +12736,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
12471
12736
|
return Array.flatten(found);
|
|
12472
12737
|
});
|
|
12473
12738
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
12474
|
-
const RULE$
|
|
12739
|
+
const RULE$22 = "package-script";
|
|
12475
12740
|
const LIFECYCLE = [
|
|
12476
12741
|
"preinstall",
|
|
12477
12742
|
"install",
|
|
@@ -12494,12 +12759,12 @@ const LIFECYCLE = [
|
|
|
12494
12759
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
12495
12760
|
file,
|
|
12496
12761
|
...position,
|
|
12497
|
-
rule: RULE$
|
|
12762
|
+
rule: RULE$22,
|
|
12498
12763
|
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.`
|
|
12499
12764
|
});
|
|
12500
12765
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
12501
12766
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
12502
|
-
const RULE$
|
|
12767
|
+
const RULE$21 = "vite-plus-block";
|
|
12503
12768
|
const MARKER = Array.join([
|
|
12504
12769
|
"<!--",
|
|
12505
12770
|
"VITE PLUS START",
|
|
@@ -12512,7 +12777,7 @@ const problemIn = (file) => (source) => {
|
|
|
12512
12777
|
return Option.some({
|
|
12513
12778
|
file,
|
|
12514
12779
|
...positionOf(source)(index.value),
|
|
12515
|
-
rule: RULE$
|
|
12780
|
+
rule: RULE$21,
|
|
12516
12781
|
message: MESSAGE$8
|
|
12517
12782
|
});
|
|
12518
12783
|
};
|
|
@@ -12568,7 +12833,7 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
12568
12833
|
})
|
|
12569
12834
|
});
|
|
12570
12835
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
12571
|
-
const RULE$
|
|
12836
|
+
const RULE$19 = "publish-trigger";
|
|
12572
12837
|
const PUBLISH = /\bmsch-publish\b/u;
|
|
12573
12838
|
const MANUAL = "workflow_dispatch";
|
|
12574
12839
|
const TRIGGER_KEY = "on";
|
|
@@ -12588,18 +12853,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
12588
12853
|
};
|
|
12589
12854
|
/** @internal */
|
|
12590
12855
|
const checkPublishTrigger = workflowCheck({
|
|
12591
|
-
rule: RULE$
|
|
12856
|
+
rule: RULE$19,
|
|
12592
12857
|
message: MESSAGE$6,
|
|
12593
12858
|
offsetsOf: publishTriggerOffsetsOf
|
|
12594
12859
|
});
|
|
12595
12860
|
// src/features/check-workflows/model/release-please.ts
|
|
12596
|
-
const RULE$
|
|
12861
|
+
const RULE$18 = "release-please";
|
|
12597
12862
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
12598
12863
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
12599
|
-
const FIRST$
|
|
12864
|
+
const FIRST$4 = 1;
|
|
12600
12865
|
const MESSAGE$5 = "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.";
|
|
12601
12866
|
const checkReleasePleaseSteps = workflowCheck({
|
|
12602
|
-
rule: RULE$
|
|
12867
|
+
rule: RULE$18,
|
|
12603
12868
|
message: MESSAGE$5,
|
|
12604
12869
|
offsetsOf: scalarKeyOffsets({
|
|
12605
12870
|
name: "uses",
|
|
@@ -12611,9 +12876,9 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
12611
12876
|
const names = yield* files.listedFiles(root);
|
|
12612
12877
|
return pipe(names, Array.filter((name) => RELEASE_PLEASE_FILE.test(name)), Array.map((name) => ({
|
|
12613
12878
|
file: files.join(root, name),
|
|
12614
|
-
line: FIRST$
|
|
12615
|
-
column: FIRST$
|
|
12616
|
-
rule: RULE$
|
|
12879
|
+
line: FIRST$4,
|
|
12880
|
+
column: FIRST$4,
|
|
12881
|
+
rule: RULE$18,
|
|
12617
12882
|
message: MESSAGE$5
|
|
12618
12883
|
})));
|
|
12619
12884
|
});
|
|
@@ -12625,17 +12890,17 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
12625
12890
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
12626
12891
|
const CONCURRENCY_KEY = "concurrency";
|
|
12627
12892
|
const QUEUE_KEY = "queue";
|
|
12628
|
-
const RULE$
|
|
12893
|
+
const RULE$17 = "workflow-queue";
|
|
12629
12894
|
const MESSAGE$4 = "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.";
|
|
12630
12895
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
12631
12896
|
/** @internal */
|
|
12632
12897
|
const checkWorkflowQueues = workflowCheck({
|
|
12633
|
-
rule: RULE$
|
|
12898
|
+
rule: RULE$17,
|
|
12634
12899
|
message: MESSAGE$4,
|
|
12635
12900
|
offsetsOf: queueOffsetsOf
|
|
12636
12901
|
});
|
|
12637
12902
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
12638
|
-
const RULE$
|
|
12903
|
+
const RULE$16 = "workflow-commit";
|
|
12639
12904
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
12640
12905
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
12641
12906
|
const MESSAGE$3 = "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.";
|
|
@@ -12643,7 +12908,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
12643
12908
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
12644
12909
|
/** @internal */
|
|
12645
12910
|
const checkWorkflowCommits = workflowCheck({
|
|
12646
|
-
rule: RULE$
|
|
12911
|
+
rule: RULE$16,
|
|
12647
12912
|
message: MESSAGE$3,
|
|
12648
12913
|
offsetsOf: commitOffsetsOf
|
|
12649
12914
|
});
|
|
@@ -12671,14 +12936,16 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
12671
12936
|
checkPublishTrigger(root),
|
|
12672
12937
|
checkRestrictedRules(root),
|
|
12673
12938
|
checkMarkdown(root),
|
|
12939
|
+
checkLegacyWeb(root),
|
|
12940
|
+
checkDocumentedCommands(root),
|
|
12674
12941
|
checkStructure(root),
|
|
12675
12942
|
checkWorkflowLint(root)
|
|
12676
12943
|
], { concurrency: "unbounded" });
|
|
12677
12944
|
return Array.flatten(found);
|
|
12678
12945
|
});
|
|
12679
12946
|
// src/features/ban-comments/model/found-comment.ts
|
|
12680
|
-
const taggedError$
|
|
12681
|
-
var CommentsUnreadable = class extends taggedError$
|
|
12947
|
+
const taggedError$3 = Schema.TaggedError;
|
|
12948
|
+
var CommentsUnreadable = class extends taggedError$3()("CommentsUnreadable", {
|
|
12682
12949
|
reader: Schema.String,
|
|
12683
12950
|
message: Schema.String
|
|
12684
12951
|
}) {};
|
|
@@ -12749,7 +13016,7 @@ const COMMENT_NODES = [
|
|
|
12749
13016
|
"block_comment",
|
|
12750
13017
|
"multiline_comment"
|
|
12751
13018
|
];
|
|
12752
|
-
const START$
|
|
13019
|
+
const START$13 = 0;
|
|
12753
13020
|
const NEXT = 1;
|
|
12754
13021
|
const NONE$1 = [];
|
|
12755
13022
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -12802,7 +13069,7 @@ const markupComment = (source) => (node) => {
|
|
|
12802
13069
|
}];
|
|
12803
13070
|
};
|
|
12804
13071
|
const textComments = (grammars, grammar) => (text) => {
|
|
12805
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13072
|
+
const shift = shifted(text.startIndex ?? START$13);
|
|
12806
13073
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
12807
13074
|
};
|
|
12808
13075
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -12838,13 +13105,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
12838
13105
|
}[reader](source);
|
|
12839
13106
|
};
|
|
12840
13107
|
// src/features/ban-comments/model/comments.ts
|
|
12841
|
-
const RULE$
|
|
12842
|
-
const CONFIG_FILE$
|
|
13108
|
+
const RULE$15 = "comment";
|
|
13109
|
+
const CONFIG_FILE$2 = "vite.config.ts";
|
|
12843
13110
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
12844
|
-
const READ_CONCURRENCY$
|
|
12845
|
-
const START$
|
|
12846
|
-
const FIRST_LINE$4 = 1;
|
|
12847
|
-
const FIRST_COLUMN$3 = 1;
|
|
13111
|
+
const READ_CONCURRENCY$7 = 64;
|
|
13112
|
+
const START$12 = 0;
|
|
12848
13113
|
const READERS$1 = [
|
|
12849
13114
|
[/\.(?:[cm]?jsx?)$/u, "javascript"],
|
|
12850
13115
|
[/\.(?:[cm]?ts)$/u, "typescript"],
|
|
@@ -12890,8 +13155,8 @@ const NO_SETTINGS = {
|
|
|
12890
13155
|
ignorePatterns: []
|
|
12891
13156
|
};
|
|
12892
13157
|
const NONE = [];
|
|
12893
|
-
const taggedError$
|
|
12894
|
-
var CommentConfigUnreadable = class extends taggedError$
|
|
13158
|
+
const taggedError$2 = Schema.TaggedError;
|
|
13159
|
+
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
12895
13160
|
const shebangReader = (source) => {
|
|
12896
13161
|
if (!String$1.startsWith(SHEBANG)(source)) return Option.none();
|
|
12897
13162
|
return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
|
|
@@ -12899,25 +13164,18 @@ const shebangReader = (source) => {
|
|
|
12899
13164
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
12900
13165
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
12901
13166
|
const lineBefore = (source, index) => {
|
|
12902
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13167
|
+
const lines = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
12903
13168
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
12904
13169
|
};
|
|
12905
13170
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
12906
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13171
|
+
const isShebang = ({ index, text }) => index === START$12 && String$1.startsWith(SHEBANG)(text);
|
|
12907
13172
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
12908
13173
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
12909
13174
|
file,
|
|
12910
13175
|
...positionOf(source)(index),
|
|
12911
|
-
rule: RULE$
|
|
13176
|
+
rule: RULE$15,
|
|
12912
13177
|
message: MESSAGE$2
|
|
12913
13178
|
});
|
|
12914
|
-
const unreadableProblem = (file, message) => ({
|
|
12915
|
-
file,
|
|
12916
|
-
line: FIRST_LINE$4,
|
|
12917
|
-
column: FIRST_COLUMN$3,
|
|
12918
|
-
rule: RULE$14,
|
|
12919
|
-
message: `msch could not read the comments in this file: ${message}`
|
|
12920
|
-
});
|
|
12921
13179
|
const settingsOf = ({ msch, lint }) => ({
|
|
12922
13180
|
allow: pipe(Option.fromUndefinedOr(msch), Option.flatMap(({ comments }) => Option.fromUndefinedOr(comments)), Option.match({
|
|
12923
13181
|
onNone: () => NO_SETTINGS.allow,
|
|
@@ -12927,7 +13185,7 @@ const settingsOf = ({ msch, lint }) => ({
|
|
|
12927
13185
|
});
|
|
12928
13186
|
const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
|
|
12929
13187
|
const files = yield* RepositoryFiles;
|
|
12930
|
-
const file = files.join(root, CONFIG_FILE$
|
|
13188
|
+
const file = files.join(root, CONFIG_FILE$2);
|
|
12931
13189
|
if (!(yield* files.exists(file))) return NO_SETTINGS;
|
|
12932
13190
|
const config = yield* Effect.tryPromise({
|
|
12933
13191
|
try: () => resolveConfigFromFile(file),
|
|
@@ -12964,13 +13222,13 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
12964
13222
|
const toProblem = problemOf$2(file, source);
|
|
12965
13223
|
return Option.match(readerOf(name, source), {
|
|
12966
13224
|
onNone: () => Effect.succeed(NONE),
|
|
12967
|
-
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([
|
|
13225
|
+
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([problemInFile(RULE$15)(file, `msch could not read the comments in this file: ${message}`)])))
|
|
12968
13226
|
});
|
|
12969
13227
|
};
|
|
12970
13228
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
12971
13229
|
onNone: () => Effect.succeed(NONE),
|
|
12972
13230
|
onSome: (source) => problemsIn(entry, source)
|
|
12973
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
13231
|
+
}))), { concurrency: READ_CONCURRENCY$7 });
|
|
12974
13232
|
return Array.flatten(found);
|
|
12975
13233
|
});
|
|
12976
13234
|
// src/features/ban-tools/model/banned-tool.ts
|
|
@@ -13070,13 +13328,13 @@ const WILDCARD = "*";
|
|
|
13070
13328
|
const FIRST_LINE$2 = 1;
|
|
13071
13329
|
const FIRST_COLUMN$1 = 1;
|
|
13072
13330
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
13073
|
-
const READ_CONCURRENCY$
|
|
13331
|
+
const READ_CONCURRENCY$6 = 16;
|
|
13074
13332
|
const STALE_RULE = "stale-release-age-exclude";
|
|
13075
13333
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
13076
13334
|
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.";
|
|
13077
13335
|
const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
|
|
13078
13336
|
const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
|
|
13079
|
-
const decodeManifest$
|
|
13337
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
|
|
13080
13338
|
const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
|
|
13081
13339
|
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
13082
13340
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
@@ -13104,8 +13362,8 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
13104
13362
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
13105
13363
|
const files = yield* RepositoryFiles;
|
|
13106
13364
|
const listed = yield* files.listedFiles(root);
|
|
13107
|
-
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
13108
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
13365
|
+
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$6 });
|
|
13366
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$5(text))), Array.flatMap(referencesIn));
|
|
13109
13367
|
const fromOverrides = pipe(fieldsOf$2(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13110
13368
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13111
13369
|
});
|
|
@@ -13150,11 +13408,11 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
|
|
|
13150
13408
|
// src/features/check-skills/model/skill-entry.ts
|
|
13151
13409
|
const ENTRY_RULE = "unlocked-skill";
|
|
13152
13410
|
const VISIBLE_RULE = "skill-source-visible";
|
|
13153
|
-
const CONFIG_FILE = "vite.config.ts";
|
|
13411
|
+
const CONFIG_FILE$1 = "vite.config.ts";
|
|
13154
13412
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13155
13413
|
const SOURCE = "masseater/skills";
|
|
13156
13414
|
const PRESET$1 = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
|
|
13157
|
-
const START$
|
|
13415
|
+
const START$11 = 0;
|
|
13158
13416
|
const LOCAL_PREFIX = "./";
|
|
13159
13417
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
13160
13418
|
const Source = Schema.Struct({
|
|
@@ -13163,17 +13421,17 @@ const Source = Schema.Struct({
|
|
|
13163
13421
|
});
|
|
13164
13422
|
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
13165
13423
|
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
13166
|
-
const taggedError = Schema.TaggedError;
|
|
13167
|
-
var SkillsConfigUnreadable = class extends taggedError()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13424
|
+
const taggedError$1 = Schema.TaggedError;
|
|
13425
|
+
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13168
13426
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
13169
13427
|
file,
|
|
13170
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
13428
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$11))),
|
|
13171
13429
|
rule,
|
|
13172
13430
|
message
|
|
13173
13431
|
});
|
|
13174
13432
|
const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
|
|
13175
13433
|
const files = yield* RepositoryFiles;
|
|
13176
|
-
const file = files.join(root, CONFIG_FILE);
|
|
13434
|
+
const file = files.join(root, CONFIG_FILE$1);
|
|
13177
13435
|
const text = yield* files.readFile(file);
|
|
13178
13436
|
if (Option.isNone(text)) return Option.none();
|
|
13179
13437
|
const config = yield* Effect.tryPromise({
|
|
@@ -13200,7 +13458,7 @@ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root
|
|
|
13200
13458
|
const file = files.join(root, RENOVATE_FILE$1);
|
|
13201
13459
|
const text = yield* files.readFile(file);
|
|
13202
13460
|
if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
|
|
13203
|
-
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`)];
|
|
13461
|
+
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
|
|
13204
13462
|
});
|
|
13205
13463
|
/** @internal */
|
|
13206
13464
|
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
@@ -13214,22 +13472,15 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
13214
13472
|
];
|
|
13215
13473
|
});
|
|
13216
13474
|
// src/features/check-skills/model/published-skills.ts
|
|
13217
|
-
const RULE$
|
|
13475
|
+
const RULE$14 = "published-skills";
|
|
13218
13476
|
const KEYWORD = "tanstack-intent";
|
|
13219
13477
|
const SKILLS = "skills";
|
|
13220
13478
|
const MANIFEST_FILE = "package.json";
|
|
13221
13479
|
const SKILL_FILE$1 = "SKILL.md";
|
|
13222
|
-
const FIRST$5 = 1;
|
|
13223
13480
|
const SUCCEEDED = 0;
|
|
13224
13481
|
const SYNC = "Run vp exec intent maintainer sync in the repository root.";
|
|
13225
13482
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
13226
|
-
const problemAt$2 = (
|
|
13227
|
-
file,
|
|
13228
|
-
line: FIRST$5,
|
|
13229
|
-
column: FIRST$5,
|
|
13230
|
-
rule: RULE$13,
|
|
13231
|
-
message
|
|
13232
|
-
});
|
|
13483
|
+
const problemAt$2 = problemInFile(RULE$14);
|
|
13233
13484
|
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))));
|
|
13234
13485
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
13235
13486
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
@@ -13250,7 +13501,7 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
13250
13501
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
13251
13502
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
13252
13503
|
}, Effect.scoped);
|
|
13253
|
-
const problemsIn$
|
|
13504
|
+
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
13254
13505
|
const files = yield* RepositoryFiles;
|
|
13255
13506
|
const directory = files.join(root, project.directory);
|
|
13256
13507
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
@@ -13262,11 +13513,11 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
13262
13513
|
/** @internal */
|
|
13263
13514
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
13264
13515
|
const projects = yield* publishedProjects(root);
|
|
13265
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
13516
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$8(root, project), { concurrency: 1 });
|
|
13266
13517
|
return Array.flatten(problems);
|
|
13267
13518
|
});
|
|
13268
13519
|
// src/features/check-skills/model/skill-files.ts
|
|
13269
|
-
const RULE$
|
|
13520
|
+
const RULE$13 = "skill-file";
|
|
13270
13521
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
13271
13522
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
13272
13523
|
const MARKDOWN = ".md";
|
|
@@ -13283,9 +13534,9 @@ const GITHUB = "https://github.com/";
|
|
|
13283
13534
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
13284
13535
|
const BLANK = /\s+/u;
|
|
13285
13536
|
const SEPARATOR$3 = "/";
|
|
13286
|
-
const START$
|
|
13287
|
-
const FIRST$
|
|
13288
|
-
const READ_CONCURRENCY$
|
|
13537
|
+
const START$10 = 0;
|
|
13538
|
+
const FIRST$3 = 1;
|
|
13539
|
+
const READ_CONCURRENCY$5 = 16;
|
|
13289
13540
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
13290
13541
|
const Frontmatter = Schema.Struct({
|
|
13291
13542
|
name: Schema.optional(Schema.String),
|
|
@@ -13293,9 +13544,9 @@ const Frontmatter = Schema.Struct({
|
|
|
13293
13544
|
metadata: Schema.optional(Metadata)
|
|
13294
13545
|
});
|
|
13295
13546
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
13296
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
13547
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$10));
|
|
13297
13548
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
13298
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
13549
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$10].length), Option.getOrElse(() => START$10));
|
|
13299
13550
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
13300
13551
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
13301
13552
|
const bodyStart = bodyStartOf(source);
|
|
@@ -13323,16 +13574,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
13323
13574
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
13324
13575
|
file: skill.file,
|
|
13325
13576
|
...positionOf(skill.source)(index),
|
|
13326
|
-
rule: RULE$
|
|
13577
|
+
rule: RULE$13,
|
|
13327
13578
|
message
|
|
13328
13579
|
})));
|
|
13329
13580
|
const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
13330
13581
|
target,
|
|
13331
|
-
index: found.index ?? START$
|
|
13582
|
+
index: found.index ?? START$10
|
|
13332
13583
|
})), Option.toArray);
|
|
13333
13584
|
const rangeOf$1 = (found) => {
|
|
13334
|
-
const start = found.index ?? START$
|
|
13335
|
-
return [start, start + found[START$
|
|
13585
|
+
const start = found.index ?? START$10;
|
|
13586
|
+
return [start, start + found[START$10].length];
|
|
13336
13587
|
};
|
|
13337
13588
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
13338
13589
|
const linksIn = (source) => {
|
|
@@ -13350,23 +13601,23 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
13350
13601
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
13351
13602
|
file,
|
|
13352
13603
|
...positionOf(source)(index),
|
|
13353
|
-
rule: RULE$
|
|
13604
|
+
rule: RULE$13,
|
|
13354
13605
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
13355
13606
|
})));
|
|
13356
13607
|
});
|
|
13357
|
-
const problemsIn$
|
|
13608
|
+
const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
13358
13609
|
const files = yield* RepositoryFiles;
|
|
13359
13610
|
const file = files.join(root, name);
|
|
13360
13611
|
const directory = files.dirname(name);
|
|
13361
13612
|
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$3}`)));
|
|
13362
13613
|
const text = yield* files.readFile(file);
|
|
13363
13614
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
13364
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
13615
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
|
|
13365
13616
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
13366
13617
|
file: files.join(root, entry),
|
|
13367
|
-
line: FIRST$
|
|
13368
|
-
column: FIRST$
|
|
13369
|
-
rule: RULE$
|
|
13618
|
+
line: FIRST$3,
|
|
13619
|
+
column: FIRST$3,
|
|
13620
|
+
rule: RULE$13,
|
|
13370
13621
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
13371
13622
|
})));
|
|
13372
13623
|
return [
|
|
@@ -13383,7 +13634,7 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13383
13634
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
13384
13635
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13385
13636
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
|
|
13386
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
13637
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$7(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
13387
13638
|
return Array.flatten(found);
|
|
13388
13639
|
});
|
|
13389
13640
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -13446,9 +13697,9 @@ const cargoEntries = (text) => {
|
|
|
13446
13697
|
};
|
|
13447
13698
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
13448
13699
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
13449
|
-
const RULE$
|
|
13700
|
+
const RULE$12 = "version-downgrade";
|
|
13450
13701
|
const DEFAULT_BASE = "origin/main";
|
|
13451
|
-
const READ_CONCURRENCY$
|
|
13702
|
+
const READ_CONCURRENCY$4 = 16;
|
|
13452
13703
|
const READERS = [
|
|
13453
13704
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
13454
13705
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -13472,7 +13723,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
13472
13723
|
file,
|
|
13473
13724
|
line: lineOf(text, entry),
|
|
13474
13725
|
column: FIRST_LINE$1,
|
|
13475
|
-
rule: RULE$
|
|
13726
|
+
rule: RULE$12,
|
|
13476
13727
|
message: message(old, entry)
|
|
13477
13728
|
})), Option.toArray)));
|
|
13478
13729
|
};
|
|
@@ -13498,7 +13749,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
13498
13749
|
before: read(before),
|
|
13499
13750
|
after: read(after)
|
|
13500
13751
|
})), Option.getOrElse(() => []));
|
|
13501
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
13752
|
+
}), { concurrency: READ_CONCURRENCY$4 });
|
|
13502
13753
|
return Array.flatten(found);
|
|
13503
13754
|
});
|
|
13504
13755
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -13509,13 +13760,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
13509
13760
|
const CAP_RULE = "renovate-version-cap";
|
|
13510
13761
|
const PRESET_RULE = "renovate-msch-preset";
|
|
13511
13762
|
const PRESET = "github>masseater/masseater.dev//libs/msch/renovate";
|
|
13512
|
-
const START$
|
|
13513
|
-
const READ_CONCURRENCY$
|
|
13763
|
+
const START$9 = 0;
|
|
13764
|
+
const READ_CONCURRENCY$3 = 16;
|
|
13514
13765
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
13515
13766
|
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.";
|
|
13516
13767
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
13517
13768
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
13518
|
-
const problemsIn$
|
|
13769
|
+
const problemsIn$6 = (file, source) => {
|
|
13519
13770
|
const at = positionOf(source);
|
|
13520
13771
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
13521
13772
|
file,
|
|
@@ -13528,7 +13779,7 @@ const problemsIn$5 = (file, source) => {
|
|
|
13528
13779
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
13529
13780
|
...pipe([{
|
|
13530
13781
|
file,
|
|
13531
|
-
...at(START$
|
|
13782
|
+
...at(START$9),
|
|
13532
13783
|
rule: PRESET_RULE,
|
|
13533
13784
|
message: PRESET_MESSAGE
|
|
13534
13785
|
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -13542,30 +13793,30 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13542
13793
|
const file = files.join(root, name);
|
|
13543
13794
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13544
13795
|
onNone: () => [],
|
|
13545
|
-
onSome: (source) => problemsIn$
|
|
13796
|
+
onSome: (source) => problemsIn$6(file, source)
|
|
13546
13797
|
})));
|
|
13547
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13798
|
+
}, { concurrency: READ_CONCURRENCY$3 });
|
|
13548
13799
|
return Array.flatten(found);
|
|
13549
13800
|
});
|
|
13550
13801
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
13551
13802
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
13552
13803
|
const NUL = "\0";
|
|
13553
|
-
const START$
|
|
13804
|
+
const START$8 = 0;
|
|
13554
13805
|
const HEX = 16;
|
|
13555
13806
|
const CODE_POINT_WIDTH = 4;
|
|
13556
|
-
const READ_CONCURRENCY$
|
|
13557
|
-
const RULE$
|
|
13558
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
13807
|
+
const READ_CONCURRENCY$2 = 64;
|
|
13808
|
+
const RULE$11 = "hidden-unicode";
|
|
13809
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$8)(character), Option.getOrElse(() => START$8), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
13559
13810
|
const problemOf$1 = (file, source) => (found) => {
|
|
13560
|
-
const hex = hexOf(found[START$
|
|
13811
|
+
const hex = hexOf(found[START$8]);
|
|
13561
13812
|
return {
|
|
13562
13813
|
file,
|
|
13563
|
-
...positionOf(source)(found.index ?? START$
|
|
13564
|
-
rule: RULE$
|
|
13814
|
+
...positionOf(source)(found.index ?? START$8),
|
|
13815
|
+
rule: RULE$11,
|
|
13565
13816
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
13566
13817
|
};
|
|
13567
13818
|
};
|
|
13568
|
-
const problemsIn$
|
|
13819
|
+
const problemsIn$5 = (file, source) => {
|
|
13569
13820
|
if (String$1.includes(NUL)(source)) return [];
|
|
13570
13821
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
|
|
13571
13822
|
};
|
|
@@ -13577,25 +13828,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
13577
13828
|
const file = files.join(root, name);
|
|
13578
13829
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13579
13830
|
onNone: () => [],
|
|
13580
|
-
onSome: (source) => problemsIn$
|
|
13831
|
+
onSome: (source) => problemsIn$5(file, source)
|
|
13581
13832
|
})));
|
|
13582
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13833
|
+
}, { concurrency: READ_CONCURRENCY$2 });
|
|
13583
13834
|
return Array.flatten(found);
|
|
13584
13835
|
});
|
|
13585
13836
|
// src/features/find-unneeded-files/model/alchemy-patch.ts
|
|
13586
|
-
const RULE$
|
|
13837
|
+
const RULE$10 = "alchemy-patch";
|
|
13587
13838
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
13588
13839
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
13589
|
-
const START$
|
|
13840
|
+
const START$7 = 0;
|
|
13590
13841
|
const problemOf = (file, position, name) => ({
|
|
13591
13842
|
file,
|
|
13592
13843
|
...position,
|
|
13593
|
-
rule: RULE$
|
|
13844
|
+
rule: RULE$10,
|
|
13594
13845
|
message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
|
|
13595
13846
|
});
|
|
13596
|
-
const problemsIn$
|
|
13847
|
+
const problemsIn$4 = (file, patched) => (source) => {
|
|
13597
13848
|
const at = positionOf(source);
|
|
13598
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
13849
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$7));
|
|
13599
13850
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
13600
13851
|
};
|
|
13601
13852
|
/** @internal */
|
|
@@ -13605,12 +13856,12 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
|
|
|
13605
13856
|
const text = yield* files.readFile(file);
|
|
13606
13857
|
const manifest = yield* workspaceManifest(root);
|
|
13607
13858
|
const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
13608
|
-
return pipe(text, Option.map(problemsIn$
|
|
13859
|
+
return pipe(text, Option.map(problemsIn$4(file, patched)), Option.getOrElse(() => []));
|
|
13609
13860
|
});
|
|
13610
13861
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
13611
13862
|
const MSCH = "@r_masseater/msch";
|
|
13612
13863
|
const SCOPE$1 = "@r_masseater/";
|
|
13613
|
-
const RULE$
|
|
13864
|
+
const RULE$9 = "applied-package";
|
|
13614
13865
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
13615
13866
|
const NOT_FOUND = -1;
|
|
13616
13867
|
const SEPARATOR$2 = "/";
|
|
@@ -13655,7 +13906,7 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
13655
13906
|
const problemAt$1 = (file, source) => (index, name) => ({
|
|
13656
13907
|
file,
|
|
13657
13908
|
...positionOf(source)(index),
|
|
13658
|
-
rule: RULE$
|
|
13909
|
+
rule: RULE$9,
|
|
13659
13910
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
13660
13911
|
});
|
|
13661
13912
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
@@ -13710,8 +13961,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
13710
13961
|
return yield* appliedPackageProblems(root, applied);
|
|
13711
13962
|
});
|
|
13712
13963
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
13713
|
-
const RULE$
|
|
13714
|
-
const FIRST$
|
|
13964
|
+
const RULE$8 = "replaced-tool";
|
|
13965
|
+
const FIRST$2 = 1;
|
|
13715
13966
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
13716
13967
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
13717
13968
|
const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
|
|
@@ -13787,18 +14038,18 @@ const REPLACED = [
|
|
|
13787
14038
|
replacement: "the root AGENTS.md and the skills in masseater/skills"
|
|
13788
14039
|
}
|
|
13789
14040
|
];
|
|
13790
|
-
const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
14041
|
+
const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
13791
14042
|
file,
|
|
13792
|
-
line: FIRST$
|
|
13793
|
-
column: FIRST$
|
|
13794
|
-
rule: RULE$
|
|
14043
|
+
line: FIRST$2,
|
|
14044
|
+
column: FIRST$2,
|
|
14045
|
+
rule: RULE$8,
|
|
13795
14046
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
13796
14047
|
})));
|
|
13797
14048
|
/** @internal */
|
|
13798
14049
|
const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplacedTools(root) {
|
|
13799
14050
|
const listed = yield* listedFiles(root);
|
|
13800
|
-
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor(entry)))));
|
|
13801
|
-
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor(entry))));
|
|
14051
|
+
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor$1(entry)))));
|
|
14052
|
+
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor$1(entry))));
|
|
13802
14053
|
});
|
|
13803
14054
|
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
13804
14055
|
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
@@ -13820,7 +14071,7 @@ const SETUP_PATTERNS = [
|
|
|
13820
14071
|
];
|
|
13821
14072
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
13822
14073
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
13823
|
-
const START$
|
|
14074
|
+
const START$6 = 0;
|
|
13824
14075
|
const LAST_SEGMENT = 1;
|
|
13825
14076
|
const FIRST_LINE = 1;
|
|
13826
14077
|
const FIRST_COLUMN = 1;
|
|
@@ -13890,7 +14141,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
13890
14141
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
13891
14142
|
return directoriesOf(roots);
|
|
13892
14143
|
});
|
|
13893
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
14144
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
|
|
13894
14145
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
13895
14146
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
13896
14147
|
const cargoProblems = (present, enabled) => {
|
|
@@ -13926,11 +14177,11 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
13926
14177
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
13927
14178
|
});
|
|
13928
14179
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
13929
|
-
const RULE$
|
|
14180
|
+
const RULE$7 = "effect-diagnostics-once";
|
|
13930
14181
|
const PLUGIN = "@effect/language-service";
|
|
13931
14182
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
13932
|
-
const EXCLUDED$
|
|
13933
|
-
const START$
|
|
14183
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14184
|
+
const START$5 = 0;
|
|
13934
14185
|
const Plugin = Schema.Struct({
|
|
13935
14186
|
name: Schema.optional(Schema.String),
|
|
13936
14187
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -13941,38 +14192,38 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
13941
14192
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
13942
14193
|
const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
|
|
13943
14194
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
13944
|
-
const problemsIn$
|
|
14195
|
+
const problemsIn$3 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array.some(reportsDiagnostics)), Option.map(() => ({
|
|
13945
14196
|
file: entry.file,
|
|
13946
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
13947
|
-
rule: RULE$
|
|
14197
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$5))),
|
|
14198
|
+
rule: RULE$7,
|
|
13948
14199
|
message: MESSAGE$1
|
|
13949
14200
|
})), Option.toArray);
|
|
13950
14201
|
/** @internal */
|
|
13951
14202
|
const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* checkEffectDiagnostics(root) {
|
|
13952
14203
|
const files = yield* RepositoryFiles;
|
|
13953
|
-
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$
|
|
14204
|
+
const configs = yield* files.matchingFiles(root, [CONFIG_PATHSPEC, ...EXCLUDED$4]);
|
|
13954
14205
|
return yield* scanText(pipe(configs, Array.map((name) => ({
|
|
13955
14206
|
name,
|
|
13956
14207
|
file: files.join(root, name)
|
|
13957
|
-
}))), problemsIn$
|
|
14208
|
+
}))), problemsIn$3);
|
|
13958
14209
|
});
|
|
13959
14210
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
13960
|
-
const RULE$
|
|
14211
|
+
const RULE$6 = "version-range";
|
|
13961
14212
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
13962
14213
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
13963
14214
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
13964
14215
|
const PATH_LIKE = "/";
|
|
13965
|
-
const START$
|
|
14216
|
+
const START$4 = 0;
|
|
13966
14217
|
const SECTIONS = [
|
|
13967
14218
|
"dependencies",
|
|
13968
14219
|
"devDependencies",
|
|
13969
14220
|
"optionalDependencies"
|
|
13970
14221
|
];
|
|
13971
|
-
const EXCLUDED$
|
|
14222
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13972
14223
|
const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
|
|
13973
14224
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
13974
14225
|
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
13975
|
-
const decodeManifest$
|
|
14226
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
13976
14227
|
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
13977
14228
|
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
13978
14229
|
const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
|
|
@@ -13986,16 +14237,16 @@ const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatM
|
|
|
13986
14237
|
specifier
|
|
13987
14238
|
})), Option.toArray)));
|
|
13988
14239
|
const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
13989
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
14240
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$4));
|
|
13990
14241
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
13991
14242
|
file,
|
|
13992
14243
|
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
13993
|
-
rule: RULE$
|
|
14244
|
+
rule: RULE$6,
|
|
13994
14245
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
13995
14246
|
})));
|
|
13996
14247
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted(name)}"\\s*:\\s*"${quoted(specifier)}"`, "u");
|
|
13997
14248
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "mu");
|
|
13998
|
-
const manifestProblems$1 = (entry, source) => pipe(decodeManifest$
|
|
14249
|
+
const manifestProblems$1 = (entry, source) => pipe(decodeManifest$4(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
|
|
13999
14250
|
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
14000
14251
|
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
14001
14252
|
const files = yield* RepositoryFiles;
|
|
@@ -14010,7 +14261,7 @@ const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(r
|
|
|
14010
14261
|
/** @internal */
|
|
14011
14262
|
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
14012
14263
|
const files = yield* RepositoryFiles;
|
|
14013
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
14264
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$3]);
|
|
14014
14265
|
const listed = pipe(manifests, Array.map((name) => ({
|
|
14015
14266
|
name,
|
|
14016
14267
|
file: files.join(root, name)
|
|
@@ -14019,6 +14270,58 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
14019
14270
|
const fromCatalogs = yield* catalogProblems(root);
|
|
14020
14271
|
return [...fromManifests, ...fromCatalogs];
|
|
14021
14272
|
});
|
|
14273
|
+
// src/features/check-pack-settings/model/pack-settings.ts
|
|
14274
|
+
const RULE$5 = "pack-publint";
|
|
14275
|
+
const CONFIG_FILE = "vite.config.ts";
|
|
14276
|
+
const PACK_KEY = "pack:";
|
|
14277
|
+
const START$3 = 0;
|
|
14278
|
+
const READ_CONCURRENCY$1 = 16;
|
|
14279
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14280
|
+
const Manifest$3 = Schema.Struct({
|
|
14281
|
+
private: Schema.optional(Schema.Boolean),
|
|
14282
|
+
publishConfig: Schema.optional(Schema.Unknown)
|
|
14283
|
+
});
|
|
14284
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
14285
|
+
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
14286
|
+
const isStrict = Schema.is(StrictPack);
|
|
14287
|
+
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
14288
|
+
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
14289
|
+
const taggedError = Schema.TaggedError;
|
|
14290
|
+
var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
14291
|
+
const isPublished$2 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14292
|
+
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array.ensure(pack)), Option.exists(Array.some(isStrict)));
|
|
14293
|
+
const problemFor = (file, source) => ({
|
|
14294
|
+
file,
|
|
14295
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$3)),
|
|
14296
|
+
rule: RULE$5,
|
|
14297
|
+
message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
|
|
14298
|
+
});
|
|
14299
|
+
const isPublishedManifest = (source) => pipe(source, Option.flatMap(decodeManifest$3), Option.exists(isPublished$2));
|
|
14300
|
+
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
14301
|
+
const config = yield* Effect.tryPromise({
|
|
14302
|
+
try: () => resolveConfigFromFile(configFile),
|
|
14303
|
+
catch: () => PackConfigUnreadable.make({ file: configFile })
|
|
14304
|
+
}).pipe(Effect.option);
|
|
14305
|
+
return Option.exists(config, runsStrictPublint);
|
|
14306
|
+
});
|
|
14307
|
+
const configProblems = Effect.fn("configProblems")(function* configProblems(configFile) {
|
|
14308
|
+
const source = yield* (yield* RepositoryFiles).readFile(configFile);
|
|
14309
|
+
if (Option.isNone(source)) return [];
|
|
14310
|
+
if (yield* strictPublintIn(configFile)) return [];
|
|
14311
|
+
return [problemFor(configFile, source.value)];
|
|
14312
|
+
});
|
|
14313
|
+
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
14314
|
+
const files = yield* RepositoryFiles;
|
|
14315
|
+
const manifest = yield* files.readFile(files.join(root, manifestName));
|
|
14316
|
+
if (!isPublishedManifest(manifest)) return [];
|
|
14317
|
+
return yield* configProblems(files.join(root, files.dirname(manifestName), CONFIG_FILE));
|
|
14318
|
+
});
|
|
14319
|
+
/** @internal */
|
|
14320
|
+
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
14321
|
+
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
14322
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$2(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
14323
|
+
return Array.flatten(found);
|
|
14324
|
+
});
|
|
14022
14325
|
// src/features/check-package-scope/model/package-scope.ts
|
|
14023
14326
|
const RULE$4 = "package-scope";
|
|
14024
14327
|
const SCOPE = "@r_masseater/";
|
|
@@ -14053,7 +14356,6 @@ const RULE$3 = "plugin-marketplace";
|
|
|
14053
14356
|
const PLUGIN_DIRECTORY = ".claude-plugin";
|
|
14054
14357
|
const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
|
|
14055
14358
|
const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
|
|
14056
|
-
const FIRST$2 = 1;
|
|
14057
14359
|
const INDENT = 2;
|
|
14058
14360
|
const OwnerSchema = Schema.Struct({
|
|
14059
14361
|
name: Schema.String,
|
|
@@ -14062,6 +14364,7 @@ const OwnerSchema = Schema.Struct({
|
|
|
14062
14364
|
const Person = Schema.Union([Schema.String, OwnerSchema]);
|
|
14063
14365
|
const RootManifest = Schema.fromJsonString(Schema.Struct({
|
|
14064
14366
|
name: Schema.String,
|
|
14367
|
+
description: Schema.optionalKey(Schema.String),
|
|
14065
14368
|
author: Schema.optionalKey(Person)
|
|
14066
14369
|
}));
|
|
14067
14370
|
const PluginManifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));
|
|
@@ -14074,9 +14377,11 @@ const PluginSchema = Schema.Struct({
|
|
|
14074
14377
|
source: Schema.Union([Schema.String, NpmSource]),
|
|
14075
14378
|
description: Schema.String
|
|
14076
14379
|
});
|
|
14380
|
+
const MetadataSchema = Schema.Struct({ description: Schema.String });
|
|
14077
14381
|
const Marketplace = Schema.fromJsonString(Schema.Struct({
|
|
14078
14382
|
name: Schema.String,
|
|
14079
14383
|
owner: OwnerSchema,
|
|
14384
|
+
metadata: Schema.optionalKey(MetadataSchema),
|
|
14080
14385
|
plugins: Schema.Array(PluginSchema)
|
|
14081
14386
|
}), { space: INDENT });
|
|
14082
14387
|
const decodeRoot = Schema.decodeUnknownOption(RootManifest);
|
|
@@ -14103,24 +14408,23 @@ const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
|
14103
14408
|
description: Option.getOrElse(project.description, () => "")
|
|
14104
14409
|
})));
|
|
14105
14410
|
});
|
|
14106
|
-
const problem = (
|
|
14107
|
-
file,
|
|
14108
|
-
line: FIRST$2,
|
|
14109
|
-
column: FIRST$2,
|
|
14110
|
-
rule: RULE$3,
|
|
14111
|
-
message
|
|
14112
|
-
});
|
|
14411
|
+
const problem = problemInFile(RULE$3);
|
|
14113
14412
|
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
14114
14413
|
const projects = yield* workspaceProjects(root);
|
|
14115
14414
|
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
14116
14415
|
return Array.getSomes(found);
|
|
14117
14416
|
});
|
|
14417
|
+
const described = (description) => pipe(Option.fromUndefinedOr(description), Option.match({
|
|
14418
|
+
onNone: () => ({}),
|
|
14419
|
+
onSome: (text) => ({ metadata: { description: text } })
|
|
14420
|
+
}));
|
|
14118
14421
|
const ownerIn = Effect.fn("ownerIn")(function* ownerIn(root) {
|
|
14119
14422
|
const files = yield* RepositoryFiles;
|
|
14120
14423
|
const text = yield* files.readFile(files.join(root, MANIFEST_FILE$3));
|
|
14121
|
-
return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
|
|
14424
|
+
return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, description, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
|
|
14122
14425
|
name: marketplaceName(name),
|
|
14123
|
-
owner: ownerOf(found)
|
|
14426
|
+
owner: ownerOf(found),
|
|
14427
|
+
...described(description)
|
|
14124
14428
|
})))));
|
|
14125
14429
|
});
|
|
14126
14430
|
const rewrite = Effect.fn("rewrite")(function* rewrite(file, expected) {
|
|
@@ -14368,6 +14672,7 @@ const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root
|
|
|
14368
14672
|
const found = yield* Effect.all([
|
|
14369
14673
|
checkNodeVersion(root),
|
|
14370
14674
|
checkPackageScope(root),
|
|
14675
|
+
checkPackSettings(root),
|
|
14371
14676
|
checkUnusedWorkspaces(root),
|
|
14372
14677
|
checkExactVersions(root),
|
|
14373
14678
|
checkUpstreamExits(root),
|