@r_masseater/msch 0.14.0 → 0.16.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,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { $ as isTypeLiteralNode, A as isArrayLiteralExpression, B as isModuleBlock, C as IndexKind, D as getLeadingCommentRanges, E as getJSDocTags, F as isEnumDeclaration, G as isPropertyAccessExpression, H as isNewExpression, I as isExportDeclaration, J as isSignatureDeclaration, K as isPropertyAssignment, L as isIdentifier, M as isCallExpression, N as isClassDeclaration, O as getNameOfDeclaration, P as isElementAccessExpression, Q as isTypeAliasDeclaration, R as isImportDeclaration, S as API, T as SyntaxKind, U as isNumericLiteral, V as isModuleDeclaration, W as isObjectLiteralExpression, X as isSpreadElement, Y as isSourceFile, Z as isStringLiteral, _ as propertyNamesOf, a as sortProblems, b as symbolAt, c as columnOf, d as descendantsOf, et as isTypeReferenceNode, f as importedModulesOf, g as lineOf, h as isTypeDeclaration, i as problemAt, it as isVariableStatement, j as isBinaryExpression, k as getTextOfJSDocComment, l as contains, m as isGenericDeclaration, nt as isVariableDeclaration, o as NODE_MODULES_SEGMENT, p as isExternalDeclaration, q as isSatisfiesExpression, r as formatProblem, rt as isVariableDeclarationList, s as childrenOf$2, t as ProblemList, tt as isUnionTypeNode, u as declarationsOf, v as referencedSymbols, w as InternalSymbolName, x as uniqueByReference, y as resolvedSymbol, z as isInterfaceDeclaration } from "./problem-PUlrIOu9.mjs";
2
+ import { $ as isReturnStatement, A as getTextOfJSDocComment, B as isFunctionDeclaration, C as IndexKind, D as getJSDocTags, E as SyntaxKind, F as isCallExpression, G as isModuleBlock, H as isIdentifier, I as isClassDeclaration, J as isNumericLiteral, K as isModuleDeclaration, L as isElementAccessExpression, M as isArrowFunction, N as isBinaryExpression, O as getLeadingCommentRanges, P as isBlock, Q as isPropertyAssignment, R as isEnumDeclaration, S as API, T as SignatureKind, U as isImportDeclaration, V as isFunctionExpression, W as isInterfaceDeclaration, X as isParenthesizedExpression, Y as isObjectLiteralExpression, Z as isPropertyAccessExpression, _ as propertyNamesOf, a as sortProblems, at as isTypeAliasDeclaration, b as symbolAt, c as columnOf, ct as isUnionTypeNode, d as descendantsOf, dt as isVariableStatement, et as isSatisfiesExpression, f as importedModulesOf, g as lineOf, h as isTypeDeclaration, i as problemAt, it as isStringLiteral, j as isArrayLiteralExpression, k as getNameOfDeclaration, l as contains, lt as isVariableDeclaration, m as isGenericDeclaration, nt as isSourceFile, o as NODE_MODULES_SEGMENT, ot as isTypeLiteralNode, p as isExternalDeclaration, q as isNewExpression, r as formatProblem, rt as isSpreadElement, s as childrenOf$2, st as isTypeReferenceNode, t as ProblemList, tt as isSignatureDeclaration, u as declarationsOf, ut as isVariableDeclarationList, v as referencedSymbols, w as InternalSymbolName, x as uniqueByReference, y as resolvedSymbol, z as isExportDeclaration } from "./problem-xi8VIKs3.mjs";
3
3
  import { i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-BiKs7S7N.mjs";
4
- import { C as publishedWorkspaces, D as readManifest, E as dependencyEntries, O as workspaceDependencies, T as MANIFEST_FILE, _ as childrenOf$3, a as hasVerifyTask, b as nestedValues, g as KeySchema, h as workspaceConfigOf, i as definesTask, l as workspaceDirectories, r as VERIFY_TASK, t as namedWorkspaces, v as keyName, w as publicEntriesOf, y as literalOf } from "./workspace-De9R-Kix.mjs";
5
- import { t as COMMENT_DIRECTIVES } from "./comment-directives-TN0dNEbg.mjs";
4
+ import { C as publishedWorkspaces, D as readManifest, E as dependencyEntries, O as workspaceDependencies, T as MANIFEST_FILE, _ as childrenOf$3, a as hasVerifyTask, b as nestedValues, g as KeySchema, h as workspaceConfigOf, i as definesTask, l as workspaceDirectories, r as VERIFY_TASK, t as namedWorkspaces, v as keyName, w as publicEntriesOf, y as literalOf } from "./workspace-aMPb8EA_.mjs";
5
+ 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";
8
8
  import { parse, resolveConfigFromFile } from "vite-plus";
@@ -222,13 +222,13 @@ const annotateResources = (api) => Effect.gen(function* annotateCompiler() {
222
222
  });
223
223
  // src/entities/project/model/project.ts
224
224
  const CONFIG_PATHSPEC = `:(glob)**/tsconfig.json`;
225
- const HIDDEN_PREFIX = ".";
225
+ const HIDDEN_PREFIX$1 = ".";
226
226
  const SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([
227
227
  NODE_MODULES,
228
228
  "dist",
229
229
  "coverage"
230
230
  ]);
231
- const isVisible = (file) => pipe(String$1.split(file, "/"), Array.every((segment) => !String$1.startsWith(HIDDEN_PREFIX)(segment) && !SKIPPED_DIRECTORIES.has(segment)));
231
+ const isVisible = (file) => pipe(String$1.split(file, "/"), Array.every((segment) => !String$1.startsWith(HIDDEN_PREFIX$1)(segment) && !SKIPPED_DIRECTORIES.has(segment)));
232
232
  const listConfigFiles = (root) => Effect.gen(function* configFilesUnder() {
233
233
  const files = yield* RepositoryFiles;
234
234
  const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);
@@ -317,6 +317,8 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
317
317
  });
