@r_masseater/msch 0.35.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -17
- package/dist/cli.mjs +237 -147
- package/dist/cli.mjs.map +1 -1
- package/dist/{comment-directives-WcDqvLwJ.mjs → comment-directives-5-f_qs1E.mjs} +4 -2
- package/dist/comment-directives-5-f_qs1E.mjs.map +1 -0
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-X-_KpO1E.mjs → define-lint-preset-BsiifqPn.mjs} +25 -8
- package/dist/define-lint-preset-BsiifqPn.mjs.map +1 -0
- package/dist/{index-C02uoL59.d.mts → index-4dm7Z_mh.d.mts} +2 -1
- package/dist/lint.mjs +1 -1
- package/dist/{package-DU5r3bvx.mjs → package-DnxpBVTG.mjs} +58 -5
- package/dist/package-DnxpBVTG.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +1 -2
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/comment-directives-WcDqvLwJ.mjs.map +0 -1
- package/dist/define-lint-preset-X-_KpO1E.mjs.map +0 -1
- package/dist/package-DU5r3bvx.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,24 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { B as stringsIn, E as hasVerifyTask, F as childrenOf$2, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as definesTask, _ as publishedProjects, a as publicEntriesOf, b as runTasksOf, c as readManifest, d as lockedPackages, f as deployEntries, i as EntryManifestJson, l as workspaceDependencies, m as patternOf$1, o as MANIFEST_FILE$1, p as namedWorkspaces, r as publishedWorkspaces, s as dependencyEntries, u as lockedGraph, v as workspaceDirectories, w as VERIFY_TASK, y as workspaceManifest, z as propertyValue } from "./package-DnxpBVTG.mjs";
|
|
3
3
|
import { a as groupOf$2, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-R0NW0NE9.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-5-f_qs1E.mjs";
|
|
5
|
+
import { $ as isPropertyAccessExpression, A as getLeadingCommentRanges, B as isEnumDeclaration, C as uniqueByReference, D as SignatureKind, E as InternalSymbolName, F as isBinaryExpression, G as isImportDeclaration, H as isFunctionDeclaration, I as isBlock, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isCallExpression, M as getTextOfJSDocComment, N as isArrayLiteralExpression, O as SyntaxKind, P as isArrowFunction, Q as isParenthesizedExpression, R as isClassDeclaration, S as symbolAt, T as IndexKind, U as isFunctionExpression, V as isExportDeclaration, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as lineOf$3, a as problemAt$9, at as isSpreadElement, b as referencedSymbols, c as columnOf, ct as isTypeLiteralNode, d as descendantsOf, dt as isVariableDeclaration, et as isPropertyAssignment, f as importedModulesOf, ft as isVariableDeclarationList, g as isTypeDeclaration, h as isInsideAny, i as formatProblem, it as isSourceFile, j as getNameOfDeclaration, k as getJSDocTags, l as contains, lt as isTypeReferenceNode, m as isGenericDeclaration, n as ProblemList, nt as isSatisfiesExpression, o as sortProblems, ot as isStringLiteral, p as isExternalDeclaration, pt as isVariableStatement, q as isModuleBlock, rt as isSignatureDeclaration, s as childrenOf$3, st as isTypeAliasDeclaration, tt as isReturnStatement, u as declarationsOf, ut as isUnionTypeNode, v as packageOf$1, w as API, x as resolvedSymbol, y as propertyNamesOf, z as isElementAccessExpression } from "./cli-contract-mzluqQvf.mjs";
|
|
6
6
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
7
7
|
import { Array, Cause, Config, Effect, FileSystem, Function, HashMap, HashSet, Layer, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
8
8
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
9
9
|
import { ChildProcess } from "effect/process";
|
|
10
10
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
11
|
-
import {
|
|
11
|
+
import { parse as parse$1 } from "@pnpm/deps.path";
|
|
12
|
+
import { Parser, isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
|
|
13
|
+
import semver from "semver";
|
|
12
14
|
import path from "node:path";
|
|
13
15
|
import { fileURLToPath } from "node:url";
|
|
14
16
|
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
15
17
|
import { isComment, isTag, isText } from "domhandler";
|
|
16
18
|
import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
|
|
17
19
|
import { DockerfileParser } from "dockerfile-ast";
|
|
18
|
-
import { parse as parse$
|
|
20
|
+
import { parse as parse$3 } from "sql-parser-cst";
|
|
19
21
|
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
20
22
|
import { findSkillFiles } from "@tanstack/intent";
|
|
21
|
-
import semver from "semver";
|
|
22
23
|
import { runMain } from "@effect/platform-node-shared/NodeRuntime";
|
|
23
24
|
import { FetchHttpClient } from "effect/http";
|
|
24
25
|
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
@@ -211,7 +212,7 @@ var OverrideResolutionFailed = class extends taggedError$5()("OverrideResolution
|
|
|
211
212
|
override: Schema.String,
|
|
212
213
|
output: Schema.String
|
|
213
214
|
}) {};
|
|
214
|
-
const textOf = (stream) => stream.pipe(Stream.decodeText(), Stream.mkString);
|
|
215
|
+
const textOf$1 = (stream) => stream.pipe(Stream.decodeText(), Stream.mkString);
|
|
215
216
|
const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override) {
|
|
216
217
|
const handle = yield* ChildProcess.make("vp", [
|
|
217
218
|
"install",
|
|
@@ -225,7 +226,7 @@ const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override
|
|
|
225
226
|
extendEnv: true,
|
|
226
227
|
stdin: "ignore"
|
|
227
228
|
});
|
|
228
|
-
const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], { concurrency: "unbounded" });
|
|
229
|
+
const [output, status] = yield* Effect.all([textOf$1(handle.all), handle.exitCode], { concurrency: "unbounded" });
|
|
229
230
|
if (Number(status) !== SUCCEEDED$1) return yield* OverrideResolutionFailed.make({
|
|
230
231
|
override,
|
|
231
232
|
output
|
|
@@ -242,7 +243,7 @@ const auditIn = Effect.fn("auditIn")(function* auditIn(directory) {
|
|
|
242
243
|
extendEnv: true,
|
|
243
244
|
stdin: "ignore"
|
|
244
245
|
});
|
|
245
|
-
const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], { concurrency: "unbounded" });
|
|
246
|
+
const [report] = yield* Effect.all([textOf$1(handle.stdout), handle.exitCode], { concurrency: "unbounded" });
|
|
246
247
|
return advisoriesIn(report);
|
|
247
248
|
}, Effect.scoped);
|
|
248
249
|
const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* trackedFiles(root) {
|
|
@@ -252,7 +253,7 @@ const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* tra
|
|
|
252
253
|
"--",
|
|
253
254
|
...RESOLUTION_FILES
|
|
254
255
|
], { cwd: root });
|
|
255
|
-
const listed = yield* textOf(handle.stdout);
|
|
256
|
+
const listed = yield* textOf$1(handle.stdout);
|
|
256
257
|
return pipe(String$1.split(listed, "\0"), Array.filter(String$1.isNonEmpty));
|
|
257
258
|
}, Effect.scoped);
|
|
258
259
|
const copyFiles = Effect.fn("copyFiles")(function* copyFiles(workspace, directory) {
|
|
@@ -324,10 +325,10 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
324
325
|
});
|
|
325
326
|
// src/shared/lib/scanned-files.ts
|
|
326
327
|
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
327
|
-
const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
328
|
+
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
328
329
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
329
|
-
const READ_CONCURRENCY$
|
|
330
|
-
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
|
|
330
|
+
const READ_CONCURRENCY$26 = 64;
|
|
331
|
+
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
331
332
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
332
333
|
/** @internal */
|
|
333
334
|
const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
|
|
@@ -349,18 +350,18 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
349
350
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
350
351
|
onNone: () => [],
|
|
351
352
|
onSome: (source) => problemsIn(entry, source)
|
|
352
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
353
|
+
}))), { concurrency: READ_CONCURRENCY$26 });
|
|
353
354
|
return Array.flatten(found);
|
|
354
355
|
});
|
|
355
356
|
// src/features/check-overrides/model/git-subpath.ts
|
|
356
357
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
357
358
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
358
|
-
const RULE$
|
|
359
|
+
const RULE$40 = "git-subpath-dependency";
|
|
359
360
|
const WHOLE_MATCH$3 = 0;
|
|
360
361
|
const problemAt$8 = ({ file }, source) => (found) => ({
|
|
361
362
|
file,
|
|
362
363
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
363
|
-
rule: RULE$
|
|
364
|
+
rule: RULE$40,
|
|
364
365
|
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])}\`.`
|
|
365
366
|
});
|
|
366
367
|
const problemsIn$15 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$8(entry, source)));
|
|
@@ -371,13 +372,13 @@ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(r
|
|
|
371
372
|
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$15);
|
|
372
373
|
});
|
|
373
374
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
374
|
-
const RULE$
|
|
375
|
+
const RULE$39 = "unnamed-restriction";
|
|
375
376
|
const WHOLE_MATCH$2 = 0;
|
|
376
377
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
377
378
|
const problemsIn$14 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
378
379
|
file: entry.file,
|
|
379
380
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
380
|
-
rule: RULE$
|
|
381
|
+
rule: RULE$39,
|
|
381
382
|
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.`
|
|
382
383
|
})));
|
|
383
384
|
/** @internal */
|
|
@@ -386,7 +387,7 @@ const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRe
|
|
|
386
387
|
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$14);
|
|
387
388
|
});
|
|
388
389
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
389
|
-
const RULE$
|
|
390
|
+
const RULE$38 = "colocated-git-patterns";
|
|
390
391
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
391
392
|
const ROOT$2 = ".";
|
|
392
393
|
const SEPARATOR$21 = "/";
|
|
@@ -397,8 +398,8 @@ const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$21}`;
|
|
|
397
398
|
const LEADING_SLASHES = /^\/+/u;
|
|
398
399
|
const TRAILING_SLASHES = /\/+$/u;
|
|
399
400
|
const SPACES = /\s+/u;
|
|
400
|
-
const FIRST$
|
|
401
|
-
const READ_CONCURRENCY$
|
|
401
|
+
const FIRST$19 = 1;
|
|
402
|
+
const READ_CONCURRENCY$25 = 16;
|
|
402
403
|
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$21}`)(inner));
|
|
403
404
|
const withoutPrefix = (prefix, text) => {
|
|
404
405
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
@@ -423,7 +424,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
|
423
424
|
file,
|
|
424
425
|
kind,
|
|
425
426
|
directory,
|
|
426
|
-
line: index + FIRST$
|
|
427
|
+
line: index + FIRST$19,
|
|
427
428
|
pattern,
|
|
428
429
|
values: Array.join(values, " ")
|
|
429
430
|
});
|
|
@@ -438,12 +439,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
438
439
|
const problemAt$7 = (entry, message) => ({
|
|
439
440
|
file: entry.file,
|
|
440
441
|
line: entry.line,
|
|
441
|
-
column: FIRST$
|
|
442
|
-
rule: RULE$
|
|
442
|
+
column: FIRST$19,
|
|
443
|
+
rule: RULE$38,
|
|
443
444
|
message
|
|
444
445
|
});
|
|
445
446
|
const misplacedMessage = (kind, workspaces) => {
|
|
446
|
-
if (workspaces.length === FIRST$
|
|
447
|
+
if (workspaces.length === FIRST$19) {
|
|
447
448
|
const workspace = Array.join(workspaces, "");
|
|
448
449
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
449
450
|
}
|
|
@@ -493,17 +494,17 @@ const repeated = (entries) => (entry) => {
|
|
|
493
494
|
/** @internal */
|
|
494
495
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
495
496
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
496
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
497
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$25 });
|
|
497
498
|
const entries = Array.flatten(read);
|
|
498
499
|
const workspaces = yield* workspaceDirectories(root);
|
|
499
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
500
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$25 });
|
|
500
501
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
501
502
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
502
503
|
});
|
|
503
504
|
// src/features/check-placement/model/colocated-tests.ts
|
|
504
|
-
const RULE$
|
|
505
|
-
const FIRST$
|
|
506
|
-
const READ_CONCURRENCY$
|
|
505
|
+
const RULE$37 = "colocated-test";
|
|
506
|
+
const FIRST$18 = 1;
|
|
507
|
+
const READ_CONCURRENCY$24 = 64;
|
|
507
508
|
const ROOT_SUBPATH = ".";
|
|
508
509
|
const NAME_GROUP = "name";
|
|
509
510
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -527,9 +528,9 @@ const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manife
|
|
|
527
528
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
528
529
|
const problemFor$6 = (test, message) => ({
|
|
529
530
|
file: test.file,
|
|
530
|
-
line: FIRST$
|
|
531
|
-
column: FIRST$
|
|
532
|
-
rule: RULE$
|
|
531
|
+
line: FIRST$18,
|
|
532
|
+
column: FIRST$18,
|
|
533
|
+
rule: RULE$37,
|
|
533
534
|
message: `${test.base} ${message}`
|
|
534
535
|
});
|
|
535
536
|
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);
|
|
@@ -568,7 +569,7 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
568
569
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
569
570
|
});
|
|
570
571
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
571
|
-
const problemIn$
|
|
572
|
+
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
572
573
|
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$6(test, DIRECTORY_MESSAGE));
|
|
573
574
|
if (!TEST_FILE$1.test(test.name)) return Option.none();
|
|
574
575
|
if (yield* refersIn(context, test)) return Option.none();
|
|
@@ -592,12 +593,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
592
593
|
directory: files.dirname(file)
|
|
593
594
|
};
|
|
594
595
|
}));
|
|
595
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$
|
|
596
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$24 });
|
|
596
597
|
return Array.getSomes(found);
|
|
597
598
|
});
|
|
598
599
|
// src/shared/lib/agent-docs.ts
|
|
599
600
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
600
|
-
const READ_CONCURRENCY$
|
|
601
|
+
const READ_CONCURRENCY$23 = 16;
|
|
601
602
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
602
603
|
const files = yield* RepositoryFiles;
|
|
603
604
|
const listed = yield* files.listedFiles(root);
|
|
@@ -606,31 +607,31 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
606
607
|
const file = files.join(root, name);
|
|
607
608
|
const problemOf = Option.flatMap(problemIn(file));
|
|
608
609
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
609
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
610
|
+
}, { concurrency: READ_CONCURRENCY$23 });
|
|
610
611
|
return Array.getSomes(found);
|
|
611
612
|
});
|
|
612
613
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
613
614
|
const RECOMMENDED_LINES = 200;
|
|
614
|
-
const FIRST$
|
|
615
|
-
const RULE$
|
|
615
|
+
const FIRST$17 = 1;
|
|
616
|
+
const RULE$36 = "agent-docs-length";
|
|
616
617
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
617
618
|
const problemFor$5 = (file) => (lines) => {
|
|
618
619
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
619
620
|
return Option.some({
|
|
620
621
|
file,
|
|
621
622
|
line: 201,
|
|
622
|
-
column: FIRST$
|
|
623
|
-
rule: RULE$
|
|
623
|
+
column: FIRST$17,
|
|
624
|
+
rule: RULE$36,
|
|
624
625
|
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.`
|
|
625
626
|
});
|
|
626
627
|
};
|
|
627
628
|
/** @internal */
|
|
628
629
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
|
|
629
630
|
// src/features/check-placement/model/dangling-links.ts
|
|
630
|
-
const RULE$
|
|
631
|
+
const RULE$35 = "dangling-link";
|
|
631
632
|
const SEPARATOR$20 = "/";
|
|
632
|
-
const FIRST$
|
|
633
|
-
const READ_CONCURRENCY$
|
|
633
|
+
const FIRST$16 = 1;
|
|
634
|
+
const READ_CONCURRENCY$22 = 16;
|
|
634
635
|
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
|
|
635
636
|
/** @internal */
|
|
636
637
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
@@ -641,21 +642,21 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
641
642
|
const link = yield* files.readLink(file);
|
|
642
643
|
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) => ({
|
|
643
644
|
file,
|
|
644
|
-
line: FIRST$
|
|
645
|
-
column: FIRST$
|
|
646
|
-
rule: RULE$
|
|
645
|
+
line: FIRST$16,
|
|
646
|
+
column: FIRST$16,
|
|
647
|
+
rule: RULE$35,
|
|
647
648
|
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.`
|
|
648
649
|
})));
|
|
649
650
|
});
|
|
650
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
651
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$22 });
|
|
651
652
|
return Array.getSomes(found);
|
|
652
653
|
});
|
|
653
654
|
// src/features/check-placement/model/nested-docs.ts
|
|
654
|
-
const RULE$
|
|
655
|
+
const RULE$34 = "nested-docs";
|
|
655
656
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
656
657
|
const SEPARATOR$19 = "/";
|
|
657
|
-
const FIRST$
|
|
658
|
-
const READ_CONCURRENCY$
|
|
658
|
+
const FIRST$15 = 1;
|
|
659
|
+
const READ_CONCURRENCY$21 = 64;
|
|
659
660
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
660
661
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
661
662
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
@@ -665,9 +666,9 @@ var RootConfigUnreadable = class extends taggedError$4()("RootConfigUnreadable",
|
|
|
665
666
|
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
666
667
|
const problemFor$4 = (file, message) => ({
|
|
667
668
|
file,
|
|
668
|
-
line: FIRST$
|
|
669
|
-
column: FIRST$
|
|
670
|
-
rule: RULE$
|
|
669
|
+
line: FIRST$15,
|
|
670
|
+
column: FIRST$15,
|
|
671
|
+
rule: RULE$34,
|
|
671
672
|
message
|
|
672
673
|
});
|
|
673
674
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
@@ -682,7 +683,7 @@ const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
|
682
683
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
683
684
|
return Option.some(problemFor$4(file, `${base} ${README_MESSAGE}`));
|
|
684
685
|
};
|
|
685
|
-
const problemIn$
|
|
686
|
+
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
686
687
|
const files = yield* RepositoryFiles;
|
|
687
688
|
const file = files.join(root, name);
|
|
688
689
|
const doc = {
|
|
@@ -714,16 +715,42 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
714
715
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
715
716
|
workspaceAgentDocs
|
|
716
717
|
};
|
|
717
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$
|
|
718
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$21 });
|
|
719
|
+
return Array.getSomes(found);
|
|
720
|
+
});
|
|
721
|
+
// src/features/check-placement/model/published-readme.ts
|
|
722
|
+
const RULE$33 = "published-readme";
|
|
723
|
+
const README_FILE = "README.md";
|
|
724
|
+
const READ_CONCURRENCY$20 = 16;
|
|
725
|
+
const MESSAGE$11 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
726
|
+
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
727
|
+
const files = yield* RepositoryFiles;
|
|
728
|
+
const file = files.join(root, directory, README_FILE);
|
|
729
|
+
const text = yield* files.readFile(file);
|
|
730
|
+
return pipe(text, Option.flatMap((source) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
731
|
+
const { line, column } = positionOf(source)(found.index);
|
|
732
|
+
return {
|
|
733
|
+
file,
|
|
734
|
+
line,
|
|
735
|
+
column,
|
|
736
|
+
rule: RULE$33,
|
|
737
|
+
message: MESSAGE$11
|
|
738
|
+
};
|
|
739
|
+
}))));
|
|
740
|
+
});
|
|
741
|
+
/** @internal */
|
|
742
|
+
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
743
|
+
const projects = yield* publishedProjects(root);
|
|
744
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$20 });
|
|
718
745
|
return Array.getSomes(found);
|
|
719
746
|
});
|
|
720
747
|
// src/features/check-placement/model/root-docs.ts
|
|
721
|
-
const RULE$
|
|
748
|
+
const RULE$32 = "root-docs";
|
|
722
749
|
const SEPARATOR$18 = "/";
|
|
723
|
-
const FIRST$
|
|
750
|
+
const FIRST$14 = 1;
|
|
724
751
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
725
752
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
726
|
-
const MESSAGE$
|
|
753
|
+
const MESSAGE$10 = "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.";
|
|
727
754
|
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
728
755
|
/** @internal */
|
|
729
756
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
@@ -731,14 +758,14 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
731
758
|
const names = yield* files.listedFiles(root);
|
|
732
759
|
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
733
760
|
file: files.join(root, name),
|
|
734
|
-
line: FIRST$
|
|
735
|
-
column: FIRST$
|
|
736
|
-
rule: RULE$
|
|
737
|
-
message: `${name} ${MESSAGE$
|
|
761
|
+
line: FIRST$14,
|
|
762
|
+
column: FIRST$14,
|
|
763
|
+
rule: RULE$32,
|
|
764
|
+
message: `${name} ${MESSAGE$10}`
|
|
738
765
|
})));
|
|
739
766
|
});
|
|
740
767
|
// src/features/check-placement/model/root-readme.ts
|
|
741
|
-
const RULE$
|
|
768
|
+
const RULE$31 = "root-readme";
|
|
742
769
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
743
770
|
const READ_CONCURRENCY$19 = 16;
|
|
744
771
|
const START$13 = 0;
|
|
@@ -787,7 +814,7 @@ const problemsIn$13 = (file, source, plugins) => (workspace) => {
|
|
|
787
814
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
788
815
|
file,
|
|
789
816
|
...at(found.index ?? START$13),
|
|
790
|
-
rule: RULE$
|
|
817
|
+
rule: RULE$31,
|
|
791
818
|
message
|
|
792
819
|
})));
|
|
793
820
|
};
|
|
@@ -817,12 +844,13 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
817
844
|
checkRootReadme(root),
|
|
818
845
|
checkRootDocs(root),
|
|
819
846
|
checkAgentDocsLength(root),
|
|
820
|
-
checkDanglingLinks(root)
|
|
847
|
+
checkDanglingLinks(root),
|
|
848
|
+
checkPublishedReadme(root)
|
|
821
849
|
], { concurrency: "unbounded" });
|
|
822
850
|
return Array.flatten(found);
|
|
823
851
|
});
|
|
824
852
|
// src/features/check-placement/model/docs-mirror.ts
|
|
825
|
-
const RULE$
|
|
853
|
+
const RULE$30 = "docs-mirror";
|
|
826
854
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
827
855
|
const MIRROR_LIMIT = 3;
|
|
828
856
|
const READ_CONCURRENCY$18 = 16;
|
|
@@ -847,7 +875,7 @@ const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
847
875
|
file,
|
|
848
876
|
line,
|
|
849
877
|
column,
|
|
850
|
-
rule: RULE$
|
|
878
|
+
rule: RULE$30,
|
|
851
879
|
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.`
|
|
852
880
|
};
|
|
853
881
|
}), Option.toArray);
|
|
@@ -879,25 +907,25 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
879
907
|
return Array.flatten(found);
|
|
880
908
|
});
|
|
881
909
|
// src/features/check-placement/model/ignored-sources.ts
|
|
882
|
-
const RULE$
|
|
910
|
+
const RULE$29 = "ignored-sources";
|
|
883
911
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
884
|
-
const FIRST$
|
|
885
|
-
const MESSAGE$
|
|
912
|
+
const FIRST$13 = 1;
|
|
913
|
+
const MESSAGE$9 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
886
914
|
/** @internal */
|
|
887
915
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
888
916
|
const files = yield* RepositoryFiles;
|
|
889
917
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
890
918
|
return pipe(ignored, Array.map((file) => ({
|
|
891
919
|
file: files.join(root, file),
|
|
892
|
-
line: FIRST$
|
|
893
|
-
column: FIRST$
|
|
894
|
-
rule: RULE$
|
|
895
|
-
message: MESSAGE$
|
|
920
|
+
line: FIRST$13,
|
|
921
|
+
column: FIRST$13,
|
|
922
|
+
rule: RULE$29,
|
|
923
|
+
message: MESSAGE$9
|
|
896
924
|
})));
|
|
897
925
|
});
|
|
898
926
|
// src/features/check-placement/model/member-sources.ts
|
|
899
927
|
const ROOT_WORKSPACE$1 = ".";
|
|
900
|
-
const FIRST$
|
|
928
|
+
const FIRST$12 = 1;
|
|
901
929
|
const SEPARATOR$16 = "/";
|
|
902
930
|
const EXCLUDED$2 = [
|
|
903
931
|
":(exclude,attr:linguist-vendored)",
|
|
@@ -918,8 +946,8 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
918
946
|
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
919
947
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
920
948
|
file,
|
|
921
|
-
line: FIRST$
|
|
922
|
-
column: FIRST$
|
|
949
|
+
line: FIRST$12,
|
|
950
|
+
column: FIRST$12,
|
|
923
951
|
rule,
|
|
924
952
|
message
|
|
925
953
|
});
|
|
@@ -985,7 +1013,7 @@ const checkLayeredSource = Effect.fn("checkLayeredSource")(function* checkLayere
|
|
|
985
1013
|
});
|
|
986
1014
|
// src/features/check-placement/model/source-aliases.ts
|
|
987
1015
|
const ALIAS_RULE = "source-alias";
|
|
988
|
-
const FIRST$
|
|
1016
|
+
const FIRST$11 = 1;
|
|
989
1017
|
const SOURCE_ALIAS = "#/*";
|
|
990
1018
|
const SOURCE_TARGET = "./src/*";
|
|
991
1019
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
@@ -994,8 +1022,8 @@ const Manifest$2 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
|
994
1022
|
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
995
1023
|
const problemAt$6 = (file, rule, message) => ({
|
|
996
1024
|
file,
|
|
997
|
-
line: FIRST$
|
|
998
|
-
column: FIRST$
|
|
1025
|
+
line: FIRST$11,
|
|
1026
|
+
column: FIRST$11,
|
|
999
1027
|
rule,
|
|
1000
1028
|
message
|
|
1001
1029
|
});
|
|
@@ -9511,7 +9539,7 @@ const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
|
9511
9539
|
const SEPARATOR$13 = "/";
|
|
9512
9540
|
const CURRENT = "./";
|
|
9513
9541
|
const READ_CONCURRENCY$17 = 8;
|
|
9514
|
-
const FIRST$
|
|
9542
|
+
const FIRST$10 = 1;
|
|
9515
9543
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
9516
9544
|
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9517
9545
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
@@ -9587,8 +9615,8 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
9587
9615
|
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
9588
9616
|
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
9589
9617
|
file: files.join(root, directory, path),
|
|
9590
|
-
line: FIRST$
|
|
9591
|
-
column: FIRST$
|
|
9618
|
+
line: FIRST$10,
|
|
9619
|
+
column: FIRST$10,
|
|
9592
9620
|
rule: UNRUN,
|
|
9593
9621
|
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.`
|
|
9594
9622
|
})));
|
|
@@ -9600,8 +9628,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
9600
9628
|
const isDirectory = yield* files.isDirectory(file);
|
|
9601
9629
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
9602
9630
|
file,
|
|
9603
|
-
line: FIRST$
|
|
9604
|
-
column: FIRST$
|
|
9631
|
+
line: FIRST$10,
|
|
9632
|
+
column: FIRST$10,
|
|
9605
9633
|
rule: SCRIPTS,
|
|
9606
9634
|
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.`
|
|
9607
9635
|
})));
|
|
@@ -9615,11 +9643,11 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
9615
9643
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
9616
9644
|
});
|
|
9617
9645
|
// src/features/check-repository-layout/model/crates.ts
|
|
9618
|
-
const RULE$
|
|
9646
|
+
const RULE$28 = "unverified-crate";
|
|
9619
9647
|
const CARGO_FILE = "Cargo.toml";
|
|
9620
9648
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
9621
9649
|
const SEPARATOR$12 = "/";
|
|
9622
|
-
const FIRST$
|
|
9650
|
+
const FIRST$9 = 1;
|
|
9623
9651
|
const READ_CONCURRENCY$16 = 8;
|
|
9624
9652
|
const CrateEntry = Schema.Struct({
|
|
9625
9653
|
name: Schema.String,
|
|
@@ -9651,9 +9679,9 @@ const owningWorkspace = (directories) => (directory) => {
|
|
|
9651
9679
|
};
|
|
9652
9680
|
const problemFor$2 = (crate, message) => ({
|
|
9653
9681
|
file: crate.manifest,
|
|
9654
|
-
line: FIRST$
|
|
9655
|
-
column: FIRST$
|
|
9656
|
-
rule: RULE$
|
|
9682
|
+
line: FIRST$9,
|
|
9683
|
+
column: FIRST$9,
|
|
9684
|
+
rule: RULE$28,
|
|
9657
9685
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
9658
9686
|
});
|
|
9659
9687
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -9673,7 +9701,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
9673
9701
|
return Array.getSomes(found);
|
|
9674
9702
|
});
|
|
9675
9703
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
9676
|
-
const RULE$
|
|
9704
|
+
const RULE$27 = "deploy-entry-pattern";
|
|
9677
9705
|
const FALLOW_KEYS = [
|
|
9678
9706
|
"entry",
|
|
9679
9707
|
"entryPoints",
|
|
@@ -9692,7 +9720,7 @@ const ROOT_WORKSPACE = ".";
|
|
|
9692
9720
|
const WRAP_OFFSET$1 = 1;
|
|
9693
9721
|
const NO_OFFSET = 0;
|
|
9694
9722
|
const READ_CONCURRENCY$15 = 8;
|
|
9695
|
-
const MESSAGE$
|
|
9723
|
+
const MESSAGE$8 = "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.";
|
|
9696
9724
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
9697
9725
|
const FALLOW = {
|
|
9698
9726
|
keys: FALLOW_KEYS,
|
|
@@ -9744,8 +9772,8 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
9744
9772
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
9745
9773
|
file: path,
|
|
9746
9774
|
...positionOf(text.value)(start - kind.offset),
|
|
9747
|
-
rule: RULE$
|
|
9748
|
-
message: `${pattern} ${MESSAGE$
|
|
9775
|
+
rule: RULE$27,
|
|
9776
|
+
message: `${pattern} ${MESSAGE$8}`
|
|
9749
9777
|
})));
|
|
9750
9778
|
});
|
|
9751
9779
|
/** @internal */
|
|
@@ -9777,7 +9805,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
9777
9805
|
return Array.flatten(found);
|
|
9778
9806
|
});
|
|
9779
9807
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
9780
|
-
const RULE$
|
|
9808
|
+
const RULE$26 = "listed-entry";
|
|
9781
9809
|
const ENTRY_KEYS = [
|
|
9782
9810
|
"entry",
|
|
9783
9811
|
"entryPoints",
|
|
@@ -9807,7 +9835,7 @@ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
9807
9835
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
9808
9836
|
file: path,
|
|
9809
9837
|
...positionOf(text.value)(start),
|
|
9810
|
-
rule: RULE$
|
|
9838
|
+
rule: RULE$26,
|
|
9811
9839
|
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.`
|
|
9812
9840
|
})));
|
|
9813
9841
|
});
|
|
@@ -9819,9 +9847,9 @@ const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallow
|
|
|
9819
9847
|
return Array.flatten(found);
|
|
9820
9848
|
});
|
|
9821
9849
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
9822
|
-
const RULE$
|
|
9850
|
+
const RULE$25 = "hidden-verify";
|
|
9823
9851
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
9824
|
-
const FIRST$
|
|
9852
|
+
const FIRST$8 = 1;
|
|
9825
9853
|
const READ_CONCURRENCY$13 = 8;
|
|
9826
9854
|
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
9827
9855
|
const config = yield* workspaceConfigOf(root, directory);
|
|
@@ -9831,9 +9859,9 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
9831
9859
|
const verified = yield* hasVerifyTask(file);
|
|
9832
9860
|
return Option.some({
|
|
9833
9861
|
file,
|
|
9834
|
-
line: FIRST$
|
|
9835
|
-
column: FIRST$
|
|
9836
|
-
rule: RULE$
|
|
9862
|
+
line: FIRST$8,
|
|
9863
|
+
column: FIRST$8,
|
|
9864
|
+
rule: RULE$25,
|
|
9837
9865
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$3}. The root verify reads ${CONFIG_FILE$3} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$3}.`
|
|
9838
9866
|
}).pipe(Option.filter(() => verified));
|
|
9839
9867
|
});
|
|
@@ -9844,11 +9872,11 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
9844
9872
|
return Array.getSomes(found);
|
|
9845
9873
|
});
|
|
9846
9874
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
9847
|
-
const RULE$
|
|
9875
|
+
const RULE$24 = "root-workspace-path";
|
|
9848
9876
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
9849
9877
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
9850
9878
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
9851
|
-
const FIRST$
|
|
9879
|
+
const FIRST$7 = 0;
|
|
9852
9880
|
const NEXT$2 = 1;
|
|
9853
9881
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
9854
9882
|
const mentions$1 = (directory) => (text) => {
|
|
@@ -9856,14 +9884,14 @@ const mentions$1 = (directory) => (text) => {
|
|
|
9856
9884
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
9857
9885
|
const before = parts[index] ?? "";
|
|
9858
9886
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
9859
|
-
const following = String$1.slice(FIRST$
|
|
9887
|
+
const following = String$1.slice(FIRST$7, NEXT$2)(after);
|
|
9860
9888
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
9861
9889
|
}));
|
|
9862
9890
|
};
|
|
9863
9891
|
const problemsIn$9 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions$1(directory)(found.text)), Array.map((directory) => ({
|
|
9864
9892
|
file,
|
|
9865
9893
|
...positionOf(source)(found.start),
|
|
9866
|
-
rule: RULE$
|
|
9894
|
+
rule: RULE$24,
|
|
9867
9895
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$2} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$2}: msch.lint, msch.devDependencies or its verify task.`
|
|
9868
9896
|
})));
|
|
9869
9897
|
/** @internal */
|
|
@@ -9877,7 +9905,7 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
9877
9905
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$9(file, source.value, directories)));
|
|
9878
9906
|
});
|
|
9879
9907
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
9880
|
-
const RULE$
|
|
9908
|
+
const RULE$23 = "shared-uncached-task";
|
|
9881
9909
|
const READ_CONCURRENCY$12 = 8;
|
|
9882
9910
|
const SHARED = 2;
|
|
9883
9911
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -9920,7 +9948,7 @@ const problemsOf$2 = (definitions) => {
|
|
|
9920
9948
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
9921
9949
|
file,
|
|
9922
9950
|
...position,
|
|
9923
|
-
rule: RULE$
|
|
9951
|
+
rule: RULE$23,
|
|
9924
9952
|
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.`
|
|
9925
9953
|
})));
|
|
9926
9954
|
};
|
|
@@ -10066,13 +10094,13 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10066
10094
|
/** @internal */
|
|
10067
10095
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10068
10096
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10069
|
-
const RULE$
|
|
10097
|
+
const RULE$22 = "workflow-path";
|
|
10070
10098
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10071
10099
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10072
10100
|
const READ_CONCURRENCY$11 = 8;
|
|
10073
10101
|
const WILDCARD$2 = /[*?[]/u;
|
|
10074
10102
|
const SEPARATOR$9 = "/";
|
|
10075
|
-
const FIRST$
|
|
10103
|
+
const FIRST$6 = 0;
|
|
10076
10104
|
const EXPECTED = {
|
|
10077
10105
|
action: "a directory with action.yml",
|
|
10078
10106
|
directory: "a directory",
|
|
@@ -10113,7 +10141,7 @@ const RESOLVERS = {
|
|
|
10113
10141
|
};
|
|
10114
10142
|
const staticPrefix = (path) => {
|
|
10115
10143
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10116
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$
|
|
10144
|
+
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$6, -1)(prefix);
|
|
10117
10145
|
return prefix;
|
|
10118
10146
|
};
|
|
10119
10147
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -10132,7 +10160,7 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
10132
10160
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10133
10161
|
file,
|
|
10134
10162
|
...positionOf(source)(found.offset),
|
|
10135
|
-
rule: RULE$
|
|
10163
|
+
rule: RULE$22,
|
|
10136
10164
|
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.`
|
|
10137
10165
|
});
|
|
10138
10166
|
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -10259,6 +10287,42 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10259
10287
|
], { concurrency: "unbounded" });
|
|
10260
10288
|
return Array.flatten(found);
|
|
10261
10289
|
});
|
|
10290
|
+
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
10291
|
+
const RULE$21 = "legacy-typescript";
|
|
10292
|
+
const LOCKFILE = "pnpm-lock.yaml";
|
|
10293
|
+
const COMPILER = "typescript";
|
|
10294
|
+
const CURRENT_MAJOR = 7;
|
|
10295
|
+
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
10296
|
+
const FIRST$5 = 1;
|
|
10297
|
+
const legacyOf = (id) => {
|
|
10298
|
+
const { name, version } = parse$1(id);
|
|
10299
|
+
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
10300
|
+
return pipe(Option.fromNullishOr(name), Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? "")), Option.map((found) => ({
|
|
10301
|
+
id,
|
|
10302
|
+
name: found
|
|
10303
|
+
})));
|
|
10304
|
+
};
|
|
10305
|
+
const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
|
|
10306
|
+
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
10307
|
+
onNone: () => FIRST$5,
|
|
10308
|
+
onSome: (index) => index + FIRST$5
|
|
10309
|
+
}));
|
|
10310
|
+
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)}.`;
|
|
10311
|
+
/** @internal */
|
|
10312
|
+
const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(function* checkTypescriptGeneration(root) {
|
|
10313
|
+
const files = yield* RepositoryFiles;
|
|
10314
|
+
const file = files.join(root, LOCKFILE);
|
|
10315
|
+
const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
10316
|
+
const read = yield* files.readFile(file);
|
|
10317
|
+
const source = Option.getOrElse(read, () => "");
|
|
10318
|
+
return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
|
|
10319
|
+
file,
|
|
10320
|
+
line: lineOf$2(source)(legacy.id),
|
|
10321
|
+
column: FIRST$5,
|
|
10322
|
+
rule: RULE$21,
|
|
10323
|
+
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
10324
|
+
})));
|
|
10325
|
+
});
|
|
10262
10326
|
// src/shared/lib/values.ts
|
|
10263
10327
|
const SCHEMA_TYPE_PROPERTIES = ["Type", "_output"];
|
|
10264
10328
|
const MINIMUM_SET_SIZE = 2;
|
|
@@ -11071,7 +11135,7 @@ const ownerOf$1 = (project) => (annotated) => {
|
|
|
11071
11135
|
key,
|
|
11072
11136
|
name: node.name.getText(),
|
|
11073
11137
|
file: node.getSourceFile().fileName,
|
|
11074
|
-
line: lineOf$
|
|
11138
|
+
line: lineOf$3(node),
|
|
11075
11139
|
column: columnOf(node),
|
|
11076
11140
|
packageName: project.packageName,
|
|
11077
11141
|
values: ownedValues
|
|
@@ -11519,7 +11583,7 @@ const unownedSiteOf = (scope) => (site) => ({
|
|
|
11519
11583
|
scope,
|
|
11520
11584
|
file: site.node.getSourceFile().fileName,
|
|
11521
11585
|
start: site.node.getStart(),
|
|
11522
|
-
line: lineOf$
|
|
11586
|
+
line: lineOf$3(site.node),
|
|
11523
11587
|
column: columnOf(site.node),
|
|
11524
11588
|
values: site.values
|
|
11525
11589
|
});
|
|
@@ -11546,7 +11610,7 @@ const duplicateProblems = (relative) => (sites) => {
|
|
|
11546
11610
|
}))));
|
|
11547
11611
|
};
|
|
11548
11612
|
// src/features/check-value-owners/model/name-lists.ts
|
|
11549
|
-
const RULE$
|
|
11613
|
+
const RULE$20 = "hand-written-names";
|
|
11550
11614
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11551
11615
|
const nameListOf = (site) => {
|
|
11552
11616
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -11561,7 +11625,7 @@ const problemOf$6 = ({ list, reason }) => ({
|
|
|
11561
11625
|
file: list.site.file,
|
|
11562
11626
|
line: list.site.line,
|
|
11563
11627
|
column: list.site.column,
|
|
11564
|
-
rule: RULE$
|
|
11628
|
+
rule: RULE$20,
|
|
11565
11629
|
message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
|
|
11566
11630
|
});
|
|
11567
11631
|
// src/features/check-value-owners/model/declared-names.ts
|
|
@@ -11788,7 +11852,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
11788
11852
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
11789
11853
|
}, Effect.scoped);
|
|
11790
11854
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
11791
|
-
const RULE$
|
|
11855
|
+
const RULE$19 = "namespace-destructuring";
|
|
11792
11856
|
const LOCAL = /^[.#/]/u;
|
|
11793
11857
|
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.`;
|
|
11794
11858
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -11804,7 +11868,7 @@ const destructuredName = (declaration) => {
|
|
|
11804
11868
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
11805
11869
|
};
|
|
11806
11870
|
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
|
|
11807
|
-
rule: RULE$
|
|
11871
|
+
rule: RULE$19,
|
|
11808
11872
|
message: messageOf$1(name)
|
|
11809
11873
|
})), Option.map((report) => report(declaration)));
|
|
11810
11874
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -11812,7 +11876,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
11812
11876
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
11813
11877
|
};
|
|
11814
11878
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
11815
|
-
const RULE$
|
|
11879
|
+
const RULE$18 = "pass-through-wrapper";
|
|
11816
11880
|
const SINGLE_STATEMENT = 1;
|
|
11817
11881
|
const SINGLE_DECLARATION = 1;
|
|
11818
11882
|
const THIS_PARAMETER = "this";
|
|
@@ -11909,7 +11973,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
11909
11973
|
const problemOf$4 = (checker) => (candidate) => {
|
|
11910
11974
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
11911
11975
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$9({
|
|
11912
|
-
rule: RULE$
|
|
11976
|
+
rule: RULE$18,
|
|
11913
11977
|
message: messageOf(forward.callee.getText())
|
|
11914
11978
|
})(candidate.name)));
|
|
11915
11979
|
};
|
|
@@ -11918,7 +11982,7 @@ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(so
|
|
|
11918
11982
|
/** @internal */
|
|
11919
11983
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
|
|
11920
11984
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
11921
|
-
const RULE$
|
|
11985
|
+
const RULE$17 = "missing-hook";
|
|
11922
11986
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
11923
11987
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
11924
11988
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
@@ -11943,7 +12007,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
11943
12007
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
11944
12008
|
file,
|
|
11945
12009
|
...positionOf(source)(index),
|
|
11946
|
-
rule: RULE$
|
|
12010
|
+
rule: RULE$17,
|
|
11947
12011
|
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.`
|
|
11948
12012
|
})));
|
|
11949
12013
|
});
|
|
@@ -11977,8 +12041,8 @@ const EXTENSION = /\.[^./]+$/u;
|
|
|
11977
12041
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
11978
12042
|
const READ_CONCURRENCY$8 = 64;
|
|
11979
12043
|
const FIRST$4 = 1;
|
|
11980
|
-
const RULE$
|
|
11981
|
-
const MESSAGE$
|
|
12044
|
+
const RULE$16 = "shell-script";
|
|
12045
|
+
const MESSAGE$7 = "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.";
|
|
11982
12046
|
const HookSchema = Schema.Struct({
|
|
11983
12047
|
command: Schema.optional(Schema.String),
|
|
11984
12048
|
args: Schema.optional(Schema.Array(Schema.String))
|
|
@@ -12000,8 +12064,8 @@ const problemFor$1 = (file) => ({
|
|
|
12000
12064
|
file,
|
|
12001
12065
|
line: FIRST$4,
|
|
12002
12066
|
column: FIRST$4,
|
|
12003
|
-
rule: RULE$
|
|
12004
|
-
message: MESSAGE$
|
|
12067
|
+
rule: RULE$16,
|
|
12068
|
+
message: MESSAGE$7
|
|
12005
12069
|
});
|
|
12006
12070
|
/** @internal */
|
|
12007
12071
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
@@ -12053,9 +12117,9 @@ const runScriptsOf = (source) => {
|
|
|
12053
12117
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
12054
12118
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12055
12119
|
const COMMENT = "#";
|
|
12056
|
-
const RULE$
|
|
12120
|
+
const RULE$15 = "workflow-script";
|
|
12057
12121
|
const ONE_COMMAND = 1;
|
|
12058
|
-
const MESSAGE$
|
|
12122
|
+
const MESSAGE$6 = "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.";
|
|
12059
12123
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
12060
12124
|
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
12061
12125
|
const runsMoreThanOneCommand = ({ text }) => {
|
|
@@ -12067,8 +12131,8 @@ const problemsIn$6 = (file) => (source) => {
|
|
|
12067
12131
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
12068
12132
|
file,
|
|
12069
12133
|
...at(start),
|
|
12070
|
-
rule: RULE$
|
|
12071
|
-
message: MESSAGE$
|
|
12134
|
+
rule: RULE$15,
|
|
12135
|
+
message: MESSAGE$6
|
|
12072
12136
|
})));
|
|
12073
12137
|
};
|
|
12074
12138
|
/** @internal */
|
|
@@ -12294,7 +12358,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
12294
12358
|
return Array.flatten(found);
|
|
12295
12359
|
});
|
|
12296
12360
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
12297
|
-
const RULE$
|
|
12361
|
+
const RULE$14 = "package-script";
|
|
12298
12362
|
const LIFECYCLE = [
|
|
12299
12363
|
"preinstall",
|
|
12300
12364
|
"install",
|
|
@@ -12317,26 +12381,26 @@ const LIFECYCLE = [
|
|
|
12317
12381
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
12318
12382
|
file,
|
|
12319
12383
|
...position,
|
|
12320
|
-
rule: RULE$
|
|
12384
|
+
rule: RULE$14,
|
|
12321
12385
|
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.`
|
|
12322
12386
|
});
|
|
12323
12387
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
12324
12388
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
12325
|
-
const RULE$
|
|
12389
|
+
const RULE$13 = "vite-plus-block";
|
|
12326
12390
|
const MARKER = Array.join([
|
|
12327
12391
|
"<!--",
|
|
12328
12392
|
"VITE PLUS START",
|
|
12329
12393
|
"-->"
|
|
12330
12394
|
], "");
|
|
12331
|
-
const MESSAGE$
|
|
12395
|
+
const MESSAGE$5 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
|
|
12332
12396
|
const problemIn = (file) => (source) => {
|
|
12333
12397
|
const index = String$1.indexOf(MARKER)(source);
|
|
12334
12398
|
if (Option.isNone(index)) return Option.none();
|
|
12335
12399
|
return Option.some({
|
|
12336
12400
|
file,
|
|
12337
12401
|
...positionOf(source)(index.value),
|
|
12338
|
-
rule: RULE$
|
|
12339
|
-
message: MESSAGE$
|
|
12402
|
+
rule: RULE$13,
|
|
12403
|
+
message: MESSAGE$5
|
|
12340
12404
|
});
|
|
12341
12405
|
};
|
|
12342
12406
|
/** @internal */
|
|
@@ -12359,6 +12423,8 @@ const pairsNamed = (name) => (source) => {
|
|
|
12359
12423
|
} });
|
|
12360
12424
|
return found;
|
|
12361
12425
|
};
|
|
12426
|
+
const pairIn = (name) => (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMap((map) => Array.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === name)));
|
|
12427
|
+
const keyOffsetIn = (name) => (node) => pipe(pairIn(name)(node), Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)), Option.flatMap((key) => Option.fromNullishOr(key.range)), Option.map(([start]) => start));
|
|
12362
12428
|
const workflowCheck = ({ rule, message, offsetsOf }) => Effect.fn(rule)(function* checkWorkflows(root) {
|
|
12363
12429
|
const workflows = yield* readWorkflows(root);
|
|
12364
12430
|
return pipe(workflows, Array.flatMap(({ file, source }) => {
|
|
@@ -12378,22 +12444,44 @@ const workflowCheck = ({ rule, message, offsetsOf }) => Effect.fn(rule)(function
|
|
|
12378
12444
|
// src/features/check-workflows/model/full-history-checkout.ts
|
|
12379
12445
|
const DEPTH_KEY = "fetch-depth";
|
|
12380
12446
|
const WHOLE_HISTORY = "0";
|
|
12381
|
-
const RULE$
|
|
12382
|
-
const MESSAGE$
|
|
12447
|
+
const RULE$12 = "full-history-checkout";
|
|
12448
|
+
const MESSAGE$4 = "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.";
|
|
12383
12449
|
const fullHistoryOffsetsOf = (source) => pipe(pairsNamed(DEPTH_KEY)(source), Array.filter(({ value }) => isScalar(value) && String(value.value) === WHOLE_HISTORY), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)), Option.map(([start]) => start), Option.toArray)));
|
|
12384
12450
|
/** @internal */
|
|
12385
12451
|
const checkFullHistoryCheckout = workflowCheck({
|
|
12452
|
+
rule: RULE$12,
|
|
12453
|
+
message: MESSAGE$4,
|
|
12454
|
+
offsetsOf: fullHistoryOffsetsOf
|
|
12455
|
+
});
|
|
12456
|
+
// src/features/check-workflows/model/release-pr-auto-merge.ts
|
|
12457
|
+
const RULE$11 = "release-pr-auto-merge";
|
|
12458
|
+
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
12459
|
+
const AUTO_MERGE = /\bgh\s+pr\s+merge\b[^\n]*--auto\b/u;
|
|
12460
|
+
const MESSAGE$3 = "opens a release PR with release-please but no later step in the job turns on its auto-merge. The merge queue only moves PRs with auto-merge, so the release PR falls behind main and waits for someone. Add a step after it that runs `gh pr merge --auto --squash` on the PR from the action's `pr` output with the token that opened it.";
|
|
12461
|
+
const textOf = (node, name) => pipe(pairIn(name)(node), Option.flatMap(({ value }) => Option.liftPredicate(value, isScalar)), Option.map((scalar) => String(scalar.value)), Option.getOrElse(() => ""));
|
|
12462
|
+
const stepOf = (node) => {
|
|
12463
|
+
const inputs = Option.getOrUndefined(Option.map(pairIn("with")(node), ({ value }) => value));
|
|
12464
|
+
return {
|
|
12465
|
+
opensReleasePr: RELEASE_PLEASE.test(textOf(node, "uses")) && textOf(inputs, "skip-github-pull-request") !== "true",
|
|
12466
|
+
turnsOnAutoMerge: AUTO_MERGE.test(textOf(node, "run")),
|
|
12467
|
+
offset: keyOffsetIn("uses")(node)
|
|
12468
|
+
};
|
|
12469
|
+
};
|
|
12470
|
+
const stepsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map((seq) => pipe(seq.items, Array.map(stepOf))), Option.getOrElse(() => []));
|
|
12471
|
+
const unqueuedOffsetsOf = (steps) => pipe(steps, Array.flatMap((step, index) => pipe(step.offset, Option.filter(() => step.opensReleasePr && !Array.some(Array.drop(steps, index), (later) => later.turnsOnAutoMerge)), Option.toArray)));
|
|
12472
|
+
const releasePrOffsetsOf = (source) => pipe(pairsNamed("steps")(source), Array.flatMap(({ value }) => unqueuedOffsetsOf(stepsOf(value))));
|
|
12473
|
+
/** @internal */
|
|
12474
|
+
const checkReleasePrAutoMerge = workflowCheck({
|
|
12386
12475
|
rule: RULE$11,
|
|
12387
12476
|
message: MESSAGE$3,
|
|
12388
|
-
offsetsOf:
|
|
12477
|
+
offsetsOf: releasePrOffsetsOf
|
|
12389
12478
|
});
|
|
12390
12479
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
12391
12480
|
const CONCURRENCY_KEY = "concurrency";
|
|
12392
12481
|
const QUEUE_KEY = "queue";
|
|
12393
12482
|
const RULE$10 = "workflow-queue";
|
|
12394
12483
|
const MESSAGE$2 = "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.";
|
|
12395
|
-
const
|
|
12396
|
-
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(queueKeyOf(pair.value))));
|
|
12484
|
+
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
12397
12485
|
/** @internal */
|
|
12398
12486
|
const checkWorkflowQueues = workflowCheck({
|
|
12399
12487
|
rule: RULE$10,
|
|
@@ -12423,6 +12511,7 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
12423
12511
|
checkWorkflowQueues(root),
|
|
12424
12512
|
checkWorkflowCommits(root),
|
|
12425
12513
|
checkFullHistoryCheckout(root),
|
|
12514
|
+
checkReleasePrAutoMerge(root),
|
|
12426
12515
|
checkRestrictedRules(root)
|
|
12427
12516
|
], { concurrency: "unbounded" });
|
|
12428
12517
|
return Array.flatten(found);
|
|
@@ -12471,7 +12560,7 @@ const tomlComments = (source) => Effect.try({
|
|
|
12471
12560
|
const isSqlComment = (value) => isRecord(value) && (value["type"] === "line_comment" || value["type"] === "block_comment") && typeof value["text"] === "string" && Array.isArray(value["range"]);
|
|
12472
12561
|
const sqlComments = (source) => Effect.try({
|
|
12473
12562
|
try: () => {
|
|
12474
|
-
const program = parse$
|
|
12563
|
+
const program = parse$3(source, {
|
|
12475
12564
|
dialect: "sqlite",
|
|
12476
12565
|
includeComments: true,
|
|
12477
12566
|
includeRange: true,
|
|
@@ -13115,8 +13204,8 @@ const problemsIn$4 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
13115
13204
|
});
|
|
13116
13205
|
/** @internal */
|
|
13117
13206
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
13118
|
-
const projects = yield*
|
|
13119
|
-
const problems = yield* Effect.forEach(
|
|
13207
|
+
const projects = yield* publishedProjects(root);
|
|
13208
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$4(root, project), { concurrency: 1 });
|
|
13120
13209
|
return Array.flatten(problems);
|
|
13121
13210
|
});
|
|
13122
13211
|
// src/features/check-skills/model/skill-files.ts
|
|
@@ -13148,7 +13237,7 @@ const Frontmatter = Schema.Struct({
|
|
|
13148
13237
|
});
|
|
13149
13238
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
13150
13239
|
const offsetOf = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$3));
|
|
13151
|
-
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$
|
|
13240
|
+
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
13152
13241
|
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$3].length), Option.getOrElse(() => START$3));
|
|
13153
13242
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
13154
13243
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
@@ -13281,7 +13370,7 @@ const manifestEntries = (text) => {
|
|
|
13281
13370
|
};
|
|
13282
13371
|
const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
13283
13372
|
const workspaceEntries = (text) => {
|
|
13284
|
-
const settings = fieldsOf(Option.getOrUndefined(Option.liftThrowable(() => parse$
|
|
13373
|
+
const settings = fieldsOf(Option.getOrUndefined(Option.liftThrowable(() => parse$2(text))()));
|
|
13285
13374
|
return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings["catalogs"])];
|
|
13286
13375
|
};
|
|
13287
13376
|
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
|
|
@@ -13799,7 +13888,8 @@ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
|
|
|
13799
13888
|
checkPlacement(root),
|
|
13800
13889
|
checkPublishedPackages(root),
|
|
13801
13890
|
checkWorkspaces(root),
|
|
13802
|
-
checkToolUse(root)
|
|
13891
|
+
checkToolUse(root),
|
|
13892
|
+
checkTypescriptGeneration(root)
|
|
13803
13893
|
], { concurrency: "unbounded" });
|
|
13804
13894
|
return Array.flatten(found);
|
|
13805
13895
|
});
|