@r_masseater/msch 0.19.0 → 0.20.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/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
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$
|
|
4
|
-
import { a as groupOf, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-B11FFAIk.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$2, 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-DZEnO-xY.mjs";
|
|
4
|
+
import { a as groupOf$1, 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$13 = "/";
|
|
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$13}`))
|
|
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$13}${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$14 = 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$14, index), String$1.split("\n"));
|
|
405
405
|
return {
|
|
406
406
|
line: before.length,
|
|
407
407
|
column: pipe(Array.last(before), Option.match({
|
|
@@ -415,7 +415,7 @@ const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
|
415
415
|
const SUBPATH_IMPORT = "#";
|
|
416
416
|
const WILDCARD$2 = "*";
|
|
417
417
|
const SCOPE = "@";
|
|
418
|
-
const SEPARATOR$
|
|
418
|
+
const SEPARATOR$12 = "/";
|
|
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$12);
|
|
431
|
+
if (String$1.startsWith(SCOPE)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS$1), Array.join(SEPARATOR$12));
|
|
432
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$12));
|
|
433
433
|
};
|
|
434
434
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
435
435
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -525,12 +525,12 @@ const InstalledManifest = Schema.Struct({
|
|
|
525
525
|
peerDependenciesMeta: PeerMeta
|
|
526
526
|
});
|
|
527
527
|
const decodeManifest$3 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
528
|
-
const keysOf$
|
|
528
|
+
const keysOf$2 = (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) => [
|
|
531
|
-
...keysOf$
|
|
532
|
-
...keysOf$
|
|
533
|
-
...pipe(keysOf$
|
|
531
|
+
...keysOf$2(manifest.dependencies),
|
|
532
|
+
...keysOf$2(manifest.optionalDependencies),
|
|
533
|
+
...pipe(keysOf$2(manifest.peerDependencies), Array.filter((name) => !isOptionalPeer(manifest, name)))
|
|
534
534
|
];
|
|
535
535
|
const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
536
536
|
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$13 = 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$13 && 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$13);
|
|
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$13))));
|
|
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$13);
|
|
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$13)),
|
|
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
|
})));
|
|
@@ -686,7 +686,7 @@ const problemsOf$2 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
|
|
|
686
686
|
join: (target) => files.join(workspace.directory, target),
|
|
687
687
|
packEntries: workspace.packEntries
|
|
688
688
|
});
|
|
689
|
-
const provided = HashSet.fromIterable(keysOf$
|
|
689
|
+
const provided = HashSet.fromIterable(keysOf$2(manifest.value.peerDependencies));
|
|
690
690
|
const sized = yield* sizeProblems({
|
|
691
691
|
workspace,
|
|
692
692
|
entries,
|
|
@@ -808,14 +808,14 @@ const withoutPeerContext = (version) => Option.match(String$1.indexOf(PEER_CONTE
|
|
|
808
808
|
onSome: (start) => String$1.slice(NAME_START, start)(version)
|
|
809
809
|
});
|
|
810
810
|
const packageOf$1 = (key) => Option.map(separatorOf(key), (separator) => [String$1.slice(NAME_START, separator)(key), withoutPeerContext(String$1.slice(separator + SEPARATOR_LENGTH)(key))]);
|
|
811
|
-
const keysOf = (node) => {
|
|
811
|
+
const keysOf$1 = (node) => {
|
|
812
812
|
if (!isMap(node)) return [];
|
|
813
813
|
return pipe(node.items, Array.flatMap((pair) => {
|
|
814
814
|
if (isScalar(pair.key)) return [String(pair.key.value)];
|
|
815
815
|
return [];
|
|
816
816
|
}));
|
|
817
817
|
};
|
|
818
|
-
const lockfileKeysOf = (lockfile, section) => pipe(parseAllDocuments(lockfile), Array.flatMap((document) => keysOf(document.get(section))));
|
|
818
|
+
const lockfileKeysOf = (lockfile, section) => pipe(parseAllDocuments(lockfile), Array.flatMap((document) => keysOf$1(document.get(section))));
|
|
819
819
|
const resolutionOf = (findings) => (lockfile) => {
|
|
820
820
|
const snapshots = lockfileKeysOf(lockfile, "snapshots");
|
|
821
821
|
const packages = Array.getSomes(pipe([...lockfileKeysOf(lockfile, "packages"), ...snapshots], Array.map((key) => packageOf$1(key))));
|
|
@@ -1005,7 +1005,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
1005
1005
|
});
|
|
1006
1006
|
// src/shared/lib/agent-docs.ts
|
|
1007
1007
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
1008
|
-
const READ_CONCURRENCY$
|
|
1008
|
+
const READ_CONCURRENCY$19 = 16;
|
|
1009
1009
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
1010
1010
|
const files = yield* RepositoryFiles;
|
|
1011
1011
|
const listed = yield* files.listedFiles(root);
|
|
@@ -1014,13 +1014,13 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
1014
1014
|
const file = files.join(root, name);
|
|
1015
1015
|
const problemOf = Option.flatMap(problemIn(file));
|
|
1016
1016
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
1017
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1017
|
+
}, { concurrency: READ_CONCURRENCY$19 });
|
|
1018
1018
|
return Array.getSomes(found);
|
|
1019
1019
|
});
|
|
1020
1020
|
// src/features/placement/model/agent-docs-length.ts
|
|
1021
1021
|
const RECOMMENDED_LINES = 200;
|
|
1022
1022
|
const FIRST$13 = 1;
|
|
1023
|
-
const RULE$
|
|
1023
|
+
const RULE$25 = "agent-docs-length";
|
|
1024
1024
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
1025
1025
|
const problemFor$5 = (file) => (lines) => {
|
|
1026
1026
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -1028,16 +1028,16 @@ const problemFor$5 = (file) => (lines) => {
|
|
|
1028
1028
|
file,
|
|
1029
1029
|
line: 201,
|
|
1030
1030
|
column: FIRST$13,
|
|
1031
|
-
rule: RULE$
|
|
1031
|
+
rule: RULE$25,
|
|
1032
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.`
|
|
1033
1033
|
});
|
|
1034
1034
|
};
|
|
1035
1035
|
/** @internal */
|
|
1036
1036
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
|
|
1037
1037
|
// src/features/placement/model/colocated-tests.ts
|
|
1038
|
-
const RULE$
|
|
1038
|
+
const RULE$24 = "colocated-test";
|
|
1039
1039
|
const FIRST$12 = 1;
|
|
1040
|
-
const READ_CONCURRENCY$
|
|
1040
|
+
const READ_CONCURRENCY$18 = 64;
|
|
1041
1041
|
const ROOT_SUBPATH = ".";
|
|
1042
1042
|
const NAME_GROUP = "name";
|
|
1043
1043
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -1061,7 +1061,7 @@ const problemFor$4 = (test, message) => ({
|
|
|
1061
1061
|
file: test.file,
|
|
1062
1062
|
line: FIRST$12,
|
|
1063
1063
|
column: FIRST$12,
|
|
1064
|
-
rule: RULE$
|
|
1064
|
+
rule: RULE$24,
|
|
1065
1065
|
message: `${test.base} ${message}`
|
|
1066
1066
|
});
|
|
1067
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);
|
|
@@ -1099,7 +1099,7 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
1099
1099
|
if (Option.isNone(source)) return true;
|
|
1100
1100
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
1101
1101
|
});
|
|
1102
|
-
const problemIn$
|
|
1102
|
+
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
1103
1103
|
if (SEPARATE_TEST_DIRECTORY.test(test.name)) return Option.some(problemFor$4(test, DIRECTORY_MESSAGE));
|
|
1104
1104
|
if (!TEST_FILE.test(test.name)) return Option.none();
|
|
1105
1105
|
if (yield* refersIn(context, test)) return Option.none();
|
|
@@ -1123,15 +1123,15 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
1123
1123
|
directory: files.dirname(file)
|
|
1124
1124
|
};
|
|
1125
1125
|
}));
|
|
1126
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$
|
|
1126
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$5(context, test), { concurrency: READ_CONCURRENCY$18 });
|
|
1127
1127
|
return Array.getSomes(found);
|
|
1128
1128
|
});
|
|
1129
1129
|
// src/features/placement/model/dangling-links.ts
|
|
1130
|
-
const RULE$
|
|
1131
|
-
const SEPARATOR$
|
|
1130
|
+
const RULE$23 = "dangling-link";
|
|
1131
|
+
const SEPARATOR$11 = "/";
|
|
1132
1132
|
const FIRST$11 = 1;
|
|
1133
|
-
const READ_CONCURRENCY$
|
|
1134
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
1133
|
+
const READ_CONCURRENCY$17 = 16;
|
|
1134
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$11}`)(name);
|
|
1135
1135
|
/** @internal */
|
|
1136
1136
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
1137
1137
|
const files = yield* RepositoryFiles;
|
|
@@ -1143,31 +1143,31 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
1143
1143
|
file,
|
|
1144
1144
|
line: FIRST$11,
|
|
1145
1145
|
column: FIRST$11,
|
|
1146
|
-
rule: RULE$
|
|
1146
|
+
rule: RULE$23,
|
|
1147
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
1148
|
})));
|
|
1149
1149
|
});
|
|
1150
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
1150
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$17 });
|
|
1151
1151
|
return Array.getSomes(found);
|
|
1152
1152
|
});
|
|
1153
1153
|
// src/features/placement/model/nested-docs.ts
|
|
1154
|
-
const RULE$
|
|
1154
|
+
const RULE$22 = "nested-docs";
|
|
1155
1155
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1156
|
-
const SEPARATOR$
|
|
1156
|
+
const SEPARATOR$10 = "/";
|
|
1157
1157
|
const FIRST$10 = 1;
|
|
1158
|
-
const READ_CONCURRENCY$
|
|
1158
|
+
const READ_CONCURRENCY$16 = 64;
|
|
1159
1159
|
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
1160
1160
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
1161
1161
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
1162
1162
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1163
1163
|
const taggedError$3 = Schema.TaggedError;
|
|
1164
1164
|
var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1165
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1165
|
+
const isNested = (name) => String$1.includes(SEPARATOR$10)(name);
|
|
1166
1166
|
const problemFor$3 = (file, message) => ({
|
|
1167
1167
|
file,
|
|
1168
1168
|
line: FIRST$10,
|
|
1169
1169
|
column: FIRST$10,
|
|
1170
|
-
rule: RULE$
|
|
1170
|
+
rule: RULE$22,
|
|
1171
1171
|
message
|
|
1172
1172
|
});
|
|
1173
1173
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
@@ -1182,7 +1182,7 @@ const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
|
1182
1182
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
1183
1183
|
return Option.some(problemFor$3(file, `${base} ${README_MESSAGE}`));
|
|
1184
1184
|
};
|
|
1185
|
-
const problemIn$
|
|
1185
|
+
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
1186
1186
|
const files = yield* RepositoryFiles;
|
|
1187
1187
|
const file = files.join(root, name);
|
|
1188
1188
|
const doc = {
|
|
@@ -1213,17 +1213,17 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1213
1213
|
workspaces: pipe(nested, Array.filter((name) => files.basename(name) === MANIFEST_FILE), Array.map((name) => files.dirname(files.join(root, name))), HashSet.fromIterable),
|
|
1214
1214
|
workspaceAgentDocs
|
|
1215
1215
|
};
|
|
1216
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$
|
|
1216
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$4(root, allowed, name), { concurrency: READ_CONCURRENCY$16 });
|
|
1217
1217
|
return Array.getSomes(found);
|
|
1218
1218
|
});
|
|
1219
1219
|
// src/features/placement/model/root-docs.ts
|
|
1220
|
-
const RULE$
|
|
1221
|
-
const SEPARATOR$
|
|
1220
|
+
const RULE$21 = "root-docs";
|
|
1221
|
+
const SEPARATOR$9 = "/";
|
|
1222
1222
|
const FIRST$9 = 1;
|
|
1223
1223
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1224
1224
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1225
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$
|
|
1226
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$9)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1227
1227
|
/** @internal */
|
|
1228
1228
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1229
1229
|
const files = yield* RepositoryFiles;
|
|
@@ -1232,15 +1232,15 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1232
1232
|
file: files.join(root, name),
|
|
1233
1233
|
line: FIRST$9,
|
|
1234
1234
|
column: FIRST$9,
|
|
1235
|
-
rule: RULE$
|
|
1235
|
+
rule: RULE$21,
|
|
1236
1236
|
message: `${name} ${MESSAGE$5}`
|
|
1237
1237
|
})));
|
|
1238
1238
|
});
|
|
1239
1239
|
// src/features/placement/model/root-readme.ts
|
|
1240
|
-
const RULE$
|
|
1240
|
+
const RULE$20 = "root-readme";
|
|
1241
1241
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1242
|
-
const READ_CONCURRENCY$
|
|
1243
|
-
const START$
|
|
1242
|
+
const READ_CONCURRENCY$15 = 16;
|
|
1243
|
+
const START$12 = 0;
|
|
1244
1244
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
1245
1245
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
1246
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.`;
|
|
@@ -1249,8 +1249,8 @@ const problemsIn$10 = (file, source) => ({ directory, pattern }) => {
|
|
|
1249
1249
|
const at = positionOf(source);
|
|
1250
1250
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
1251
1251
|
file,
|
|
1252
|
-
...at(found.index ?? START$
|
|
1253
|
-
rule: RULE$
|
|
1252
|
+
...at(found.index ?? START$12),
|
|
1253
|
+
rule: RULE$20,
|
|
1254
1254
|
message
|
|
1255
1255
|
})));
|
|
1256
1256
|
};
|
|
@@ -1268,7 +1268,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
1268
1268
|
const readmes = pipe(names, Array.filter((name) => ROOT_DOC.test(name)));
|
|
1269
1269
|
const named = yield* namedWorkspaces(root);
|
|
1270
1270
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
1271
|
-
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$15 });
|
|
1272
1272
|
return Array.flatten(found);
|
|
1273
1273
|
});
|
|
1274
1274
|
// src/features/placement/model/placement-checks.ts
|
|
@@ -1291,9 +1291,9 @@ const SCRIPTS = "scripts-directory";
|
|
|
1291
1291
|
const BIN = "bin";
|
|
1292
1292
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
1293
1293
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
1294
|
-
const SEPARATOR$
|
|
1294
|
+
const SEPARATOR$8 = "/";
|
|
1295
1295
|
const CURRENT = "./";
|
|
1296
|
-
const READ_CONCURRENCY$
|
|
1296
|
+
const READ_CONCURRENCY$14 = 8;
|
|
1297
1297
|
const FIRST$8 = 1;
|
|
1298
1298
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
1299
1299
|
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
@@ -1337,16 +1337,16 @@ const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
|
1337
1337
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
1338
1338
|
const files = yield* RepositoryFiles;
|
|
1339
1339
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
1340
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
1340
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$8}${name}`), Array.filter(isCommand$1));
|
|
1341
1341
|
});
|
|
1342
1342
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
1343
1343
|
const files = yield* RepositoryFiles;
|
|
1344
1344
|
const listed = yield* files.listedFiles(root);
|
|
1345
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$
|
|
1346
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$14 });
|
|
1347
1347
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
1348
1348
|
});
|
|
1349
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
1349
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$8));
|
|
1350
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
1351
|
file,
|
|
1352
1352
|
...positionOf(source)(start),
|
|
@@ -1393,17 +1393,17 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
1393
1393
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
1394
1394
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
1395
1395
|
const workflows = yield* workflowText(root);
|
|
1396
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$9(root, directory, workflows), { concurrency: READ_CONCURRENCY$
|
|
1397
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1396
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$9(root, directory, workflows), { concurrency: READ_CONCURRENCY$14 });
|
|
1397
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$14 });
|
|
1398
1398
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
1399
1399
|
});
|
|
1400
1400
|
// src/features/repository-layout/model/crates.ts
|
|
1401
|
-
const RULE$
|
|
1401
|
+
const RULE$19 = "unverified-crate";
|
|
1402
1402
|
const CARGO_FILE = "Cargo.toml";
|
|
1403
1403
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
1404
|
-
const SEPARATOR$
|
|
1404
|
+
const SEPARATOR$7 = "/";
|
|
1405
1405
|
const FIRST$7 = 1;
|
|
1406
|
-
const READ_CONCURRENCY$
|
|
1406
|
+
const READ_CONCURRENCY$13 = 8;
|
|
1407
1407
|
const CrateEntry = Schema.Struct({
|
|
1408
1408
|
name: Schema.String,
|
|
1409
1409
|
manifest_path: Schema.String
|
|
@@ -1429,17 +1429,17 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
1429
1429
|
})));
|
|
1430
1430
|
}, Effect.scoped);
|
|
1431
1431
|
const owningWorkspace = (directories) => (directory) => {
|
|
1432
|
-
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$7}`)(directory)));
|
|
1433
1433
|
return Array.last(Array.sort(owners, String$1.Order));
|
|
1434
1434
|
};
|
|
1435
1435
|
const problemFor$2 = (crate, message) => ({
|
|
1436
1436
|
file: crate.manifest,
|
|
1437
1437
|
line: FIRST$7,
|
|
1438
1438
|
column: FIRST$7,
|
|
1439
|
-
rule: RULE$
|
|
1439
|
+
rule: RULE$19,
|
|
1440
1440
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
1441
1441
|
});
|
|
1442
|
-
const problemIn$
|
|
1442
|
+
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
1443
1443
|
const files = yield* RepositoryFiles;
|
|
1444
1444
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
1445
1445
|
if (Option.isNone(workspace)) return Option.some(problemFor$2(crate, "is outside every workspace package"));
|
|
@@ -1452,11 +1452,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
1452
1452
|
if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
|
|
1453
1453
|
const directories = yield* workspaceDirectories(root);
|
|
1454
1454
|
const crates = yield* cratesIn(root);
|
|
1455
|
-
const found = yield* Effect.forEach(crates, (crate) => problemIn$
|
|
1455
|
+
const found = yield* Effect.forEach(crates, (crate) => problemIn$3(root, directories, crate), { concurrency: READ_CONCURRENCY$13 });
|
|
1456
1456
|
return Array.getSomes(found);
|
|
1457
1457
|
});
|
|
1458
1458
|
// src/features/repository-layout/model/fallow-entries.ts
|
|
1459
|
-
const RULE$
|
|
1459
|
+
const RULE$18 = "listed-entry";
|
|
1460
1460
|
const ENTRY_KEYS = [
|
|
1461
1461
|
"entry",
|
|
1462
1462
|
"entryPoints",
|
|
@@ -1464,9 +1464,9 @@ const ENTRY_KEYS = [
|
|
|
1464
1464
|
];
|
|
1465
1465
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
1466
1466
|
const WILDCARD$1 = /[*?{[]/u;
|
|
1467
|
-
const SEPARATOR$
|
|
1467
|
+
const SEPARATOR$6 = "/";
|
|
1468
1468
|
const WRAP_OFFSET = 1;
|
|
1469
|
-
const READ_CONCURRENCY$
|
|
1469
|
+
const READ_CONCURRENCY$12 = 8;
|
|
1470
1470
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
1471
1471
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
1472
1472
|
const entryPatternsIn = (node) => {
|
|
@@ -1476,7 +1476,7 @@ const entryPatternsIn = (node) => {
|
|
|
1476
1476
|
})));
|
|
1477
1477
|
return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
|
|
1478
1478
|
};
|
|
1479
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$
|
|
1479
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$6}`)(text))) || String$1.includes(SEPARATOR$6)(text) && !WILDCARD$1.test(text);
|
|
1480
1480
|
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
1481
1481
|
const files = yield* RepositoryFiles;
|
|
1482
1482
|
const path = files.join(root, file);
|
|
@@ -1486,7 +1486,7 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, di
|
|
|
1486
1486
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
1487
1487
|
file: path,
|
|
1488
1488
|
...positionOf(text.value)(start),
|
|
1489
|
-
rule: RULE$
|
|
1489
|
+
rule: RULE$18,
|
|
1490
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
1491
|
})));
|
|
1492
1492
|
});
|
|
@@ -1494,15 +1494,15 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, di
|
|
|
1494
1494
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
1495
1495
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
1496
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$
|
|
1497
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$8(root, file, directories), { concurrency: READ_CONCURRENCY$12 });
|
|
1498
1498
|
return Array.flatten(found);
|
|
1499
1499
|
});
|
|
1500
1500
|
// src/features/repository-layout/model/hidden-verify.ts
|
|
1501
|
-
const RULE$
|
|
1501
|
+
const RULE$17 = "hidden-verify";
|
|
1502
1502
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
1503
1503
|
const FIRST$6 = 1;
|
|
1504
|
-
const READ_CONCURRENCY$
|
|
1505
|
-
const problemIn$
|
|
1504
|
+
const READ_CONCURRENCY$11 = 8;
|
|
1505
|
+
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
1506
1506
|
const config = yield* workspaceConfigOf(root, directory);
|
|
1507
1507
|
if (Option.isNone(config)) return Option.none();
|
|
1508
1508
|
const { file, program } = config.value;
|
|
@@ -1512,18 +1512,18 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1512
1512
|
file,
|
|
1513
1513
|
line: FIRST$6,
|
|
1514
1514
|
column: FIRST$6,
|
|
1515
|
-
rule: RULE$
|
|
1515
|
+
rule: RULE$17,
|
|
1516
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}.`
|
|
1517
1517
|
}).pipe(Option.filter(() => verified));
|
|
1518
1518
|
});
|
|
1519
1519
|
/** @internal */
|
|
1520
1520
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
1521
1521
|
const directories = yield* workspaceDirectories(root);
|
|
1522
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$
|
|
1522
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$11 });
|
|
1523
1523
|
return Array.getSomes(found);
|
|
1524
1524
|
});
|
|
1525
1525
|
// src/features/repository-layout/model/root-workspace-paths.ts
|
|
1526
|
-
const RULE$
|
|
1526
|
+
const RULE$16 = "root-workspace-path";
|
|
1527
1527
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
1528
1528
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
1529
1529
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -1542,7 +1542,7 @@ const mentions = (directory) => (text) => {
|
|
|
1542
1542
|
const problemsIn$7 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
1543
1543
|
file,
|
|
1544
1544
|
...positionOf(source)(found.start),
|
|
1545
|
-
rule: RULE$
|
|
1545
|
+
rule: RULE$16,
|
|
1546
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.`
|
|
1547
1547
|
})));
|
|
1548
1548
|
/** @internal */
|
|
@@ -1556,8 +1556,8 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
1556
1556
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$7(file, source.value, directories)));
|
|
1557
1557
|
});
|
|
1558
1558
|
// src/features/repository-layout/model/shared-uncached-tasks.ts
|
|
1559
|
-
const RULE$
|
|
1560
|
-
const READ_CONCURRENCY$
|
|
1559
|
+
const RULE$15 = "shared-uncached-task";
|
|
1560
|
+
const READ_CONCURRENCY$10 = 8;
|
|
1561
1561
|
const SHARED = 2;
|
|
1562
1562
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
1563
1563
|
const UncachedTask = Schema.Struct({
|
|
@@ -1599,14 +1599,14 @@ const problemsOf$1 = (definitions) => {
|
|
|
1599
1599
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
1600
1600
|
file,
|
|
1601
1601
|
...position,
|
|
1602
|
-
rule: RULE$
|
|
1602
|
+
rule: RULE$15,
|
|
1603
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.`
|
|
1604
1604
|
})));
|
|
1605
1605
|
};
|
|
1606
1606
|
/** @internal */
|
|
1607
1607
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
1608
1608
|
const directories = yield* workspaceDirectories(root);
|
|
1609
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
1609
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$10 });
|
|
1610
1610
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$1));
|
|
1611
1611
|
});
|
|
1612
1612
|
// src/features/repository-layout/model/workflow-nodes.ts
|
|
@@ -1645,7 +1645,7 @@ const scalarsIn = (source) => {
|
|
|
1645
1645
|
const ROOT = ".";
|
|
1646
1646
|
const LOCAL = "./";
|
|
1647
1647
|
const NEGATION = "!";
|
|
1648
|
-
const SEPARATOR$
|
|
1648
|
+
const SEPARATOR$5 = "/";
|
|
1649
1649
|
const LINE$1 = "\n";
|
|
1650
1650
|
const UNRESOLVED_MARKERS = [
|
|
1651
1651
|
"${{",
|
|
@@ -1655,7 +1655,7 @@ const UNRESOLVED_MARKERS = [
|
|
|
1655
1655
|
const ABSOLUTE_MARKERS = ["/", "~"];
|
|
1656
1656
|
const FILE_INPUT_SUFFIX = "-file";
|
|
1657
1657
|
const DEPENDENCY_PATH_INPUT = "cache-dependency-path";
|
|
1658
|
-
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
1658
|
+
const FILTER_KEYS$1 = ["paths", "paths-ignore"];
|
|
1659
1659
|
const HASH_FILES = /hashFiles\((?<arguments>[^)]*)\)/gu;
|
|
1660
1660
|
const QUOTED$2 = /'(?<path>[^']*)'/gu;
|
|
1661
1661
|
const SCRIPT = /^[\w.@/-]+\.(?:ts|mts|cts|sh)$/u;
|
|
@@ -1672,7 +1672,7 @@ const withoutLocal = (path) => {
|
|
|
1672
1672
|
const joinPath = (base, path) => {
|
|
1673
1673
|
const relative = withoutLocal(String$1.trim(path));
|
|
1674
1674
|
if (base === ROOT) return relative;
|
|
1675
|
-
return `${base}${SEPARATOR$
|
|
1675
|
+
return `${base}${SEPARATOR$5}${relative}`;
|
|
1676
1676
|
};
|
|
1677
1677
|
const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
|
|
1678
1678
|
const path = String$1.trim(text);
|
|
@@ -1686,7 +1686,7 @@ const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
|
|
|
1686
1686
|
};
|
|
1687
1687
|
const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
|
|
1688
1688
|
const globsIn = (field, node) => pipe(itemsOf(node), Array.flatMap((item) => Option.toArray(stringOf(item))), Array.filter(isPositive), Array.flatMap(reference("glob", field)));
|
|
1689
|
-
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
1689
|
+
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
1690
1690
|
const directoryOf$1 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT, text)), Option.getOrElse(() => base));
|
|
1691
1691
|
const located = (kind, field, base = ROOT) => (found) => pipe(found, Option.toArray, Array.flatMap(reference(kind, field, base)));
|
|
1692
1692
|
const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL)(text)));
|
|
@@ -1745,12 +1745,12 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
1745
1745
|
/** @internal */
|
|
1746
1746
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
1747
1747
|
// src/features/repository-layout/model/workflow-paths.ts
|
|
1748
|
-
const RULE$
|
|
1748
|
+
const RULE$14 = "workflow-path";
|
|
1749
1749
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
1750
1750
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
1751
|
-
const READ_CONCURRENCY$
|
|
1751
|
+
const READ_CONCURRENCY$9 = 8;
|
|
1752
1752
|
const WILDCARD = /[*?[]/u;
|
|
1753
|
-
const SEPARATOR$
|
|
1753
|
+
const SEPARATOR$4 = "/";
|
|
1754
1754
|
const FIRST$4 = 0;
|
|
1755
1755
|
const EXPECTED = {
|
|
1756
1756
|
action: "a directory with action.yml",
|
|
@@ -1775,10 +1775,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
|
|
|
1775
1775
|
return Option.getOrElse(directory, () => false);
|
|
1776
1776
|
});
|
|
1777
1777
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
1778
|
-
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$4}${name}`)));
|
|
1779
1779
|
return pipe(found, Array.some(Boolean));
|
|
1780
1780
|
});
|
|
1781
|
-
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$4))}`;
|
|
1782
1782
|
const RESOLVERS = {
|
|
1783
1783
|
action: hasAction,
|
|
1784
1784
|
directory: isDirectoryAt,
|
|
@@ -1786,13 +1786,13 @@ const RESOLVERS = {
|
|
|
1786
1786
|
glob: matchesGlob,
|
|
1787
1787
|
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
1788
1788
|
if (yield* existsAt(root, path)) return true;
|
|
1789
|
-
const segments = String$1.split(path, SEPARATOR$
|
|
1789
|
+
const segments = String$1.split(path, SEPARATOR$4);
|
|
1790
1790
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
1791
1791
|
})
|
|
1792
1792
|
};
|
|
1793
1793
|
const staticPrefix = (path) => {
|
|
1794
1794
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
|
|
1795
|
-
if (String$1.endsWith(SEPARATOR$
|
|
1795
|
+
if (String$1.endsWith(SEPARATOR$4)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
|
|
1796
1796
|
return prefix;
|
|
1797
1797
|
};
|
|
1798
1798
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -1801,7 +1801,7 @@ const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
|
1801
1801
|
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
1802
1802
|
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
1803
1803
|
});
|
|
1804
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$
|
|
1804
|
+
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$4}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$4}`)(path);
|
|
1805
1805
|
const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
1806
1806
|
const prefix = staticPrefix(found.path);
|
|
1807
1807
|
if (pipe(produced, Array.some(overlaps(prefix)))) return false;
|
|
@@ -1811,7 +1811,7 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
1811
1811
|
const problemOf$5 = (file, source) => (found) => ({
|
|
1812
1812
|
file,
|
|
1813
1813
|
...positionOf(source)(found.offset),
|
|
1814
|
-
rule: RULE$
|
|
1814
|
+
rule: RULE$14,
|
|
1815
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.`
|
|
1816
1816
|
});
|
|
1817
1817
|
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -1826,9 +1826,102 @@ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow
|
|
|
1826
1826
|
/** @internal */
|
|
1827
1827
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
1828
1828
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
1829
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$6(root, workflow), { concurrency: READ_CONCURRENCY$
|
|
1829
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$6(root, workflow), { concurrency: READ_CONCURRENCY$9 });
|
|
1830
1830
|
return Array.flatten(found);
|
|
1831
1831
|
});
|
|
1832
|
+
// src/features/repository-layout/model/workflow-scale.ts
|
|
1833
|
+
const PATH_FILTER = "workflow-path-filter";
|
|
1834
|
+
const PACKAGE = "workflow-package";
|
|
1835
|
+
const WORKFLOW = /^\.github\/workflows\/(?<name>[^/]+)\.ya?ml$/u;
|
|
1836
|
+
const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
1837
|
+
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
1838
|
+
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
1839
|
+
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
1840
|
+
const START$11 = 0;
|
|
1841
|
+
const READ_CONCURRENCY$8 = 8;
|
|
1842
|
+
const SEPARATOR$3 = "/";
|
|
1843
|
+
const WORD_SEPARATORS = /[-_]/gu;
|
|
1844
|
+
const SPACE = " ";
|
|
1845
|
+
const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
|
|
1846
|
+
const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
|
|
1847
|
+
const keysOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array.filter(isPair), Array.flatMap(({ key }) => Option.toArray(stringOf(key))));
|
|
1848
|
+
const problemAt$1 = ({ file, source }, rule, message) => (offset) => ({
|
|
1849
|
+
file,
|
|
1850
|
+
...positionOf(source)(offset),
|
|
1851
|
+
rule,
|
|
1852
|
+
message
|
|
1853
|
+
});
|
|
1854
|
+
const pathFiltersIn = (file, source) => {
|
|
1855
|
+
const root = parseDocument(source).contents;
|
|
1856
|
+
const triggers = pipe(entriesOf(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
|
|
1857
|
+
const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
|
|
1858
|
+
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$1({
|
|
1859
|
+
file,
|
|
1860
|
+
source
|
|
1861
|
+
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
1862
|
+
};
|
|
1863
|
+
const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ pattern }) => Option.isSome(String$1.match(pattern)(text))), Option.map(({ directory }) => directory));
|
|
1864
|
+
const named = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
1865
|
+
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$3}`)(path)), Option.map(({ directory }) => directory));
|
|
1866
|
+
const namesIn = (name, source) => {
|
|
1867
|
+
const root = parseDocument(source).contents;
|
|
1868
|
+
return [
|
|
1869
|
+
{
|
|
1870
|
+
text: name,
|
|
1871
|
+
offset: START$11
|
|
1872
|
+
},
|
|
1873
|
+
...Option.toArray(stringOf(childOf("name")(root))),
|
|
1874
|
+
...keysOf(childOf("jobs")(root))
|
|
1875
|
+
];
|
|
1876
|
+
};
|
|
1877
|
+
const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, offset }) => pipe(Array.fromIterable(String$1.matchAll(PACKAGE_FILTER)(text)), Array.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap((groups) => Option.fromNullishOr(groups["value"])), Option.toArray)), Array.map((value) => ({
|
|
1878
|
+
text: value,
|
|
1879
|
+
offset
|
|
1880
|
+
})))));
|
|
1881
|
+
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$1(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
|
|
1882
|
+
const packagesIn = (workspaces, { file, name, source }) => {
|
|
1883
|
+
const where = {
|
|
1884
|
+
file,
|
|
1885
|
+
source
|
|
1886
|
+
};
|
|
1887
|
+
const fromNames = pipe(namesIn(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named(workspaces, text))));
|
|
1888
|
+
const referenced = pipe(workflowReferences(source), Array.filter(({ field }) => !String$1.startsWith("on.")(field)), Array.flatMap(({ field, path, offset }) => reported(where, offset, field)(containing(workspaces, path))));
|
|
1889
|
+
const filtered = pipe(filtersIn(source), Array.flatMap(({ text, offset }) => reported(where, offset, `--filter ${text}`)(matching(workspaces, text))));
|
|
1890
|
+
return [
|
|
1891
|
+
...fromNames,
|
|
1892
|
+
...referenced,
|
|
1893
|
+
...filtered
|
|
1894
|
+
];
|
|
1895
|
+
};
|
|
1896
|
+
const actionProblems = (workspaces, file, name) => pipe(named(workspaces, name), Option.map((directory) => ({
|
|
1897
|
+
file,
|
|
1898
|
+
line: 1,
|
|
1899
|
+
column: 1,
|
|
1900
|
+
rule: PACKAGE,
|
|
1901
|
+
message: packageMessage(`The action ${name}`, directory)
|
|
1902
|
+
})), Option.toArray);
|
|
1903
|
+
const groupOf = (pattern, name) => pipe(String$1.match(pattern)(name), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups["name"])));
|
|
1904
|
+
/** @internal */
|
|
1905
|
+
const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkflowScale(root) {
|
|
1906
|
+
const files = yield* RepositoryFiles;
|
|
1907
|
+
const listed = yield* files.listedFiles(root);
|
|
1908
|
+
const workspaces = yield* namedWorkspaces(root);
|
|
1909
|
+
const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf(WORKFLOW, name), Option.map((stem) => ({
|
|
1910
|
+
name,
|
|
1911
|
+
stem
|
|
1912
|
+
})), Option.toArray)));
|
|
1913
|
+
const found = yield* Effect.forEach(workflows, ({ name, stem }) => Effect.gen(function* problemsOf() {
|
|
1914
|
+
const file = files.join(root, name);
|
|
1915
|
+
const source = yield* files.readFile(file);
|
|
1916
|
+
return pipe(source, Option.map((text) => [...pathFiltersIn(file, text), ...packagesIn(workspaces, {
|
|
1917
|
+
file,
|
|
1918
|
+
name: stem,
|
|
1919
|
+
source: text
|
|
1920
|
+
})]), Option.getOrElse(() => []));
|
|
1921
|
+
}), { concurrency: READ_CONCURRENCY$8 });
|
|
1922
|
+
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
1923
|
+
return [...Array.flatten(found), ...actions];
|
|
1924
|
+
});
|
|
1832
1925
|
// src/features/repository-layout/model/workspace-checks.ts
|
|
1833
1926
|
/** @internal */
|
|
1834
1927
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
@@ -1839,12 +1932,13 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
1839
1932
|
checkHiddenVerify(root),
|
|
1840
1933
|
checkRootWorkspacePaths(root),
|
|
1841
1934
|
checkSharedUncachedTasks(root),
|
|
1842
|
-
checkWorkflowPaths(root)
|
|
1935
|
+
checkWorkflowPaths(root),
|
|
1936
|
+
checkWorkflowScale(root)
|
|
1843
1937
|
], { concurrency: "unbounded" });
|
|
1844
1938
|
return Array.flatten(found);
|
|
1845
1939
|
});
|
|
1846
1940
|
// src/features/pass-through-wrappers/model/pass-through-wrappers.ts
|
|
1847
|
-
const RULE$
|
|
1941
|
+
const RULE$13 = "pass-through-wrapper";
|
|
1848
1942
|
const SINGLE_STATEMENT = 1;
|
|
1849
1943
|
const SINGLE_DECLARATION = 1;
|
|
1850
1944
|
const THIS_PARAMETER = "this";
|
|
@@ -1940,8 +2034,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
1940
2034
|
};
|
|
1941
2035
|
const problemOf$4 = (checker) => (candidate) => {
|
|
1942
2036
|
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$
|
|
1944
|
-
rule: RULE$
|
|
2037
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$2({
|
|
2038
|
+
rule: RULE$13,
|
|
1945
2039
|
message: messageOf(forward.callee.getText())
|
|
1946
2040
|
})(candidate.name)));
|
|
1947
2041
|
};
|
|
@@ -2042,7 +2136,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
2042
2136
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
2043
2137
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
2044
2138
|
};
|
|
2045
|
-
const annotationProblem = (message) => problemAt$
|
|
2139
|
+
const annotationProblem = (message) => problemAt$2({
|
|
2046
2140
|
rule: "owner-annotation",
|
|
2047
2141
|
message
|
|
2048
2142
|
});
|
|
@@ -2167,7 +2261,7 @@ const shapeProblem = (site, matches) => {
|
|
|
2167
2261
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
2168
2262
|
onSome: () => "Use the library type instead of copying it."
|
|
2169
2263
|
});
|
|
2170
|
-
return problemAt$
|
|
2264
|
+
return problemAt$2({
|
|
2171
2265
|
rule: "library-shape",
|
|
2172
2266
|
message: `This shape copies ${shown}. ${advice}`
|
|
2173
2267
|
})(site.node);
|
|
@@ -2261,7 +2355,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
2261
2355
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
2262
2356
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
2263
2357
|
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.`;
|
|
2264
|
-
return verdict([problemAt$
|
|
2358
|
+
return verdict([problemAt$2({
|
|
2265
2359
|
rule: "owner-extension",
|
|
2266
2360
|
message
|
|
2267
2361
|
})(site.node)], []);
|
|
@@ -2283,7 +2377,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2283
2377
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
2284
2378
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
2285
2379
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
2286
|
-
return verdict([problemAt$
|
|
2380
|
+
return verdict([problemAt$2({
|
|
2287
2381
|
rule: "owner-value-set",
|
|
2288
2382
|
message
|
|
2289
2383
|
})(site.node)], []);
|
|
@@ -2291,7 +2385,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2291
2385
|
const candidates = libraryCandidates(context)(site);
|
|
2292
2386
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
2293
2387
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
2294
|
-
return verdict([problemAt$
|
|
2388
|
+
return verdict([problemAt$2({
|
|
2295
2389
|
rule: "library-value-set",
|
|
2296
2390
|
message
|
|
2297
2391
|
})(site.node)], []);
|
|
@@ -2322,7 +2416,7 @@ const isValuePosition = (node) => {
|
|
|
2322
2416
|
const { parent } = node;
|
|
2323
2417
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
2324
2418
|
};
|
|
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$
|
|
2419
|
+
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$2({
|
|
2326
2420
|
rule: "owned-literal",
|
|
2327
2421
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
2328
2422
|
})(literal)));
|
|
@@ -2596,17 +2690,17 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
2596
2690
|
/** @internal */
|
|
2597
2691
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn]);
|
|
2598
2692
|
// src/features/agent-settings/model/missing-hooks.ts
|
|
2599
|
-
const RULE$
|
|
2693
|
+
const RULE$12 = "missing-hook";
|
|
2600
2694
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
2601
2695
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
2602
2696
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
2603
2697
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
2604
2698
|
const PLUGIN_ROOT = "..";
|
|
2605
2699
|
const READ_CONCURRENCY$7 = 16;
|
|
2606
|
-
const START$
|
|
2607
|
-
const referenceOf = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
2700
|
+
const START$10 = 0;
|
|
2701
|
+
const referenceOf = (found) => pipe(groupOf$1("path")(found), Option.filter(() => Option.isNone(groupOf$1("optional")(found))), Option.map((path) => ({
|
|
2608
2702
|
path,
|
|
2609
|
-
index: found.index ?? START$
|
|
2703
|
+
index: found.index ?? START$10
|
|
2610
2704
|
})), Option.toArray);
|
|
2611
2705
|
const referencesIn = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf));
|
|
2612
2706
|
const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
@@ -2621,7 +2715,7 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
2621
2715
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
2622
2716
|
file,
|
|
2623
2717
|
...positionOf(source)(index),
|
|
2624
|
-
rule: RULE$
|
|
2718
|
+
rule: RULE$12,
|
|
2625
2719
|
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
2720
|
})));
|
|
2627
2721
|
});
|
|
@@ -2655,7 +2749,7 @@ const EXTENSION = /\.[^./]+$/u;
|
|
|
2655
2749
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
2656
2750
|
const READ_CONCURRENCY$6 = 64;
|
|
2657
2751
|
const FIRST$3 = 1;
|
|
2658
|
-
const RULE$
|
|
2752
|
+
const RULE$11 = "shell-script";
|
|
2659
2753
|
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
2754
|
const HookSchema = Schema.Struct({
|
|
2661
2755
|
command: Schema.optional(Schema.String),
|
|
@@ -2678,7 +2772,7 @@ const problemFor$1 = (file) => ({
|
|
|
2678
2772
|
file,
|
|
2679
2773
|
line: FIRST$3,
|
|
2680
2774
|
column: FIRST$3,
|
|
2681
|
-
rule: RULE$
|
|
2775
|
+
rule: RULE$11,
|
|
2682
2776
|
message: MESSAGE$4
|
|
2683
2777
|
});
|
|
2684
2778
|
/** @internal */
|
|
@@ -2715,8 +2809,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
2715
2809
|
});
|
|
2716
2810
|
// src/shared/lib/workflow-run.ts
|
|
2717
2811
|
const RUN_KEY = "run";
|
|
2718
|
-
const START$
|
|
2719
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
2812
|
+
const START$9 = 0;
|
|
2813
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$9));
|
|
2720
2814
|
const runScriptsOf = (source) => {
|
|
2721
2815
|
const found = [];
|
|
2722
2816
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -2731,7 +2825,7 @@ const runScriptsOf = (source) => {
|
|
|
2731
2825
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
2732
2826
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
2733
2827
|
const COMMENT = "#";
|
|
2734
|
-
const RULE$
|
|
2828
|
+
const RULE$10 = "workflow-script";
|
|
2735
2829
|
const ONE_COMMAND = 1;
|
|
2736
2830
|
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
2831
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -2745,7 +2839,7 @@ const problemsIn$4 = (file) => (source) => {
|
|
|
2745
2839
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
2746
2840
|
file,
|
|
2747
2841
|
...at(start),
|
|
2748
|
-
rule: RULE$
|
|
2842
|
+
rule: RULE$10,
|
|
2749
2843
|
message: MESSAGE$3
|
|
2750
2844
|
})));
|
|
2751
2845
|
};
|
|
@@ -2831,7 +2925,7 @@ const STEP_FILES = [
|
|
|
2831
2925
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
2832
2926
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
2833
2927
|
const READ_CONCURRENCY$4 = 16;
|
|
2834
|
-
const START$
|
|
2928
|
+
const START$8 = 0;
|
|
2835
2929
|
const FIRST$2 = 1;
|
|
2836
2930
|
const LINE = "\n";
|
|
2837
2931
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
@@ -2841,7 +2935,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
2841
2935
|
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
2842
2936
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
2843
2937
|
const NO_SOURCES = [];
|
|
2844
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
2938
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$8));
|
|
2845
2939
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
2846
2940
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
2847
2941
|
return {
|
|
@@ -2935,7 +3029,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
2935
3029
|
return Array.flatten(found);
|
|
2936
3030
|
});
|
|
2937
3031
|
// src/features/vite-plus/model/package-scripts.ts
|
|
2938
|
-
const RULE$
|
|
3032
|
+
const RULE$9 = "package-script";
|
|
2939
3033
|
const LIFECYCLE = [
|
|
2940
3034
|
"preinstall",
|
|
2941
3035
|
"install",
|
|
@@ -2958,30 +3052,30 @@ const LIFECYCLE = [
|
|
|
2958
3052
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
2959
3053
|
file,
|
|
2960
3054
|
...position,
|
|
2961
|
-
rule: RULE$
|
|
3055
|
+
rule: RULE$9,
|
|
2962
3056
|
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
3057
|
});
|
|
2964
3058
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
2965
3059
|
// src/features/vite-plus/model/vite-plus-block.ts
|
|
2966
|
-
const RULE$
|
|
3060
|
+
const RULE$8 = "vite-plus-block";
|
|
2967
3061
|
const MARKER = Array.join([
|
|
2968
3062
|
"<!--",
|
|
2969
3063
|
"VITE PLUS START",
|
|
2970
3064
|
"-->"
|
|
2971
3065
|
], "");
|
|
2972
3066
|
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) => {
|
|
3067
|
+
const problemIn$1 = (file) => (source) => {
|
|
2974
3068
|
const index = String$1.indexOf(MARKER)(source);
|
|
2975
3069
|
if (Option.isNone(index)) return Option.none();
|
|
2976
3070
|
return Option.some({
|
|
2977
3071
|
file,
|
|
2978
3072
|
...positionOf(source)(index.value),
|
|
2979
|
-
rule: RULE$
|
|
3073
|
+
rule: RULE$8,
|
|
2980
3074
|
message: MESSAGE$2
|
|
2981
3075
|
});
|
|
2982
3076
|
};
|
|
2983
3077
|
/** @internal */
|
|
2984
|
-
const checkVitePlusBlock = (root) => agentDocProblems(root, problemIn);
|
|
3078
|
+
const checkVitePlusBlock = (root) => agentDocProblems(root, problemIn$1);
|
|
2985
3079
|
// src/features/vite-plus/model/vite-plus-checks.ts
|
|
2986
3080
|
/** @internal */
|
|
2987
3081
|
const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
|
|
@@ -2995,7 +3089,7 @@ const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
|
|
|
2995
3089
|
// src/features/workflow-concurrency/model/workflow-queue.ts
|
|
2996
3090
|
const CONCURRENCY_KEY = "concurrency";
|
|
2997
3091
|
const QUEUE_KEY = "queue";
|
|
2998
|
-
const RULE$
|
|
3092
|
+
const RULE$7 = "workflow-queue";
|
|
2999
3093
|
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.";
|
|
3000
3094
|
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));
|
|
3001
3095
|
const queueOffsetsOf = (source) => {
|
|
@@ -3016,7 +3110,7 @@ const checkWorkflowQueues = Effect.fn("checkWorkflowQueues")(function* checkWork
|
|
|
3016
3110
|
file,
|
|
3017
3111
|
line,
|
|
3018
3112
|
column,
|
|
3019
|
-
rule: RULE$
|
|
3113
|
+
rule: RULE$7,
|
|
3020
3114
|
message: MESSAGE$1
|
|
3021
3115
|
};
|
|
3022
3116
|
}));
|
|
@@ -3123,7 +3217,7 @@ const COMMENT_NODES = [
|
|
|
3123
3217
|
"block_comment",
|
|
3124
3218
|
"multiline_comment"
|
|
3125
3219
|
];
|
|
3126
|
-
const START$
|
|
3220
|
+
const START$7 = 0;
|
|
3127
3221
|
const NEXT = 1;
|
|
3128
3222
|
const NONE$1 = [];
|
|
3129
3223
|
const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
|
|
@@ -3186,7 +3280,7 @@ const markupComment = (source) => (node) => {
|
|
|
3186
3280
|
}];
|
|
3187
3281
|
};
|
|
3188
3282
|
const textComments = (grammars, grammar) => (text) => {
|
|
3189
|
-
const shift = shifted(text.startIndex ?? START$
|
|
3283
|
+
const shift = shifted(text.startIndex ?? START$7);
|
|
3190
3284
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
3191
3285
|
};
|
|
3192
3286
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -3222,11 +3316,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
3222
3316
|
}[reader](source);
|
|
3223
3317
|
};
|
|
3224
3318
|
// src/features/comments/model/comments.ts
|
|
3225
|
-
const RULE$
|
|
3319
|
+
const RULE$6 = "comment";
|
|
3226
3320
|
const CONFIG_FILE = "vite.config.ts";
|
|
3227
3321
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
3228
3322
|
const READ_CONCURRENCY$3 = 64;
|
|
3229
|
-
const START$
|
|
3323
|
+
const START$6 = 0;
|
|
3230
3324
|
const FIRST_LINE$2 = 1;
|
|
3231
3325
|
const FIRST_COLUMN$2 = 1;
|
|
3232
3326
|
const READERS = [
|
|
@@ -3283,23 +3377,23 @@ const shebangReader = (source) => {
|
|
|
3283
3377
|
const readerOf = (name, source) => pipe(READERS, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
3284
3378
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
3285
3379
|
const lineBefore = (source, index) => {
|
|
3286
|
-
const lines = pipe(source, String$1.slice(START$
|
|
3380
|
+
const lines = pipe(source, String$1.slice(START$6, index), String$1.split("\n"));
|
|
3287
3381
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
3288
3382
|
};
|
|
3289
3383
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
3290
|
-
const isShebang = ({ index, text }) => index === START$
|
|
3384
|
+
const isShebang = ({ index, text }) => index === START$6 && String$1.startsWith(SHEBANG)(text);
|
|
3291
3385
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
3292
3386
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
3293
3387
|
file,
|
|
3294
3388
|
...positionOf(source)(index),
|
|
3295
|
-
rule: RULE$
|
|
3389
|
+
rule: RULE$6,
|
|
3296
3390
|
message: MESSAGE
|
|
3297
3391
|
});
|
|
3298
3392
|
const unreadableProblem = (file, message) => ({
|
|
3299
3393
|
file,
|
|
3300
3394
|
line: FIRST_LINE$2,
|
|
3301
3395
|
column: FIRST_COLUMN$2,
|
|
3302
|
-
rule: RULE$
|
|
3396
|
+
rule: RULE$6,
|
|
3303
3397
|
message: `msch could not read the comments in this file: ${message}`
|
|
3304
3398
|
});
|
|
3305
3399
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -3360,18 +3454,18 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
3360
3454
|
// src/features/invisible-characters/model/hidden-unicode.ts
|
|
3361
3455
|
const HIDDEN = /[\u00AD\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|[\u{E0000}-\u{E007F}]/gu;
|
|
3362
3456
|
const NUL = "\0";
|
|
3363
|
-
const START$
|
|
3457
|
+
const START$5 = 0;
|
|
3364
3458
|
const HEX = 16;
|
|
3365
3459
|
const CODE_POINT_WIDTH = 4;
|
|
3366
3460
|
const READ_CONCURRENCY$2 = 64;
|
|
3367
|
-
const RULE$
|
|
3368
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
3461
|
+
const RULE$5 = "hidden-unicode";
|
|
3462
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$5)(character), Option.getOrElse(() => START$5), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
3369
3463
|
const problemOf$1 = (file, source) => (found) => {
|
|
3370
|
-
const hex = hexOf(found[START$
|
|
3464
|
+
const hex = hexOf(found[START$5]);
|
|
3371
3465
|
return {
|
|
3372
3466
|
file,
|
|
3373
|
-
...positionOf(source)(found.index ?? START$
|
|
3374
|
-
rule: RULE$
|
|
3467
|
+
...positionOf(source)(found.index ?? START$5),
|
|
3468
|
+
rule: RULE$5,
|
|
3375
3469
|
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}.`
|
|
3376
3470
|
};
|
|
3377
3471
|
};
|
|
@@ -3468,7 +3562,7 @@ const checkPython = Effect.fn("checkPython")(function* checkPython(root) {
|
|
|
3468
3562
|
return [...pipe(present, Array.map(fileProblem)), ...scanned];
|
|
3469
3563
|
});
|
|
3470
3564
|
// src/features/runtime-version/model/node-version.ts
|
|
3471
|
-
const RULE$
|
|
3565
|
+
const RULE$4 = "node-version";
|
|
3472
3566
|
const MINIMUM = 26;
|
|
3473
3567
|
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
3474
3568
|
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
@@ -3482,7 +3576,7 @@ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t
|
|
|
3482
3576
|
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
3483
3577
|
const ALTERNATIVE = "||";
|
|
3484
3578
|
const ENGINES_KEY = "\"engines\"";
|
|
3485
|
-
const START$
|
|
3579
|
+
const START$4 = 0;
|
|
3486
3580
|
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
3487
3581
|
const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
|
|
3488
3582
|
const Manifest = Schema.Struct({
|
|
@@ -3491,7 +3585,7 @@ const Manifest = Schema.Struct({
|
|
|
3491
3585
|
engines: Schema.optional(Engines)
|
|
3492
3586
|
});
|
|
3493
3587
|
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
3494
|
-
const majorOf = (found) => pipe(groupOf("major")(found), Option.map(Number));
|
|
3588
|
+
const majorOf = (found) => pipe(groupOf$1("major")(found), Option.map(Number));
|
|
3495
3589
|
const isOld = (major) => major < MINIMUM;
|
|
3496
3590
|
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
3497
3591
|
const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
@@ -3502,14 +3596,14 @@ const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some
|
|
|
3502
3596
|
const problemAt = ({ entry, source, index }, message) => ({
|
|
3503
3597
|
file: entry.file,
|
|
3504
3598
|
...positionOf(source)(index),
|
|
3505
|
-
rule: RULE$
|
|
3599
|
+
rule: RULE$4,
|
|
3506
3600
|
message
|
|
3507
3601
|
});
|
|
3508
|
-
const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
3602
|
+
const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$4));
|
|
3509
3603
|
const unstatedProblem = (entry, source) => problemAt({
|
|
3510
3604
|
entry,
|
|
3511
3605
|
source,
|
|
3512
|
-
index: START$
|
|
3606
|
+
index: START$4
|
|
3513
3607
|
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
3514
3608
|
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
3515
3609
|
entry,
|
|
@@ -3528,12 +3622,12 @@ const manifestProblems = (entry, source) => {
|
|
|
3528
3622
|
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
3623
|
entry,
|
|
3530
3624
|
source,
|
|
3531
|
-
index: found.index ?? START$
|
|
3532
|
-
}, `${SUPPORTED} \`${String$1.trim(found[START$
|
|
3625
|
+
index: found.index ?? START$4
|
|
3626
|
+
}, `${SUPPORTED} \`${String$1.trim(found[START$4])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
3533
3627
|
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
3534
3628
|
entry,
|
|
3535
3629
|
source,
|
|
3536
|
-
index: START$
|
|
3630
|
+
index: START$4
|
|
3537
3631
|
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
3538
3632
|
const problemsIn$2 = (entry, source) => {
|
|
3539
3633
|
if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
|
|
@@ -3554,6 +3648,45 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
|
|
|
3554
3648
|
})))];
|
|
3555
3649
|
return yield* scanText(sources, problemsIn$2);
|
|
3556
3650
|
});
|
|
3651
|
+
// src/features/skills/model/skill-entry.ts
|
|
3652
|
+
const RULE$3 = "unlocked-skill";
|
|
3653
|
+
const LOCK_FILE = "skills-lock.json";
|
|
3654
|
+
const SOURCE = "masseater/skills";
|
|
3655
|
+
const ENTRY = "masseater-ecosystem";
|
|
3656
|
+
const INSTALLED_ENTRY = `.agents/skills/${ENTRY}/SKILL.md`;
|
|
3657
|
+
const NAMED = /`(?<name>[a-z0-9]+(?:-[a-z0-9]+)*)`(?!\]\()/gu;
|
|
3658
|
+
const START$3 = 0;
|
|
3659
|
+
const Lock = Schema.Struct({ skills: Schema.Record(Schema.String, Schema.Struct({ source: Schema.String })) });
|
|
3660
|
+
const decodeLock = Schema.decodeUnknownOption(Schema.fromJsonString(Lock));
|
|
3661
|
+
const namedIn = (entry) => pipe(Array.fromIterable(String$1.matchAll(NAMED)(entry)), Array.flatMap((found) => Option.toArray(groupOf$1("name")(found))), Array.dedupe);
|
|
3662
|
+
const fixFor = (name) => `Run "vp exec skills add ${SOURCE} -s ${name} -y". The command drops ref from the ${SOURCE} entries, so write it back.`;
|
|
3663
|
+
const problemIn = ({ file, source }) => (anchor, message) => ({
|
|
3664
|
+
file,
|
|
3665
|
+
...positionOf(source)(pipe(String$1.indexOf(anchor)(source), Option.getOrElse(() => START$3))),
|
|
3666
|
+
rule: RULE$3,
|
|
3667
|
+
message
|
|
3668
|
+
});
|
|
3669
|
+
const lockedSkills = Effect.fn("lockedSkills")(function* lockedSkills(root) {
|
|
3670
|
+
const files = yield* RepositoryFiles;
|
|
3671
|
+
const file = files.join(root, LOCK_FILE);
|
|
3672
|
+
const text = yield* files.readFile(file);
|
|
3673
|
+
return pipe(text, Option.flatMap((source) => pipe(decodeLock(source), Option.map((lock) => ({
|
|
3674
|
+
file,
|
|
3675
|
+
source,
|
|
3676
|
+
names: pipe(lock.skills, Record.filter((skill) => skill.source === SOURCE), Record.keys)
|
|
3677
|
+
})))), Option.filter(({ names }) => Array.isReadonlyArrayNonEmpty(names)));
|
|
3678
|
+
});
|
|
3679
|
+
/** @internal */
|
|
3680
|
+
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
3681
|
+
const files = yield* RepositoryFiles;
|
|
3682
|
+
const lock = yield* lockedSkills(root);
|
|
3683
|
+
if (Option.isNone(lock)) return [];
|
|
3684
|
+
const { names } = lock.value;
|
|
3685
|
+
const problemAt = problemIn(lock.value);
|
|
3686
|
+
if (!Array.contains(names, ENTRY)) return [problemAt(SOURCE, `installs skills from ${SOURCE} without ${ENTRY}, the skill that says which of them to read in which situation. ${fixFor(ENTRY)}`)];
|
|
3687
|
+
const entry = yield* files.readFile(files.join(root, INSTALLED_ENTRY));
|
|
3688
|
+
return pipe(entry, Option.map(namedIn), Option.getOrElse(() => []), Array.filter((name) => !Array.contains(names, name)), Array.map((name) => problemAt(`"${ENTRY}"`, `${ENTRY} tells agents to read ${name}, which this file does not install. ${fixFor(name)}`)));
|
|
3689
|
+
});
|
|
3557
3690
|
// src/features/skills/model/skill-files.ts
|
|
3558
3691
|
const RULE$2 = "skill-file";
|
|
3559
3692
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
@@ -3583,13 +3716,13 @@ const Frontmatter = Schema.Struct({
|
|
|
3583
3716
|
});
|
|
3584
3717
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
3585
3718
|
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))));
|
|
3719
|
+
const frontmatterOf = (source) => pipe(groupOf$1("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$1(yaml))));
|
|
3587
3720
|
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$2].length), Option.getOrElse(() => START$2));
|
|
3588
3721
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
3589
3722
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
3590
3723
|
const bodyStart = bodyStartOf(source);
|
|
3591
3724
|
const body = String$1.slice(bodyStart)(source);
|
|
3592
|
-
const heading = groupOf("title")(HEADING.exec(body));
|
|
3725
|
+
const heading = groupOf$1("title")(HEADING.exec(body));
|
|
3593
3726
|
return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
|
|
3594
3727
|
index: offsetOf(source, NAME_KEY),
|
|
3595
3728
|
message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
|
|
@@ -3615,7 +3748,7 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
3615
3748
|
rule: RULE$2,
|
|
3616
3749
|
message
|
|
3617
3750
|
})));
|
|
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) => ({
|
|
3751
|
+
const linkOf = (found) => pipe(groupOf$1("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
3752
|
target,
|
|
3620
3753
|
index: found.index ?? START$2
|
|
3621
3754
|
})), Option.toArray);
|
|
@@ -3924,6 +4057,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
3924
4057
|
checkAlchemyPatch(root),
|
|
3925
4058
|
checkNodeVersion(root),
|
|
3926
4059
|
checkSkillFiles(root),
|
|
4060
|
+
checkSkillEntry(root),
|
|
3927
4061
|
checkComments(root)
|
|
3928
4062
|
], { concurrency: "unbounded" });
|
|
3929
4063
|
return Array.flatten(found);
|