318
318
  // src/entities/project/model/inputs.ts
319
319
  const SEPARATOR$6 = "/";
320
+ const SCOPE_PREFIX$2 = "@";
321
+ const HIDDEN_PREFIX = ".";
320
322
  const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
321
323
  const nearestManifestDirectory = Effect.fn("nearestManifestDirectory")(function* nearestManifestDirectory(start) {
322
324
  const files = yield* RepositoryFiles;
@@ -349,24 +351,50 @@ const workspaceClosure = Effect.fn("workspaceClosure")(function* workspaceClosur
349
351
  }
350
352
  return [...seen];
351
353
  });
352
- const isUnder = (prefixes) => (file) => !String$1.includes(SEPARATOR$6)(file) || pipe(prefixes, Array.some((prefix) => String$1.startsWith(prefix)(file)));
353
- const prefixesOf = Effect.fn("prefixesOf")(function* prefixesOf(root, configPath) {
354
+ const isUnder = (prefixes) => (file) => pipe(prefixes, Array.some((prefix) => String$1.startsWith(prefix)(file)));
355
+ const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath) {
354
356
  const files = yield* RepositoryFiles;
355
357
  const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));
356
358
  const directories = yield* workspaceClosure(directory);
357
- return pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$6}`));
359
+ return {
360
+ directories,
361
+ prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$6}`))
362
+ };
363
+ });
364
+ const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
365
+ const files = yield* RepositoryFiles;
366
+ if (!String$1.startsWith(SCOPE_PREFIX$2)(name)) return [name];
367
+ const scoped = yield* files.readDirectory(files.join(modules, name));
368
+ return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$6}${entry}`));
369
+ });
370
+ const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
371
+ const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
372
+ const nested = yield* pipe(listed, Array.filter((name) => !String$1.startsWith(HIDDEN_PREFIX)(name)), Effect.forEach(scopedNames(modules)));
373
+ return Array.flatten(nested);
374
+ });
375
+ const installedPackages = Effect.fn("installedPackages")(function* installedPackages(root, directory) {
376
+ const files = yield* RepositoryFiles;
377
+ const modules = files.join(directory, NODE_MODULES);
378
+ const names = yield* installedNames$1(modules);
379
+ return yield* pipe(names, Effect.forEach((name) => files.realPath(files.join(modules, name)).pipe(Effect.map((found) => files.relative(root, found)))));
380
+ });
381
+ const dependencyVersions = Effect.fn("dependencyVersions")(function* dependencyVersions(root, directories) {
382
+ const installed = yield* pipe(Array.dedupe([root, ...directories]), Effect.forEach((directory) => installedPackages(root, directory)));
383
+ return Array.sort(Array.dedupe(Array.flatten(installed)), Order.String);
358
384
  });
359
385
  const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath) => Effect.gen(function* collectInputs() {
360
386
  const files = yield* RepositoryFiles;
361
387
  const parsed = parseConfig(compiler.api)(configPath);
362
388
  if (Option.isNone(parsed)) return Option.none();
363
- const prefixes = yield* prefixesOf(root, configPath);
389
+ const closure = yield* closureOf$1(root, configPath);
390
+ const dependencies = yield* dependencyVersions(root, closure.directories);
364
391
  const options = yield* encodeOptions(parsed.value.options).pipe(Effect.orElseSucceed(() => ""));
365
392
  const sources = pipe(parsed.value.fileNames, Array.map((fileName) => files.relative(root, fileName)));
366
- const shared = pipe(listed, Array.filter(isUnder(prefixes)));
393
+ const shared = pipe(listed, Array.filter(isUnder(closure.prefixes)));
367
394
  return Option.some({
368
395
  options,
369
- files: Array.sort(Array.dedupe([...sources, ...shared]), Order.String)
396
+ files: Array.sort(Array.dedupe([...sources, ...shared]), Order.String),
397
+ dependencies
370
398
  });
371
399
  });
372
400
  // src/shared/lib/text-position.ts
@@ -975,12 +1003,115 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
975
1003
  if (Option.isNone(manifest) || !Array.isReadonlyArrayNonEmpty(keys)) return [];
976
1004
  return yield* problemsFor(root, manifest.value, keys);
977
1005
  });
1006
+ // src/features/pass-through-wrappers/model/pass-through-wrappers.ts
1007
+ const RULE$14 = "pass-through-wrapper";
1008
+ const SINGLE_STATEMENT = 1;
1009
+ const SINGLE_DECLARATION = 1;
1010
+ const THIS_PARAMETER = "this";
1011
+ const NO_ARGUMENTS = [];
1012
+ const messageOf = (callee) => `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;
1013
+ const unwrapped = (expression) => {
1014
+ if (isParenthesizedExpression(expression)) return unwrapped(expression.expression);
1015
+ return expression;
1016
+ };
1017
+ const isWrapperExpression = (expression) => isArrowFunction(expression) || isFunctionExpression(expression);
1018
+ const candidateOf = (node) => {
1019
+ if (isFunctionDeclaration(node)) return pipe(Option.fromUndefinedOr(node.name), Option.map((name) => ({
1020
+ name,
1021
+ wrapper: node
1022
+ })));
1023
+ if (!isVariableDeclaration(node) || !isIdentifier(node.name)) return Option.none();
1024
+ const { name } = node;
1025
+ return pipe(Option.fromUndefinedOr(node.initializer), Option.map(unwrapped), Option.filter(isWrapperExpression), Option.map((wrapper) => ({
1026
+ name,
1027
+ wrapper
1028
+ })));
1029
+ };
1030
+ const changesTheCall = (wrapper) => Predicate.isNotUndefined(wrapper.asteriskToken) || Option.exists(Option.fromUndefinedOr(wrapper.type), (type) => type.kind === SyntaxKind.TypePredicate) || pipe(wrapper.modifiers ?? [], Array.some((modifier) => modifier.kind === SyntaxKind.AsyncKeyword));
1031
+ const returnedExpression = (wrapper) => {
1032
+ const { body } = wrapper;
1033
+ if (Predicate.isUndefined(body)) return Option.none();
1034
+ if (!isBlock(body)) return Option.some(body);
1035
+ if (body.statements.length !== SINGLE_STATEMENT) return Option.none();
1036
+ return pipe(Array.head(body.statements), Option.filter((statement) => isReturnStatement(statement)), Option.flatMap((statement) => Option.fromUndefinedOr(statement.expression)));
1037
+ };
1038
+ const callForward = (call) => ({
1039
+ node: call,
1040
+ callee: call.expression,
1041
+ kind: SignatureKind.Call,
1042
+ arguments: call.arguments,
1043
+ typed: Predicate.isNotUndefined(call.typeArguments),
1044
+ optional: Predicate.isNotUndefined(call.questionDotToken)
1045
+ });
1046
+ const forwardOf = (expression) => {
1047
+ const inner = unwrapped(expression);
1048
+ if (isCallExpression(inner)) return Option.some(callForward(inner));
1049
+ if (isNewExpression(inner)) return Option.some({
1050
+ node: inner,
1051
+ callee: inner.expression,
1052
+ kind: SignatureKind.Construct,
1053
+ arguments: inner.arguments ?? NO_ARGUMENTS,
1054
+ typed: Predicate.isNotUndefined(inner.typeArguments),
1055
+ optional: false
1056
+ });
1057
+ return Option.none();
1058
+ };
1059
+ const rootOf = (callee) => {
1060
+ if (isIdentifier(callee)) return Option.some(callee);
1061
+ if (isPropertyAccessExpression(callee) && Predicate.isUndefined(callee.questionDotToken) && isIdentifier(callee.name)) return rootOf(callee.expression);
1062
+ return Option.none();
1063
+ };
1064
+ const parameterName = (parameter) => {
1065
+ const { name } = parameter;
1066
+ if (!isIdentifier(name) || Predicate.isNotUndefined(parameter.initializer) || name.text === THIS_PARAMETER) return Option.none();
1067
+ return Option.some(name.text);
1068
+ };
1069
+ const isRest = (parameter) => Predicate.isNotUndefined(parameter.dotDotDotToken);
1070
+ const forwardsParameter = ([parameter, name, argument]) => {
1071
+ if (!isRest(parameter)) return isIdentifier(argument) && argument.text === name;
1072
+ return isSpreadElement(argument) && isIdentifier(argument.expression) && argument.expression.text === name;
1073
+ };
1074
+ const forwardedNames = (wrapper, forward) => {
1075
+ const { parameters } = wrapper;
1076
+ const names = pipe(parameters, Array.map(parameterName), Array.getSomes);
1077
+ if (names.length !== parameters.length || forward.arguments.length !== parameters.length) return Option.none();
1078
+ const triples = Array.zipWith(Array.zip(parameters, names), forward.arguments, ([parameter, name], argument) => [
1079
+ parameter,
1080
+ name,
1081
+ argument
1082
+ ]);
1083
+ return pipe(Option.some(names), Option.filter(() => pipe(triples, Array.every(forwardsParameter))));
1084
+ };
1085
+ const calleeTakesExactly = (checker) => (forward, count) => {
1086
+ const signatures = checker.getSignaturesOfType(checker.getTypeAtLocation(forward.callee), forward.kind);
1087
+ return Array.isReadonlyArrayNonEmpty(signatures) && pipe(signatures, Array.every((signature) => !signature.hasRestParameter && signature.parameters.length === count && !Array.isReadonlyArrayNonEmpty(signature.typeParameters ?? [])));
1088
+ };
1089
+ const keepsTheReturnType = (checker) => (wrapper, forward) => Option.match(Option.fromUndefinedOr(wrapper.type), {
1090
+ onNone: () => true,
1091
+ onSome: (type) => checker.getTypeAtLocation(type).id === checker.getTypeAtLocation(forward.node).id
1092
+ });
1093
+ const isOverloaded = (checker) => (name) => Option.exists(Option.fromUndefinedOr(checker.getSymbolAtLocation(name)), (symbol) => symbol.declarations.length > SINGLE_DECLARATION);
1094
+ const callsAnotherFunction = ({ name }, forward, names) => Option.exists(rootOf(forward.callee), (root) => root.text !== name.text && !names.includes(root.text));
1095
+ const isPassThrough = (checker) => (candidate) => (forward) => {
1096
+ const { wrapper, name } = candidate;
1097
+ if (forward.typed || forward.optional) return false;
1098
+ const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
1099
+ return Option.exists(forwardedNames(wrapper, forward), (names) => callsAnotherFunction(candidate, forward, names)) && (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) && keepsTheReturnType(checker)(wrapper, forward) && !isOverloaded(checker)(name);
1100
+ };
1101
+ const problemOf$3 = (checker) => (candidate) => {
1102
+ if (changesTheCall(candidate.wrapper)) return Option.none();
1103
+ return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt({
1104
+ rule: RULE$14,
1105
+ message: messageOf(forward.callee.getText())
1106
+ })(candidate.name)));
1107
+ };
1108
+ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$3(checker)), Array.getSomes);
978
1109
  // src/features/placement/model/agent-docs-length.ts
