@r_masseater/msch 0.15.0 → 0.18.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-PUlrIOu9.mjs → cli-contract-BeVYJPZW.mjs} +14 -7
- package/dist/cli-contract-BeVYJPZW.mjs.map +1 -0
- package/dist/cli.mjs +430 -119
- package/dist/cli.mjs.map +1 -1
- package/dist/lint.d.mts +10 -1
- package/dist/lint.mjs +29 -4
- package/dist/lint.mjs.map +1 -1
- package/dist/oxlint.mjs +1 -1
- package/dist/{workspace-aMPb8EA_.mjs → workspace-BJk4TcI8.mjs} +23 -2
- package/dist/workspace-BJk4TcI8.mjs.map +1 -0
- package/dist/workspace-settings.mjs +1 -1
- package/package.json +1 -1
- package/dist/problem-PUlrIOu9.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 {
|
|
2
|
+
import { A as workspaceDependencies, D as MANIFEST_FILE, E as publicEntriesOf, O as dependencyEntries, S as stringsIn, T as publishedWorkspaces, _ as KeySchema, a as definesTask, b as literalOf, g as workspaceConfigOf, i as VERIFY_TASK, k as readManifest, o as hasVerifyTask, r as RUN_TASKS, t as namedWorkspaces, u as workspaceDirectories, v as childrenOf$2, x as nestedValues, y as keyName } from "./workspace-BJk4TcI8.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, 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-BeVYJPZW.mjs";
|
|
3
4
|
import { i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-BiKs7S7N.mjs";
|
|
4
|
-
import { C as publishedWorkspaces, D as readManifest, E as dependencyEntries, O as workspaceDependencies, T as MANIFEST_FILE, _ as childrenOf$3, a as hasVerifyTask, b as nestedValues, g as KeySchema, h as workspaceConfigOf, i as definesTask, l as workspaceDirectories, r as VERIFY_TASK, t as namedWorkspaces, v as keyName, w as publicEntriesOf, y as literalOf } from "./workspace-aMPb8EA_.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$9 = "/";
|
|
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$9}`))
|
|
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$9}${entry}`));
|
|
369
369
|
});
|
|
370
370
|
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
371
371
|
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
@@ -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$8 = "/";
|
|
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$8);
|
|
431
|
+
if (String$1.startsWith(SCOPE)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS$1), Array.join(SEPARATOR$8));
|
|
432
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$8));
|
|
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;
|
|
@@ -524,7 +524,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
524
524
|
peerDependencies: DependencyMap,
|
|
525
525
|
peerDependenciesMeta: PeerMeta
|
|
526
526
|
});
|
|
527
|
-
const decodeManifest$
|
|
527
|
+
const decodeManifest$2 = 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$2), 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;
|
|
@@ -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) {
|
|
@@ -1006,17 +1006,17 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
1006
1006
|
// src/features/placement/model/agent-docs-length.ts
|
|
1007
1007
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
1008
1008
|
const RECOMMENDED_LINES = 200;
|
|
1009
|
-
const READ_CONCURRENCY$
|
|
1010
|
-
const FIRST$
|
|
1011
|
-
const RULE$
|
|
1009
|
+
const READ_CONCURRENCY$14 = 16;
|
|
1010
|
+
const FIRST$9 = 1;
|
|
1011
|
+
const RULE$16 = "agent-docs-length";
|
|
1012
1012
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
1013
1013
|
const problemFor$4 = (file) => (lines) => {
|
|
1014
1014
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
1015
1015
|
return Option.some({
|
|
1016
1016
|
file,
|
|
1017
1017
|
line: 201,
|
|
1018
|
-
column: FIRST$
|
|
1019
|
-
rule: RULE$
|
|
1018
|
+
column: FIRST$9,
|
|
1019
|
+
rule: RULE$16,
|
|
1020
1020
|
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.`
|
|
1021
1021
|
});
|
|
1022
1022
|
};
|
|
@@ -1028,13 +1028,13 @@ const checkAgentDocsLength = Effect.fn("checkAgentDocsLength")(function* checkAg
|
|
|
1028
1028
|
const found = yield* Effect.forEach(docs, (name) => {
|
|
1029
1029
|
const file = files.join(root, name);
|
|
1030
1030
|
return files.readFile(file).pipe(Effect.map(Option.flatMap((source) => problemFor$4(file)(lineCount(source)))));
|
|
1031
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1031
|
+
}, { concurrency: READ_CONCURRENCY$14 });
|
|
1032
1032
|
return Array.getSomes(found);
|
|
1033
1033
|
});
|
|
1034
1034
|
// src/features/placement/model/colocated-tests.ts
|
|
1035
|
-
const RULE$
|
|
1036
|
-
const FIRST$
|
|
1037
|
-
const READ_CONCURRENCY$
|
|
1035
|
+
const RULE$15 = "colocated-test";
|
|
1036
|
+
const FIRST$8 = 1;
|
|
1037
|
+
const READ_CONCURRENCY$13 = 64;
|
|
1038
1038
|
const ROOT_SUBPATH = ".";
|
|
1039
1039
|
const NAME_GROUP = "name";
|
|
1040
1040
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -1048,17 +1048,17 @@ const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(
|
|
|
1048
1048
|
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
1049
1049
|
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.";
|
|
1050
1050
|
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>.";
|
|
1051
|
-
const Manifest = Schema.Struct({
|
|
1051
|
+
const Manifest$1 = Schema.Struct({
|
|
1052
1052
|
name: Schema.optional(Schema.String),
|
|
1053
1053
|
exports: Schema.optional(Schema.Unknown)
|
|
1054
1054
|
});
|
|
1055
|
-
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
1055
|
+
const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
|
|
1056
1056
|
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1057
1057
|
const problemFor$3 = (test, message) => ({
|
|
1058
1058
|
file: test.file,
|
|
1059
|
-
line: FIRST$
|
|
1060
|
-
column: FIRST$
|
|
1061
|
-
rule: RULE$
|
|
1059
|
+
line: FIRST$8,
|
|
1060
|
+
column: FIRST$8,
|
|
1061
|
+
rule: RULE$15,
|
|
1062
1062
|
message: `${test.base} ${message}`
|
|
1063
1063
|
});
|
|
1064
1064
|
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);
|
|
@@ -1078,7 +1078,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
1078
1078
|
if (Option.isNone(owner)) return [];
|
|
1079
1079
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
|
|
1080
1080
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
1081
|
-
return pipe(text, Option.flatMap(decodeManifest), Option.map(specifiersBeside({
|
|
1081
|
+
return pipe(text, Option.flatMap(decodeManifest$1), Option.map(specifiersBeside({
|
|
1082
1082
|
join,
|
|
1083
1083
|
dirname: files.dirname,
|
|
1084
1084
|
directory: test.directory
|
|
@@ -1120,27 +1120,27 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
1120
1120
|
directory: files.dirname(file)
|
|
1121
1121
|
};
|
|
1122
1122
|
}));
|
|
1123
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$3(context, test), { concurrency: READ_CONCURRENCY$
|
|
1123
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$3(context, test), { concurrency: READ_CONCURRENCY$13 });
|
|
1124
1124
|
return Array.getSomes(found);
|
|
1125
1125
|
});
|
|
1126
1126
|
// src/features/placement/model/nested-docs.ts
|
|
1127
|
-
const RULE$
|
|
1127
|
+
const RULE$14 = "nested-docs";
|
|
1128
1128
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1129
|
-
const SEPARATOR$
|
|
1130
|
-
const FIRST$
|
|
1131
|
-
const READ_CONCURRENCY$
|
|
1129
|
+
const SEPARATOR$7 = "/";
|
|
1130
|
+
const FIRST$7 = 1;
|
|
1131
|
+
const READ_CONCURRENCY$12 = 64;
|
|
1132
1132
|
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1133
1133
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1134
1134
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
1135
1135
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1136
1136
|
const taggedError$3 = Schema.TaggedError;
|
|
1137
1137
|
var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1138
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1138
|
+
const isNested = (name) => String$1.includes(SEPARATOR$7)(name);
|
|
1139
1139
|
const problemFor$2 = (file, message) => ({
|
|
1140
1140
|
file,
|
|
1141
|
-
line: FIRST$
|
|
1142
|
-
column: FIRST$
|
|
1143
|
-
rule: RULE$
|
|
1141
|
+
line: FIRST$7,
|
|
1142
|
+
column: FIRST$7,
|
|
1143
|
+
rule: RULE$14,
|
|
1144
1144
|
message
|
|
1145
1145
|
});
|
|
1146
1146
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
@@ -1186,24 +1186,44 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1186
1186
|
workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
|
|
1187
1187
|
workspaceAgentDocs
|
|
1188
1188
|
};
|
|
1189
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$2(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
1189
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$2(root, allowed, name), { concurrency: READ_CONCURRENCY$12 });
|
|
1190
1190
|
return Array.getSomes(found);
|
|
1191
1191
|
});
|
|
1192
|
+
// src/features/placement/model/root-docs.ts
|
|
1193
|
+
const RULE$13 = "root-docs";
|
|
1194
|
+
const SEPARATOR$6 = "/";
|
|
1195
|
+
const FIRST$6 = 1;
|
|
1196
|
+
const MARKDOWN = /\.(?:md|mdx|markdown)$/iu;
|
|
1197
|
+
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1198
|
+
const MESSAGE$4 = "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.";
|
|
1199
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$6)(name) && MARKDOWN.test(name) && !ALLOWED.test(name);
|
|
1200
|
+
/** @internal */
|
|
1201
|
+
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1202
|
+
const files = yield* RepositoryFiles;
|
|
1203
|
+
const names = yield* files.listedFiles(root);
|
|
1204
|
+
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
1205
|
+
file: files.join(root, name),
|
|
1206
|
+
line: FIRST$6,
|
|
1207
|
+
column: FIRST$6,
|
|
1208
|
+
rule: RULE$13,
|
|
1209
|
+
message: `${name} ${MESSAGE$4}`
|
|
1210
|
+
})));
|
|
1211
|
+
});
|
|
1192
1212
|
// src/features/placement/model/root-readme.ts
|
|
1193
|
-
const RULE$
|
|
1213
|
+
const RULE$12 = "root-readme";
|
|
1194
1214
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1195
|
-
const READ_CONCURRENCY$
|
|
1215
|
+
const READ_CONCURRENCY$11 = 16;
|
|
1196
1216
|
const START$5 = 0;
|
|
1197
1217
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1198
1218
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1199
1219
|
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.`;
|
|
1200
|
-
const problemsIn$
|
|
1220
|
+
const problemsIn$6 = (file, source) => ({ directory, pattern }) => {
|
|
1201
1221
|
const message = messageFor(directory);
|
|
1202
1222
|
const at = positionOf(source);
|
|
1203
1223
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
1204
1224
|
file,
|
|
1205
1225
|
...at(found.index ?? START$5),
|
|
1206
|
-
rule: RULE$
|
|
1226
|
+
rule: RULE$12,
|
|
1207
1227
|
message
|
|
1208
1228
|
})));
|
|
1209
1229
|
};
|
|
@@ -1211,7 +1231,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
|
|
|
1211
1231
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
1212
1232
|
return pipe(text, Option.match({
|
|
1213
1233
|
onNone: () => [],
|
|
1214
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
1234
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$6(file, source)))
|
|
1215
1235
|
}));
|
|
1216
1236
|
});
|
|
1217
1237
|
/** @internal */
|
|
@@ -1221,7 +1241,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1221
1241
|
const readmes = pipe(names, Array.filter((name) => ROOT_DOC.test(name)));
|
|
1222
1242
|
const named = yield* namedWorkspaces(root);
|
|
1223
1243
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1224
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$
|
|
1244
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$11 });
|
|
1225
1245
|
return Array.flatten(found);
|
|
1226
1246
|
});
|
|
1227
1247
|
// src/features/placement/model/placement-checks.ts
|
|
@@ -1230,18 +1250,132 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
|
|
|
1230
1250
|
const found = yield* Effect.all([
|
|
1231
1251
|
checkNestedDocs(root),
|
|
1232
1252
|
checkRootReadme(root),
|
|
1253
|
+
checkRootDocs(root),
|
|
1233
1254
|
checkColocatedTests(root),
|
|
1234
1255
|
checkAgentDocsLength(root)
|
|
1235
1256
|
], { concurrency: "unbounded" });
|
|
1236
1257
|
return Array.flatten(found);
|
|
1237
1258
|
});
|
|
1259
|
+
// src/features/repository-layout/model/command-entries.ts
|
|
1260
|
+
const OUTSIDE_BIN = "command-outside-bin";
|
|
1261
|
+
const UNRUN = "unrun-command";
|
|
1262
|
+
const SCRIPTS = "scripts-directory";
|
|
1263
|
+
const BIN = "bin";
|
|
1264
|
+
const SCRIPTS_DIRECTORY = "scripts";
|
|
1265
|
+
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
1266
|
+
const SEPARATOR$5 = "/";
|
|
1267
|
+
const CURRENT = "./";
|
|
1268
|
+
const READ_CONCURRENCY$10 = 8;
|
|
1269
|
+
const FIRST$5 = 1;
|
|
1270
|
+
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
1271
|
+
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
1272
|
+
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
1273
|
+
const Manifest = Schema.Struct({
|
|
1274
|
+
bin: Schema.optional(Schema.Unknown),
|
|
1275
|
+
main: Schema.optional(Schema.Unknown),
|
|
1276
|
+
exports: Schema.optional(Schema.Unknown)
|
|
1277
|
+
});
|
|
1278
|
+
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
1279
|
+
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
1280
|
+
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
1281
|
+
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
1282
|
+
const NO_ENTRIES = {
|
|
1283
|
+
all: [],
|
|
1284
|
+
bins: []
|
|
1285
|
+
};
|
|
1286
|
+
const withoutCurrent = (path) => String$1.replace(new RegExp(`^${CURRENT}`, "u"), "")(path);
|
|
1287
|
+
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) => ({
|
|
1288
|
+
path: withoutCurrent(path),
|
|
1289
|
+
start
|
|
1290
|
+
})), Option.toArray)));
|
|
1291
|
+
const targetsIn = (held) => [...pipe(decodeTarget(held), Option.map(withoutCurrent), Option.toArray), ...pipe(decodeTargetMap(held), Option.map(Record.values), Option.getOrElse(() => []), Array.flatMap(targetsIn))];
|
|
1292
|
+
const entriesOf$1 = (manifest) => {
|
|
1293
|
+
const bins = targetsIn(manifest.bin);
|
|
1294
|
+
return {
|
|
1295
|
+
all: [
|
|
1296
|
+
...bins,
|
|
1297
|
+
...targetsIn(manifest.main),
|
|
1298
|
+
...targetsIn(manifest.exports)
|
|
1299
|
+
],
|
|
1300
|
+
bins
|
|
1301
|
+
};
|
|
1302
|
+
};
|
|
1303
|
+
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
1304
|
+
const files = yield* RepositoryFiles;
|
|
1305
|
+
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE));
|
|
1306
|
+
return pipe(text, Option.flatMap(decodeManifest), Option.map(entriesOf$1), Option.getOrElse(() => NO_ENTRIES));
|
|
1307
|
+
});
|
|
1308
|
+
const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
1309
|
+
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
1310
|
+
const files = yield* RepositoryFiles;
|
|
1311
|
+
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
1312
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$5}${name}`), Array.filter(isCommand$1));
|
|
1313
|
+
});
|
|
1314
|
+
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
1315
|
+
const files = yield* RepositoryFiles;
|
|
1316
|
+
const listed = yield* files.listedFiles(root);
|
|
1317
|
+
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
1318
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$10 });
|
|
1319
|
+
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
1320
|
+
});
|
|
1321
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$5));
|
|
1322
|
+
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
1323
|
+
file,
|
|
1324
|
+
...positionOf(source)(start),
|
|
1325
|
+
rule: OUTSIDE_BIN,
|
|
1326
|
+
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.`
|
|
1327
|
+
})));
|
|
1328
|
+
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
1329
|
+
const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
1330
|
+
const files = yield* RepositoryFiles;
|
|
1331
|
+
const config = yield* workspaceConfigOf(root, directory);
|
|
1332
|
+
const entries = yield* declaredEntries(root, directory);
|
|
1333
|
+
const commands = yield* commandFilesIn(root, directory);
|
|
1334
|
+
const runs = pipe(config, Option.map(({ program }) => runsOf(program)), Option.getOrElse(() => []));
|
|
1335
|
+
const runPaths = pipe(runs, Array.map(({ path }) => path));
|
|
1336
|
+
const outside = pipe(config, Option.map(({ file, source }) => outsideProblems({
|
|
1337
|
+
file,
|
|
1338
|
+
source,
|
|
1339
|
+
runs,
|
|
1340
|
+
entries
|
|
1341
|
+
})), Option.getOrElse(() => []));
|
|
1342
|
+
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
1343
|
+
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
1344
|
+
file: files.join(root, directory, path),
|
|
1345
|
+
line: FIRST$5,
|
|
1346
|
+
column: FIRST$5,
|
|
1347
|
+
rule: UNRUN,
|
|
1348
|
+
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.`
|
|
1349
|
+
})));
|
|
1350
|
+
return [...outside, ...unrun];
|
|
1351
|
+
});
|
|
1352
|
+
const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root, directory) {
|
|
1353
|
+
const files = yield* RepositoryFiles;
|
|
1354
|
+
const file = files.join(root, directory, SCRIPTS_DIRECTORY);
|
|
1355
|
+
const isDirectory = yield* files.isDirectory(file);
|
|
1356
|
+
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
1357
|
+
file,
|
|
1358
|
+
line: FIRST$5,
|
|
1359
|
+
column: FIRST$5,
|
|
1360
|
+
rule: SCRIPTS,
|
|
1361
|
+
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.`
|
|
1362
|
+
})));
|
|
1363
|
+
});
|
|
1364
|
+
/** @internal */
|
|
1365
|
+
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
1366
|
+
const all = ["", ...yield* workspaceDirectories(root)];
|
|
1367
|
+
const workflows = yield* workflowText(root);
|
|
1368
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$5(root, directory, workflows), { concurrency: READ_CONCURRENCY$10 });
|
|
1369
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$10 });
|
|
1370
|
+
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
1371
|
+
});
|
|
1238
1372
|
// src/features/repository-layout/model/crates.ts
|
|
1239
|
-
const RULE$
|
|
1373
|
+
const RULE$11 = "unverified-crate";
|
|
1240
1374
|
const CARGO_FILE = "Cargo.toml";
|
|
1241
1375
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
1242
|
-
const SEPARATOR$
|
|
1376
|
+
const SEPARATOR$4 = "/";
|
|
1243
1377
|
const FIRST$4 = 1;
|
|
1244
|
-
const READ_CONCURRENCY$
|
|
1378
|
+
const READ_CONCURRENCY$9 = 8;
|
|
1245
1379
|
const CrateEntry = Schema.Struct({
|
|
1246
1380
|
name: Schema.String,
|
|
1247
1381
|
manifest_path: Schema.String
|
|
@@ -1267,14 +1401,14 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
1267
1401
|
})));
|
|
1268
1402
|
}, Effect.scoped);
|
|
1269
1403
|
const owningWorkspace = (directories) => (directory) => {
|
|
1270
|
-
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
1404
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$4}`)(directory)));
|
|
1271
1405
|
return Array.last(Array.sort(owners, String$1.Order));
|
|
1272
1406
|
};
|
|
1273
1407
|
const problemFor$1 = (crate, message) => ({
|
|
1274
1408
|
file: crate.manifest,
|
|
1275
1409
|
line: FIRST$4,
|
|
1276
1410
|
column: FIRST$4,
|
|
1277
|
-
rule: RULE$
|
|
1411
|
+
rule: RULE$11,
|
|
1278
1412
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
1279
1413
|
});
|
|
1280
1414
|
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -1290,11 +1424,53 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
1290
1424
|
if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
|
|
1291
1425
|
const directories = yield* workspaceDirectories(root);
|
|
1292
1426
|
const crates = yield* cratesIn(root);
|
|
1293
|
-
const found = yield* Effect.forEach(crates, (crate) => problemIn$1(root, directories, crate), { concurrency: READ_CONCURRENCY$
|
|
1427
|
+
const found = yield* Effect.forEach(crates, (crate) => problemIn$1(root, directories, crate), { concurrency: READ_CONCURRENCY$9 });
|
|
1294
1428
|
return Array.getSomes(found);
|
|
1295
1429
|
});
|
|
1430
|
+
// src/features/repository-layout/model/fallow-entries.ts
|
|
1431
|
+
const RULE$10 = "listed-entry";
|
|
1432
|
+
const ENTRY_KEYS = [
|
|
1433
|
+
"entry",
|
|
1434
|
+
"entryPoints",
|
|
1435
|
+
"supportEntry"
|
|
1436
|
+
];
|
|
1437
|
+
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
1438
|
+
const WILDCARD$1 = /[*?{[]/u;
|
|
1439
|
+
const SEPARATOR$3 = "/";
|
|
1440
|
+
const WRAP_OFFSET = 1;
|
|
1441
|
+
const READ_CONCURRENCY$8 = 8;
|
|
1442
|
+
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
1443
|
+
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
1444
|
+
const entryPatternsIn = (node) => {
|
|
1445
|
+
if (Predicate.isReadonlyObject(node) && isEntryProperty(node)) return pipe(stringsIn(node["value"]), Array.map(({ text, start }) => ({
|
|
1446
|
+
text,
|
|
1447
|
+
start: start - WRAP_OFFSET
|
|
1448
|
+
})));
|
|
1449
|
+
return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
|
|
1450
|
+
};
|
|
1451
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$3}`)(text))) || String$1.includes(SEPARATOR$3)(text) && !WILDCARD$1.test(text);
|
|
1452
|
+
const problemsIn$4 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
1453
|
+
const files = yield* RepositoryFiles;
|
|
1454
|
+
const path = files.join(root, file);
|
|
1455
|
+
const text = yield* files.readFile(path);
|
|
1456
|
+
if (Option.isNone(text)) return [];
|
|
1457
|
+
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, `(${text.value})`, { lang: "ts" }));
|
|
1458
|
+
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
1459
|
+
file: path,
|
|
1460
|
+
...positionOf(text.value)(start),
|
|
1461
|
+
rule: RULE$10,
|
|
1462
|
+
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.`
|
|
1463
|
+
})));
|
|
1464
|
+
});
|
|
1465
|
+
/** @internal */
|
|
1466
|
+
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
1467
|
+
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
1468
|
+
const directories = yield* workspaceDirectories(root);
|
|
1469
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$4(root, file, directories), { concurrency: READ_CONCURRENCY$8 });
|
|
1470
|
+
return Array.flatten(found);
|
|
1471
|
+
});
|
|
1296
1472
|
// src/features/repository-layout/model/hidden-verify.ts
|
|
1297
|
-
const RULE$
|
|
1473
|
+
const RULE$9 = "hidden-verify";
|
|
1298
1474
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
1299
1475
|
const FIRST$3 = 1;
|
|
1300
1476
|
const READ_CONCURRENCY$7 = 8;
|
|
@@ -1308,7 +1484,7 @@ const problemIn = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
|
1308
1484
|
file,
|
|
1309
1485
|
line: FIRST$3,
|
|
1310
1486
|
column: FIRST$3,
|
|
1311
|
-
rule: RULE$
|
|
1487
|
+
rule: RULE$9,
|
|
1312
1488
|
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}.`
|
|
1313
1489
|
}).pipe(Option.filter(() => verified));
|
|
1314
1490
|
});
|
|
@@ -1319,32 +1495,12 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
1319
1495
|
return Array.getSomes(found);
|
|
1320
1496
|
});
|
|
1321
1497
|
// src/features/repository-layout/model/root-workspace-paths.ts
|
|
1322
|
-
const RULE$
|
|
1498
|
+
const RULE$8 = "root-workspace-path";
|
|
1323
1499
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
1324
1500
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
1325
1501
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
1326
1502
|
const FIRST$2 = 0;
|
|
1327
1503
|
const NEXT$2 = 1;
|
|
1328
|
-
const StringNode = Schema.Union([Schema.Struct({
|
|
1329
|
-
type: Schema.Literal("Literal"),
|
|
1330
|
-
value: Schema.String,
|
|
1331
|
-
start: Schema.Finite
|
|
1332
|
-
}), Schema.Struct({
|
|
1333
|
-
type: Schema.Literal("TemplateElement"),
|
|
1334
|
-
value: Schema.Struct({ cooked: Schema.String }),
|
|
1335
|
-
start: Schema.Finite
|
|
1336
|
-
})]);
|
|
1337
|
-
const decodeStringNode = Schema.decodeUnknownOption(StringNode);
|
|
1338
|
-
const textOf = (node) => {
|
|
1339
|
-
if (node.type === "Literal") return node.value;
|
|
1340
|
-
return node.value.cooked;
|
|
1341
|
-
};
|
|
1342
|
-
const stringsIn = (node) => {
|
|
1343
|
-
return [...pipe(decodeStringNode(node), Option.map((found) => ({
|
|
1344
|
-
text: textOf(found),
|
|
1345
|
-
start: found.start
|
|
1346
|
-
})), Option.toArray), ...pipe(childrenOf$3(node), Array.flatMap(stringsIn))];
|
|
1347
|
-
};
|
|
1348
1504
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
1349
1505
|
const mentions = (directory) => (text) => {
|
|
1350
1506
|
const parts = String$1.split(text, directory);
|
|
@@ -1358,7 +1514,7 @@ const mentions = (directory) => (text) => {
|
|
|
1358
1514
|
const problemsIn$3 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
1359
1515
|
file,
|
|
1360
1516
|
...positionOf(source)(found.start),
|
|
1361
|
-
rule: RULE$
|
|
1517
|
+
rule: RULE$8,
|
|
1362
1518
|
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.`
|
|
1363
1519
|
})));
|
|
1364
1520
|
/** @internal */
|
|
@@ -1372,8 +1528,7 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
1372
1528
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$3(file, source.value, directories)));
|
|
1373
1529
|
});
|
|
1374
1530
|
// src/features/repository-layout/model/shared-uncached-tasks.ts
|
|
1375
|
-
const RULE$
|
|
1376
|
-
const TASKS_PATH = ["run", "tasks"];
|
|
1531
|
+
const RULE$7 = "shared-uncached-task";
|
|
1377
1532
|
const READ_CONCURRENCY$6 = 8;
|
|
1378
1533
|
const SHARED = 2;
|
|
1379
1534
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -1417,7 +1572,7 @@ const definitionsIn = Effect.fn("definitionsIn")(function* definitionsIn(root, d
|
|
|
1417
1572
|
const config = yield* workspaceConfigOf(root, directory);
|
|
1418
1573
|
if (Option.isNone(config)) return [];
|
|
1419
1574
|
const { file, source, program } = config.value;
|
|
1420
|
-
return pipe(nestedValues(
|
|
1575
|
+
return pipe(nestedValues(RUN_TASKS)(program), Array.flatMap((tasks) => pipe(decodeTaskObject(tasks), Option.map(({ properties }) => properties), Option.getOrElse(() => []))), Array.flatMap((property) => pipe(decodeTaskProperty(property), Option.flatMap(definitionOf({
|
|
1421
1576
|
directory,
|
|
1422
1577
|
file,
|
|
1423
1578
|
source
|
|
@@ -1429,7 +1584,7 @@ const problemsOf = (definitions) => {
|
|
|
1429
1584
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
1430
1585
|
file,
|
|
1431
1586
|
...position,
|
|
1432
|
-
rule: RULE$
|
|
1587
|
+
rule: RULE$7,
|
|
1433
1588
|
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.`
|
|
1434
1589
|
})));
|
|
1435
1590
|
};
|
|
@@ -1575,7 +1730,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
1575
1730
|
/** @internal */
|
|
1576
1731
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
1577
1732
|
// src/features/repository-layout/model/workflow-paths.ts
|
|
1578
|
-
const RULE$
|
|
1733
|
+
const RULE$6 = "workflow-path";
|
|
1579
1734
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
1580
1735
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
1581
1736
|
const READ_CONCURRENCY$5 = 8;
|
|
@@ -1638,10 +1793,10 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
1638
1793
|
if (yield* RESOLVERS[found.kind](root, found.path)) return false;
|
|
1639
1794
|
return !(yield* isIgnored$1(root, found.path));
|
|
1640
1795
|
});
|
|
1641
|
-
const problemOf$
|
|
1796
|
+
const problemOf$3 = (file, source) => (found) => ({
|
|
1642
1797
|
file,
|
|
1643
1798
|
...positionOf(source)(found.offset),
|
|
1644
|
-
rule: RULE$
|
|
1799
|
+
rule: RULE$6,
|
|
1645
1800
|
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.`
|
|
1646
1801
|
});
|
|
1647
1802
|
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -1651,7 +1806,7 @@ const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, workflow
|
|
|
1651
1806
|
if (Option.isNone(source)) return [];
|
|
1652
1807
|
const produced = producedPaths(source.value);
|
|
1653
1808
|
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
|
|
1654
|
-
return pipe(missing, Array.map(problemOf$
|
|
1809
|
+
return pipe(missing, Array.map(problemOf$3(file, source.value)));
|
|
1655
1810
|
});
|
|
1656
1811
|
/** @internal */
|
|
1657
1812
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
@@ -1663,7 +1818,9 @@ const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkfl
|
|
|
1663
1818
|
/** @internal */
|
|
1664
1819
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
1665
1820
|
const found = yield* Effect.all([
|
|
1821
|
+
checkCommandEntries(root),
|
|
1666
1822
|
checkCrates(root),
|
|
1823
|
+
checkFallowEntries(root),
|
|
1667
1824
|
checkHiddenVerify(root),
|
|
1668
1825
|
checkRootWorkspacePaths(root),
|
|
1669
1826
|
checkSharedUncachedTasks(root),
|
|
@@ -1678,8 +1835,8 @@ const EXTENSION = /\.[^./]+$/u;
|
|
|
1678
1835
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
1679
1836
|
const READ_CONCURRENCY$4 = 64;
|
|
1680
1837
|
const FIRST = 1;
|
|
1681
|
-
const RULE$
|
|
1682
|
-
const MESSAGE$
|
|
1838
|
+
const RULE$5 = "shell-script";
|
|
1839
|
+
const MESSAGE$3 = "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.";
|
|
1683
1840
|
const HookSchema = Schema.Struct({
|
|
1684
1841
|
command: Schema.optional(Schema.String),
|
|
1685
1842
|
args: Schema.optional(Schema.Array(Schema.String))
|
|
@@ -1697,13 +1854,12 @@ const sessionStartCommands = (source) => {
|
|
|
1697
1854
|
};
|
|
1698
1855
|
const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.getOrElse(() => name));
|
|
1699
1856
|
const hasExtension = (name) => EXTENSION.test(baseName(name));
|
|
1700
|
-
const startsWithShellShebang = (source) => SHELL_SHEBANG.test(source);
|
|
1701
1857
|
const problemFor = (file) => ({
|
|
1702
1858
|
file,
|
|
1703
1859
|
line: FIRST,
|
|
1704
1860
|
column: FIRST,
|
|
1705
|
-
rule: RULE$
|
|
1706
|
-
message: MESSAGE$
|
|
1861
|
+
rule: RULE$5,
|
|
1862
|
+
message: MESSAGE$3
|
|
1707
1863
|
});
|
|
1708
1864
|
/** @internal */
|
|
1709
1865
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
@@ -1716,23 +1872,36 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
1716
1872
|
const file = files.join(root, name);
|
|
1717
1873
|
if (SHELL_FILE.test(name)) return files.exists(file);
|
|
1718
1874
|
if (hasExtension(name)) return Effect.succeed(false);
|
|
1719
|
-
return files.readFile(file).pipe(Effect.map(Option.exists(
|
|
1875
|
+
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
1720
1876
|
};
|
|
1721
1877
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
1722
1878
|
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$4 });
|
|
1723
1879
|
return pipe(shell, Array.map((name) => problemFor(files.join(root, name))));
|
|
1724
1880
|
});
|
|
1725
|
-
// src/
|
|
1881
|
+
// src/shared/lib/workflow-files.ts
|
|
1726
1882
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
1883
|
+
const READ_CONCURRENCY$3 = 16;
|
|
1884
|
+
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
1885
|
+
const files = yield* RepositoryFiles;
|
|
1886
|
+
const names = yield* files.listedFiles(root);
|
|
1887
|
+
const found = yield* Effect.forEach(pipe(names, Array.filter((name) => WORKFLOW_FILE.test(name))), (name) => {
|
|
1888
|
+
const file = files.join(root, name);
|
|
1889
|
+
return files.readFile(file).pipe(Effect.map(Option.map((source) => ({
|
|
1890
|
+
file,
|
|
1891
|
+
source
|
|
1892
|
+
}))));
|
|
1893
|
+
}, { concurrency: READ_CONCURRENCY$3 });
|
|
1894
|
+
return Array.getSomes(found);
|
|
1895
|
+
});
|
|
1896
|
+
// src/features/scripts/model/workflows.ts
|
|
1727
1897
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
1728
1898
|
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
1729
1899
|
const COMMENT = "#";
|
|
1730
1900
|
const RUN_KEY = "run";
|
|
1731
|
-
const RULE$
|
|
1732
|
-
const READ_CONCURRENCY$3 = 16;
|
|
1901
|
+
const RULE$4 = "workflow-script";
|
|
1733
1902
|
const START$4 = 0;
|
|
1734
1903
|
const ONE_COMMAND = 1;
|
|
1735
|
-
const MESSAGE$
|
|
1904
|
+
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.";
|
|
1736
1905
|
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$4));
|
|
1737
1906
|
const runScriptsOf = (source) => {
|
|
1738
1907
|
const found = [];
|
|
@@ -1755,20 +1924,14 @@ const problemsIn$1 = (file) => (source) => {
|
|
|
1755
1924
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
1756
1925
|
file,
|
|
1757
1926
|
...at(start),
|
|
1758
|
-
rule: RULE$
|
|
1759
|
-
message: MESSAGE$
|
|
1927
|
+
rule: RULE$4,
|
|
1928
|
+
message: MESSAGE$2
|
|
1760
1929
|
})));
|
|
1761
1930
|
};
|
|
1762
1931
|
/** @internal */
|
|
1763
1932
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
1764
|
-
const
|
|
1765
|
-
|
|
1766
|
-
const workflows = pipe(names, Array.filter((name) => WORKFLOW_FILE.test(name)));
|
|
1767
|
-
const found = yield* Effect.forEach(workflows, (name) => {
|
|
1768
|
-
const file = files.join(root, name);
|
|
1769
|
-
return files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$1(file)), Option.getOrElse(() => []))));
|
|
1770
|
-
}, { concurrency: READ_CONCURRENCY$3 });
|
|
1771
|
-
return Array.flatten(found);
|
|
1933
|
+
const workflows = yield* readWorkflows(root);
|
|
1934
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$1(file)(source)));
|
|
1772
1935
|
});
|
|
1773
1936
|
// src/features/scripts/model/script-checks.ts
|
|
1774
1937
|
/** @internal */
|
|
@@ -1776,6 +1939,139 @@ const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
|
|
|
1776
1939
|
const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], { concurrency: "unbounded" });
|
|
1777
1940
|
return Array.flatten(found);
|
|
1778
1941
|
});
|
|
1942
|
+
// src/features/workflow-concurrency/model/workflow-queue.ts
|
|
1943
|
+
const CONCURRENCY_KEY = "concurrency";
|
|
1944
|
+
const QUEUE_KEY = "queue";
|
|
1945
|
+
const RULE$3 = "workflow-queue";
|
|
1946
|
+
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.";
|
|
1947
|
+
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));
|
|
1948
|
+
const queueOffsetsOf = (source) => {
|
|
1949
|
+
const found = [];
|
|
1950
|
+
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
1951
|
+
if (isPair(pair) && isScalar(pair.key) && pair.key.value === CONCURRENCY_KEY) found.push(...Option.toArray(queueKeyOf(pair.value)));
|
|
1952
|
+
} });
|
|
1953
|
+
return found;
|
|
1954
|
+
};
|
|
1955
|
+
/** @internal */
|
|
1956
|
+
const checkWorkflowQueues = Effect.fn("checkWorkflowQueues")(function* checkWorkflowQueues(root) {
|
|
1957
|
+
const workflows = yield* readWorkflows(root);
|
|
1958
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => {
|
|
1959
|
+
const at = positionOf(source);
|
|
1960
|
+
return pipe(queueOffsetsOf(source), Array.map((offset) => {
|
|
1961
|
+
const { line, column } = at(offset);
|
|
1962
|
+
return {
|
|
1963
|
+
file,
|
|
1964
|
+
line,
|
|
1965
|
+
column,
|
|
1966
|
+
rule: RULE$3,
|
|
1967
|
+
message: MESSAGE$1
|
|
1968
|
+
};
|
|
1969
|
+
}));
|
|
1970
|
+
}));
|
|
1971
|
+
});
|
|
1972
|
+
// src/features/pass-through-wrappers/model/pass-through-wrappers.ts
|
|
1973
|
+
const RULE$2 = "pass-through-wrapper";
|
|
1974
|
+
const SINGLE_STATEMENT = 1;
|
|
1975
|
+
const SINGLE_DECLARATION = 1;
|
|
1976
|
+
const THIS_PARAMETER = "this";
|
|
1977
|
+
const NO_ARGUMENTS = [];
|
|
1978
|
+
const messageOf = (callee) => `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;
|
|
1979
|
+
const unwrapped = (expression) => {
|
|
1980
|
+
if (isParenthesizedExpression(expression)) return unwrapped(expression.expression);
|
|
1981
|
+
return expression;
|
|
1982
|
+
};
|
|
1983
|
+
const isWrapperExpression = (expression) => isArrowFunction(expression) || isFunctionExpression(expression);
|
|
1984
|
+
const candidateOf = (node) => {
|
|
1985
|
+
if (isFunctionDeclaration(node)) return pipe(Option.fromUndefinedOr(node.name), Option.map((name) => ({
|
|
1986
|
+
name,
|
|
1987
|
+
wrapper: node
|
|
1988
|
+
})));
|
|
1989
|
+
if (!isVariableDeclaration(node) || !isIdentifier(node.name)) return Option.none();
|
|
1990
|
+
const { name } = node;
|
|
1991
|
+
return pipe(Option.fromUndefinedOr(node.initializer), Option.map(unwrapped), Option.filter(isWrapperExpression), Option.map((wrapper) => ({
|
|
1992
|
+
name,
|
|
1993
|
+
wrapper
|
|
1994
|
+
})));
|
|
1995
|
+
};
|
|
1996
|
+
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));
|
|
1997
|
+
const returnedExpression = (wrapper) => {
|
|
1998
|
+
const { body } = wrapper;
|
|
1999
|
+
if (Predicate.isUndefined(body)) return Option.none();
|
|
2000
|
+
if (!isBlock(body)) return Option.some(body);
|
|
2001
|
+
if (body.statements.length !== SINGLE_STATEMENT) return Option.none();
|
|
2002
|
+
return pipe(Array.head(body.statements), Option.filter((statement) => isReturnStatement(statement)), Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)));
|
|
2003
|
+
};
|
|
2004
|
+
const callForward = (call) => ({
|
|
2005
|
+
node: call,
|
|
2006
|
+
callee: call.expression,
|
|
2007
|
+
kind: SignatureKind.Call,
|
|
2008
|
+
arguments: call.arguments,
|
|
2009
|
+
typed: Predicate.isNotUndefined(call.typeArguments),
|
|
2010
|
+
optional: Predicate.isNotUndefined(call.questionDotToken)
|
|
2011
|
+
});
|
|
2012
|
+
const forwardOf = (expression) => {
|
|
2013
|
+
const inner = unwrapped(expression);
|
|
2014
|
+
if (isCallExpression(inner)) return Option.some(callForward(inner));
|
|
2015
|
+
if (isNewExpression(inner)) return Option.some({
|
|
2016
|
+
node: inner,
|
|
2017
|
+
callee: inner.expression,
|
|
2018
|
+
kind: SignatureKind.Construct,
|
|
2019
|
+
arguments: inner.arguments ?? NO_ARGUMENTS,
|
|
2020
|
+
typed: Predicate.isNotUndefined(inner.typeArguments),
|
|
2021
|
+
optional: false
|
|
2022
|
+
});
|
|
2023
|
+
return Option.none();
|
|
2024
|
+
};
|
|
2025
|
+
const rootOf = (callee) => {
|
|
2026
|
+
if (isIdentifier(callee)) return Option.some(callee);
|
|
2027
|
+
if (isPropertyAccessExpression(callee) && Predicate.isUndefined(callee.questionDotToken) && isIdentifier(callee.name)) return rootOf(callee.expression);
|
|
2028
|
+
return Option.none();
|
|
2029
|
+
};
|
|
2030
|
+
const parameterName = (parameter) => {
|
|
2031
|
+
const { name } = parameter;
|
|
2032
|
+
if (!isIdentifier(name) || Predicate.isNotUndefined(parameter.initializer) || name.text === THIS_PARAMETER) return Option.none();
|
|
2033
|
+
return Option.some(name.text);
|
|
2034
|
+
};
|
|
2035
|
+
const isRest = (parameter) => Predicate.isNotUndefined(parameter.dotDotDotToken);
|
|
2036
|
+
const forwardsParameter = ([parameter, name, argument]) => {
|
|
2037
|
+
if (!isRest(parameter)) return isIdentifier(argument) && argument.text === name;
|
|
2038
|
+
return isSpreadElement(argument) && isIdentifier(argument.expression) && argument.expression.text === name;
|
|
2039
|
+
};
|
|
2040
|
+
const forwardedNames = (wrapper, forward) => {
|
|
2041
|
+
const { parameters } = wrapper;
|
|
2042
|
+
const names = pipe(parameters, Array.map(parameterName), Array.getSomes);
|
|
2043
|
+
if (names.length !== parameters.length || forward.arguments.length !== parameters.length) return Option.none();
|
|
2044
|
+
const triples = Array.zipWith(Array.zip(parameters, names), forward.arguments, ([parameter, name], argument) => [
|
|
2045
|
+
parameter,
|
|
2046
|
+
name,
|
|
2047
|
+
argument
|
|
2048
|
+
]);
|
|
2049
|
+
return pipe(Option.some(names), Option.filter(() => pipe(triples, Array.every(forwardsParameter))));
|
|
2050
|
+
};
|
|
2051
|
+
const calleeTakesExactly = (checker) => (forward, count) => {
|
|
2052
|
+
const signatures = checker.getSignaturesOfType(checker.getTypeAtLocation(forward.callee), forward.kind);
|
|
2053
|
+
return Array.isReadonlyArrayNonEmpty(signatures) && pipe(signatures, Array.every((signature) => !signature.hasRestParameter && signature.parameters.length === count && !Array.isReadonlyArrayNonEmpty(signature.typeParameters ?? [])));
|
|
2054
|
+
};
|
|
2055
|
+
const keepsTheReturnType = (checker) => (wrapper, forward) => Option.match(Option.fromUndefinedOr(wrapper.type), {
|
|
2056
|
+
onNone: () => true,
|
|
2057
|
+
onSome: (type) => checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id
|
|
2058
|
+
});
|
|
2059
|
+
const isOverloaded = (checker) => (name) => Option.exists(Option.fromUndefinedOr(checker.getSymbolAtLocation(name)), (symbol) => symbol.declarations.length > SINGLE_DECLARATION);
|
|
2060
|
+
const callsAnotherFunction = ({ name }, forward, names) => Option.exists(rootOf(forward.callee), (root) => root.text !== name.text && !names.includes(root.text));
|
|
2061
|
+
const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
2062
|
+
const { wrapper, name } = candidate;
|
|
2063
|
+
if (forward.typed || forward.optional) return false;
|
|
2064
|
+
const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
|
|
2065
|
+
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);
|
|
2066
|
+
};
|
|
2067
|
+
const problemOf$2 = (checker) => (candidate) => {
|
|
2068
|
+
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
2069
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt({
|
|
2070
|
+
rule: RULE$2,
|
|
2071
|
+
message: messageOf(forward.callee.getText())
|
|
2072
|
+
})(candidate.name)));
|
|
2073
|
+
};
|
|
2074
|
+
const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$2(checker)), Array.getSomes);
|
|
1779
2075
|
// src/features/value-owners/model/slots.ts
|
|
1780
2076
|
const ANNOTATED_KINDS = /* @__PURE__ */ new Set([
|
|
1781
2077
|
SyntaxKind.Parameter,
|
|
@@ -2058,7 +2354,7 @@ const derivationScopeOf = (node) => {
|
|
|
2058
2354
|
};
|
|
2059
2355
|
const sourcesOf = (checker) => (node) => pipe(referencedSymbols(checker)(derivationScopeOf(node)), Array.filter((symbol) => Option.isSome(namedValuesOf(checker)(symbol))));
|
|
2060
2356
|
const sitesUnder = (checker) => (node) => {
|
|
2061
|
-
const nested = pipe(childrenOf$
|
|
2357
|
+
const nested = pipe(childrenOf$3(node), Array.flatMap((child) => sitesUnder(checker)(child)));
|
|
2062
2358
|
if (Array.isReadonlyArrayNonEmpty(nested)) return nested;
|
|
2063
2359
|
return siteValuesOf(checker)(node).pipe(Option.map((values) => ({
|
|
2064
2360
|
node,
|
|
@@ -2166,7 +2462,7 @@ const ownerDeclarationsIn = (project, owners) => {
|
|
|
2166
2462
|
const isInside = (outers) => (node) => pipe(outers, Array.some((outer) => contains(outer)(node)));
|
|
2167
2463
|
const sitesOutside = (checker) => (project, outers) => pipe(project.sourceFiles, Array.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)), Array.filter((site) => !isInside(outers)(site.node)));
|
|
2168
2464
|
const nodesOf = (sites) => pipe(sites, Array.map((site) => site.node));
|
|
2169
|
-
const analyzeProject = (owners) => (project) => {
|
|
2465
|
+
const analyzeProject = ({ owners, sourceChecks }) => (project) => {
|
|
2170
2466
|
const { checker } = project;
|
|
2171
2467
|
const ownerDeclarations = ownerDeclarationsIn(project, owners);
|
|
2172
2468
|
const sites = sitesOutside(checker)(project, ownerDeclarations);
|
|
@@ -2189,7 +2485,11 @@ const analyzeProject = (owners) => (project) => {
|
|
|
2189
2485
|
shapes: project.library.shapes
|
|
2190
2486
|
};
|
|
2191
2487
|
return {
|
|
2192
|
-
problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [
|
|
2488
|
+
problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [
|
|
2489
|
+
...ownedLiteralProblems(context)(sourceFile, excluded),
|
|
2490
|
+
...shapeProblemsIn(shapeContext)(sourceFile),
|
|
2491
|
+
...pipe(sourceChecks, Array.flatMap((check) => check(checker)(sourceFile)))
|
|
2492
|
+
]))],
|
|
2193
2493
|
unowned: pipe(verdicts, Array.flatMap((found) => found.unowned))
|
|
2194
2494
|
};
|
|
2195
2495
|
};
|
|
@@ -2345,8 +2645,11 @@ const scopeOf = (project, configPath) => ({
|
|
|
2345
2645
|
name: Option.getOrElse(project.packageName, () => configPath),
|
|
2346
2646
|
dependencies: project.workspaceDependencies
|
|
2347
2647
|
});
|
|
2348
|
-
const freshAnalysis = ({ workspace, owners }) => (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => {
|
|
2349
|
-
const analysis = analyzeProject(
|
|
2648
|
+
const freshAnalysis = ({ workspace, owners, sourceChecks }) => (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => {
|
|
2649
|
+
const analysis = analyzeProject({
|
|
2650
|
+
owners,
|
|
2651
|
+
sourceChecks
|
|
2652
|
+
})(project);
|
|
2350
2653
|
const scope = scopeOf(project, configPath);
|
|
2351
2654
|
return {
|
|
2352
2655
|
problems: analysis.problems,
|
|
@@ -2379,13 +2682,14 @@ const cacheFor = Effect.fn("cacheFor")(function* cacheFor(root, owners) {
|
|
|
2379
2682
|
const encoded = yield* encodeOwners(plain).pipe(Effect.orElseSucceed(() => ""));
|
|
2380
2683
|
return yield* analysisCache(root, encoded);
|
|
2381
2684
|
});
|
|
2382
|
-
const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(workspace, owners, configPaths) {
|
|
2685
|
+
const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(workspace, { owners, sourceChecks }, configPaths) {
|
|
2383
2686
|
const files = yield* RepositoryFiles;
|
|
2384
2687
|
const cache = yield* cacheFor(workspace.root, owners);
|
|
2385
2688
|
const listed = yield* files.listedFiles(workspace.root);
|
|
2386
2689
|
const keyed = yield* pipe(configPaths, Effect.forEach(analyzeConfig({
|
|
2387
2690
|
workspace,
|
|
2388
2691
|
owners,
|
|
2692
|
+
sourceChecks,
|
|
2389
2693
|
cache,
|
|
2390
2694
|
listed
|
|
2391
2695
|
})));
|
|
@@ -2393,7 +2697,7 @@ const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(w
|
|
|
2393
2697
|
yield* pruneAnalyses(cache)(pipe(found, Array.map(([key]) => key)));
|
|
2394
2698
|
return pipe(found, Array.map(([, analysis]) => analysis));
|
|
2395
2699
|
});
|
|
2396
|
-
const checkRepository = Effect.fn("checkRepository")(function* checkRepository(root) {
|
|
2700
|
+
const checkRepository = Effect.fn("checkRepository")(function* checkRepository(root, sourceChecks = []) {
|
|
2397
2701
|
const files = yield* RepositoryFiles;
|
|
2398
2702
|
const workspace = {
|
|
2399
2703
|
compiler: yield* typeScriptCompiler,
|
|
@@ -2402,7 +2706,10 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
2402
2706
|
};
|
|
2403
2707
|
const configPaths = yield* listConfigFiles(root);
|
|
2404
2708
|
const ownerScan = yield* scanOwners(workspace, configPaths);
|
|
2405
|
-
const analyses = yield* analyzeProjects(workspace,
|
|
2709
|
+
const analyses = yield* analyzeProjects(workspace, {
|
|
2710
|
+
owners: ownerScan.owners,
|
|
2711
|
+
sourceChecks
|
|
2712
|
+
}, configPaths);
|
|
2406
2713
|
const relative = (file) => files.relative(root, file);
|
|
2407
2714
|
const unowned = pipe(analyses, Array.flatMap((analysis) => analysis.unowned));
|
|
2408
2715
|
return sortProblems([
|
|
@@ -2411,6 +2718,9 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
2411
2718
|
...duplicateProblems(relative)(unowned)
|
|
2412
2719
|
]);
|
|
2413
2720
|
}, Effect.scoped);
|
|
2721
|
+
// src/app/source-checks.ts
|
|
2722
|
+
/** @internal */
|
|
2723
|
+
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn]);
|
|
2414
2724
|
// src/features/comments/model/found-comment.ts
|
|
2415
2725
|
const taggedError$2 = Schema.TaggedError;
|
|
2416
2726
|
var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
|
|
@@ -2986,13 +3296,14 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
2986
3296
|
/** @internal */
|
|
2987
3297
|
const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
|
|
2988
3298
|
const found = yield* Effect.all([
|
|
2989
|
-
|
|
3299
|
+
checkSources(root),
|
|
2990
3300
|
checkOverrides(root),
|
|
2991
3301
|
checkTrackedText(root),
|
|
2992
3302
|
checkPlacement(root),
|
|
2993
3303
|
checkScripts(root),
|
|
2994
3304
|
checkPublishedPackages(root),
|
|
2995
|
-
checkWorkspaces(root)
|
|
3305
|
+
checkWorkspaces(root),
|
|
3306
|
+
checkWorkflowQueues(root)
|
|
2996
3307
|
], { concurrency: "unbounded" });
|
|
2997
3308
|
return Array.flatten(found);
|
|
2998
3309
|
});
|
|
@@ -3017,7 +3328,7 @@ const runCli = (program) => {
|
|
|
3017
3328
|
const main = Layer.build(services).pipe(Effect.flatMap((context) => Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context)), Effect.scoped);
|
|
3018
3329
|
runMain(main, { disableErrorReporting: true });
|
|
3019
3330
|
};
|
|
3020
|
-
//
|
|
3331
|
+
// bin/msch.ts
|
|
3021
3332
|
const NO_PROBLEMS = 0;
|
|
3022
3333
|
const reportText = (root, problems) => Effect.gen(function* report() {
|
|
3023
3334
|
const files = yield* RepositoryFiles;
|