@r_masseater/msch 0.16.0 → 0.19.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/dist/{problem-xi8VIKs3.mjs → cli-contract-C0YCHq4g.mjs} +21 -5
- package/dist/cli-contract-C0YCHq4g.mjs.map +1 -0
- package/dist/cli.mjs +1230 -435
- package/dist/cli.mjs.map +1 -1
- package/dist/decision-rules.d.mts +3 -2
- package/dist/lint.d.mts +19 -10
- package/dist/lint.mjs +247 -178
- package/dist/lint.mjs.map +1 -1
- package/dist/oxlint.mjs +1 -1
- package/dist/{repository-files-BiKs7S7N.mjs → repository-files-B11FFAIk.mjs} +10 -3
- package/dist/repository-files-B11FFAIk.mjs.map +1 -0
- package/dist/{workspace-aMPb8EA_.mjs → workspace-CMPDXFWk.mjs} +64 -20
- package/dist/workspace-CMPDXFWk.mjs.map +1 -0
- package/dist/workspace-settings.mjs +2 -2
- package/package.json +3 -1
- package/skills/msch-checks/SKILL.md +22 -0
- package/dist/decision-rules-BFywSPLT.d.mts +0 -3
- package/dist/problem-xi8VIKs3.mjs.map +0 -1
- package/dist/repository-files-BiKs7S7N.mjs.map +0 -1
- package/dist/workspace-aMPb8EA_.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { i as
|
|
4
|
-
import {
|
|
2
|
+
import { A as dependencyEntries, C as propertyValue, D as publishedWorkspaces, M as workspaceDependencies, O as publicEntriesOf, S as nestedValues, _ as workspaceConfigOf, a as runTasksOf, b as keyName, c as VERIFY_TASK, i as workspaceDirectories, j as readManifest, k as MANIFEST_FILE, l as definesTask, s as RUN_TASKS, t as namedWorkspaces, u as hasVerifyTask, v as KeySchema, w as stringsIn, x as literalOf, y as childrenOf$2 } from "./workspace-CMPDXFWk.mjs";
|
|
3
|
+
import { $ as isPropertyAssignment, A as getNameOfDeclaration, B as isExportDeclaration, C as API, D as SyntaxKind, E as SignatureKind, F as isBlock, G as isInterfaceDeclaration, H as isFunctionExpression, I as isCallExpression, J as isNewExpression, K as isModuleBlock, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isPropertyAccessExpression, R as isElementAccessExpression, S as uniqueByReference, T as InternalSymbolName, U as isIdentifier, V as isFunctionDeclaration, W as isImportDeclaration, X as isObjectLiteralExpression, Y as isNumericLiteral, Z as isParenthesizedExpression, _ as lineOf, a as problemAt$1, at as isStringLiteral, b as resolvedSymbol, c as childrenOf$3, ct as isTypeReferenceNode, d as declarationsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as descendantsOf, ft as isVariableStatement, g as isTypeDeclaration, h as isGenericDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as columnOf, lt as isUnionTypeNode, m as isExternalDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as importedModulesOf, q as isModuleDeclaration, rt as isSourceFile, s as NODE_MODULES_SEGMENT, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as contains, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-C0YCHq4g.mjs";
|
|
4
|
+
import { a as groupOf, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-B11FFAIk.mjs";
|
|
5
5
|
import { t as COMMENT_DIRECTIVES } from "./comment-directives-WcDqvLwJ.mjs";
|
|
6
6
|
import { Array, Cause, 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";
|
|
7
7
|
import { ChildProcess } from "effect/process";
|
|
@@ -316,7 +316,7 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
|
|
|
316
316
|
return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
|
|
317
317
|
});
|
|
318
318
|
// src/entities/project/model/inputs.ts
|
|
319
|
-
const SEPARATOR$
|
|
319
|
+
const SEPARATOR$12 = "/";
|
|
320
320
|
const SCOPE_PREFIX$2 = "@";
|
|
321
321
|
const HIDDEN_PREFIX = ".";
|
|
322
322
|
const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
@@ -358,14 +358,14 @@ const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath)
|
|
|
358
358
|
const directories = yield* workspaceClosure(directory);
|
|
359
359
|
return {
|
|
360
360
|
directories,
|
|
361
|
-
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$
|
|
361
|
+
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$12}`))
|
|
362
362
|
};
|
|
363
363
|
});
|
|
364
364
|
const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
|
|
365
365
|
const files = yield* RepositoryFiles;
|
|
366
366
|
if (!String$1.startsWith(SCOPE_PREFIX$2)(name)) return [name];
|
|
367
367
|
const scoped = yield* files.readDirectory(files.join(modules, name));
|
|
368
|
-
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$
|
|
368
|
+
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$12}${entry}`));
|
|
369
369
|
});
|
|
370
370
|
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
371
371
|
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
@@ -398,10 +398,10 @@ const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath
|
|
|
398
398
|
});
|
|
399
399
|
});
|
|
400
400
|
// src/shared/lib/text-position.ts
|
|
401
|
-
const START$
|
|
401
|
+
const START$12 = 0;
|
|
402
402
|
const FIRST_COLUMN$3 = 1;
|
|
403
403
|
const positionOf = (source) => (index) => {
|
|
404
|
-
const before = pipe(source, String$1.slice(START$
|
|
404
|
+
const before = pipe(source, String$1.slice(START$12, index), String$1.split("\n"));
|
|
405
405
|
return {
|
|
406
406
|
line: before.length,
|
|
407
407
|
column: pipe(Array.last(before), Option.match({
|
|
@@ -413,9 +413,9 @@ const positionOf = (source) => (index) => {
|
|
|
413
413
|
// src/features/install-size/model/import-graph.ts
|
|
414
414
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
415
415
|
const SUBPATH_IMPORT = "#";
|
|
416
|
-
const WILDCARD$
|
|
416
|
+
const WILDCARD$2 = "*";
|
|
417
417
|
const SCOPE = "@";
|
|
418
|
-
const SEPARATOR$
|
|
418
|
+
const SEPARATOR$11 = "/";
|
|
419
419
|
const SOURCE_SUFFIXES = [
|
|
420
420
|
"",
|
|
421
421
|
".ts",
|
|
@@ -427,9 +427,9 @@ const PLAIN_SEGMENTS = 1;
|
|
|
427
427
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
428
428
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
429
429
|
const packageNameOf = (specifier) => {
|
|
430
|
-
const segments = String$1.split(specifier, SEPARATOR$
|
|
431
|
-
if (String$1.startsWith(SCOPE)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS$1), Array.join(SEPARATOR$
|
|
432
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$
|
|
430
|
+
const segments = String$1.split(specifier, SEPARATOR$11);
|
|
431
|
+
if (String$1.startsWith(SCOPE)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS$1), Array.join(SEPARATOR$11));
|
|
432
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$11));
|
|
433
433
|
};
|
|
434
434
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
435
435
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -447,9 +447,9 @@ const specifiersIn = (api, file, text) => {
|
|
|
447
447
|
return Array.getSomes(found);
|
|
448
448
|
};
|
|
449
449
|
const subpathTarget = (imports, specifier) => pipe(Record.toEntries(imports), Array.findFirst(([pattern, target]) => {
|
|
450
|
-
if (!String$1.endsWith(WILDCARD$
|
|
451
|
-
const prefix = String$1.replace(WILDCARD$
|
|
452
|
-
return Option.liftPredicate(String$1.replace(WILDCARD$
|
|
450
|
+
if (!String$1.endsWith(WILDCARD$2)(pattern)) return Option.liftPredicate(target, () => pattern === specifier);
|
|
451
|
+
const prefix = String$1.replace(WILDCARD$2, "")(pattern);
|
|
452
|
+
return Option.liftPredicate(String$1.replace(WILDCARD$2, String$1.replace(prefix, "")(specifier))(target), () => String$1.startsWith(prefix)(specifier));
|
|
453
453
|
}));
|
|
454
454
|
const existingSource = Effect.fn("existingSource")(function* existingSource(base) {
|
|
455
455
|
const files = yield* RepositoryFiles;
|
|
@@ -466,18 +466,18 @@ const localFile = Effect.fn("localFile")(function* localFile({ directory, import
|
|
|
466
466
|
if (Option.isNone(target)) return Option.none();
|
|
467
467
|
return yield* existingSource(files.resolve(directory, target.value));
|
|
468
468
|
});
|
|
469
|
-
const referenceOf = (graph, from, specifier) => {
|
|
469
|
+
const referenceOf$1 = (graph, from, specifier) => {
|
|
470
470
|
if (RELATIVE.test(specifier) || String$1.startsWith(SUBPATH_IMPORT)(specifier)) return localFile(graph, from, specifier).pipe(Effect.map(Option.map(Result.succeed)));
|
|
471
471
|
const name = packageNameOf(specifier);
|
|
472
472
|
return Effect.succeedSome(Result.fail(name));
|
|
473
473
|
};
|
|
474
|
-
const referencesIn = Effect.fn("referencesIn")(function* referencesIn(graph, file) {
|
|
474
|
+
const referencesIn$1 = Effect.fn("referencesIn")(function* referencesIn(graph, file) {
|
|
475
475
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
476
476
|
const specifiers = Option.match(text, {
|
|
477
477
|
onNone: () => [],
|
|
478
478
|
onSome: (source) => specifiersIn(graph.api, file, source)
|
|
479
479
|
});
|
|
480
|
-
const references = yield* pipe(specifiers, Effect.forEach((specifier) => referenceOf(graph, file, specifier)));
|
|
480
|
+
const references = yield* pipe(specifiers, Effect.forEach((specifier) => referenceOf$1(graph, file, specifier)));
|
|
481
481
|
const found = Array.getSomes(references);
|
|
482
482
|
return {
|
|
483
483
|
packages: Array.getFailures(found),
|
|
@@ -491,7 +491,7 @@ const packagesFrom = (graph, walk) => Array.match(walk.pending, {
|
|
|
491
491
|
...walk,
|
|
492
492
|
pending: rest
|
|
493
493
|
});
|
|
494
|
-
return referencesIn(graph, next).pipe(Effect.flatMap(({ packages, sources }) => packagesFrom(graph, {
|
|
494
|
+
return referencesIn$1(graph, next).pipe(Effect.flatMap(({ packages, sources }) => packagesFrom(graph, {
|
|
495
495
|
pending: [...rest, ...sources],
|
|
496
496
|
visited: HashSet.add(walk.visited, next),
|
|
497
497
|
packages: HashSet.union(walk.packages, HashSet.fromIterable(packages))
|
|
@@ -524,7 +524,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
524
524
|
peerDependencies: DependencyMap,
|
|
525
525
|
peerDependenciesMeta: PeerMeta
|
|
526
526
|
});
|
|
527
|
-
const decodeManifest$
|
|
527
|
+
const decodeManifest$3 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
528
528
|
const keysOf$1 = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
529
529
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
530
530
|
const installedNames = (manifest) => [
|
|
@@ -535,7 +535,7 @@ const installedNames = (manifest) => [
|
|
|
535
535
|
const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
536
536
|
const files = yield* RepositoryFiles;
|
|
537
537
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE));
|
|
538
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
538
|
+
return pipe(text, Option.flatMap(decodeManifest$3), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
539
539
|
});
|
|
540
540
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
541
541
|
const files = yield* RepositoryFiles;
|
|
@@ -597,11 +597,11 @@ const LISTED_LARGEST = 5;
|
|
|
597
597
|
const SIZE_CONCURRENCY = 32;
|
|
598
598
|
const MEGABYTE = 1e6;
|
|
599
599
|
const MEGABYTE_DIGITS = 1;
|
|
600
|
-
const START$
|
|
600
|
+
const START$11 = 0;
|
|
601
601
|
const SINGLE_ENTRY = 1;
|
|
602
602
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
603
603
|
const usageHint = (dependency, entryCount) => {
|
|
604
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
604
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$11 && dependency.entries.length < entryCount)) return "";
|
|
605
605
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
606
606
|
};
|
|
607
607
|
const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -610,7 +610,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
610
610
|
const { workspace, total } = overrun;
|
|
611
611
|
const config = yield* files.readFile(workspace.configFile);
|
|
612
612
|
const source = Option.getOrElse(config, () => "");
|
|
613
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
613
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$11);
|
|
614
614
|
return {
|
|
615
615
|
file: workspace.configFile,
|
|
616
616
|
...positionOf(source)(index),
|
|
@@ -627,7 +627,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
627
627
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
628
628
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
629
629
|
const sizes = HashMap.fromIterable(measured);
|
|
630
|
-
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
630
|
+
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$11))));
|
|
631
631
|
return {
|
|
632
632
|
closures,
|
|
633
633
|
sizeOf,
|
|
@@ -660,11 +660,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
660
660
|
})];
|
|
661
661
|
});
|
|
662
662
|
const stackProblems = (file, source, dependencies) => {
|
|
663
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$
|
|
663
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$11);
|
|
664
664
|
const rest = String$1.slice(section)(source);
|
|
665
665
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
666
666
|
file,
|
|
667
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
667
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$11)),
|
|
668
668
|
rule: STACK_DEPENDENCY,
|
|
669
669
|
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.`
|
|
670
670
|
})));
|
|
@@ -676,7 +676,7 @@ const PublishedManifest = Schema.Struct({
|
|
|
676
676
|
exports: Schema.optional(Schema.Unknown),
|
|
677
677
|
bin: Schema.optional(Schema.Unknown)
|
|
678
678
|
});
|
|
679
|
-
const problemsOf$
|
|
679
|
+
const problemsOf$2 = Effect.fn("problemsOf")(function* problemsOf(workspace, file, source) {
|
|
680
680
|
const files = yield* RepositoryFiles;
|
|
681
681
|
const manifest = Schema.decodeOption(Schema.fromJsonString(PublishedManifest))(source);
|
|
682
682
|
if (Option.isNone(manifest)) return [];
|
|
@@ -700,7 +700,7 @@ const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProb
|
|
|
700
700
|
const source = yield* files.readFile(file);
|
|
701
701
|
return yield* Option.match(source, {
|
|
702
702
|
onNone: () => Effect.succeed([]),
|
|
703
|
-
onSome: (text) => problemsOf$
|
|
703
|
+
onSome: (text) => problemsOf$2(workspace, file, text)
|
|
704
704
|
});
|
|
705
705
|
});
|
|
706
706
|
/** @internal */
|
|
@@ -889,11 +889,11 @@ const withBaselineProbe = (manifest) => {
|
|
|
889
889
|
return document.toString();
|
|
890
890
|
};
|
|
891
891
|
// src/features/overrides/model/overrides.ts
|
|
892
|
-
const WORKSPACE_FILE$
|
|
892
|
+
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
893
893
|
const LOCKFILE$1 = "pnpm-lock.yaml";
|
|
894
894
|
const RESOLUTION_FILES = [
|
|
895
895
|
"*package.json",
|
|
896
|
-
WORKSPACE_FILE$
|
|
896
|
+
WORKSPACE_FILE$2,
|
|
897
897
|
LOCKFILE$1,
|
|
898
898
|
".npmrc",
|
|
899
899
|
"patches/*"
|
|
@@ -905,7 +905,7 @@ var OverrideResolutionFailed = class extends taggedError$4()("OverrideResolution
|
|
|
905
905
|
override: Schema.String,
|
|
906
906
|
output: Schema.String
|
|
907
907
|
}) {};
|
|
908
|
-
const textOf
|
|
908
|
+
const textOf = (stream) => stream.pipe(Stream.decodeText(), Stream.mkString);
|
|
909
909
|
const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override) {
|
|
910
910
|
const handle = yield* ChildProcess.make("vp", [
|
|
911
911
|
"install",
|
|
@@ -919,7 +919,7 @@ const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override
|
|
|
919
919
|
extendEnv: true,
|
|
920
920
|
stdin: "ignore"
|
|
921
921
|
});
|
|
922
|
-
const [output, status] = yield* Effect.all([textOf
|
|
922
|
+
const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], { concurrency: "unbounded" });
|
|
923
923
|
if (Number(status) !== SUCCEEDED) return yield* OverrideResolutionFailed.make({
|
|
924
924
|
override,
|
|
925
925
|
output
|
|
@@ -936,7 +936,7 @@ const auditIn = Effect.fn("auditIn")(function* auditIn(directory) {
|
|
|
936
936
|
extendEnv: true,
|
|
937
937
|
stdin: "ignore"
|
|
938
938
|
});
|
|
939
|
-
const [report] = yield* Effect.all([textOf
|
|
939
|
+
const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], { concurrency: "unbounded" });
|
|
940
940
|
return advisoriesIn(report);
|
|
941
941
|
}, Effect.scoped);
|
|
942
942
|
const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* trackedFiles(root) {
|
|
@@ -946,7 +946,7 @@ const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* tra
|
|
|
946
946
|
"--",
|
|
947
947
|
...RESOLUTION_FILES
|
|
948
948
|
], { cwd: root });
|
|
949
|
-
const listed = yield* textOf
|
|
949
|
+
const listed = yield* textOf(handle.stdout);
|
|
950
950
|
return pipe(String$1.split(listed, "\0"), Array.filter(String$1.isNonEmpty));
|
|
951
951
|
}, Effect.scoped);
|
|
952
952
|
const copyFiles = Effect.fn("copyFiles")(function* copyFiles(workspace, directory) {
|
|
@@ -964,7 +964,7 @@ const resolutionWith = Effect.fn("resolutionWith")(function* resolutionWith(work
|
|
|
964
964
|
const path = yield* Path.Path;
|
|
965
965
|
const directory = yield* fs.makeTempDirectoryScoped({ prefix: "msch-overrides-" });
|
|
966
966
|
yield* copyFiles(workspace, directory);
|
|
967
|
-
yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE$
|
|
967
|
+
yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE$2), manifest);
|
|
968
968
|
const output = yield* resolveIn(directory, override);
|
|
969
969
|
const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE$1));
|
|
970
970
|
yield* Effect.annotateCurrentSpan({ "msch.override": override });
|
|
@@ -983,7 +983,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, manifes
|
|
|
983
983
|
};
|
|
984
984
|
const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));
|
|
985
985
|
const judgeAgainstBaseline = judge(baseline);
|
|
986
|
-
const file = path.join(root, WORKSPACE_FILE$
|
|
986
|
+
const file = path.join(root, WORKSPACE_FILE$2);
|
|
987
987
|
const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(Effect.map((candidate) => overrideProblem({
|
|
988
988
|
...located,
|
|
989
989
|
file
|
|
@@ -995,7 +995,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, manifes
|
|
|
995
995
|
const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
|
|
996
996
|
const fs = yield* FileSystem.FileSystem;
|
|
997
997
|
const path = yield* Path.Path;
|
|
998
|
-
const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$
|
|
998
|
+
const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$2)).pipe(Effect.option);
|
|
999
999
|
const keys = Option.match(manifest, {
|
|
1000
1000
|
onNone: () => [],
|
|
1001
1001
|
onSome: overrideKeysOf
|
|
@@ -1003,141 +1003,41 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
1003
1003
|
if (Option.isNone(manifest) || !Array.isReadonlyArrayNonEmpty(keys)) return [];
|
|
1004
1004
|
return yield* problemsFor(root, manifest.value, keys);
|
|
1005
1005
|
});
|
|
1006
|
-
// src/
|
|
1007
|
-
const
|
|
1008
|
-
const
|
|
1009
|
-
const
|
|
1010
|
-
const
|
|
1011
|
-
const
|
|
1012
|
-
const
|
|
1013
|
-
const
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
if (isFunctionDeclaration(node)) return pipe(Option.fromUndefinedOr(node.name), Option.map((name) => ({
|
|
1020
|
-
name,
|
|
1021
|
-
wrapper: node
|
|
1022
|
-
})));
|
|
1023
|
-
if (!isVariableDeclaration(node) || !isIdentifier(node.name)) return Option.none();
|
|
1024
|
-
const { name } = node;
|
|
1025
|
-
return pipe(Option.fromUndefinedOr(node.initializer), Option.map(unwrapped), Option.filter(isWrapperExpression), Option.map((wrapper) => ({
|
|
1026
|
-
name,
|
|
1027
|
-
wrapper
|
|
1028
|
-
})));
|
|
1029
|
-
};
|
|
1030
|
-
const changesTheCall = (wrapper) => Predicate.isNotUndefined(wrapper.asteriskToken) || Option.exists(Option.fromUndefinedOr(wrapper.type), (type) => type.kind === SyntaxKind.TypePredicate) || pipe(wrapper.modifiers ?? [], Array.some((modifier) => modifier.kind === SyntaxKind.AsyncKeyword));
|
|
1031
|
-
const returnedExpression = (wrapper) => {
|
|
1032
|
-
const { body } = wrapper;
|
|
1033
|
-
if (Predicate.isUndefined(body)) return Option.none();
|
|
1034
|
-
if (!isBlock(body)) return Option.some(body);
|
|
1035
|
-
if (body.statements.length !== SINGLE_STATEMENT) return Option.none();
|
|
1036
|
-
return pipe(Array.head(body.statements), Option.filter((statement) => isReturnStatement(statement)), Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)));
|
|
1037
|
-
};
|
|
1038
|
-
const callForward = (call) => ({
|
|
1039
|
-
node: call,
|
|
1040
|
-
callee: call.expression,
|
|
1041
|
-
kind: SignatureKind.Call,
|
|
1042
|
-
arguments: call.arguments,
|
|
1043
|
-
typed: Predicate.isNotUndefined(call.typeArguments),
|
|
1044
|
-
optional: Predicate.isNotUndefined(call.questionDotToken)
|
|
1045
|
-
});
|
|
1046
|
-
const forwardOf = (expression) => {
|
|
1047
|
-
const inner = unwrapped(expression);
|
|
1048
|
-
if (isCallExpression(inner)) return Option.some(callForward(inner));
|
|
1049
|
-
if (isNewExpression(inner)) return Option.some({
|
|
1050
|
-
node: inner,
|
|
1051
|
-
callee: inner.expression,
|
|
1052
|
-
kind: SignatureKind.Construct,
|
|
1053
|
-
arguments: inner.arguments ?? NO_ARGUMENTS,
|
|
1054
|
-
typed: Predicate.isNotUndefined(inner.typeArguments),
|
|
1055
|
-
optional: false
|
|
1056
|
-
});
|
|
1057
|
-
return Option.none();
|
|
1058
|
-
};
|
|
1059
|
-
const rootOf = (callee) => {
|
|
1060
|
-
if (isIdentifier(callee)) return Option.some(callee);
|
|
1061
|
-
if (isPropertyAccessExpression(callee) && Predicate.isUndefined(callee.questionDotToken) && isIdentifier(callee.name)) return rootOf(callee.expression);
|
|
1062
|
-
return Option.none();
|
|
1063
|
-
};
|
|
1064
|
-
const parameterName = (parameter) => {
|
|
1065
|
-
const { name } = parameter;
|
|
1066
|
-
if (!isIdentifier(name) || Predicate.isNotUndefined(parameter.initializer) || name.text === THIS_PARAMETER) return Option.none();
|
|
1067
|
-
return Option.some(name.text);
|
|
1068
|
-
};
|
|
1069
|
-
const isRest = (parameter) => Predicate.isNotUndefined(parameter.dotDotDotToken);
|
|
1070
|
-
const forwardsParameter = ([parameter, name, argument]) => {
|
|
1071
|
-
if (!isRest(parameter)) return isIdentifier(argument) && argument.text === name;
|
|
1072
|
-
return isSpreadElement(argument) && isIdentifier(argument.expression) && argument.expression.text === name;
|
|
1073
|
-
};
|
|
1074
|
-
const forwardedNames = (wrapper, forward) => {
|
|
1075
|
-
const { parameters } = wrapper;
|
|
1076
|
-
const names = pipe(parameters, Array.map(parameterName), Array.getSomes);
|
|
1077
|
-
if (names.length !== parameters.length || forward.arguments.length !== parameters.length) return Option.none();
|
|
1078
|
-
const triples = Array.zipWith(Array.zip(parameters, names), forward.arguments, ([parameter, name], argument) => [
|
|
1079
|
-
parameter,
|
|
1080
|
-
name,
|
|
1081
|
-
argument
|
|
1082
|
-
]);
|
|
1083
|
-
return pipe(Option.some(names), Option.filter(() => pipe(triples, Array.every(forwardsParameter))));
|
|
1084
|
-
};
|
|
1085
|
-
const calleeTakesExactly = (checker) => (forward, count) => {
|
|
1086
|
-
const signatures = checker.getSignaturesOfType(checker.getTypeAtLocation(forward.callee), forward.kind);
|
|
1087
|
-
return Array.isReadonlyArrayNonEmpty(signatures) && pipe(signatures, Array.every((signature) => !signature.hasRestParameter && signature.parameters.length === count && !Array.isReadonlyArrayNonEmpty(signature.typeParameters ?? [])));
|
|
1088
|
-
};
|
|
1089
|
-
const keepsTheReturnType = (checker) => (wrapper, forward) => Option.match(Option.fromUndefinedOr(wrapper.type), {
|
|
1090
|
-
onNone: () => true,
|
|
1091
|
-
onSome: (type) => checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id
|
|
1006
|
+
// src/shared/lib/agent-docs.ts
|
|
1007
|
+
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
1008
|
+
const READ_CONCURRENCY$18 = 16;
|
|
1009
|
+
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
1010
|
+
const files = yield* RepositoryFiles;
|
|
1011
|
+
const listed = yield* files.listedFiles(root);
|
|
1012
|
+
const docs = pipe(listed, Array.filter((name) => AGENT_DOC.test(name)));
|
|
1013
|
+
const found = yield* Effect.forEach(docs, (name) => {
|
|
1014
|
+
const file = files.join(root, name);
|
|
1015
|
+
const problemOf = Option.flatMap(problemIn(file));
|
|
1016
|
+
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
1017
|
+
}, { concurrency: READ_CONCURRENCY$18 });
|
|
1018
|
+
return Array.getSomes(found);
|
|
1092
1019
|
});
|
|
1093
|
-
const isOverloaded = (checker) => (name) => Option.exists(Option.fromUndefinedOr(checker.getSymbolAtLocation(name)), (symbol) => symbol.declarations.length > SINGLE_DECLARATION);
|
|
1094
|
-
const callsAnotherFunction = ({ name }, forward, names) => Option.exists(rootOf(forward.callee), (root) => root.text !== name.text && !names.includes(root.text));
|
|
1095
|
-
const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
1096
|
-
const { wrapper, name } = candidate;
|
|
1097
|
-
if (forward.typed || forward.optional) return false;
|
|
1098
|
-
const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
|
|
1099
|
-
return Option.exists(forwardedNames(wrapper, forward), (names) => callsAnotherFunction(candidate, forward, names)) && (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) && keepsTheReturnType(checker)(wrapper, forward) && !isOverloaded(checker)(name);
|
|
1100
|
-
};
|
|
1101
|
-
const problemOf$3 = (checker) => (candidate) => {
|
|
1102
|
-
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
1103
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt({
|
|
1104
|
-
rule: RULE$14,
|
|
1105
|
-
message: messageOf(forward.callee.getText())
|
|
1106
|
-
})(candidate.name)));
|
|
1107
|
-
};
|
|
1108
|
-
const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$3(checker)), Array.getSomes);
|
|
1109
1020
|
// src/features/placement/model/agent-docs-length.ts
|
|
1110
|
-
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
1111
1021
|
const RECOMMENDED_LINES = 200;
|
|
1112
|
-
const
|
|
1113
|
-
const
|
|
1114
|
-
const RULE$13 = "agent-docs-length";
|
|
1022
|
+
const FIRST$13 = 1;
|
|
1023
|
+
const RULE$24 = "agent-docs-length";
|
|
1115
1024
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
1116
|
-
const problemFor$
|
|
1025
|
+
const problemFor$5 = (file) => (lines) => {
|
|
1117
1026
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
1118
1027
|
return Option.some({
|
|
1119
1028
|
file,
|
|
1120
1029
|
line: 201,
|
|
1121
|
-
column: FIRST$
|
|
1122
|
-
rule: RULE$
|
|
1030
|
+
column: FIRST$13,
|
|
1031
|
+
rule: RULE$24,
|
|
1123
1032
|
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.`
|
|
1124
1033
|
});
|
|
1125
1034
|
};
|
|
1126
1035
|
/** @internal */
|
|
1127
|
-
const checkAgentDocsLength =
|
|
1128
|
-
const files = yield* RepositoryFiles;
|
|
1129
|
-
const listed = yield* files.listedFiles(root);
|
|
1130
|
-
const docs = pipe(listed, Array.filter((name) => AGENT_DOC.test(name)));
|
|
1131
|
-
const found = yield* Effect.forEach(docs, (name) => {
|
|
1132
|
-
const file = files.join(root, name);
|
|
1133
|
-
return files.readFile(file).pipe(Effect.map(Option.flatMap((source) => problemFor$4(file)(lineCount(source)))));
|
|
1134
|
-
}, { concurrency: READ_CONCURRENCY$12 });
|
|
1135
|
-
return Array.getSomes(found);
|
|
1136
|
-
});
|
|
1036
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
|
|
1137
1037
|
// src/features/placement/model/colocated-tests.ts
|
|
1138
|
-
const RULE$
|
|
1139
|
-
const FIRST$
|
|
1140
|
-
const READ_CONCURRENCY$
|
|
1038
|
+
const RULE$23 = "colocated-test";
|
|
1039
|
+
const FIRST$12 = 1;
|
|
1040
|
+
const READ_CONCURRENCY$17 = 64;
|
|
1141
1041
|
const ROOT_SUBPATH = ".";
|
|
1142
1042
|
const NAME_GROUP = "name";
|
|
1143
1043
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -1148,20 +1048,20 @@ const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?|specs?)\/
|
|
|
1148
1048
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
1149
1049
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
1150
1050
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
1151
|
-
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
1051
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
1152
1052
|
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.";
|
|
1153
1053
|
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>.";
|
|
1154
|
-
const Manifest = Schema.Struct({
|
|
1054
|
+
const Manifest$2 = Schema.Struct({
|
|
1155
1055
|
name: Schema.optional(Schema.String),
|
|
1156
1056
|
exports: Schema.optional(Schema.Unknown)
|
|
1157
1057
|
});
|
|
1158
|
-
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
1058
|
+
const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
1159
1059
|
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1160
|
-
const problemFor$
|
|
1060
|
+
const problemFor$4 = (test, message) => ({
|
|
1161
1061
|
file: test.file,
|
|
1162
|
-
line: FIRST$
|
|
1163
|
-
column: FIRST$
|
|
1164
|
-
rule: RULE$
|
|
1062
|
+
line: FIRST$12,
|
|
1063
|
+
column: FIRST$12,
|
|
1064
|
+
rule: RULE$23,
|
|
1165
1065
|
message: `${test.base} ${message}`
|
|
1166
1066
|
});
|
|
1167
1067
|
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);
|
|
@@ -1181,7 +1081,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
1181
1081
|
if (Option.isNone(owner)) return [];
|
|
1182
1082
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
|
|
1183
1083
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
1184
|
-
return pipe(text, Option.flatMap(decodeManifest), Option.map(specifiersBeside({
|
|
1084
|
+
return pipe(text, Option.flatMap(decodeManifest$2), Option.map(specifiersBeside({
|
|
1185
1085
|
join,
|
|
1186
1086
|
dirname: files.dirname,
|
|
1187
1087
|
directory: test.directory
|
|
@@ -1199,16 +1099,16 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
1199
1099
|
if (Option.isNone(source)) return true;
|
|
1200
1100
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
1201
1101
|
});
|
|
1202
|
-
const problemIn$
|
|
1203
|
-
if (SEPARATE_TEST_DIRECTORY.test(test.name)) return Option.some(problemFor$
|
|
1102
|
+
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
1103
|
+
if (SEPARATE_TEST_DIRECTORY.test(test.name)) return Option.some(problemFor$4(test, DIRECTORY_MESSAGE));
|
|
1204
1104
|
if (!TEST_FILE.test(test.name)) return Option.none();
|
|
1205
1105
|
if (yield* refersIn(context, test)) return Option.none();
|
|
1206
|
-
return Option.some(problemFor$
|
|
1106
|
+
return Option.some(problemFor$4(test, SIBLING_MESSAGE));
|
|
1207
1107
|
});
|
|
1208
1108
|
/** @internal */
|
|
1209
1109
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
1210
1110
|
const files = yield* RepositoryFiles;
|
|
1211
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED);
|
|
1111
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$2);
|
|
1212
1112
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
1213
1113
|
const context = {
|
|
1214
1114
|
root,
|
|
@@ -1223,42 +1123,66 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
1223
1123
|
directory: files.dirname(file)
|
|
1224
1124
|
};
|
|
1225
1125
|
}));
|
|
1226
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$
|
|
1126
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$4(context, test), { concurrency: READ_CONCURRENCY$17 });
|
|
1127
|
+
return Array.getSomes(found);
|
|
1128
|
+
});
|
|
1129
|
+
// src/features/placement/model/dangling-links.ts
|
|
1130
|
+
const RULE$22 = "dangling-link";
|
|
1131
|
+
const SEPARATOR$10 = "/";
|
|
1132
|
+
const FIRST$11 = 1;
|
|
1133
|
+
const READ_CONCURRENCY$16 = 16;
|
|
1134
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$10}`)(name);
|
|
1135
|
+
/** @internal */
|
|
1136
|
+
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
1137
|
+
const files = yield* RepositoryFiles;
|
|
1138
|
+
const [links, listed] = yield* Effect.all([files.linkedFiles(root), files.listedFiles(root)], { concurrency: "unbounded" });
|
|
1139
|
+
const problemOf = Effect.fn("problemOf")(function* problemOf(name) {
|
|
1140
|
+
const file = files.join(root, name);
|
|
1141
|
+
const link = yield* files.readLink(file);
|
|
1142
|
+
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) => ({
|
|
1143
|
+
file,
|
|
1144
|
+
line: FIRST$11,
|
|
1145
|
+
column: FIRST$11,
|
|
1146
|
+
rule: RULE$22,
|
|
1147
|
+
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.`
|
|
1148
|
+
})));
|
|
1149
|
+
});
|
|
1150
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$16 });
|
|
1227
1151
|
return Array.getSomes(found);
|
|
1228
1152
|
});
|
|
1229
1153
|
// src/features/placement/model/nested-docs.ts
|
|
1230
|
-
const RULE$
|
|
1154
|
+
const RULE$21 = "nested-docs";
|
|
1231
1155
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1232
|
-
const SEPARATOR$
|
|
1233
|
-
const FIRST$
|
|
1234
|
-
const READ_CONCURRENCY$
|
|
1156
|
+
const SEPARATOR$9 = "/";
|
|
1157
|
+
const FIRST$10 = 1;
|
|
1158
|
+
const READ_CONCURRENCY$15 = 64;
|
|
1235
1159
|
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1236
1160
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1237
1161
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
1238
1162
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1239
1163
|
const taggedError$3 = Schema.TaggedError;
|
|
1240
1164
|
var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1241
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1242
|
-
const problemFor$
|
|
1165
|
+
const isNested = (name) => String$1.includes(SEPARATOR$9)(name);
|
|
1166
|
+
const problemFor$3 = (file, message) => ({
|
|
1243
1167
|
file,
|
|
1244
|
-
line: FIRST$
|
|
1245
|
-
column: FIRST$
|
|
1246
|
-
rule: RULE$
|
|
1168
|
+
line: FIRST$10,
|
|
1169
|
+
column: FIRST$10,
|
|
1170
|
+
rule: RULE$21,
|
|
1247
1171
|
message
|
|
1248
1172
|
});
|
|
1249
1173
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
1250
1174
|
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.";
|
|
1251
1175
|
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.";
|
|
1252
1176
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
1253
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
1177
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$3(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
1254
1178
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1255
|
-
return Option.some(problemFor$
|
|
1179
|
+
return Option.some(problemFor$3(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
1256
1180
|
};
|
|
1257
1181
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
1258
1182
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1259
|
-
return Option.some(problemFor$
|
|
1183
|
+
return Option.some(problemFor$3(file, `${base} ${README_MESSAGE}`));
|
|
1260
1184
|
};
|
|
1261
|
-
const problemIn$
|
|
1185
|
+
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
1262
1186
|
const files = yield* RepositoryFiles;
|
|
1263
1187
|
const file = files.join(root, name);
|
|
1264
1188
|
const doc = {
|
|
@@ -1289,24 +1213,44 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1289
1213
|
workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
|
|
1290
1214
|
workspaceAgentDocs
|
|
1291
1215
|
};
|
|
1292
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$
|
|
1216
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$3(root, allowed, name), { concurrency: READ_CONCURRENCY$15 });
|
|
1293
1217
|
return Array.getSomes(found);
|
|
1294
1218
|
});
|
|
1219
|
+
// src/features/placement/model/root-docs.ts
|
|
1220
|
+
const RULE$20 = "root-docs";
|
|
1221
|
+
const SEPARATOR$8 = "/";
|
|
1222
|
+
const FIRST$9 = 1;
|
|
1223
|
+
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1224
|
+
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1225
|
+
const MESSAGE$5 = "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.";
|
|
1226
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$8)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1227
|
+
/** @internal */
|
|
1228
|
+
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1229
|
+
const files = yield* RepositoryFiles;
|
|
1230
|
+
const names = yield* files.listedFiles(root);
|
|
1231
|
+
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
1232
|
+
file: files.join(root, name),
|
|
1233
|
+
line: FIRST$9,
|
|
1234
|
+
column: FIRST$9,
|
|
1235
|
+
rule: RULE$20,
|
|
1236
|
+
message: `${name} ${MESSAGE$5}`
|
|
1237
|
+
})));
|
|
1238
|
+
});
|
|
1295
1239
|
// src/features/placement/model/root-readme.ts
|
|
1296
|
-
const RULE$
|
|
1240
|
+
const RULE$19 = "root-readme";
|
|
1297
1241
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1298
|
-
const READ_CONCURRENCY$
|
|
1299
|
-
const START$
|
|
1242
|
+
const READ_CONCURRENCY$14 = 16;
|
|
1243
|
+
const START$10 = 0;
|
|
1300
1244
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1301
1245
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1302
1246
|
const messageFor = (directory) => `names the workspace ${directory}. The root README, AGENTS.md and CLAUDE.md describe the repository as a whole. Write what belongs to the workspace in ${directory}/README.md, or for agents in ${directory}/AGENTS.md.`;
|
|
1303
|
-
const problemsIn$
|
|
1247
|
+
const problemsIn$10 = (file, source) => ({ directory, pattern }) => {
|
|
1304
1248
|
const message = messageFor(directory);
|
|
1305
1249
|
const at = positionOf(source);
|
|
1306
1250
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
1307
1251
|
file,
|
|
1308
|
-
...at(found.index ?? START$
|
|
1309
|
-
rule: RULE$
|
|
1252
|
+
...at(found.index ?? START$10),
|
|
1253
|
+
rule: RULE$19,
|
|
1310
1254
|
message
|
|
1311
1255
|
})));
|
|
1312
1256
|
};
|
|
@@ -1314,7 +1258,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
|
|
|
1314
1258
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1315
1259
|
return pipe(text, Option.match({
|
|
1316
1260
|
onNone: () => [],
|
|
1317
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1261
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$10(file, source)))
|
|
1318
1262
|
}));
|
|
1319
1263
|
});
|
|
1320
1264
|
/** @internal */
|
|
@@ -1324,7 +1268,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1324
1268
|
const readmes = pipe(names, Array.filter((name) => ROOT_DOC.test(name)));
|
|
1325
1269
|
const named = yield* namedWorkspaces(root);
|
|
1326
1270
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1327
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$
|
|
1271
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$14 });
|
|
1328
1272
|
return Array.flatten(found);
|
|
1329
1273
|
});
|
|
1330
1274
|
// src/features/placement/model/placement-checks.ts
|
|
@@ -1333,18 +1277,133 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
|
|
|
1333
1277
|
const found = yield* Effect.all([
|
|
1334
1278
|
checkNestedDocs(root),
|
|
1335
1279
|
checkRootReadme(root),
|
|
1280
|
+
checkRootDocs(root),
|
|
1336
1281
|
checkColocatedTests(root),
|
|
1337
|
-
checkAgentDocsLength(root)
|
|
1282
|
+
checkAgentDocsLength(root),
|
|
1283
|
+
checkDanglingLinks(root)
|
|
1338
1284
|
], { concurrency: "unbounded" });
|
|
1339
1285
|
return Array.flatten(found);
|
|
1340
1286
|
});
|
|
1287
|
+
// src/features/repository-layout/model/command-entries.ts
|
|
1288
|
+
const OUTSIDE_BIN = "command-outside-bin";
|
|
1289
|
+
const UNRUN = "unrun-command";
|
|
1290
|
+
const SCRIPTS = "scripts-directory";
|
|
1291
|
+
const BIN = "bin";
|
|
1292
|
+
const SCRIPTS_DIRECTORY = "scripts";
|
|
1293
|
+
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
1294
|
+
const SEPARATOR$7 = "/";
|
|
1295
|
+
const CURRENT = "./";
|
|
1296
|
+
const READ_CONCURRENCY$13 = 8;
|
|
1297
|
+
const FIRST$8 = 1;
|
|
1298
|
+
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
1299
|
+
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
1300
|
+
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
1301
|
+
const Manifest$1 = Schema.Struct({
|
|
1302
|
+
bin: Schema.optional(Schema.Unknown),
|
|
1303
|
+
main: Schema.optional(Schema.Unknown),
|
|
1304
|
+
exports: Schema.optional(Schema.Unknown)
|
|
1305
|
+
});
|
|
1306
|
+
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
1307
|
+
const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
|
|
1308
|
+
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
1309
|
+
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
1310
|
+
const NO_ENTRIES = {
|
|
1311
|
+
all: [],
|
|
1312
|
+
bins: []
|
|
1313
|
+
};
|
|
1314
|
+
const withoutCurrent = (path) => String$1.replace(new RegExp(`^${CURRENT}`, "u"), "")(path);
|
|
1315
|
+
const runsIn = ({ text, start }) => pipe(Array.fromIterable(String$1.matchAll(RUN_FILE)(text)), Array.flatMap((found) => pipe(Option.fromUndefinedOr(found.groups), Option.flatMap(Record.get("file")), Option.map((path) => ({
|
|
1316
|
+
path: withoutCurrent(path),
|
|
1317
|
+
start
|
|
1318
|
+
})), Option.toArray)));
|
|
1319
|
+
const targetsIn = (held) => [...pipe(decodeTarget(held), Option.map(withoutCurrent), Option.toArray), ...pipe(decodeTargetMap(held), Option.map(Record.values), Option.getOrElse(() => []), Array.flatMap(targetsIn))];
|
|
1320
|
+
const entriesOf$1 = (manifest) => {
|
|
1321
|
+
const bins = targetsIn(manifest.bin);
|
|
1322
|
+
return {
|
|
1323
|
+
all: [
|
|
1324
|
+
...bins,
|
|
1325
|
+
...targetsIn(manifest.main),
|
|
1326
|
+
...targetsIn(manifest.exports)
|
|
1327
|
+
],
|
|
1328
|
+
bins
|
|
1329
|
+
};
|
|
1330
|
+
};
|
|
1331
|
+
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
1332
|
+
const files = yield* RepositoryFiles;
|
|
1333
|
+
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));
|
|
1334
|
+
return pipe(text, Option.flatMap(decodeManifest$1), Option.map(entriesOf$1), Option.getOrElse(() => NO_ENTRIES));
|
|
1335
|
+
});
|
|
1336
|
+
const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
1337
|
+
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
1338
|
+
const files = yield* RepositoryFiles;
|
|
1339
|
+
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
1340
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$7}${name}`), Array.filter(isCommand$1));
|
|
1341
|
+
});
|
|
1342
|
+
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
1343
|
+
const files = yield* RepositoryFiles;
|
|
1344
|
+
const listed = yield* files.listedFiles(root);
|
|
1345
|
+
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
1346
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$13 });
|
|
1347
|
+
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
1348
|
+
});
|
|
1349
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$7));
|
|
1350
|
+
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
1351
|
+
file,
|
|
1352
|
+
...positionOf(source)(start),
|
|
1353
|
+
rule: OUTSIDE_BIN,
|
|
1354
|
+
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.`
|
|
1355
|
+
})));
|
|
1356
|
+
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
1357
|
+
const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
1358
|
+
const files = yield* RepositoryFiles;
|
|
1359
|
+
const config = yield* workspaceConfigOf(root, directory);
|
|
1360
|
+
const entries = yield* declaredEntries(root, directory);
|
|
1361
|
+
const commands = yield* commandFilesIn(root, directory);
|
|
1362
|
+
const runs = pipe(config, Option.map(({ program }) => runsOf(program)), Option.getOrElse(() => []));
|
|
1363
|
+
const runPaths = pipe(runs, Array.map(({ path }) => path));
|
|
1364
|
+
const outside = pipe(config, Option.map(({ file, source }) => outsideProblems({
|
|
1365
|
+
file,
|
|
1366
|
+
source,
|
|
1367
|
+
runs,
|
|
1368
|
+
entries
|
|
1369
|
+
})), Option.getOrElse(() => []));
|
|
1370
|
+
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
1371
|
+
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
1372
|
+
file: files.join(root, directory, path),
|
|
1373
|
+
line: FIRST$8,
|
|
1374
|
+
column: FIRST$8,
|
|
1375
|
+
rule: UNRUN,
|
|
1376
|
+
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.`
|
|
1377
|
+
})));
|
|
1378
|
+
return [...outside, ...unrun];
|
|
1379
|
+
});
|
|
1380
|
+
const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root, directory) {
|
|
1381
|
+
const files = yield* RepositoryFiles;
|
|
1382
|
+
const file = files.join(root, directory, SCRIPTS_DIRECTORY);
|
|
1383
|
+
const isDirectory = yield* files.isDirectory(file);
|
|
1384
|
+
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
1385
|
+
file,
|
|
1386
|
+
line: FIRST$8,
|
|
1387
|
+
column: FIRST$8,
|
|
1388
|
+
rule: SCRIPTS,
|
|
1389
|
+
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.`
|
|
1390
|
+
})));
|
|
1391
|
+
});
|
|
1392
|
+
/** @internal */
|
|
1393
|
+
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
1394
|
+
const all = ["", ...yield* workspaceDirectories(root)];
|
|
1395
|
+
const workflows = yield* workflowText(root);
|
|
1396
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$9(root, directory, workflows), { concurrency: READ_CONCURRENCY$13 });
|
|
1397
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$13 });
|
|
1398
|
+
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
1399
|
+
});
|
|
1341
1400
|
// src/features/repository-layout/model/crates.ts
|
|
1342
|
-
const RULE$
|
|
1401
|
+
const RULE$18 = "unverified-crate";
|
|
1343
1402
|
const CARGO_FILE = "Cargo.toml";
|
|
1344
1403
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
1345
|
-
const SEPARATOR$
|
|
1346
|
-
const FIRST$
|
|
1347
|
-
const READ_CONCURRENCY$
|
|
1404
|
+
const SEPARATOR$6 = "/";
|
|
1405
|
+
const FIRST$7 = 1;
|
|
1406
|
+
const READ_CONCURRENCY$12 = 8;
|
|
1348
1407
|
const CrateEntry = Schema.Struct({
|
|
1349
1408
|
name: Schema.String,
|
|
1350
1409
|
manifest_path: Schema.String
|
|
@@ -1370,22 +1429,22 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
1370
1429
|
})));
|
|
1371
1430
|
}, Effect.scoped);
|
|
1372
1431
|
const owningWorkspace = (directories) => (directory) => {
|
|
1373
|
-
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
1432
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$6}`)(directory)));
|
|
1374
1433
|
return Array.last(Array.sort(owners, String$1.Order));
|
|
1375
1434
|
};
|
|
1376
|
-
const problemFor$
|
|
1435
|
+
const problemFor$2 = (crate, message) => ({
|
|
1377
1436
|
file: crate.manifest,
|
|
1378
|
-
line: FIRST$
|
|
1379
|
-
column: FIRST$
|
|
1380
|
-
rule: RULE$
|
|
1437
|
+
line: FIRST$7,
|
|
1438
|
+
column: FIRST$7,
|
|
1439
|
+
rule: RULE$18,
|
|
1381
1440
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
1382
1441
|
});
|
|
1383
|
-
const problemIn$
|
|
1442
|
+
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
1384
1443
|
const files = yield* RepositoryFiles;
|
|
1385
1444
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
1386
|
-
if (Option.isNone(workspace)) return Option.some(problemFor$
|
|
1445
|
+
if (Option.isNone(workspace)) return Option.some(problemFor$2(crate, "is outside every workspace package"));
|
|
1387
1446
|
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$3))) return Option.none();
|
|
1388
|
-
return Option.some(problemFor$
|
|
1447
|
+
return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$3} has no verify task`));
|
|
1389
1448
|
});
|
|
1390
1449
|
/** @internal */
|
|
1391
1450
|
const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
@@ -1393,15 +1452,57 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
1393
1452
|
if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
|
|
1394
1453
|
const directories = yield* workspaceDirectories(root);
|
|
1395
1454
|
const crates = yield* cratesIn(root);
|
|
1396
|
-
const found = yield* Effect.forEach(crates, (crate) => problemIn$
|
|
1455
|
+
const found = yield* Effect.forEach(crates, (crate) => problemIn$2(root, directories, crate), { concurrency: READ_CONCURRENCY$12 });
|
|
1397
1456
|
return Array.getSomes(found);
|
|
1398
1457
|
});
|
|
1458
|
+
// src/features/repository-layout/model/fallow-entries.ts
|
|
1459
|
+
const RULE$17 = "listed-entry";
|
|
1460
|
+
const ENTRY_KEYS = [
|
|
1461
|
+
"entry",
|
|
1462
|
+
"entryPoints",
|
|
1463
|
+
"supportEntry"
|
|
1464
|
+
];
|
|
1465
|
+
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
1466
|
+
const WILDCARD$1 = /[*?{[]/u;
|
|
1467
|
+
const SEPARATOR$5 = "/";
|
|
1468
|
+
const WRAP_OFFSET = 1;
|
|
1469
|
+
const READ_CONCURRENCY$11 = 8;
|
|
1470
|
+
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
1471
|
+
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
1472
|
+
const entryPatternsIn = (node) => {
|
|
1473
|
+
if (Predicate.isReadonlyObject(node) && isEntryProperty(node)) return pipe(stringsIn(node["value"]), Array.map(({ text, start }) => ({
|
|
1474
|
+
text,
|
|
1475
|
+
start: start - WRAP_OFFSET
|
|
1476
|
+
})));
|
|
1477
|
+
return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
|
|
1478
|
+
};
|
|
1479
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$5}`)(text))) || String$1.includes(SEPARATOR$5)(text) && !WILDCARD$1.test(text);
|
|
1480
|
+
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
1481
|
+
const files = yield* RepositoryFiles;
|
|
1482
|
+
const path = files.join(root, file);
|
|
1483
|
+
const text = yield* files.readFile(path);
|
|
1484
|
+
if (Option.isNone(text)) return [];
|
|
1485
|
+
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, `(${text.value})`, { lang: "ts" }));
|
|
1486
|
+
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
1487
|
+
file: path,
|
|
1488
|
+
...positionOf(text.value)(start),
|
|
1489
|
+
rule: RULE$17,
|
|
1490
|
+
message: `${pattern} names files one by one. Give fallow a place that every workspace uses the same way, such as bin/*.ts or a tool's config file name, or make fallow find the file through package.json.`
|
|
1491
|
+
})));
|
|
1492
|
+
});
|
|
1493
|
+
/** @internal */
|
|
1494
|
+
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
1495
|
+
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
1496
|
+
const directories = yield* workspaceDirectories(root);
|
|
1497
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$8(root, file, directories), { concurrency: READ_CONCURRENCY$11 });
|
|
1498
|
+
return Array.flatten(found);
|
|
1499
|
+
});
|
|
1399
1500
|
// src/features/repository-layout/model/hidden-verify.ts
|
|
1400
|
-
const RULE$
|
|
1501
|
+
const RULE$16 = "hidden-verify";
|
|
1401
1502
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
1402
|
-
const FIRST$
|
|
1403
|
-
const READ_CONCURRENCY$
|
|
1404
|
-
const problemIn = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
1503
|
+
const FIRST$6 = 1;
|
|
1504
|
+
const READ_CONCURRENCY$10 = 8;
|
|
1505
|
+
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
1405
1506
|
const config = yield* workspaceConfigOf(root, directory);
|
|
1406
1507
|
if (Option.isNone(config)) return Option.none();
|
|
1407
1508
|
const { file, program } = config.value;
|
|
@@ -1409,59 +1510,39 @@ const problemIn = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
|
1409
1510
|
const verified = yield* hasVerifyTask(file);
|
|
1410
1511
|
return Option.some({
|
|
1411
1512
|
file,
|
|
1412
|
-
line: FIRST$
|
|
1413
|
-
column: FIRST$
|
|
1414
|
-
rule: RULE$
|
|
1513
|
+
line: FIRST$6,
|
|
1514
|
+
column: FIRST$6,
|
|
1515
|
+
rule: RULE$16,
|
|
1415
1516
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$2}. The root verify reads ${CONFIG_FILE$2} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$2}.`
|
|
1416
1517
|
}).pipe(Option.filter(() => verified));
|
|
1417
1518
|
});
|
|
1418
1519
|
/** @internal */
|
|
1419
1520
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
1420
1521
|
const directories = yield* workspaceDirectories(root);
|
|
1421
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1522
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$10 });
|
|
1422
1523
|
return Array.getSomes(found);
|
|
1423
1524
|
});
|
|
1424
1525
|
// src/features/repository-layout/model/root-workspace-paths.ts
|
|
1425
|
-
const RULE$
|
|
1526
|
+
const RULE$15 = "root-workspace-path";
|
|
1426
1527
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
1427
1528
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
1428
1529
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
1429
|
-
const FIRST$
|
|
1530
|
+
const FIRST$5 = 0;
|
|
1430
1531
|
const NEXT$2 = 1;
|
|
1431
|
-
const StringNode = Schema.Union([Schema.Struct({
|
|
1432
|
-
type: Schema.Literal("Literal"),
|
|
1433
|
-
value: Schema.String,
|
|
1434
|
-
start: Schema.Finite
|
|
1435
|
-
}), Schema.Struct({
|
|
1436
|
-
type: Schema.Literal("TemplateElement"),
|
|
1437
|
-
value: Schema.Struct({ cooked: Schema.String }),
|
|
1438
|
-
start: Schema.Finite
|
|
1439
|
-
})]);
|
|
1440
|
-
const decodeStringNode = Schema.decodeUnknownOption(StringNode);
|
|
1441
|
-
const textOf = (node) => {
|
|
1442
|
-
if (node.type === "Literal") return node.value;
|
|
1443
|
-
return node.value.cooked;
|
|
1444
|
-
};
|
|
1445
|
-
const stringsIn = (node) => {
|
|
1446
|
-
return [...pipe(decodeStringNode(node), Option.map((found) => ({
|
|
1447
|
-
text: textOf(found),
|
|
1448
|
-
start: found.start
|
|
1449
|
-
})), Option.toArray), ...pipe(childrenOf$3(node), Array.flatMap(stringsIn))];
|
|
1450
|
-
};
|
|
1451
1532
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
1452
1533
|
const mentions = (directory) => (text) => {
|
|
1453
1534
|
const parts = String$1.split(text, directory);
|
|
1454
1535
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
1455
1536
|
const before = parts[index] ?? "";
|
|
1456
1537
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
1457
|
-
const following = String$1.slice(FIRST$
|
|
1538
|
+
const following = String$1.slice(FIRST$5, NEXT$2)(after);
|
|
1458
1539
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
1459
1540
|
}));
|
|
1460
1541
|
};
|
|
1461
|
-
const problemsIn$
|
|
1542
|
+
const problemsIn$7 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
1462
1543
|
file,
|
|
1463
1544
|
...positionOf(source)(found.start),
|
|
1464
|
-
rule: RULE$
|
|
1545
|
+
rule: RULE$15,
|
|
1465
1546
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$1} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$1}: msch.lint, msch.devDependencies or its verify task.`
|
|
1466
1547
|
})));
|
|
1467
1548
|
/** @internal */
|
|
@@ -1472,31 +1553,17 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
1472
1553
|
if (Option.isNone(source)) return [];
|
|
1473
1554
|
const directories = yield* workspaceDirectories(root);
|
|
1474
1555
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
1475
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
1556
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$7(file, source.value, directories)));
|
|
1476
1557
|
});
|
|
1477
1558
|
// src/features/repository-layout/model/shared-uncached-tasks.ts
|
|
1478
|
-
const RULE$
|
|
1479
|
-
const
|
|
1480
|
-
const READ_CONCURRENCY$6 = 8;
|
|
1559
|
+
const RULE$14 = "shared-uncached-task";
|
|
1560
|
+
const READ_CONCURRENCY$9 = 8;
|
|
1481
1561
|
const SHARED = 2;
|
|
1482
1562
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
1483
|
-
const TaskProperty = Schema.Struct({
|
|
1484
|
-
type: Schema.Literal("Property"),
|
|
1485
|
-
computed: Schema.Literal(false),
|
|
1486
|
-
key: KeySchema,
|
|
1487
|
-
value: Schema.Unknown,
|
|
1488
|
-
start: Schema.Finite
|
|
1489
|
-
});
|
|
1490
|
-
const TaskObject = Schema.Struct({
|
|
1491
|
-
type: Schema.Literal("ObjectExpression"),
|
|
1492
|
-
properties: Schema.Array(Schema.Unknown)
|
|
1493
|
-
});
|
|
1494
1563
|
const UncachedTask = Schema.Struct({
|
|
1495
1564
|
cache: Schema.Literal(false),
|
|
1496
1565
|
command: Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)])
|
|
1497
1566
|
});
|
|
1498
|
-
const decodeTaskProperty = Schema.decodeUnknownOption(TaskProperty);
|
|
1499
|
-
const decodeTaskObject = Schema.decodeUnknownOption(TaskObject);
|
|
1500
1567
|
const decodeUncachedTask = Schema.decodeUnknownOption(UncachedTask);
|
|
1501
1568
|
const encodeDefinition = Schema.encodeOption(Schema.fromJsonString(Schema.Unknown));
|
|
1502
1569
|
const commandText$1 = (command) => Array.join(Array.ensure(command), " && ");
|
|
@@ -1517,30 +1584,30 @@ const definitionOf = ({ directory, file, source }) => (task) => Option.gen(funct
|
|
|
1517
1584
|
};
|
|
1518
1585
|
});
|
|
1519
1586
|
const definitionsIn = Effect.fn("definitionsIn")(function* definitionsIn(root, directory) {
|
|
1520
|
-
const
|
|
1521
|
-
if (Option.isNone(
|
|
1522
|
-
const { file, source,
|
|
1523
|
-
return pipe(
|
|
1587
|
+
const found = yield* runTasksOf(root, directory);
|
|
1588
|
+
if (Option.isNone(found)) return [];
|
|
1589
|
+
const { file, source, tasks } = found.value;
|
|
1590
|
+
return pipe(tasks, Array.flatMap((task) => Option.toArray(definitionOf({
|
|
1524
1591
|
directory,
|
|
1525
1592
|
file,
|
|
1526
1593
|
source
|
|
1527
|
-
}))
|
|
1594
|
+
})(task))));
|
|
1528
1595
|
});
|
|
1529
|
-
const problemsOf = (definitions) => {
|
|
1596
|
+
const problemsOf$1 = (definitions) => {
|
|
1530
1597
|
const directories = pipe(definitions, Array.map(({ directory }) => directory), Array.dedupe);
|
|
1531
1598
|
if (directories.length < SHARED) return [];
|
|
1532
1599
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
1533
1600
|
file,
|
|
1534
1601
|
...position,
|
|
1535
|
-
rule: RULE$
|
|
1602
|
+
rule: RULE$14,
|
|
1536
1603
|
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.`
|
|
1537
1604
|
})));
|
|
1538
1605
|
};
|
|
1539
1606
|
/** @internal */
|
|
1540
1607
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
1541
1608
|
const directories = yield* workspaceDirectories(root);
|
|
1542
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1543
|
-
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf));
|
|
1609
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$9 });
|
|
1610
|
+
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$1));
|
|
1544
1611
|
});
|
|
1545
1612
|
// src/features/repository-layout/model/workflow-nodes.ts
|
|
1546
1613
|
const MISSING_OFFSET = 0;
|
|
@@ -1548,11 +1615,11 @@ const isRanged = (node) => isScalar(node) || isMap(node) || isSeq(node);
|
|
|
1548
1615
|
/** @internal */
|
|
1549
1616
|
const isText$1 = (node) => isScalar(node) && typeof node.value === "string";
|
|
1550
1617
|
const isTextPair = (pair) => isPair(pair) && isText$1(pair.key);
|
|
1551
|
-
const offsetOf = (node) => pipe(Option.liftPredicate(node, isRanged), Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)), Option.map(([start]) => start), Option.getOrElse(() => MISSING_OFFSET));
|
|
1618
|
+
const offsetOf$3 = (node) => pipe(Option.liftPredicate(node, isRanged), Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)), Option.map(([start]) => start), Option.getOrElse(() => MISSING_OFFSET));
|
|
1552
1619
|
/** @internal */
|
|
1553
1620
|
const stringOf = (node) => pipe(Option.liftPredicate(node, isText$1), Option.map((scalar) => ({
|
|
1554
1621
|
text: scalar.value,
|
|
1555
|
-
offset: offsetOf(scalar)
|
|
1622
|
+
offset: offsetOf$3(scalar)
|
|
1556
1623
|
})));
|
|
1557
1624
|
/** @internal */
|
|
1558
1625
|
const childOf = (key) => (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.get(key, true)), Option.getOrUndefined);
|
|
@@ -1578,8 +1645,8 @@ const scalarsIn = (source) => {
|
|
|
1578
1645
|
const ROOT = ".";
|
|
1579
1646
|
const LOCAL = "./";
|
|
1580
1647
|
const NEGATION = "!";
|
|
1581
|
-
const SEPARATOR$
|
|
1582
|
-
const LINE = "\n";
|
|
1648
|
+
const SEPARATOR$4 = "/";
|
|
1649
|
+
const LINE$1 = "\n";
|
|
1583
1650
|
const UNRESOLVED_MARKERS = [
|
|
1584
1651
|
"${{",
|
|
1585
1652
|
"$",
|
|
@@ -1590,7 +1657,7 @@ const FILE_INPUT_SUFFIX = "-file";
|
|
|
1590
1657
|
const DEPENDENCY_PATH_INPUT = "cache-dependency-path";
|
|
1591
1658
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
1592
1659
|
const HASH_FILES = /hashFiles\((?<arguments>[^)]*)\)/gu;
|
|
1593
|
-
const QUOTED$
|
|
1660
|
+
const QUOTED$2 = /'(?<path>[^']*)'/gu;
|
|
1594
1661
|
const SCRIPT = /^[\w.@/-]+\.(?:ts|mts|cts|sh)$/u;
|
|
1595
1662
|
const TOKEN_SEPARATOR = /[\s;&|()<>"'`=]+/u;
|
|
1596
1663
|
/** @internal */
|
|
@@ -1605,7 +1672,7 @@ const withoutLocal = (path) => {
|
|
|
1605
1672
|
const joinPath = (base, path) => {
|
|
1606
1673
|
const relative = withoutLocal(String$1.trim(path));
|
|
1607
1674
|
if (base === ROOT) return relative;
|
|
1608
|
-
return `${base}${SEPARATOR$
|
|
1675
|
+
return `${base}${SEPARATOR$4}${relative}`;
|
|
1609
1676
|
};
|
|
1610
1677
|
const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
|
|
1611
1678
|
const path = String$1.trim(text);
|
|
@@ -1628,7 +1695,7 @@ const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(tex
|
|
|
1628
1695
|
offset
|
|
1629
1696
|
})));
|
|
1630
1697
|
const isFileInput = ([key]) => String$1.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;
|
|
1631
|
-
const linesOf = ({ text, offset }) => pipe(String$1.split(text, LINE), Array.map((line) => ({
|
|
1698
|
+
const linesOf = ({ text, offset }) => pipe(String$1.split(text, LINE$1), Array.map((line) => ({
|
|
1632
1699
|
text: line,
|
|
1633
1700
|
offset
|
|
1634
1701
|
})));
|
|
@@ -1659,7 +1726,7 @@ const groupsOf = (pattern, group) => ({ text, offset }) => pipe(Array.fromIterab
|
|
|
1659
1726
|
text: value,
|
|
1660
1727
|
offset
|
|
1661
1728
|
})));
|
|
1662
|
-
const hashFilesIn = (source) => pipe(scalarsIn(source), Array.flatMap(groupsOf(HASH_FILES, "arguments")), Array.flatMap(groupsOf(QUOTED$
|
|
1729
|
+
const hashFilesIn = (source) => pipe(scalarsIn(source), Array.flatMap(groupsOf(HASH_FILES, "arguments")), Array.flatMap(groupsOf(QUOTED$2, "path")), Array.filter(isPositive), Array.flatMap(reference("glob", "hashFiles")));
|
|
1663
1730
|
const jobsOf = (source) => entriesOf(childOf("jobs")(parseDocument(source).contents));
|
|
1664
1731
|
/** @internal */
|
|
1665
1732
|
const workflowReferences = (source) => {
|
|
@@ -1678,13 +1745,13 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
1678
1745
|
/** @internal */
|
|
1679
1746
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
1680
1747
|
// src/features/repository-layout/model/workflow-paths.ts
|
|
1681
|
-
const RULE$
|
|
1748
|
+
const RULE$13 = "workflow-path";
|
|
1682
1749
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
1683
1750
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
1684
|
-
const READ_CONCURRENCY$
|
|
1751
|
+
const READ_CONCURRENCY$8 = 8;
|
|
1685
1752
|
const WILDCARD = /[*?[]/u;
|
|
1686
|
-
const SEPARATOR$
|
|
1687
|
-
const FIRST$
|
|
1753
|
+
const SEPARATOR$3 = "/";
|
|
1754
|
+
const FIRST$4 = 0;
|
|
1688
1755
|
const EXPECTED = {
|
|
1689
1756
|
action: "a directory with action.yml",
|
|
1690
1757
|
directory: "a directory",
|
|
@@ -1708,10 +1775,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
|
|
|
1708
1775
|
return Option.getOrElse(directory, () => false);
|
|
1709
1776
|
});
|
|
1710
1777
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
1711
|
-
const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$
|
|
1778
|
+
const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$3}${name}`)));
|
|
1712
1779
|
return pipe(found, Array.some(Boolean));
|
|
1713
1780
|
});
|
|
1714
|
-
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$
|
|
1781
|
+
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$3))}`;
|
|
1715
1782
|
const RESOLVERS = {
|
|
1716
1783
|
action: hasAction,
|
|
1717
1784
|
directory: isDirectoryAt,
|
|
@@ -1719,13 +1786,13 @@ const RESOLVERS = {
|
|
|
1719
1786
|
glob: matchesGlob,
|
|
1720
1787
|
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
1721
1788
|
if (yield* existsAt(root, path)) return true;
|
|
1722
|
-
const segments = String$1.split(path, SEPARATOR$
|
|
1789
|
+
const segments = String$1.split(path, SEPARATOR$3);
|
|
1723
1790
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
1724
1791
|
})
|
|
1725
1792
|
};
|
|
1726
1793
|
const staticPrefix = (path) => {
|
|
1727
1794
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
|
|
1728
|
-
if (String$1.endsWith(SEPARATOR$
|
|
1795
|
+
if (String$1.endsWith(SEPARATOR$3)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
|
|
1729
1796
|
return prefix;
|
|
1730
1797
|
};
|
|
1731
1798
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -1734,39 +1801,41 @@ const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
|
1734
1801
|
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
1735
1802
|
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
1736
1803
|
});
|
|
1737
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$
|
|
1804
|
+
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$3}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$3}`)(path);
|
|
1738
1805
|
const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
1739
1806
|
const prefix = staticPrefix(found.path);
|
|
1740
1807
|
if (pipe(produced, Array.some(overlaps(prefix)))) return false;
|
|
1741
1808
|
if (yield* RESOLVERS[found.kind](root, found.path)) return false;
|
|
1742
1809
|
return !(yield* isIgnored$1(root, found.path));
|
|
1743
1810
|
});
|
|
1744
|
-
const problemOf$
|
|
1811
|
+
const problemOf$5 = (file, source) => (found) => ({
|
|
1745
1812
|
file,
|
|
1746
1813
|
...positionOf(source)(found.offset),
|
|
1747
|
-
rule: RULE$
|
|
1814
|
+
rule: RULE$13,
|
|
1748
1815
|
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.`
|
|
1749
1816
|
});
|
|
1750
|
-
const problemsIn$
|
|
1817
|
+
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
1751
1818
|
const files = yield* RepositoryFiles;
|
|
1752
1819
|
const file = files.join(root, workflow);
|
|
1753
1820
|
const source = yield* files.readFile(file);
|
|
1754
1821
|
if (Option.isNone(source)) return [];
|
|
1755
1822
|
const produced = producedPaths(source.value);
|
|
1756
1823
|
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
|
|
1757
|
-
return pipe(missing, Array.map(problemOf$
|
|
1824
|
+
return pipe(missing, Array.map(problemOf$5(file, source.value)));
|
|
1758
1825
|
});
|
|
1759
1826
|
/** @internal */
|
|
1760
1827
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
1761
1828
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
1762
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
1829
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$6(root, workflow), { concurrency: READ_CONCURRENCY$8 });
|
|
1763
1830
|
return Array.flatten(found);
|
|
1764
1831
|
});
|
|
1765
1832
|
// src/features/repository-layout/model/workspace-checks.ts
|
|
1766
1833
|
/** @internal */
|
|
1767
1834
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
1768
1835
|
const found = yield* Effect.all([
|
|
1836
|
+
checkCommandEntries(root),
|
|
1769
1837
|
checkCrates(root),
|
|
1838
|
+
checkFallowEntries(root),
|
|
1770
1839
|
checkHiddenVerify(root),
|
|
1771
1840
|
checkRootWorkspacePaths(root),
|
|
1772
1841
|
checkSharedUncachedTasks(root),
|
|
@@ -1774,117 +1843,109 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
1774
1843
|
], { concurrency: "unbounded" });
|
|
1775
1844
|
return Array.flatten(found);
|
|
1776
1845
|
});
|
|
1777
|
-
// src/features/
|
|
1778
|
-
const
|
|
1779
|
-
const
|
|
1780
|
-
const
|
|
1781
|
-
const
|
|
1782
|
-
const
|
|
1783
|
-
const
|
|
1784
|
-
const
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
command: Schema.optional(Schema.String),
|
|
1788
|
-
args: Schema.optional(Schema.Array(Schema.String))
|
|
1789
|
-
});
|
|
1790
|
-
const MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });
|
|
1791
|
-
const HooksSchema = Schema.Struct({ SessionStart: Schema.optional(Schema.Array(MatcherSchema)) });
|
|
1792
|
-
const SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });
|
|
1793
|
-
const decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));
|
|
1794
|
-
const NO_TEXT = [];
|
|
1795
|
-
const commandText = ({ command, args }) => [...Option.toArray(Option.fromUndefinedOr(command)), ...pipe(Option.fromUndefinedOr(args), Option.getOrElse(() => NO_TEXT))];
|
|
1796
|
-
const matcherText = ({ hooks }) => pipe(hooks, Array.flatMap((hook) => commandText(hook)));
|
|
1797
|
-
const sessionStartCommands = (source) => {
|
|
1798
|
-
const matchers = pipe(decodeSettings(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)));
|
|
1799
|
-
return pipe(matchers, Option.map(Array.flatMap((matcher) => matcherText(matcher))), Option.getOrElse(() => NO_TEXT));
|
|
1846
|
+
// src/features/pass-through-wrappers/model/pass-through-wrappers.ts
|
|
1847
|
+
const RULE$12 = "pass-through-wrapper";
|
|
1848
|
+
const SINGLE_STATEMENT = 1;
|
|
1849
|
+
const SINGLE_DECLARATION = 1;
|
|
1850
|
+
const THIS_PARAMETER = "this";
|
|
1851
|
+
const NO_ARGUMENTS = [];
|
|
1852
|
+
const messageOf = (callee) => `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;
|
|
1853
|
+
const unwrapped = (expression) => {
|
|
1854
|
+
if (isParenthesizedExpression(expression)) return unwrapped(expression.expression);
|
|
1855
|
+
return expression;
|
|
1800
1856
|
};
|
|
1801
|
-
const
|
|
1802
|
-
const
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1857
|
+
const isWrapperExpression = (expression) => isArrowFunction(expression) || isFunctionExpression(expression);
|
|
1858
|
+
const candidateOf = (node) => {
|
|
1859
|
+
if (isFunctionDeclaration(node)) return pipe(Option.fromUndefinedOr(node.name), Option.map((name) => ({
|
|
1860
|
+
name,
|
|
1861
|
+
wrapper: node
|
|
1862
|
+
})));
|
|
1863
|
+
if (!isVariableDeclaration(node) || !isIdentifier(node.name)) return Option.none();
|
|
1864
|
+
const { name } = node;
|
|
1865
|
+
return pipe(Option.fromUndefinedOr(node.initializer), Option.map(unwrapped), Option.filter(isWrapperExpression), Option.map((wrapper) => ({
|
|
1866
|
+
name,
|
|
1867
|
+
wrapper
|
|
1868
|
+
})));
|
|
1869
|
+
};
|
|
1870
|
+
const changesTheCall = (wrapper) => Predicate.isNotUndefined(wrapper.asteriskToken) || Option.exists(Option.fromUndefinedOr(wrapper.type), (type) => type.kind === SyntaxKind.TypePredicate) || pipe(wrapper.modifiers ?? [], Array.some((modifier) => modifier.kind === SyntaxKind.AsyncKeyword));
|
|
1871
|
+
const returnedExpression = (wrapper) => {
|
|
1872
|
+
const { body } = wrapper;
|
|
1873
|
+
if (Predicate.isUndefined(body)) return Option.none();
|
|
1874
|
+
if (!isBlock(body)) return Option.some(body);
|
|
1875
|
+
if (body.statements.length !== SINGLE_STATEMENT) return Option.none();
|
|
1876
|
+
return pipe(Array.head(body.statements), Option.filter((statement) => isReturnStatement(statement)), Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)));
|
|
1877
|
+
};
|
|
1878
|
+
const callForward = (call) => ({
|
|
1879
|
+
node: call,
|
|
1880
|
+
callee: call.expression,
|
|
1881
|
+
kind: SignatureKind.Call,
|
|
1882
|
+
arguments: call.arguments,
|
|
1883
|
+
typed: Predicate.isNotUndefined(call.typeArguments),
|
|
1884
|
+
optional: Predicate.isNotUndefined(call.questionDotToken)
|
|
1809
1885
|
});
|
|
1810
|
-
|
|
1811
|
-
const
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
};
|
|
1823
|
-
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
1824
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$4 });
|
|
1825
|
-
return pipe(shell, Array.map((name) => problemFor(files.join(root, name))));
|
|
1826
|
-
});
|
|
1827
|
-
// src/shared/lib/workflow-files.ts
|
|
1828
|
-
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
1829
|
-
const READ_CONCURRENCY$3 = 16;
|
|
1830
|
-
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
1831
|
-
const files = yield* RepositoryFiles;
|
|
1832
|
-
const names = yield* files.listedFiles(root);
|
|
1833
|
-
const found = yield* Effect.forEach(pipe(names, Array.filter((name) => WORKFLOW_FILE.test(name))), (name) => {
|
|
1834
|
-
const file = files.join(root, name);
|
|
1835
|
-
return files.readFile(file).pipe(Effect.map(Option.map((source) => ({
|
|
1836
|
-
file,
|
|
1837
|
-
source
|
|
1838
|
-
}))));
|
|
1839
|
-
}, { concurrency: READ_CONCURRENCY$3 });
|
|
1840
|
-
return Array.getSomes(found);
|
|
1841
|
-
});
|
|
1842
|
-
// src/features/scripts/model/workflows.ts
|
|
1843
|
-
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
1844
|
-
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
1845
|
-
const COMMENT = "#";
|
|
1846
|
-
const RUN_KEY = "run";
|
|
1847
|
-
const RULE$3 = "workflow-script";
|
|
1848
|
-
const START$4 = 0;
|
|
1849
|
-
const ONE_COMMAND = 1;
|
|
1850
|
-
const MESSAGE$2 = "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.";
|
|
1851
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$4));
|
|
1852
|
-
const runScriptsOf = (source) => {
|
|
1853
|
-
const found = [];
|
|
1854
|
-
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
1855
|
-
if (isPair(pair) && isScalar(pair.key) && pair.key.value === RUN_KEY && isScalar(pair.value) && typeof pair.value.value === "string") found.push({
|
|
1856
|
-
text: pair.value.value,
|
|
1857
|
-
start: startOf(pair.value.range)
|
|
1858
|
-
});
|
|
1859
|
-
} });
|
|
1860
|
-
return found;
|
|
1886
|
+
const forwardOf = (expression) => {
|
|
1887
|
+
const inner = unwrapped(expression);
|
|
1888
|
+
if (isCallExpression(inner)) return Option.some(callForward(inner));
|
|
1889
|
+
if (isNewExpression(inner)) return Option.some({
|
|
1890
|
+
node: inner,
|
|
1891
|
+
callee: inner.expression,
|
|
1892
|
+
kind: SignatureKind.Construct,
|
|
1893
|
+
arguments: inner.arguments ?? NO_ARGUMENTS,
|
|
1894
|
+
typed: Predicate.isNotUndefined(inner.typeArguments),
|
|
1895
|
+
optional: false
|
|
1896
|
+
});
|
|
1897
|
+
return Option.none();
|
|
1861
1898
|
};
|
|
1862
|
-
const
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
1899
|
+
const rootOf = (callee) => {
|
|
1900
|
+
if (isIdentifier(callee)) return Option.some(callee);
|
|
1901
|
+
if (isPropertyAccessExpression(callee) && Predicate.isUndefined(callee.questionDotToken) && isIdentifier(callee.name)) return rootOf(callee.expression);
|
|
1902
|
+
return Option.none();
|
|
1867
1903
|
};
|
|
1868
|
-
const
|
|
1869
|
-
const
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
...at(start),
|
|
1873
|
-
rule: RULE$3,
|
|
1874
|
-
message: MESSAGE$2
|
|
1875
|
-
})));
|
|
1904
|
+
const parameterName = (parameter) => {
|
|
1905
|
+
const { name } = parameter;
|
|
1906
|
+
if (!isIdentifier(name) || Predicate.isNotUndefined(parameter.initializer) || name.text === THIS_PARAMETER) return Option.none();
|
|
1907
|
+
return Option.some(name.text);
|
|
1876
1908
|
};
|
|
1877
|
-
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1880
|
-
return
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
const
|
|
1885
|
-
|
|
1886
|
-
|
|
1909
|
+
const isRest = (parameter) => Predicate.isNotUndefined(parameter.dotDotDotToken);
|
|
1910
|
+
const forwardsParameter = ([parameter, name, argument]) => {
|
|
1911
|
+
if (!isRest(parameter)) return isIdentifier(argument) && argument.text === name;
|
|
1912
|
+
return isSpreadElement(argument) && isIdentifier(argument.expression) && argument.expression.text === name;
|
|
1913
|
+
};
|
|
1914
|
+
const forwardedNames = (wrapper, forward) => {
|
|
1915
|
+
const { parameters } = wrapper;
|
|
1916
|
+
const names = pipe(parameters, Array.map(parameterName), Array.getSomes);
|
|
1917
|
+
if (names.length !== parameters.length || forward.arguments.length !== parameters.length) return Option.none();
|
|
1918
|
+
const triples = Array.zipWith(Array.zip(parameters, names), forward.arguments, ([parameter, name], argument) => [
|
|
1919
|
+
parameter,
|
|
1920
|
+
name,
|
|
1921
|
+
argument
|
|
1922
|
+
]);
|
|
1923
|
+
return pipe(Option.some(names), Option.filter(() => pipe(triples, Array.every(forwardsParameter))));
|
|
1924
|
+
};
|
|
1925
|
+
const calleeTakesExactly = (checker) => (forward, count) => {
|
|
1926
|
+
const signatures = checker.getSignaturesOfType(checker.getTypeAtLocation(forward.callee), forward.kind);
|
|
1927
|
+
return Array.isReadonlyArrayNonEmpty(signatures) && pipe(signatures, Array.every((signature) => !signature.hasRestParameter && signature.parameters.length === count && !Array.isReadonlyArrayNonEmpty(signature.typeParameters ?? [])));
|
|
1928
|
+
};
|
|
1929
|
+
const keepsTheReturnType = (checker) => (wrapper, forward) => Option.match(Option.fromUndefinedOr(wrapper.type), {
|
|
1930
|
+
onNone: () => true,
|
|
1931
|
+
onSome: (type) => checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id
|
|
1887
1932
|
});
|
|
1933
|
+
const isOverloaded = (checker) => (name) => Option.exists(Option.fromUndefinedOr(checker.getSymbolAtLocation(name)), (symbol) => symbol.declarations.length > SINGLE_DECLARATION);
|
|
1934
|
+
const callsAnotherFunction = ({ name }, forward, names) => Option.exists(rootOf(forward.callee), (root) => root.text !== name.text && !names.includes(root.text));
|
|
1935
|
+
const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
1936
|
+
const { wrapper, name } = candidate;
|
|
1937
|
+
if (forward.typed || forward.optional) return false;
|
|
1938
|
+
const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
|
|
1939
|
+
return Option.exists(forwardedNames(wrapper, forward), (names) => callsAnotherFunction(candidate, forward, names)) && (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) && keepsTheReturnType(checker)(wrapper, forward) && !isOverloaded(checker)(name);
|
|
1940
|
+
};
|
|
1941
|
+
const problemOf$4 = (checker) => (candidate) => {
|
|
1942
|
+
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
1943
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$1({
|
|
1944
|
+
rule: RULE$12,
|
|
1945
|
+
message: messageOf(forward.callee.getText())
|
|
1946
|
+
})(candidate.name)));
|
|
1947
|
+
};
|
|
1948
|
+
const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$4(checker)), Array.getSomes);
|
|
1888
1949
|
// src/features/value-owners/model/slots.ts
|
|
1889
1950
|
const ANNOTATED_KINDS = /* @__PURE__ */ new Set([
|
|
1890
1951
|
SyntaxKind.Parameter,
|
|
@@ -1981,7 +2042,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
1981
2042
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
1982
2043
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
1983
2044
|
};
|
|
1984
|
-
const annotationProblem = (message) => problemAt({
|
|
2045
|
+
const annotationProblem = (message) => problemAt$1({
|
|
1985
2046
|
rule: "owner-annotation",
|
|
1986
2047
|
message
|
|
1987
2048
|
});
|
|
@@ -2106,7 +2167,7 @@ const shapeProblem = (site, matches) => {
|
|
|
2106
2167
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
2107
2168
|
onSome: () => "Use the library type instead of copying it."
|
|
2108
2169
|
});
|
|
2109
|
-
return problemAt({
|
|
2170
|
+
return problemAt$1({
|
|
2110
2171
|
rule: "library-shape",
|
|
2111
2172
|
message: `This shape copies ${shown}. ${advice}`
|
|
2112
2173
|
})(site.node);
|
|
@@ -2167,7 +2228,7 @@ const derivationScopeOf = (node) => {
|
|
|
2167
2228
|
};
|
|
2168
2229
|
const sourcesOf = (checker) => (node) => pipe(referencedSymbols(checker)(derivationScopeOf(node)), Array.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))));
|
|
2169
2230
|
const sitesUnder = (checker) => (node) => {
|
|
2170
|
-
const nested = pipe(childrenOf$
|
|
2231
|
+
const nested = pipe(childrenOf$3(node), Array.flatMap((child) => sitesUnder(checker)(child)));
|
|
2171
2232
|
if (Array.isReadonlyArrayNonEmpty(nested)) return nested;
|
|
2172
2233
|
return siteValuesOf(checker)(node).pipe(Option.map((values) => ({
|
|
2173
2234
|
node,
|
|
@@ -2200,7 +2261,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
2200
2261
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
2201
2262
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
2202
2263
|
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.`;
|
|
2203
|
-
return verdict([problemAt({
|
|
2264
|
+
return verdict([problemAt$1({
|
|
2204
2265
|
rule: "owner-extension",
|
|
2205
2266
|
message
|
|
2206
2267
|
})(site.node)], []);
|
|
@@ -2222,7 +2283,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2222
2283
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
2223
2284
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
2224
2285
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
2225
|
-
return verdict([problemAt({
|
|
2286
|
+
return verdict([problemAt$1({
|
|
2226
2287
|
rule: "owner-value-set",
|
|
2227
2288
|
message
|
|
2228
2289
|
})(site.node)], []);
|
|
@@ -2230,7 +2291,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2230
2291
|
const candidates = libraryCandidates(context)(site);
|
|
2231
2292
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
2232
2293
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
2233
|
-
return verdict([problemAt({
|
|
2294
|
+
return verdict([problemAt$1({
|
|
2234
2295
|
rule: "library-value-set",
|
|
2235
2296
|
message
|
|
2236
2297
|
})(site.node)], []);
|
|
@@ -2261,7 +2322,7 @@ const isValuePosition = (node) => {
|
|
|
2261
2322
|
const { parent } = node;
|
|
2262
2323
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
2263
2324
|
};
|
|
2264
|
-
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({
|
|
2325
|
+
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$1({
|
|
2265
2326
|
rule: "owned-literal",
|
|
2266
2327
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
2267
2328
|
})(literal)));
|
|
@@ -2531,10 +2592,410 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
2531
2592
|
...duplicateProblems(relative)(unowned)
|
|
2532
2593
|
]);
|
|
2533
2594
|
}, Effect.scoped);
|
|
2595
|
+
// src/app/source-checks.ts
|
|
2596
|
+
/** @internal */
|
|
2597
|
+
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn]);
|
|
2598
|
+
// src/features/agent-settings/model/missing-hooks.ts
|
|
2599
|
+
const RULE$11 = "missing-hook";
|
|
2600
|
+
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
2601
|
+
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
2602
|
+
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
2603
|
+
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
2604
|
+
const PLUGIN_ROOT = "..";
|
|
2605
|
+
const READ_CONCURRENCY$7 = 16;
|
|
2606
|
+
const START$9 = 0;
|
|
2607
|
+
const referenceOf = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
2608
|
+
path,
|
|
2609
|
+
index: found.index ?? START$9
|
|
2610
|
+
})), Option.toArray);
|
|
2611
|
+
const referencesIn = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf));
|
|
2612
|
+
const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
2613
|
+
const files = yield* RepositoryFiles;
|
|
2614
|
+
const text = yield* files.readFile(file);
|
|
2615
|
+
if (Option.isNone(text)) return [];
|
|
2616
|
+
const source = text.value;
|
|
2617
|
+
const absent = yield* Effect.filter(referencesIn(pattern, source), ({ path }) => files.exists(files.join(base, path)).pipe(Effect.map((exists) => !exists)));
|
|
2618
|
+
const targetOf = ({ path }) => files.join(base, path);
|
|
2619
|
+
const built = yield* files.ignoredPaths(root, pipe(absent, Array.map(targetOf)));
|
|
2620
|
+
const missing = pipe(absent, Array.filter((reference) => !Array.contains(built, targetOf(reference))));
|
|
2621
|
+
return pipe(missing, Array.map(({ path, index }) => ({
|
|
2622
|
+
file,
|
|
2623
|
+
...positionOf(source)(index),
|
|
2624
|
+
rule: RULE$11,
|
|
2625
|
+
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.`
|
|
2626
|
+
})));
|
|
2627
|
+
});
|
|
2628
|
+
/** @internal */
|
|
2629
|
+
const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingHooks(root) {
|
|
2630
|
+
const files = yield* RepositoryFiles;
|
|
2631
|
+
const listed = yield* files.listedFiles(root);
|
|
2632
|
+
const hookFiles = pipe(listed, Array.flatMap((name) => {
|
|
2633
|
+
const file = files.join(root, name);
|
|
2634
|
+
if (SETTINGS_FILE$1.test(name)) return [{
|
|
2635
|
+
root,
|
|
2636
|
+
file,
|
|
2637
|
+
base: root,
|
|
2638
|
+
pattern: PROJECT_PATH
|
|
2639
|
+
}];
|
|
2640
|
+
if (PLUGIN_HOOKS_FILE.test(name)) return [{
|
|
2641
|
+
root,
|
|
2642
|
+
file,
|
|
2643
|
+
base: files.join(files.dirname(file), PLUGIN_ROOT),
|
|
2644
|
+
pattern: PLUGIN_PATH
|
|
2645
|
+
}];
|
|
2646
|
+
return [];
|
|
2647
|
+
}));
|
|
2648
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$5, { concurrency: READ_CONCURRENCY$7 });
|
|
2649
|
+
return Array.flatten(found);
|
|
2650
|
+
});
|
|
2651
|
+
// src/features/scripts/model/shell-scripts.ts
|
|
2652
|
+
const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
2653
|
+
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
2654
|
+
const EXTENSION = /\.[^./]+$/u;
|
|
2655
|
+
const SETTINGS_FILE = ".claude/settings.json";
|
|
2656
|
+
const READ_CONCURRENCY$6 = 64;
|
|
2657
|
+
const FIRST$3 = 1;
|
|
2658
|
+
const RULE$10 = "shell-script";
|
|
2659
|
+
const MESSAGE$4 = "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.";
|
|
2660
|
+
const HookSchema = Schema.Struct({
|
|
2661
|
+
command: Schema.optional(Schema.String),
|
|
2662
|
+
args: Schema.optional(Schema.Array(Schema.String))
|
|
2663
|
+
});
|
|
2664
|
+
const MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });
|
|
2665
|
+
const HooksSchema = Schema.Struct({ SessionStart: Schema.optional(Schema.Array(MatcherSchema)) });
|
|
2666
|
+
const SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });
|
|
2667
|
+
const decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));
|
|
2668
|
+
const NO_TEXT = [];
|
|
2669
|
+
const commandText = ({ command, args }) => [...Option.toArray(Option.fromUndefinedOr(command)), ...pipe(Option.fromUndefinedOr(args), Option.getOrElse(() => NO_TEXT))];
|
|
2670
|
+
const matcherText = ({ hooks }) => pipe(hooks, Array.flatMap((hook) => commandText(hook)));
|
|
2671
|
+
const sessionStartCommands = (source) => {
|
|
2672
|
+
const matchers = pipe(decodeSettings(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)));
|
|
2673
|
+
return pipe(matchers, Option.map(Array.flatMap((matcher) => matcherText(matcher))), Option.getOrElse(() => NO_TEXT));
|
|
2674
|
+
};
|
|
2675
|
+
const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.getOrElse(() => name));
|
|
2676
|
+
const hasExtension = (name) => EXTENSION.test(baseName(name));
|
|
2677
|
+
const problemFor$1 = (file) => ({
|
|
2678
|
+
file,
|
|
2679
|
+
line: FIRST$3,
|
|
2680
|
+
column: FIRST$3,
|
|
2681
|
+
rule: RULE$10,
|
|
2682
|
+
message: MESSAGE$4
|
|
2683
|
+
});
|
|
2684
|
+
/** @internal */
|
|
2685
|
+
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
2686
|
+
const files = yield* RepositoryFiles;
|
|
2687
|
+
const names = yield* files.listedFiles(root);
|
|
2688
|
+
const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));
|
|
2689
|
+
const commands = pipe(settings, Option.map(sessionStartCommands), Option.getOrElse(() => NO_TEXT));
|
|
2690
|
+
const isSessionStartHook = (name) => pipe(commands, Array.some(String$1.includes(name)));
|
|
2691
|
+
const isShell = (name) => {
|
|
2692
|
+
const file = files.join(root, name);
|
|
2693
|
+
if (SHELL_FILE.test(name)) return files.exists(file);
|
|
2694
|
+
if (hasExtension(name)) return Effect.succeed(false);
|
|
2695
|
+
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
2696
|
+
};
|
|
2697
|
+
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
2698
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$6 });
|
|
2699
|
+
return pipe(shell, Array.map((name) => problemFor$1(files.join(root, name))));
|
|
2700
|
+
});
|
|
2701
|
+
// src/shared/lib/workflow-files.ts
|
|
2702
|
+
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
2703
|
+
const READ_CONCURRENCY$5 = 16;
|
|
2704
|
+
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
2705
|
+
const files = yield* RepositoryFiles;
|
|
2706
|
+
const names = yield* files.listedFiles(root);
|
|
2707
|
+
const found = yield* Effect.forEach(pipe(names, Array.filter((name) => WORKFLOW_FILE.test(name))), (name) => {
|
|
2708
|
+
const file = files.join(root, name);
|
|
2709
|
+
return files.readFile(file).pipe(Effect.map(Option.map((source) => ({
|
|
2710
|
+
file,
|
|
2711
|
+
source
|
|
2712
|
+
}))));
|
|
2713
|
+
}, { concurrency: READ_CONCURRENCY$5 });
|
|
2714
|
+
return Array.getSomes(found);
|
|
2715
|
+
});
|
|
2716
|
+
// src/shared/lib/workflow-run.ts
|
|
2717
|
+
const RUN_KEY = "run";
|
|
2718
|
+
const START$8 = 0;
|
|
2719
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$8));
|
|
2720
|
+
const runScriptsOf = (source) => {
|
|
2721
|
+
const found = [];
|
|
2722
|
+
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
2723
|
+
if (isPair(pair) && isScalar(pair.key) && pair.key.value === RUN_KEY && isScalar(pair.value) && typeof pair.value.value === "string") found.push({
|
|
2724
|
+
text: pair.value.value,
|
|
2725
|
+
start: startOf(pair.value.range)
|
|
2726
|
+
});
|
|
2727
|
+
} });
|
|
2728
|
+
return found;
|
|
2729
|
+
};
|
|
2730
|
+
// src/features/scripts/model/workflows.ts
|
|
2731
|
+
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
2732
|
+
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
2733
|
+
const COMMENT = "#";
|
|
2734
|
+
const RULE$9 = "workflow-script";
|
|
2735
|
+
const ONE_COMMAND = 1;
|
|
2736
|
+
const MESSAGE$3 = "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.";
|
|
2737
|
+
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
2738
|
+
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
2739
|
+
const runsMoreThanOneCommand = ({ text }) => {
|
|
2740
|
+
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
2741
|
+
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
2742
|
+
};
|
|
2743
|
+
const problemsIn$4 = (file) => (source) => {
|
|
2744
|
+
const at = positionOf(source);
|
|
2745
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
2746
|
+
file,
|
|
2747
|
+
...at(start),
|
|
2748
|
+
rule: RULE$9,
|
|
2749
|
+
message: MESSAGE$3
|
|
2750
|
+
})));
|
|
2751
|
+
};
|
|
2752
|
+
/** @internal */
|
|
2753
|
+
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
2754
|
+
const workflows = yield* readWorkflows(root);
|
|
2755
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$4(file)(source)));
|
|
2756
|
+
});
|
|
2757
|
+
// src/features/scripts/model/script-checks.ts
|
|
2758
|
+
/** @internal */
|
|
2759
|
+
const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
|
|
2760
|
+
const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], { concurrency: "unbounded" });
|
|
2761
|
+
return Array.flatten(found);
|
|
2762
|
+
});
|
|
2763
|
+
// src/features/vite-plus/model/command-words.ts
|
|
2764
|
+
const CONTINUATION = /\\\n/gu;
|
|
2765
|
+
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
2766
|
+
const SEPARATOR$2 = /&&|\|\||[;|\n`]|\$\(/u;
|
|
2767
|
+
const BLANK$1 = /\s+/u;
|
|
2768
|
+
const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
|
|
2769
|
+
const QUOTE = "\"\"";
|
|
2770
|
+
const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
|
|
2771
|
+
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$2), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
|
|
2772
|
+
// src/features/vite-plus/model/command-problems.ts
|
|
2773
|
+
const PACKAGE_MANAGERS = [
|
|
2774
|
+
"pnpm",
|
|
2775
|
+
"pnpx",
|
|
2776
|
+
"npm",
|
|
2777
|
+
"npx",
|
|
2778
|
+
"yarn",
|
|
2779
|
+
"bun",
|
|
2780
|
+
"bunx"
|
|
2781
|
+
];
|
|
2782
|
+
const VITE_PLUS = "vp";
|
|
2783
|
+
const RUN = "run";
|
|
2784
|
+
const GIT = "git";
|
|
2785
|
+
const GITHUB$1 = "gh";
|
|
2786
|
+
const MERGE = "merge";
|
|
2787
|
+
const SKIP_HOOKS = "--no-verify";
|
|
2788
|
+
const BYPASS_RULESET = "--admin";
|
|
2789
|
+
const FILTER = /^(?:--filter(?:=.*)?|-F)$/u;
|
|
2790
|
+
const TASK_KINDS = ["script", "task"];
|
|
2791
|
+
const SECOND = 1;
|
|
2792
|
+
const programOf = (words) => Array.headNonEmpty(words);
|
|
2793
|
+
const subcommandOf = (words) => Array.get(words, SECOND);
|
|
2794
|
+
const RULES = [
|
|
2795
|
+
{
|
|
2796
|
+
rule: "package-manager-command",
|
|
2797
|
+
applies: (_source, words) => Array.contains(PACKAGE_MANAGERS, programOf(words)),
|
|
2798
|
+
message: (command) => `\`${command}\` calls the package manager directly. Run it through vp (vp install, vp add, vp exec, vp dlx, vp run), so that hooks, CI and sessions all use the toolchain Vite+ pins.`
|
|
2799
|
+
},
|
|
2800
|
+
{
|
|
2801
|
+
rule: "skipped-gate",
|
|
2802
|
+
applies: (_source, words) => programOf(words) === GIT && Array.contains(words, SKIP_HOOKS) || programOf(words) === GITHUB$1 && Array.contains(words, MERGE) && Array.contains(words, BYPASS_RULESET),
|
|
2803
|
+
message: (command) => `\`${command}\` skips a gate: ${SKIP_HOOKS} skips the hooks that run verify, and ${BYPASS_RULESET} bypasses the ruleset. Remove the flag and fix what the gate reports.`
|
|
2804
|
+
},
|
|
2805
|
+
{
|
|
2806
|
+
rule: "filter-task",
|
|
2807
|
+
applies: (source, words) => Array.contains(TASK_KINDS, source.kind) && programOf(words) === VITE_PLUS && Option.contains(subcommandOf(words), RUN) && pipe(words, Array.some((word) => FILTER.test(word))),
|
|
2808
|
+
message: (command) => `\`${command}\` wraps one package's task in another task. Write <package>#<task> in dependsOn instead, so that Vite+ sees the dependency and caches it.`
|
|
2809
|
+
}
|
|
2810
|
+
];
|
|
2811
|
+
const problemsOf = (source) => pipe(simpleCommands(source.text), Array.flatMap((words) => pipe(RULES, Array.filter(({ applies }) => applies(source, words)), Array.map(({ rule, message }) => ({
|
|
2812
|
+
file: source.file,
|
|
2813
|
+
...source.position,
|
|
2814
|
+
rule,
|
|
2815
|
+
message: message(String$1.trim(Array.join(words, " ")))
|
|
2816
|
+
})))));
|
|
2817
|
+
const commandProblems$1 = (sources) => pipe(sources, Array.flatMap(problemsOf));
|
|
2818
|
+
// src/features/vite-plus/model/command-sources.ts
|
|
2819
|
+
const ROOT_DIRECTORY = ".";
|
|
2820
|
+
const COMMAND_KEY = "command";
|
|
2821
|
+
const ARGUMENTS_KEY = "args";
|
|
2822
|
+
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
2823
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED$1];
|
|
2824
|
+
const STEP_FILES = [
|
|
2825
|
+
":(glob).github/workflows/*.yml",
|
|
2826
|
+
":(glob).github/workflows/*.yaml",
|
|
2827
|
+
":(glob)**/action.yml",
|
|
2828
|
+
":(glob)**/action.yaml",
|
|
2829
|
+
...EXCLUDED$1
|
|
2830
|
+
];
|
|
2831
|
+
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
2832
|
+
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
2833
|
+
const READ_CONCURRENCY$4 = 16;
|
|
2834
|
+
const START$7 = 0;
|
|
2835
|
+
const FIRST$2 = 1;
|
|
2836
|
+
const LINE = "\n";
|
|
2837
|
+
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
2838
|
+
const decodeCommandText = Schema.decodeUnknownOption(CommandText);
|
|
2839
|
+
const Scripts = Schema.Struct({ scripts: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
2840
|
+
const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts));
|
|
2841
|
+
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
2842
|
+
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
2843
|
+
const NO_SOURCES = [];
|
|
2844
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$7));
|
|
2845
|
+
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
2846
|
+
const offset = offsetOf$2(source, `"${name}"`);
|
|
2847
|
+
return {
|
|
2848
|
+
kind: "script",
|
|
2849
|
+
file,
|
|
2850
|
+
position: positionOf(source)(offset),
|
|
2851
|
+
name,
|
|
2852
|
+
text
|
|
2853
|
+
};
|
|
2854
|
+
}));
|
|
2855
|
+
const stepSources = (file) => (source) => pipe(runScriptsOf(source), Array.map(({ text, start }) => ({
|
|
2856
|
+
kind: "step",
|
|
2857
|
+
file,
|
|
2858
|
+
position: positionOf(source)(start),
|
|
2859
|
+
name: "run",
|
|
2860
|
+
text
|
|
2861
|
+
})));
|
|
2862
|
+
const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE), Array.map((text, index) => ({
|
|
2863
|
+
kind: "hook",
|
|
2864
|
+
file,
|
|
2865
|
+
position: {
|
|
2866
|
+
line: index + FIRST$2,
|
|
2867
|
+
column: FIRST$2
|
|
2868
|
+
},
|
|
2869
|
+
name,
|
|
2870
|
+
text
|
|
2871
|
+
})));
|
|
2872
|
+
const commandIn = (node) => {
|
|
2873
|
+
if (!Predicate.isReadonlyObject(node)) return Option.none();
|
|
2874
|
+
const record = node;
|
|
2875
|
+
return pipe(Option.fromUndefinedOr(record[COMMAND_KEY]), Option.filter(Predicate.isString), Option.map((command) => pipe(decodeArguments(record[ARGUMENTS_KEY]), Option.getOrElse(() => []), Array.prepend(command), Array.join(" "))));
|
|
2876
|
+
};
|
|
2877
|
+
const commandsIn = (node) => [...Option.toArray(commandIn(node)), ...pipe(childrenOf$2(node), Array.flatMap(commandsIn))];
|
|
2878
|
+
const agentSources = (file) => (source) => pipe(decodeJson(source), Option.map(commandsIn), Option.getOrElse(() => []), Array.map((text) => {
|
|
2879
|
+
const program = Array.headNonEmpty(String$1.split(text, " "));
|
|
2880
|
+
const offset = offsetOf$2(source, `"${program}"`);
|
|
2881
|
+
return {
|
|
2882
|
+
kind: "agent",
|
|
2883
|
+
file,
|
|
2884
|
+
position: positionOf(source)(offset),
|
|
2885
|
+
name: COMMAND_KEY,
|
|
2886
|
+
text
|
|
2887
|
+
};
|
|
2888
|
+
}));
|
|
2889
|
+
const taskCommand = (value) => pipe(propertyValue(COMMAND_KEY)(value), Option.orElse(() => Option.some(value)), Option.flatMap(literalOf), Option.flatMap(decodeCommandText), Option.map((command) => Array.join(Array.ensure(command), LINE)));
|
|
2890
|
+
const taskSource = (file, source) => (task) => pipe(taskCommand(task.value), Option.map((text) => ({
|
|
2891
|
+
kind: "task",
|
|
2892
|
+
file,
|
|
2893
|
+
position: positionOf(source)(task.start),
|
|
2894
|
+
name: keyName(task.key),
|
|
2895
|
+
text
|
|
2896
|
+
})));
|
|
2897
|
+
const taskSources = Effect.fn("taskSources")(function* taskSources(root, directory) {
|
|
2898
|
+
const found = yield* runTasksOf(root, directory);
|
|
2899
|
+
if (Option.isNone(found)) return NO_SOURCES;
|
|
2900
|
+
const { file, source, tasks } = found.value;
|
|
2901
|
+
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
2902
|
+
});
|
|
2903
|
+
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
2904
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$4 });
|
|
2905
|
+
return Array.flatten(found);
|
|
2906
|
+
});
|
|
2907
|
+
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
2908
|
+
const files = yield* RepositoryFiles;
|
|
2909
|
+
const found = yield* Effect.forEach(names, (name) => {
|
|
2910
|
+
const file = files.join(root, name);
|
|
2911
|
+
const sourcesIn = Option.match({
|
|
2912
|
+
onNone: () => NO_SOURCES,
|
|
2913
|
+
onSome: sourcesOf(file, name)
|
|
2914
|
+
});
|
|
2915
|
+
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
2916
|
+
}, { concurrency: READ_CONCURRENCY$4 });
|
|
2917
|
+
return Array.flatten(found);
|
|
2918
|
+
});
|
|
2919
|
+
/** @internal */
|
|
2920
|
+
const commandSources = Effect.fn("commandSources")(function* commandSources(root) {
|
|
2921
|
+
const files = yield* RepositoryFiles;
|
|
2922
|
+
const [manifests, steps, hooks, workspaces] = yield* Effect.all([
|
|
2923
|
+
files.matchingFiles(root, MANIFESTS),
|
|
2924
|
+
files.matchingFiles(root, STEP_FILES),
|
|
2925
|
+
files.matchingFiles(root, HOOK_FILES),
|
|
2926
|
+
workspaceDirectories(root)
|
|
2927
|
+
], { concurrency: "unbounded" });
|
|
2928
|
+
const found = yield* Effect.all([
|
|
2929
|
+
readSources(root, manifests, scriptSources),
|
|
2930
|
+
readSources(root, steps, stepSources),
|
|
2931
|
+
readSources(root, hooks, hookSources),
|
|
2932
|
+
readSources(root, AGENT_FILES, agentSources),
|
|
2933
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY, ...workspaces]))
|
|
2934
|
+
], { concurrency: "unbounded" });
|
|
2935
|
+
return Array.flatten(found);
|
|
2936
|
+
});
|
|
2937
|
+
// src/features/vite-plus/model/package-scripts.ts
|
|
2938
|
+
const RULE$8 = "package-script";
|
|
2939
|
+
const LIFECYCLE = [
|
|
2940
|
+
"preinstall",
|
|
2941
|
+
"install",
|
|
2942
|
+
"postinstall",
|
|
2943
|
+
"preprepare",
|
|
2944
|
+
"prepare",
|
|
2945
|
+
"postprepare",
|
|
2946
|
+
"prepublish",
|
|
2947
|
+
"prepublishOnly",
|
|
2948
|
+
"prepack",
|
|
2949
|
+
"postpack",
|
|
2950
|
+
"publish",
|
|
2951
|
+
"postpublish",
|
|
2952
|
+
"preversion",
|
|
2953
|
+
"version",
|
|
2954
|
+
"postversion",
|
|
2955
|
+
"dependencies",
|
|
2956
|
+
"pnpm:devPreinstall"
|
|
2957
|
+
];
|
|
2958
|
+
const problemOf$3 = ({ file, position, name }) => ({
|
|
2959
|
+
file,
|
|
2960
|
+
...position,
|
|
2961
|
+
rule: RULE$8,
|
|
2962
|
+
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.`
|
|
2963
|
+
});
|
|
2964
|
+
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
2965
|
+
// src/features/vite-plus/model/vite-plus-block.ts
|
|
2966
|
+
const RULE$7 = "vite-plus-block";
|
|
2967
|
+
const MARKER = Array.join([
|
|
2968
|
+
"<!--",
|
|
2969
|
+
"VITE PLUS START",
|
|
2970
|
+
"-->"
|
|
2971
|
+
], "");
|
|
2972
|
+
const MESSAGE$2 = "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.";
|
|
2973
|
+
const problemIn = (file) => (source) => {
|
|
2974
|
+
const index = String$1.indexOf(MARKER)(source);
|
|
2975
|
+
if (Option.isNone(index)) return Option.none();
|
|
2976
|
+
return Option.some({
|
|
2977
|
+
file,
|
|
2978
|
+
...positionOf(source)(index.value),
|
|
2979
|
+
rule: RULE$7,
|
|
2980
|
+
message: MESSAGE$2
|
|
2981
|
+
});
|
|
2982
|
+
};
|
|
2983
|
+
/** @internal */
|
|
2984
|
+
const checkVitePlusBlock = (root) => agentDocProblems(root, problemIn);
|
|
2985
|
+
// src/features/vite-plus/model/vite-plus-checks.ts
|
|
2986
|
+
/** @internal */
|
|
2987
|
+
const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
|
|
2988
|
+
const [sources, blocks] = yield* Effect.all([commandSources(root), checkVitePlusBlock(root)], { concurrency: "unbounded" });
|
|
2989
|
+
return [
|
|
2990
|
+
...packageScriptProblems(sources),
|
|
2991
|
+
...commandProblems$1(sources),
|
|
2992
|
+
...blocks
|
|
2993
|
+
];
|
|
2994
|
+
});
|
|
2534
2995
|
// src/features/workflow-concurrency/model/workflow-queue.ts
|
|
2535
2996
|
const CONCURRENCY_KEY = "concurrency";
|
|
2536
2997
|
const QUEUE_KEY = "queue";
|
|
2537
|
-
const RULE$
|
|
2998
|
+
const RULE$6 = "workflow-queue";
|
|
2538
2999
|
const MESSAGE$1 = "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.";
|
|
2539
3000
|
const queueKeyOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMap((map) => Array.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === QUEUE_KEY)), Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)), Option.flatMap((key) => Option.fromNullishOr(key.range)), Option.map(([start]) => start));
|
|
2540
3001
|
const queueOffsetsOf = (source) => {
|
|
@@ -2555,12 +3016,23 @@ const checkWorkflowQueues = Effect.fn("checkWorkflowQueues")(function* checkWork
|
|
|
2555
3016
|
file,
|
|
2556
3017
|
line,
|
|
2557
3018
|
column,
|
|
2558
|
-
rule: RULE$
|
|
3019
|
+
rule: RULE$6,
|
|
2559
3020
|
message: MESSAGE$1
|
|
2560
3021
|
};
|
|
2561
3022
|
}));
|
|
2562
3023
|
}));
|
|
2563
3024
|
});
|
|
3025
|
+
// src/app/tool-use.ts
|
|
3026
|
+
/** @internal */
|
|
3027
|
+
const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
3028
|
+
const found = yield* Effect.all([
|
|
3029
|
+
checkVitePlus(root),
|
|
3030
|
+
checkMissingHooks(root),
|
|
3031
|
+
checkScripts(root),
|
|
3032
|
+
checkWorkflowQueues(root)
|
|
3033
|
+
], { concurrency: "unbounded" });
|
|
3034
|
+
return Array.flatten(found);
|
|
3035
|
+
});
|
|
2564
3036
|
// src/features/comments/model/found-comment.ts
|
|
2565
3037
|
const taggedError$2 = Schema.TaggedError;
|
|
2566
3038
|
var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
|
|
@@ -2651,7 +3123,7 @@ const COMMENT_NODES = [
|
|
|
2651
3123
|
"block_comment",
|
|
2652
3124
|
"multiline_comment"
|
|
2653
3125
|
];
|
|
2654
|
-
const START$
|
|
3126
|
+
const START$6 = 0;
|
|
2655
3127
|
const NEXT = 1;
|
|
2656
3128
|
const NONE$1 = [];
|
|
2657
3129
|
const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
|
|
@@ -2714,7 +3186,7 @@ const markupComment = (source) => (node) => {
|
|
|
2714
3186
|
}];
|
|
2715
3187
|
};
|
|
2716
3188
|
const textComments = (grammars, grammar) => (text) => {
|
|
2717
|
-
const shift = shifted(text.startIndex ?? START$
|
|
3189
|
+
const shift = shifted(text.startIndex ?? START$6);
|
|
2718
3190
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
2719
3191
|
};
|
|
2720
3192
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -2750,11 +3222,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
2750
3222
|
}[reader](source);
|
|
2751
3223
|
};
|
|
2752
3224
|
// src/features/comments/model/comments.ts
|
|
2753
|
-
const RULE$
|
|
3225
|
+
const RULE$5 = "comment";
|
|
2754
3226
|
const CONFIG_FILE = "vite.config.ts";
|
|
2755
3227
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
2756
|
-
const READ_CONCURRENCY$
|
|
2757
|
-
const START$
|
|
3228
|
+
const READ_CONCURRENCY$3 = 64;
|
|
3229
|
+
const START$5 = 0;
|
|
2758
3230
|
const FIRST_LINE$2 = 1;
|
|
2759
3231
|
const FIRST_COLUMN$2 = 1;
|
|
2760
3232
|
const READERS = [
|
|
@@ -2811,23 +3283,23 @@ const shebangReader = (source) => {
|
|
|
2811
3283
|
const readerOf = (name, source) => pipe(READERS, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
2812
3284
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
2813
3285
|
const lineBefore = (source, index) => {
|
|
2814
|
-
const lines = pipe(source, String$1.slice(START$
|
|
3286
|
+
const lines = pipe(source, String$1.slice(START$5, index), String$1.split("\n"));
|
|
2815
3287
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
2816
3288
|
};
|
|
2817
3289
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
2818
|
-
const isShebang = ({ index, text }) => index === START$
|
|
3290
|
+
const isShebang = ({ index, text }) => index === START$5 && String$1.startsWith(SHEBANG)(text);
|
|
2819
3291
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
2820
|
-
const problemOf$
|
|
3292
|
+
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
2821
3293
|
file,
|
|
2822
3294
|
...positionOf(source)(index),
|
|
2823
|
-
rule: RULE$
|
|
3295
|
+
rule: RULE$5,
|
|
2824
3296
|
message: MESSAGE
|
|
2825
3297
|
});
|
|
2826
3298
|
const unreadableProblem = (file, message) => ({
|
|
2827
3299
|
file,
|
|
2828
3300
|
line: FIRST_LINE$2,
|
|
2829
3301
|
column: FIRST_COLUMN$2,
|
|
2830
|
-
rule: RULE$
|
|
3302
|
+
rule: RULE$5,
|
|
2831
3303
|
message: `msch could not read the comments in this file: ${message}`
|
|
2832
3304
|
});
|
|
2833
3305
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -2873,7 +3345,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
2873
3345
|
const comments = commentsWith(grammars);
|
|
2874
3346
|
const problemsIn = ({ name, file }, source) => {
|
|
2875
3347
|
const kept = Predicate.not(isAllowed(source, directives));
|
|
2876
|
-
const toProblem = problemOf$
|
|
3348
|
+
const toProblem = problemOf$2(file, source);
|
|
2877
3349
|
return Option.match(readerOf(name, source), {
|
|
2878
3350
|
onNone: () => Effect.succeed(NONE),
|
|
2879
3351
|
onSome: (reader) => comments(reader, source).pipe(Effect.map(Array.filter(kept)), Effect.map(Array.map(toProblem)), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed([unreadableProblem(file, message)])))
|
|
@@ -2882,30 +3354,30 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
2882
3354
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
2883
3355
|
onNone: () => Effect.succeed(NONE),
|
|
2884
3356
|
onSome: (source) => problemsIn(entry, source)
|
|
2885
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
3357
|
+
}))), { concurrency: READ_CONCURRENCY$3 });
|
|
2886
3358
|
return Array.flatten(found);
|
|
2887
3359
|
});
|
|
2888
3360
|
// src/features/invisible-characters/model/hidden-unicode.ts
|
|
2889
3361
|
const HIDDEN = /[\u00AD\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|[\u{E0000}-\u{E007F}]/gu;
|
|
2890
3362
|
const NUL = "\0";
|
|
2891
|
-
const START$
|
|
3363
|
+
const START$4 = 0;
|
|
2892
3364
|
const HEX = 16;
|
|
2893
3365
|
const CODE_POINT_WIDTH = 4;
|
|
2894
|
-
const READ_CONCURRENCY$
|
|
2895
|
-
const RULE = "hidden-unicode";
|
|
2896
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
2897
|
-
const problemOf = (file, source) => (found) => {
|
|
2898
|
-
const hex = hexOf(found[START$
|
|
3366
|
+
const READ_CONCURRENCY$2 = 64;
|
|
3367
|
+
const RULE$4 = "hidden-unicode";
|
|
3368
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$4)(character), Option.getOrElse(() => START$4), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
3369
|
+
const problemOf$1 = (file, source) => (found) => {
|
|
3370
|
+
const hex = hexOf(found[START$4]);
|
|
2899
3371
|
return {
|
|
2900
3372
|
file,
|
|
2901
|
-
...positionOf(source)(found.index ?? START$
|
|
2902
|
-
rule: RULE,
|
|
3373
|
+
...positionOf(source)(found.index ?? START$4),
|
|
3374
|
+
rule: RULE$4,
|
|
2903
3375
|
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}.`
|
|
2904
3376
|
};
|
|
2905
3377
|
};
|
|
2906
|
-
const problemsIn = (file, source) => {
|
|
3378
|
+
const problemsIn$3 = (file, source) => {
|
|
2907
3379
|
if (String$1.includes(NUL)(source)) return [];
|
|
2908
|
-
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
|
|
3380
|
+
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
|
|
2909
3381
|
};
|
|
2910
3382
|
/** @internal */
|
|
2911
3383
|
const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHiddenUnicode(root) {
|
|
@@ -2915,16 +3387,16 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
2915
3387
|
const file = files.join(root, name);
|
|
2916
3388
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
2917
3389
|
onNone: () => [],
|
|
2918
|
-
onSome: (source) => problemsIn(file, source)
|
|
3390
|
+
onSome: (source) => problemsIn$3(file, source)
|
|
2919
3391
|
})));
|
|
2920
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
3392
|
+
}, { concurrency: READ_CONCURRENCY$2 });
|
|
2921
3393
|
return Array.flatten(found);
|
|
2922
3394
|
});
|
|
2923
3395
|
// src/shared/lib/scanned-files.ts
|
|
2924
3396
|
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:Dockerfile[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
2925
3397
|
const LOCKFILE = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
2926
3398
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
2927
|
-
const READ_CONCURRENCY = 64;
|
|
3399
|
+
const READ_CONCURRENCY$1 = 64;
|
|
2928
3400
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE.test(name);
|
|
2929
3401
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
2930
3402
|
/** @internal */
|
|
@@ -2947,7 +3419,7 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
2947
3419
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
2948
3420
|
onNone: () => [],
|
|
2949
3421
|
onSome: (source) => problemsIn(entry, source)
|
|
2950
|
-
}))), { concurrency: READ_CONCURRENCY });
|
|
3422
|
+
}))), { concurrency: READ_CONCURRENCY$1 });
|
|
2951
3423
|
return Array.flatten(found);
|
|
2952
3424
|
});
|
|
2953
3425
|
// src/features/python/model/python.ts
|
|
@@ -2995,6 +3467,326 @@ const checkPython = Effect.fn("checkPython")(function* checkPython(root) {
|
|
|
2995
3467
|
const present = yield* presentFiles(pipe(listed, Array.filter(isPython)));
|
|
2996
3468
|
return [...pipe(present, Array.map(fileProblem)), ...scanned];
|
|
2997
3469
|
});
|
|
3470
|
+
// src/features/runtime-version/model/node-version.ts
|
|
3471
|
+
const RULE$3 = "node-version";
|
|
3472
|
+
const MINIMUM = 26;
|
|
3473
|
+
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
3474
|
+
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
3475
|
+
const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
|
|
3476
|
+
const DOCKERFILE = /(?:^|\/)Dockerfile[^/]*$/u;
|
|
3477
|
+
const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
|
|
3478
|
+
const PINNED_VERSION = /^\s*v?(?<major>\d+)/u;
|
|
3479
|
+
const BASE_IMAGE = /^FROM[ \t]+(?:--\S+[ \t]+)*(?:[\w.-]+(?::\d+)?\/)*node:(?<major>\d+)/gimu;
|
|
3480
|
+
const SETUP_INPUT = /\bnode-version:[ \t]*["']?v?(?<major>\d+)/gu;
|
|
3481
|
+
const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t]+)v?(?<major>\d+)/gmu;
|
|
3482
|
+
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
3483
|
+
const ALTERNATIVE = "||";
|
|
3484
|
+
const ENGINES_KEY = "\"engines\"";
|
|
3485
|
+
const START$3 = 0;
|
|
3486
|
+
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
3487
|
+
const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
|
|
3488
|
+
const Manifest = Schema.Struct({
|
|
3489
|
+
private: Schema.optional(Schema.Boolean),
|
|
3490
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
3491
|
+
engines: Schema.optional(Engines)
|
|
3492
|
+
});
|
|
3493
|
+
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
3494
|
+
const majorOf = (found) => pipe(groupOf("major")(found), Option.map(Number));
|
|
3495
|
+
const isOld = (major) => major < MINIMUM;
|
|
3496
|
+
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
3497
|
+
const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
3498
|
+
onNone: () => true,
|
|
3499
|
+
onSome: isOld
|
|
3500
|
+
}));
|
|
3501
|
+
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
|
|
3502
|
+
const problemAt = ({ entry, source, index }, message) => ({
|
|
3503
|
+
file: entry.file,
|
|
3504
|
+
...positionOf(source)(index),
|
|
3505
|
+
rule: RULE$3,
|
|
3506
|
+
message
|
|
3507
|
+
});
|
|
3508
|
+
const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$3));
|
|
3509
|
+
const unstatedProblem = (entry, source) => problemAt({
|
|
3510
|
+
entry,
|
|
3511
|
+
source,
|
|
3512
|
+
index: START$3
|
|
3513
|
+
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
3514
|
+
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
3515
|
+
entry,
|
|
3516
|
+
source,
|
|
3517
|
+
index: offsetOf$1(source, ENGINES_KEY)
|
|
3518
|
+
}, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
|
|
3519
|
+
const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
3520
|
+
const rangeOf$1 = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
|
|
3521
|
+
const manifestProblems = (entry, source) => {
|
|
3522
|
+
const manifest = decodeManifest(source);
|
|
3523
|
+
if (Option.isNone(manifest)) return [];
|
|
3524
|
+
const range = rangeOf$1(manifest.value);
|
|
3525
|
+
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
3526
|
+
return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
|
|
3527
|
+
};
|
|
3528
|
+
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
|
|
3529
|
+
entry,
|
|
3530
|
+
source,
|
|
3531
|
+
index: found.index ?? START$3
|
|
3532
|
+
}, `${SUPPORTED} \`${String$1.trim(found[START$3])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
3533
|
+
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
3534
|
+
entry,
|
|
3535
|
+
source,
|
|
3536
|
+
index: START$3
|
|
3537
|
+
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
3538
|
+
const problemsIn$2 = (entry, source) => {
|
|
3539
|
+
if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
|
|
3540
|
+
if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
|
|
3541
|
+
if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
|
|
3542
|
+
if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
|
|
3543
|
+
return pinnedProblems(SETUP_INPUT)(entry, source);
|
|
3544
|
+
};
|
|
3545
|
+
const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.test(entry.name) || STEP_FILE.test(entry.name) || isToolVersions(entry);
|
|
3546
|
+
/** @internal */
|
|
3547
|
+
const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
|
|
3548
|
+
const files = yield* RepositoryFiles;
|
|
3549
|
+
const listed = yield* listedFiles(root);
|
|
3550
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE}`, ...EXCLUDED]);
|
|
3551
|
+
const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
|
|
3552
|
+
name,
|
|
3553
|
+
file: files.join(root, name)
|
|
3554
|
+
})))];
|
|
3555
|
+
return yield* scanText(sources, problemsIn$2);
|
|
3556
|
+
});
|
|
3557
|
+
// src/features/skills/model/skill-files.ts
|
|
3558
|
+
const RULE$2 = "skill-file";
|
|
3559
|
+
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
3560
|
+
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
3561
|
+
const MARKDOWN = ".md";
|
|
3562
|
+
const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
|
|
3563
|
+
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
3564
|
+
const HEADING = /^# (?<title>.+)$/mu;
|
|
3565
|
+
const NAME_KEY = /^name:/mu;
|
|
3566
|
+
const LICENSE_KEY = /^license:/mu;
|
|
3567
|
+
const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
|
|
3568
|
+
const LINK = /\]\((?<target>[^)\s]+)\)/gu;
|
|
3569
|
+
const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
|
|
3570
|
+
const FRAGMENT = /#.*$/u;
|
|
3571
|
+
const GITHUB = "https://github.com/";
|
|
3572
|
+
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
3573
|
+
const BLANK = /\s+/u;
|
|
3574
|
+
const SEPARATOR$1 = "/";
|
|
3575
|
+
const START$2 = 0;
|
|
3576
|
+
const FIRST$1 = 1;
|
|
3577
|
+
const READ_CONCURRENCY = 16;
|
|
3578
|
+
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
3579
|
+
const Frontmatter = Schema.Struct({
|
|
3580
|
+
name: Schema.optional(Schema.String),
|
|
3581
|
+
license: Schema.optional(Schema.Unknown),
|
|
3582
|
+
metadata: Schema.optional(Metadata)
|
|
3583
|
+
});
|
|
3584
|
+
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
3585
|
+
const offsetOf = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$2));
|
|
3586
|
+
const frontmatterOf = (source) => pipe(groupOf("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$1(yaml))));
|
|
3587
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$2].length), Option.getOrElse(() => START$2));
|
|
3588
|
+
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
3589
|
+
const nameProblems = ({ source, directory }, name, folder) => {
|
|
3590
|
+
const bodyStart = bodyStartOf(source);
|
|
3591
|
+
const body = String$1.slice(bodyStart)(source);
|
|
3592
|
+
const heading = groupOf("title")(HEADING.exec(body));
|
|
3593
|
+
return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
|
|
3594
|
+
index: offsetOf(source, NAME_KEY),
|
|
3595
|
+
message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
|
|
3596
|
+
})), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
|
|
3597
|
+
index: bodyStart + offsetOf(body, HEADING),
|
|
3598
|
+
message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
|
|
3599
|
+
})), Option.toArray)];
|
|
3600
|
+
};
|
|
3601
|
+
const derivedProblems = (source, derived) => pipe(String$1.split(String$1.trim(derived), BLANK), Array.filter((url) => String$1.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)), Array.map((url) => ({
|
|
3602
|
+
index: offsetOf(source, url),
|
|
3603
|
+
message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`
|
|
3604
|
+
})));
|
|
3605
|
+
const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
|
|
3606
|
+
...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
|
|
3607
|
+
...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
|
|
3608
|
+
index: offsetOf(skill.source, LICENSE_KEY),
|
|
3609
|
+
message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
|
|
3610
|
+
})), Option.toArray),
|
|
3611
|
+
...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
|
|
3612
|
+
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
3613
|
+
file: skill.file,
|
|
3614
|
+
...positionOf(skill.source)(index),
|
|
3615
|
+
rule: RULE$2,
|
|
3616
|
+
message
|
|
3617
|
+
})));
|
|
3618
|
+
const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
3619
|
+
target,
|
|
3620
|
+
index: found.index ?? START$2
|
|
3621
|
+
})), Option.toArray);
|
|
3622
|
+
const rangeOf = (found) => {
|
|
3623
|
+
const start = found.index ?? START$2;
|
|
3624
|
+
return [start, start + found[START$2].length];
|
|
3625
|
+
};
|
|
3626
|
+
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
3627
|
+
const linksIn = (source) => {
|
|
3628
|
+
const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf));
|
|
3629
|
+
return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
|
|
3630
|
+
};
|
|
3631
|
+
const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
3632
|
+
const files = yield* RepositoryFiles;
|
|
3633
|
+
const text = yield* files.readFile(file);
|
|
3634
|
+
if (Option.isNone(text)) return [];
|
|
3635
|
+
const source = text.value;
|
|
3636
|
+
const directory = files.dirname(file);
|
|
3637
|
+
const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
|
|
3638
|
+
const missing = yield* Effect.filter(linksIn(source), isMissing);
|
|
3639
|
+
return pipe(missing, Array.map(({ target, index }) => ({
|
|
3640
|
+
file,
|
|
3641
|
+
...positionOf(source)(index),
|
|
3642
|
+
rule: RULE$2,
|
|
3643
|
+
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
3644
|
+
})));
|
|
3645
|
+
});
|
|
3646
|
+
const problemsIn$1 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
3647
|
+
const files = yield* RepositoryFiles;
|
|
3648
|
+
const file = files.join(root, name);
|
|
3649
|
+
const directory = files.dirname(name);
|
|
3650
|
+
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$1}`)));
|
|
3651
|
+
const text = yield* files.readFile(file);
|
|
3652
|
+
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
3653
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY });
|
|
3654
|
+
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
3655
|
+
file: files.join(root, entry),
|
|
3656
|
+
line: FIRST$1,
|
|
3657
|
+
column: FIRST$1,
|
|
3658
|
+
rule: RULE$2,
|
|
3659
|
+
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
3660
|
+
})));
|
|
3661
|
+
return [
|
|
3662
|
+
...pipe(text, Option.map((source) => frontmatterProblems({
|
|
3663
|
+
file,
|
|
3664
|
+
directory,
|
|
3665
|
+
source
|
|
3666
|
+
}, files.basename(directory))), Option.getOrElse(() => [])),
|
|
3667
|
+
...licenses,
|
|
3668
|
+
...Array.flatten(links)
|
|
3669
|
+
];
|
|
3670
|
+
});
|
|
3671
|
+
/** @internal */
|
|
3672
|
+
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
3673
|
+
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
3674
|
+
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
|
|
3675
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$1(root, listed, name), { concurrency: READ_CONCURRENCY });
|
|
3676
|
+
return Array.flatten(found);
|
|
3677
|
+
});
|
|
3678
|
+
// src/features/unneeded-files/model/alchemy-patch.ts
|
|
3679
|
+
const RULE$1 = "alchemy-patch";
|
|
3680
|
+
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
3681
|
+
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
3682
|
+
const START$1 = 0;
|
|
3683
|
+
const WorkspaceFile$1 = Schema.Struct({ patchedDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)) });
|
|
3684
|
+
const decodeWorkspaceFile$1 = Schema.decodeUnknownOption(WorkspaceFile$1);
|
|
3685
|
+
const patchedIn = (source) => pipe(decodeWorkspaceFile$1(parse$1(source)), Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
3686
|
+
const problemOf = (file, position, name) => ({
|
|
3687
|
+
file,
|
|
3688
|
+
...position,
|
|
3689
|
+
rule: RULE$1,
|
|
3690
|
+
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.`
|
|
3691
|
+
});
|
|
3692
|
+
const problemsIn = (file) => (source) => {
|
|
3693
|
+
const at = positionOf(source);
|
|
3694
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$1));
|
|
3695
|
+
return pipe(patchedIn(source), Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
3696
|
+
};
|
|
3697
|
+
/** @internal */
|
|
3698
|
+
const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyPatch(root) {
|
|
3699
|
+
const files = yield* RepositoryFiles;
|
|
3700
|
+
const file = files.join(root, WORKSPACE_FILE$1);
|
|
3701
|
+
const text = yield* files.readFile(file);
|
|
3702
|
+
return pipe(text, Option.map(problemsIn(file)), Option.getOrElse(() => []));
|
|
3703
|
+
});
|
|
3704
|
+
// src/features/unneeded-files/model/replaced-tools.ts
|
|
3705
|
+
const RULE = "replaced-tool";
|
|
3706
|
+
const FIRST = 1;
|
|
3707
|
+
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
3708
|
+
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
3709
|
+
const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
|
|
3710
|
+
const REPLACED = [
|
|
3711
|
+
{
|
|
3712
|
+
pattern: /(?:^|\/)turbo\.jsonc?$/u,
|
|
3713
|
+
tool: "Turborepo",
|
|
3714
|
+
replacement: TASKS
|
|
3715
|
+
},
|
|
3716
|
+
{
|
|
3717
|
+
pattern: /(?:^|\/)nx\.json$/u,
|
|
3718
|
+
tool: "Nx",
|
|
3719
|
+
replacement: TASKS
|
|
3720
|
+
},
|
|
3721
|
+
{
|
|
3722
|
+
pattern: /(?:^|\/)\.husky\//u,
|
|
3723
|
+
tool: "husky",
|
|
3724
|
+
replacement: HOOKS
|
|
3725
|
+
},
|
|
3726
|
+
{
|
|
3727
|
+
pattern: /(?:^|\/)(?:\.?lefthook(?:-local)?\.(?:ya?ml|toml|json)|\.lefthook\/)/u,
|
|
3728
|
+
tool: "lefthook",
|
|
3729
|
+
replacement: HOOKS
|
|
3730
|
+
},
|
|
3731
|
+
{
|
|
3732
|
+
pattern: /(?:^|\/)\.?knip\.(?:jsonc?|[cm]?[jt]s)$/u,
|
|
3733
|
+
tool: "knip",
|
|
3734
|
+
replacement: "fallow"
|
|
3735
|
+
},
|
|
3736
|
+
{
|
|
3737
|
+
pattern: /(?:^|\/)\.jscpd\.json$/u,
|
|
3738
|
+
tool: "jscpd",
|
|
3739
|
+
replacement: "fallow"
|
|
3740
|
+
},
|
|
3741
|
+
{
|
|
3742
|
+
pattern: /(?:^|\/)(?:\.eslintrc(?:\.\w+)?|\.eslintignore|eslint\.config\.[cm]?[jt]s)$/u,
|
|
3743
|
+
tool: "ESLint",
|
|
3744
|
+
replacement: "`lint` in vite.config.ts, run with `vp check`"
|
|
3745
|
+
},
|
|
3746
|
+
{
|
|
3747
|
+
pattern: /(?:^|\/)(?:\.prettierrc(?:\.\w+)?|\.prettierignore|prettier\.config\.[cm]?[jt]s)$/u,
|
|
3748
|
+
tool: "Prettier",
|
|
3749
|
+
replacement: "`fmt` in vite.config.ts, run with `vp check`"
|
|
3750
|
+
},
|
|
3751
|
+
{
|
|
3752
|
+
pattern: /(?:^|\/)jest\.config\.(?:json|[cm]?[jt]s)$/u,
|
|
3753
|
+
tool: "Jest",
|
|
3754
|
+
replacement: "`test` in vite.config.ts, run with `vp test`"
|
|
3755
|
+
},
|
|
3756
|
+
{
|
|
3757
|
+
pattern: /(?:^|\/)wrangler\.(?:toml|jsonc?)$/u,
|
|
3758
|
+
tool: "wrangler",
|
|
3759
|
+
replacement: ALCHEMY
|
|
3760
|
+
},
|
|
3761
|
+
{
|
|
3762
|
+
pattern: /(?:^|\/)Pulumi(?:\.[\w-]+)?\.ya?ml$/u,
|
|
3763
|
+
tool: "Pulumi",
|
|
3764
|
+
replacement: ALCHEMY
|
|
3765
|
+
},
|
|
3766
|
+
{
|
|
3767
|
+
pattern: /\.tf(?:vars)?$/u,
|
|
3768
|
+
tool: "Terraform",
|
|
3769
|
+
replacement: ALCHEMY
|
|
3770
|
+
},
|
|
3771
|
+
{
|
|
3772
|
+
pattern: /(?:^|\/)\.claude\/rules\//u,
|
|
3773
|
+
tool: ".claude/rules",
|
|
3774
|
+
replacement: "the root AGENTS.md and the skills in masseater/skills"
|
|
3775
|
+
}
|
|
3776
|
+
];
|
|
3777
|
+
const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
3778
|
+
file,
|
|
3779
|
+
line: FIRST,
|
|
3780
|
+
column: FIRST,
|
|
3781
|
+
rule: RULE,
|
|
3782
|
+
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
3783
|
+
})));
|
|
3784
|
+
/** @internal */
|
|
3785
|
+
const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplacedTools(root) {
|
|
3786
|
+
const listed = yield* listedFiles(root);
|
|
3787
|
+
const present = yield* presentFiles(pipe(listed, Array.filter((entry) => Option.isSome(problemFor(entry)))));
|
|
3788
|
+
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor(entry))));
|
|
3789
|
+
});
|
|
2998
3790
|
// src/features/unneeded-files/model/unneeded-files.ts
|
|
2999
3791
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
3000
3792
|
const PNPM_DIRECTORY = ".pnpm/";
|
|
@@ -3128,6 +3920,10 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
3128
3920
|
checkHiddenUnicode(root),
|
|
3129
3921
|
checkPython(root),
|
|
3130
3922
|
checkUnneededFiles(root),
|
|
3923
|
+
checkReplacedTools(root),
|
|
3924
|
+
checkAlchemyPatch(root),
|
|
3925
|
+
checkNodeVersion(root),
|
|
3926
|
+
checkSkillFiles(root),
|
|
3131
3927
|
checkComments(root)
|
|
3132
3928
|
], { concurrency: "unbounded" });
|
|
3133
3929
|
return Array.flatten(found);
|
|
@@ -3136,14 +3932,13 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
3136
3932
|
/** @internal */
|
|
3137
3933
|
const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
|
|
3138
3934
|
const found = yield* Effect.all([
|
|
3139
|
-
|
|
3935
|
+
checkSources(root),
|
|
3140
3936
|
checkOverrides(root),
|
|
3141
3937
|
checkTrackedText(root),
|
|
3142
3938
|
checkPlacement(root),
|
|
3143
|
-
checkScripts(root),
|
|
3144
3939
|
checkPublishedPackages(root),
|
|
3145
3940
|
checkWorkspaces(root),
|
|
3146
|
-
|
|
3941
|
+
checkToolUse(root)
|
|
3147
3942
|
], { concurrency: "unbounded" });
|
|
3148
3943
|
return Array.flatten(found);
|
|
3149
3944
|
});
|
|
@@ -3168,7 +3963,7 @@ const runCli = (program) => {
|
|
|
3168
3963
|
const main = Layer.build(services).pipe(Effect.flatMap((context) => Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context)), Effect.scoped);
|
|
3169
3964
|
runMain(main, { disableErrorReporting: true });
|
|
3170
3965
|
};
|
|
3171
|
-
//
|
|
3966
|
+
// bin/msch.ts
|
|
3172
3967
|
const NO_PROBLEMS = 0;
|
|
3173
3968
|
const reportText = (root, problems) => Effect.gen(function* report() {
|
|
3174
3969
|
const files = yield* RepositoryFiles;
|