979
1110
  const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
980
1111
  const RECOMMENDED_LINES = 200;
981
1112
  const READ_CONCURRENCY$12 = 16;
982
1113
  const FIRST$7 = 1;
983
- const RULE$12 = "agent-docs-length";
1114
+ const RULE$13 = "agent-docs-length";
984
1115
  const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
985
1116
  const problemFor$4 = (file) => (lines) => {
986
1117
  if (lines <= RECOMMENDED_LINES) return Option.none();
@@ -988,7 +1119,7 @@ const problemFor$4 = (file) => (lines) => {
988
1119
  file,
989
1120
  line: 201,
990
1121
  column: FIRST$7,
991
- rule: RULE$12,
1122
+ rule: RULE$13,
992
1123
  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.`
993
1124
  });
994
1125
  };
@@ -1004,7 +1135,7 @@ const checkAgentDocsLength = Effect.fn("checkAgentDocsLength")(function* checkAg
1004
1135
  return Array.getSomes(found);
1005
1136
  });
1006
1137
  // src/features/placement/model/colocated-tests.ts
1007
- const RULE$11 = "colocated-test";
1138
+ const RULE$12 = "colocated-test";
1008
1139
  const FIRST$6 = 1;
1009
1140
  const READ_CONCURRENCY$11 = 64;
1010
1141
  const ROOT_SUBPATH = ".";
@@ -1030,7 +1161,7 @@ const problemFor$3 = (test, message) => ({
1030
1161
  file: test.file,
1031
1162
  line: FIRST$6,
1032
1163
  column: FIRST$6,
1033
- rule: RULE$11,
1164
+ rule: RULE$12,
1034
1165
  message: `${test.base} ${message}`
1035
1166
  });
1036
1167
  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);
@@ -1096,7 +1227,7 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
1096
1227
  return Array.getSomes(found);
1097
1228
  });
1098
1229
  // src/features/placement/model/nested-docs.ts
1099
- const RULE$10 = "nested-docs";
1230
+ const RULE$11 = "nested-docs";
1100
1231
  const CONFIG_FILE$4 = "vite.config.ts";
1101
1232
  const SEPARATOR$4 = "/";
1102
1233
  const FIRST$5 = 1;
@@ -1112,7 +1243,7 @@ const problemFor$2 = (file, message) => ({
1112
1243
  file,
1113
1244
  line: FIRST$5,
1114
1245
  column: FIRST$5,
1115
- rule: RULE$10,
1246
+ rule: RULE$11,
1116
1247
  message
1117
1248
  });
1118
1249
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
@@ -1162,10 +1293,12 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
1162
1293
  return Array.getSomes(found);
1163
1294
  });
1164
1295
  // src/features/placement/model/root-readme.ts
1165
- const RULE$9 = "root-readme";
1296
+ const RULE$10 = "root-readme";
1166
1297
  const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
1167
1298
  const READ_CONCURRENCY$9 = 16;
1168
1299
  const START$5 = 0;
1300
+ const CHECK_POLICY = "@r_masseater/msch";
1301
+ const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
1169
1302
  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.`;
1170
1303
  const problemsIn$4 = (file, source) => ({ directory, pattern }) => {
1171
1304
  const message = messageFor(directory);
@@ -1173,7 +1306,7 @@ const problemsIn$4 = (file, source) => ({ directory, pattern }) => {
1173
1306
  return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
1174
1307
  file,
1175
1308
  ...at(found.index ?? START$5),
1176
- rule: RULE$9,
1309
+ rule: RULE$10,
1177
1310
  message
1178
1311
  })));
