@r_masseater/msch 0.54.0 → 0.57.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 +18 -18
- package/dist/app-B22Gq0no.mjs +2120 -0
- package/dist/app-B22Gq0no.mjs.map +1 -0
- package/dist/cargo-inputs.d.mts +1 -1
- package/dist/cargo-inputs.mjs +4 -9
- package/dist/cargo-inputs.mjs.map +1 -1
- package/dist/changed.mjs +90 -19
- package/dist/changed.mjs.map +1 -1
- package/dist/{check-upstream-exits-DYxWDyHC.mjs → check-upstream-exits-DsBS7bui.mjs} +2 -2
- package/dist/check-upstream-exits-DsBS7bui.mjs.map +1 -0
- package/dist/cli.mjs +469 -385
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +3 -2
- package/dist/config.mjs.map +1 -1
- package/dist/credential-broker-D8sFyowJ.mjs +105 -0
- package/dist/credential-broker-D8sFyowJ.mjs.map +1 -0
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-CWEkZVIC.mjs → define-lint-preset-DeLIlDuA.mjs} +7 -634
- package/dist/define-lint-preset-DeLIlDuA.mjs.map +1 -0
- package/dist/{dependencies-DCJv7YcW.mjs → dependencies-CbvZost8.mjs} +11 -7
- package/dist/dependencies-CbvZost8.mjs.map +1 -0
- package/dist/exits.mjs +4 -5
- package/dist/exits.mjs.map +1 -1
- package/dist/{index-BeH2yfX6.d.mts → index-Cwnhs7VE.d.mts} +4 -51
- package/dist/library.d.mts +18 -0
- package/dist/library.mjs +28 -0
- package/dist/library.mjs.map +1 -0
- package/dist/lint-rules.mjs +243 -40
- package/dist/lint-rules.mjs.map +1 -1
- package/dist/lint.d.mts +2 -2
- package/dist/lint.mjs +1 -1
- package/dist/locked-inputs-DMSoGCa-.mjs +20 -0
- package/dist/locked-inputs-DMSoGCa-.mjs.map +1 -0
- package/dist/locked-inputs.d.mts +2 -3
- package/dist/locked-inputs.mjs +1 -20
- package/dist/oxlint.mjs +29 -14
- package/dist/oxlint.mjs.map +1 -1
- package/dist/{package-LeBO9czg.mjs → package-DZbqpZfs.mjs} +6 -6
- package/dist/package-DZbqpZfs.mjs.map +1 -0
- package/dist/{problem-CzOlOb5f.mjs → problem-Q4Zyi4PR.mjs} +10 -6
- package/dist/problem-Q4Zyi4PR.mjs.map +1 -0
- package/dist/{project-C4uzq7_4.mjs → project-CIY_lNiT.mjs} +36 -14
- package/dist/project-CIY_lNiT.mjs.map +1 -0
- package/dist/publish.mjs +625 -338
- package/dist/publish.mjs.map +1 -1
- package/dist/runtime-LT40e_l3.mjs +28 -0
- package/dist/runtime-LT40e_l3.mjs.map +1 -0
- package/dist/{syntax-3AJkpCcs.mjs → syntax-BNRNY74H.mjs} +13 -4
- package/dist/syntax-BNRNY74H.mjs.map +1 -0
- package/dist/wake.d.mts +1 -0
- package/dist/wake.mjs +25 -0
- package/dist/wake.mjs.map +1 -0
- package/dist/workspace-settings.mjs +5 -5
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +29 -22
- package/skills/{publishing → msch-publishing}/SKILL.md +8 -2
- package/skills/{repository-config → msch-repository-config}/SKILL.md +5 -2
- package/skills/{workspace-settings → msch-workspace-settings}/SKILL.md +4 -3
- package/dist/check-upstream-exits-DYxWDyHC.mjs.map +0 -1
- package/dist/define-lint-preset-CWEkZVIC.mjs.map +0 -1
- package/dist/dependencies-DCJv7YcW.mjs.map +0 -1
- package/dist/locked-inputs.mjs.map +0 -1
- package/dist/package-LeBO9czg.mjs.map +0 -1
- package/dist/problem-CzOlOb5f.mjs.map +0 -1
- package/dist/project-C4uzq7_4.mjs.map +0 -1
- package/dist/runtime-DFsdNYI0.mjs +0 -29
- package/dist/runtime-DFsdNYI0.mjs.map +0 -1
- package/dist/syntax-3AJkpCcs.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as propertyValue, C as RUN_TASKS, E as hasVerifyTask, F as KeySchema, I as childrenOf$1, L as keyName, P as workspaceConfigOf, R as literalOf, T as definesTask, V as stringsIn, _ as publishedProjects, a as cratesIn, b as workspaceManifest, c as workspaceLinks, d as deployEntries, f as namedWorkspaces, h as shadcnUiOf, l as lockedGraph, o as owningWorkspace, p as patternOf$1, r as readManifest, t as MANIFEST_FILE$3, u as lockedPackages, v as workspaceDirectories, w as VERIFY_TASK, x as runTasksOf, y as workspaceProjects, z as nestedValues } from "./dependencies-
|
|
3
|
-
import { C as valueKey, S as schemaTypeOf, _ as formatValues, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as recordsIn, l as mentions$1, m as isObjectType, n as contentKey, o as projectInputs, p as describeLibraryType, r as keepOnly, t as implementationFingerprint, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./project-
|
|
2
|
+
import { B as propertyValue, C as RUN_TASKS, E as hasVerifyTask, F as KeySchema, I as childrenOf$1, L as keyName, P as workspaceConfigOf, R as literalOf, T as definesTask, V as stringsIn, _ as publishedProjects, a as cratesIn, b as workspaceManifest, c as workspaceLinks, d as deployEntries, f as namedWorkspaces, h as shadcnUiOf, l as lockedGraph, o as owningWorkspace, p as patternOf$1, r as readManifest, t as MANIFEST_FILE$3, u as lockedPackages, v as workspaceDirectories, w as VERIFY_TASK, x as runTasksOf, y as workspaceProjects, z as nestedValues } from "./dependencies-CbvZost8.mjs";
|
|
3
|
+
import { C as valueKey, S as schemaTypeOf, _ as formatValues, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as recordsIn, l as mentions$1, m as isObjectType, n as contentKey, o as projectInputs, p as describeLibraryType, r as keepOnly, t as implementationFingerprint, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./project-CIY_lNiT.mjs";
|
|
4
4
|
import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
|
|
5
|
-
import { a as isRecord, c as isScannedText, d as presentFiles, f as scanText, i as collectNodes, l as isToolVersions, n as checkUpstreamExits, o as tomlSourceComments, p as positionOf, s as yamlSourceComments, t as checkScatteredDeviations, u as listedFiles } from "./check-upstream-exits-
|
|
6
|
-
import {
|
|
7
|
-
import { a as
|
|
5
|
+
import { a as isRecord, c as isScannedText, d as presentFiles, f as scanText, i as collectNodes, l as isToolVersions, n as checkUpstreamExits, o as tomlSourceComments, p as positionOf, s as yamlSourceComments, t as checkScatteredDeviations, u as listedFiles } from "./check-upstream-exits-DsBS7bui.mjs";
|
|
6
|
+
import { n as baseName, r as isInside, t as matcher } from "./app-B22Gq0no.mjs";
|
|
7
|
+
import { a as publicEntriesOf, i as EntryManifestJson, o as targetsIn, r as publishedWorkspaces } from "./package-DZbqpZfs.mjs";
|
|
8
|
+
import { a as problemAtPosition, i as problemAt$7, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-Q4Zyi4PR.mjs";
|
|
8
9
|
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-CXgB6xpE.mjs";
|
|
9
10
|
import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
|
|
10
|
-
import { $ as
|
|
11
|
-
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-
|
|
11
|
+
import { $ as isReturnStatement, A as getTextOfJSDocComment, B as isFunctionDeclaration, 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, P as isBlock, Q as isPropertyAssignment, R as isEnumDeclaration, T as SymbolFlags, U as isImportDeclaration, V as isFunctionExpression, W as isInterfaceDeclaration, X as isParenthesizedExpression, Y as isObjectLiteralExpression, Z as isPropertyAccessExpression, _ as referencedSymbols, a as declarationsOf, at as isTypeAliasDeclaration, b as uniqueByReference, c as importedModulesOf, ct as isUnionTypeNode, d as isInsideAny, dt as isVariableStatement, et as isSatisfiesExpression, f as isOutsideDeclaration, g as propertyNamesOf, h as packageOf$1, i as contains, it as isStringLiteral, j as isArrayLiteralExpression, k as getNameOfDeclaration, l as isExternalDeclaration, lt as isVariableDeclaration, m as lineOf$3, n as childrenOf$2, nt as isSourceFile, o as declaresAType, ot as isTypeLiteralNode, p as isTypeDeclaration, q as isNewExpression, r as columnOf, rt as isSpreadElement, s as descendantsOf, st as isTypeReferenceNode, t as carriesTag, tt as isSignatureDeclaration, u as isGenericDeclaration, ut as isVariableDeclarationList, w as SignatureKind, y as symbolAt, z as isExportDeclaration } from "./syntax-BNRNY74H.mjs";
|
|
12
|
+
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-LT40e_l3.mjs";
|
|
12
13
|
import "./cli-contract-D7btWrEu.mjs";
|
|
13
14
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
14
|
-
import { Array, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
15
|
+
import { Array, Config, Context, Effect, FileSystem, HashMap, HashSet, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
15
16
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
16
17
|
import { ChildProcess } from "effect/process";
|
|
17
18
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -20,10 +21,11 @@ import { fileURLToPath } from "node:url";
|
|
|
20
21
|
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
21
22
|
import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
|
|
22
23
|
import semver from "semver";
|
|
24
|
+
import { stripVTControlCharacters } from "node:util";
|
|
25
|
+
import { rolldown } from "vite/rolldown";
|
|
23
26
|
import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
|
|
24
27
|
import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
|
|
25
28
|
import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4";
|
|
26
|
-
import path from "node:path";
|
|
27
29
|
import { isComment, isTag, isText } from "domhandler";
|
|
28
30
|
import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
|
|
29
31
|
import { DockerfileParser } from "dockerfile-ast";
|
|
@@ -224,7 +226,7 @@ const RESOLUTION_FILES = [
|
|
|
224
226
|
".npmrc",
|
|
225
227
|
"patches/*"
|
|
226
228
|
];
|
|
227
|
-
const RESOLUTION_CONCURRENCY =
|
|
229
|
+
const RESOLUTION_CONCURRENCY = 2;
|
|
228
230
|
const SUCCEEDED$1 = 0;
|
|
229
231
|
const taggedError$7 = Schema.TaggedError;
|
|
230
232
|
var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
|
|
@@ -348,38 +350,53 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
348
350
|
// src/features/check-overrides/model/git-subpath.ts
|
|
349
351
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
350
352
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
351
|
-
const RULE$
|
|
352
|
-
const WHOLE_MATCH$
|
|
353
|
-
const problemAt$
|
|
353
|
+
const RULE$59 = "git-subpath-dependency";
|
|
354
|
+
const WHOLE_MATCH$4 = 0;
|
|
355
|
+
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
354
356
|
file,
|
|
355
|
-
...positionOf(source)(found.index ?? WHOLE_MATCH$
|
|
356
|
-
rule: RULE$
|
|
357
|
-
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$
|
|
357
|
+
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
358
|
+
rule: RULE$59,
|
|
359
|
+
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
358
360
|
});
|
|
359
|
-
const problemsIn$
|
|
361
|
+
const problemsIn$20 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$6(entry, source)));
|
|
360
362
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
361
363
|
/** @internal */
|
|
362
364
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
363
365
|
const listed = yield* listedFiles(root);
|
|
364
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
366
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$20);
|
|
365
367
|
});
|
|
366
368
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
367
|
-
const RULE$
|
|
368
|
-
const WHOLE_MATCH$
|
|
369
|
+
const RULE$58 = "unnamed-restriction";
|
|
370
|
+
const WHOLE_MATCH$3 = 0;
|
|
369
371
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
370
|
-
const problemsIn$
|
|
372
|
+
const problemsIn$19 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
371
373
|
file: entry.file,
|
|
372
|
-
...positionOf(source)(found.index ?? WHOLE_MATCH$
|
|
373
|
-
rule: RULE$
|
|
374
|
-
message: `${found[WHOLE_MATCH$
|
|
374
|
+
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
375
|
+
rule: RULE$58,
|
|
376
|
+
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
375
377
|
})));
|
|
376
378
|
/** @internal */
|
|
377
379
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
380
|
+
const listed = yield* listedFiles(root);
|
|
381
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$19);
|
|
382
|
+
});
|
|
383
|
+
// src/features/check-overrides/model/type-exemptions.ts
|
|
384
|
+
const RULE$57 = "named-type-exemption";
|
|
385
|
+
const WHOLE_MATCH$2 = 0;
|
|
386
|
+
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
387
|
+
const problemsIn$18 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array.map((found) => ({
|
|
388
|
+
file: entry.file,
|
|
389
|
+
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
390
|
+
rule: RULE$57,
|
|
391
|
+
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
392
|
+
})));
|
|
393
|
+
/** @internal */
|
|
394
|
+
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
378
395
|
const listed = yield* listedFiles(root);
|
|
379
396
|
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$18);
|
|
380
397
|
});
|
|
381
398
|
// src/features/check-overrides/model/package-registry.ts
|
|
382
|
-
const RULE$
|
|
399
|
+
const RULE$56 = "package-registry";
|
|
383
400
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
384
401
|
const TRAILING_SLASH = /\/$/u;
|
|
385
402
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
@@ -396,7 +413,7 @@ const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ in
|
|
|
396
413
|
const workspaceProblem = (file, source, registry) => ({
|
|
397
414
|
file,
|
|
398
415
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
399
|
-
rule: RULE$
|
|
416
|
+
rule: RULE$56,
|
|
400
417
|
message: Option.match(registry, {
|
|
401
418
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
402
419
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -405,7 +422,7 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
405
422
|
const npmrcProblems = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array.filter((found) => !Option.exists(groupOf$2("value")(found), isGuarded)), Array.map((found) => ({
|
|
406
423
|
file: entry.file,
|
|
407
424
|
...positionOf(source)(found.index ?? START$21),
|
|
408
|
-
rule: RULE$
|
|
425
|
+
rule: RULE$56,
|
|
409
426
|
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$21])}\`. Remove the line.`
|
|
410
427
|
})));
|
|
411
428
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
@@ -425,36 +442,34 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
425
442
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
426
443
|
});
|
|
427
444
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
428
|
-
const RULE$
|
|
445
|
+
const RULE$55 = "colocated-git-patterns";
|
|
429
446
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
430
447
|
const ROOT$3 = ".";
|
|
431
|
-
const SEPARATOR$22 = "/";
|
|
432
448
|
const NEGATION$1 = "!";
|
|
433
449
|
const COMMENT$1 = "#";
|
|
434
450
|
const ANY_DEPTH = "**";
|
|
435
|
-
const FLOATING_PREFIX = `${ANY_DEPTH}
|
|
451
|
+
const FLOATING_PREFIX = `${ANY_DEPTH}/`;
|
|
436
452
|
const LEADING_SLASHES = /^\/+/u;
|
|
437
453
|
const TRAILING_SLASHES = /\/+$/u;
|
|
438
454
|
const SPACES = /\s+/u;
|
|
439
455
|
const FIRST$21 = 1;
|
|
440
456
|
const READ_CONCURRENCY$31 = 16;
|
|
441
|
-
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$3 || String$1.startsWith(`${directory}${SEPARATOR$22}`)(inner));
|
|
442
457
|
const withoutPrefix = (prefix, text) => {
|
|
443
458
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
444
459
|
return text;
|
|
445
460
|
};
|
|
446
461
|
const isAnchored = (pattern) => {
|
|
447
462
|
const body = withoutPrefix(NEGATION$1, pattern);
|
|
448
|
-
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(
|
|
463
|
+
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes("/"));
|
|
449
464
|
};
|
|
450
465
|
const segmentsOf = ({ directory, pattern }) => {
|
|
451
466
|
const body = withoutPrefix(NEGATION$1, pattern);
|
|
452
467
|
const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
|
|
453
|
-
const own = String$1.split(
|
|
468
|
+
const own = String$1.split("/")(trimmed);
|
|
454
469
|
if (directory === ROOT$3) return own;
|
|
455
|
-
return [...String$1.split(
|
|
470
|
+
return [...String$1.split("/")(directory), ...own];
|
|
456
471
|
};
|
|
457
|
-
const depthOf = (directory) => String$1.split(
|
|
472
|
+
const depthOf = (directory) => String$1.split("/")(directory).length;
|
|
458
473
|
const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
459
474
|
const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
|
|
460
475
|
if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT$1)(pattern)) return Option.none();
|
|
@@ -474,13 +489,10 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
474
489
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
475
490
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array.map(toEntry), Array.getSomes);
|
|
476
491
|
});
|
|
477
|
-
const
|
|
478
|
-
file: entry.file,
|
|
492
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$55)(entry.file, {
|
|
479
493
|
line: entry.line,
|
|
480
|
-
column: FIRST$21
|
|
481
|
-
|
|
482
|
-
message
|
|
483
|
-
});
|
|
494
|
+
column: FIRST$21
|
|
495
|
+
}, message);
|
|
484
496
|
const misplacedMessage = (kind, workspaces) => {
|
|
485
497
|
if (workspaces.length === FIRST$21) {
|
|
486
498
|
const workspace = Array.join(workspaces, "");
|
|
@@ -492,7 +504,7 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
|
|
|
492
504
|
const files = yield* RepositoryFiles;
|
|
493
505
|
const leading = Array.take(segments, depth);
|
|
494
506
|
if (Array.contains(leading, ANY_DEPTH)) return [];
|
|
495
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading,
|
|
507
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, "/")}/${MANIFEST_FILE$3}`]);
|
|
496
508
|
return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
|
|
497
509
|
});
|
|
498
510
|
const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
|
|
@@ -508,17 +520,17 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
|
|
|
508
520
|
if (!isAnchored(entry.pattern)) return Option.none();
|
|
509
521
|
const deepest = yield* matchedWorkspaces(root, workspaces, entry);
|
|
510
522
|
if (Array.isReadonlyArrayEmpty(deepest)) return Option.none();
|
|
511
|
-
return Option.some(
|
|
523
|
+
return Option.some(patternProblem(entry, misplacedMessage(entry.kind, deepest)));
|
|
512
524
|
});
|
|
513
525
|
const isFloating = (pattern) => !String$1.startsWith(NEGATION$1)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
|
|
514
526
|
const ownLevelName = (pattern) => {
|
|
515
527
|
if (isFloating(pattern)) return Option.some(pattern);
|
|
516
|
-
const name = withoutPrefix(
|
|
528
|
+
const name = withoutPrefix("/", pattern);
|
|
517
529
|
return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));
|
|
518
530
|
};
|
|
519
531
|
const sameName = (outer, name) => {
|
|
520
532
|
if (outer === name) return true;
|
|
521
|
-
return String$1.endsWith(
|
|
533
|
+
return String$1.endsWith("/")(name) && `${outer}/` === name;
|
|
522
534
|
};
|
|
523
535
|
const coveredBy = (entry, name) => (outer) => outer.kind === entry.kind && outer.values === entry.values && isFloating(outer.pattern) && isInside(outer.directory)(entry.directory) && sameName(outer.pattern, name);
|
|
524
536
|
const outerName = ({ directory, kind }) => {
|
|
@@ -527,7 +539,7 @@ const outerName = ({ directory, kind }) => {
|
|
|
527
539
|
};
|
|
528
540
|
const repeated = (entries) => (entry) => {
|
|
529
541
|
const outer = pipe(ownLevelName(entry.pattern), Option.flatMap((name) => pipe(entries, Array.findFirst(coveredBy(entry, name)))));
|
|
530
|
-
return pipe(outer, Option.map((found) =>
|
|
542
|
+
return pipe(outer, Option.map((found) => patternProblem(entry, `repeats ${found.pattern} from ${outerName(found)}, which already applies here. Delete it.`)));
|
|
531
543
|
};
|
|
532
544
|
/** @internal */
|
|
533
545
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
@@ -540,7 +552,7 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
540
552
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
541
553
|
});
|
|
542
554
|
// src/features/check-placement/model/colocated-tests.ts
|
|
543
|
-
const RULE$
|
|
555
|
+
const RULE$54 = "colocated-test";
|
|
544
556
|
const FIRST$20 = 1;
|
|
545
557
|
const READ_CONCURRENCY$30 = 64;
|
|
546
558
|
const ROOT_SUBPATH = ".";
|
|
@@ -564,11 +576,11 @@ const Manifest$6 = Schema.Struct({
|
|
|
564
576
|
});
|
|
565
577
|
const decodeManifest$10 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$6));
|
|
566
578
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
567
|
-
const problemFor$
|
|
579
|
+
const problemFor$8 = (test, message) => ({
|
|
568
580
|
file: test.file,
|
|
569
581
|
line: FIRST$20,
|
|
570
582
|
column: FIRST$20,
|
|
571
|
-
rule: RULE$
|
|
583
|
+
rule: RULE$54,
|
|
572
584
|
message: `${test.base} ${message}`
|
|
573
585
|
});
|
|
574
586
|
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);
|
|
@@ -607,11 +619,11 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
607
619
|
return yield* refersToOwnDirectory(context, test, source.value);
|
|
608
620
|
});
|
|
609
621
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
610
|
-
const problemIn$
|
|
611
|
-
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$
|
|
622
|
+
const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
623
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$8(test, DIRECTORY_MESSAGE));
|
|
612
624
|
if (!TEST_FILE$2.test(test.name)) return Option.none();
|
|
613
625
|
if (yield* refersIn(context, test)) return Option.none();
|
|
614
|
-
return Option.some(problemFor$
|
|
626
|
+
return Option.some(problemFor$8(test, SIBLING_MESSAGE));
|
|
615
627
|
});
|
|
616
628
|
/** @internal */
|
|
617
629
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
@@ -631,7 +643,7 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
631
643
|
directory: files.dirname(file)
|
|
632
644
|
};
|
|
633
645
|
}));
|
|
634
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$
|
|
646
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$30 });
|
|
635
647
|
return Array.getSomes(found);
|
|
636
648
|
});
|
|
637
649
|
// src/shared/lib/agent-docs.ts
|
|
@@ -651,22 +663,22 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
651
663
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
652
664
|
const RECOMMENDED_LINES = 200;
|
|
653
665
|
const FIRST$19 = 1;
|
|
654
|
-
const RULE$
|
|
666
|
+
const RULE$53 = "agent-docs-length";
|
|
655
667
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
656
|
-
const problemFor$
|
|
668
|
+
const problemFor$7 = (file) => (lines) => {
|
|
657
669
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
658
670
|
return Option.some({
|
|
659
671
|
file,
|
|
660
672
|
line: 201,
|
|
661
673
|
column: FIRST$19,
|
|
662
|
-
rule: RULE$
|
|
674
|
+
rule: RULE$53,
|
|
663
675
|
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.`
|
|
664
676
|
});
|
|
665
677
|
};
|
|
666
678
|
/** @internal */
|
|
667
|
-
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$
|
|
679
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$7(file)(lineCount(source)));
|
|
668
680
|
// src/features/check-placement/model/claude-link.ts
|
|
669
|
-
const RULE$
|
|
681
|
+
const RULE$52 = "claude-md-link";
|
|
670
682
|
const CLAUDE = "CLAUDE.md";
|
|
671
683
|
const AGENTS = "AGENTS.md";
|
|
672
684
|
const FIRST$18 = 1;
|
|
@@ -685,7 +697,7 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
685
697
|
file: path,
|
|
686
698
|
line: FIRST$18,
|
|
687
699
|
column: FIRST$18,
|
|
688
|
-
rule: RULE$
|
|
700
|
+
rule: RULE$52,
|
|
689
701
|
message: MESSAGE$16
|
|
690
702
|
})));
|
|
691
703
|
});
|
|
@@ -694,11 +706,11 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
694
706
|
return Array.getSomes(found);
|
|
695
707
|
});
|
|
696
708
|
// src/features/check-placement/model/dangling-links.ts
|
|
697
|
-
const RULE$
|
|
698
|
-
const SEPARATOR$
|
|
709
|
+
const RULE$51 = "dangling-link";
|
|
710
|
+
const SEPARATOR$20 = "/";
|
|
699
711
|
const FIRST$17 = 1;
|
|
700
712
|
const READ_CONCURRENCY$27 = 16;
|
|
701
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
713
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
|
|
702
714
|
/** @internal */
|
|
703
715
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
704
716
|
const files = yield* RepositoryFiles;
|
|
@@ -710,7 +722,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
710
722
|
file,
|
|
711
723
|
line: FIRST$17,
|
|
712
724
|
column: FIRST$17,
|
|
713
|
-
rule: RULE$
|
|
725
|
+
rule: RULE$51,
|
|
714
726
|
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.`
|
|
715
727
|
})));
|
|
716
728
|
});
|
|
@@ -720,7 +732,7 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
720
732
|
// src/features/check-placement/model/member-sources.ts
|
|
721
733
|
const ROOT_WORKSPACE$1 = ".";
|
|
722
734
|
const FIRST$16 = 1;
|
|
723
|
-
const SEPARATOR$
|
|
735
|
+
const SEPARATOR$19 = "/";
|
|
724
736
|
const EXCLUDED$7 = [
|
|
725
737
|
":(exclude,attr:linguist-vendored)",
|
|
726
738
|
":(exclude,attr:linguist-generated)",
|
|
@@ -745,7 +757,7 @@ const fileProblem$1 = ({ file, rule, message }) => ({
|
|
|
745
757
|
rule,
|
|
746
758
|
message
|
|
747
759
|
});
|
|
748
|
-
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$
|
|
760
|
+
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$19}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
749
761
|
workspace,
|
|
750
762
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
751
763
|
})));
|
|
@@ -768,10 +780,10 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
768
780
|
}));
|
|
769
781
|
});
|
|
770
782
|
// src/features/check-placement/model/deployed-readme.ts
|
|
771
|
-
const RULE$
|
|
783
|
+
const RULE$50 = "deployed-readme";
|
|
772
784
|
const ROOT_DIRECTORY$2 = "";
|
|
773
785
|
const READ_CONCURRENCY$26 = 16;
|
|
774
|
-
const MISSING_MESSAGE$
|
|
786
|
+
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
775
787
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
776
788
|
const ADDRESS_KEYS = [
|
|
777
789
|
"domain",
|
|
@@ -804,18 +816,18 @@ const deploysTo = Effect.fn("deploysTo")(function* deploysTo(root, file) {
|
|
|
804
816
|
const parsed = yield* Effect.promise(() => parse(file, text.value, { lang: "ts" }));
|
|
805
817
|
return servesAddress(parsed.program);
|
|
806
818
|
});
|
|
807
|
-
const problemIn$
|
|
819
|
+
const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
808
820
|
const readme = yield* readReadme({
|
|
809
821
|
root,
|
|
810
822
|
directory,
|
|
811
|
-
rule: RULE$
|
|
812
|
-
missingMessage: MISSING_MESSAGE$
|
|
823
|
+
rule: RULE$50,
|
|
824
|
+
missingMessage: MISSING_MESSAGE$2
|
|
813
825
|
});
|
|
814
826
|
return Result.match(readme, {
|
|
815
827
|
onFailure: Option.some,
|
|
816
828
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
817
829
|
file,
|
|
818
|
-
rule: RULE$
|
|
830
|
+
rule: RULE$50,
|
|
819
831
|
message: NO_URL_MESSAGE
|
|
820
832
|
})))
|
|
821
833
|
});
|
|
@@ -828,35 +840,39 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
828
840
|
const candidates = pipe(listed, Array.filter((file) => STACK_FILE.test(file)));
|
|
829
841
|
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$26 });
|
|
830
842
|
const owners = pipe(deploying, Array.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$2))), Array.dedupe);
|
|
831
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$
|
|
843
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$26 });
|
|
832
844
|
return Array.getSomes(found);
|
|
833
845
|
});
|
|
834
846
|
// src/features/check-placement/model/nested-docs.ts
|
|
835
|
-
const RULE$
|
|
847
|
+
const RULE$49 = "nested-docs";
|
|
836
848
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
837
|
-
const SEPARATOR$
|
|
849
|
+
const SEPARATOR$18 = "/";
|
|
838
850
|
const READ_CONCURRENCY$25 = 64;
|
|
839
851
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
840
852
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
841
853
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
854
|
+
const MANIFEST$4 = "package.json";
|
|
855
|
+
const MISSING_RULE = "workspace-agents-md";
|
|
842
856
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
843
857
|
const taggedError$6 = Schema.TaggedError;
|
|
844
858
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
845
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
846
|
-
const problemFor$
|
|
859
|
+
const isNested = (name) => String$1.includes(SEPARATOR$18)(name);
|
|
860
|
+
const problemFor$6 = problemInFile(RULE$49);
|
|
847
861
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
848
862
|
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
863
|
+
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
849
864
|
const README_MESSAGE = "is allowed below the root only in a workspace, the directory that holds its package.json. Move it into the workspace it describes.";
|
|
850
865
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
851
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
866
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$6(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
852
867
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
853
|
-
return Option.some(problemFor$
|
|
868
|
+
return Option.some(problemFor$6(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
854
869
|
};
|
|
855
870
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
856
871
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
857
|
-
return Option.some(problemFor$
|
|
872
|
+
return Option.some(problemFor$6(file, `${base} ${README_MESSAGE}`));
|
|
858
873
|
};
|
|
859
|
-
const
|
|
874
|
+
const missingProblems = ({ required, directories, present, join }) => pipe(directories, Array.filter((directory) => required && !HashSet.has(present, join(directory, WORKSPACE_AGENT_DOC))), Array.map((directory) => problemInFile(MISSING_RULE)(join(directory, MANIFEST$4), MISSING_MESSAGE$1)));
|
|
875
|
+
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
860
876
|
const files = yield* RepositoryFiles;
|
|
861
877
|
const file = files.join(root, name);
|
|
862
878
|
const doc = {
|
|
@@ -888,19 +904,25 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
888
904
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
889
905
|
workspaceAgentDocs
|
|
890
906
|
};
|
|
891
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$
|
|
892
|
-
|
|
907
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$25 });
|
|
908
|
+
const missing = missingProblems({
|
|
909
|
+
required: workspaceAgentDocs,
|
|
910
|
+
directories: pipe(directories, Array.map((directory) => files.join(root, directory))),
|
|
911
|
+
present: pipe(names, Array.map((name) => files.join(root, name)), HashSet.fromIterable),
|
|
912
|
+
join: files.join
|
|
913
|
+
});
|
|
914
|
+
return [...Array.getSomes(found), ...missing];
|
|
893
915
|
});
|
|
894
916
|
// src/features/check-placement/model/published-readme.ts
|
|
895
|
-
const RULE$
|
|
917
|
+
const RULE$48 = "published-readme";
|
|
896
918
|
const READ_CONCURRENCY$24 = 16;
|
|
897
919
|
const MESSAGE$15 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
898
920
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
899
|
-
const problemIn$
|
|
921
|
+
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
900
922
|
const readme = yield* readReadme({
|
|
901
923
|
root,
|
|
902
924
|
directory,
|
|
903
|
-
rule: RULE$
|
|
925
|
+
rule: RULE$48,
|
|
904
926
|
missingMessage: MISSING_MESSAGE
|
|
905
927
|
});
|
|
906
928
|
return Result.match(readme, {
|
|
@@ -911,7 +933,7 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
911
933
|
file,
|
|
912
934
|
line,
|
|
913
935
|
column,
|
|
914
|
-
rule: RULE$
|
|
936
|
+
rule: RULE$48,
|
|
915
937
|
message: MESSAGE$15
|
|
916
938
|
};
|
|
917
939
|
}))
|
|
@@ -920,17 +942,17 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
920
942
|
/** @internal */
|
|
921
943
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
922
944
|
const projects = yield* publishedProjects(root);
|
|
923
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$
|
|
945
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$24 });
|
|
924
946
|
return Array.getSomes(found);
|
|
925
947
|
});
|
|
926
948
|
// src/features/check-placement/model/published-tests.ts
|
|
927
|
-
const RULE$
|
|
949
|
+
const RULE$47 = "published-tests";
|
|
928
950
|
const MANIFEST_FILE$2 = "package.json";
|
|
929
951
|
const FILE_START = 1;
|
|
930
952
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
931
953
|
const MESSAGE$14 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
932
954
|
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
933
|
-
const problemFor$
|
|
955
|
+
const problemFor$5 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
934
956
|
const files = yield* RepositoryFiles;
|
|
935
957
|
const absolute = files.join(root, directory);
|
|
936
958
|
const prefix = `${absolute}/`;
|
|
@@ -939,7 +961,7 @@ const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
939
961
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
940
962
|
line: FILE_START,
|
|
941
963
|
column: FILE_START,
|
|
942
|
-
rule: RULE$
|
|
964
|
+
rule: RULE$47,
|
|
943
965
|
message: MESSAGE$14
|
|
944
966
|
});
|
|
945
967
|
});
|
|
@@ -949,17 +971,17 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
949
971
|
const projects = yield* publishedProjects(root);
|
|
950
972
|
const listed = yield* files.listedFiles(root);
|
|
951
973
|
const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
|
|
952
|
-
const found = yield* Effect.forEach(projects, (project) => problemFor$
|
|
974
|
+
const found = yield* Effect.forEach(projects, (project) => problemFor$5(root, absolute, project), { concurrency: 1 });
|
|
953
975
|
return Array.getSomes(found);
|
|
954
976
|
});
|
|
955
977
|
// src/features/check-placement/model/root-docs.ts
|
|
956
|
-
const RULE$
|
|
957
|
-
const SEPARATOR$
|
|
978
|
+
const RULE$46 = "root-docs";
|
|
979
|
+
const SEPARATOR$17 = "/";
|
|
958
980
|
const FIRST$15 = 1;
|
|
959
981
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
960
982
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
961
983
|
const MESSAGE$13 = "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.";
|
|
962
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
984
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$17)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
963
985
|
/** @internal */
|
|
964
986
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
965
987
|
const files = yield* RepositoryFiles;
|
|
@@ -968,19 +990,19 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
968
990
|
file: files.join(root, name),
|
|
969
991
|
line: FIRST$15,
|
|
970
992
|
column: FIRST$15,
|
|
971
|
-
rule: RULE$
|
|
993
|
+
rule: RULE$46,
|
|
972
994
|
message: `${name} ${MESSAGE$13}`
|
|
973
995
|
})));
|
|
974
996
|
});
|
|
975
997
|
// src/features/check-placement/model/root-readme.ts
|
|
976
|
-
const RULE$
|
|
998
|
+
const RULE$45 = "root-readme";
|
|
977
999
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
978
1000
|
const READ_CONCURRENCY$23 = 16;
|
|
979
1001
|
const START$20 = 0;
|
|
980
1002
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
981
1003
|
const MARKETPLACE$1 = ".claude-plugin/marketplace.json";
|
|
982
1004
|
const RELATIVE$1 = /^\.\//u;
|
|
983
|
-
const SEPARATOR$
|
|
1005
|
+
const SEPARATOR$16 = "/";
|
|
984
1006
|
const MarketplacePlugin = Schema.Struct({
|
|
985
1007
|
name: Schema.optional(Schema.String),
|
|
986
1008
|
source: Schema.Unknown
|
|
@@ -992,7 +1014,7 @@ const NO_PLUGINS = {
|
|
|
992
1014
|
};
|
|
993
1015
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
994
1016
|
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.`;
|
|
995
|
-
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$
|
|
1017
|
+
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$16)(directory), Array.last, Option.getOrElse(() => directory));
|
|
996
1018
|
const pluginsOf = (plugins) => {
|
|
997
1019
|
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
|
|
998
1020
|
const segments = pipe(directories, Array.map(lastSegment));
|
|
@@ -1019,12 +1041,7 @@ const problemsIn$17 = (file, source, plugins) => (workspace) => {
|
|
|
1019
1041
|
const message = messageFor(workspace.directory);
|
|
1020
1042
|
const at = positionOf(source);
|
|
1021
1043
|
const pattern = patternFor(plugins)(workspace);
|
|
1022
|
-
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => (
|
|
1023
|
-
file,
|
|
1024
|
-
...at(found.index ?? START$20),
|
|
1025
|
-
rule: RULE$44,
|
|
1026
|
-
message
|
|
1027
|
-
})));
|
|
1044
|
+
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => problemAtPosition(RULE$45)(file, at(found.index ?? START$20), message)));
|
|
1028
1045
|
};
|
|
1029
1046
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
1030
1047
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
@@ -1061,7 +1078,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
1061
1078
|
return Array.flatten(found);
|
|
1062
1079
|
});
|
|
1063
1080
|
// src/features/check-placement/model/docs-mirror.ts
|
|
1064
|
-
const RULE$
|
|
1081
|
+
const RULE$44 = "docs-mirror";
|
|
1065
1082
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
1066
1083
|
const MIRROR_LIMIT = 3;
|
|
1067
1084
|
const READ_CONCURRENCY$22 = 16;
|
|
@@ -1080,20 +1097,20 @@ const firstMention = (source, workspace) => {
|
|
|
1080
1097
|
};
|
|
1081
1098
|
const ownerOf$3 = (doc) => (workspace) => String$1.startsWith(`${workspace.directory}/`)(doc);
|
|
1082
1099
|
const describe = (mentions) => pipe(mentions, Array.map(({ directory }) => `\`${directory}\``), Array.join(", "));
|
|
1083
|
-
const problemFor$
|
|
1100
|
+
const problemFor$4 = (file, source, mentions) => pipe(Array.head(mentions), Option.filter(() => mentions.length >= MIRROR_LIMIT), Option.map(({ offset }) => {
|
|
1084
1101
|
const { line, column } = positionOf(source)(offset);
|
|
1085
1102
|
return {
|
|
1086
1103
|
file,
|
|
1087
1104
|
line,
|
|
1088
1105
|
column,
|
|
1089
|
-
rule: RULE$
|
|
1106
|
+
rule: RULE$44,
|
|
1090
1107
|
message: `names ${String(mentions.length)} other workspaces (${describe(mentions)}). The workspace list and each package.json already declare them, so this copy goes stale. Point at the declaration instead of listing it.`
|
|
1091
1108
|
};
|
|
1092
1109
|
}), Option.toArray);
|
|
1093
1110
|
const othersIn = (doc, workspaces) => pipe(workspaces, Array.filter((workspace) => !ownerOf$3(doc)(workspace)));
|
|
1094
|
-
const problemIn$
|
|
1111
|
+
const problemIn$4 = (workspaces) => (doc, file, source) => {
|
|
1095
1112
|
const mentions = pipe(othersIn(doc, workspaces), Array.flatMap((workspace) => Option.toArray(firstMention(source, workspace))));
|
|
1096
|
-
return problemFor$
|
|
1113
|
+
return problemFor$4(file, source, Array.sort(mentions, byOffset));
|
|
1097
1114
|
};
|
|
1098
1115
|
const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
1099
1116
|
const files = yield* RepositoryFiles;
|
|
@@ -1112,13 +1129,13 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1112
1129
|
const file = files.join(root, doc);
|
|
1113
1130
|
return files.readFile(file).pipe(Effect.map((source) => Option.match(source, {
|
|
1114
1131
|
onNone: () => [],
|
|
1115
|
-
onSome: (text) => problemIn$
|
|
1132
|
+
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
1116
1133
|
})));
|
|
1117
1134
|
}, { concurrency: READ_CONCURRENCY$22 });
|
|
1118
1135
|
return Array.flatten(found);
|
|
1119
1136
|
});
|
|
1120
1137
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1121
|
-
const RULE$
|
|
1138
|
+
const RULE$43 = "ignored-sources";
|
|
1122
1139
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1123
1140
|
const FIRST$14 = 1;
|
|
1124
1141
|
const MESSAGE$12 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
@@ -1130,7 +1147,7 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
1130
1147
|
file: files.join(root, file),
|
|
1131
1148
|
line: FIRST$14,
|
|
1132
1149
|
column: FIRST$14,
|
|
1133
|
-
rule: RULE$
|
|
1150
|
+
rule: RULE$43,
|
|
1134
1151
|
message: MESSAGE$12
|
|
1135
1152
|
})));
|
|
1136
1153
|
});
|
|
@@ -9712,7 +9729,7 @@ var english_verbs_default = [
|
|
|
9712
9729
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
9713
9730
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
9714
9731
|
const SEGMENT_RULE = "slice-segment-name";
|
|
9715
|
-
const SEPARATOR$
|
|
9732
|
+
const SEPARATOR$14 = "/";
|
|
9716
9733
|
const NEXT$3 = 1;
|
|
9717
9734
|
const WORD_SEPARATOR$1 = "-";
|
|
9718
9735
|
const MINIMUM_WORDS = 2;
|
|
@@ -9738,7 +9755,7 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
9738
9755
|
return words.length >= MINIMUM_WORDS && Option.exists(Array.head(words), (word) => VERBS.has(word));
|
|
9739
9756
|
};
|
|
9740
9757
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
9741
|
-
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$
|
|
9758
|
+
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array.head(String$1.split(String$1.slice(13)(path), SEPARATOR$14))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$14}${FEATURES$1}${slice}`));
|
|
9742
9759
|
const SLICE_LAYERS = [
|
|
9743
9760
|
"features",
|
|
9744
9761
|
"entities",
|
|
@@ -9746,26 +9763,26 @@ const SLICE_LAYERS = [
|
|
|
9746
9763
|
"pages"
|
|
9747
9764
|
];
|
|
9748
9765
|
const SLICE_DEPTHS = [3, 4];
|
|
9749
|
-
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$
|
|
9766
|
+
const pathPrefix = (parts, depth) => Array.join(Array.take(parts, depth), SEPARATOR$14);
|
|
9750
9767
|
const isInSliceLayer = (parts) => {
|
|
9751
9768
|
const [source, layer] = parts;
|
|
9752
|
-
return `${source}${SEPARATOR$
|
|
9769
|
+
return `${source}${SEPARATOR$14}` === SOURCE$1 && Array.contains(SLICE_LAYERS, layer ?? "");
|
|
9753
9770
|
};
|
|
9754
9771
|
const indexedSlice = (owned) => {
|
|
9755
|
-
const parts = String$1.split(owned.inner, SEPARATOR$
|
|
9772
|
+
const parts = String$1.split(owned.inner, SEPARATOR$14);
|
|
9756
9773
|
const depth = parts.length - NEXT$3;
|
|
9757
|
-
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$
|
|
9774
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$14}${pathPrefix(parts, depth)}`));
|
|
9758
9775
|
};
|
|
9759
9776
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
9760
|
-
const parts = String$1.split(inner, SEPARATOR$
|
|
9761
|
-
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$
|
|
9777
|
+
const parts = String$1.split(inner, SEPARATOR$14);
|
|
9778
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$14}${pathPrefix(parts, depth)}`);
|
|
9762
9779
|
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
9763
|
-
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$
|
|
9780
|
+
return pipe(SLICE_DEPTHS, Array.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$14}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
9764
9781
|
};
|
|
9765
9782
|
const deployNamed = ({ workspace, inner }) => {
|
|
9766
9783
|
if (!String$1.startsWith(SOURCE$1)(inner)) return Option.none();
|
|
9767
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
9768
|
-
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$
|
|
9784
|
+
const segments = String$1.split(inner, SEPARATOR$14);
|
|
9785
|
+
return pipe(Array.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$14}${Array.join(Array.take(segments, index + NEXT$3), SEPARATOR$14)}`));
|
|
9769
9786
|
};
|
|
9770
9787
|
/** @internal */
|
|
9771
9788
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -9817,13 +9834,7 @@ const ENTRY_MESSAGE = "makes an inner module of a slice public. Declare it with
|
|
|
9817
9834
|
const TEST_MESSAGE = "sits in a separate test directory. Put the test next to the code it tests as a #[cfg(test)] module; only a test that replaces the global allocator needs its own binary in tests/.";
|
|
9818
9835
|
const SLICE_MESSAGE = "is not named <verb>_<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check_layout, sync_manuscripts).";
|
|
9819
9836
|
const isFeatureName = isVerbObjectBy(WORD_SEPARATOR);
|
|
9820
|
-
const itemProblem = (file, rule, message) => (
|
|
9821
|
-
file,
|
|
9822
|
-
line,
|
|
9823
|
-
column,
|
|
9824
|
-
rule,
|
|
9825
|
-
message
|
|
9826
|
-
});
|
|
9837
|
+
const itemProblem = (file, rule, message) => (position) => problemAtPosition(rule)(file, position, message);
|
|
9827
9838
|
const isRootItem = (inner) => (item) => {
|
|
9828
9839
|
if (Array.contains(ROOT_ITEMS, item.kind)) return true;
|
|
9829
9840
|
if (item.kind === "mod_item") return !item.inline && Option.exists(item.name, (name) => Array.contains(LAYERS, name));
|
|
@@ -9894,13 +9905,13 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
9894
9905
|
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
9895
9906
|
});
|
|
9896
9907
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
9897
|
-
const RULE$
|
|
9908
|
+
const RULE$42 = "shadcn-ui-alias";
|
|
9898
9909
|
const FIRST$13 = 1;
|
|
9899
|
-
const problemOf$
|
|
9910
|
+
const problemOf$9 = (directory, { file, alias }) => ({
|
|
9900
9911
|
file,
|
|
9901
9912
|
line: FIRST$13,
|
|
9902
9913
|
column: FIRST$13,
|
|
9903
|
-
rule: RULE$
|
|
9914
|
+
rule: RULE$42,
|
|
9904
9915
|
message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
|
|
9905
9916
|
});
|
|
9906
9917
|
/** @internal */
|
|
@@ -9912,7 +9923,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
|
|
|
9912
9923
|
onNone: () => Effect.succeed(false),
|
|
9913
9924
|
onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
|
|
9914
9925
|
})) return Array.empty();
|
|
9915
|
-
return [problemOf$
|
|
9926
|
+
return [problemOf$9(directory, found.value)];
|
|
9916
9927
|
});
|
|
9917
9928
|
// src/features/check-placement/model/source-aliases.ts
|
|
9918
9929
|
const ALIAS_RULE = "source-alias";
|
|
@@ -9963,7 +9974,7 @@ const SCRIPTS = "scripts-directory";
|
|
|
9963
9974
|
const BIN = "bin";
|
|
9964
9975
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
9965
9976
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
9966
|
-
const SEPARATOR$
|
|
9977
|
+
const SEPARATOR$13 = "/";
|
|
9967
9978
|
const CURRENT = "./";
|
|
9968
9979
|
const READ_CONCURRENCY$20 = 8;
|
|
9969
9980
|
const FIRST$12 = 1;
|
|
@@ -9975,10 +9986,7 @@ const Manifest$4 = Schema.Struct({
|
|
|
9975
9986
|
main: Schema.optional(Schema.Unknown),
|
|
9976
9987
|
exports: Schema.optional(Schema.Unknown)
|
|
9977
9988
|
});
|
|
9978
|
-
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
9979
9989
|
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
9980
|
-
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
9981
|
-
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
9982
9990
|
const NO_ENTRIES = {
|
|
9983
9991
|
all: [],
|
|
9984
9992
|
bins: []
|
|
@@ -9988,14 +9996,14 @@ const runsIn = ({ text, start }) => pipe(Array.fromIterable(String$1.matchAll(RU
|
|
|
9988
9996
|
path: withoutCurrent(path),
|
|
9989
9997
|
start
|
|
9990
9998
|
})), Option.toArray)));
|
|
9991
|
-
const
|
|
9999
|
+
const targetPaths = (held) => pipe(targetsIn(held), Array.map(withoutCurrent));
|
|
9992
10000
|
const entriesOf$2 = (manifest) => {
|
|
9993
|
-
const bins =
|
|
10001
|
+
const bins = targetPaths(manifest.bin);
|
|
9994
10002
|
return {
|
|
9995
10003
|
all: [
|
|
9996
10004
|
...bins,
|
|
9997
|
-
...
|
|
9998
|
-
...
|
|
10005
|
+
...targetPaths(manifest.main),
|
|
10006
|
+
...targetPaths(manifest.exports)
|
|
9999
10007
|
],
|
|
10000
10008
|
bins
|
|
10001
10009
|
};
|
|
@@ -10009,7 +10017,7 @@ const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
|
10009
10017
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
10010
10018
|
const files = yield* RepositoryFiles;
|
|
10011
10019
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
10012
|
-
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$
|
|
10020
|
+
return pipe(names, Array.map((name) => `${BIN}${SEPARATOR$13}${name}`), Array.filter(isCommand$1));
|
|
10013
10021
|
});
|
|
10014
10022
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
10015
10023
|
const files = yield* RepositoryFiles;
|
|
@@ -10018,7 +10026,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
10018
10026
|
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$20 });
|
|
10019
10027
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
10020
10028
|
});
|
|
10021
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
10029
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13));
|
|
10022
10030
|
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.filter(({ path }) => !COMMAND$1.test(path) && !Array.contains(entries.all, path)), Array.map(({ path, start }) => ({
|
|
10023
10031
|
file,
|
|
10024
10032
|
...positionOf(source)(start),
|
|
@@ -10070,34 +10078,34 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
10070
10078
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10071
10079
|
});
|
|
10072
10080
|
// src/features/check-repository-layout/model/crates.ts
|
|
10073
|
-
const RULE$
|
|
10081
|
+
const RULE$41 = "unverified-crate";
|
|
10074
10082
|
const VERSION_RULE = "release-version";
|
|
10075
10083
|
const MANIFEST_FILE$1 = "package.json";
|
|
10076
10084
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10077
10085
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
10078
10086
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
10079
|
-
const SEPARATOR$
|
|
10087
|
+
const SEPARATOR$12 = "/";
|
|
10080
10088
|
const FIRST$11 = 1;
|
|
10081
10089
|
const READ_CONCURRENCY$19 = 8;
|
|
10082
10090
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10083
|
-
const problemFor$
|
|
10091
|
+
const problemFor$3 = (crate, message) => ({
|
|
10084
10092
|
file: crate.manifest,
|
|
10085
10093
|
line: FIRST$11,
|
|
10086
10094
|
column: FIRST$11,
|
|
10087
|
-
rule: RULE$
|
|
10095
|
+
rule: RULE$41,
|
|
10088
10096
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10089
10097
|
});
|
|
10090
|
-
const problemIn$
|
|
10098
|
+
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
10091
10099
|
const files = yield* RepositoryFiles;
|
|
10092
10100
|
const workspace = owningWorkspace(directories)(files.relative(root, files.dirname(crate.manifest)));
|
|
10093
|
-
if (Option.isNone(workspace)) return Option.some(problemFor$
|
|
10101
|
+
if (Option.isNone(workspace)) return Option.some(problemFor$3(crate, "is outside every workspace package"));
|
|
10094
10102
|
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$6))) return Option.none();
|
|
10095
|
-
return Option.some(problemFor$
|
|
10103
|
+
return Option.some(problemFor$3(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$6} has no verify task`));
|
|
10096
10104
|
});
|
|
10097
10105
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
10098
10106
|
const files = yield* RepositoryFiles;
|
|
10099
10107
|
const directory = files.relative(root, files.dirname(crate.manifest));
|
|
10100
|
-
const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$
|
|
10108
|
+
const workspace = pipe(directories, Array.findFirst((candidate) => pipe(APP_DIRECTORIES, Array.map((inner) => pipe([candidate, inner], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$12))), Array.contains(directory))));
|
|
10101
10109
|
if (Option.isNone(workspace)) return Option.none();
|
|
10102
10110
|
const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE$1));
|
|
10103
10111
|
const version = pipe(text, Option.flatMap(Schema.decodeOption(PackageVersion)), Option.map((manifest) => manifest.version));
|
|
@@ -10116,11 +10124,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
10116
10124
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10117
10125
|
const directories = yield* workspaceDirectories(root);
|
|
10118
10126
|
const crates = yield* cratesIn(root);
|
|
10119
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$
|
|
10127
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$19 });
|
|
10120
10128
|
return Array.getSomes(Array.flatten(found));
|
|
10121
10129
|
});
|
|
10122
10130
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10123
|
-
const RULE$
|
|
10131
|
+
const RULE$40 = "deploy-entry-pattern";
|
|
10124
10132
|
const FALLOW_KEYS = [
|
|
10125
10133
|
"entry",
|
|
10126
10134
|
"entryPoints",
|
|
@@ -10191,7 +10199,7 @@ const problemsIn$15 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10191
10199
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10192
10200
|
file: path,
|
|
10193
10201
|
...positionOf(text.value)(start - kind.offset),
|
|
10194
|
-
rule: RULE$
|
|
10202
|
+
rule: RULE$40,
|
|
10195
10203
|
message: `${pattern} ${MESSAGE$11}`
|
|
10196
10204
|
})));
|
|
10197
10205
|
});
|
|
@@ -10224,7 +10232,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10224
10232
|
return Array.flatten(found);
|
|
10225
10233
|
});
|
|
10226
10234
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10227
|
-
const RULE$
|
|
10235
|
+
const RULE$39 = "listed-entry";
|
|
10228
10236
|
const ENTRY_KEYS = [
|
|
10229
10237
|
"entry",
|
|
10230
10238
|
"entryPoints",
|
|
@@ -10232,7 +10240,7 @@ const ENTRY_KEYS = [
|
|
|
10232
10240
|
];
|
|
10233
10241
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
10234
10242
|
const WILDCARD$3 = /[*?{[]/u;
|
|
10235
|
-
const SEPARATOR$
|
|
10243
|
+
const SEPARATOR$11 = "/";
|
|
10236
10244
|
const WRAP_OFFSET = 1;
|
|
10237
10245
|
const READ_CONCURRENCY$17 = 8;
|
|
10238
10246
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
@@ -10244,7 +10252,7 @@ const entryPatternsIn = (node) => {
|
|
|
10244
10252
|
})));
|
|
10245
10253
|
return pipe(childrenOf$1(node), Array.flatMap(entryPatternsIn));
|
|
10246
10254
|
};
|
|
10247
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$
|
|
10255
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$11}`)(text))) || String$1.includes(SEPARATOR$11)(text) && !WILDCARD$3.test(text);
|
|
10248
10256
|
const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10249
10257
|
const files = yield* RepositoryFiles;
|
|
10250
10258
|
const path = files.join(root, file);
|
|
@@ -10254,7 +10262,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10254
10262
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10255
10263
|
file: path,
|
|
10256
10264
|
...positionOf(text.value)(start),
|
|
10257
|
-
rule: RULE$
|
|
10265
|
+
rule: RULE$39,
|
|
10258
10266
|
message: `${pattern} names files one by one. Let fallow find the file through what declares it: package.json bin and exports, a tool's config file, or the main of the Alchemy resource that deploys it.`
|
|
10259
10267
|
})));
|
|
10260
10268
|
});
|
|
@@ -10266,7 +10274,7 @@ const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallow
|
|
|
10266
10274
|
return Array.flatten(found);
|
|
10267
10275
|
});
|
|
10268
10276
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10269
|
-
const RULE$
|
|
10277
|
+
const RULE$38 = "root-workspace-path";
|
|
10270
10278
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10271
10279
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10272
10280
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -10285,7 +10293,7 @@ const mentions = (directory) => (text) => {
|
|
|
10285
10293
|
const problemsIn$13 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10286
10294
|
file,
|
|
10287
10295
|
...positionOf(source)(found.start),
|
|
10288
|
-
rule: RULE$
|
|
10296
|
+
rule: RULE$38,
|
|
10289
10297
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
10290
10298
|
})));
|
|
10291
10299
|
/** @internal */
|
|
@@ -10299,11 +10307,11 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10299
10307
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$13(file, source.value, directories)));
|
|
10300
10308
|
});
|
|
10301
10309
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10302
|
-
const RULE$
|
|
10310
|
+
const RULE$37 = "hidden-verify";
|
|
10303
10311
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10304
10312
|
const FIRST$9 = 1;
|
|
10305
10313
|
const READ_CONCURRENCY$16 = 8;
|
|
10306
|
-
const problemIn$
|
|
10314
|
+
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10307
10315
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10308
10316
|
if (Option.isNone(config)) return Option.none();
|
|
10309
10317
|
const { file, program } = config.value;
|
|
@@ -10313,18 +10321,18 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10313
10321
|
file,
|
|
10314
10322
|
line: FIRST$9,
|
|
10315
10323
|
column: FIRST$9,
|
|
10316
|
-
rule: RULE$
|
|
10324
|
+
rule: RULE$37,
|
|
10317
10325
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
10318
10326
|
}).pipe(Option.filter(() => verified));
|
|
10319
10327
|
});
|
|
10320
10328
|
/** @internal */
|
|
10321
10329
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10322
10330
|
const directories = yield* workspaceDirectories(root);
|
|
10323
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$
|
|
10331
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$16 });
|
|
10324
10332
|
return Array.getSomes(found);
|
|
10325
10333
|
});
|
|
10326
10334
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10327
|
-
const RULE$
|
|
10335
|
+
const RULE$36 = "shared-uncached-task";
|
|
10328
10336
|
const READ_CONCURRENCY$15 = 8;
|
|
10329
10337
|
const SHARED = 2;
|
|
10330
10338
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -10367,7 +10375,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
10367
10375
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10368
10376
|
file,
|
|
10369
10377
|
...position,
|
|
10370
|
-
rule: RULE$
|
|
10378
|
+
rule: RULE$36,
|
|
10371
10379
|
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.`
|
|
10372
10380
|
})));
|
|
10373
10381
|
};
|
|
@@ -10378,7 +10386,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
10378
10386
|
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10379
10387
|
});
|
|
10380
10388
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10381
|
-
const RULE$
|
|
10389
|
+
const RULE$35 = "unlocked-task";
|
|
10382
10390
|
const READ_CONCURRENCY$14 = 8;
|
|
10383
10391
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10384
10392
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -10390,7 +10398,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
10390
10398
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10391
10399
|
file,
|
|
10392
10400
|
...positionOf(source)(task.start),
|
|
10393
|
-
rule: RULE$
|
|
10401
|
+
rule: RULE$35,
|
|
10394
10402
|
message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
|
|
10395
10403
|
})), Option.toArray)));
|
|
10396
10404
|
/** @internal */
|
|
@@ -10445,7 +10453,7 @@ const scalarsIn = (source) => {
|
|
|
10445
10453
|
const ROOT$2 = ".";
|
|
10446
10454
|
const LOCAL$1 = "./";
|
|
10447
10455
|
const NEGATION = "!";
|
|
10448
|
-
const SEPARATOR$
|
|
10456
|
+
const SEPARATOR$10 = "/";
|
|
10449
10457
|
const LINE$1 = "\n";
|
|
10450
10458
|
const UNRESOLVED_MARKERS = [
|
|
10451
10459
|
"${{",
|
|
@@ -10472,7 +10480,7 @@ const withoutLocal = (path) => {
|
|
|
10472
10480
|
const joinPath = (base, path) => {
|
|
10473
10481
|
const relative = withoutLocal(String$1.trim(path));
|
|
10474
10482
|
if (base === ROOT$2) return relative;
|
|
10475
|
-
return `${base}${SEPARATOR$
|
|
10483
|
+
return `${base}${SEPARATOR$10}${relative}`;
|
|
10476
10484
|
};
|
|
10477
10485
|
const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
|
|
10478
10486
|
const path = String$1.trim(text);
|
|
@@ -10545,12 +10553,12 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10545
10553
|
/** @internal */
|
|
10546
10554
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10547
10555
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10548
|
-
const RULE$
|
|
10556
|
+
const RULE$34 = "workflow-path";
|
|
10549
10557
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10550
10558
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10551
10559
|
const READ_CONCURRENCY$13 = 8;
|
|
10552
10560
|
const WILDCARD$2 = /[*?[]/u;
|
|
10553
|
-
const SEPARATOR$
|
|
10561
|
+
const SEPARATOR$9 = "/";
|
|
10554
10562
|
const FIRST$8 = 0;
|
|
10555
10563
|
const EXPECTED = {
|
|
10556
10564
|
action: "a directory with action.yml",
|
|
@@ -10575,10 +10583,10 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
|
|
|
10575
10583
|
return Option.getOrElse(directory, () => false);
|
|
10576
10584
|
});
|
|
10577
10585
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
10578
|
-
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$
|
|
10586
|
+
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$9}${name}`), { concurrency: 1 });
|
|
10579
10587
|
return pipe(found, Array.some(Boolean));
|
|
10580
10588
|
});
|
|
10581
|
-
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$
|
|
10589
|
+
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array.drop(index), Array.join(SEPARATOR$9))}`;
|
|
10582
10590
|
const RESOLVERS = {
|
|
10583
10591
|
action: hasAction,
|
|
10584
10592
|
directory: isDirectoryAt,
|
|
@@ -10586,32 +10594,32 @@ const RESOLVERS = {
|
|
|
10586
10594
|
glob: matchesGlob,
|
|
10587
10595
|
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
10588
10596
|
if (yield* existsAt(root, path)) return true;
|
|
10589
|
-
const segments = String$1.split(path, SEPARATOR$
|
|
10597
|
+
const segments = String$1.split(path, SEPARATOR$9);
|
|
10590
10598
|
return yield* matchesAny(root, Array.makeBy(segments.length, suffixAt(segments)));
|
|
10591
10599
|
})
|
|
10592
10600
|
};
|
|
10593
10601
|
const staticPrefix = (path) => {
|
|
10594
10602
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10595
|
-
if (String$1.endsWith(SEPARATOR$
|
|
10603
|
+
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$8, -1)(prefix);
|
|
10596
10604
|
return prefix;
|
|
10597
10605
|
};
|
|
10598
|
-
const isIgnored
|
|
10606
|
+
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
10599
10607
|
const prefix = staticPrefix(path);
|
|
10600
10608
|
if (String$1.isEmpty(prefix)) return false;
|
|
10601
10609
|
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix]);
|
|
10602
10610
|
return Array.isReadonlyArrayNonEmpty(ignored);
|
|
10603
10611
|
});
|
|
10604
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$
|
|
10612
|
+
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$9}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$9}`)(path);
|
|
10605
10613
|
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
10606
10614
|
const prefix = staticPrefix(found.path);
|
|
10607
10615
|
if (pipe(produced, Array.some(overlaps(prefix)))) return false;
|
|
10608
10616
|
if (yield* RESOLVERS[found.kind](root, found.path)) return false;
|
|
10609
|
-
return !(yield* isIgnored
|
|
10617
|
+
return !(yield* isIgnored(root, found.path));
|
|
10610
10618
|
});
|
|
10611
|
-
const problemOf$
|
|
10619
|
+
const problemOf$8 = (file, source) => (found) => ({
|
|
10612
10620
|
file,
|
|
10613
10621
|
...positionOf(source)(found.offset),
|
|
10614
|
-
rule: RULE$
|
|
10622
|
+
rule: RULE$34,
|
|
10615
10623
|
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.`
|
|
10616
10624
|
});
|
|
10617
10625
|
const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -10621,7 +10629,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
10621
10629
|
if (Option.isNone(source)) return [];
|
|
10622
10630
|
const produced = producedPaths(source.value);
|
|
10623
10631
|
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing$1(root, produced, found));
|
|
10624
|
-
return pipe(missing, Array.map(problemOf$
|
|
10632
|
+
return pipe(missing, Array.map(problemOf$8(file, source.value)));
|
|
10625
10633
|
});
|
|
10626
10634
|
/** @internal */
|
|
10627
10635
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
@@ -10639,7 +10647,7 @@ const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
|
10639
10647
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10640
10648
|
const START$19 = 0;
|
|
10641
10649
|
const READ_CONCURRENCY$12 = 8;
|
|
10642
|
-
const SEPARATOR$
|
|
10650
|
+
const SEPARATOR$8 = "/";
|
|
10643
10651
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10644
10652
|
const SPACE = " ";
|
|
10645
10653
|
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.";
|
|
@@ -10662,8 +10670,8 @@ const pathFiltersIn = (file, source) => {
|
|
|
10662
10670
|
};
|
|
10663
10671
|
const matching = (workspaces, text) => pipe(workspaces, Array.findFirst(({ names }) => Array.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf$1(names))(text))), Option.map(({ directory }) => directory));
|
|
10664
10672
|
const named$1 = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
10665
|
-
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$
|
|
10666
|
-
const namesIn = (name, source) => {
|
|
10673
|
+
const containing = (workspaces, path) => pipe(workspaces, Array.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$8}`)(path)), Option.map(({ directory }) => directory));
|
|
10674
|
+
const namesIn$1 = (name, source) => {
|
|
10667
10675
|
const root = parseDocument(source).contents;
|
|
10668
10676
|
return [
|
|
10669
10677
|
{
|
|
@@ -10684,7 +10692,7 @@ const packagesIn = (workspaces, { file, name, source }) => {
|
|
|
10684
10692
|
file,
|
|
10685
10693
|
source
|
|
10686
10694
|
};
|
|
10687
|
-
const fromNames = pipe(namesIn(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
|
|
10695
|
+
const fromNames = pipe(namesIn$1(name, source), Array.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
|
|
10688
10696
|
const referenced = pipe(workflowReferences(source), Array.filter(({ field }) => !String$1.startsWith("on.")(field)), Array.flatMap(({ field, path, offset }) => reported(where, offset, field)(containing(workspaces, path))));
|
|
10689
10697
|
const filtered = pipe(filtersIn(source), Array.flatMap(({ text, offset }) => reported(where, offset, `--filter ${text}`)(matching(workspaces, text))));
|
|
10690
10698
|
return [
|
|
@@ -10737,48 +10745,12 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10737
10745
|
], { concurrency: "unbounded" });
|
|
10738
10746
|
return Array.flatten(found);
|
|
10739
10747
|
});
|
|
10740
|
-
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
10741
|
-
const RULE$32 = "legacy-typescript";
|
|
10742
|
-
const LOCKFILE = "pnpm-lock.yaml";
|
|
10743
|
-
const COMPILER = "typescript";
|
|
10744
|
-
const CURRENT_MAJOR = 7;
|
|
10745
|
-
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
10746
|
-
const FIRST$7 = 1;
|
|
10747
|
-
const legacyOf = (id) => {
|
|
10748
|
-
const { name, version } = parse$1(id);
|
|
10749
|
-
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
10750
|
-
return pipe(Option.fromNullishOr(name), Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? "")), Option.map((found) => ({
|
|
10751
|
-
id,
|
|
10752
|
-
name: found
|
|
10753
|
-
})));
|
|
10754
|
-
};
|
|
10755
|
-
const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
|
|
10756
|
-
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
10757
|
-
onNone: () => FIRST$7,
|
|
10758
|
-
onSome: (index) => index + FIRST$7
|
|
10759
|
-
}));
|
|
10760
|
-
const messageOf$2 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array.join(dependents, ", ")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;
|
|
10761
|
-
/** @internal */
|
|
10762
|
-
const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(function* checkTypescriptGeneration(root) {
|
|
10763
|
-
const files = yield* RepositoryFiles;
|
|
10764
|
-
const file = files.join(root, LOCKFILE);
|
|
10765
|
-
const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
10766
|
-
const read = yield* files.readFile(file);
|
|
10767
|
-
const source = Option.getOrElse(read, () => "");
|
|
10768
|
-
return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
|
|
10769
|
-
file,
|
|
10770
|
-
line: lineOf$2(source)(legacy.id),
|
|
10771
|
-
column: FIRST$7,
|
|
10772
|
-
rule: RULE$32,
|
|
10773
|
-
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
10774
|
-
})));
|
|
10775
|
-
});
|
|
10776
10748
|
// src/features/measure-install-size/model/import-graph.ts
|
|
10777
10749
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
10778
10750
|
const SUBPATH_IMPORT = "#";
|
|
10779
10751
|
const WILDCARD$1 = "*";
|
|
10780
10752
|
const SCOPE$2 = "@";
|
|
10781
|
-
const SEPARATOR$
|
|
10753
|
+
const SEPARATOR$7 = "/";
|
|
10782
10754
|
const SOURCE_SUFFIXES = [
|
|
10783
10755
|
"",
|
|
10784
10756
|
".ts",
|
|
@@ -10790,9 +10762,9 @@ const PLAIN_SEGMENTS = 1;
|
|
|
10790
10762
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
10791
10763
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
10792
10764
|
const packageNameOf = (specifier) => {
|
|
10793
|
-
const segments = String$1.split(specifier, SEPARATOR$
|
|
10794
|
-
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$
|
|
10795
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$
|
|
10765
|
+
const segments = String$1.split(specifier, SEPARATOR$7);
|
|
10766
|
+
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$7));
|
|
10767
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$7));
|
|
10796
10768
|
};
|
|
10797
10769
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
10798
10770
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -10990,7 +10962,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
10990
10962
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
10991
10963
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
10992
10964
|
const sizes = HashMap.fromIterable(measured);
|
|
10993
|
-
const sizeOf = (packages) =>
|
|
10965
|
+
const sizeOf = (packages) => packages.pipe(Array.fromIterable, Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$18)), Number$1.sumAll);
|
|
10994
10966
|
return {
|
|
10995
10967
|
closures,
|
|
10996
10968
|
sizeOf,
|
|
@@ -11072,6 +11044,97 @@ const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* che
|
|
|
11072
11044
|
const found = yield* Effect.forEach(workspaces, workspaceProblems, { concurrency: 1 });
|
|
11073
11045
|
return Array.flatten(found);
|
|
11074
11046
|
});
|
|
11047
|
+
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
11048
|
+
const RULE$33 = "legacy-typescript";
|
|
11049
|
+
const LOCKFILE = "pnpm-lock.yaml";
|
|
11050
|
+
const COMPILER = "typescript";
|
|
11051
|
+
const CURRENT_MAJOR = 7;
|
|
11052
|
+
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
11053
|
+
const FIRST$7 = 1;
|
|
11054
|
+
const legacyOf = (id) => {
|
|
11055
|
+
const { name, version } = parse$1(id);
|
|
11056
|
+
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
11057
|
+
return pipe(Option.fromNullishOr(name), Option.filter(() => isOldCompiler || LEGACY_COMPILER_PACKAGE.test(name ?? "")), Option.map((found) => ({
|
|
11058
|
+
id,
|
|
11059
|
+
name: found
|
|
11060
|
+
})));
|
|
11061
|
+
};
|
|
11062
|
+
const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
|
|
11063
|
+
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
11064
|
+
onNone: () => FIRST$7,
|
|
11065
|
+
onSome: (index) => index + FIRST$7
|
|
11066
|
+
}));
|
|
11067
|
+
const messageOf$2 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array.join(dependents, ", ")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;
|
|
11068
|
+
/** @internal */
|
|
11069
|
+
const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(function* checkTypescriptGeneration(root) {
|
|
11070
|
+
const files = yield* RepositoryFiles;
|
|
11071
|
+
const file = files.join(root, LOCKFILE);
|
|
11072
|
+
const nodes = yield* lockedGraph(root).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
11073
|
+
const read = yield* files.readFile(file);
|
|
11074
|
+
const source = Option.getOrElse(read, () => "");
|
|
11075
|
+
return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
|
|
11076
|
+
file,
|
|
11077
|
+
line: lineOf$2(source)(legacy.id),
|
|
11078
|
+
column: FIRST$7,
|
|
11079
|
+
rule: RULE$33,
|
|
11080
|
+
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
11081
|
+
})));
|
|
11082
|
+
});
|
|
11083
|
+
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
11084
|
+
const RULE$32 = "worker-bundle";
|
|
11085
|
+
const BUNDLE_CONCURRENCY = 4;
|
|
11086
|
+
const SHOWN_ERRORS = 3;
|
|
11087
|
+
const ERROR_LINE = /\[[A-Z_]+\]/u;
|
|
11088
|
+
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
11089
|
+
const CONDITIONS = [
|
|
11090
|
+
"workerd",
|
|
11091
|
+
"worker",
|
|
11092
|
+
"browser",
|
|
11093
|
+
"import",
|
|
11094
|
+
"module",
|
|
11095
|
+
"default"
|
|
11096
|
+
];
|
|
11097
|
+
const NO_DETAIL = "Run the bundle to see the error.";
|
|
11098
|
+
const problemFor$2 = problemInFile(RULE$32);
|
|
11099
|
+
const errorLines = (error) => pipe(Option.liftPredicate(error, Predicate.isError), Option.map(({ message }) => message), Option.getOrElse(() => String(error)), stripVTControlCharacters, String$1.split("\n"), Array.filter((line) => ERROR_LINE.test(line)), Array.take(SHOWN_ERRORS));
|
|
11100
|
+
const detailOf = (lines) => pipe(lines, Array.match({
|
|
11101
|
+
onEmpty: () => NO_DETAIL,
|
|
11102
|
+
onNonEmpty: Array.join(" ")
|
|
11103
|
+
}));
|
|
11104
|
+
const problemOf$7 = (file, lines) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detailOf(lines)}`);
|
|
11105
|
+
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
11106
|
+
const built = yield* Effect.tryPromise({
|
|
11107
|
+
try: () => rolldown({
|
|
11108
|
+
input: file,
|
|
11109
|
+
platform: "neutral",
|
|
11110
|
+
external: PLATFORM_MODULES,
|
|
11111
|
+
resolve: { conditionNames: CONDITIONS },
|
|
11112
|
+
logLevel: "silent"
|
|
11113
|
+
}),
|
|
11114
|
+
catch: errorLines
|
|
11115
|
+
});
|
|
11116
|
+
yield* Effect.tryPromise({
|
|
11117
|
+
try: () => built.generate({ format: "esm" }),
|
|
11118
|
+
catch: errorLines
|
|
11119
|
+
});
|
|
11120
|
+
yield* Effect.promise(() => built.close());
|
|
11121
|
+
}).pipe(Effect.match({
|
|
11122
|
+
onSuccess: () => Option.none(),
|
|
11123
|
+
onFailure: (lines) => Option.some(problemOf$7(file, lines))
|
|
11124
|
+
}));
|
|
11125
|
+
/** @internal */
|
|
11126
|
+
const checkWorkerBundles = Effect.fn("checkWorkerBundles")(function* checkWorkerBundles(root) {
|
|
11127
|
+
const files = yield* RepositoryFiles;
|
|
11128
|
+
const entries = yield* deployEntries(root);
|
|
11129
|
+
const found = yield* Effect.forEach(entries, (entry) => bundleProblem(files.join(root, entry)), { concurrency: BUNDLE_CONCURRENCY });
|
|
11130
|
+
return Array.getSomes(found);
|
|
11131
|
+
});
|
|
11132
|
+
// src/app/build-checks.ts
|
|
11133
|
+
/** @internal */
|
|
11134
|
+
const checkBuilds = Effect.fn("checkBuilds")(function* checkBuilds(root) {
|
|
11135
|
+
const found = yield* Effect.all([checkTypescriptGeneration(root), checkWorkerBundles(root)], { concurrency: "unbounded" });
|
|
11136
|
+
return Array.flatten(found);
|
|
11137
|
+
});
|
|
11075
11138
|
// src/features/check-value-owners/model/slots.ts
|
|
11076
11139
|
const ANNOTATED_KINDS = /* @__PURE__ */ new Set([
|
|
11077
11140
|
SyntaxKind.Parameter,
|
|
@@ -11154,6 +11217,63 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
11154
11217
|
values: freeLiteralsIn(checker)(sourceFile, excluded),
|
|
11155
11218
|
imports: importedFilesOf(checker)(sourceFile)
|
|
11156
11219
|
})), Array.filter((facts) => Array.isReadonlyArrayNonEmpty(facts.values) || Array.isReadonlyArrayNonEmpty(facts.imports)));
|
|
11220
|
+
// src/features/check-value-owners/model/name-lists.ts
|
|
11221
|
+
const RULE$31 = "hand-written-names";
|
|
11222
|
+
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11223
|
+
const nameListOf = (site) => {
|
|
11224
|
+
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
11225
|
+
const names = pipe(site.values, Array.filter(Predicate.isString));
|
|
11226
|
+
return Option.liftPredicate({
|
|
11227
|
+
site,
|
|
11228
|
+
names
|
|
11229
|
+
}, (list) => list.names.length === site.values.length);
|
|
11230
|
+
};
|
|
11231
|
+
const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
|
|
11232
|
+
const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
11233
|
+
file,
|
|
11234
|
+
line,
|
|
11235
|
+
column,
|
|
11236
|
+
rule: RULE$31,
|
|
11237
|
+
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
11238
|
+
});
|
|
11239
|
+
const problemOf$6 = ({ list, reason }) => listedProblem({
|
|
11240
|
+
file: list.site.file,
|
|
11241
|
+
line: list.site.line,
|
|
11242
|
+
column: list.site.column,
|
|
11243
|
+
names: list.names,
|
|
11244
|
+
reason
|
|
11245
|
+
});
|
|
11246
|
+
// src/features/check-value-owners/model/outside-names.ts
|
|
11247
|
+
const IDENTIFIER = /^[A-Za-z_$][\w$]*$/u;
|
|
11248
|
+
const HALF = 2;
|
|
11249
|
+
const outsideTypeIn = (project) => {
|
|
11250
|
+
const exported = HashSet.fromIterable(project.library.typeNames);
|
|
11251
|
+
const values = HashSet.fromIterable([...project.library.tagNames, ...pipe(project.library.vocabularies, Array.flatMap(({ vocabulary }) => vocabulary.values))]);
|
|
11252
|
+
const known = /* @__PURE__ */ new Map();
|
|
11253
|
+
const isOutside = isOutsideDeclaration(project.program);
|
|
11254
|
+
const isGlobalType = (name) => pipe(Option.fromNullishOr(project.checker.resolveName(name, SymbolFlags.Type)), Option.map(declarationsOf), Option.exists((declarations) => declaresAType(declarations) && !carriesTag(name)(declarations) && pipe(declarations, Array.every(isOutside))));
|
|
11255
|
+
return (name) => known.getOrInsertComputed(name, () => IDENTIFIER.test(name) && !HashSet.has(values, name) && (HashSet.has(exported, name) || isGlobalType(name)));
|
|
11256
|
+
};
|
|
11257
|
+
const namesIn = (list) => pipe(list.elements, Array.filter(isStringLiteral), Array.map((element) => element.text));
|
|
11258
|
+
const problemIn$1 = (isOutsideType) => (list) => {
|
|
11259
|
+
const names = namesIn(list);
|
|
11260
|
+
const outside = pipe(names, Array.filter(isOutsideType));
|
|
11261
|
+
if (outside.length < Math.max(2, names.length / HALF)) return Option.none();
|
|
11262
|
+
return Option.some(listedProblem({
|
|
11263
|
+
file: list.getSourceFile().fileName,
|
|
11264
|
+
line: lineOf$3(list),
|
|
11265
|
+
column: columnOf(list),
|
|
11266
|
+
names,
|
|
11267
|
+
reason: `${formatValues(outside)} are types that the language or a package declares. Let the code that reads this list decide by where each type is declared, so that a new type does not mean a new entry.`
|
|
11268
|
+
}));
|
|
11269
|
+
};
|
|
11270
|
+
const outsideNameProblemsIn = (project) => {
|
|
11271
|
+
const problemOfList = problemIn$1(outsideTypeIn(project));
|
|
11272
|
+
return (sourceFile) => {
|
|
11273
|
+
if (TEST_FILE.test(sourceFile.fileName)) return [];
|
|
11274
|
+
return pipe(descendantsOf(sourceFile), Array.filter(isArrayLiteralExpression), Array.map(problemOfList), Array.getSomes);
|
|
11275
|
+
};
|
|
11276
|
+
};
|
|
11157
11277
|
// src/features/check-value-owners/model/owners.ts
|
|
11158
11278
|
const OWNER_TAG = "msch";
|
|
11159
11279
|
const FIRST_OWNER_COUNT = 1;
|
|
@@ -11186,7 +11306,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
11186
11306
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
11187
11307
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
11188
11308
|
};
|
|
11189
|
-
const annotationProblem = (message) => problemAt$
|
|
11309
|
+
const annotationProblem = (message) => problemAt$7({
|
|
11190
11310
|
rule: "owner-annotation",
|
|
11191
11311
|
message
|
|
11192
11312
|
});
|
|
@@ -11323,7 +11443,7 @@ const shapeProblem = (site, matches) => {
|
|
|
11323
11443
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
11324
11444
|
onSome: () => "Use the library type instead of copying it."
|
|
11325
11445
|
});
|
|
11326
|
-
return problemAt$
|
|
11446
|
+
return problemAt$7({
|
|
11327
11447
|
rule: "library-shape",
|
|
11328
11448
|
message: `This shape copies ${shown}. ${advice}`
|
|
11329
11449
|
})(site.node);
|
|
@@ -11428,7 +11548,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
11428
11548
|
const added = pipe(site.values, Array.filter((value) => !isSubsetOf([value], held)));
|
|
11429
11549
|
if (!Array.isReadonlyArrayNonEmpty(owners) || !Array.isReadonlyArrayNonEmpty(added)) return verdict([], []);
|
|
11430
11550
|
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.`;
|
|
11431
|
-
return verdict([problemAt$
|
|
11551
|
+
return verdict([problemAt$7({
|
|
11432
11552
|
rule: "owner-extension",
|
|
11433
11553
|
message
|
|
11434
11554
|
})(site.node)], []);
|
|
@@ -11450,7 +11570,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
11450
11570
|
const owners = pipe(context.owners, Array.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
11451
11571
|
if (Array.isReadonlyArrayNonEmpty(owners)) {
|
|
11452
11572
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
11453
|
-
return verdict([problemAt$
|
|
11573
|
+
return verdict([problemAt$7({
|
|
11454
11574
|
rule: "owner-value-set",
|
|
11455
11575
|
message
|
|
11456
11576
|
})(site.node)], []);
|
|
@@ -11458,7 +11578,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
11458
11578
|
const candidates = libraryCandidates(context)(site);
|
|
11459
11579
|
if (Array.isReadonlyArrayNonEmpty(candidates)) {
|
|
11460
11580
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
11461
|
-
return verdict([problemAt$
|
|
11581
|
+
return verdict([problemAt$7({
|
|
11462
11582
|
rule: "library-value-set",
|
|
11463
11583
|
message
|
|
11464
11584
|
})(site.node)], []);
|
|
@@ -11489,7 +11609,7 @@ const isValuePosition = (node) => {
|
|
|
11489
11609
|
const { parent } = node;
|
|
11490
11610
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array.some((isSlot) => isSlot(node, parent)));
|
|
11491
11611
|
};
|
|
11492
|
-
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$
|
|
11612
|
+
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$7({
|
|
11493
11613
|
rule: "owned-literal",
|
|
11494
11614
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
11495
11615
|
})(literal)));
|
|
@@ -11497,6 +11617,15 @@ const ownedLiteralProblems = (context) => (sourceFile, excluded) => Array.getSom
|
|
|
11497
11617
|
// src/features/check-value-owners/model/analysis.ts
|
|
11498
11618
|
const isVisibleTo = (project) => (owner) => pipe(project.sourceFiles, Array.some((sourceFile) => sourceFile.fileName === owner.file)) || Option.exists(owner.packageName, (name) => Option.contains(project.packageName, name) || project.workspaceDependencies.includes(name));
|
|
11499
11619
|
const nodesOf = (sites) => pipe(sites, Array.map((site) => site.node));
|
|
11620
|
+
const fileChecksOf = (project, sourceChecks) => [
|
|
11621
|
+
shapeProblemsIn({
|
|
11622
|
+
checker: project.checker,
|
|
11623
|
+
program: project.program,
|
|
11624
|
+
shapes: project.library.shapes
|
|
11625
|
+
}),
|
|
11626
|
+
outsideNameProblemsIn(project),
|
|
11627
|
+
...pipe(sourceChecks, Array.map((check) => check(project.checker)))
|
|
11628
|
+
];
|
|
11500
11629
|
const analyzeProject = ({ owners, sourceChecks }) => (project) => {
|
|
11501
11630
|
const { checker } = project;
|
|
11502
11631
|
const ownerDeclarations = ownerDeclarationsIn(owners)(project);
|
|
@@ -11514,17 +11643,9 @@ const analyzeProject = ({ owners, sourceChecks }) => (project) => {
|
|
|
11514
11643
|
};
|
|
11515
11644
|
const verdicts = pipe(sites, Array.map((site) => siteVerdict(context)(site)));
|
|
11516
11645
|
const excluded = [...ownerDeclarations, ...nodesOf(sites)];
|
|
11517
|
-
const
|
|
11518
|
-
checker,
|
|
11519
|
-
program: project.program,
|
|
11520
|
-
shapes: project.library.shapes
|
|
11521
|
-
};
|
|
11646
|
+
const fileChecks = fileChecksOf(project, sourceChecks);
|
|
11522
11647
|
return {
|
|
11523
|
-
problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [
|
|
11524
|
-
...ownedLiteralProblems(context)(sourceFile, excluded),
|
|
11525
|
-
...shapeProblemsIn(shapeContext)(sourceFile),
|
|
11526
|
-
...pipe(sourceChecks, Array.flatMap((check) => check(checker)(sourceFile)))
|
|
11527
|
-
]))],
|
|
11648
|
+
problems: [...pipe(verdicts, Array.flatMap((found) => found.problems)), ...pipe(project.sourceFiles, Array.flatMap((sourceFile) => [...ownedLiteralProblems(context)(sourceFile, excluded), ...pipe(fileChecks, Array.flatMap((check) => check(sourceFile)))]))],
|
|
11528
11649
|
unowned: pipe(verdicts, Array.flatMap((found) => found.unowned)),
|
|
11529
11650
|
literals: fileFactsIn(checker)(project.sourceFiles, excluded)
|
|
11530
11651
|
};
|
|
@@ -11565,7 +11686,6 @@ const AnalysisSchema = Schema.Struct({
|
|
|
11565
11686
|
unowned: Schema.Array(UnownedSiteSchema),
|
|
11566
11687
|
literals: Schema.Array(FileLiteralsSchema)
|
|
11567
11688
|
});
|
|
11568
|
-
const AnalysisJson = Schema.fromJsonString(AnalysisSchema);
|
|
11569
11689
|
const hasher = Effect.gen(function* currentHasher() {
|
|
11570
11690
|
return (yield* RepositoryFiles).hash;
|
|
11571
11691
|
});
|
|
@@ -11626,19 +11746,28 @@ const moved = (move) => (analysis) => ({
|
|
|
11626
11746
|
})))
|
|
11627
11747
|
});
|
|
11628
11748
|
const entryFile = (cache, key) => `${cache.directory}/${key}${CACHE_SUFFIX}`;
|
|
11749
|
+
const portableOf = (cache, files) => SchemaTransformation.transform({
|
|
11750
|
+
decode: moved((file) => files.resolve(cache.root, file)),
|
|
11751
|
+
encode: moved((file) => files.relative(cache.root, file))
|
|
11752
|
+
});
|
|
11753
|
+
const codecOf = (cache) => Effect.gen(function* buildCodec() {
|
|
11754
|
+
const files = yield* RepositoryFiles;
|
|
11755
|
+
const portable = AnalysisSchema.pipe(Schema.decodeTo(AnalysisSchema, portableOf(cache, files)));
|
|
11756
|
+
return Schema.fromJsonString(portable);
|
|
11757
|
+
});
|
|
11629
11758
|
const readAnalysis = (cache) => (key) => Effect.gen(function* readCached() {
|
|
11630
11759
|
const files = yield* RepositoryFiles;
|
|
11760
|
+
const codec = yield* codecOf(cache);
|
|
11631
11761
|
const text = yield* files.readFile(entryFile(cache, key));
|
|
11632
|
-
const restored = moved((file) => files.resolve(cache.root, file));
|
|
11633
11762
|
return yield* Option.match(text, {
|
|
11634
11763
|
onNone: () => Effect.succeedNone,
|
|
11635
|
-
onSome: (found) => Schema.decodeEffect(
|
|
11636
|
-
})
|
|
11764
|
+
onSome: (found) => Schema.decodeEffect(codec)(found).pipe(Effect.option)
|
|
11765
|
+
});
|
|
11637
11766
|
});
|
|
11638
11767
|
const writeAnalysis = (cache) => (key, analysis) => Effect.gen(function* writeCached() {
|
|
11639
11768
|
const files = yield* RepositoryFiles;
|
|
11640
|
-
const
|
|
11641
|
-
const text = yield* Schema.encodeEffect(
|
|
11769
|
+
const codec = yield* codecOf(cache);
|
|
11770
|
+
const text = yield* Schema.encodeEffect(codec)(analysis).pipe(Effect.option);
|
|
11642
11771
|
yield* Option.match(text, {
|
|
11643
11772
|
onNone: () => Effect.void,
|
|
11644
11773
|
onSome: (found) => files.writeFile(entryFile(cache, key), found)
|
|
@@ -11682,25 +11811,6 @@ const duplicateProblems = (relative) => (sites) => {
|
|
|
11682
11811
|
}];
|
|
11683
11812
|
}))));
|
|
11684
11813
|
};
|
|
11685
|
-
// src/features/check-value-owners/model/name-lists.ts
|
|
11686
|
-
const RULE$31 = "hand-written-names";
|
|
11687
|
-
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
11688
|
-
const nameListOf = (site) => {
|
|
11689
|
-
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
11690
|
-
const names = pipe(site.values, Array.filter(Predicate.isString));
|
|
11691
|
-
return Option.liftPredicate({
|
|
11692
|
-
site,
|
|
11693
|
-
names
|
|
11694
|
-
}, (list) => list.names.length === site.values.length);
|
|
11695
|
-
};
|
|
11696
|
-
const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
|
|
11697
|
-
const problemOf$6 = ({ list, reason }) => ({
|
|
11698
|
-
file: list.site.file,
|
|
11699
|
-
line: list.site.line,
|
|
11700
|
-
column: list.site.column,
|
|
11701
|
-
rule: RULE$31,
|
|
11702
|
-
message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
|
|
11703
|
-
});
|
|
11704
11814
|
// src/features/check-value-owners/model/declared-names.ts
|
|
11705
11815
|
const MOST_DEFINING_FILES = 2;
|
|
11706
11816
|
const SINGLE_NAME = 1;
|
|
@@ -11739,7 +11849,7 @@ const declaredNameProblem = ({ literals, relative }) => {
|
|
|
11739
11849
|
const PATH_PREFIX = /^(?:!|\.\/)+/u;
|
|
11740
11850
|
const GLOB = /[*?{[]/u;
|
|
11741
11851
|
const EXTENSION$1 = /\.[^./]+$/u;
|
|
11742
|
-
const SEPARATOR$
|
|
11852
|
+
const SEPARATOR$6 = "/";
|
|
11743
11853
|
const ROOT$1 = ".";
|
|
11744
11854
|
const namedPath = (repository, file) => (name) => {
|
|
11745
11855
|
const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
|
|
@@ -11748,12 +11858,12 @@ const namedPath = (repository, file) => (name) => {
|
|
|
11748
11858
|
return pipe([fromFile, bare], Array.findFirst((path) => HashSet.has(repository.paths, path)));
|
|
11749
11859
|
};
|
|
11750
11860
|
const kindOf = (repository) => (path) => {
|
|
11751
|
-
if (HashSet.has(repository.directories, path)) return SEPARATOR$
|
|
11861
|
+
if (HashSet.has(repository.directories, path)) return SEPARATOR$6;
|
|
11752
11862
|
return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array.head), Option.getOrElse(() => path));
|
|
11753
11863
|
};
|
|
11754
11864
|
const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
|
|
11755
11865
|
const coversDirectory = (repository) => (group) => pipe(Array.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
|
|
11756
|
-
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$
|
|
11866
|
+
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$6}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
|
|
11757
11867
|
const directoryLabel = (directory) => {
|
|
11758
11868
|
if (directory === ROOT$1) return "the repository root";
|
|
11759
11869
|
return directory;
|
|
@@ -11804,13 +11914,13 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
|
|
|
11804
11914
|
};
|
|
11805
11915
|
// src/features/check-value-owners/model/repository-names.ts
|
|
11806
11916
|
const MANIFEST$2 = "package.json";
|
|
11807
|
-
const SEPARATOR$
|
|
11917
|
+
const SEPARATOR$5 = "/";
|
|
11808
11918
|
const FIRST_SEGMENT = 1;
|
|
11809
11919
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
11810
11920
|
const decodeManifest$6 = Schema.decodeUnknownOption(ManifestJson);
|
|
11811
11921
|
const prefixesOf = (file) => {
|
|
11812
|
-
const segments = pipe(file, String$1.split(SEPARATOR$
|
|
11813
|
-
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$
|
|
11922
|
+
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
11923
|
+
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
11814
11924
|
};
|
|
11815
11925
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
11816
11926
|
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
@@ -11940,7 +12050,7 @@ const destructuredName = (declaration) => {
|
|
|
11940
12050
|
if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
|
|
11941
12051
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
11942
12052
|
};
|
|
11943
|
-
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$
|
|
12053
|
+
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
11944
12054
|
rule: RULE$30,
|
|
11945
12055
|
message: messageOf$1(name)
|
|
11946
12056
|
})), Option.map((report) => report(declaration)));
|
|
@@ -12045,7 +12155,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12045
12155
|
};
|
|
12046
12156
|
const problemOf$4 = (checker) => (candidate) => {
|
|
12047
12157
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12048
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
12158
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
12049
12159
|
rule: RULE$29,
|
|
12050
12160
|
message: messageOf(forward.callee.getText())
|
|
12051
12161
|
})(candidate.name)));
|
|
@@ -12054,7 +12164,7 @@ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(so
|
|
|
12054
12164
|
// src/app/source-checks.ts
|
|
12055
12165
|
/** @internal */
|
|
12056
12166
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
|
|
12057
|
-
//
|
|
12167
|
+
// src/shared/config/masseater-marketplace.json
|
|
12058
12168
|
var name = "masseater-dev";
|
|
12059
12169
|
var plugins = [{
|
|
12060
12170
|
"name": "kogane",
|
|
@@ -12071,17 +12181,10 @@ var plugins = [{
|
|
|
12071
12181
|
},
|
|
12072
12182
|
"description": "CLI for watashi (watashi.masseater.dev). Sends Claude Code transcripts from a Stop hook after masking secrets locally with h56m, and manages login and API tokens."
|
|
12073
12183
|
}];
|
|
12074
|
-
// package.json
|
|
12075
|
-
var repository = {
|
|
12076
|
-
"type": "git",
|
|
12077
|
-
"url": "git+https://github.com/masseater/masseater.dev.git",
|
|
12078
|
-
"directory": "libs/msch"
|
|
12079
|
-
};
|
|
12080
12184
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
12081
12185
|
const RULE$28 = "known-plugins";
|
|
12082
12186
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
12083
12187
|
const GITHUB$2 = "github";
|
|
12084
|
-
const REPOSITORY = /github\.com\/(?<repository>[\w.-]+\/[\w.-]+?)(?:\.git)?$/u;
|
|
12085
12188
|
const Source$1 = Schema.Struct({
|
|
12086
12189
|
source: Schema.String,
|
|
12087
12190
|
repo: Schema.optionalKey(Schema.String)
|
|
@@ -12094,8 +12197,7 @@ const SettingsSchema$1 = Schema.Struct({
|
|
|
12094
12197
|
enabledPlugins: Schema.optionalKey(Plugins$1)
|
|
12095
12198
|
});
|
|
12096
12199
|
const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(SettingsSchema$1));
|
|
12097
|
-
const
|
|
12098
|
-
const REPOSITORY_NAME = repositoryOf(repository.url);
|
|
12200
|
+
const REPOSITORY_NAME = "masseater/masseater.dev";
|
|
12099
12201
|
const MARKETPLACE = name;
|
|
12100
12202
|
const PLUGINS = pipe(plugins, Array.map(({ name }) => `${name}@${MARKETPLACE}`));
|
|
12101
12203
|
const problem$1 = problemInFile(RULE$28);
|
|
@@ -12206,7 +12308,7 @@ const ARGS = "args";
|
|
|
12206
12308
|
const PLACEHOLDER = /[<>*{}$]/u;
|
|
12207
12309
|
const WHITESPACE = /\s+/u;
|
|
12208
12310
|
const ROOT = ".";
|
|
12209
|
-
const SEPARATOR$
|
|
12311
|
+
const SEPARATOR$4 = "/";
|
|
12210
12312
|
const END_OF_OPTIONS = "--";
|
|
12211
12313
|
const FLAG = "-";
|
|
12212
12314
|
const TASK_SEPARATOR$1 = "#";
|
|
@@ -12253,8 +12355,8 @@ const parsed = (args) => {
|
|
|
12253
12355
|
return pipe(specifierOf(tokens), Option.filter(() => !pipe(tokens, Array.some((token) => PLACEHOLDER.test(token)))), Option.map(invocationOf(tokens)));
|
|
12254
12356
|
};
|
|
12255
12357
|
const ancestorsOf$1 = (file) => {
|
|
12256
|
-
const parts = pipe(String$1.split(file, SEPARATOR$
|
|
12257
|
-
return [...Array.makeBy(parts.length, (index) => pipe(parts, Array.take(parts.length - index), Array.join(SEPARATOR$
|
|
12358
|
+
const parts = pipe(String$1.split(file, SEPARATOR$4), Array.dropRight(ONE$1));
|
|
12359
|
+
return [...Array.makeBy(parts.length, (index) => pipe(parts, Array.take(parts.length - index), Array.join(SEPARATOR$4))), ROOT];
|
|
12258
12360
|
};
|
|
12259
12361
|
const named = (graph, name) => (directory) => directory === String$1.replace(LOCAL_PREFIX$1, "")(name) || pipe(Record.get(graph.packages, directory), Option.exists((found) => found.name === name));
|
|
12260
12362
|
const packagesOf = (graph, file) => (scope) => {
|
|
@@ -12278,7 +12380,7 @@ const problemsIn$10 = (graph, absolute, { file, text }) => pipe(Array.fromIterab
|
|
|
12278
12380
|
rule: RULE$26,
|
|
12279
12381
|
message: `${match[START$16]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
12280
12382
|
})), Option.toArray)));
|
|
12281
|
-
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$
|
|
12383
|
+
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$4), Array.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
12282
12384
|
/** @internal */
|
|
12283
12385
|
const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* checkDocumentedCommands(root) {
|
|
12284
12386
|
const files = yield* RepositoryFiles;
|
|
@@ -12421,10 +12523,10 @@ const RULE$24 = "shell-script";
|
|
|
12421
12523
|
const MESSAGE$10 = "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.";
|
|
12422
12524
|
const HookSchema = Schema.Struct({
|
|
12423
12525
|
command: Schema.optional(Schema.String),
|
|
12424
|
-
args: Schema.
|
|
12526
|
+
args: Schema.String.pipe(Schema.Array, Schema.optional)
|
|
12425
12527
|
});
|
|
12426
12528
|
const MatcherSchema = Schema.Struct({ hooks: Schema.Array(HookSchema) });
|
|
12427
|
-
const HooksSchema = Schema.Struct({ SessionStart:
|
|
12529
|
+
const HooksSchema = Schema.Struct({ SessionStart: MatcherSchema.pipe(Schema.Array, Schema.optional) });
|
|
12428
12530
|
const SettingsSchema = Schema.Struct({ hooks: Schema.optional(HooksSchema) });
|
|
12429
12531
|
const decodeSettings = Schema.decodeOption(Schema.fromJsonString(SettingsSchema));
|
|
12430
12532
|
const NO_TEXT = [];
|
|
@@ -12434,7 +12536,6 @@ const sessionStartCommands = (source) => {
|
|
|
12434
12536
|
const matchers = pipe(decodeSettings(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)));
|
|
12435
12537
|
return pipe(matchers, Option.map(Array.flatMap((matcher) => matcherText(matcher))), Option.getOrElse(() => NO_TEXT));
|
|
12436
12538
|
};
|
|
12437
|
-
const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.getOrElse(() => name));
|
|
12438
12539
|
const hasExtension = (name) => EXTENSION.test(baseName(name));
|
|
12439
12540
|
/** @internal */
|
|
12440
12541
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
@@ -12497,12 +12598,7 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
12497
12598
|
};
|
|
12498
12599
|
const problemsIn$9 = (file) => (source) => {
|
|
12499
12600
|
const at = positionOf(source);
|
|
12500
|
-
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => (
|
|
12501
|
-
file,
|
|
12502
|
-
...at(start),
|
|
12503
|
-
rule: RULE$23,
|
|
12504
|
-
message: MESSAGE$9
|
|
12505
|
-
})));
|
|
12601
|
+
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => problemAtPosition(RULE$23)(file, at(start), MESSAGE$9)));
|
|
12506
12602
|
};
|
|
12507
12603
|
/** @internal */
|
|
12508
12604
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
@@ -12527,12 +12623,12 @@ const checkStructure = checkSection({
|
|
|
12527
12623
|
// src/features/check-vite-plus/model/command-words.ts
|
|
12528
12624
|
const CONTINUATION = /\\\n/gu;
|
|
12529
12625
|
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12530
|
-
const SEPARATOR$
|
|
12626
|
+
const SEPARATOR$3 = /&&|\|\||[;|\n`]|\$\(/u;
|
|
12531
12627
|
const BLANK$1 = /\s+/u;
|
|
12532
12628
|
const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
|
|
12533
12629
|
const QUOTE = "\"\"";
|
|
12534
12630
|
const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
|
|
12535
|
-
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$
|
|
12631
|
+
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));
|
|
12536
12632
|
// src/features/check-vite-plus/model/command-problems.ts
|
|
12537
12633
|
const PACKAGE_MANAGERS = [
|
|
12538
12634
|
"pnpm",
|
|
@@ -12834,10 +12930,10 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
12834
12930
|
});
|
|
12835
12931
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
12836
12932
|
const RULE$19 = "publish-trigger";
|
|
12837
|
-
const PUBLISH = /\bmsch-publish\b/u;
|
|
12933
|
+
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
12838
12934
|
const MANUAL = "workflow_dispatch";
|
|
12839
12935
|
const TRIGGER_KEY = "on";
|
|
12840
|
-
const MESSAGE$6 = "publishes with `msch-publish` from a trigger other than `workflow_dispatch`. Publishing is manual: bump the version in a PR, then dispatch the workflow for the workspace.";
|
|
12936
|
+
const MESSAGE$6 = "publishes with `msch-publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Publishing is manual: bump the version in a PR, then dispatch the workflow for the workspace.";
|
|
12841
12937
|
const triggersOf = (node) => {
|
|
12842
12938
|
if (isScalar(node)) return [String(node.value)];
|
|
12843
12939
|
if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
|
|
@@ -12935,6 +13031,7 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
12935
13031
|
checkReleasePlease(root),
|
|
12936
13032
|
checkPublishTrigger(root),
|
|
12937
13033
|
checkRestrictedRules(root),
|
|
13034
|
+
checkTypeExemptions(root),
|
|
12938
13035
|
checkMarkdown(root),
|
|
12939
13036
|
checkLegacyWeb(root),
|
|
12940
13037
|
checkDocumentedCommands(root),
|
|
@@ -12957,42 +13054,34 @@ const trimmed = ({ index, text }) => ({
|
|
|
12957
13054
|
index,
|
|
12958
13055
|
text: String$1.trimEnd(text)
|
|
12959
13056
|
});
|
|
13057
|
+
const commentsFrom = (reader) => (read) => (source) => Effect.try({
|
|
13058
|
+
try: () => pipe(read(source), Array.map(trimmed)),
|
|
13059
|
+
catch: unreadable(reader)
|
|
13060
|
+
});
|
|
12960
13061
|
// src/features/ban-comments/model/config-comments.ts
|
|
12961
13062
|
const NEXT$1 = 1;
|
|
12962
|
-
const yamlComments = (
|
|
12963
|
-
|
|
12964
|
-
catch: unreadable("yaml")
|
|
12965
|
-
});
|
|
12966
|
-
const tomlComments = (source) => Effect.try({
|
|
12967
|
-
try: () => pipe(tomlSourceComments(source), Array.map(trimmed)),
|
|
12968
|
-
catch: unreadable("toml")
|
|
12969
|
-
});
|
|
13063
|
+
const yamlComments = commentsFrom("yaml")(yamlSourceComments);
|
|
13064
|
+
const tomlComments = commentsFrom("toml")(tomlSourceComments);
|
|
12970
13065
|
const isSqlComment = (value) => isRecord(value) && (value["type"] === "line_comment" || value["type"] === "block_comment") && typeof value["text"] === "string" && Array.isArray(value["range"]);
|
|
12971
|
-
const sqlComments = (source) =>
|
|
12972
|
-
|
|
12973
|
-
|
|
12974
|
-
|
|
12975
|
-
|
|
12976
|
-
|
|
12977
|
-
|
|
12978
|
-
|
|
12979
|
-
|
|
12980
|
-
|
|
12981
|
-
|
|
12982
|
-
})));
|
|
12983
|
-
},
|
|
12984
|
-
catch: unreadable("sql")
|
|
13066
|
+
const sqlComments = commentsFrom("sql")((source) => {
|
|
13067
|
+
const program = parse$3(source, {
|
|
13068
|
+
dialect: "sqlite",
|
|
13069
|
+
includeComments: true,
|
|
13070
|
+
includeRange: true,
|
|
13071
|
+
paramTypes: []
|
|
13072
|
+
});
|
|
13073
|
+
return pipe(collectNodes(isSqlComment)(program), Array.map(({ range: [start], text }) => ({
|
|
13074
|
+
index: start,
|
|
13075
|
+
text
|
|
13076
|
+
})));
|
|
12985
13077
|
});
|
|
12986
13078
|
const offsetAt = (lines) => ({ line, character }) => character + pipe(lines, Array.take(line), Array.map((text) => text.length + NEXT$1), Number$1.sumAll);
|
|
12987
|
-
const dockerfileComments = (source) =>
|
|
12988
|
-
|
|
12989
|
-
|
|
12990
|
-
|
|
12991
|
-
|
|
12992
|
-
|
|
12993
|
-
})));
|
|
12994
|
-
},
|
|
12995
|
-
catch: unreadable("dockerfile")
|
|
13079
|
+
const dockerfileComments = commentsFrom("dockerfile")((source) => {
|
|
13080
|
+
const lines = String$1.split(source, "\n");
|
|
13081
|
+
return pipe(DockerfileParser.parse(source).getComments(), Array.map((comment) => ({
|
|
13082
|
+
index: offsetAt(lines)(comment.getRange().start),
|
|
13083
|
+
text: comment.toString()
|
|
13084
|
+
})));
|
|
12996
13085
|
});
|
|
12997
13086
|
// src/features/ban-comments/model/comment-readers.ts
|
|
12998
13087
|
const GRAMMARS = [
|
|
@@ -13032,17 +13121,14 @@ const loadGrammars = Effect.fn("loadGrammars")(function* loadGrammars() {
|
|
|
13032
13121
|
const commentNodesIn = (language, source) => pipe(readTree({
|
|
13033
13122
|
language,
|
|
13034
13123
|
source,
|
|
13035
|
-
read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) =>
|
|
13124
|
+
read: (root) => pipe(root.descendantsOfType(COMMENT_NODES), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.map((node) => ({
|
|
13036
13125
|
index: node.startIndex,
|
|
13037
13126
|
text: node.text
|
|
13038
13127
|
})))
|
|
13039
13128
|
}), Option.getOrElse(() => NONE$1));
|
|
13040
13129
|
const syntaxComments = (grammars, grammar) => (source) => Option.match(grammars(grammar), {
|
|
13041
13130
|
onNone: () => Effect.fail(unreadable(grammar)("the grammar is not loaded")),
|
|
13042
|
-
onSome: (language) =>
|
|
13043
|
-
try: () => commentNodesIn(language, source),
|
|
13044
|
-
catch: unreadable(grammar)
|
|
13045
|
-
})
|
|
13131
|
+
onSome: (language) => commentsFrom(grammar)((text) => commentNodesIn(language, text))(source)
|
|
13046
13132
|
});
|
|
13047
13133
|
const SCRIPT_TYPE = /^(?:|module|text\/javascript|application\/javascript)$/iu;
|
|
13048
13134
|
const SHADER_TYPE = /shader|glsl/iu;
|
|
@@ -13197,14 +13283,14 @@ const rootSettings = Effect.fn("rootSettings")(function* rootSettings(root) {
|
|
|
13197
13283
|
}));
|
|
13198
13284
|
});
|
|
13199
13285
|
const directivePattern = (directives) => new RegExp(String.raw`^\s?(?:${Array.join(directives, "|")})`, "u");
|
|
13200
|
-
const isIgnored = (patterns) => (name) => pipe(patterns, Array.some((pattern) => path.matchesGlob(name, pattern)));
|
|
13201
13286
|
const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, settings) {
|
|
13202
13287
|
const files = yield* RepositoryFiles;
|
|
13203
13288
|
const listed = yield* files.listedFiles(root);
|
|
13204
13289
|
const generated = yield* files.generatedFiles(root);
|
|
13205
13290
|
const vendored = yield* files.matchingFiles(root, [VENDORED_PATHSPEC]);
|
|
13291
|
+
const isIgnored = matcher(settings.ignorePatterns);
|
|
13206
13292
|
const skipped = HashSet.fromIterable([...generated, ...pipe(vendored, Array.map((name) => files.join(root, name)))]);
|
|
13207
|
-
return pipe(listed, Array.filter((name) => !isIgnored(
|
|
13293
|
+
return pipe(listed, Array.filter((name) => !isIgnored(name)), Array.map((name) => ({
|
|
13208
13294
|
name,
|
|
13209
13295
|
file: files.join(root, name)
|
|
13210
13296
|
})), Array.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
@@ -13235,6 +13321,11 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13235
13321
|
const PROGRAM_SOURCE = /\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;
|
|
13236
13322
|
const CONFIG_SOURCE = /(?:^|\/)[^/]*\.config\.[cm]?[jt]s$/u;
|
|
13237
13323
|
const isProgramSource = ({ name }) => PROGRAM_SOURCE.test(name) && !CONFIG_SOURCE.test(name);
|
|
13324
|
+
const patternsBy = ({ spawn, command, toolVersions = [] }) => (entry) => {
|
|
13325
|
+
if (isProgramSource(entry)) return spawn;
|
|
13326
|
+
if (isToolVersions(entry)) return [...command, ...toolVersions];
|
|
13327
|
+
return command;
|
|
13328
|
+
};
|
|
13238
13329
|
const spawnPattern = (program) => new RegExp(String.raw`(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make)\(\s*|\$\(\s*|\$\s*(?=\x60))["'\x60](?:${program})(?=["'\x60\s])`, "gu");
|
|
13239
13330
|
const FIRST_LINE$3 = 1;
|
|
13240
13331
|
const FIRST_COLUMN$2 = 1;
|
|
@@ -13274,16 +13365,15 @@ const COMMAND_PATTERNS$1 = [
|
|
|
13274
13365
|
...SPAWN_PATTERNS$1,
|
|
13275
13366
|
/\buses:\s*["']?docker(?:\/[\w.-]+|:\/\/)/gu
|
|
13276
13367
|
];
|
|
13277
|
-
const patternsFor$1 = (entry) => {
|
|
13278
|
-
if (isProgramSource(entry)) return SPAWN_PATTERNS$1;
|
|
13279
|
-
return COMMAND_PATTERNS$1;
|
|
13280
|
-
};
|
|
13281
13368
|
const renameOf = ({ name }) => pipe(RENAMES, Array.findFirst(([pattern]) => pattern.test(name)), Option.map(([, renamed]) => renamed));
|
|
13282
13369
|
const DOCKER = {
|
|
13283
13370
|
fileRule: "docker-file",
|
|
13284
13371
|
commandRule: "docker-command",
|
|
13285
13372
|
isFile: (entry) => Option.isSome(renameOf(entry)),
|
|
13286
|
-
patternsFor:
|
|
13373
|
+
patternsFor: patternsBy({
|
|
13374
|
+
spawn: SPAWN_PATTERNS$1,
|
|
13375
|
+
command: COMMAND_PATTERNS$1
|
|
13376
|
+
}),
|
|
13287
13377
|
fileMessage: (entry) => `Docker is not used in this repository: podman builds and runs containers. Name this file ${Option.getOrElse(renameOf(entry), () => "for podman")}, the name podman reads.`,
|
|
13288
13378
|
commandMessage: (command) => `Docker is not used in this repository. Replace \`${command}\` with podman, which takes the same arguments.`
|
|
13289
13379
|
};
|
|
@@ -13292,27 +13382,24 @@ const checkDocker = (root) => checkBannedTool(root, DOCKER);
|
|
|
13292
13382
|
// src/features/ban-tools/model/python.ts
|
|
13293
13383
|
const PYTHON_FILE = /(?:\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\/)(?:pyproject\.toml|uv\.lock|uv\.toml|poetry\.lock|Pipfile|Pipfile\.lock|setup\.cfg|tox\.ini|pytest\.ini|\.python-version|requirements[^/]*\.txt))$/u;
|
|
13294
13384
|
const SPAWN_PATTERNS = [spawnPattern(String.raw`python[\d.]*|pip3?|pipx|uvx?|poetry`)];
|
|
13295
|
-
const COMMAND_PATTERNS = [
|
|
13296
|
-
/(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
|
|
13297
|
-
/(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
|
|
13298
|
-
/(?<![\w./@-])pipx[ \t]+(?:run|install|inject|upgrade)\b/gu,
|
|
13299
|
-
/(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
|
|
13300
|
-
/(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
|
|
13301
|
-
/(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
|
|
13302
|
-
...SPAWN_PATTERNS,
|
|
13303
|
-
/\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
|
|
13304
|
-
];
|
|
13305
|
-
const TOOL_PATTERNS$1 = [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
13306
|
-
const patternsFor = (entry) => {
|
|
13307
|
-
if (isProgramSource(entry)) return SPAWN_PATTERNS;
|
|
13308
|
-
if (isToolVersions(entry)) return [...COMMAND_PATTERNS, ...TOOL_PATTERNS$1];
|
|
13309
|
-
return COMMAND_PATTERNS;
|
|
13310
|
-
};
|
|
13311
13385
|
const PYTHON = {
|
|
13312
13386
|
fileRule: "python-file",
|
|
13313
13387
|
commandRule: "python-command",
|
|
13314
13388
|
isFile: ({ name }) => PYTHON_FILE.test(name),
|
|
13315
|
-
patternsFor
|
|
13389
|
+
patternsFor: patternsBy({
|
|
13390
|
+
spawn: SPAWN_PATTERNS,
|
|
13391
|
+
command: [
|
|
13392
|
+
/(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
|
|
13393
|
+
/(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
|
|
13394
|
+
/(?<![\w./@-])pipx[ \t]+(?:run|install|inject|upgrade)\b/gu,
|
|
13395
|
+
/(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
|
|
13396
|
+
/(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
|
|
13397
|
+
/(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
|
|
13398
|
+
...SPAWN_PATTERNS,
|
|
13399
|
+
/\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
|
|
13400
|
+
],
|
|
13401
|
+
toolVersions: [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu]
|
|
13402
|
+
}),
|
|
13316
13403
|
fileMessage: () => "Python is not used in this repository. Replace this file with TypeScript or Rust.",
|
|
13317
13404
|
commandMessage: (command) => `Python is not used in this repository. Remove \`${command}\` and do the work in TypeScript or Rust.`
|
|
13318
13405
|
};
|
|
@@ -13411,7 +13498,7 @@ const VISIBLE_RULE = "skill-source-visible";
|
|
|
13411
13498
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
13412
13499
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13413
13500
|
const SOURCE = "masseater/skills";
|
|
13414
|
-
const PRESET$1 = "github>masseater/
|
|
13501
|
+
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
13415
13502
|
const START$11 = 0;
|
|
13416
13503
|
const LOCAL_PREFIX = "./";
|
|
13417
13504
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
@@ -13478,14 +13565,13 @@ const SKILLS = "skills";
|
|
|
13478
13565
|
const MANIFEST_FILE = "package.json";
|
|
13479
13566
|
const SKILL_FILE$1 = "SKILL.md";
|
|
13480
13567
|
const SUCCEEDED = 0;
|
|
13481
|
-
const SYNC = "Run vp exec intent maintainer sync in the repository root.";
|
|
13482
13568
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
13483
13569
|
const problemAt$2 = problemInFile(RULE$14);
|
|
13484
13570
|
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
|
|
13485
13571
|
const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
|
|
13486
13572
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
13487
|
-
const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them.
|
|
13488
|
-
const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them.
|
|
13573
|
+
const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
|
|
13574
|
+
const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
|
|
13489
13575
|
return Array.getSomes([keyword, unshipped]);
|
|
13490
13576
|
};
|
|
13491
13577
|
const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
|
|
@@ -13506,7 +13592,7 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project)
|
|
|
13506
13592
|
const directory = files.join(root, project.directory);
|
|
13507
13593
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
13508
13594
|
const skills = skillDirectoriesIn(files, directory);
|
|
13509
|
-
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without
|
|
13595
|
+
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
|
|
13510
13596
|
const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
13511
13597
|
return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
|
|
13512
13598
|
});
|
|
@@ -13533,7 +13619,7 @@ const FRAGMENT = /#.*$/u;
|
|
|
13533
13619
|
const GITHUB = "https://github.com/";
|
|
13534
13620
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
13535
13621
|
const BLANK = /\s+/u;
|
|
13536
|
-
const SEPARATOR$
|
|
13622
|
+
const SEPARATOR$2 = "/";
|
|
13537
13623
|
const START$10 = 0;
|
|
13538
13624
|
const FIRST$3 = 1;
|
|
13539
13625
|
const READ_CONCURRENCY$5 = 16;
|
|
@@ -13609,7 +13695,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13609
13695
|
const files = yield* RepositoryFiles;
|
|
13610
13696
|
const file = files.join(root, name);
|
|
13611
13697
|
const directory = files.dirname(name);
|
|
13612
|
-
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$
|
|
13698
|
+
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
|
|
13613
13699
|
const text = yield* files.readFile(file);
|
|
13614
13700
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
13615
13701
|
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
|
|
@@ -13673,12 +13759,12 @@ const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map
|
|
|
13673
13759
|
};
|
|
13674
13760
|
}), Option.toArray);
|
|
13675
13761
|
const manifestEntries = (text) => {
|
|
13676
|
-
const manifest =
|
|
13762
|
+
const manifest = decodeJson(text).pipe(Option.getOrUndefined, fieldsOf$1);
|
|
13677
13763
|
return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
|
|
13678
13764
|
};
|
|
13679
13765
|
const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf$1(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
13680
13766
|
const workspaceEntries = (text) => {
|
|
13681
|
-
const settings =
|
|
13767
|
+
const settings = Option.liftThrowable(() => parse$2(text))().pipe(Option.getOrUndefined, fieldsOf$1);
|
|
13682
13768
|
return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings["catalogs"])];
|
|
13683
13769
|
};
|
|
13684
13770
|
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf$1), Option.getOrElse(() => ({})));
|
|
@@ -13759,7 +13845,7 @@ const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)
|
|
|
13759
13845
|
const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
13760
13846
|
const CAP_RULE = "renovate-version-cap";
|
|
13761
13847
|
const PRESET_RULE = "renovate-msch-preset";
|
|
13762
|
-
const PRESET = "github>masseater/
|
|
13848
|
+
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
13763
13849
|
const START$9 = 0;
|
|
13764
13850
|
const READ_CONCURRENCY$3 = 16;
|
|
13765
13851
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
@@ -13864,7 +13950,7 @@ const SCOPE$1 = "@r_masseater/";
|
|
|
13864
13950
|
const RULE$9 = "applied-package";
|
|
13865
13951
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
13866
13952
|
const NOT_FOUND = -1;
|
|
13867
|
-
const SEPARATOR$
|
|
13953
|
+
const SEPARATOR$1 = "/";
|
|
13868
13954
|
const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
|
|
13869
13955
|
const BinMap = Schema.Record(Schema.String, Schema.String);
|
|
13870
13956
|
const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
|
|
@@ -13878,7 +13964,7 @@ const declaredNames = (manifest) => pipe([
|
|
|
13878
13964
|
const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
|
|
13879
13965
|
onNone: () => [],
|
|
13880
13966
|
onSome: (bin) => {
|
|
13881
|
-
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$
|
|
13967
|
+
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
|
|
13882
13968
|
return Record.keys(bin);
|
|
13883
13969
|
}
|
|
13884
13970
|
}));
|
|
@@ -13912,7 +13998,7 @@ const problemAt$1 = (file, source) => (index, name) => ({
|
|
|
13912
13998
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
13913
13999
|
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
13914
14000
|
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$1(file, source)(found.index ?? NOT_FOUND, entry.name)))));
|
|
13915
|
-
const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$
|
|
14001
|
+
const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
|
|
13916
14002
|
onEmpty: () => "",
|
|
13917
14003
|
onNonEmpty: Array.max(BY_LENGTH)
|
|
13918
14004
|
}));
|
|
@@ -14054,7 +14140,7 @@ const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplac
|
|
|
14054
14140
|
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
14055
14141
|
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
14056
14142
|
const PNPM_DIRECTORY = ".pnpm/";
|
|
14057
|
-
const SEPARATOR
|
|
14143
|
+
const SEPARATOR = "/";
|
|
14058
14144
|
const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
|
|
14059
14145
|
const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
|
|
14060
14146
|
const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
|
|
@@ -14124,10 +14210,10 @@ const isCargoManifest = matches(CARGO_MANIFEST_FILE);
|
|
|
14124
14210
|
const isForeignLockfile = matches(FOREIGN_LOCKFILE);
|
|
14125
14211
|
const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
|
|
14126
14212
|
const isPnpmOutput = matches(PNPM_OUTPUT);
|
|
14127
|
-
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR
|
|
14213
|
+
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
|
|
14128
14214
|
const ancestorsOf = (directory) => {
|
|
14129
|
-
const parts = String$1.split(directory, SEPARATOR
|
|
14130
|
-
return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR
|
|
14215
|
+
const parts = String$1.split(directory, SEPARATOR);
|
|
14216
|
+
return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
|
|
14131
14217
|
};
|
|
14132
14218
|
const readsCargoLock = (manifests, workspaces) => ({ name }) => {
|
|
14133
14219
|
const directory = directoryOf(name);
|
|
@@ -14544,7 +14630,6 @@ const RULE$1 = "unused-workspace";
|
|
|
14544
14630
|
const CARGO_FILE = "Cargo.toml";
|
|
14545
14631
|
const ROOT_DIRECTORY = "";
|
|
14546
14632
|
const TASK_SEPARATOR = "#";
|
|
14547
|
-
const SEPARATOR = "/";
|
|
14548
14633
|
const START = 0;
|
|
14549
14634
|
const FIRST$1 = 1;
|
|
14550
14635
|
const READ_CONCURRENCY = 8;
|
|
@@ -14597,7 +14682,6 @@ const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directo
|
|
|
14597
14682
|
const config = yield* workspaceConfigOf(root, directory);
|
|
14598
14683
|
return pipe(config, Option.map(({ program }) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))))), Option.getOrElse(() => []));
|
|
14599
14684
|
});
|
|
14600
|
-
const isWithin = (directory) => (file) => String$1.startsWith(`${directory}${SEPARATOR}`)(file);
|
|
14601
14685
|
const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
|
|
14602
14686
|
const { root, directory, crateLibraries, deployed } = request;
|
|
14603
14687
|
const files = yield* RepositoryFiles;
|
|
@@ -14606,7 +14690,7 @@ const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
|
|
|
14606
14690
|
directory,
|
|
14607
14691
|
name: Option.fromUndefinedOr(manifest.name),
|
|
14608
14692
|
library: Predicate.isNotUndefined(manifest.exports) || Predicate.isNotUndefined(manifest.main) || Array.contains(crateLibraries, directory),
|
|
14609
|
-
entry: manifest.private !== true || Predicate.isNotUndefined(manifest.bin) || pipe(deployed, Array.some(
|
|
14693
|
+
entry: manifest.private !== true || Predicate.isNotUndefined(manifest.bin) || pipe(deployed, Array.some(isInside(directory)))
|
|
14610
14694
|
})));
|
|
14611
14695
|
});
|
|
14612
14696
|
const linksTo = (members, from) => (name) => pipe(members, Array.filter((member) => Option.contains(member.name, name)), Array.map(({ directory }) => ({
|
|
@@ -14718,7 +14802,7 @@ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
|
|
|
14718
14802
|
checkPublishedPackages(root),
|
|
14719
14803
|
checkWorkspaces(root),
|
|
14720
14804
|
checkToolUse(root),
|
|
14721
|
-
|
|
14805
|
+
checkBuilds(root)
|
|
14722
14806
|
], { concurrency: "unbounded" });
|
|
14723
14807
|
return Array.flatten(found);
|
|
14724
14808
|
});
|