@r_masseater/msch 0.21.0 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/{cli-contract-Dia53DiS.mjs → cli-contract-D4OO_ku4.mjs} +15 -2
- package/dist/cli-contract-D4OO_ku4.mjs.map +1 -0
- package/dist/cli.mjs +278 -157
- package/dist/cli.mjs.map +1 -1
- package/dist/lint.d.mts +2 -6
- package/dist/lint.mjs +4 -3
- package/dist/lint.mjs.map +1 -1
- package/dist/oxlint.mjs +1 -1
- package/package.json +3 -2
- package/src/app/vite.d.ts +2 -0
- package/dist/cli-contract-Dia53DiS.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
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
|
|
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 packageOf$1, a as problemAt$3, at as isStringLiteral, b as resolvedSymbol, c as columnOf, ct as isTypeReferenceNode, d as descendantsOf, dt as isVariableDeclarationList, et as isReturnStatement, f as importedModulesOf, ft as isVariableStatement, g as lineOf, h as isTypeDeclaration, i as formatProblem, it as isSpreadElement, j as getTextOfJSDocComment, k as getLeadingCommentRanges, l as contains, lt as isUnionTypeNode, m as isGenericDeclaration, n as ProblemList, nt as isSignatureDeclaration, o as sortProblems, ot as isTypeAliasDeclaration, p as isExternalDeclaration, q as isModuleDeclaration, rt as isSourceFile, s as childrenOf$3, st as isTypeLiteralNode, tt as isSatisfiesExpression, u as declarationsOf, ut as isVariableDeclaration, v as propertyNamesOf, w as IndexKind, x as symbolAt, y as referencedSymbols, z as isEnumDeclaration } from "./cli-contract-D4OO_ku4.mjs";
|
|
4
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
|
+
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
6
7
|
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
8
|
import { ChildProcess } from "effect/process";
|
|
8
9
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -316,8 +317,8 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
|
|
|
316
317
|
return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
|
|
317
318
|
});
|
|
318
319
|
// src/entities/project/model/inputs.ts
|
|
319
|
-
const SEPARATOR$
|
|
320
|
-
const SCOPE_PREFIX$
|
|
320
|
+
const SEPARATOR$14 = "/";
|
|
321
|
+
const SCOPE_PREFIX$1 = "@";
|
|
321
322
|
const HIDDEN_PREFIX = ".";
|
|
322
323
|
const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
323
324
|
const nearestManifestDirectory = Effect.fn("nearestManifestDirectory")(function* nearestManifestDirectory(start) {
|
|
@@ -358,14 +359,14 @@ const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath)
|
|
|
358
359
|
const directories = yield* workspaceClosure(directory);
|
|
359
360
|
return {
|
|
360
361
|
directories,
|
|
361
|
-
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$
|
|
362
|
+
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$14}`))
|
|
362
363
|
};
|
|
363
364
|
});
|
|
364
365
|
const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
|
|
365
366
|
const files = yield* RepositoryFiles;
|
|
366
|
-
if (!String$1.startsWith(SCOPE_PREFIX$
|
|
367
|
+
if (!String$1.startsWith(SCOPE_PREFIX$1)(name)) return [name];
|
|
367
368
|
const scoped = yield* files.readDirectory(files.join(modules, name));
|
|
368
|
-
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$
|
|
369
|
+
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$14}${entry}`));
|
|
369
370
|
});
|
|
370
371
|
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
371
372
|
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
@@ -414,22 +415,22 @@ const positionOf = (source) => (index) => {
|
|
|
414
415
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
415
416
|
const SUBPATH_IMPORT = "#";
|
|
416
417
|
const WILDCARD$2 = "*";
|
|
417
|
-
const SCOPE = "@";
|
|
418
|
-
const SEPARATOR$
|
|
418
|
+
const SCOPE$1 = "@";
|
|
419
|
+
const SEPARATOR$13 = "/";
|
|
419
420
|
const SOURCE_SUFFIXES = [
|
|
420
421
|
"",
|
|
421
422
|
".ts",
|
|
422
423
|
".tsx",
|
|
423
424
|
"/index.ts"
|
|
424
425
|
];
|
|
425
|
-
const SCOPED_SEGMENTS
|
|
426
|
+
const SCOPED_SEGMENTS = 2;
|
|
426
427
|
const PLAIN_SEGMENTS = 1;
|
|
427
428
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
428
429
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
429
430
|
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
|
|
432
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$
|
|
431
|
+
const segments = String$1.split(specifier, SEPARATOR$13);
|
|
432
|
+
if (String$1.startsWith(SCOPE$1)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$13));
|
|
433
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$13));
|
|
433
434
|
};
|
|
434
435
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
435
436
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -776,7 +777,7 @@ const AdvisorySchema = Schema.Struct({
|
|
|
776
777
|
github_advisory_id: Schema.String
|
|
777
778
|
});
|
|
778
779
|
const AuditReport = Schema.fromJsonString(Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }));
|
|
779
|
-
const SCOPE_PREFIX
|
|
780
|
+
const SCOPE_PREFIX = "@";
|
|
780
781
|
const NAME_START = 0;
|
|
781
782
|
const SEPARATOR_LENGTH = 1;
|
|
782
783
|
const PEER_CONTEXT_START = "(";
|
|
@@ -800,14 +801,14 @@ const advisoriesIn = (output) => Option.match(Schema.decodeOption(AuditReport)(o
|
|
|
800
801
|
onSome: (report) => sorted(pipe(Record.values(report.advisories), Array.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`)))
|
|
801
802
|
});
|
|
802
803
|
const separatorOf = (key) => {
|
|
803
|
-
if (!String$1.startsWith(SCOPE_PREFIX
|
|
804
|
-
return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX
|
|
804
|
+
if (!String$1.startsWith(SCOPE_PREFIX)(key)) return String$1.indexOf(SCOPE_PREFIX)(key);
|
|
805
|
+
return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX), Option.map((index) => index + SEPARATOR_LENGTH));
|
|
805
806
|
};
|
|
806
807
|
const withoutPeerContext = (version) => Option.match(String$1.indexOf(PEER_CONTEXT_START)(version), {
|
|
807
808
|
onNone: () => version,
|
|
808
809
|
onSome: (start) => String$1.slice(NAME_START, start)(version)
|
|
809
810
|
});
|
|
810
|
-
const packageOf
|
|
811
|
+
const packageOf = (key) => Option.map(separatorOf(key), (separator) => [String$1.slice(NAME_START, separator)(key), withoutPeerContext(String$1.slice(separator + SEPARATOR_LENGTH)(key))]);
|
|
811
812
|
const keysOf$1 = (node) => {
|
|
812
813
|
if (!isMap(node)) return [];
|
|
813
814
|
return pipe(node.items, Array.flatMap((pair) => {
|
|
@@ -818,7 +819,7 @@ const keysOf$1 = (node) => {
|
|
|
818
819
|
const lockfileKeysOf = (lockfile, section) => pipe(parseAllDocuments(lockfile), Array.flatMap((document) => keysOf$1(document.get(section))));
|
|
819
820
|
const resolutionOf = (findings) => (lockfile) => {
|
|
820
821
|
const snapshots = lockfileKeysOf(lockfile, "snapshots");
|
|
821
|
-
const packages = Array.getSomes(pipe([...lockfileKeysOf(lockfile, "packages"), ...snapshots], Array.map((key) => packageOf
|
|
822
|
+
const packages = Array.getSomes(pipe([...lockfileKeysOf(lockfile, "packages"), ...snapshots], Array.map((key) => packageOf(key))));
|
|
822
823
|
const versions = Record.map(Array.groupBy(packages, ([name]) => name), (entries) => sorted(pipe(entries, Array.map(([, version]) => version))));
|
|
823
824
|
return {
|
|
824
825
|
...findings,
|
|
@@ -889,11 +890,11 @@ const withBaselineProbe = (manifest) => {
|
|
|
889
890
|
return document.toString();
|
|
890
891
|
};
|
|
891
892
|
// src/features/overrides/model/overrides.ts
|
|
892
|
-
const WORKSPACE_FILE$
|
|
893
|
+
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
893
894
|
const LOCKFILE$1 = "pnpm-lock.yaml";
|
|
894
895
|
const RESOLUTION_FILES = [
|
|
895
896
|
"*package.json",
|
|
896
|
-
WORKSPACE_FILE$
|
|
897
|
+
WORKSPACE_FILE$3,
|
|
897
898
|
LOCKFILE$1,
|
|
898
899
|
".npmrc",
|
|
899
900
|
"patches/*"
|
|
@@ -964,7 +965,7 @@ const resolutionWith = Effect.fn("resolutionWith")(function* resolutionWith(work
|
|
|
964
965
|
const path = yield* Path.Path;
|
|
965
966
|
const directory = yield* fs.makeTempDirectoryScoped({ prefix: "msch-overrides-" });
|
|
966
967
|
yield* copyFiles(workspace, directory);
|
|
967
|
-
yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE$
|
|
968
|
+
yield* fs.writeFileString(path.join(directory, WORKSPACE_FILE$3), manifest);
|
|
968
969
|
const output = yield* resolveIn(directory, override);
|
|
969
970
|
const lockfile = yield* fs.readFileString(path.join(directory, LOCKFILE$1));
|
|
970
971
|
yield* Effect.annotateCurrentSpan({ "msch.override": override });
|
|
@@ -983,7 +984,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, manifes
|
|
|
983
984
|
};
|
|
984
985
|
const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(manifest));
|
|
985
986
|
const judgeAgainstBaseline = judge(baseline);
|
|
986
|
-
const file = path.join(root, WORKSPACE_FILE$
|
|
987
|
+
const file = path.join(root, WORKSPACE_FILE$3);
|
|
987
988
|
const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(manifest)).pipe(Effect.map((candidate) => overrideProblem({
|
|
988
989
|
...located,
|
|
989
990
|
file
|
|
@@ -995,7 +996,7 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, manifes
|
|
|
995
996
|
const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
|
|
996
997
|
const fs = yield* FileSystem.FileSystem;
|
|
997
998
|
const path = yield* Path.Path;
|
|
998
|
-
const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$
|
|
999
|
+
const manifest = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$3)).pipe(Effect.option);
|
|
999
1000
|
const keys = Option.match(manifest, {
|
|
1000
1001
|
onNone: () => [],
|
|
1001
1002
|
onSome: overrideKeysOf
|
|
@@ -1020,7 +1021,7 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
1020
1021
|
// src/features/placement/model/agent-docs-length.ts
|
|
1021
1022
|
const RECOMMENDED_LINES = 200;
|
|
1022
1023
|
const FIRST$13 = 1;
|
|
1023
|
-
const RULE$
|
|
1024
|
+
const RULE$26 = "agent-docs-length";
|
|
1024
1025
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
1025
1026
|
const problemFor$5 = (file) => (lines) => {
|
|
1026
1027
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
@@ -1028,14 +1029,14 @@ const problemFor$5 = (file) => (lines) => {
|
|
|
1028
1029
|
file,
|
|
1029
1030
|
line: 201,
|
|
1030
1031
|
column: FIRST$13,
|
|
1031
|
-
rule: RULE$
|
|
1032
|
+
rule: RULE$26,
|
|
1032
1033
|
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
1034
|
});
|
|
1034
1035
|
};
|
|
1035
1036
|
/** @internal */
|
|
1036
1037
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$5(file)(lineCount(source)));
|
|
1037
1038
|
// src/features/placement/model/colocated-tests.ts
|
|
1038
|
-
const RULE$
|
|
1039
|
+
const RULE$25 = "colocated-test";
|
|
1039
1040
|
const FIRST$12 = 1;
|
|
1040
1041
|
const READ_CONCURRENCY$18 = 64;
|
|
1041
1042
|
const ROOT_SUBPATH = ".";
|
|
@@ -1061,12 +1062,12 @@ const problemFor$4 = (test, message) => ({
|
|
|
1061
1062
|
file: test.file,
|
|
1062
1063
|
line: FIRST$12,
|
|
1063
1064
|
column: FIRST$12,
|
|
1064
|
-
rule: RULE$
|
|
1065
|
+
rule: RULE$25,
|
|
1065
1066
|
message: `${test.base} ${message}`
|
|
1066
1067
|
});
|
|
1067
1068
|
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);
|
|
1068
1069
|
const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE.test(name)));
|
|
1069
|
-
const ownerOf$
|
|
1070
|
+
const ownerOf$2 = (packages, name) => {
|
|
1070
1071
|
const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
|
|
1071
1072
|
return Array.last(Array.sort(owners, byLength));
|
|
1072
1073
|
};
|
|
@@ -1077,7 +1078,7 @@ const specifiersBeside = ({ join, dirname, directory }) => (manifest) => pipe(Op
|
|
|
1077
1078
|
}), Array.filter(({ source }) => dirname(source) === directory), Array.map(({ label }) => String$1.replace(ROOT_SUBPATH, name)(label)))), Option.getOrElse(() => []));
|
|
1078
1079
|
const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context, test) {
|
|
1079
1080
|
const files = yield* RepositoryFiles;
|
|
1080
|
-
const owner = ownerOf$
|
|
1081
|
+
const owner = ownerOf$2(context.packages, test.name);
|
|
1081
1082
|
if (Option.isNone(owner)) return [];
|
|
1082
1083
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE));
|
|
1083
1084
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
@@ -1127,11 +1128,11 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
1127
1128
|
return Array.getSomes(found);
|
|
1128
1129
|
});
|
|
1129
1130
|
// src/features/placement/model/dangling-links.ts
|
|
1130
|
-
const RULE$
|
|
1131
|
-
const SEPARATOR$
|
|
1131
|
+
const RULE$24 = "dangling-link";
|
|
1132
|
+
const SEPARATOR$12 = "/";
|
|
1132
1133
|
const FIRST$11 = 1;
|
|
1133
1134
|
const READ_CONCURRENCY$17 = 16;
|
|
1134
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
1135
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$12}`)(name);
|
|
1135
1136
|
/** @internal */
|
|
1136
1137
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
1137
1138
|
const files = yield* RepositoryFiles;
|
|
@@ -1143,7 +1144,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
1143
1144
|
file,
|
|
1144
1145
|
line: FIRST$11,
|
|
1145
1146
|
column: FIRST$11,
|
|
1146
|
-
rule: RULE$
|
|
1147
|
+
rule: RULE$24,
|
|
1147
1148
|
message: `is a link to ${target}, where no file is tracked. A fresh checkout gets a link to nothing, and GitHub Actions fails to load the repository's actions. Track a file there, such as .gitkeep, or delete the link.`
|
|
1148
1149
|
})));
|
|
1149
1150
|
});
|
|
@@ -1151,9 +1152,9 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
1151
1152
|
return Array.getSomes(found);
|
|
1152
1153
|
});
|
|
1153
1154
|
// src/features/placement/model/nested-docs.ts
|
|
1154
|
-
const RULE$
|
|
1155
|
+
const RULE$23 = "nested-docs";
|
|
1155
1156
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
1156
|
-
const SEPARATOR$
|
|
1157
|
+
const SEPARATOR$11 = "/";
|
|
1157
1158
|
const FIRST$10 = 1;
|
|
1158
1159
|
const READ_CONCURRENCY$16 = 64;
|
|
1159
1160
|
const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
@@ -1162,12 +1163,12 @@ const README = /^README(?:\.[^/]+)?$/iu;
|
|
|
1162
1163
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
1163
1164
|
const taggedError$3 = Schema.TaggedError;
|
|
1164
1165
|
var RootConfigUnreadable = class extends taggedError$3()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
1165
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
1166
|
+
const isNested = (name) => String$1.includes(SEPARATOR$11)(name);
|
|
1166
1167
|
const problemFor$3 = (file, message) => ({
|
|
1167
1168
|
file,
|
|
1168
1169
|
line: FIRST$10,
|
|
1169
1170
|
column: FIRST$10,
|
|
1170
|
-
rule: RULE$
|
|
1171
|
+
rule: RULE$23,
|
|
1171
1172
|
message
|
|
1172
1173
|
});
|
|
1173
1174
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
@@ -1217,13 +1218,13 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
1217
1218
|
return Array.getSomes(found);
|
|
1218
1219
|
});
|
|
1219
1220
|
// src/features/placement/model/root-docs.ts
|
|
1220
|
-
const RULE$
|
|
1221
|
-
const SEPARATOR$
|
|
1221
|
+
const RULE$22 = "root-docs";
|
|
1222
|
+
const SEPARATOR$10 = "/";
|
|
1222
1223
|
const FIRST$9 = 1;
|
|
1223
1224
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
1224
1225
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
1225
1226
|
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$
|
|
1227
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$10)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
1227
1228
|
/** @internal */
|
|
1228
1229
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
1229
1230
|
const files = yield* RepositoryFiles;
|
|
@@ -1232,12 +1233,12 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
1232
1233
|
file: files.join(root, name),
|
|
1233
1234
|
line: FIRST$9,
|
|
1234
1235
|
column: FIRST$9,
|
|
1235
|
-
rule: RULE$
|
|
1236
|
+
rule: RULE$22,
|
|
1236
1237
|
message: `${name} ${MESSAGE$5}`
|
|
1237
1238
|
})));
|
|
1238
1239
|
});
|
|
1239
1240
|
// src/features/placement/model/root-readme.ts
|
|
1240
|
-
const RULE$
|
|
1241
|
+
const RULE$21 = "root-readme";
|
|
1241
1242
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
1242
1243
|
const READ_CONCURRENCY$15 = 16;
|
|
1243
1244
|
const START$12 = 0;
|
|
@@ -1250,7 +1251,7 @@ const problemsIn$10 = (file, source) => ({ directory, pattern }) => {
|
|
|
1250
1251
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
1251
1252
|
file,
|
|
1252
1253
|
...at(found.index ?? START$12),
|
|
1253
|
-
rule: RULE$
|
|
1254
|
+
rule: RULE$21,
|
|
1254
1255
|
message
|
|
1255
1256
|
})));
|
|
1256
1257
|
};
|
|
@@ -1291,7 +1292,7 @@ const SCRIPTS = "scripts-directory";
|
|
|
1291
1292
|
const BIN = "bin";
|
|
1292
1293
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
1293
1294
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
1294
|
-
const SEPARATOR$
|
|
1295
|
+
const SEPARATOR$9 = "/";
|
|
1295
1296
|
const CURRENT = "./";
|
|
1296
1297
|
const READ_CONCURRENCY$14 = 8;
|
|
1297
1298
|
const FIRST$8 = 1;
|
|
@@ -1337,7 +1338,7 @@ const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
|
1337
1338
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
1338
1339
|
const files = yield* RepositoryFiles;
|
|
1339
1340
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
1340
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
1341
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$9}${name}`), Array.filter(isCommand$1));
|
|
1341
1342
|
});
|
|
1342
1343
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
1343
1344
|
const files = yield* RepositoryFiles;
|
|
@@ -1346,7 +1347,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
1346
1347
|
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$14 });
|
|
1347
1348
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
1348
1349
|
});
|
|
1349
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
1350
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$9));
|
|
1350
1351
|
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
1351
1352
|
file,
|
|
1352
1353
|
...positionOf(source)(start),
|
|
@@ -1398,10 +1399,10 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
1398
1399
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
1399
1400
|
});
|
|
1400
1401
|
// src/features/repository-layout/model/crates.ts
|
|
1401
|
-
const RULE$
|
|
1402
|
+
const RULE$20 = "unverified-crate";
|
|
1402
1403
|
const CARGO_FILE = "Cargo.toml";
|
|
1403
1404
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
1404
|
-
const SEPARATOR$
|
|
1405
|
+
const SEPARATOR$8 = "/";
|
|
1405
1406
|
const FIRST$7 = 1;
|
|
1406
1407
|
const READ_CONCURRENCY$13 = 8;
|
|
1407
1408
|
const CrateEntry = Schema.Struct({
|
|
@@ -1429,14 +1430,14 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
1429
1430
|
})));
|
|
1430
1431
|
}, Effect.scoped);
|
|
1431
1432
|
const owningWorkspace = (directories) => (directory) => {
|
|
1432
|
-
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
1433
|
+
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$8}`)(directory)));
|
|
1433
1434
|
return Array.last(Array.sort(owners, String$1.Order));
|
|
1434
1435
|
};
|
|
1435
1436
|
const problemFor$2 = (crate, message) => ({
|
|
1436
1437
|
file: crate.manifest,
|
|
1437
1438
|
line: FIRST$7,
|
|
1438
1439
|
column: FIRST$7,
|
|
1439
|
-
rule: RULE$
|
|
1440
|
+
rule: RULE$20,
|
|
1440
1441
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
1441
1442
|
});
|
|
1442
1443
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -1456,7 +1457,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
1456
1457
|
return Array.getSomes(found);
|
|
1457
1458
|
});
|
|
1458
1459
|
// src/features/repository-layout/model/fallow-entries.ts
|
|
1459
|
-
const RULE$
|
|
1460
|
+
const RULE$19 = "listed-entry";
|
|
1460
1461
|
const ENTRY_KEYS = [
|
|
1461
1462
|
"entry",
|
|
1462
1463
|
"entryPoints",
|
|
@@ -1464,7 +1465,7 @@ const ENTRY_KEYS = [
|
|
|
1464
1465
|
];
|
|
1465
1466
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
1466
1467
|
const WILDCARD$1 = /[*?{[]/u;
|
|
1467
|
-
const SEPARATOR$
|
|
1468
|
+
const SEPARATOR$7 = "/";
|
|
1468
1469
|
const WRAP_OFFSET = 1;
|
|
1469
1470
|
const READ_CONCURRENCY$12 = 8;
|
|
1470
1471
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
@@ -1476,7 +1477,7 @@ const entryPatternsIn = (node) => {
|
|
|
1476
1477
|
})));
|
|
1477
1478
|
return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
|
|
1478
1479
|
};
|
|
1479
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$
|
|
1480
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$7}`)(text))) || String$1.includes(SEPARATOR$7)(text) && !WILDCARD$1.test(text);
|
|
1480
1481
|
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
1481
1482
|
const files = yield* RepositoryFiles;
|
|
1482
1483
|
const path = files.join(root, file);
|
|
@@ -1486,7 +1487,7 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, file, di
|
|
|
1486
1487
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
1487
1488
|
file: path,
|
|
1488
1489
|
...positionOf(text.value)(start),
|
|
1489
|
-
rule: RULE$
|
|
1490
|
+
rule: RULE$19,
|
|
1490
1491
|
message: `${pattern} names files one by one. Give fallow a place that every workspace uses the same way, such as bin/*.ts or a tool's config file name, or make fallow find the file through package.json.`
|
|
1491
1492
|
})));
|
|
1492
1493
|
});
|
|
@@ -1498,7 +1499,7 @@ const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallow
|
|
|
1498
1499
|
return Array.flatten(found);
|
|
1499
1500
|
});
|
|
1500
1501
|
// src/features/repository-layout/model/hidden-verify.ts
|
|
1501
|
-
const RULE$
|
|
1502
|
+
const RULE$18 = "hidden-verify";
|
|
1502
1503
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
1503
1504
|
const FIRST$6 = 1;
|
|
1504
1505
|
const READ_CONCURRENCY$11 = 8;
|
|
@@ -1512,7 +1513,7 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
1512
1513
|
file,
|
|
1513
1514
|
line: FIRST$6,
|
|
1514
1515
|
column: FIRST$6,
|
|
1515
|
-
rule: RULE$
|
|
1516
|
+
rule: RULE$18,
|
|
1516
1517
|
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
1518
|
}).pipe(Option.filter(() => verified));
|
|
1518
1519
|
});
|
|
@@ -1523,7 +1524,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
1523
1524
|
return Array.getSomes(found);
|
|
1524
1525
|
});
|
|
1525
1526
|
// src/features/repository-layout/model/root-workspace-paths.ts
|
|
1526
|
-
const RULE$
|
|
1527
|
+
const RULE$17 = "root-workspace-path";
|
|
1527
1528
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
1528
1529
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
1529
1530
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -1542,7 +1543,7 @@ const mentions = (directory) => (text) => {
|
|
|
1542
1543
|
const problemsIn$7 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
1543
1544
|
file,
|
|
1544
1545
|
...positionOf(source)(found.start),
|
|
1545
|
-
rule: RULE$
|
|
1546
|
+
rule: RULE$17,
|
|
1546
1547
|
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
1548
|
})));
|
|
1548
1549
|
/** @internal */
|
|
@@ -1556,7 +1557,7 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
1556
1557
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$7(file, source.value, directories)));
|
|
1557
1558
|
});
|
|
1558
1559
|
// src/features/repository-layout/model/shared-uncached-tasks.ts
|
|
1559
|
-
const RULE$
|
|
1560
|
+
const RULE$16 = "shared-uncached-task";
|
|
1560
1561
|
const READ_CONCURRENCY$10 = 8;
|
|
1561
1562
|
const SHARED = 2;
|
|
1562
1563
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -1599,7 +1600,7 @@ const problemsOf$1 = (definitions) => {
|
|
|
1599
1600
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
1600
1601
|
file,
|
|
1601
1602
|
...position,
|
|
1602
|
-
rule: RULE$
|
|
1603
|
+
rule: RULE$16,
|
|
1603
1604
|
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
1605
|
})));
|
|
1605
1606
|
};
|
|
@@ -1645,7 +1646,7 @@ const scalarsIn = (source) => {
|
|
|
1645
1646
|
const ROOT = ".";
|
|
1646
1647
|
const LOCAL = "./";
|
|
1647
1648
|
const NEGATION = "!";
|
|
1648
|
-
const SEPARATOR$
|
|
1649
|
+
const SEPARATOR$6 = "/";
|
|
1649
1650
|
const LINE$1 = "\n";
|
|
1650
1651
|
const UNRESOLVED_MARKERS = [
|
|
1651
1652
|
"${{",
|
|
@@ -1672,7 +1673,7 @@ const withoutLocal = (path) => {
|
|
|
1672
1673
|
const joinPath = (base, path) => {
|
|
1673
1674
|
const relative = withoutLocal(String$1.trim(path));
|
|
1674
1675
|
if (base === ROOT) return relative;
|
|
1675
|
-
return `${base}${SEPARATOR$
|
|
1676
|
+
return `${base}${SEPARATOR$6}${relative}`;
|
|
1676
1677
|
};
|
|
1677
1678
|
const reference = (kind, field, base = ROOT) => ({ text, offset }) => {
|
|
1678
1679
|
const path = String$1.trim(text);
|
|
@@ -1745,12 +1746,12 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
1745
1746
|
/** @internal */
|
|
1746
1747
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
1747
1748
|
// src/features/repository-layout/model/workflow-paths.ts
|
|
1748
|
-
const RULE$
|
|
1749
|
+
const RULE$15 = "workflow-path";
|
|
1749
1750
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
1750
1751
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
1751
1752
|
const READ_CONCURRENCY$9 = 8;
|
|
1752
1753
|
const WILDCARD = /[*?[]/u;
|
|
1753
|
-
const SEPARATOR$
|
|
1754
|
+
const SEPARATOR$5 = "/";
|
|
1754
1755
|
const FIRST$4 = 0;
|
|
1755
1756
|
const EXPECTED = {
|
|
1756
1757
|
action: "a directory with action.yml",
|
|
@@ -1775,10 +1776,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
|
|
|
1775
1776
|
return Option.getOrElse(directory, () => false);
|
|
1776
1777
|
});
|
|
1777
1778
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
1778
|
-
const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$
|
|
1779
|
+
const found = yield* pipe(ACTION_DEFINITIONS, Effect.forEach((name) => existsAt(root, `${path}${SEPARATOR$5}${name}`)));
|
|
1779
1780
|
return pipe(found, Array.some(Boolean));
|
|
1780
1781
|
});
|
|
1781
|
-
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$
|
|
1782
|
+
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$5))}`;
|
|
1782
1783
|
const RESOLVERS = {
|
|
1783
1784
|
action: hasAction,
|
|
1784
1785
|
directory: isDirectoryAt,
|
|
@@ -1786,13 +1787,13 @@ const RESOLVERS = {
|
|
|
1786
1787
|
glob: matchesGlob,
|
|
1787
1788
|
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
1788
1789
|
if (yield* existsAt(root, path)) return true;
|
|
1789
|
-
const segments = String$1.split(path, SEPARATOR$
|
|
1790
|
+
const segments = String$1.split(path, SEPARATOR$5);
|
|
1790
1791
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
1791
1792
|
})
|
|
1792
1793
|
};
|
|
1793
1794
|
const staticPrefix = (path) => {
|
|
1794
1795
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD));
|
|
1795
|
-
if (String$1.endsWith(SEPARATOR$
|
|
1796
|
+
if (String$1.endsWith(SEPARATOR$5)(prefix)) return String$1.slice(FIRST$4, -1)(prefix);
|
|
1796
1797
|
return prefix;
|
|
1797
1798
|
};
|
|
1798
1799
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -1801,7 +1802,7 @@ const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
|
1801
1802
|
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
1802
1803
|
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
1803
1804
|
});
|
|
1804
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$
|
|
1805
|
+
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$5}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$5}`)(path);
|
|
1805
1806
|
const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
1806
1807
|
const prefix = staticPrefix(found.path);
|
|
1807
1808
|
if (pipe(produced, Array.some(overlaps(prefix)))) return false;
|
|
@@ -1811,7 +1812,7 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
1811
1812
|
const problemOf$5 = (file, source) => (found) => ({
|
|
1812
1813
|
file,
|
|
1813
1814
|
...positionOf(source)(found.offset),
|
|
1814
|
-
rule: RULE$
|
|
1815
|
+
rule: RULE$15,
|
|
1815
1816
|
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
1817
|
});
|
|
1817
1818
|
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -1839,13 +1840,13 @@ const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
|
1839
1840
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
1840
1841
|
const START$11 = 0;
|
|
1841
1842
|
const READ_CONCURRENCY$8 = 8;
|
|
1842
|
-
const SEPARATOR$
|
|
1843
|
+
const SEPARATOR$4 = "/";
|
|
1843
1844
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
1844
1845
|
const SPACE = " ";
|
|
1845
1846
|
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
1847
|
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
1848
|
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$
|
|
1849
|
+
const problemAt$2 = ({ file, source }, rule, message) => (offset) => ({
|
|
1849
1850
|
file,
|
|
1850
1851
|
...positionOf(source)(offset),
|
|
1851
1852
|
rule,
|
|
@@ -1855,14 +1856,14 @@ const pathFiltersIn = (file, source) => {
|
|
|
1855
1856
|
const root = parseDocument(source).contents;
|
|
1856
1857
|
const triggers = pipe(entriesOf(childOf("on")(root)), Array.flatMap(([, trigger]) => keysOf(trigger)), Array.filter(({ text }) => Array.contains(FILTER_KEYS, text)));
|
|
1857
1858
|
const actions = pipe(scalarsIn(source), Array.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
|
|
1858
|
-
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$
|
|
1859
|
+
return pipe([...triggers, ...actions], Array.map(({ offset }) => problemAt$2({
|
|
1859
1860
|
file,
|
|
1860
1861
|
source
|
|
1861
1862
|
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
1862
1863
|
};
|
|
1863
1864
|
const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ pattern }) => Option.isSome(String$1.match(pattern)(text))), Option.map(({ directory }) => directory));
|
|
1864
1865
|
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$
|
|
1866
|
+
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$4}`)(path)), Option.map(({ directory }) => directory));
|
|
1866
1867
|
const namesIn = (name, source) => {
|
|
1867
1868
|
const root = parseDocument(source).contents;
|
|
1868
1869
|
return [
|
|
@@ -1878,7 +1879,7 @@ const filtersIn = (source) => pipe(scalarsIn(source), Array.flatMap(({ text, off
|
|
|
1878
1879
|
text: value,
|
|
1879
1880
|
offset
|
|
1880
1881
|
})))));
|
|
1881
|
-
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$
|
|
1882
|
+
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$2(where, PACKAGE, packageMessage(what, directory))(offset)), Option.toArray);
|
|
1882
1883
|
const packagesIn = (workspaces, { file, name, source }) => {
|
|
1883
1884
|
const where = {
|
|
1884
1885
|
file,
|
|
@@ -1938,7 +1939,7 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
1938
1939
|
return Array.flatten(found);
|
|
1939
1940
|
});
|
|
1940
1941
|
// src/features/pass-through-wrappers/model/pass-through-wrappers.ts
|
|
1941
|
-
const RULE$
|
|
1942
|
+
const RULE$14 = "pass-through-wrapper";
|
|
1942
1943
|
const SINGLE_STATEMENT = 1;
|
|
1943
1944
|
const SINGLE_DECLARATION = 1;
|
|
1944
1945
|
const THIS_PARAMETER = "this";
|
|
@@ -2034,8 +2035,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
2034
2035
|
};
|
|
2035
2036
|
const problemOf$4 = (checker) => (candidate) => {
|
|
2036
2037
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
2037
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
2038
|
-
rule: RULE$
|
|
2038
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$3({
|
|
2039
|
+
rule: RULE$14,
|
|
2039
2040
|
message: messageOf(forward.callee.getText())
|
|
2040
2041
|
})(candidate.name)));
|
|
2041
2042
|
};
|
|
@@ -2073,25 +2074,13 @@ const contextSymbolsOf = (checker) => (expression) => {
|
|
|
2073
2074
|
return slotOf(checker)(expression).pipe(Option.flatMap(annotationOf), Option.map((annotation) => referencedSymbols(checker)(annotation)), Option.getOrElse(() => []));
|
|
2074
2075
|
};
|
|
2075
2076
|
// src/features/value-owners/model/flows.ts
|
|
2076
|
-
const SCOPE_PREFIX = "@";
|
|
2077
|
-
const SCOPED_SEGMENTS = 2;
|
|
2078
|
-
const UNSCOPED_SEGMENTS = 1;
|
|
2079
2077
|
const MODULE_PREFIX = /^".*?"\./u;
|
|
2080
|
-
const packageOf = (fileName) => {
|
|
2081
|
-
const afterModules = pipe(fileName, String$1.lastIndexOf(NODE_MODULES_SEGMENT), Option.match({
|
|
2082
|
-
onNone: () => fileName,
|
|
2083
|
-
onSome: (index) => String$1.slice(index + NODE_MODULES_SEGMENT.length)(fileName)
|
|
2084
|
-
}));
|
|
2085
|
-
const segments = String$1.split("/")(afterModules);
|
|
2086
|
-
if (String$1.startsWith(SCOPE_PREFIX)(afterModules)) return pipe(Array.take(segments, SCOPED_SEGMENTS), Array.join("/"));
|
|
2087
|
-
return pipe(Array.take(segments, UNSCOPED_SEGMENTS), Array.join("/"));
|
|
2088
|
-
};
|
|
2089
2078
|
const externalDeclarationOf = (context) => (symbol) => Array.findFirst(declarationsOf(symbol), (declaration) => isExternalDeclaration(context.program)(declaration));
|
|
2090
|
-
const aliasTarget = (context) => (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => externalDeclarationOf(context)(alias).pipe(Option.map((declaration) => `${String$1.replace(MODULE_PREFIX, "")(context.checker.getFullyQualifiedName(alias))} from ${packageOf(declaration.getSourceFile().fileName)}`))));
|
|
2079
|
+
const aliasTarget = (context) => (type) => Option.fromUndefinedOr(type.getAliasSymbol()).pipe(Option.flatMap((alias) => externalDeclarationOf(context)(alias).pipe(Option.map((declaration) => `${String$1.replace(MODULE_PREFIX, "")(context.checker.getFullyQualifiedName(alias))} from ${packageOf$1(declaration.getSourceFile().fileName)}`))));
|
|
2091
2080
|
const isNamedContainer = (node) => isSignatureDeclaration(node) || isInterfaceDeclaration(node) || isClassDeclaration(node);
|
|
2092
2081
|
const slotTarget = (context) => (expression) => slotOf(context.checker)(expression).pipe(Option.filter((slot) => isExternalDeclaration(context.program)(slot)), Option.filter((slot) => Option.isSome(vocabularyOf(context.checker)(context.checker.getTypeAtLocation(slot)))), Option.map((slot) => {
|
|
2093
2082
|
const owner = Option.liftPredicate(slot.parent, isNamedContainer).pipe(Option.flatMap((container) => Option.fromUndefinedOr(getNameOfDeclaration(container))), Option.map((name) => ` of ${name.getText()}`), Option.getOrElse(() => ""));
|
|
2094
|
-
return `${Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(Option.map((found) => found.getText()), Option.getOrElse(() => "value"))}${owner} from ${packageOf(slot.getSourceFile().fileName)}`;
|
|
2083
|
+
return `${Option.fromUndefinedOr(getNameOfDeclaration(slot)).pipe(Option.map((found) => found.getText()), Option.getOrElse(() => "value"))}${owner} from ${packageOf$1(slot.getSourceFile().fileName)}`;
|
|
2095
2084
|
}));
|
|
2096
2085
|
const libraryTargetOf = (context) => (expression, contextual) => aliasTarget(context)(contextual).pipe(Option.orElse(() => slotTarget(context)(expression)));
|
|
2097
2086
|
const siteWithin = (context) => (node) => Array.findFirst(context.sites, (site) => contains(node)(site.node));
|
|
@@ -2136,7 +2125,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
2136
2125
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
2137
2126
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
2138
2127
|
};
|
|
2139
|
-
const annotationProblem = (message) => problemAt$
|
|
2128
|
+
const annotationProblem = (message) => problemAt$3({
|
|
2140
2129
|
rule: "owner-annotation",
|
|
2141
2130
|
message
|
|
2142
2131
|
});
|
|
@@ -2144,7 +2133,7 @@ const scanned = (owners, problems) => ({
|
|
|
2144
2133
|
owners,
|
|
2145
2134
|
problems
|
|
2146
2135
|
});
|
|
2147
|
-
const ownerOf = (project) => (annotated) => {
|
|
2136
|
+
const ownerOf$1 = (project) => (annotated) => {
|
|
2148
2137
|
const { node, conceptId } = annotated;
|
|
2149
2138
|
if (!isModuleConst(node)) return scanned([], [annotationProblem(`@${OWNER_TAG} registers an owner only on a module-scope const.`)(node)]);
|
|
2150
2139
|
if (conceptId === "") return scanned([], [annotationProblem(`@${OWNER_TAG} needs a concept id.`)(node)]);
|
|
@@ -2178,7 +2167,7 @@ const conflictProblems = (owners) => pipe(owners, Array.flatMap((owner, index) =
|
|
|
2178
2167
|
return [...pipe(Array.take(sameConcept, FIRST_OWNER_COUNT), Array.map(() => ownerProblem(`The concept ${owner.conceptId} already has an owner.`)(owner))), ...pipe(Array.take(sameSet, FIRST_OWNER_COUNT), Array.map((other) => ownerProblem(`The values ${formatValues(owner.values)} are already owned by ${other.conceptId}.`)(owner)))];
|
|
2179
2168
|
}));
|
|
2180
2169
|
const ownersIn = (project) => {
|
|
2181
|
-
const results = pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(annotatedIn(sourceFile), Array.map((annotated) => ownerOf(project)(annotated)))));
|
|
2170
|
+
const results = pipe(project.sourceFiles, Array.flatMap((sourceFile) => pipe(annotatedIn(sourceFile), Array.map((annotated) => ownerOf$1(project)(annotated)))));
|
|
2182
2171
|
return scanned(pipe(results, Array.flatMap((result) => result.owners)), pipe(results, Array.flatMap((result) => result.problems)));
|
|
2183
2172
|
};
|
|
2184
2173
|
const combineOwnerScans = (scans) => {
|
|
@@ -2199,6 +2188,19 @@ const derivedDeclarationsOf = (checker) => (node) => {
|
|
|
2199
2188
|
const scopes = Array.prepend(contractOf(node), node);
|
|
2200
2189
|
return new Set(pipe(scopes, Array.flatMap((scope) => referencedSymbols(checker)(scope)), Array.flatMap((symbol) => declarationsOf(symbol)), Array.map((declaration) => declarationKey(locationOf(declaration)))));
|
|
2201
2190
|
};
|
|
2191
|
+
// src/features/value-owners/model/property-match.ts
|
|
2192
|
+
const openTypeIdsOf = (checker) => ({
|
|
2193
|
+
any: checker.getAnyType().id,
|
|
2194
|
+
unknown: checker.getUnknownType().id
|
|
2195
|
+
});
|
|
2196
|
+
const sameProperty = ({ checker, open }) => (localType, library) => {
|
|
2197
|
+
const libraryType = checker.getTypeOfSymbol(library);
|
|
2198
|
+
return libraryType.id !== open.any && libraryType.id !== open.unknown && checker.isTypeAssignableTo(localType, libraryType) && checker.isTypeAssignableTo(libraryType, localType);
|
|
2199
|
+
};
|
|
2200
|
+
const declaredBy = (shape) => (library) => {
|
|
2201
|
+
const owner = packageOf$1(shape.declaration.file);
|
|
2202
|
+
return pipe(declarationsOf(library), Array.some((declaration) => packageOf$1(declaration.getSourceFile().fileName) === owner));
|
|
2203
|
+
};
|
|
2202
2204
|
// src/features/value-owners/model/shapes.ts
|
|
2203
2205
|
const MINIMUM_SHAPE_PROPERTIES = 3;
|
|
2204
2206
|
const EXACT = 0;
|
|
@@ -2220,10 +2222,6 @@ const shapeSitesIn = (checker) => (sourceFile) => Array.getSomes(pipe(descendant
|
|
|
2220
2222
|
node,
|
|
2221
2223
|
type
|
|
2222
2224
|
}))))));
|
|
2223
|
-
const openTypeIdsOf = (checker) => ({
|
|
2224
|
-
any: checker.getAnyType().id,
|
|
2225
|
-
unknown: checker.getUnknownType().id
|
|
2226
|
-
});
|
|
2227
2225
|
const isIndexedDeclaration = (node) => isTypeDeclaration(node) || isVariableDeclaration(node);
|
|
2228
2226
|
const declarationAt = (program) => (location) => Option.fromUndefinedOr(program.getSourceFile(location.file)).pipe(Option.flatMap((sourceFile) => Array.findFirst(descendantsOf(sourceFile), (node) => node.pos === location.pos && node.kind === location.kind && isIndexedDeclaration(node))));
|
|
2229
2227
|
const symbolOfDeclaration = (checker) => (declaration) => Option.fromUndefinedOr(checker.getSymbolAtLocation(declaration.name));
|
|
@@ -2238,13 +2236,12 @@ const hasEveryName = (locals) => (shape) => {
|
|
|
2238
2236
|
const names = new Set(shape.propertyNames);
|
|
2239
2237
|
return pipe(locals, Array.every((local) => names.has(local.name)));
|
|
2240
2238
|
};
|
|
2241
|
-
const sameProperty = (checker, open) => (localType, library) => {
|
|
2242
|
-
const libraryType = checker.getTypeOfSymbol(library);
|
|
2243
|
-
return libraryType.id !== open.any && libraryType.id !== open.unknown && checker.isTypeAssignableTo(localType, libraryType) && checker.isTypeAssignableTo(libraryType, localType);
|
|
2244
|
-
};
|
|
2245
2239
|
const matchOf = (context, open) => (locals, shape) => {
|
|
2246
2240
|
const { checker } = context;
|
|
2247
|
-
if (!shapeTypeOf(context)(shape).pipe(Option.exists((shapeType) => pipe(locals, Array.every((local) => Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(Option.exists((library) =>
|
|
2241
|
+
if (!shapeTypeOf(context)(shape).pipe(Option.exists((shapeType) => pipe(locals, Array.every((local) => Option.fromUndefinedOr(checker.getPropertyOfType(shapeType, local.name)).pipe(Option.exists((library) => declaredBy(shape)(library) && sameProperty({
|
|
2242
|
+
checker,
|
|
2243
|
+
open
|
|
2244
|
+
})(local.type, library)))))))) return Option.none();
|
|
2248
2245
|
return Option.some({
|
|
2249
2246
|
shape,
|
|
2250
2247
|
extra: shape.propertyNames.length - locals.length
|
|
@@ -2261,7 +2258,7 @@ const shapeProblem = (site, matches) => {
|
|
|
2261
2258
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
2262
2259
|
onSome: () => "Use the library type instead of copying it."
|
|
2263
2260
|
});
|
|
2264
|
-
return problemAt$
|
|
2261
|
+
return problemAt$3({
|
|
2265
2262
|
rule: "library-shape",
|
|
2266
2263
|
message: `This shape copies ${shown}. ${advice}`
|
|
2267
2264
|
})(site.node);
|
|
@@ -2355,7 +2352,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
2355
2352
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
2356
2353
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
2357
2354
|
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.`;
|
|
2358
|
-
return verdict([problemAt$
|
|
2355
|
+
return verdict([problemAt$3({
|
|
2359
2356
|
rule: "owner-extension",
|
|
2360
2357
|
message
|
|
2361
2358
|
})(site.node)], []);
|
|
@@ -2377,7 +2374,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2377
2374
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
2378
2375
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
2379
2376
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
2380
|
-
return verdict([problemAt$
|
|
2377
|
+
return verdict([problemAt$3({
|
|
2381
2378
|
rule: "owner-value-set",
|
|
2382
2379
|
message
|
|
2383
2380
|
})(site.node)], []);
|
|
@@ -2385,7 +2382,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
2385
2382
|
const candidates = libraryCandidates(context)(site);
|
|
2386
2383
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
2387
2384
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
2388
|
-
return verdict([problemAt$
|
|
2385
|
+
return verdict([problemAt$3({
|
|
2389
2386
|
rule: "library-value-set",
|
|
2390
2387
|
message
|
|
2391
2388
|
})(site.node)], []);
|
|
@@ -2416,7 +2413,7 @@ const isValuePosition = (node) => {
|
|
|
2416
2413
|
const { parent } = node;
|
|
2417
2414
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
2418
2415
|
};
|
|
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$
|
|
2416
|
+
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$3({
|
|
2420
2417
|
rule: "owned-literal",
|
|
2421
2418
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
2422
2419
|
})(literal)));
|
|
@@ -2690,7 +2687,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
2690
2687
|
/** @internal */
|
|
2691
2688
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn]);
|
|
2692
2689
|
// src/features/agent-settings/model/missing-hooks.ts
|
|
2693
|
-
const RULE$
|
|
2690
|
+
const RULE$13 = "missing-hook";
|
|
2694
2691
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
2695
2692
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
2696
2693
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
@@ -2715,7 +2712,7 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
2715
2712
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
2716
2713
|
file,
|
|
2717
2714
|
...positionOf(source)(index),
|
|
2718
|
-
rule: RULE$
|
|
2715
|
+
rule: RULE$13,
|
|
2719
2716
|
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.`
|
|
2720
2717
|
})));
|
|
2721
2718
|
});
|
|
@@ -2749,7 +2746,7 @@ const EXTENSION = /\.[^./]+$/u;
|
|
|
2749
2746
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
2750
2747
|
const READ_CONCURRENCY$6 = 64;
|
|
2751
2748
|
const FIRST$3 = 1;
|
|
2752
|
-
const RULE$
|
|
2749
|
+
const RULE$12 = "shell-script";
|
|
2753
2750
|
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.";
|
|
2754
2751
|
const HookSchema = Schema.Struct({
|
|
2755
2752
|
command: Schema.optional(Schema.String),
|
|
@@ -2772,7 +2769,7 @@ const problemFor$1 = (file) => ({
|
|
|
2772
2769
|
file,
|
|
2773
2770
|
line: FIRST$3,
|
|
2774
2771
|
column: FIRST$3,
|
|
2775
|
-
rule: RULE$
|
|
2772
|
+
rule: RULE$12,
|
|
2776
2773
|
message: MESSAGE$4
|
|
2777
2774
|
});
|
|
2778
2775
|
/** @internal */
|
|
@@ -2825,7 +2822,7 @@ const runScriptsOf = (source) => {
|
|
|
2825
2822
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
2826
2823
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
2827
2824
|
const COMMENT = "#";
|
|
2828
|
-
const RULE$
|
|
2825
|
+
const RULE$11 = "workflow-script";
|
|
2829
2826
|
const ONE_COMMAND = 1;
|
|
2830
2827
|
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.";
|
|
2831
2828
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -2839,7 +2836,7 @@ const problemsIn$4 = (file) => (source) => {
|
|
|
2839
2836
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
2840
2837
|
file,
|
|
2841
2838
|
...at(start),
|
|
2842
|
-
rule: RULE$
|
|
2839
|
+
rule: RULE$11,
|
|
2843
2840
|
message: MESSAGE$3
|
|
2844
2841
|
})));
|
|
2845
2842
|
};
|
|
@@ -2857,12 +2854,12 @@ const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
|
|
|
2857
2854
|
// src/features/vite-plus/model/command-words.ts
|
|
2858
2855
|
const CONTINUATION = /\\\n/gu;
|
|
2859
2856
|
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
2860
|
-
const SEPARATOR$
|
|
2857
|
+
const SEPARATOR$3 = /&&|\|\||[;|\n`]|\$\(/u;
|
|
2861
2858
|
const BLANK$1 = /\s+/u;
|
|
2862
2859
|
const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
|
|
2863
2860
|
const QUOTE = "\"\"";
|
|
2864
2861
|
const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
|
|
2865
|
-
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$
|
|
2862
|
+
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$3), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
|
|
2866
2863
|
// src/features/vite-plus/model/command-problems.ts
|
|
2867
2864
|
const PACKAGE_MANAGERS = [
|
|
2868
2865
|
"pnpm",
|
|
@@ -3029,7 +3026,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
3029
3026
|
return Array.flatten(found);
|
|
3030
3027
|
});
|
|
3031
3028
|
// src/features/vite-plus/model/package-scripts.ts
|
|
3032
|
-
const RULE$
|
|
3029
|
+
const RULE$10 = "package-script";
|
|
3033
3030
|
const LIFECYCLE = [
|
|
3034
3031
|
"preinstall",
|
|
3035
3032
|
"install",
|
|
@@ -3052,12 +3049,12 @@ const LIFECYCLE = [
|
|
|
3052
3049
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
3053
3050
|
file,
|
|
3054
3051
|
...position,
|
|
3055
|
-
rule: RULE$
|
|
3052
|
+
rule: RULE$10,
|
|
3056
3053
|
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.`
|
|
3057
3054
|
});
|
|
3058
3055
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
3059
3056
|
// src/features/vite-plus/model/vite-plus-block.ts
|
|
3060
|
-
const RULE$
|
|
3057
|
+
const RULE$9 = "vite-plus-block";
|
|
3061
3058
|
const MARKER = Array.join([
|
|
3062
3059
|
"<!--",
|
|
3063
3060
|
"VITE PLUS START",
|
|
@@ -3070,7 +3067,7 @@ const problemIn$1 = (file) => (source) => {
|
|
|
3070
3067
|
return Option.some({
|
|
3071
3068
|
file,
|
|
3072
3069
|
...positionOf(source)(index.value),
|
|
3073
|
-
rule: RULE$
|
|
3070
|
+
rule: RULE$9,
|
|
3074
3071
|
message: MESSAGE$2
|
|
3075
3072
|
});
|
|
3076
3073
|
};
|
|
@@ -3089,7 +3086,7 @@ const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
|
|
|
3089
3086
|
// src/features/workflow-concurrency/model/workflow-queue.ts
|
|
3090
3087
|
const CONCURRENCY_KEY = "concurrency";
|
|
3091
3088
|
const QUEUE_KEY = "queue";
|
|
3092
|
-
const RULE$
|
|
3089
|
+
const RULE$8 = "workflow-queue";
|
|
3093
3090
|
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.";
|
|
3094
3091
|
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));
|
|
3095
3092
|
const queueOffsetsOf = (source) => {
|
|
@@ -3110,7 +3107,7 @@ const checkWorkflowQueues = Effect.fn("checkWorkflowQueues")(function* checkWork
|
|
|
3110
3107
|
file,
|
|
3111
3108
|
line,
|
|
3112
3109
|
column,
|
|
3113
|
-
rule: RULE$
|
|
3110
|
+
rule: RULE$8,
|
|
3114
3111
|
message: MESSAGE$1
|
|
3115
3112
|
};
|
|
3116
3113
|
}));
|
|
@@ -3422,7 +3419,7 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
3422
3419
|
}[reader](source);
|
|
3423
3420
|
};
|
|
3424
3421
|
// src/features/comments/model/comments.ts
|
|
3425
|
-
const RULE$
|
|
3422
|
+
const RULE$7 = "comment";
|
|
3426
3423
|
const CONFIG_FILE = "vite.config.ts";
|
|
3427
3424
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
3428
3425
|
const READ_CONCURRENCY$2 = 64;
|
|
@@ -3492,14 +3489,14 @@ const isAllowed = (source, directives) => (comment) => isShebang(comment) || dir
|
|
|
3492
3489
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
3493
3490
|
file,
|
|
3494
3491
|
...positionOf(source)(index),
|
|
3495
|
-
rule: RULE$
|
|
3492
|
+
rule: RULE$7,
|
|
3496
3493
|
message: MESSAGE
|
|
3497
3494
|
});
|
|
3498
3495
|
const unreadableProblem = (file, message) => ({
|
|
3499
3496
|
file,
|
|
3500
3497
|
line: FIRST_LINE$1,
|
|
3501
3498
|
column: FIRST_COLUMN$1,
|
|
3502
|
-
rule: RULE$
|
|
3499
|
+
rule: RULE$7,
|
|
3503
3500
|
message: `msch could not read the comments in this file: ${message}`
|
|
3504
3501
|
});
|
|
3505
3502
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -3564,14 +3561,14 @@ const START$5 = 0;
|
|
|
3564
3561
|
const HEX = 16;
|
|
3565
3562
|
const CODE_POINT_WIDTH = 4;
|
|
3566
3563
|
const READ_CONCURRENCY$1 = 64;
|
|
3567
|
-
const RULE$
|
|
3564
|
+
const RULE$6 = "hidden-unicode";
|
|
3568
3565
|
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"));
|
|
3569
3566
|
const problemOf$1 = (file, source) => (found) => {
|
|
3570
3567
|
const hex = hexOf(found[START$5]);
|
|
3571
3568
|
return {
|
|
3572
3569
|
file,
|
|
3573
3570
|
...positionOf(source)(found.index ?? START$5),
|
|
3574
|
-
rule: RULE$
|
|
3571
|
+
rule: RULE$6,
|
|
3575
3572
|
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}.`
|
|
3576
3573
|
};
|
|
3577
3574
|
};
|
|
@@ -3593,7 +3590,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
3593
3590
|
return Array.flatten(found);
|
|
3594
3591
|
});
|
|
3595
3592
|
// src/features/runtime-version/model/node-version.ts
|
|
3596
|
-
const RULE$
|
|
3593
|
+
const RULE$5 = "node-version";
|
|
3597
3594
|
const MINIMUM = 26;
|
|
3598
3595
|
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
3599
3596
|
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
@@ -3624,19 +3621,19 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
|
3624
3621
|
onSome: isOld
|
|
3625
3622
|
}));
|
|
3626
3623
|
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
|
|
3627
|
-
const problemAt = ({ entry, source, index }, message) => ({
|
|
3624
|
+
const problemAt$1 = ({ entry, source, index }, message) => ({
|
|
3628
3625
|
file: entry.file,
|
|
3629
3626
|
...positionOf(source)(index),
|
|
3630
|
-
rule: RULE$
|
|
3627
|
+
rule: RULE$5,
|
|
3631
3628
|
message
|
|
3632
3629
|
});
|
|
3633
3630
|
const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$4));
|
|
3634
|
-
const unstatedProblem = (entry, source) => problemAt({
|
|
3631
|
+
const unstatedProblem = (entry, source) => problemAt$1({
|
|
3635
3632
|
entry,
|
|
3636
3633
|
source,
|
|
3637
3634
|
index: START$4
|
|
3638
3635
|
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
3639
|
-
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
3636
|
+
const rangeProblem = (entry, source) => (range) => problemAt$1({
|
|
3640
3637
|
entry,
|
|
3641
3638
|
source,
|
|
3642
3639
|
index: offsetOf$1(source, ENGINES_KEY)
|
|
@@ -3650,12 +3647,12 @@ const manifestProblems = (entry, source) => {
|
|
|
3650
3647
|
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
3651
3648
|
return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
|
|
3652
3649
|
};
|
|
3653
|
-
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({
|
|
3650
|
+
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$1({
|
|
3654
3651
|
entry,
|
|
3655
3652
|
source,
|
|
3656
3653
|
index: found.index ?? START$4
|
|
3657
3654
|
}, `${SUPPORTED} \`${String$1.trim(found[START$4])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
3658
|
-
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
3655
|
+
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$1({
|
|
3659
3656
|
entry,
|
|
3660
3657
|
source,
|
|
3661
3658
|
index: START$4
|
|
@@ -3680,7 +3677,7 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
|
|
|
3680
3677
|
return yield* scanText(sources, problemsIn$2);
|
|
3681
3678
|
});
|
|
3682
3679
|
// src/features/skills/model/skill-entry.ts
|
|
3683
|
-
const RULE$
|
|
3680
|
+
const RULE$4 = "unlocked-skill";
|
|
3684
3681
|
const LOCK_FILE = "skills-lock.json";
|
|
3685
3682
|
const SOURCE = "masseater/skills";
|
|
3686
3683
|
const ENTRY = "masseater-ecosystem";
|
|
@@ -3694,7 +3691,7 @@ const fixFor = (name) => `Run "vp exec skills add ${SOURCE} -s ${name} -y". The
|
|
|
3694
3691
|
const problemIn = ({ file, source }) => (anchor, message) => ({
|
|
3695
3692
|
file,
|
|
3696
3693
|
...positionOf(source)(pipe(String$1.indexOf(anchor)(source), Option.getOrElse(() => START$3))),
|
|
3697
|
-
rule: RULE$
|
|
3694
|
+
rule: RULE$4,
|
|
3698
3695
|
message
|
|
3699
3696
|
});
|
|
3700
3697
|
const lockedSkills = Effect.fn("lockedSkills")(function* lockedSkills(root) {
|
|
@@ -3719,7 +3716,7 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
3719
3716
|
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)}`)));
|
|
3720
3717
|
});
|
|
3721
3718
|
// src/features/skills/model/skill-files.ts
|
|
3722
|
-
const RULE$
|
|
3719
|
+
const RULE$3 = "skill-file";
|
|
3723
3720
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
3724
3721
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
3725
3722
|
const MARKDOWN = ".md";
|
|
@@ -3735,7 +3732,7 @@ const FRAGMENT = /#.*$/u;
|
|
|
3735
3732
|
const GITHUB = "https://github.com/";
|
|
3736
3733
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
3737
3734
|
const BLANK = /\s+/u;
|
|
3738
|
-
const SEPARATOR$
|
|
3735
|
+
const SEPARATOR$2 = "/";
|
|
3739
3736
|
const START$2 = 0;
|
|
3740
3737
|
const FIRST$1 = 1;
|
|
3741
3738
|
const READ_CONCURRENCY = 16;
|
|
@@ -3776,7 +3773,7 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
3776
3773
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
3777
3774
|
file: skill.file,
|
|
3778
3775
|
...positionOf(skill.source)(index),
|
|
3779
|
-
rule: RULE$
|
|
3776
|
+
rule: RULE$3,
|
|
3780
3777
|
message
|
|
3781
3778
|
})));
|
|
3782
3779
|
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) => ({
|
|
@@ -3803,7 +3800,7 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
3803
3800
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
3804
3801
|
file,
|
|
3805
3802
|
...positionOf(source)(index),
|
|
3806
|
-
rule: RULE$
|
|
3803
|
+
rule: RULE$3,
|
|
3807
3804
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
3808
3805
|
})));
|
|
3809
3806
|
});
|
|
@@ -3811,7 +3808,7 @@ const problemsIn$1 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
3811
3808
|
const files = yield* RepositoryFiles;
|
|
3812
3809
|
const file = files.join(root, name);
|
|
3813
3810
|
const directory = files.dirname(name);
|
|
3814
|
-
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$
|
|
3811
|
+
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
3815
3812
|
const text = yield* files.readFile(file);
|
|
3816
3813
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
3817
3814
|
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY });
|
|
@@ -3819,7 +3816,7 @@ const problemsIn$1 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
3819
3816
|
file: files.join(root, entry),
|
|
3820
3817
|
line: FIRST$1,
|
|
3821
3818
|
column: FIRST$1,
|
|
3822
|
-
rule: RULE$
|
|
3819
|
+
rule: RULE$3,
|
|
3823
3820
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
3824
3821
|
})));
|
|
3825
3822
|
return [
|
|
@@ -3840,8 +3837,8 @@ const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(r
|
|
|
3840
3837
|
return Array.flatten(found);
|
|
3841
3838
|
});
|
|
3842
3839
|
// src/features/unneeded-files/model/alchemy-patch.ts
|
|
3843
|
-
const RULE$
|
|
3844
|
-
const WORKSPACE_FILE$
|
|
3840
|
+
const RULE$2 = "alchemy-patch";
|
|
3841
|
+
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
3845
3842
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
3846
3843
|
const START$1 = 0;
|
|
3847
3844
|
const WorkspaceFile$1 = Schema.Struct({ patchedDependencies: Schema.optionalKey(Schema.Record(Schema.String, Schema.Unknown)) });
|
|
@@ -3850,7 +3847,7 @@ const patchedIn = (source) => pipe(decodeWorkspaceFile$1(parse$1(source)), Optio
|
|
|
3850
3847
|
const problemOf = (file, position, name) => ({
|
|
3851
3848
|
file,
|
|
3852
3849
|
...position,
|
|
3853
|
-
rule: RULE$
|
|
3850
|
+
rule: RULE$2,
|
|
3854
3851
|
message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
|
|
3855
3852
|
});
|
|
3856
3853
|
const problemsIn = (file) => (source) => {
|
|
@@ -3861,10 +3858,112 @@ const problemsIn = (file) => (source) => {
|
|
|
3861
3858
|
/** @internal */
|
|
3862
3859
|
const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyPatch(root) {
|
|
3863
3860
|
const files = yield* RepositoryFiles;
|
|
3864
|
-
const file = files.join(root, WORKSPACE_FILE$
|
|
3861
|
+
const file = files.join(root, WORKSPACE_FILE$2);
|
|
3865
3862
|
const text = yield* files.readFile(file);
|
|
3866
3863
|
return pipe(text, Option.map(problemsIn(file)), Option.getOrElse(() => []));
|
|
3867
3864
|
});
|
|
3865
|
+
// src/features/unneeded-files/model/applied-packages.ts
|
|
3866
|
+
const MSCH = "@r_masseater/msch";
|
|
3867
|
+
const SCOPE = "@r_masseater/";
|
|
3868
|
+
const RULE$1 = "applied-package";
|
|
3869
|
+
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
3870
|
+
const NOT_FOUND = -1;
|
|
3871
|
+
const SEPARATOR$1 = "/";
|
|
3872
|
+
const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
|
|
3873
|
+
const BinMap = Schema.Record(Schema.String, Schema.String);
|
|
3874
|
+
const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
|
|
3875
|
+
const decodeBinField = Schema.decodeUnknownOption(Schema.fromJsonString(BinField));
|
|
3876
|
+
const escaped = (text) => String$1.replaceAll(/[.*+?^${}()|[\]\\]/gu, String.raw`\$&`)(text);
|
|
3877
|
+
const declaredNames = (manifest) => pipe([
|
|
3878
|
+
manifest.dependencies,
|
|
3879
|
+
manifest.devDependencies,
|
|
3880
|
+
manifest.peerDependencies
|
|
3881
|
+
], Array.flatMap((field) => Record.keys(field ?? {})));
|
|
3882
|
+
const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
|
|
3883
|
+
onNone: () => [],
|
|
3884
|
+
onSome: (bin) => {
|
|
3885
|
+
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
|
|
3886
|
+
return Record.keys(bin);
|
|
3887
|
+
}
|
|
3888
|
+
}));
|
|
3889
|
+
const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE}`)));
|
|
3890
|
+
const installedPackage = Effect.fn("installedPackage")(function* installedPackage(name) {
|
|
3891
|
+
const files = yield* RepositoryFiles;
|
|
3892
|
+
const text = yield* pipe(manifestOf(name), Option.match({
|
|
3893
|
+
onNone: () => Effect.succeed(Option.none()),
|
|
3894
|
+
onSome: (file) => files.readFile(file)
|
|
3895
|
+
}));
|
|
3896
|
+
return {
|
|
3897
|
+
name,
|
|
3898
|
+
bins: pipe(text, Option.map((source) => binsIn(name, source)), Option.getOrElse(() => []))
|
|
3899
|
+
};
|
|
3900
|
+
});
|
|
3901
|
+
const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
3902
|
+
const files = yield* RepositoryFiles;
|
|
3903
|
+
const manifest = yield* pipe(manifestOf(MSCH), Option.match({
|
|
3904
|
+
onNone: () => Effect.succeed(Option.none()),
|
|
3905
|
+
onSome: (file) => readManifest(files.dirname(file))
|
|
3906
|
+
}));
|
|
3907
|
+
const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE)));
|
|
3908
|
+
return yield* pipe(names, Effect.forEach(installedPackage));
|
|
3909
|
+
});
|
|
3910
|
+
const problemAt = (file, source) => (index, name) => ({
|
|
3911
|
+
file,
|
|
3912
|
+
...positionOf(source)(index),
|
|
3913
|
+
rule: RULE$1,
|
|
3914
|
+
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
3915
|
+
});
|
|
3916
|
+
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
3917
|
+
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
3918
|
+
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt(file, source)(found.index ?? NOT_FOUND, entry.name)))));
|
|
3919
|
+
const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
|
|
3920
|
+
onEmpty: () => "",
|
|
3921
|
+
onNonEmpty: Array.max(BY_LENGTH)
|
|
3922
|
+
}));
|
|
3923
|
+
const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$1;
|
|
3924
|
+
const consumersIn = Effect.fn("consumersIn")(function* consumersIn(root, directories) {
|
|
3925
|
+
const files = yield* RepositoryFiles;
|
|
3926
|
+
return yield* pipe(directories, Effect.filter((directory) => readManifest(files.join(root, directory)).pipe(Effect.map(Option.exists((manifest) => manifest.name !== MSCH && Array.contains(declaredNames(manifest), MSCH))))));
|
|
3927
|
+
});
|
|
3928
|
+
const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appliedNames, directory) {
|
|
3929
|
+
const files = yield* RepositoryFiles;
|
|
3930
|
+
const file = files.join(root, directory, MANIFEST_FILE);
|
|
3931
|
+
const text = yield* files.readFile(file);
|
|
3932
|
+
const manifest = yield* readManifest(files.join(root, directory));
|
|
3933
|
+
return pipe(Option.all({
|
|
3934
|
+
source: text,
|
|
3935
|
+
declared: manifest
|
|
3936
|
+
}), Option.match({
|
|
3937
|
+
onNone: () => [],
|
|
3938
|
+
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt(file, source)(index, name)), Option.toArray)))
|
|
3939
|
+
}));
|
|
3940
|
+
});
|
|
3941
|
+
const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
|
|
3942
|
+
const owner = ownerOf(directories);
|
|
3943
|
+
const listed = yield* listedFiles(root);
|
|
3944
|
+
const sources = pipe(listed, Array.filter((entry) => isScannedSource(entry) && Array.contains(consumers, owner(entry.name))));
|
|
3945
|
+
return yield* scanText(sources, usesIn(applied));
|
|
3946
|
+
});
|
|
3947
|
+
/** @internal */
|
|
3948
|
+
const appliedPackageProblems = Effect.fn("appliedPackageProblems")(function* appliedPackageProblems(root, applied) {
|
|
3949
|
+
if (!Array.isReadonlyArrayNonEmpty(applied)) return [];
|
|
3950
|
+
const directories = ["", ...yield* workspaceDirectories(root)];
|
|
3951
|
+
const consumers = yield* consumersIn(root, directories);
|
|
3952
|
+
const appliedNames = pipe(applied, Array.map(({ name }) => name));
|
|
3953
|
+
const manifestProblems = yield* pipe(consumers, Effect.forEach((directory) => manifestUses(root, appliedNames, directory)));
|
|
3954
|
+
const sourceProblems = yield* sourceUses({
|
|
3955
|
+
root,
|
|
3956
|
+
applied,
|
|
3957
|
+
directories,
|
|
3958
|
+
consumers
|
|
3959
|
+
});
|
|
3960
|
+
return [...Array.flatten(manifestProblems), ...sourceProblems];
|
|
3961
|
+
});
|
|
3962
|
+
/** @internal */
|
|
3963
|
+
const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAppliedPackages(root) {
|
|
3964
|
+
const applied = yield* appliedByMsch();
|
|
3965
|
+
return yield* appliedPackageProblems(root, applied);
|
|
3966
|
+
});
|
|
3868
3967
|
// src/features/unneeded-files/model/replaced-tools.ts
|
|
3869
3968
|
const RULE = "replaced-tool";
|
|
3870
3969
|
const FIRST = 1;
|
|
@@ -4090,7 +4189,8 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
4090
4189
|
checkNodeVersion(root),
|
|
4091
4190
|
checkSkillFiles(root),
|
|
4092
4191
|
checkSkillEntry(root),
|
|
4093
|
-
checkComments(root)
|
|
4192
|
+
checkComments(root),
|
|
4193
|
+
checkAppliedPackages(root)
|
|
4094
4194
|
], { concurrency: "unbounded" });
|
|
4095
4195
|
return Array.flatten(found);
|
|
4096
4196
|
});
|
|
@@ -4131,25 +4231,46 @@ const runCli = (program) => {
|
|
|
4131
4231
|
};
|
|
4132
4232
|
// bin/msch.ts
|
|
4133
4233
|
const NO_PROBLEMS = 0;
|
|
4134
|
-
const
|
|
4234
|
+
const ONE_FAILURE = 1;
|
|
4235
|
+
const NO_CONFIG = "config-missing";
|
|
4236
|
+
const writeProblems = (root, problems) => Effect.gen(function* report() {
|
|
4135
4237
|
const files = yield* RepositoryFiles;
|
|
4136
4238
|
const format = formatProblem((file) => files.relative(root, file));
|
|
4137
4239
|
yield* writeStdout(pipe(problems, Array.map((problem) => `${format(problem)}\n`), Array.join("")));
|
|
4138
|
-
|
|
4139
|
-
|
|
4240
|
+
});
|
|
4241
|
+
const writeStderr = Effect.fn("writeStderr")(function* writeStderr(text) {
|
|
4242
|
+
const stdio = yield* Stdio.Stdio;
|
|
4243
|
+
yield* Stream.make(text).pipe(Stream.run(stdio.stderr()), Effect.orDie);
|
|
4244
|
+
});
|
|
4245
|
+
const failuresOf = (args, kind, message) => {
|
|
4246
|
+
if (Array.isReadonlyArrayEmpty(args) && kind === NO_CONFIG) return Effect.succeed(NO_PROBLEMS);
|
|
4247
|
+
return writeStderr(`${message}\n`).pipe(Effect.as(ONE_FAILURE));
|
|
4248
|
+
};
|
|
4249
|
+
const toolChecks = (root, args) => runVpa(root, args).pipe(Effect.as(NO_PROBLEMS), Effect.catchIf(Schema.is(VpToolsError), (failure) => failuresOf(args, failure.kind, failure.message)));
|
|
4250
|
+
const failWhenAny = (count) => {
|
|
4251
|
+
if (count > NO_PROBLEMS) return Effect.fail(ProblemsFound.make({ count }));
|
|
4252
|
+
return Effect.void;
|
|
4253
|
+
};
|
|
4254
|
+
const writeJson = Effect.fn("writeJson")(function* writeJson(root) {
|
|
4255
|
+
const found = yield* checkAll(root);
|
|
4256
|
+
const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(sortProblems(found));
|
|
4257
|
+
return yield* writeStdout(text);
|
|
4258
|
+
});
|
|
4259
|
+
const checkEverything = Effect.fn("checkEverything")(function* checkEverything(root) {
|
|
4260
|
+
const found = yield* checkAll(root);
|
|
4261
|
+
const problems = sortProblems(found);
|
|
4262
|
+
yield* writeProblems(root, problems);
|
|
4263
|
+
const toolFailures = yield* toolChecks(root, []);
|
|
4264
|
+
return yield* failWhenAny(problems.length + toolFailures);
|
|
4140
4265
|
});
|
|
4141
4266
|
runCli(Effect.gen(function* msch() {
|
|
4142
4267
|
const stdio = yield* Stdio.Stdio;
|
|
4143
4268
|
const files = yield* RepositoryFiles;
|
|
4144
4269
|
const args = yield* stdio.args;
|
|
4145
4270
|
const root = files.resolve(".");
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
const text = yield* Schema.encodeEffect(Schema.fromJsonString(ProblemList))(problems);
|
|
4150
|
-
return yield* writeStdout(text);
|
|
4151
|
-
}
|
|
4152
|
-
return yield* reportText(root, problems);
|
|
4271
|
+
if (args.includes("--json")) return yield* writeJson(root);
|
|
4272
|
+
if (Array.isReadonlyArrayNonEmpty(args)) return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));
|
|
4273
|
+
return yield* checkEverything(root);
|
|
4153
4274
|
}));
|
|
4154
4275
|
export {};
|
|
4155
4276
|
|