1179
1312
  };
@@ -1189,7 +1322,8 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
1189
1322
  const files = yield* RepositoryFiles;
1190
1323
  const names = yield* files.listedFiles(root);
1191
1324
  const readmes = pipe(names, Array.filter((name) => ROOT_DOC.test(name)));
1192
- const workspaces = yield* namedWorkspaces(root);
1325
+ const named = yield* namedWorkspaces(root);
1326
+ const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
1193
1327
  const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces), { concurrency: READ_CONCURRENCY$9 });
1194
1328
  return Array.flatten(found);
1195
1329
  });
@@ -1205,7 +1339,7 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
1205
1339
  return Array.flatten(found);
1206
1340
  });
1207
1341
  // src/features/repository-layout/model/crates.ts
1208
- const RULE$8 = "unverified-crate";
1342
+ const RULE$9 = "unverified-crate";
1209
1343
  const CARGO_FILE = "Cargo.toml";
1210
1344
  const CONFIG_FILE$3 = "vite.config.ts";
1211
1345
  const SEPARATOR$3 = "/";
@@ -1243,7 +1377,7 @@ const problemFor$1 = (crate, message) => ({
1243
1377
  file: crate.manifest,
1244
1378
  line: FIRST$4,
1245
1379
  column: FIRST$4,
1246
- rule: RULE$8,
1380
+ rule: RULE$9,
1247
1381
  message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
1248
1382
  });
1249
1383
  const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
@@ -1263,7 +1397,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
1263
1397
  return Array.getSomes(found);
1264
1398
  });
1265
1399
  // src/features/repository-layout/model/hidden-verify.ts
1266
- const RULE$7 = "hidden-verify";
1400
+ const RULE$8 = "hidden-verify";
1267
1401
  const CONFIG_FILE$2 = "vite.config.ts";
1268
1402
  const FIRST$3 = 1;
1269
1403
  const READ_CONCURRENCY$7 = 8;
@@ -1277,7 +1411,7 @@ const problemIn = Effect.fn("problemIn")(function* problemIn(root, directory) {
1277
1411
  file,
1278
1412
  line: FIRST$3,
1279
1413
  column: FIRST$3,
1280
- rule: RULE$7,
1414
+ rule: RULE$8,
1281
1415
  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}.`
1282
1416
  }).pipe(Option.filter(() => verified));
1283
1417
  });
@@ -1288,7 +1422,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
1288
1422
  return Array.getSomes(found);
1289
1423
  });
1290
1424
  // src/features/repository-layout/model/root-workspace-paths.ts
1291
- const RULE$6 = "root-workspace-path";
1425
+ const RULE$7 = "root-workspace-path";
1292
1426
  const CONFIG_FILE$1 = "vite.config.ts";
1293
1427
  const PATH_CHARACTER = /[\w.@/-]/u;
1294
1428
  const NAME_CHARACTER = /[\w.@-]/u;
@@ -1327,7 +1461,7 @@ const mentions = (directory) => (text) => {
1327
1461
  const problemsIn$3 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
1328
1462
  file,
1329
1463
  ...positionOf(source)(found.start),
1330
- rule: RULE$6,
1464
+ rule: RULE$7,
1331
1465
  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.`
1332
1466
  })));
1333
1467
  /** @internal */
@@ -1341,7 +1475,7 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
1341
1475
  return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$3(file, source.value, directories)));
1342
1476
  });
1343
1477
  // src/features/repository-layout/model/shared-uncached-tasks.ts
1344
- const RULE$5 = "shared-uncached-task";
1478
+ const RULE$6 = "shared-uncached-task";
1345
1479
  const TASKS_PATH = ["run", "tasks"];
1346
1480
  const READ_CONCURRENCY$6 = 8;
1347
1481
  const SHARED = 2;
@@ -1398,7 +1532,7 @@ const problemsOf = (definitions) => {
1398
1532
  return pipe(definitions, Array.map(({ file, position, name, command }) => ({
1399
1533
  file,
1400
1534
  ...position,
1401
- rule: RULE$5,
1535
+ rule: RULE$6,
1402
1536
  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.`
1403
1537
  })));
1404
1538
  };
@@ -1544,7 +1678,7 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
1544
1678
  /** @internal */
1545
1679
  const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
1546
1680
  // src/features/repository-layout/model/workflow-paths.ts
1547
- const RULE$4 = "workflow-path";
1681
+ const RULE$5 = "workflow-path";
1548
1682
  const WORKFLOW_DIRECTORY = ".github/workflows/";
1549
1683
  const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
1550
1684
  const READ_CONCURRENCY$5 = 8;
@@ -1610,7 +1744,7 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
1610
1744
  const problemOf$2 = (file, source) => (found) => ({
1611
1745
  file,
1612
1746
  ...positionOf(source)(found.offset),
1613
- rule: RULE$4,
1747
+ rule: RULE$5,
1614
1748
  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.`
1615
1749
  });
1616
1750
  const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
@@ -1647,8 +1781,8 @@ const EXTENSION = /\.[^./]+$/u;
1647
1781
  const SETTINGS_FILE = ".claude/settings.json";
1648
1782
  const READ_CONCURRENCY$4 = 64;
1649
1783
  const FIRST = 1;
1650
- const RULE$3 = "shell-script";
1651
- const MESSAGE$2 = "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.";
1784
+ const RULE$4 = "shell-script";
1785
+ const MESSAGE$3 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
1652
1786
  const HookSchema = Schema.Struct({
1653
1787
  command: Schema.optional(Schema.String),
1654
1788
  args: Schema.optional(Schema.Array(Schema.String))
@@ -1666,13 +1800,12 @@ const sessionStartCommands = (source) => {
1666
1800
  };
1667
1801
  const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.getOrElse(() => name));
1668
1802
  const hasExtension = (name) => EXTENSION.test(baseName(name));
1669
- const startsWithShellShebang = (source) => SHELL_SHEBANG.test(source);
1670
1803
  const problemFor = (file) => ({
1671
1804
  file,
1672
1805
  line: FIRST,
1673
1806
  column: FIRST,
1674
- rule: RULE$3,
1675
- message: MESSAGE$2
1807
+ rule: RULE$4,
1808
+ message: MESSAGE$3
1676
1809
  });
1677
1810
  /** @internal */
1678
1811
  const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
@@ -1685,23 +1818,36 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
1685
1818
  const file = files.join(root, name);
1686
1819
  if (SHELL_FILE.test(name)) return files.exists(file);
1687
1820
  if (hasExtension(name)) return Effect.succeed(false);
1688
- return files.readFile(file).pipe(Effect.map(Option.exists(startsWithShellShebang)));
1821
+ return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
1689
1822
  };
1690
1823
  const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
1691
1824
  const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$4 });
1692
1825
  return pipe(shell, Array.map((name) => problemFor(files.join(root, name))));
1693
1826
  });
1694
- // src/features/scripts/model/workflows.ts
1827
+ // src/shared/lib/workflow-files.ts
1695
1828
  const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
1829
+ const READ_CONCURRENCY$3 = 16;
1830
+ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
1831
+ const files = yield* RepositoryFiles;
1832
+ const names = yield* files.listedFiles(root);
1833
+ const found = yield* Effect.forEach(pipe(names, Array.filter((name) => WORKFLOW_FILE.test(name))), (name) => {
1834
+ const file = files.join(root, name);
1835
+ return files.readFile(file).pipe(Effect.map(Option.map((source) => ({
1836
+ file,
1837
+ source
1838
+ }))));
1839
+ }, { concurrency: READ_CONCURRENCY$3 });
1840
+ return Array.getSomes(found);
1841
+ });
1842
+ // src/features/scripts/model/workflows.ts
1696
1843
  const COMMAND_CHAIN = /&&|\|\||;|\|/u;
1697
1844
  const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
1698
1845
  const COMMENT = "#";
1699
1846
  const RUN_KEY = "run";
1700
- const RULE$2 = "workflow-script";
1701
- const READ_CONCURRENCY$3 = 16;
1847
+ const RULE$3 = "workflow-script";
1702
1848
  const START$4 = 0;
1703
1849
  const ONE_COMMAND = 1;
1704
- const MESSAGE$1 = "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.";
1850
+ const MESSAGE$2 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
1705
1851
  const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$4));
1706
1852
  const runScriptsOf = (source) => {
1707
1853
  const found = [];
@@ -1724,20 +1870,14 @@ const problemsIn$1 = (file) => (source) => {
1724
1870
  return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
1725
1871
  file,
1726
1872
  ...at(start),
1727
- rule: RULE$2,
1728
- message: MESSAGE$1
1873
+ rule: RULE$3,
1874
+ message: MESSAGE$2
1729
1875
  })));
1730
1876
  };
1731
1877
  /** @internal */
1732
1878
  const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
1733
- const files = yield* RepositoryFiles;
1734
- const names = yield* files.listedFiles(root);
1735
- const workflows = pipe(names, Array.filter((name) => WORKFLOW_FILE.test(name)));
1736
- const found = yield* Effect.forEach(workflows, (name) => {
1737
- const file = files.join(root, name);
1738
- return files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$1(file)), Option.getOrElse(() => []))));
1739
- }, { concurrency: READ_CONCURRENCY$3 });
1740
- return Array.flatten(found);
1879
+ const workflows = yield* readWorkflows(root);
1880
+ return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$1(file)(source)));
1741
1881
  });
1742
1882
  // src/features/scripts/model/script-checks.ts
1743
1883
  /** @internal */
@@ -2135,7 +2275,7 @@ const ownerDeclarationsIn = (project, owners) => {
2135
2275
  const isInside = (outers) => (node) => pipe(outers, Array.some((outer) => contains(outer)(node)));
2136
2276
  const sitesOutside = (checker) => (project, outers) => pipe(project.sourceFiles, Array.flatMap((sourceFile) => sitesUnder(checker)(sourceFile)), Array.filter((site) => !isInside(outers)(site.node)));
2137
2277
  const nodesOf = (sites) => pipe(sites, Array.map((site) => site.node));
2138
- const analyzeProject = (owners) => (project) => {
2278
+ const analyzeProject = ({ owners, sourceChecks }) => (project) => {
2139
2279
  const { checker } = project;
2140
2280
  const ownerDeclarations = ownerDeclarationsIn(project, owners);
2141
2281
  const sites = sitesOutside(checker)(project, ownerDeclarations);
@@ -2158,7 +2298,11 @@ const analyzeProject = (owners) => (project) => {
2158
2298
  shapes: project.library.shapes
2159
2299
  };
2160
2300
  return {
2161
- problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [...ownedLiteralProblems(context)(sourceFile, excluded), ...shapeProblemsIn(shapeContext)(sourceFile)]))],
2301
+ problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [
2302
+ ...ownedLiteralProblems(context)(sourceFile, excluded),
2303
+ ...shapeProblemsIn(shapeContext)(sourceFile),
2304
+ ...pipe(sourceChecks, Array.flatMap((check) => check(checker)(sourceFile)))
2305
+ ]))],
2162
2306
  unowned: pipe(verdicts, Array.flatMap((found) => found.unowned))
2163
2307
  };
2164
2308
  };
@@ -2244,7 +2388,11 @@ const keyOf = (cache) => (configPath, inputs) => Effect.gen(function* deriveKey(
2244
2388
  files.relative(cache.root, configPath),
2245
2389
  inputs.options
2246
2390
  ];
2247
- return yield* cache.hash(Array.join([...header, ...entries], LINE_SEPARATOR));
2391
+ return yield* cache.hash(Array.join([
2392
+ ...header,
2393
+ ...inputs.dependencies,
2394
+ ...entries
2395
+ ], LINE_SEPARATOR));
2248
2396
  });
2249
2397
  const entryFile = (cache, key) => `${cache.directory}/${key}${CACHE_SUFFIX}`;
2250
2398
  const readAnalysis = (cache) => (key) => Effect.gen(function* readCached() {
@@ -2310,8 +2458,11 @@ const scopeOf = (project, configPath) => ({
2310
2458
  name: Option.getOrElse(project.packageName, () => configPath),
2311
2459
  dependencies: project.workspaceDependencies
2312
2460
  });
2313
- const freshAnalysis = ({ workspace, owners }) => (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => {
2314
- const analysis = analyzeProject(owners)(project);
2461
+ const freshAnalysis = ({ workspace, owners, sourceChecks }) => (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => {
2462
+ const analysis = analyzeProject({
2463
+ owners,
2464
+ sourceChecks
2465
+ })(project);
2315
2466
  const scope = scopeOf(project, configPath);
2316
2467
  return {
2317
2468
  problems: analysis.problems,
@@ -2344,13 +2495,14 @@ const cacheFor = Effect.fn("cacheFor")(function* cacheFor(root, owners) {
2344
2495
  const encoded = yield* encodeOwners(plain).pipe(Effect.orElseSucceed(() => ""));
2345
2496
  return yield* analysisCache(root, encoded);
2346
2497
  });
2347
- const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(workspace, owners, configPaths) {
2498
+ const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(workspace, { owners, sourceChecks }, configPaths) {
2348
2499
  const files = yield* RepositoryFiles;
2349
2500
  const cache = yield* cacheFor(workspace.root, owners);
2350
2501
  const listed = yield* files.listedFiles(workspace.root);
2351
2502
  const keyed = yield* pipe(configPaths, Effect.forEach(analyzeConfig({
2352
2503
  workspace,
2353
2504
  owners,
2505
+ sourceChecks,
2354
2506
  cache,
2355
2507
  listed
2356
2508
  })));
@@ -2358,7 +2510,7 @@ const analyzeProjects = Effect.fn("analyzeProjects")(function* analyzeProjects(w
2358
2510
  yield* pruneAnalyses(cache)(pipe(found, Array.map(([key]) => key)));
2359
2511
  return pipe(found, Array.map(([, analysis]) => analysis));
2360
2512
  });
2361
- const checkRepository = Effect.fn("checkRepository")(function* checkRepository(root) {
2513
+ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(root, sourceChecks = []) {
2362
2514
  const files = yield* RepositoryFiles;
2363
2515
  const workspace = {
2364
2516
  compiler: yield* typeScriptCompiler,
@@ -2367,7 +2519,10 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
2367
2519
  };
2368
2520
  const configPaths = yield* listConfigFiles(root);
2369
2521
  const ownerScan = yield* scanOwners(workspace, configPaths);
2370
- const analyses = yield* analyzeProjects(workspace, ownerScan.owners, configPaths);
2522
+ const analyses = yield* analyzeProjects(workspace, {
2523
+ owners: ownerScan.owners,
2524
+ sourceChecks
2525
+ }, configPaths);
2371
2526
  const relative = (file) => files.relative(root, file);
2372
2527
  const unowned = pipe(analyses, Array.flatMap((analysis) => analysis.unowned));
2373
2528
  return sortProblems([
@@ -2376,6 +2531,36 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
2376
2531
  ...duplicateProblems(relative)(unowned)
2377
2532
  ]);
2378
2533
  }, Effect.scoped);
2534
+ // src/features/workflow-concurrency/model/workflow-queue.ts
2535
+ const CONCURRENCY_KEY = "concurrency";
2536
+ const QUEUE_KEY = "queue";
2537
+ const RULE$2 = "workflow-queue";
2538
+ const MESSAGE$1 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
2539
+ const queueKeyOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMap((map) => Array.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === QUEUE_KEY)), Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)), Option.flatMap((key) => Option.fromNullishOr(key.range)), Option.map(([start]) => start));
2540
+ const queueOffsetsOf = (source) => {
2541
+ const found = [];
2542
+ visit(parseDocument(source), { Pair: (_key, pair) => {
2543
+ if (isPair(pair) && isScalar(pair.key) && pair.key.value === CONCURRENCY_KEY) found.push(...Option.toArray(queueKeyOf(pair.value)));
2544
+ } });
2545
+ return found;
2546
+ };
2547
+ /** @internal */
2548
+ const checkWorkflowQueues = Effect.fn("checkWorkflowQueues")(function* checkWorkflowQueues(root) {
2549
+ const workflows = yield* readWorkflows(root);
2550
+ return pipe(workflows, Array.flatMap(({ file, source }) => {
2551
+ const at = positionOf(source);
2552
+ return pipe(queueOffsetsOf(source), Array.map((offset) => {
2553
+ const { line, column } = at(offset);
2554
+ return {
2555
+ file,
2556
+ line,
2557
+ column,
2558
+ rule: RULE$2,
2559
+ message: MESSAGE$1
2560
+ };
2561
+ }));
2562
+ }));
2563
+ });
2379
2564
  // src/features/comments/model/found-comment.ts
2380
2565
  const taggedError$2 = Schema.TaggedError;
2381
2566
  var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
@@ -2951,13 +3136,14 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
2951
3136
  /** @internal */
2952
3137
  const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
2953
3138
  const found = yield* Effect.all([
2954
- checkRepository(root),
3139
+ checkRepository(root, [passThroughWrappersIn]),
2955
3140
  checkOverrides(root),
2956
3141
  checkTrackedText(root),
2957
3142
  checkPlacement(root),
2958
3143
  checkScripts(root),
2959
3144
  checkPublishedPackages(root),
2960
- checkWorkspaces(root)
3145
+ checkWorkspaces(root),
3146
+ checkWorkflowQueues(root)
2961
3147
  ], { concurrency: "unbounded" });
2962
3148
  return Array.flatten(found);
2963
3149
  });