@r_masseater/msch 0.40.0 → 0.42.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 +7 -0
- package/dist/cargo-inputs.d.mts +14 -0
- package/dist/cargo-inputs.mjs +226 -0
- package/dist/cargo-inputs.mjs.map +1 -0
- package/dist/{cli-contract-8SnKqhGw.mjs → cli-contract-DdTV5DaG.mjs} +2 -2
- package/dist/{cli-contract-8SnKqhGw.mjs.map → cli-contract-DdTV5DaG.mjs.map} +1 -1
- package/dist/cli.mjs +771 -723
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +9 -6
- package/dist/config.mjs.map +1 -1
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-BYMl7wof.mjs → define-lint-preset-DKJku2ZR.mjs} +124 -85
- package/dist/define-lint-preset-DKJku2ZR.mjs.map +1 -0
- package/dist/ignored-directories-CfACwIvu.mjs +50 -0
- package/dist/ignored-directories-CfACwIvu.mjs.map +1 -0
- package/dist/{index-lM4Pphgz.d.mts → index-BwiAHe_u.d.mts} +21 -16
- package/dist/{index-CcVKuHBw.d.mts → index-DdJXnW1q.d.mts} +2 -2
- package/dist/lint.d.mts +2 -2
- package/dist/lint.mjs +1 -1
- package/dist/oxlint.mjs +1 -1
- package/dist/{package-A62qq8pE.mjs → package-vbK0Qycn.mjs} +2 -2
- package/dist/{package-A62qq8pE.mjs.map → package-vbK0Qycn.mjs.map} +1 -1
- package/dist/publish.d.mts +1 -0
- package/dist/publish.mjs +578 -0
- package/dist/publish.mjs.map +1 -0
- package/dist/{repository-files-CorshdqY.mjs → repository-files-CPfBA4mf.mjs} +7 -1
- package/dist/repository-files-CPfBA4mf.mjs.map +1 -0
- package/dist/runtime-Dc5gCUSF.mjs +29 -0
- package/dist/runtime-Dc5gCUSF.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +6 -63
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +17 -7
- package/skills/msch-checks/SKILL.md +0 -5
- package/skills/publishing/SKILL.md +44 -0
- package/skills/repository-config/SKILL.md +8 -7
- package/src/app/vite.d.ts +4 -0
- package/dist/define-lint-preset-BYMl7wof.mjs.map +0 -1
- package/dist/repository-files-CorshdqY.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { B as stringsIn, E as hasVerifyTask, F as childrenOf$2, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as definesTask, _ as publishedProjects, a as publicEntriesOf, b as runTasksOf, c as readManifest, d as lockedPackages, f as deployEntries, i as EntryManifestJson, l as workspaceDependencies, m as patternOf$1, o as MANIFEST_FILE$
|
|
3
|
-
import { a as groupOf$2,
|
|
2
|
+
import { B as stringsIn, E as hasVerifyTask, F as childrenOf$2, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as definesTask, _ as publishedProjects, a as publicEntriesOf, b as runTasksOf, c as readManifest, d as lockedPackages, f as deployEntries, i as EntryManifestJson, l as workspaceDependencies, m as patternOf$1, o as MANIFEST_FILE$3, p as namedWorkspaces, r as publishedWorkspaces, s as dependencyEntries, u as lockedGraph, v as workspaceDirectories, w as VERIFY_TASK, y as workspaceManifest, z as propertyValue } from "./package-vbK0Qycn.mjs";
|
|
3
|
+
import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-CPfBA4mf.mjs";
|
|
4
4
|
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-5-f_qs1E.mjs";
|
|
5
|
-
import { $ as isPropertyAccessExpression, A as getLeadingCommentRanges, B as isEnumDeclaration, C as uniqueByReference, D as SignatureKind, E as InternalSymbolName, F as isBinaryExpression, G as isImportDeclaration, H as isFunctionDeclaration, I as isBlock, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isCallExpression, M as getTextOfJSDocComment, N as isArrayLiteralExpression, O as SyntaxKind, P as isArrowFunction, Q as isParenthesizedExpression, R as isClassDeclaration, S as symbolAt, T as IndexKind, U as isFunctionExpression, V as isExportDeclaration, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as lineOf$3, a as problemAt$9, at as isSpreadElement, b as referencedSymbols, c as columnOf, ct as isTypeLiteralNode, d as descendantsOf, dt as isVariableDeclaration, et as isPropertyAssignment, f as importedModulesOf, ft as isVariableDeclarationList, g as isTypeDeclaration, h as isInsideAny, i as formatProblem, it as isSourceFile, j as getNameOfDeclaration, k as getJSDocTags, l as contains, lt as isTypeReferenceNode, m as isGenericDeclaration, n as ProblemList, nt as isSatisfiesExpression, o as sortProblems, ot as isStringLiteral, p as isExternalDeclaration, pt as isVariableStatement, q as isModuleBlock, rt as isSignatureDeclaration, s as childrenOf$3, st as isTypeAliasDeclaration, tt as isReturnStatement, u as declarationsOf, ut as isUnionTypeNode, v as packageOf$1, w as API, x as resolvedSymbol, y as propertyNamesOf, z as isElementAccessExpression } from "./cli-contract-
|
|
5
|
+
import { $ as isPropertyAccessExpression, A as getLeadingCommentRanges, B as isEnumDeclaration, C as uniqueByReference, D as SignatureKind, E as InternalSymbolName, F as isBinaryExpression, G as isImportDeclaration, H as isFunctionDeclaration, I as isBlock, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isCallExpression, M as getTextOfJSDocComment, N as isArrayLiteralExpression, O as SyntaxKind, P as isArrowFunction, Q as isParenthesizedExpression, R as isClassDeclaration, S as symbolAt, T as IndexKind, U as isFunctionExpression, V as isExportDeclaration, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as lineOf$3, a as problemAt$9, at as isSpreadElement, b as referencedSymbols, c as columnOf, ct as isTypeLiteralNode, d as descendantsOf, dt as isVariableDeclaration, et as isPropertyAssignment, f as importedModulesOf, ft as isVariableDeclarationList, g as isTypeDeclaration, h as isInsideAny, i as formatProblem, it as isSourceFile, j as getNameOfDeclaration, k as getJSDocTags, l as contains, lt as isTypeReferenceNode, m as isGenericDeclaration, n as ProblemList, nt as isSatisfiesExpression, o as sortProblems, ot as isStringLiteral, p as isExternalDeclaration, pt as isVariableStatement, q as isModuleBlock, rt as isSignatureDeclaration, s as childrenOf$3, st as isTypeAliasDeclaration, tt as isReturnStatement, u as declarationsOf, ut as isUnionTypeNode, v as packageOf$1, w as API, x as resolvedSymbol, y as propertyNamesOf, z as isElementAccessExpression } from "./cli-contract-DdTV5DaG.mjs";
|
|
6
|
+
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-Dc5gCUSF.mjs";
|
|
6
7
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
7
|
-
import { Array,
|
|
8
|
+
import { Array, Boolean as Boolean$1, Config, Effect, FileSystem, Function, HashMap, HashSet, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
8
9
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
9
10
|
import { ChildProcess } from "effect/process";
|
|
10
11
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -14,6 +15,8 @@ import treeSitter from "@vscode/tree-sitter-wasm";
|
|
|
14
15
|
import { Parser, isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
|
|
15
16
|
import semver from "semver";
|
|
16
17
|
import { diagnosticDetail, lint, markdownPathspecs, y8Section } from "@r_masseater/y8";
|
|
18
|
+
import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
|
|
19
|
+
import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4";
|
|
17
20
|
import path from "node:path";
|
|
18
21
|
import { isComment, isTag, isText } from "domhandler";
|
|
19
22
|
import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
|
|
@@ -21,9 +24,6 @@ import { DockerfileParser } from "dockerfile-ast";
|
|
|
21
24
|
import { parse as parse$3 } from "sql-parser-cst";
|
|
22
25
|
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
23
26
|
import { findSkillFiles } from "@tanstack/intent";
|
|
24
|
-
import { runMain } from "@effect/platform-node-shared/NodeRuntime";
|
|
25
|
-
import { FetchHttpClient } from "effect/http";
|
|
26
|
-
import { Otlp, OtlpSerialization } from "effect/observability";
|
|
27
27
|
// src/features/check-overrides/model/override-findings.ts
|
|
28
28
|
const describeVersions = (versions) => Option.getOrElse(Option.liftPredicate(Array.join(versions, ","), (joined) => joined !== ""), () => "-");
|
|
29
29
|
const describeChanges = (report) => {
|
|
@@ -50,10 +50,10 @@ const overrideProblem = (located) => (report) => {
|
|
|
50
50
|
return Option.none();
|
|
51
51
|
};
|
|
52
52
|
// src/shared/lib/text-position.ts
|
|
53
|
-
const START$
|
|
53
|
+
const START$16 = 0;
|
|
54
54
|
const FIRST_COLUMN$4 = 1;
|
|
55
55
|
const positionOf = (source) => (index) => {
|
|
56
|
-
const before = pipe(source, String$1.slice(START$
|
|
56
|
+
const before = pipe(source, String$1.slice(START$16, index), String$1.split("\n"));
|
|
57
57
|
return {
|
|
58
58
|
line: before.length,
|
|
59
59
|
column: pipe(Array.last(before), Option.match({
|
|
@@ -208,12 +208,12 @@ const RESOLUTION_FILES = [
|
|
|
208
208
|
];
|
|
209
209
|
const RESOLUTION_CONCURRENCY = 4;
|
|
210
210
|
const SUCCEEDED$1 = 0;
|
|
211
|
-
const taggedError$
|
|
212
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
211
|
+
const taggedError$6 = Schema.TaggedError;
|
|
212
|
+
var OverrideResolutionFailed = class extends taggedError$6()("OverrideResolutionFailed", {
|
|
213
213
|
override: Schema.String,
|
|
214
214
|
output: Schema.String
|
|
215
215
|
}) {};
|
|
216
|
-
const textOf
|
|
216
|
+
const textOf = (stream) => stream.pipe(Stream.decodeText(), Stream.mkString);
|
|
217
217
|
const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override) {
|
|
218
218
|
const handle = yield* ChildProcess.make("vp", [
|
|
219
219
|
"install",
|
|
@@ -227,7 +227,7 @@ const resolveIn = Effect.fn("resolveIn")(function* resolveIn(directory, override
|
|
|
227
227
|
extendEnv: true,
|
|
228
228
|
stdin: "ignore"
|
|
229
229
|
});
|
|
230
|
-
const [output, status] = yield* Effect.all([textOf
|
|
230
|
+
const [output, status] = yield* Effect.all([textOf(handle.all), handle.exitCode], { concurrency: "unbounded" });
|
|
231
231
|
if (Number(status) !== SUCCEEDED$1) return yield* OverrideResolutionFailed.make({
|
|
232
232
|
override,
|
|
233
233
|
output
|
|
@@ -244,7 +244,7 @@ const auditIn = Effect.fn("auditIn")(function* auditIn(directory) {
|
|
|
244
244
|
extendEnv: true,
|
|
245
245
|
stdin: "ignore"
|
|
246
246
|
});
|
|
247
|
-
const [report] = yield* Effect.all([textOf
|
|
247
|
+
const [report] = yield* Effect.all([textOf(handle.stdout), handle.exitCode], { concurrency: "unbounded" });
|
|
248
248
|
return advisoriesIn(report);
|
|
249
249
|
}, Effect.scoped);
|
|
250
250
|
const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* trackedFiles(root) {
|
|
@@ -254,7 +254,7 @@ const trackedResolutionFiles = Effect.fn("trackedResolutionFiles")(function* tra
|
|
|
254
254
|
"--",
|
|
255
255
|
...RESOLUTION_FILES
|
|
256
256
|
], { cwd: root });
|
|
257
|
-
const listed = yield* textOf
|
|
257
|
+
const listed = yield* textOf(handle.stdout);
|
|
258
258
|
return pipe(String$1.split(listed, "\0"), Array.filter(String$1.isNonEmpty));
|
|
259
259
|
}, Effect.scoped);
|
|
260
260
|
const copyFiles = Effect.fn("copyFiles")(function* copyFiles(workspace, directory) {
|
|
@@ -330,13 +330,13 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
330
330
|
const SCANNED_FILE = /(?:\.(?:[cm]?[jt]sx?|jsonc?|toml|ya?ml|sh|bash|zsh|fish|rs|cs|go|mk)|(?:^|\/)(?:(?:Dockerfile|Containerfile)[^/]*|Makefile|justfile|\.tool-versions|[^./][^./]*))$/u;
|
|
331
331
|
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
332
332
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
333
|
-
const READ_CONCURRENCY$
|
|
333
|
+
const READ_CONCURRENCY$28 = 64;
|
|
334
334
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
335
335
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
336
336
|
/** @internal */
|
|
337
337
|
const listedFiles = Effect.fn("listedFiles")(function* listedFiles(root) {
|
|
338
338
|
const files = yield* RepositoryFiles;
|
|
339
|
-
const names = yield* files.
|
|
339
|
+
const names = yield* files.ownedFiles(root);
|
|
340
340
|
return pipe(names, Array.map((name) => ({
|
|
341
341
|
name,
|
|
342
342
|
file: files.join(root, name)
|
|
@@ -353,61 +353,61 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
353
353
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
354
354
|
onNone: () => [],
|
|
355
355
|
onSome: (source) => problemsIn(entry, source)
|
|
356
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
356
|
+
}))), { concurrency: READ_CONCURRENCY$28 });
|
|
357
357
|
return Array.flatten(found);
|
|
358
358
|
});
|
|
359
359
|
// src/features/check-overrides/model/git-subpath.ts
|
|
360
360
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
361
361
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
362
|
-
const RULE$
|
|
362
|
+
const RULE$45 = "git-subpath-dependency";
|
|
363
363
|
const WHOLE_MATCH$3 = 0;
|
|
364
364
|
const problemAt$8 = ({ file }, source) => (found) => ({
|
|
365
365
|
file,
|
|
366
366
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
367
|
-
rule: RULE$
|
|
367
|
+
rule: RULE$45,
|
|
368
368
|
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$3])}\`.`
|
|
369
369
|
});
|
|
370
|
-
const problemsIn$
|
|
370
|
+
const problemsIn$16 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$8(entry, source)));
|
|
371
371
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
372
372
|
/** @internal */
|
|
373
373
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
374
374
|
const listed = yield* listedFiles(root);
|
|
375
|
-
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$
|
|
375
|
+
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$16);
|
|
376
376
|
});
|
|
377
377
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
378
|
-
const RULE$
|
|
378
|
+
const RULE$44 = "unnamed-restriction";
|
|
379
379
|
const WHOLE_MATCH$2 = 0;
|
|
380
380
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
381
|
-
const problemsIn$
|
|
381
|
+
const problemsIn$15 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
382
382
|
file: entry.file,
|
|
383
383
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
384
|
-
rule: RULE$
|
|
384
|
+
rule: RULE$44,
|
|
385
385
|
message: `${found[WHOLE_MATCH$2]} 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.`
|
|
386
386
|
})));
|
|
387
387
|
/** @internal */
|
|
388
388
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
389
389
|
const listed = yield* listedFiles(root);
|
|
390
|
-
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$
|
|
390
|
+
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$15);
|
|
391
391
|
});
|
|
392
392
|
// src/features/check-overrides/model/package-registry.ts
|
|
393
|
-
const RULE$
|
|
393
|
+
const RULE$43 = "package-registry";
|
|
394
394
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
395
395
|
const TRAILING_SLASH = /\/$/u;
|
|
396
396
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
397
397
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
398
398
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
399
399
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
400
|
-
const START$
|
|
400
|
+
const START$15 = 0;
|
|
401
401
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
402
402
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
403
403
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
404
404
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
405
405
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
406
|
-
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
406
|
+
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$15));
|
|
407
407
|
const workspaceProblem = (file, source, registry) => ({
|
|
408
408
|
file,
|
|
409
409
|
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
410
|
-
rule: RULE$
|
|
410
|
+
rule: RULE$43,
|
|
411
411
|
message: Option.match(registry, {
|
|
412
412
|
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$4}.`,
|
|
413
413
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
@@ -415,9 +415,9 @@ const workspaceProblem = (file, source, registry) => ({
|
|
|
415
415
|
});
|
|
416
416
|
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) => ({
|
|
417
417
|
file: entry.file,
|
|
418
|
-
...positionOf(source)(found.index ?? START$
|
|
419
|
-
rule: RULE$
|
|
420
|
-
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
418
|
+
...positionOf(source)(found.index ?? START$15),
|
|
419
|
+
rule: RULE$43,
|
|
420
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$15])}\`. Remove the line.`
|
|
421
421
|
})));
|
|
422
422
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
423
423
|
const files = yield* RepositoryFiles;
|
|
@@ -436,36 +436,36 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
436
436
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
437
437
|
});
|
|
438
438
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
439
|
-
const RULE$
|
|
439
|
+
const RULE$42 = "colocated-git-patterns";
|
|
440
440
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
441
441
|
const ROOT$2 = ".";
|
|
442
|
-
const SEPARATOR$
|
|
442
|
+
const SEPARATOR$21 = "/";
|
|
443
443
|
const NEGATION$1 = "!";
|
|
444
444
|
const COMMENT$1 = "#";
|
|
445
445
|
const ANY_DEPTH = "**";
|
|
446
|
-
const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$
|
|
446
|
+
const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$21}`;
|
|
447
447
|
const LEADING_SLASHES = /^\/+/u;
|
|
448
448
|
const TRAILING_SLASHES = /\/+$/u;
|
|
449
449
|
const SPACES = /\s+/u;
|
|
450
|
-
const FIRST$
|
|
451
|
-
const READ_CONCURRENCY$
|
|
452
|
-
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$
|
|
450
|
+
const FIRST$22 = 1;
|
|
451
|
+
const READ_CONCURRENCY$27 = 16;
|
|
452
|
+
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$21}`)(inner));
|
|
453
453
|
const withoutPrefix = (prefix, text) => {
|
|
454
454
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
455
455
|
return text;
|
|
456
456
|
};
|
|
457
457
|
const isAnchored = (pattern) => {
|
|
458
458
|
const body = withoutPrefix(NEGATION$1, pattern);
|
|
459
|
-
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$
|
|
459
|
+
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes(SEPARATOR$21));
|
|
460
460
|
};
|
|
461
|
-
const segmentsOf
|
|
461
|
+
const segmentsOf = ({ directory, pattern }) => {
|
|
462
462
|
const body = withoutPrefix(NEGATION$1, pattern);
|
|
463
463
|
const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
|
|
464
|
-
const own = String$1.split(SEPARATOR$
|
|
464
|
+
const own = String$1.split(SEPARATOR$21)(trimmed);
|
|
465
465
|
if (directory === ROOT$2) return own;
|
|
466
|
-
return [...String$1.split(SEPARATOR$
|
|
466
|
+
return [...String$1.split(SEPARATOR$21)(directory), ...own];
|
|
467
467
|
};
|
|
468
|
-
const depthOf = (directory) => String$1.split(SEPARATOR$
|
|
468
|
+
const depthOf = (directory) => String$1.split(SEPARATOR$21)(directory).length;
|
|
469
469
|
const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
470
470
|
const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
|
|
471
471
|
if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT$1)(pattern)) return Option.none();
|
|
@@ -473,7 +473,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
|
473
473
|
file,
|
|
474
474
|
kind,
|
|
475
475
|
directory,
|
|
476
|
-
line: index + FIRST$
|
|
476
|
+
line: index + FIRST$22,
|
|
477
477
|
pattern,
|
|
478
478
|
values: Array.join(values, " ")
|
|
479
479
|
});
|
|
@@ -488,12 +488,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
488
488
|
const problemAt$7 = (entry, message) => ({
|
|
489
489
|
file: entry.file,
|
|
490
490
|
line: entry.line,
|
|
491
|
-
column: FIRST$
|
|
492
|
-
rule: RULE$
|
|
491
|
+
column: FIRST$22,
|
|
492
|
+
rule: RULE$42,
|
|
493
493
|
message
|
|
494
494
|
});
|
|
495
495
|
const misplacedMessage = (kind, workspaces) => {
|
|
496
|
-
if (workspaces.length === FIRST$
|
|
496
|
+
if (workspaces.length === FIRST$22) {
|
|
497
497
|
const workspace = Array.join(workspaces, "");
|
|
498
498
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
499
499
|
}
|
|
@@ -503,12 +503,12 @@ const matchedAtDepth = Effect.fn("matchedAtDepth")(function* matchedAtDepth(root
|
|
|
503
503
|
const files = yield* RepositoryFiles;
|
|
504
504
|
const leading = Array.take(segments, depth);
|
|
505
505
|
if (Array.contains(leading, ANY_DEPTH)) return [];
|
|
506
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$
|
|
506
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)${Array.join(leading, SEPARATOR$21)}${SEPARATOR$21}${MANIFEST_FILE$3}`]);
|
|
507
507
|
return pipe(manifests, Array.map((manifest) => files.dirname(manifest)));
|
|
508
508
|
});
|
|
509
509
|
const deepestOf = (inner) => pipe(inner, Array.filter((workspace) => !pipe(inner, Array.some(isInside(workspace)))));
|
|
510
510
|
const matchedWorkspaces = Effect.fn("matchedWorkspaces")(function* matchedWorkspaces(root, workspaces, entry) {
|
|
511
|
-
const segments = segmentsOf
|
|
511
|
+
const segments = segmentsOf(entry);
|
|
512
512
|
const candidates = pipe(workspaces, Array.filter(isInside(entry.directory)), Array.filter((workspace) => depthOf(workspace) < segments.length));
|
|
513
513
|
const depths = pipe(candidates, Array.map(depthOf), Array.dedupe);
|
|
514
514
|
const matched = yield* Effect.forEach(depths, (depth) => matchedAtDepth(root, segments, depth), { concurrency: 1 });
|
|
@@ -524,12 +524,12 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
|
|
|
524
524
|
const isFloating = (pattern) => !String$1.startsWith(NEGATION$1)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
|
|
525
525
|
const ownLevelName = (pattern) => {
|
|
526
526
|
if (isFloating(pattern)) return Option.some(pattern);
|
|
527
|
-
const name = withoutPrefix(SEPARATOR$
|
|
527
|
+
const name = withoutPrefix(SEPARATOR$21, pattern);
|
|
528
528
|
return Option.liftPredicate(name, (own) => isFloating(own) && !isAnchored(own));
|
|
529
529
|
};
|
|
530
530
|
const sameName = (outer, name) => {
|
|
531
531
|
if (outer === name) return true;
|
|
532
|
-
return String$1.endsWith(SEPARATOR$
|
|
532
|
+
return String$1.endsWith(SEPARATOR$21)(name) && `${outer}${SEPARATOR$21}` === name;
|
|
533
533
|
};
|
|
534
534
|
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);
|
|
535
535
|
const outerName = ({ directory, kind }) => {
|
|
@@ -543,22 +543,22 @@ const repeated = (entries) => (entry) => {
|
|
|
543
543
|
/** @internal */
|
|
544
544
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
545
545
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
546
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
546
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$27 });
|
|
547
547
|
const entries = Array.flatten(read);
|
|
548
548
|
const workspaces = yield* workspaceDirectories(root);
|
|
549
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
549
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$27 });
|
|
550
550
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
551
551
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
552
552
|
});
|
|
553
553
|
// src/features/check-placement/model/colocated-tests.ts
|
|
554
|
-
const RULE$
|
|
555
|
-
const FIRST$
|
|
556
|
-
const READ_CONCURRENCY$
|
|
554
|
+
const RULE$41 = "colocated-test";
|
|
555
|
+
const FIRST$21 = 1;
|
|
556
|
+
const READ_CONCURRENCY$26 = 64;
|
|
557
557
|
const ROOT_SUBPATH = ".";
|
|
558
558
|
const NAME_GROUP = "name";
|
|
559
559
|
const SPECIFIER_GROUP = "specifier";
|
|
560
|
-
const SCRIPT$
|
|
561
|
-
const TEST_FILE$
|
|
560
|
+
const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
|
|
561
|
+
const TEST_FILE$2 = /\.test\.[cm]?[jt]sx?$/u;
|
|
562
562
|
const MANIFEST_NAME = /package\.json$/u;
|
|
563
563
|
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
|
|
564
564
|
const SPEC_DIRECTORY = /(?:^|\/)specs?\//u;
|
|
@@ -566,24 +566,24 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
566
566
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
567
567
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
568
568
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
569
|
-
const EXCLUDED$
|
|
569
|
+
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
570
570
|
const DIRECTORY_MESSAGE = "sits in a separate test directory. Put each test next to the module it tests, and test-only helpers next to the tests as <name>.test.support.ts.";
|
|
571
571
|
const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test next to the module it tests and import that module, or a helper beside it, with ./<name>.";
|
|
572
|
-
const Manifest$
|
|
572
|
+
const Manifest$4 = Schema.Struct({
|
|
573
573
|
name: Schema.optional(Schema.String),
|
|
574
574
|
exports: Schema.optional(Schema.Unknown)
|
|
575
575
|
});
|
|
576
|
-
const decodeManifest$
|
|
576
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
577
577
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
578
|
-
const problemFor$
|
|
578
|
+
const problemFor$7 = (test, message) => ({
|
|
579
579
|
file: test.file,
|
|
580
|
-
line: FIRST$
|
|
581
|
-
column: FIRST$
|
|
582
|
-
rule: RULE$
|
|
580
|
+
line: FIRST$21,
|
|
581
|
+
column: FIRST$21,
|
|
582
|
+
rule: RULE$41,
|
|
583
583
|
message: `${test.base} ${message}`
|
|
584
584
|
});
|
|
585
585
|
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);
|
|
586
|
-
const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE$
|
|
586
|
+
const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP)], Array.some((name) => !TEST_FILE$2.test(name)));
|
|
587
587
|
const ownerOf$4 = (packages, name) => {
|
|
588
588
|
const owners = pipe(packages, Array.filter((directory) => String$1.startsWith(directory)(name)));
|
|
589
589
|
return Array.last(Array.sort(owners, byLength$2));
|
|
@@ -597,9 +597,9 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
597
597
|
const files = yield* RepositoryFiles;
|
|
598
598
|
const owner = ownerOf$4(context.packages, test.name);
|
|
599
599
|
if (Option.isNone(owner)) return [];
|
|
600
|
-
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$
|
|
600
|
+
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
601
601
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
602
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
602
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(specifiersBeside({
|
|
603
603
|
join,
|
|
604
604
|
dirname: files.dirname,
|
|
605
605
|
directory: test.directory
|
|
@@ -619,21 +619,21 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
619
619
|
});
|
|
620
620
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
621
621
|
const problemIn$6 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
622
|
-
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$
|
|
623
|
-
if (!TEST_FILE$
|
|
622
|
+
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$7(test, DIRECTORY_MESSAGE));
|
|
623
|
+
if (!TEST_FILE$2.test(test.name)) return Option.none();
|
|
624
624
|
if (yield* refersIn(context, test)) return Option.none();
|
|
625
|
-
return Option.some(problemFor$
|
|
625
|
+
return Option.some(problemFor$7(test, SIBLING_MESSAGE));
|
|
626
626
|
});
|
|
627
627
|
/** @internal */
|
|
628
628
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
629
629
|
const files = yield* RepositoryFiles;
|
|
630
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
630
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$5);
|
|
631
631
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
632
632
|
const context = {
|
|
633
633
|
root,
|
|
634
|
-
packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE$
|
|
634
|
+
packages: pipe(names, Array.filter((name) => files.basename(name) === MANIFEST_FILE$3), Array.map(String$1.replace(MANIFEST_NAME, "")))
|
|
635
635
|
};
|
|
636
|
-
const tests = pipe(names, Array.filter((name) => SCRIPT$
|
|
636
|
+
const tests = pipe(names, Array.filter((name) => SCRIPT$2.test(name)), Array.map((name) => {
|
|
637
637
|
const file = files.join(root, name);
|
|
638
638
|
return {
|
|
639
639
|
name,
|
|
@@ -642,12 +642,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
642
642
|
directory: files.dirname(file)
|
|
643
643
|
};
|
|
644
644
|
}));
|
|
645
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$
|
|
645
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$26 });
|
|
646
646
|
return Array.getSomes(found);
|
|
647
647
|
});
|
|
648
648
|
// src/shared/lib/agent-docs.ts
|
|
649
649
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
650
|
-
const READ_CONCURRENCY$
|
|
650
|
+
const READ_CONCURRENCY$25 = 16;
|
|
651
651
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
652
652
|
const files = yield* RepositoryFiles;
|
|
653
653
|
const listed = yield* files.listedFiles(root);
|
|
@@ -656,32 +656,60 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
656
656
|
const file = files.join(root, name);
|
|
657
657
|
const problemOf = Option.flatMap(problemIn(file));
|
|
658
658
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
659
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
659
|
+
}, { concurrency: READ_CONCURRENCY$25 });
|
|
660
660
|
return Array.getSomes(found);
|
|
661
661
|
});
|
|
662
662
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
663
663
|
const RECOMMENDED_LINES = 200;
|
|
664
|
-
const FIRST$
|
|
665
|
-
const RULE$
|
|
664
|
+
const FIRST$20 = 1;
|
|
665
|
+
const RULE$40 = "agent-docs-length";
|
|
666
666
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
667
|
-
const problemFor$
|
|
667
|
+
const problemFor$6 = (file) => (lines) => {
|
|
668
668
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
669
669
|
return Option.some({
|
|
670
670
|
file,
|
|
671
671
|
line: 201,
|
|
672
|
-
column: FIRST$
|
|
673
|
-
rule: RULE$
|
|
672
|
+
column: FIRST$20,
|
|
673
|
+
rule: RULE$40,
|
|
674
674
|
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.`
|
|
675
675
|
});
|
|
676
676
|
};
|
|
677
677
|
/** @internal */
|
|
678
|
-
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$
|
|
678
|
+
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$6(file)(lineCount(source)));
|
|
679
|
+
// src/features/check-placement/model/claude-link.ts
|
|
680
|
+
const RULE$39 = "claude-md-link";
|
|
681
|
+
const CLAUDE = "CLAUDE.md";
|
|
682
|
+
const AGENTS = "AGENTS.md";
|
|
683
|
+
const FIRST$19 = 1;
|
|
684
|
+
const READ_CONCURRENCY$24 = 16;
|
|
685
|
+
const MESSAGE$14 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
686
|
+
/** @internal */
|
|
687
|
+
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
688
|
+
const files = yield* RepositoryFiles;
|
|
689
|
+
const [listed, links] = yield* Effect.all([files.listedFiles(root), files.linkedFiles(root)], { concurrency: "unbounded" });
|
|
690
|
+
const problemOf = Effect.fn("problemOf")(function* problemOf(name) {
|
|
691
|
+
const file = files.join(root, name);
|
|
692
|
+
const target = yield* files.readLink(file);
|
|
693
|
+
const isLink = pipe(links, Array.contains(name));
|
|
694
|
+
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
695
|
+
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
696
|
+
file: path,
|
|
697
|
+
line: FIRST$19,
|
|
698
|
+
column: FIRST$19,
|
|
699
|
+
rule: RULE$39,
|
|
700
|
+
message: MESSAGE$14
|
|
701
|
+
})));
|
|
702
|
+
});
|
|
703
|
+
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
704
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$24 });
|
|
705
|
+
return Array.getSomes(found);
|
|
706
|
+
});
|
|
679
707
|
// src/features/check-placement/model/dangling-links.ts
|
|
680
|
-
const RULE$
|
|
681
|
-
const SEPARATOR$
|
|
682
|
-
const FIRST$
|
|
708
|
+
const RULE$38 = "dangling-link";
|
|
709
|
+
const SEPARATOR$20 = "/";
|
|
710
|
+
const FIRST$18 = 1;
|
|
683
711
|
const READ_CONCURRENCY$23 = 16;
|
|
684
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
712
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
|
|
685
713
|
/** @internal */
|
|
686
714
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
687
715
|
const files = yield* RepositoryFiles;
|
|
@@ -691,9 +719,9 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
691
719
|
const link = yield* files.readLink(file);
|
|
692
720
|
return pipe(link, Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))), Option.filter((target) => !pipe(listed, Array.some(holds(target)))), Option.map((target) => ({
|
|
693
721
|
file,
|
|
694
|
-
line: FIRST$
|
|
695
|
-
column: FIRST$
|
|
696
|
-
rule: RULE$
|
|
722
|
+
line: FIRST$18,
|
|
723
|
+
column: FIRST$18,
|
|
724
|
+
rule: RULE$38,
|
|
697
725
|
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.`
|
|
698
726
|
})));
|
|
699
727
|
});
|
|
@@ -701,36 +729,36 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
701
729
|
return Array.getSomes(found);
|
|
702
730
|
});
|
|
703
731
|
// src/features/check-placement/model/nested-docs.ts
|
|
704
|
-
const RULE$
|
|
732
|
+
const RULE$37 = "nested-docs";
|
|
705
733
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
706
|
-
const SEPARATOR$
|
|
707
|
-
const FIRST$
|
|
734
|
+
const SEPARATOR$19 = "/";
|
|
735
|
+
const FIRST$17 = 1;
|
|
708
736
|
const READ_CONCURRENCY$22 = 64;
|
|
709
737
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
710
738
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
711
739
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
712
740
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
713
|
-
const taggedError$
|
|
714
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
715
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
716
|
-
const problemFor$
|
|
741
|
+
const taggedError$5 = Schema.TaggedError;
|
|
742
|
+
var RootConfigUnreadable = class extends taggedError$5()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
743
|
+
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
744
|
+
const problemFor$5 = (file, message) => ({
|
|
717
745
|
file,
|
|
718
|
-
line: FIRST$
|
|
719
|
-
column: FIRST$
|
|
720
|
-
rule: RULE$
|
|
746
|
+
line: FIRST$17,
|
|
747
|
+
column: FIRST$17,
|
|
748
|
+
rule: RULE$37,
|
|
721
749
|
message
|
|
722
750
|
});
|
|
723
751
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
724
752
|
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.";
|
|
725
753
|
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.";
|
|
726
754
|
const agentDocProblem = ({ file, base, directory }, allowed) => {
|
|
727
|
-
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$
|
|
755
|
+
if (!allowed.workspaceAgentDocs) return Option.some(problemFor$5(file, `${base} ${AGENT_DOCS_MESSAGE}`));
|
|
728
756
|
if (base === WORKSPACE_AGENT_DOC && HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
729
|
-
return Option.some(problemFor$
|
|
757
|
+
return Option.some(problemFor$5(file, `${base} ${WORKSPACE_AGENT_DOCS_MESSAGE}`));
|
|
730
758
|
};
|
|
731
759
|
const readmeProblem = ({ file, base, directory }, allowed) => {
|
|
732
760
|
if (!README.test(base) || HashSet.has(allowed.workspaces, directory)) return Option.none();
|
|
733
|
-
return Option.some(problemFor$
|
|
761
|
+
return Option.some(problemFor$5(file, `${base} ${README_MESSAGE}`));
|
|
734
762
|
};
|
|
735
763
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, allowed, name) {
|
|
736
764
|
const files = yield* RepositoryFiles;
|
|
@@ -756,7 +784,7 @@ const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function*
|
|
|
756
784
|
/** @internal */
|
|
757
785
|
const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(root) {
|
|
758
786
|
const files = yield* RepositoryFiles;
|
|
759
|
-
const names = yield* files.
|
|
787
|
+
const names = yield* files.ownedFiles(root);
|
|
760
788
|
const nested = pipe(names, Array.filter(isNested));
|
|
761
789
|
const workspaceAgentDocs = yield* allowsWorkspaceAgentDocs(root);
|
|
762
790
|
const directories = yield* workspaceDirectories(root);
|
|
@@ -768,22 +796,31 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
768
796
|
return Array.getSomes(found);
|
|
769
797
|
});
|
|
770
798
|
// src/features/check-placement/model/published-readme.ts
|
|
771
|
-
const RULE$
|
|
799
|
+
const RULE$36 = "published-readme";
|
|
772
800
|
const README_FILE = "README.md";
|
|
773
801
|
const READ_CONCURRENCY$21 = 16;
|
|
774
|
-
const MESSAGE$
|
|
802
|
+
const MESSAGE$13 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
803
|
+
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
804
|
+
const FILE_START$2 = 1;
|
|
775
805
|
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
776
806
|
const files = yield* RepositoryFiles;
|
|
777
807
|
const file = files.join(root, directory, README_FILE);
|
|
778
808
|
const text = yield* files.readFile(file);
|
|
809
|
+
if (Option.isNone(text)) return Option.some({
|
|
810
|
+
file,
|
|
811
|
+
line: FILE_START$2,
|
|
812
|
+
column: FILE_START$2,
|
|
813
|
+
rule: RULE$36,
|
|
814
|
+
message: MISSING_MESSAGE
|
|
815
|
+
});
|
|
779
816
|
return pipe(text, Option.flatMap((source) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
780
817
|
const { line, column } = positionOf(source)(found.index);
|
|
781
818
|
return {
|
|
782
819
|
file,
|
|
783
820
|
line,
|
|
784
821
|
column,
|
|
785
|
-
rule: RULE$
|
|
786
|
-
message: MESSAGE$
|
|
822
|
+
rule: RULE$36,
|
|
823
|
+
message: MESSAGE$13
|
|
787
824
|
};
|
|
788
825
|
}))));
|
|
789
826
|
});
|
|
@@ -793,35 +830,64 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
793
830
|
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$21 });
|
|
794
831
|
return Array.getSomes(found);
|
|
795
832
|
});
|
|
833
|
+
// src/features/check-placement/model/published-tests.ts
|
|
834
|
+
const RULE$35 = "published-tests";
|
|
835
|
+
const MANIFEST_FILE$2 = "package.json";
|
|
836
|
+
const FILE_START$1 = 1;
|
|
837
|
+
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
838
|
+
const MESSAGE$12 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
839
|
+
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
840
|
+
const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
841
|
+
const files = yield* RepositoryFiles;
|
|
842
|
+
const absolute = files.join(root, directory);
|
|
843
|
+
const prefix = `${absolute}/`;
|
|
844
|
+
if (testedIn(listed)(prefix)) return Option.none();
|
|
845
|
+
return Option.some({
|
|
846
|
+
file: files.join(absolute, MANIFEST_FILE$2),
|
|
847
|
+
line: FILE_START$1,
|
|
848
|
+
column: FILE_START$1,
|
|
849
|
+
rule: RULE$35,
|
|
850
|
+
message: MESSAGE$12
|
|
851
|
+
});
|
|
852
|
+
});
|
|
853
|
+
/** @internal */
|
|
854
|
+
const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPublishedTests(root) {
|
|
855
|
+
const files = yield* RepositoryFiles;
|
|
856
|
+
const projects = yield* publishedProjects(root);
|
|
857
|
+
const listed = yield* files.listedFiles(root);
|
|
858
|
+
const absolute = pipe(listed, Array.map((file) => files.join(root, file)));
|
|
859
|
+
const found = yield* Effect.forEach(projects, (project) => problemFor$4(root, absolute, project), { concurrency: 1 });
|
|
860
|
+
return Array.getSomes(found);
|
|
861
|
+
});
|
|
796
862
|
// src/features/check-placement/model/root-docs.ts
|
|
797
|
-
const RULE$
|
|
798
|
-
const SEPARATOR$
|
|
799
|
-
const FIRST$
|
|
863
|
+
const RULE$34 = "root-docs";
|
|
864
|
+
const SEPARATOR$18 = "/";
|
|
865
|
+
const FIRST$16 = 1;
|
|
800
866
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
801
867
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
802
|
-
const MESSAGE$
|
|
803
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
868
|
+
const MESSAGE$11 = "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.";
|
|
869
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
804
870
|
/** @internal */
|
|
805
871
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
806
872
|
const files = yield* RepositoryFiles;
|
|
807
873
|
const names = yield* files.listedFiles(root);
|
|
808
874
|
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
809
875
|
file: files.join(root, name),
|
|
810
|
-
line: FIRST$
|
|
811
|
-
column: FIRST$
|
|
812
|
-
rule: RULE$
|
|
813
|
-
message: `${name} ${MESSAGE$
|
|
876
|
+
line: FIRST$16,
|
|
877
|
+
column: FIRST$16,
|
|
878
|
+
rule: RULE$34,
|
|
879
|
+
message: `${name} ${MESSAGE$11}`
|
|
814
880
|
})));
|
|
815
881
|
});
|
|
816
882
|
// src/features/check-placement/model/root-readme.ts
|
|
817
|
-
const RULE$
|
|
883
|
+
const RULE$33 = "root-readme";
|
|
818
884
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
819
885
|
const READ_CONCURRENCY$20 = 16;
|
|
820
|
-
const START$
|
|
886
|
+
const START$14 = 0;
|
|
821
887
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
822
888
|
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
823
889
|
const RELATIVE$1 = /^\.\//u;
|
|
824
|
-
const SEPARATOR$
|
|
890
|
+
const SEPARATOR$17 = "/";
|
|
825
891
|
const MarketplacePlugin = Schema.Struct({
|
|
826
892
|
name: Schema.optional(Schema.String),
|
|
827
893
|
source: Schema.Unknown
|
|
@@ -833,7 +899,7 @@ const NO_PLUGINS = {
|
|
|
833
899
|
};
|
|
834
900
|
const isCheckPolicy = ({ packageName }) => Option.contains(packageName, CHECK_POLICY);
|
|
835
901
|
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.`;
|
|
836
|
-
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$
|
|
902
|
+
const lastSegment = (directory) => pipe(String$1.split(SEPARATOR$17)(directory), Array.last, Option.getOrElse(() => directory));
|
|
837
903
|
const pluginsOf = (plugins) => {
|
|
838
904
|
const directories = pipe(plugins, Array.map(({ source }) => source), Array.filter(Predicate.isString), Array.map(String$1.replace(RELATIVE$1, "")));
|
|
839
905
|
const segments = pipe(directories, Array.map(lastSegment));
|
|
@@ -856,14 +922,14 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
856
922
|
onNone: () => ownNames(plugins, names),
|
|
857
923
|
onSome: () => [directory]
|
|
858
924
|
}));
|
|
859
|
-
const problemsIn$
|
|
925
|
+
const problemsIn$14 = (file, source, plugins) => (workspace) => {
|
|
860
926
|
const message = messageFor(workspace.directory);
|
|
861
927
|
const at = positionOf(source);
|
|
862
928
|
const pattern = patternFor(plugins)(workspace);
|
|
863
929
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
864
930
|
file,
|
|
865
|
-
...at(found.index ?? START$
|
|
866
|
-
rule: RULE$
|
|
931
|
+
...at(found.index ?? START$14),
|
|
932
|
+
rule: RULE$33,
|
|
867
933
|
message
|
|
868
934
|
})));
|
|
869
935
|
};
|
|
@@ -871,7 +937,7 @@ const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadm
|
|
|
871
937
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
872
938
|
return pipe(text, Option.match({
|
|
873
939
|
onNone: () => [],
|
|
874
|
-
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$
|
|
940
|
+
onSome: (source) => pipe(workspaces, Array.flatMap(problemsIn$14(file, source, plugins)))
|
|
875
941
|
}));
|
|
876
942
|
});
|
|
877
943
|
/** @internal */
|
|
@@ -890,16 +956,18 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
890
956
|
const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlacement(root) {
|
|
891
957
|
const found = yield* Effect.all([
|
|
892
958
|
checkNestedDocs(root),
|
|
959
|
+
checkClaudeLinks(root),
|
|
893
960
|
checkRootReadme(root),
|
|
894
961
|
checkRootDocs(root),
|
|
895
962
|
checkAgentDocsLength(root),
|
|
896
963
|
checkDanglingLinks(root),
|
|
897
|
-
checkPublishedReadme(root)
|
|
964
|
+
checkPublishedReadme(root),
|
|
965
|
+
checkPublishedTests(root)
|
|
898
966
|
], { concurrency: "unbounded" });
|
|
899
967
|
return Array.flatten(found);
|
|
900
968
|
});
|
|
901
969
|
// src/features/check-placement/model/docs-mirror.ts
|
|
902
|
-
const RULE$
|
|
970
|
+
const RULE$32 = "docs-mirror";
|
|
903
971
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
904
972
|
const MIRROR_LIMIT = 3;
|
|
905
973
|
const READ_CONCURRENCY$19 = 16;
|
|
@@ -924,7 +992,7 @@ const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
924
992
|
file,
|
|
925
993
|
line,
|
|
926
994
|
column,
|
|
927
|
-
rule: RULE$
|
|
995
|
+
rule: RULE$32,
|
|
928
996
|
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.`
|
|
929
997
|
};
|
|
930
998
|
}), Option.toArray);
|
|
@@ -956,27 +1024,27 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
956
1024
|
return Array.flatten(found);
|
|
957
1025
|
});
|
|
958
1026
|
// src/features/check-placement/model/ignored-sources.ts
|
|
959
|
-
const RULE$
|
|
1027
|
+
const RULE$31 = "ignored-sources";
|
|
960
1028
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
961
|
-
const FIRST$
|
|
962
|
-
const MESSAGE$
|
|
1029
|
+
const FIRST$15 = 1;
|
|
1030
|
+
const MESSAGE$10 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
963
1031
|
/** @internal */
|
|
964
1032
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
965
1033
|
const files = yield* RepositoryFiles;
|
|
966
1034
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
967
1035
|
return pipe(ignored, Array.map((file) => ({
|
|
968
1036
|
file: files.join(root, file),
|
|
969
|
-
line: FIRST$
|
|
970
|
-
column: FIRST$
|
|
971
|
-
rule: RULE$
|
|
972
|
-
message: MESSAGE$
|
|
1037
|
+
line: FIRST$15,
|
|
1038
|
+
column: FIRST$15,
|
|
1039
|
+
rule: RULE$31,
|
|
1040
|
+
message: MESSAGE$10
|
|
973
1041
|
})));
|
|
974
1042
|
});
|
|
975
1043
|
// src/features/check-placement/model/member-sources.ts
|
|
976
1044
|
const ROOT_WORKSPACE$1 = ".";
|
|
977
|
-
const FIRST$
|
|
978
|
-
const SEPARATOR$
|
|
979
|
-
const EXCLUDED$
|
|
1045
|
+
const FIRST$14 = 1;
|
|
1046
|
+
const SEPARATOR$16 = "/";
|
|
1047
|
+
const EXCLUDED$4 = [
|
|
980
1048
|
":(exclude,attr:linguist-vendored)",
|
|
981
1049
|
":(exclude,attr:linguist-generated)",
|
|
982
1050
|
":(exclude,attr:linguist-documentation)"
|
|
@@ -989,54 +1057,30 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
989
1057
|
const files = yield* RepositoryFiles;
|
|
990
1058
|
return {
|
|
991
1059
|
workspaces: yield* memberWorkspaces(root),
|
|
992
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$
|
|
1060
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$4)
|
|
993
1061
|
};
|
|
994
1062
|
});
|
|
995
1063
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
996
1064
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
997
1065
|
file,
|
|
998
|
-
line: FIRST$
|
|
999
|
-
column: FIRST$
|
|
1066
|
+
line: FIRST$14,
|
|
1067
|
+
column: FIRST$14,
|
|
1000
1068
|
rule,
|
|
1001
1069
|
message
|
|
1002
1070
|
});
|
|
1003
|
-
const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$
|
|
1071
|
+
const ownerOf$2 = (workspaces) => (name) => pipe(workspaces, Array.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$16}`)(name)), (owners) => Array.last(Array.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
1004
1072
|
workspace,
|
|
1005
1073
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
1006
1074
|
})));
|
|
1007
|
-
// src/features/check-placement/model/
|
|
1008
|
-
const LAYERED_RULE$1 = "layered-source";
|
|
1075
|
+
// src/features/check-placement/model/public-entries.ts
|
|
1009
1076
|
const ENTRY_RULE$3 = "public-entry";
|
|
1010
|
-
const SOURCE_DIRECTORY$1 = "src";
|
|
1011
|
-
const SEPARATOR$16 = "/";
|
|
1012
|
-
const LOOSE_DEPTH = 2;
|
|
1013
|
-
const LAYERS$1 = [
|
|
1014
|
-
"app",
|
|
1015
|
-
"pages",
|
|
1016
|
-
"widgets",
|
|
1017
|
-
"features",
|
|
1018
|
-
"entities",
|
|
1019
|
-
"shared"
|
|
1020
|
-
];
|
|
1021
|
-
const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
|
|
1022
|
-
const ROOT_ALLOWED = /^(?:[^/]+\.config\.[cm]?[jt]s|alchemy\.[^/]+\.ts|[^/]+\.d\.[cm]?ts|bin\/.+)$/u;
|
|
1023
1077
|
const PUBLIC_ENTRY = /^(?:bin\/[^/]+|src\/(?:app\/[^/]+|(?:pages|widgets|features|entities)\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/[^/]+\/index(?:\.[a-z]+)*\.tsx?|shared\/(?:ui|lib)\/.+))$/u;
|
|
1024
|
-
const OUTSIDE_MESSAGE$1 = "sits outside src/. Put every module of a workspace under src/ in an FSD layer; only bin/, *.config.ts, alchemy.*.ts and *.d.ts may stay at the workspace root.";
|
|
1025
|
-
const LOOSE_MESSAGE = "sits directly in src/. Put it in a layer: app/ for entry points and wiring, features/<verb>-<object>/ for one operation, entities/<noun>/ for a shared domain object, or shared/<segment>/ for code without domain rules.";
|
|
1026
|
-
const LAYER_MESSAGE$1 = `is not an FSD layer. src/ holds only ${Array.join(LAYERS$1, ", ")}.`;
|
|
1027
1078
|
const ENTRY_MESSAGE$2 = "is a package entry that points inside a slice. Point exports and bin at bin/<name>.ts, src/app/<entry>.ts or a slice's index.ts.";
|
|
1028
1079
|
const decodeEntryManifest = Schema.decodeUnknownOption(EntryManifestJson);
|
|
1029
|
-
const layerProblemOf = (owned) => {
|
|
1030
|
-
const parts = String$1.split(owned.inner, SEPARATOR$16);
|
|
1031
|
-
const [top, layer] = parts;
|
|
1032
|
-
if (top !== SOURCE_DIRECTORY$1) return Option.liftPredicate([`${owned.workspace}${SEPARATOR$16}${owned.inner}`, OUTSIDE_MESSAGE$1], () => !ROOT_ALLOWED.test(owned.inner));
|
|
1033
|
-
if (parts.length === LOOSE_DEPTH) return Option.some([`${owned.workspace}${SEPARATOR$16}${owned.inner}`, LOOSE_MESSAGE]);
|
|
1034
|
-
return Option.liftPredicate([`${owned.workspace}${SEPARATOR$16}${SOURCE_DIRECTORY$1}${SEPARATOR$16}${layer}`, LAYER_MESSAGE$1], () => !pipe(LAYERS$1, Array.contains(layer ?? "")));
|
|
1035
|
-
};
|
|
1036
1080
|
const entryProblems$2 = Effect.fn("entryProblems")(function* entryProblems(root, workspace) {
|
|
1037
1081
|
const files = yield* RepositoryFiles;
|
|
1038
1082
|
const directory = files.join(root, workspace);
|
|
1039
|
-
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$
|
|
1083
|
+
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
1040
1084
|
const join = (target) => files.join(directory, target);
|
|
1041
1085
|
return pipe(text, Option.flatMap(decodeEntryManifest), Option.map((manifest) => publicEntriesOf({
|
|
1042
1086
|
manifest,
|
|
@@ -1049,20 +1093,14 @@ const entryProblems$2 = Effect.fn("entryProblems")(function* entryProblems(root,
|
|
|
1049
1093
|
})));
|
|
1050
1094
|
});
|
|
1051
1095
|
/** @internal */
|
|
1052
|
-
const
|
|
1053
|
-
const
|
|
1054
|
-
const { workspaces, listed } = yield* memberSources(root);
|
|
1055
|
-
const layered = pipe(listed, Array.filter((name) => SCRIPT$2.test(name)), Array.map(ownerOf$2(workspaces)), Array.getSomes, Array.map(layerProblemOf), Array.getSomes, Array.dedupeWith(([left], [right]) => left === right), Array.map(([file, message]) => fileProblem$1({
|
|
1056
|
-
file: files.join(root, file),
|
|
1057
|
-
rule: LAYERED_RULE$1,
|
|
1058
|
-
message
|
|
1059
|
-
})));
|
|
1096
|
+
const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublicEntries(root) {
|
|
1097
|
+
const workspaces = yield* memberWorkspaces(root);
|
|
1060
1098
|
const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems$2(root, workspace), { concurrency: 1 });
|
|
1061
|
-
return
|
|
1099
|
+
return Array.flatten(entries);
|
|
1062
1100
|
});
|
|
1063
1101
|
// src/shared/lib/tree-sitter.ts
|
|
1064
|
-
const taggedError$
|
|
1065
|
-
var GrammarUnreadable = class extends taggedError$
|
|
1102
|
+
const taggedError$4 = Schema.TaggedError;
|
|
1103
|
+
var GrammarUnreadable = class extends taggedError$4()("GrammarUnreadable", {
|
|
1066
1104
|
grammar: Schema.String,
|
|
1067
1105
|
message: Schema.String
|
|
1068
1106
|
}) {};
|
|
@@ -1118,7 +1156,6 @@ const MODULE_INDEX = "mod";
|
|
|
1118
1156
|
const CRATE_ROOTS = ["src/lib.rs", "src/main.rs"];
|
|
1119
1157
|
const OUTSIDE_ALLOWED = /^(?:build\.rs|benches\/.+)$/u;
|
|
1120
1158
|
const SEPARATE_TEST = /^tests\/.+$/u;
|
|
1121
|
-
const SHARED_SLICES = ["app", "shared"];
|
|
1122
1159
|
const SLICED_LAYERS = [
|
|
1123
1160
|
"pages",
|
|
1124
1161
|
"widgets",
|
|
@@ -1129,11 +1166,6 @@ const SLICED_LAYERS = [
|
|
|
1129
1166
|
const LAYER_DEPTH = 1;
|
|
1130
1167
|
const SOURCE_PREFIX$1 = `src/`;
|
|
1131
1168
|
const ROOT_CRATE = "";
|
|
1132
|
-
const NO_RANK = -1;
|
|
1133
|
-
const LAYER_INDEX = 0;
|
|
1134
|
-
const SLICE_INDEX = 1;
|
|
1135
|
-
const upwardMessage = (target, source) => `uses the ${target} layer from the ${source} layer. A layer may only use the layers below it (${Array.join(LAYERS, ", ")}).`;
|
|
1136
|
-
const crossMessage = (layer, target, source) => `uses the ${layer} slice ${target} from the slice ${source}. Slices of one layer must not use each other; move what they share down a layer.`;
|
|
1137
1169
|
const byLength = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1138
1170
|
const crateDirectories = (listed) => pipe(listed, Array.filter((name) => MANIFEST$3.test(name)), Array.map((name) => String$1.replace(MANIFEST$3, "")(name)));
|
|
1139
1171
|
const ownedBy = (crate, name) => {
|
|
@@ -1168,120 +1200,13 @@ const kindOf$1 = (inner) => {
|
|
|
1168
1200
|
if (!String$1.startsWith(SOURCE_PREFIX$1)(inner)) return "misplaced";
|
|
1169
1201
|
return sourceKindOf(inner);
|
|
1170
1202
|
};
|
|
1171
|
-
const isInsideSource = (inner) => String$1.startsWith(SOURCE_PREFIX$1)(inner);
|
|
1172
|
-
const resolvedFrom = ({ segments, current }) => {
|
|
1173
|
-
const first = Array.head(segments);
|
|
1174
|
-
const rest = Array.drop(segments, 1);
|
|
1175
|
-
if (Option.contains(first, "crate")) return Option.some(rest);
|
|
1176
|
-
if (Option.contains(first, "self")) return resolvedFrom({
|
|
1177
|
-
segments: rest,
|
|
1178
|
-
current
|
|
1179
|
-
});
|
|
1180
|
-
if (Option.contains(first, "super")) return pipe(Option.liftPredicate(current, Array.isReadonlyArrayNonEmpty), Option.flatMap((parent) => resolvedFrom({
|
|
1181
|
-
segments: rest,
|
|
1182
|
-
current: Array.dropRight(parent, 1)
|
|
1183
|
-
})));
|
|
1184
|
-
return Option.some([...current, ...segments]);
|
|
1185
|
-
};
|
|
1186
|
-
const rankOf = (layer) => pipe(Array.findFirstIndex(LAYERS, (name) => name === layer), Option.getOrElse(() => NO_RANK));
|
|
1187
|
-
const partOf = (path, index) => Option.getOrElse(Array.get(path, index), () => "");
|
|
1188
|
-
const importMessage = ({ source, target }) => {
|
|
1189
|
-
const [sourceLayer, sourceSlice] = [partOf(source, LAYER_INDEX), partOf(source, SLICE_INDEX)];
|
|
1190
|
-
const [targetLayer, targetSlice] = [partOf(target, LAYER_INDEX), partOf(target, SLICE_INDEX)];
|
|
1191
|
-
if (!Array.contains(LAYERS, targetLayer) || target.length < 2) return Option.none();
|
|
1192
|
-
if (rankOf(targetLayer) < rankOf(sourceLayer)) return Option.some(upwardMessage(targetLayer, sourceLayer));
|
|
1193
|
-
if (targetLayer === sourceLayer && targetSlice !== sourceSlice && !Array.contains(SHARED_SLICES, targetLayer)) return Option.some(crossMessage(targetLayer, targetSlice, sourceSlice));
|
|
1194
|
-
return Option.none();
|
|
1195
|
-
};
|
|
1196
1203
|
const isSliceIndex = (modulePath) => modulePath.length === 2 && Option.exists(Array.head(modulePath), (layer) => Array.contains(SLICED_LAYERS, layer));
|
|
1197
1204
|
// src/features/check-placement/model/rust-syntax.ts
|
|
1198
|
-
const ANCHORS = [
|
|
1199
|
-
"crate",
|
|
1200
|
-
"super",
|
|
1201
|
-
"self"
|
|
1202
|
-
];
|
|
1203
|
-
const SCOPED = ["scoped_identifier", "scoped_type_identifier"];
|
|
1204
1205
|
const IGNORED_ITEMS = ["line_comment", "block_comment"];
|
|
1205
|
-
const PATH_SEPARATOR = "::";
|
|
1206
|
-
const SELF = "self";
|
|
1207
1206
|
const NEXT$4 = 1;
|
|
1208
1207
|
const ALLOCATOR = "global_allocator";
|
|
1209
1208
|
const field = (node, name) => Option.fromNullishOr(node.childForFieldName(name));
|
|
1210
1209
|
const namedChildren = (node) => pipe(node.namedChildren, Array.flatMap((child) => Option.toArray(Option.fromNullishOr(child))));
|
|
1211
|
-
const sameNode = (left, right) => Option.exists(left, (node) => node.id === right.id);
|
|
1212
|
-
const segmentsOf = (node) => {
|
|
1213
|
-
if (Array.contains(SCOPED, node.type)) return [...Option.match(field(node, "path"), {
|
|
1214
|
-
onNone: () => [],
|
|
1215
|
-
onSome: segmentsOf
|
|
1216
|
-
}), ...Option.match(field(node, "name"), {
|
|
1217
|
-
onNone: () => [],
|
|
1218
|
-
onSome: (name) => [name.text]
|
|
1219
|
-
})];
|
|
1220
|
-
if (node.type === "generic_type") return Option.match(field(node, "type"), {
|
|
1221
|
-
onNone: () => [],
|
|
1222
|
-
onSome: segmentsOf
|
|
1223
|
-
});
|
|
1224
|
-
return [node.text];
|
|
1225
|
-
};
|
|
1226
|
-
const extendsPath = (parent, node) => Array.contains(SCOPED, parent.type) && sameNode(field(parent, "path"), node) || parent.type === "generic_type" && sameNode(field(parent, "type"), node);
|
|
1227
|
-
const outermostPath = (node) => pipe(Option.fromNullishOr(node.parent), Option.filter((parent) => extendsPath(parent, node)), Option.match({
|
|
1228
|
-
onNone: () => node,
|
|
1229
|
-
onSome: outermostPath
|
|
1230
|
-
}));
|
|
1231
|
-
const tokenSegments = (node) => pipe(Option.fromNullishOr(node.nextSibling), Option.filter((separator) => separator.type === PATH_SEPARATOR), Option.flatMap((separator) => Option.fromNullishOr(separator.nextSibling)), Option.filter((next) => next.type === "identifier" || Array.contains(ANCHORS, next.type)), Option.match({
|
|
1232
|
-
onNone: () => [node.text],
|
|
1233
|
-
onSome: (next) => [node.text, ...tokenSegments(next)]
|
|
1234
|
-
}));
|
|
1235
|
-
const ancestors = (node) => pipe(Option.fromNullishOr(node.parent), Option.match({
|
|
1236
|
-
onNone: () => [],
|
|
1237
|
-
onSome: (parent) => [parent, ...ancestors(parent)]
|
|
1238
|
-
}));
|
|
1239
|
-
const scopeOf$1 = (node) => pipe(ancestors(node), Array.filter((ancestor) => ancestor.type === "mod_item"), Array.flatMap((module) => Option.toArray(field(module, "name"))), Array.map((name) => name.text), Array.reverse);
|
|
1240
|
-
const pathAt = (node, segments) => ({
|
|
1241
|
-
segments,
|
|
1242
|
-
scope: scopeOf$1(node),
|
|
1243
|
-
line: node.startPosition.row + NEXT$4,
|
|
1244
|
-
column: node.startPosition.column + NEXT$4
|
|
1245
|
-
});
|
|
1246
|
-
const insideAny = (node, kinds) => Array.some(ancestors(node), (ancestor) => Array.contains(kinds, ancestor.type));
|
|
1247
|
-
const anchoredPaths = (root) => pipe(root.descendantsOfType([...ANCHORS]), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.filter((node) => !insideAny(node, ["use_declaration", "visibility_modifier"])), Array.map((node) => {
|
|
1248
|
-
if (Option.exists(Option.fromNullishOr(node.parent), (parent) => parent.type === "token_tree")) return pathAt(node, tokenSegments(node));
|
|
1249
|
-
const outer = outermostPath(node);
|
|
1250
|
-
return pathAt(node, segmentsOf(outer));
|
|
1251
|
-
}));
|
|
1252
|
-
const joined = (prefix, node) => {
|
|
1253
|
-
const own = segmentsOf(node);
|
|
1254
|
-
if (own.length === NEXT$4 && Option.contains(Array.head(own), SELF) && Array.isReadonlyArrayNonEmpty(prefix)) return prefix;
|
|
1255
|
-
return [...prefix, ...own];
|
|
1256
|
-
};
|
|
1257
|
-
const treesOfUse = (prefix, node) => {
|
|
1258
|
-
switch (node.type) {
|
|
1259
|
-
case "scoped_use_list": {
|
|
1260
|
-
const base = Option.match(field(node, "path"), {
|
|
1261
|
-
onNone: () => prefix,
|
|
1262
|
-
onSome: (path) => joined(prefix, path)
|
|
1263
|
-
});
|
|
1264
|
-
return Option.match(field(node, "list"), {
|
|
1265
|
-
onNone: () => [base],
|
|
1266
|
-
onSome: (list) => treesOfUse(base, list)
|
|
1267
|
-
});
|
|
1268
|
-
}
|
|
1269
|
-
case "use_list": return Array.flatMap(namedChildren(node), (child) => treesOfUse(prefix, child));
|
|
1270
|
-
case "use_as_clause": return Option.match(field(node, "path"), {
|
|
1271
|
-
onNone: () => [],
|
|
1272
|
-
onSome: (path) => [joined(prefix, path)]
|
|
1273
|
-
});
|
|
1274
|
-
case "use_wildcard": return pipe(Array.head(namedChildren(node)), Option.match({
|
|
1275
|
-
onNone: () => [prefix],
|
|
1276
|
-
onSome: (path) => [joined(prefix, path)]
|
|
1277
|
-
}));
|
|
1278
|
-
default: return [joined(prefix, node)];
|
|
1279
|
-
}
|
|
1280
|
-
};
|
|
1281
|
-
const importedPaths = (root) => pipe(root.descendantsOfType("use_declaration"), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.flatMap((declaration) => pipe(field(declaration, "argument"), Option.match({
|
|
1282
|
-
onNone: () => [],
|
|
1283
|
-
onSome: (argument) => Array.map(treesOfUse([], argument), (segments) => pathAt(declaration, segments))
|
|
1284
|
-
}))), Array.filter(({ segments }) => Option.exists(Array.head(segments), (first) => Array.contains(ANCHORS, first))));
|
|
1285
1210
|
const itemOf = (node) => ({
|
|
1286
1211
|
kind: node.type,
|
|
1287
1212
|
name: Option.map(field(node, "name"), (name) => name.text),
|
|
@@ -1292,7 +1217,6 @@ const itemOf = (node) => ({
|
|
|
1292
1217
|
});
|
|
1293
1218
|
const replacesAllocator = (root) => pipe(root.descendantsOfType("attribute"), Array.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array.some((attribute) => Option.exists(Array.head(namedChildren(attribute)), (name) => name.text === ALLOCATOR)));
|
|
1294
1219
|
const readRustFile = (root) => ({
|
|
1295
|
-
paths: [...importedPaths(root), ...anchoredPaths(root)],
|
|
1296
1220
|
items: pipe(namedChildren(root), Array.filter((node) => !Array.contains(IGNORED_ITEMS, node.type)), Array.map(itemOf)),
|
|
1297
1221
|
replacesAllocator: replacesAllocator(root)
|
|
1298
1222
|
});
|
|
@@ -9772,7 +9696,6 @@ const LAYERED_RULE = "layered-source";
|
|
|
9772
9696
|
const ENTRY_RULE$1 = "public-entry";
|
|
9773
9697
|
const TEST_RULE = "colocated-test";
|
|
9774
9698
|
const SLICE_RULE = "feature-slice-name";
|
|
9775
|
-
const IMPORT_RULE = "layer-import";
|
|
9776
9699
|
const GRAMMAR = "rust";
|
|
9777
9700
|
const WORD_SEPARATOR = "_";
|
|
9778
9701
|
const FEATURES = "features";
|
|
@@ -9790,29 +9713,14 @@ const LAYER_ITEMS = [
|
|
|
9790
9713
|
"inner_attribute_item"
|
|
9791
9714
|
];
|
|
9792
9715
|
const READ_CONCURRENCY$18 = 64;
|
|
9793
|
-
const EXCLUDED$
|
|
9716
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9794
9717
|
const NONE$2 = [];
|
|
9795
|
-
const OUTSIDE_MESSAGE = "sits outside src/. Put every module of a crate under src/ in an FSD layer; only build.rs and benches/ may stay outside.";
|
|
9796
|
-
const LAYER_MESSAGE = `is not an FSD layer. A crate's src/ holds only lib.rs, main.rs, bin/ and the layers ${Array.join(LAYERS, ", ")}.`;
|
|
9797
9718
|
const ROOT_MESSAGE = "defines code in the crate root. Keep lib.rs and main.rs to mod declarations of layers, use, pub use and fn main, and put the code in a layer.";
|
|
9798
9719
|
const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
|
|
9799
9720
|
const ENTRY_MESSAGE = "makes an inner module of a slice public. Declare it with plain mod and re-export what other slices use with pub use from the slice module.";
|
|
9800
9721
|
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/.";
|
|
9801
9722
|
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).";
|
|
9802
9723
|
const isFeatureName = isVerbObjectBy(WORD_SEPARATOR);
|
|
9803
|
-
const placementProblem = ({ crate, inner, file }, root, join) => {
|
|
9804
|
-
if (!isInsideSource(inner)) return fileProblem$1({
|
|
9805
|
-
file,
|
|
9806
|
-
rule: LAYERED_RULE,
|
|
9807
|
-
message: OUTSIDE_MESSAGE
|
|
9808
|
-
});
|
|
9809
|
-
const top = Option.getOrElse(Array.head(modulePathOf(inner)), () => "");
|
|
9810
|
-
return fileProblem$1({
|
|
9811
|
-
file: join(root, crate, "src", top),
|
|
9812
|
-
rule: LAYERED_RULE,
|
|
9813
|
-
message: LAYER_MESSAGE
|
|
9814
|
-
});
|
|
9815
|
-
};
|
|
9816
9724
|
const itemProblem = (file, rule, message) => ({ line, column }) => ({
|
|
9817
9725
|
file,
|
|
9818
9726
|
line,
|
|
@@ -9826,21 +9734,11 @@ const isRootItem = (inner) => (item) => {
|
|
|
9826
9734
|
return item.kind === "function_item" && (inner === MAIN_FILE || BINARY.test(inner)) && Option.contains(item.name, MAIN);
|
|
9827
9735
|
};
|
|
9828
9736
|
const isLayerItem = (item) => Array.contains(LAYER_ITEMS, item.kind) || item.kind === "mod_item" && !item.inline;
|
|
9829
|
-
const importProblems = (file, modulePath, paths) => pipe(paths, Array.flatMap((path) => pipe(resolvedFrom({
|
|
9830
|
-
segments: path.segments,
|
|
9831
|
-
current: [...modulePath, ...path.scope]
|
|
9832
|
-
}), Option.flatMap((target) => importMessage({
|
|
9833
|
-
source: modulePath,
|
|
9834
|
-
target
|
|
9835
|
-
})), Option.map((message) => itemProblem(file, IMPORT_RULE, message)(path)), Option.toArray)), Array.dedupeWith((left, right) => left.line === right.line && left.column === right.column && left.message === right.message));
|
|
9836
9737
|
const entryProblems$1 = (file, modulePath, parsed) => {
|
|
9837
9738
|
if (!isSliceIndex(modulePath)) return NONE$2;
|
|
9838
9739
|
return pipe(parsed.items, Array.filter((item) => item.kind === "mod_item" && item.visible), Array.map(itemProblem(file, ENTRY_RULE$1, ENTRY_MESSAGE)));
|
|
9839
9740
|
};
|
|
9840
|
-
const moduleProblems = ({ source, parsed }) =>
|
|
9841
|
-
const modulePath = modulePathOf(source.inner);
|
|
9842
|
-
return [...entryProblems$1(source.file, modulePath, parsed), ...importProblems(source.file, modulePath, parsed.paths)];
|
|
9843
|
-
};
|
|
9741
|
+
const moduleProblems = ({ source, parsed }) => entryProblems$1(source.file, modulePathOf(source.inner), parsed);
|
|
9844
9742
|
const testProblems = ({ source, parsed }) => {
|
|
9845
9743
|
if (parsed.replacesAllocator) return NONE$2;
|
|
9846
9744
|
return [fileProblem$1({
|
|
@@ -9868,7 +9766,6 @@ const sliceNameProblems = (root, join, sources) => pipe(sources, Array.filter(({
|
|
|
9868
9766
|
rule: SLICE_RULE,
|
|
9869
9767
|
message: SLICE_MESSAGE
|
|
9870
9768
|
})));
|
|
9871
|
-
const misplacedProblems = (root, join, sources) => pipe(sources, Array.filter(({ inner }) => kindOf$1(inner) === "misplaced"), Array.map((source) => placementProblem(source, root, join)), Array.dedupeWith((left, right) => left.file === right.file));
|
|
9872
9769
|
const parsedWith = (language) => (source, text) => Option.map(readTree({
|
|
9873
9770
|
language,
|
|
9874
9771
|
source: text,
|
|
@@ -9883,7 +9780,7 @@ const isRead = ({ inner }) => {
|
|
|
9883
9780
|
};
|
|
9884
9781
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
9885
9782
|
const files = yield* RepositoryFiles;
|
|
9886
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
9783
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$3);
|
|
9887
9784
|
const owner = crateOf(crateDirectories(listed));
|
|
9888
9785
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
9889
9786
|
...owned,
|
|
@@ -9898,25 +9795,21 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
9898
9795
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
9899
9796
|
const parse = parsedWith(language);
|
|
9900
9797
|
const read = yield* Effect.forEach(pipe(sources, Array.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$18 });
|
|
9901
|
-
return [
|
|
9902
|
-
...misplacedProblems(root, files.join, sources),
|
|
9903
|
-
...sliceNameProblems(root, files.join, sources),
|
|
9904
|
-
...Array.flatMap(Array.getSomes(read), problemsOf$3)
|
|
9905
|
-
];
|
|
9798
|
+
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$3)];
|
|
9906
9799
|
});
|
|
9907
9800
|
// src/features/check-placement/model/source-aliases.ts
|
|
9908
9801
|
const ALIAS_RULE = "source-alias";
|
|
9909
|
-
const FIRST$
|
|
9802
|
+
const FIRST$13 = 1;
|
|
9910
9803
|
const SOURCE_ALIAS = "#/*";
|
|
9911
9804
|
const SOURCE_TARGET = "./src/*";
|
|
9912
9805
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
9913
9806
|
const ALIAS_MESSAGE = `points into src/ under its own name. Import source through "${SOURCE_ALIAS}": "${SOURCE_TARGET}" only, so an import names the layer and slice it uses instead of a folder alias.`;
|
|
9914
|
-
const Manifest$
|
|
9915
|
-
const decodeManifest$
|
|
9807
|
+
const Manifest$3 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
9808
|
+
const decodeManifest$6 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
9916
9809
|
const problemAt$6 = (file, rule, message) => ({
|
|
9917
9810
|
file,
|
|
9918
|
-
line: FIRST$
|
|
9919
|
-
column: FIRST$
|
|
9811
|
+
line: FIRST$13,
|
|
9812
|
+
column: FIRST$13,
|
|
9920
9813
|
rule,
|
|
9921
9814
|
message
|
|
9922
9815
|
});
|
|
@@ -9928,9 +9821,9 @@ const targetsOf = (target) => {
|
|
|
9928
9821
|
const intoSource = ([key, target]) => !(key === SOURCE_ALIAS && pipe(targetsOf(target), Array.every((path) => path === SOURCE_TARGET))) && pipe(targetsOf(target), Array.some((path) => SOURCE_PREFIX.test(path)));
|
|
9929
9822
|
const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, workspace) {
|
|
9930
9823
|
const files = yield* RepositoryFiles;
|
|
9931
|
-
const manifest = files.join(root, workspace, MANIFEST_FILE$
|
|
9824
|
+
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
9932
9825
|
const text = yield* files.readFile(manifest);
|
|
9933
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
9826
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.flatMap(({ imports }) => Option.liftPredicate(imports, Predicate.isObject)), Option.map((imports) => Record.toEntries(imports)), Option.getOrElse(() => Array.empty()), Array.filter(intoSource), Array.map(([key]) => problemAt$6(manifest, ALIAS_RULE, `"${key}" ${ALIAS_MESSAGE}`)));
|
|
9934
9827
|
});
|
|
9935
9828
|
/** @internal */
|
|
9936
9829
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
@@ -9944,7 +9837,7 @@ const checkPlacement = Effect.fn("checkPlacement")(function* checkPlacement(root
|
|
|
9944
9837
|
const found = yield* Effect.all([
|
|
9945
9838
|
checkDocPlacement(root),
|
|
9946
9839
|
checkColocatedTests(root),
|
|
9947
|
-
|
|
9840
|
+
checkPublicEntries(root),
|
|
9948
9841
|
checkRustModules(root),
|
|
9949
9842
|
checkSourceAliases(root),
|
|
9950
9843
|
checkSourceNames(root),
|
|
@@ -9964,17 +9857,17 @@ const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
|
9964
9857
|
const SEPARATOR$13 = "/";
|
|
9965
9858
|
const CURRENT = "./";
|
|
9966
9859
|
const READ_CONCURRENCY$17 = 8;
|
|
9967
|
-
const FIRST$
|
|
9860
|
+
const FIRST$12 = 1;
|
|
9968
9861
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
9969
9862
|
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9970
9863
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
9971
|
-
const Manifest$
|
|
9864
|
+
const Manifest$2 = Schema.Struct({
|
|
9972
9865
|
bin: Schema.optional(Schema.Unknown),
|
|
9973
9866
|
main: Schema.optional(Schema.Unknown),
|
|
9974
9867
|
exports: Schema.optional(Schema.Unknown)
|
|
9975
9868
|
});
|
|
9976
9869
|
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
9977
|
-
const decodeManifest$
|
|
9870
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
9978
9871
|
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
9979
9872
|
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
9980
9873
|
const NO_ENTRIES = {
|
|
@@ -10000,8 +9893,8 @@ const entriesOf$2 = (manifest) => {
|
|
|
10000
9893
|
};
|
|
10001
9894
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
10002
9895
|
const files = yield* RepositoryFiles;
|
|
10003
|
-
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$
|
|
10004
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
9896
|
+
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
9897
|
+
return pipe(text, Option.flatMap(decodeManifest$5), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
10005
9898
|
});
|
|
10006
9899
|
const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
10007
9900
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -10024,7 +9917,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array.fi
|
|
|
10024
9917
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
10025
9918
|
})));
|
|
10026
9919
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(runsIn));
|
|
10027
|
-
const problemsIn$
|
|
9920
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
10028
9921
|
const files = yield* RepositoryFiles;
|
|
10029
9922
|
const config = yield* workspaceConfigOf(root, directory);
|
|
10030
9923
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -10040,8 +9933,8 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
10040
9933
|
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
10041
9934
|
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
10042
9935
|
file: files.join(root, directory, path),
|
|
10043
|
-
line: FIRST$
|
|
10044
|
-
column: FIRST$
|
|
9936
|
+
line: FIRST$12,
|
|
9937
|
+
column: FIRST$12,
|
|
10045
9938
|
rule: UNRUN,
|
|
10046
9939
|
message: `No task, package.json bin or workflow runs ${workspacePath(directory, path)}. Files in ${BIN}/ are entry points for fallow, so an unused one is never reported. Run it from a task or delete it.`
|
|
10047
9940
|
})));
|
|
@@ -10053,8 +9946,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10053
9946
|
const isDirectory = yield* files.isDirectory(file);
|
|
10054
9947
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
10055
9948
|
file,
|
|
10056
|
-
line: FIRST$
|
|
10057
|
-
column: FIRST$
|
|
9949
|
+
line: FIRST$12,
|
|
9950
|
+
column: FIRST$12,
|
|
10058
9951
|
rule: SCRIPTS,
|
|
10059
9952
|
message: `${workspacePath(directory, SCRIPTS_DIRECTORY)} is a scripts directory. Put each command at ${BIN}/<name>.ts and the code that it shares in the package's own source, so that every workspace runs its commands the same way.`
|
|
10060
9953
|
})));
|
|
@@ -10063,21 +9956,26 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
10063
9956
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
10064
9957
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
10065
9958
|
const workflows = yield* workflowText(root);
|
|
10066
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
9959
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$13(root, directory, workflows), { concurrency: READ_CONCURRENCY$17 });
|
|
10067
9960
|
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$17 });
|
|
10068
9961
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
10069
9962
|
});
|
|
10070
9963
|
// src/features/check-repository-layout/model/crates.ts
|
|
10071
|
-
const RULE$
|
|
9964
|
+
const RULE$30 = "unverified-crate";
|
|
9965
|
+
const VERSION_RULE = "release-version";
|
|
9966
|
+
const MANIFEST_FILE$1 = "package.json";
|
|
9967
|
+
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
10072
9968
|
const CARGO_FILE = "Cargo.toml";
|
|
10073
9969
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
10074
9970
|
const SEPARATOR$12 = "/";
|
|
10075
|
-
const FIRST$
|
|
9971
|
+
const FIRST$11 = 1;
|
|
10076
9972
|
const READ_CONCURRENCY$16 = 8;
|
|
10077
9973
|
const CrateEntry = Schema.Struct({
|
|
10078
9974
|
name: Schema.String,
|
|
9975
|
+
version: Schema.String,
|
|
10079
9976
|
manifest_path: Schema.String
|
|
10080
9977
|
});
|
|
9978
|
+
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
10081
9979
|
const CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));
|
|
10082
9980
|
const decodeCrateList = Schema.decodeUnknownEffect(CrateList);
|
|
10083
9981
|
const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
@@ -10095,6 +9993,7 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
10095
9993
|
const list = yield* decodeCrateList(output);
|
|
10096
9994
|
return pipe(list.packages, Array.map((crate) => ({
|
|
10097
9995
|
name: crate.name,
|
|
9996
|
+
version: crate.version,
|
|
10098
9997
|
manifest: crate.manifest_path
|
|
10099
9998
|
})));
|
|
10100
9999
|
}, Effect.scoped);
|
|
@@ -10104,9 +10003,9 @@ const owningWorkspace = (directories) => (directory) => {
|
|
|
10104
10003
|
};
|
|
10105
10004
|
const problemFor$2 = (crate, message) => ({
|
|
10106
10005
|
file: crate.manifest,
|
|
10107
|
-
line: FIRST$
|
|
10108
|
-
column: FIRST$
|
|
10109
|
-
rule: RULE$
|
|
10006
|
+
line: FIRST$11,
|
|
10007
|
+
column: FIRST$11,
|
|
10008
|
+
rule: RULE$30,
|
|
10110
10009
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10111
10010
|
});
|
|
10112
10011
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10116,17 +10015,33 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories
|
|
|
10116
10015
|
if (yield* hasVerifyTask(files.join(root, workspace.value, CONFIG_FILE$5))) return Option.none();
|
|
10117
10016
|
return Option.some(problemFor$2(crate, `is in ${workspace.value}, whose ${CONFIG_FILE$5} has no verify task`));
|
|
10118
10017
|
});
|
|
10018
|
+
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
10019
|
+
const files = yield* RepositoryFiles;
|
|
10020
|
+
const directory = files.relative(root, files.dirname(crate.manifest));
|
|
10021
|
+
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))));
|
|
10022
|
+
if (Option.isNone(workspace)) return Option.none();
|
|
10023
|
+
const text = yield* files.readFile(files.join(root, workspace.value, MANIFEST_FILE$1));
|
|
10024
|
+
const version = pipe(text, Option.flatMap(Schema.decodeOption(PackageVersion)), Option.map((manifest) => manifest.version));
|
|
10025
|
+
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
10026
|
+
return Option.some({
|
|
10027
|
+
file: crate.manifest,
|
|
10028
|
+
line: FIRST$11,
|
|
10029
|
+
column: FIRST$11,
|
|
10030
|
+
rule: VERSION_RULE,
|
|
10031
|
+
message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${MANIFEST_FILE$1} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
|
|
10032
|
+
});
|
|
10033
|
+
});
|
|
10119
10034
|
/** @internal */
|
|
10120
10035
|
const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
10121
10036
|
const files = yield* RepositoryFiles;
|
|
10122
10037
|
if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
|
|
10123
10038
|
const directories = yield* workspaceDirectories(root);
|
|
10124
10039
|
const crates = yield* cratesIn(root);
|
|
10125
|
-
const found = yield* Effect.forEach(crates, (crate) => problemIn$2(root, directories, crate), { concurrency: READ_CONCURRENCY$16 });
|
|
10126
|
-
return Array.getSomes(found);
|
|
10040
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$16 });
|
|
10041
|
+
return Array.getSomes(Array.flatten(found));
|
|
10127
10042
|
});
|
|
10128
10043
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10129
|
-
const RULE$
|
|
10044
|
+
const RULE$29 = "deploy-entry-pattern";
|
|
10130
10045
|
const FALLOW_KEYS = [
|
|
10131
10046
|
"entry",
|
|
10132
10047
|
"entryPoints",
|
|
@@ -10145,7 +10060,7 @@ const ROOT_WORKSPACE = ".";
|
|
|
10145
10060
|
const WRAP_OFFSET$1 = 1;
|
|
10146
10061
|
const NO_OFFSET = 0;
|
|
10147
10062
|
const READ_CONCURRENCY$15 = 8;
|
|
10148
|
-
const MESSAGE$
|
|
10063
|
+
const MESSAGE$9 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
10149
10064
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10150
10065
|
const FALLOW = {
|
|
10151
10066
|
keys: FALLOW_KEYS,
|
|
@@ -10181,7 +10096,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
10181
10096
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
10182
10097
|
return pipe(patternsIn(kind.keys)(parsed.program), Array.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
10183
10098
|
});
|
|
10184
|
-
const problemsIn$
|
|
10099
|
+
const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
10185
10100
|
const { root, file, kind, workspaces, entries } = request;
|
|
10186
10101
|
const files = yield* RepositoryFiles;
|
|
10187
10102
|
const path = files.join(root, file);
|
|
@@ -10197,8 +10112,8 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10197
10112
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10198
10113
|
file: path,
|
|
10199
10114
|
...positionOf(text.value)(start - kind.offset),
|
|
10200
|
-
rule: RULE$
|
|
10201
|
-
message: `${pattern} ${MESSAGE$
|
|
10115
|
+
rule: RULE$29,
|
|
10116
|
+
message: `${pattern} ${MESSAGE$9}`
|
|
10202
10117
|
})));
|
|
10203
10118
|
});
|
|
10204
10119
|
/** @internal */
|
|
@@ -10220,7 +10135,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10220
10135
|
}];
|
|
10221
10136
|
return [];
|
|
10222
10137
|
}));
|
|
10223
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
10138
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$12({
|
|
10224
10139
|
root,
|
|
10225
10140
|
file,
|
|
10226
10141
|
kind,
|
|
@@ -10230,7 +10145,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10230
10145
|
return Array.flatten(found);
|
|
10231
10146
|
});
|
|
10232
10147
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10233
|
-
const RULE$
|
|
10148
|
+
const RULE$28 = "listed-entry";
|
|
10234
10149
|
const ENTRY_KEYS = [
|
|
10235
10150
|
"entry",
|
|
10236
10151
|
"entryPoints",
|
|
@@ -10251,7 +10166,7 @@ const entryPatternsIn = (node) => {
|
|
|
10251
10166
|
return pipe(childrenOf$2(node), Array.flatMap(entryPatternsIn));
|
|
10252
10167
|
};
|
|
10253
10168
|
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);
|
|
10254
|
-
const problemsIn$
|
|
10169
|
+
const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
10255
10170
|
const files = yield* RepositoryFiles;
|
|
10256
10171
|
const path = files.join(root, file);
|
|
10257
10172
|
const text = yield* files.readFile(path);
|
|
@@ -10260,7 +10175,7 @@ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10260
10175
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10261
10176
|
file: path,
|
|
10262
10177
|
...positionOf(text.value)(start),
|
|
10263
|
-
rule: RULE$
|
|
10178
|
+
rule: RULE$28,
|
|
10264
10179
|
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.`
|
|
10265
10180
|
})));
|
|
10266
10181
|
});
|
|
@@ -10268,13 +10183,13 @@ const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10268
10183
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10269
10184
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10270
10185
|
const directories = yield* workspaceDirectories(root);
|
|
10271
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
10186
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$11(root, file, directories), { concurrency: READ_CONCURRENCY$14 });
|
|
10272
10187
|
return Array.flatten(found);
|
|
10273
10188
|
});
|
|
10274
10189
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10275
|
-
const RULE$
|
|
10190
|
+
const RULE$27 = "hidden-verify";
|
|
10276
10191
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10277
|
-
const FIRST$
|
|
10192
|
+
const FIRST$10 = 1;
|
|
10278
10193
|
const READ_CONCURRENCY$13 = 8;
|
|
10279
10194
|
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10280
10195
|
const config = yield* workspaceConfigOf(root, directory);
|
|
@@ -10284,9 +10199,9 @@ const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
10284
10199
|
const verified = yield* hasVerifyTask(file);
|
|
10285
10200
|
return Option.some({
|
|
10286
10201
|
file,
|
|
10287
|
-
line: FIRST$
|
|
10288
|
-
column: FIRST$
|
|
10289
|
-
rule: RULE$
|
|
10202
|
+
line: FIRST$10,
|
|
10203
|
+
column: FIRST$10,
|
|
10204
|
+
rule: RULE$27,
|
|
10290
10205
|
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}.`
|
|
10291
10206
|
}).pipe(Option.filter(() => verified));
|
|
10292
10207
|
});
|
|
@@ -10297,11 +10212,11 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
10297
10212
|
return Array.getSomes(found);
|
|
10298
10213
|
});
|
|
10299
10214
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10300
|
-
const RULE$
|
|
10215
|
+
const RULE$26 = "root-workspace-path";
|
|
10301
10216
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
10302
10217
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10303
10218
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10304
|
-
const FIRST$
|
|
10219
|
+
const FIRST$9 = 0;
|
|
10305
10220
|
const NEXT$2 = 1;
|
|
10306
10221
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10307
10222
|
const mentions$1 = (directory) => (text) => {
|
|
@@ -10309,14 +10224,14 @@ const mentions$1 = (directory) => (text) => {
|
|
|
10309
10224
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10310
10225
|
const before = parts[index] ?? "";
|
|
10311
10226
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10312
|
-
const following = String$1.slice(FIRST$
|
|
10227
|
+
const following = String$1.slice(FIRST$9, NEXT$2)(after);
|
|
10313
10228
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10314
10229
|
}));
|
|
10315
10230
|
};
|
|
10316
|
-
const problemsIn$
|
|
10231
|
+
const problemsIn$10 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions$1(directory)(found.text)), Array.map((directory) => ({
|
|
10317
10232
|
file,
|
|
10318
10233
|
...positionOf(source)(found.start),
|
|
10319
|
-
rule: RULE$
|
|
10234
|
+
rule: RULE$26,
|
|
10320
10235
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$3} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$3}: msch.lint, msch.devDependencies or its verify task.`
|
|
10321
10236
|
})));
|
|
10322
10237
|
/** @internal */
|
|
@@ -10327,10 +10242,10 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
10327
10242
|
if (Option.isNone(source)) return [];
|
|
10328
10243
|
const directories = yield* workspaceDirectories(root);
|
|
10329
10244
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10330
|
-
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$
|
|
10245
|
+
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$10(file, source.value, directories)));
|
|
10331
10246
|
});
|
|
10332
10247
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10333
|
-
const RULE$
|
|
10248
|
+
const RULE$25 = "shared-uncached-task";
|
|
10334
10249
|
const READ_CONCURRENCY$12 = 8;
|
|
10335
10250
|
const SHARED = 2;
|
|
10336
10251
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -10373,7 +10288,7 @@ const problemsOf$2 = (definitions) => {
|
|
|
10373
10288
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10374
10289
|
file,
|
|
10375
10290
|
...position,
|
|
10376
|
-
rule: RULE$
|
|
10291
|
+
rule: RULE$25,
|
|
10377
10292
|
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.`
|
|
10378
10293
|
})));
|
|
10379
10294
|
};
|
|
@@ -10519,13 +10434,13 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10519
10434
|
/** @internal */
|
|
10520
10435
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10521
10436
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10522
|
-
const RULE$
|
|
10437
|
+
const RULE$24 = "workflow-path";
|
|
10523
10438
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10524
10439
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10525
10440
|
const READ_CONCURRENCY$11 = 8;
|
|
10526
10441
|
const WILDCARD$2 = /[*?[]/u;
|
|
10527
10442
|
const SEPARATOR$9 = "/";
|
|
10528
|
-
const FIRST$
|
|
10443
|
+
const FIRST$8 = 0;
|
|
10529
10444
|
const EXPECTED = {
|
|
10530
10445
|
action: "a directory with action.yml",
|
|
10531
10446
|
directory: "a directory",
|
|
@@ -10566,7 +10481,7 @@ const RESOLVERS = {
|
|
|
10566
10481
|
};
|
|
10567
10482
|
const staticPrefix = (path) => {
|
|
10568
10483
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10569
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$
|
|
10484
|
+
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$8, -1)(prefix);
|
|
10570
10485
|
return prefix;
|
|
10571
10486
|
};
|
|
10572
10487
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -10582,25 +10497,25 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
10582
10497
|
if (yield* RESOLVERS[found.kind](root, found.path)) return false;
|
|
10583
10498
|
return !(yield* isIgnored$1(root, found.path));
|
|
10584
10499
|
});
|
|
10585
|
-
const problemOf$
|
|
10500
|
+
const problemOf$7 = (file, source) => (found) => ({
|
|
10586
10501
|
file,
|
|
10587
10502
|
...positionOf(source)(found.offset),
|
|
10588
|
-
rule: RULE$
|
|
10503
|
+
rule: RULE$24,
|
|
10589
10504
|
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.`
|
|
10590
10505
|
});
|
|
10591
|
-
const problemsIn$
|
|
10506
|
+
const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
10592
10507
|
const files = yield* RepositoryFiles;
|
|
10593
10508
|
const file = files.join(root, workflow);
|
|
10594
10509
|
const source = yield* files.readFile(file);
|
|
10595
10510
|
if (Option.isNone(source)) return [];
|
|
10596
10511
|
const produced = producedPaths(source.value);
|
|
10597
10512
|
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing(root, produced, found));
|
|
10598
|
-
return pipe(missing, Array.map(problemOf$
|
|
10513
|
+
return pipe(missing, Array.map(problemOf$7(file, source.value)));
|
|
10599
10514
|
});
|
|
10600
10515
|
/** @internal */
|
|
10601
10516
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10602
10517
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10603
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$
|
|
10518
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$9(root, workflow), { concurrency: READ_CONCURRENCY$11 });
|
|
10604
10519
|
return Array.flatten(found);
|
|
10605
10520
|
});
|
|
10606
10521
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10611,7 +10526,7 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10611
10526
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10612
10527
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10613
10528
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10614
|
-
const START$
|
|
10529
|
+
const START$13 = 0;
|
|
10615
10530
|
const READ_CONCURRENCY$10 = 8;
|
|
10616
10531
|
const SEPARATOR$8 = "/";
|
|
10617
10532
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
@@ -10642,7 +10557,7 @@ const namesIn = (name, source) => {
|
|
|
10642
10557
|
return [
|
|
10643
10558
|
{
|
|
10644
10559
|
text: name,
|
|
10645
|
-
offset: START$
|
|
10560
|
+
offset: START$13
|
|
10646
10561
|
},
|
|
10647
10562
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10648
10563
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10713,12 +10628,12 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10713
10628
|
return Array.flatten(found);
|
|
10714
10629
|
});
|
|
10715
10630
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
10716
|
-
const RULE$
|
|
10631
|
+
const RULE$23 = "legacy-typescript";
|
|
10717
10632
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
10718
10633
|
const COMPILER = "typescript";
|
|
10719
10634
|
const CURRENT_MAJOR = 7;
|
|
10720
10635
|
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
10721
|
-
const FIRST$
|
|
10636
|
+
const FIRST$7 = 1;
|
|
10722
10637
|
const legacyOf = (id) => {
|
|
10723
10638
|
const { name, version } = parse$1(id);
|
|
10724
10639
|
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
@@ -10729,8 +10644,8 @@ const legacyOf = (id) => {
|
|
|
10729
10644
|
};
|
|
10730
10645
|
const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
|
|
10731
10646
|
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
10732
|
-
onNone: () => FIRST$
|
|
10733
|
-
onSome: (index) => index + FIRST$
|
|
10647
|
+
onNone: () => FIRST$7,
|
|
10648
|
+
onSome: (index) => index + FIRST$7
|
|
10734
10649
|
}));
|
|
10735
10650
|
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)}.`;
|
|
10736
10651
|
/** @internal */
|
|
@@ -10743,8 +10658,8 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
10743
10658
|
return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
|
|
10744
10659
|
file,
|
|
10745
10660
|
line: lineOf$2(source)(legacy.id),
|
|
10746
|
-
column: FIRST$
|
|
10747
|
-
rule: RULE$
|
|
10661
|
+
column: FIRST$7,
|
|
10662
|
+
rule: RULE$23,
|
|
10748
10663
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
10749
10664
|
})));
|
|
10750
10665
|
});
|
|
@@ -10968,7 +10883,7 @@ const listConfigFiles = (root) => Effect.gen(function* configFilesUnder() {
|
|
|
10968
10883
|
const parseConfig = (api) => (configPath) => Option.some(api.parseConfigFile(configPath)).pipe(Option.filter((parsed) => Array.isReadonlyArrayNonEmpty(parsed.fileNames)));
|
|
10969
10884
|
const nearestPackageDirectory = (directory, root) => Effect.gen(function* nearestPackage() {
|
|
10970
10885
|
const files = yield* RepositoryFiles;
|
|
10971
|
-
const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE$
|
|
10886
|
+
const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE$3));
|
|
10972
10887
|
const parent = files.dirname(directory);
|
|
10973
10888
|
if (hasManifest || directory === root || parent === directory) return directory;
|
|
10974
10889
|
return yield* nearestPackageDirectory(parent, root);
|
|
@@ -11131,7 +11046,7 @@ const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath
|
|
|
11131
11046
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
11132
11047
|
const SUBPATH_IMPORT = "#";
|
|
11133
11048
|
const WILDCARD$1 = "*";
|
|
11134
|
-
const SCOPE$
|
|
11049
|
+
const SCOPE$2 = "@";
|
|
11135
11050
|
const SEPARATOR$6 = "/";
|
|
11136
11051
|
const SOURCE_SUFFIXES = [
|
|
11137
11052
|
"",
|
|
@@ -11145,7 +11060,7 @@ const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Sche
|
|
|
11145
11060
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
11146
11061
|
const packageNameOf = (specifier) => {
|
|
11147
11062
|
const segments = String$1.split(specifier, SEPARATOR$6);
|
|
11148
|
-
if (String$1.startsWith(SCOPE$
|
|
11063
|
+
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$6));
|
|
11149
11064
|
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$6));
|
|
11150
11065
|
};
|
|
11151
11066
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
@@ -11218,7 +11133,7 @@ const packagesFrom = (graph, walk) => Array.match(walk.pending, {
|
|
|
11218
11133
|
/** @internal */
|
|
11219
11134
|
const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(api, directory, entries) {
|
|
11220
11135
|
const files = yield* RepositoryFiles;
|
|
11221
|
-
const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE$
|
|
11136
|
+
const manifest = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11222
11137
|
const graph = {
|
|
11223
11138
|
api,
|
|
11224
11139
|
directory,
|
|
@@ -11241,7 +11156,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
11241
11156
|
peerDependencies: DependencyMap,
|
|
11242
11157
|
peerDependenciesMeta: PeerMeta
|
|
11243
11158
|
});
|
|
11244
|
-
const decodeManifest$
|
|
11159
|
+
const decodeManifest$4 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11245
11160
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11246
11161
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11247
11162
|
const installedNames = (manifest) => [
|
|
@@ -11251,8 +11166,8 @@ const installedNames = (manifest) => [
|
|
|
11251
11166
|
];
|
|
11252
11167
|
const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11253
11168
|
const files = yield* RepositoryFiles;
|
|
11254
|
-
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$
|
|
11255
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
11169
|
+
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11170
|
+
return pipe(text, Option.flatMap(decodeManifest$4), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11256
11171
|
});
|
|
11257
11172
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11258
11173
|
const files = yield* RepositoryFiles;
|
|
@@ -11314,11 +11229,11 @@ const LISTED_LARGEST = 5;
|
|
|
11314
11229
|
const SIZE_CONCURRENCY = 32;
|
|
11315
11230
|
const MEGABYTE = 1e6;
|
|
11316
11231
|
const MEGABYTE_DIGITS = 1;
|
|
11317
|
-
const START$
|
|
11232
|
+
const START$12 = 0;
|
|
11318
11233
|
const SINGLE_ENTRY = 1;
|
|
11319
11234
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11320
11235
|
const usageHint = (dependency, entryCount) => {
|
|
11321
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
11236
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$12 && dependency.entries.length < entryCount)) return "";
|
|
11322
11237
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11323
11238
|
};
|
|
11324
11239
|
const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11327,7 +11242,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11327
11242
|
const { workspace, total } = overrun;
|
|
11328
11243
|
const config = yield* files.readFile(workspace.configFile);
|
|
11329
11244
|
const source = Option.getOrElse(config, () => "");
|
|
11330
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
11245
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$12);
|
|
11331
11246
|
return {
|
|
11332
11247
|
file: workspace.configFile,
|
|
11333
11248
|
...positionOf(source)(index),
|
|
@@ -11344,7 +11259,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11344
11259
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11345
11260
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11346
11261
|
const sizes = HashMap.fromIterable(measured);
|
|
11347
|
-
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
11262
|
+
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$12))));
|
|
11348
11263
|
return {
|
|
11349
11264
|
closures,
|
|
11350
11265
|
sizeOf,
|
|
@@ -11377,11 +11292,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11377
11292
|
})];
|
|
11378
11293
|
});
|
|
11379
11294
|
const stackProblems = (file, source, dependencies) => {
|
|
11380
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$
|
|
11295
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$12);
|
|
11381
11296
|
const rest = String$1.slice(section)(source);
|
|
11382
11297
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11383
11298
|
file,
|
|
11384
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
11299
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$12)),
|
|
11385
11300
|
rule: STACK_DEPENDENCY,
|
|
11386
11301
|
message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
|
|
11387
11302
|
})));
|
|
@@ -11413,7 +11328,7 @@ const problemsOf$1 = Effect.fn("problemsOf")(function* problemsOf(workspace, fil
|
|
|
11413
11328
|
});
|
|
11414
11329
|
const workspaceProblems = Effect.fn("workspaceProblems")(function* workspaceProblems(workspace) {
|
|
11415
11330
|
const files = yield* RepositoryFiles;
|
|
11416
|
-
const file = files.join(workspace.directory, MANIFEST_FILE$
|
|
11331
|
+
const file = files.join(workspace.directory, MANIFEST_FILE$3);
|
|
11417
11332
|
const source = yield* files.readFile(file);
|
|
11418
11333
|
return yield* Option.match(source, {
|
|
11419
11334
|
onNone: () => Effect.succeed([]),
|
|
@@ -11892,8 +11807,11 @@ const CACHE_DIRECTORY = [
|
|
|
11892
11807
|
];
|
|
11893
11808
|
const CACHE_SUFFIX = ".json";
|
|
11894
11809
|
const MANIFEST_ENTRY = "package.json";
|
|
11895
|
-
const
|
|
11810
|
+
const SOURCE_ENTRY = "src";
|
|
11811
|
+
const LOWER_LAYERS = ["entities", "shared"];
|
|
11812
|
+
const PATH_SEPARATOR = "/";
|
|
11896
11813
|
const EMPTY = "";
|
|
11814
|
+
const NOT_INSTALLED = [];
|
|
11897
11815
|
const FIELD_SEPARATOR = "\0";
|
|
11898
11816
|
const LINE_SEPARATOR = "\n";
|
|
11899
11817
|
const ValueSchema = Schema.Union([Schema.String, Schema.Finite]);
|
|
@@ -11939,25 +11857,56 @@ const fileDigest = (hash) => {
|
|
|
11939
11857
|
});
|
|
11940
11858
|
};
|
|
11941
11859
|
const digestEntries = (digestFile) => (named) => Effect.forEach(named, ([name, file]) => digestFile(file).pipe(Effect.map((found) => entryOf(name, found))), { concurrency: 1 });
|
|
11942
|
-
const
|
|
11860
|
+
const walked = (directory) => Effect.gen(function* walkFrom() {
|
|
11943
11861
|
const files = yield* RepositoryFiles;
|
|
11944
|
-
const
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11862
|
+
const found = yield* files.walkDirectory(directory);
|
|
11863
|
+
return pipe(found, Array.map((file) => files.join(directory, file)));
|
|
11864
|
+
});
|
|
11865
|
+
const sourceFiles = Effect.fn("sourceFiles")(function* sourceFiles(root, moduleDirectory) {
|
|
11866
|
+
const files = yield* RepositoryFiles;
|
|
11867
|
+
const source = files.join(root, SOURCE_ENTRY);
|
|
11868
|
+
const layers = pipe(LOWER_LAYERS, Array.map((layer) => files.join(source, layer)));
|
|
11869
|
+
const nested = yield* Effect.forEach([files.dirname(moduleDirectory), ...layers], walked, { concurrency: 1 });
|
|
11870
|
+
return Array.flatten(nested);
|
|
11871
|
+
});
|
|
11872
|
+
const bundleParts = Effect.fn("bundleParts")(function* bundleParts(root, moduleDirectory) {
|
|
11873
|
+
const files = yield* RepositoryFiles;
|
|
11874
|
+
const bundled = yield* walked(moduleDirectory);
|
|
11875
|
+
return {
|
|
11876
|
+
listed: [files.join(root, MANIFEST_ENTRY), ...bundled],
|
|
11877
|
+
installed: NOT_INSTALLED
|
|
11878
|
+
};
|
|
11879
|
+
});
|
|
11880
|
+
const sourceParts = Effect.fn("sourceParts")(function* sourceParts(root, moduleDirectory) {
|
|
11881
|
+
return {
|
|
11882
|
+
listed: yield* sourceFiles(root, moduleDirectory),
|
|
11883
|
+
installed: yield* installedPackages(root, root)
|
|
11884
|
+
};
|
|
11885
|
+
});
|
|
11886
|
+
/** @internal */
|
|
11887
|
+
const implementationOf = Effect.fn("implementationOf")(function* implementationOf(moduleDirectory) {
|
|
11888
|
+
const files = yield* RepositoryFiles;
|
|
11889
|
+
const root = yield* nearestManifestDirectory(moduleDirectory);
|
|
11890
|
+
const fromSource = String$1.startsWith(`${files.join(root, SOURCE_ENTRY)}${PATH_SEPARATOR}`)(moduleDirectory);
|
|
11891
|
+
const parts = yield* Boolean$1.match(fromSource, {
|
|
11892
|
+
onFalse: () => bundleParts(root, moduleDirectory),
|
|
11893
|
+
onTrue: () => sourceParts(root, moduleDirectory)
|
|
11894
|
+
});
|
|
11895
|
+
return {
|
|
11896
|
+
files: pipe(Array.sort(parts.listed, String$1.Order), Array.map((file) => [files.relative(root, file), file])),
|
|
11897
|
+
installed: parts.installed
|
|
11898
|
+
};
|
|
11949
11899
|
});
|
|
11950
11900
|
const fingerprintOf = Effect.fn("fingerprintOf")(function* fingerprintOf(hash) {
|
|
11951
|
-
const
|
|
11952
|
-
const
|
|
11953
|
-
|
|
11954
|
-
return yield* hash(Array.join(entries, LINE_SEPARATOR));
|
|
11901
|
+
const implementation = yield* implementationOf(import.meta.dirname);
|
|
11902
|
+
const entries = yield* digestEntries(fileDigest(hash))(implementation.files);
|
|
11903
|
+
return yield* hash(Array.join([...implementation.installed, ...entries], LINE_SEPARATOR));
|
|
11955
11904
|
});
|
|
11956
11905
|
const analysisCache = Effect.fn("analysisCache")(function* analysisCache(root, owners) {
|
|
11957
11906
|
const files = yield* RepositoryFiles;
|
|
11958
11907
|
const hash = yield* hasher;
|
|
11959
11908
|
const fingerprint = yield* fingerprintOf(hash);
|
|
11960
|
-
const salt = yield* hash(Array.join([fingerprint, owners], FIELD_SEPARATOR));
|
|
11909
|
+
const salt = yield* hash(Array.join([fingerprint, String$1.replaceAll(root, EMPTY)(owners)], FIELD_SEPARATOR));
|
|
11961
11910
|
return {
|
|
11962
11911
|
root,
|
|
11963
11912
|
directory: files.join(root, ...CACHE_DIRECTORY),
|
|
@@ -11972,7 +11921,7 @@ const keyOf = (cache) => (configPath, inputs) => Effect.gen(function* deriveKey(
|
|
|
11972
11921
|
const header = [
|
|
11973
11922
|
cache.salt,
|
|
11974
11923
|
files.relative(cache.root, configPath),
|
|
11975
|
-
inputs.options
|
|
11924
|
+
String$1.replaceAll(cache.root, EMPTY)(inputs.options)
|
|
11976
11925
|
];
|
|
11977
11926
|
return yield* cache.hash(Array.join([
|
|
11978
11927
|
...header,
|
|
@@ -11980,17 +11929,35 @@ const keyOf = (cache) => (configPath, inputs) => Effect.gen(function* deriveKey(
|
|
|
11980
11929
|
...entries
|
|
11981
11930
|
], LINE_SEPARATOR));
|
|
11982
11931
|
});
|
|
11932
|
+
const moved = (move) => (analysis) => ({
|
|
11933
|
+
problems: pipe(analysis.problems, Array.map((problem) => ({
|
|
11934
|
+
...problem,
|
|
11935
|
+
file: move(problem.file)
|
|
11936
|
+
}))),
|
|
11937
|
+
unowned: pipe(analysis.unowned, Array.map((site) => ({
|
|
11938
|
+
...site,
|
|
11939
|
+
file: move(site.file)
|
|
11940
|
+
}))),
|
|
11941
|
+
literals: pipe(analysis.literals, Array.map((found) => ({
|
|
11942
|
+
...found,
|
|
11943
|
+
file: move(found.file),
|
|
11944
|
+
imports: pipe(found.imports, Array.map(move))
|
|
11945
|
+
})))
|
|
11946
|
+
});
|
|
11983
11947
|
const entryFile = (cache, key) => `${cache.directory}/${key}${CACHE_SUFFIX}`;
|
|
11984
11948
|
const readAnalysis = (cache) => (key) => Effect.gen(function* readCached() {
|
|
11985
|
-
const
|
|
11949
|
+
const files = yield* RepositoryFiles;
|
|
11950
|
+
const text = yield* files.readFile(entryFile(cache, key));
|
|
11951
|
+
const restored = moved((file) => files.resolve(cache.root, file));
|
|
11986
11952
|
return yield* Option.match(text, {
|
|
11987
11953
|
onNone: () => Effect.succeedNone,
|
|
11988
11954
|
onSome: (found) => Schema.decodeEffect(AnalysisJson)(found).pipe(Effect.option)
|
|
11989
|
-
});
|
|
11955
|
+
}).pipe(Effect.map(Option.map(restored)));
|
|
11990
11956
|
});
|
|
11991
11957
|
const writeAnalysis = (cache) => (key, analysis) => Effect.gen(function* writeCached() {
|
|
11992
11958
|
const files = yield* RepositoryFiles;
|
|
11993
|
-
const
|
|
11959
|
+
const portable = moved((file) => files.relative(cache.root, file))(analysis);
|
|
11960
|
+
const text = yield* Schema.encodeEffect(AnalysisJson)(portable).pipe(Effect.option);
|
|
11994
11961
|
yield* Option.match(text, {
|
|
11995
11962
|
onNone: () => Effect.void,
|
|
11996
11963
|
onSome: (found) => files.writeFile(entryFile(cache, key), found)
|
|
@@ -12035,7 +12002,7 @@ const duplicateProblems = (relative) => (sites) => {
|
|
|
12035
12002
|
}))));
|
|
12036
12003
|
};
|
|
12037
12004
|
// src/features/check-value-owners/model/name-lists.ts
|
|
12038
|
-
const RULE$
|
|
12005
|
+
const RULE$22 = "hand-written-names";
|
|
12039
12006
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
12040
12007
|
const nameListOf = (site) => {
|
|
12041
12008
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -12046,11 +12013,11 @@ const nameListOf = (site) => {
|
|
|
12046
12013
|
}, (list) => list.names.length === site.values.length);
|
|
12047
12014
|
};
|
|
12048
12015
|
const mostNamesOf = (list) => Math.max(2, list.names.length - 1);
|
|
12049
|
-
const problemOf$
|
|
12016
|
+
const problemOf$6 = ({ list, reason }) => ({
|
|
12050
12017
|
file: list.site.file,
|
|
12051
12018
|
line: list.site.line,
|
|
12052
12019
|
column: list.site.column,
|
|
12053
|
-
rule: RULE$
|
|
12020
|
+
rule: RULE$22,
|
|
12054
12021
|
message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
|
|
12055
12022
|
});
|
|
12056
12023
|
// src/features/check-value-owners/model/declared-names.ts
|
|
@@ -12081,7 +12048,7 @@ const declaredNameProblem = ({ literals, relative }) => {
|
|
|
12081
12048
|
if (defined.length < mostNamesOf(list) || files.length < 2) return Option.none();
|
|
12082
12049
|
const names = pipe(defined, Array.map(([name]) => name));
|
|
12083
12050
|
const shown = pipe(files, Array.take(SHOWN_FILES), Array.map(relative), Array.join(", "));
|
|
12084
|
-
return Option.some(problemOf$
|
|
12051
|
+
return Option.some(problemOf$6({
|
|
12085
12052
|
list,
|
|
12086
12053
|
reason: `${formatValues(names)} are each written in another module (${shown}). Type those values with this list, or build this list from them, so that adding one does not mean editing two places.`
|
|
12087
12054
|
}));
|
|
@@ -12114,11 +12081,11 @@ const listedPathProblem = (repository) => (list) => {
|
|
|
12114
12081
|
const paths = pipe(list.names, Array.map(namedPath(repository, list.site.file)), Array.getSomes);
|
|
12115
12082
|
const packages = pipe(list.names, Array.filter((name) => HashSet.has(repository.packages, name)));
|
|
12116
12083
|
const directory = enumeratedDirectory(repository)(paths);
|
|
12117
|
-
if (Option.isSome(directory)) return Option.some(problemOf$
|
|
12084
|
+
if (Option.isSome(directory)) return Option.some(problemOf$6({
|
|
12118
12085
|
list,
|
|
12119
12086
|
reason: `they enumerate the entries of ${directoryLabel(directory.value)}. Find them with a glob or derive them from the declaration that names them.`
|
|
12120
12087
|
}));
|
|
12121
|
-
if (packages.length >= 2) return Option.some(problemOf$
|
|
12088
|
+
if (packages.length >= 2) return Option.some(problemOf$6({
|
|
12122
12089
|
list,
|
|
12123
12090
|
reason: `${formatValues(packages)} are workspace packages. Derive them from the workspace manifests or from a property that each package declares.`
|
|
12124
12091
|
}));
|
|
@@ -12133,7 +12100,7 @@ const connected = (index) => (left, right) => left === right || imports(index)(l
|
|
|
12133
12100
|
const isPartOf = (index, list) => (other) => other !== list && canImport(list.site.scope, other.site.scope) && connected(index)(list.site.file, other.site.file) && isSubsetOf(list.names, other.names) && list.names.length * SUBSET_SHARE >= other.names.length && !sameValues(list.names, other.names);
|
|
12134
12101
|
const subsetListProblem = ({ lists, literals, relative }) => {
|
|
12135
12102
|
const index = importIndexOf(literals);
|
|
12136
|
-
return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$
|
|
12103
|
+
return (list) => pipe(lists, Array.findFirst(isPartOf(index, list)), Option.map((other) => problemOf$6({
|
|
12137
12104
|
list,
|
|
12138
12105
|
reason: `they are a part of ${formatValues(other.names)} at ${relative(other.site.file)}:${String(other.site.line)}. Name that list once and select from it with Extract or Exclude.`
|
|
12139
12106
|
})));
|
|
@@ -12159,13 +12126,13 @@ const MANIFEST$2 = "package.json";
|
|
|
12159
12126
|
const SEPARATOR$4 = "/";
|
|
12160
12127
|
const FIRST_SEGMENT = 1;
|
|
12161
12128
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12162
|
-
const decodeManifest$
|
|
12129
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(ManifestJson);
|
|
12163
12130
|
const prefixesOf = (file) => {
|
|
12164
12131
|
const segments = pipe(file, String$1.split(SEPARATOR$4));
|
|
12165
12132
|
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$4))));
|
|
12166
12133
|
};
|
|
12167
12134
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12168
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
12135
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$3), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12169
12136
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12170
12137
|
const files = yield* RepositoryFiles;
|
|
12171
12138
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12277,7 +12244,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12277
12244
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12278
12245
|
}, Effect.scoped);
|
|
12279
12246
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12280
|
-
const RULE$
|
|
12247
|
+
const RULE$21 = "namespace-destructuring";
|
|
12281
12248
|
const LOCAL = /^[.#/]/u;
|
|
12282
12249
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
12283
12250
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12292,16 +12259,16 @@ const destructuredName = (declaration) => {
|
|
|
12292
12259
|
if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
|
|
12293
12260
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12294
12261
|
};
|
|
12295
|
-
const problemOf$
|
|
12296
|
-
rule: RULE$
|
|
12262
|
+
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
|
|
12263
|
+
rule: RULE$21,
|
|
12297
12264
|
message: messageOf$1(name)
|
|
12298
12265
|
})), Option.map((report) => report(declaration)));
|
|
12299
12266
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
12300
12267
|
const names = importedNames(sourceFile);
|
|
12301
|
-
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$
|
|
12268
|
+
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
12302
12269
|
};
|
|
12303
12270
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12304
|
-
const RULE$
|
|
12271
|
+
const RULE$20 = "pass-through-wrapper";
|
|
12305
12272
|
const SINGLE_STATEMENT = 1;
|
|
12306
12273
|
const SINGLE_DECLARATION = 1;
|
|
12307
12274
|
const THIS_PARAMETER = "this";
|
|
@@ -12395,32 +12362,32 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12395
12362
|
const restForwarded = pipe(wrapper.parameters, Array.some(isRest));
|
|
12396
12363
|
return Option.exists(forwardedNames(wrapper, forward), (names) => callsAnotherFunction(candidate, forward, names)) && (restForwarded || calleeTakesExactly(checker)(forward, wrapper.parameters.length)) && keepsTheReturnType(checker)(wrapper, forward) && !isOverloaded(checker)(name);
|
|
12397
12364
|
};
|
|
12398
|
-
const problemOf$
|
|
12365
|
+
const problemOf$4 = (checker) => (candidate) => {
|
|
12399
12366
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12400
12367
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$9({
|
|
12401
|
-
rule: RULE$
|
|
12368
|
+
rule: RULE$20,
|
|
12402
12369
|
message: messageOf(forward.callee.getText())
|
|
12403
12370
|
})(candidate.name)));
|
|
12404
12371
|
};
|
|
12405
|
-
const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$
|
|
12372
|
+
const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array.map(candidateOf), Array.getSomes, Array.map(problemOf$4(checker)), Array.getSomes);
|
|
12406
12373
|
// src/app/source-checks.ts
|
|
12407
12374
|
/** @internal */
|
|
12408
12375
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
|
|
12409
12376
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12410
|
-
const RULE$
|
|
12377
|
+
const RULE$19 = "missing-hook";
|
|
12411
12378
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12412
12379
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12413
12380
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12414
12381
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12415
12382
|
const PLUGIN_ROOT = "..";
|
|
12416
12383
|
const READ_CONCURRENCY$9 = 16;
|
|
12417
|
-
const START$
|
|
12384
|
+
const START$11 = 0;
|
|
12418
12385
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12419
12386
|
path,
|
|
12420
|
-
index: found.index ?? START$
|
|
12387
|
+
index: found.index ?? START$11
|
|
12421
12388
|
})), Option.toArray);
|
|
12422
12389
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12423
|
-
const problemsIn$
|
|
12390
|
+
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
12424
12391
|
const files = yield* RepositoryFiles;
|
|
12425
12392
|
const text = yield* files.readFile(file);
|
|
12426
12393
|
if (Option.isNone(text)) return [];
|
|
@@ -12432,7 +12399,7 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12432
12399
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12433
12400
|
file,
|
|
12434
12401
|
...positionOf(source)(index),
|
|
12435
|
-
rule: RULE$
|
|
12402
|
+
rule: RULE$19,
|
|
12436
12403
|
message: `runs ${path}, which does not exist. The hook fails every time it fires. Point it at a file that exists or remove the hook.`
|
|
12437
12404
|
})));
|
|
12438
12405
|
});
|
|
@@ -12456,49 +12423,61 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12456
12423
|
}];
|
|
12457
12424
|
return [];
|
|
12458
12425
|
}));
|
|
12459
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
12426
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$8, { concurrency: READ_CONCURRENCY$9 });
|
|
12460
12427
|
return Array.flatten(found);
|
|
12461
12428
|
});
|
|
12462
|
-
// src/
|
|
12463
|
-
const taggedError$
|
|
12464
|
-
var
|
|
12429
|
+
// src/shared/lib/section-check.ts
|
|
12430
|
+
const taggedError$3 = Schema.TaggedError;
|
|
12431
|
+
var SectionConfigUnreadable = class extends taggedError$3()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
12465
12432
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
12466
|
-
const
|
|
12467
|
-
const
|
|
12468
|
-
const sectionAt = Effect.fn("markdownSection")(function* sectionAt(file) {
|
|
12433
|
+
const FIRST$6 = 1;
|
|
12434
|
+
const sectionAt = (file, pick) => Effect.gen(function* readSection() {
|
|
12469
12435
|
if (!(yield* (yield* RepositoryFiles).exists(file))) return Option.none();
|
|
12470
12436
|
const config = yield* Effect.tryPromise({
|
|
12471
12437
|
try: () => resolveConfigFromFile(file),
|
|
12472
|
-
catch: () =>
|
|
12438
|
+
catch: () => SectionConfigUnreadable.make({ file })
|
|
12473
12439
|
}).pipe(Effect.option);
|
|
12474
|
-
return pipe(config, Option.map(
|
|
12440
|
+
return pipe(config, Option.map(pick));
|
|
12475
12441
|
});
|
|
12476
|
-
const
|
|
12477
|
-
file: join(root, diagnostic.path),
|
|
12478
|
-
line: diagnostic.line,
|
|
12479
|
-
column: diagnostic.column ?? FIRST$5,
|
|
12480
|
-
rule: RULE$17,
|
|
12481
|
-
message: `${diagnostic.rule} ${diagnostic.message}${diagnosticDetail(diagnostic)}`
|
|
12482
|
-
});
|
|
12483
|
-
const failureAt = (file, message) => [{
|
|
12442
|
+
const failureAt = (file, rule, message) => [{
|
|
12484
12443
|
file,
|
|
12485
|
-
line: FIRST$
|
|
12486
|
-
column: FIRST$
|
|
12487
|
-
rule
|
|
12444
|
+
line: FIRST$6,
|
|
12445
|
+
column: FIRST$6,
|
|
12446
|
+
rule,
|
|
12488
12447
|
message
|
|
12489
12448
|
}];
|
|
12490
|
-
const
|
|
12449
|
+
const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
12491
12450
|
const files = yield* RepositoryFiles;
|
|
12492
12451
|
const configFile = files.join(root, CONFIG_FILE$2);
|
|
12493
|
-
const section = yield* sectionAt(configFile);
|
|
12452
|
+
const section = yield* sectionAt(configFile, check.pick);
|
|
12494
12453
|
if (Option.isNone(section)) return [];
|
|
12495
12454
|
const config = section.value;
|
|
12496
|
-
const listed = yield* files.matchingFiles(root,
|
|
12497
|
-
|
|
12455
|
+
const [listed, projectFiles] = yield* Effect.all([files.matchingFiles(root, check.pathspecs(config)), files.listedFiles(root)], { concurrency: "unbounded" });
|
|
12456
|
+
const linted = yield* Effect.result(check.lint({
|
|
12498
12457
|
root,
|
|
12499
12458
|
files: listed,
|
|
12459
|
+
projectFiles,
|
|
12500
12460
|
config
|
|
12501
|
-
})
|
|
12461
|
+
}));
|
|
12462
|
+
return Result.match(linted, {
|
|
12463
|
+
onFailure: (failure) => failureAt(configFile, check.rule, failure.message),
|
|
12464
|
+
onSuccess: (found) => pipe(found, Array.filter(({ severity }) => severity === "error"), Array.map((diagnostic) => ({
|
|
12465
|
+
file: files.join(root, diagnostic.path),
|
|
12466
|
+
line: diagnostic.line,
|
|
12467
|
+
column: diagnostic.column ?? FIRST$6,
|
|
12468
|
+
rule: check.rule,
|
|
12469
|
+
message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`
|
|
12470
|
+
})))
|
|
12471
|
+
});
|
|
12472
|
+
}).pipe(Effect.withSpan(check.name));
|
|
12473
|
+
// src/features/check-markdown/model/markdown.ts
|
|
12474
|
+
const checkMarkdown = checkSection({
|
|
12475
|
+
name: "checkMarkdown",
|
|
12476
|
+
rule: "markdown",
|
|
12477
|
+
pick: y8Section,
|
|
12478
|
+
pathspecs: (config) => markdownPathspecs({ config }),
|
|
12479
|
+
lint,
|
|
12480
|
+
detail: diagnosticDetail
|
|
12502
12481
|
});
|
|
12503
12482
|
// src/features/check-scripts/model/shell-scripts.ts
|
|
12504
12483
|
const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
@@ -12506,9 +12485,9 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
|
|
|
12506
12485
|
const EXTENSION = /\.[^./]+$/u;
|
|
12507
12486
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
12508
12487
|
const READ_CONCURRENCY$8 = 64;
|
|
12509
|
-
const FIRST$
|
|
12510
|
-
const RULE$
|
|
12511
|
-
const MESSAGE$
|
|
12488
|
+
const FIRST$5 = 1;
|
|
12489
|
+
const RULE$18 = "shell-script";
|
|
12490
|
+
const MESSAGE$8 = "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.";
|
|
12512
12491
|
const HookSchema = Schema.Struct({
|
|
12513
12492
|
command: Schema.optional(Schema.String),
|
|
12514
12493
|
args: Schema.optional(Schema.Array(Schema.String))
|
|
@@ -12528,15 +12507,15 @@ const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.ge
|
|
|
12528
12507
|
const hasExtension = (name) => EXTENSION.test(baseName(name));
|
|
12529
12508
|
const problemFor$1 = (file) => ({
|
|
12530
12509
|
file,
|
|
12531
|
-
line: FIRST$
|
|
12532
|
-
column: FIRST$
|
|
12533
|
-
rule: RULE$
|
|
12534
|
-
message: MESSAGE$
|
|
12510
|
+
line: FIRST$5,
|
|
12511
|
+
column: FIRST$5,
|
|
12512
|
+
rule: RULE$18,
|
|
12513
|
+
message: MESSAGE$8
|
|
12535
12514
|
});
|
|
12536
12515
|
/** @internal */
|
|
12537
12516
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
12538
12517
|
const files = yield* RepositoryFiles;
|
|
12539
|
-
const names = yield* files.
|
|
12518
|
+
const names = yield* files.ownedFiles(root);
|
|
12540
12519
|
const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));
|
|
12541
12520
|
const commands = pipe(settings, Option.map(sessionStartCommands), Option.getOrElse(() => NO_TEXT));
|
|
12542
12521
|
const isSessionStartHook = (name) => pipe(commands, Array.some(String$1.includes(name)));
|
|
@@ -12567,8 +12546,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
12567
12546
|
});
|
|
12568
12547
|
// src/shared/lib/workflow-run.ts
|
|
12569
12548
|
const RUN_KEY = "run";
|
|
12570
|
-
const START$
|
|
12571
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
12549
|
+
const START$10 = 0;
|
|
12550
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$10));
|
|
12572
12551
|
const runScriptsOf = (source) => {
|
|
12573
12552
|
const found = [];
|
|
12574
12553
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -12583,28 +12562,28 @@ const runScriptsOf = (source) => {
|
|
|
12583
12562
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
12584
12563
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12585
12564
|
const COMMENT = "#";
|
|
12586
|
-
const RULE$
|
|
12565
|
+
const RULE$17 = "workflow-script";
|
|
12587
12566
|
const ONE_COMMAND = 1;
|
|
12588
|
-
const MESSAGE$
|
|
12567
|
+
const MESSAGE$7 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
12589
12568
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
12590
12569
|
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
12591
12570
|
const runsMoreThanOneCommand = ({ text }) => {
|
|
12592
12571
|
const lines = pipe(String$1.split("\n")(text), Array.map(String$1.trim), Array.filter(isCommand));
|
|
12593
12572
|
return lines.length > ONE_COMMAND || pipe(lines, Array.some(chainsCommands));
|
|
12594
12573
|
};
|
|
12595
|
-
const problemsIn$
|
|
12574
|
+
const problemsIn$7 = (file) => (source) => {
|
|
12596
12575
|
const at = positionOf(source);
|
|
12597
12576
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
12598
12577
|
file,
|
|
12599
12578
|
...at(start),
|
|
12600
|
-
rule: RULE$
|
|
12601
|
-
message: MESSAGE$
|
|
12579
|
+
rule: RULE$17,
|
|
12580
|
+
message: MESSAGE$7
|
|
12602
12581
|
})));
|
|
12603
12582
|
};
|
|
12604
12583
|
/** @internal */
|
|
12605
12584
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
12606
12585
|
const workflows = yield* readWorkflows(root);
|
|
12607
|
-
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$
|
|
12586
|
+
return pipe(workflows, Array.flatMap(({ file, source }) => problemsIn$7(file)(source)));
|
|
12608
12587
|
});
|
|
12609
12588
|
// src/features/check-scripts/model/script-checks.ts
|
|
12610
12589
|
/** @internal */
|
|
@@ -12612,6 +12591,15 @@ const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
|
|
|
12612
12591
|
const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], { concurrency: "unbounded" });
|
|
12613
12592
|
return Array.flatten(found);
|
|
12614
12593
|
});
|
|
12594
|
+
// src/features/check-structure/model/structure.ts
|
|
12595
|
+
const checkStructure = checkSection({
|
|
12596
|
+
name: "checkStructure",
|
|
12597
|
+
rule: "structure",
|
|
12598
|
+
pick: wismSection,
|
|
12599
|
+
pathspecs: (config) => wismPathspecs({ config }),
|
|
12600
|
+
lint: lint$1,
|
|
12601
|
+
detail: () => ""
|
|
12602
|
+
});
|
|
12615
12603
|
// src/features/check-vite-plus/model/command-words.ts
|
|
12616
12604
|
const CONTINUATION = /\\\n/gu;
|
|
12617
12605
|
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
@@ -12701,25 +12689,25 @@ const docSources = (file) => (source) => {
|
|
|
12701
12689
|
const ROOT_DIRECTORY = ".";
|
|
12702
12690
|
const COMMAND_KEY = "command";
|
|
12703
12691
|
const ARGUMENTS_KEY = "args";
|
|
12704
|
-
const EXCLUDED$
|
|
12705
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$
|
|
12692
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12693
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2];
|
|
12706
12694
|
const STEP_FILES = [
|
|
12707
12695
|
":(glob).github/workflows/*.yml",
|
|
12708
12696
|
":(glob).github/workflows/*.yaml",
|
|
12709
12697
|
":(glob)**/action.yml",
|
|
12710
12698
|
":(glob)**/action.yaml",
|
|
12711
|
-
...EXCLUDED$
|
|
12699
|
+
...EXCLUDED$2
|
|
12712
12700
|
];
|
|
12713
12701
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
12714
12702
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
12715
12703
|
const AGENT_DOCS = [
|
|
12716
12704
|
":(glob)**/AGENTS.md",
|
|
12717
12705
|
":(glob)**/CLAUDE.md",
|
|
12718
|
-
...EXCLUDED$
|
|
12706
|
+
...EXCLUDED$2
|
|
12719
12707
|
];
|
|
12720
12708
|
const READ_CONCURRENCY$6 = 16;
|
|
12721
|
-
const START$
|
|
12722
|
-
const FIRST$
|
|
12709
|
+
const START$9 = 0;
|
|
12710
|
+
const FIRST$4 = 1;
|
|
12723
12711
|
const LINE = "\n";
|
|
12724
12712
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
12725
12713
|
const decodeCommandText = Schema.decodeUnknownOption(CommandText);
|
|
@@ -12728,7 +12716,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
12728
12716
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
12729
12717
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12730
12718
|
const NO_SOURCES = [];
|
|
12731
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
12719
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$9));
|
|
12732
12720
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
12733
12721
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
12734
12722
|
return {
|
|
@@ -12750,8 +12738,8 @@ const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE
|
|
|
12750
12738
|
kind: "hook",
|
|
12751
12739
|
file,
|
|
12752
12740
|
position: {
|
|
12753
|
-
line: index + FIRST$
|
|
12754
|
-
column: FIRST$
|
|
12741
|
+
line: index + FIRST$4,
|
|
12742
|
+
column: FIRST$4
|
|
12755
12743
|
},
|
|
12756
12744
|
name,
|
|
12757
12745
|
text
|
|
@@ -12824,7 +12812,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
12824
12812
|
return Array.flatten(found);
|
|
12825
12813
|
});
|
|
12826
12814
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
12827
|
-
const RULE$
|
|
12815
|
+
const RULE$16 = "package-script";
|
|
12828
12816
|
const LIFECYCLE = [
|
|
12829
12817
|
"preinstall",
|
|
12830
12818
|
"install",
|
|
@@ -12847,26 +12835,26 @@ const LIFECYCLE = [
|
|
|
12847
12835
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
12848
12836
|
file,
|
|
12849
12837
|
...position,
|
|
12850
|
-
rule: RULE$
|
|
12838
|
+
rule: RULE$16,
|
|
12851
12839
|
message: `The script ${name} is not a lifecycle script. package.json scripts hold only the scripts the package manager runs by itself, such as prepare and prepack. Write ${name} as a task in run.tasks of this package's vite.config.ts, where its shape is type-checked.`
|
|
12852
12840
|
});
|
|
12853
12841
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
12854
12842
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
12855
|
-
const RULE$
|
|
12843
|
+
const RULE$15 = "vite-plus-block";
|
|
12856
12844
|
const MARKER = Array.join([
|
|
12857
12845
|
"<!--",
|
|
12858
12846
|
"VITE PLUS START",
|
|
12859
12847
|
"-->"
|
|
12860
12848
|
], "");
|
|
12861
|
-
const MESSAGE$
|
|
12849
|
+
const MESSAGE$6 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
|
|
12862
12850
|
const problemIn = (file) => (source) => {
|
|
12863
12851
|
const index = String$1.indexOf(MARKER)(source);
|
|
12864
12852
|
if (Option.isNone(index)) return Option.none();
|
|
12865
12853
|
return Option.some({
|
|
12866
12854
|
file,
|
|
12867
12855
|
...positionOf(source)(index.value),
|
|
12868
|
-
rule: RULE$
|
|
12869
|
-
message: MESSAGE$
|
|
12856
|
+
rule: RULE$15,
|
|
12857
|
+
message: MESSAGE$6
|
|
12870
12858
|
});
|
|
12871
12859
|
};
|
|
12872
12860
|
/** @internal */
|
|
@@ -12907,55 +12895,88 @@ const workflowCheck = ({ rule, message, offsetsOf }) => Effect.fn(rule)(function
|
|
|
12907
12895
|
}));
|
|
12908
12896
|
}));
|
|
12909
12897
|
});
|
|
12898
|
+
const scalarKeyOffsets = ({ name, matches }) => (source) => pipe(pairsNamed(name)(source), Array.filter(({ value }) => isScalar(value) && matches(String(value.value))), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)), Option.map(([start]) => start), Option.toArray)));
|
|
12910
12899
|
// src/features/check-workflows/model/full-history-checkout.ts
|
|
12911
12900
|
const DEPTH_KEY = "fetch-depth";
|
|
12912
12901
|
const WHOLE_HISTORY = "0";
|
|
12913
|
-
const RULE$12 = "full-history-checkout";
|
|
12914
|
-
const MESSAGE$4 = "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.";
|
|
12915
|
-
const fullHistoryOffsetsOf = (source) => pipe(pairsNamed(DEPTH_KEY)(source), Array.filter(({ value }) => isScalar(value) && String(value.value) === WHOLE_HISTORY), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)), Option.map(([start]) => start), Option.toArray)));
|
|
12916
12902
|
/** @internal */
|
|
12917
12903
|
const checkFullHistoryCheckout = workflowCheck({
|
|
12918
|
-
rule:
|
|
12919
|
-
message:
|
|
12920
|
-
offsetsOf:
|
|
12904
|
+
rule: "full-history-checkout",
|
|
12905
|
+
message: "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.",
|
|
12906
|
+
offsetsOf: scalarKeyOffsets({
|
|
12907
|
+
name: DEPTH_KEY,
|
|
12908
|
+
matches: (value) => value === WHOLE_HISTORY
|
|
12909
|
+
})
|
|
12921
12910
|
});
|
|
12922
|
-
// src/features/check-workflows/model/
|
|
12923
|
-
const RULE$
|
|
12924
|
-
const
|
|
12925
|
-
const
|
|
12926
|
-
const
|
|
12927
|
-
const
|
|
12928
|
-
const
|
|
12929
|
-
|
|
12930
|
-
return
|
|
12931
|
-
|
|
12932
|
-
|
|
12933
|
-
|
|
12934
|
-
|
|
12911
|
+
// src/features/check-workflows/model/publish-trigger.ts
|
|
12912
|
+
const RULE$13 = "publish-trigger";
|
|
12913
|
+
const PUBLISH = /\bmsch-publish\b/u;
|
|
12914
|
+
const MANUAL = "workflow_dispatch";
|
|
12915
|
+
const TRIGGER_KEY = "on";
|
|
12916
|
+
const MESSAGE$4 = "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.";
|
|
12917
|
+
const triggersOf = (node) => {
|
|
12918
|
+
if (isScalar(node)) return [String(node.value)];
|
|
12919
|
+
if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
|
|
12920
|
+
if (isMap(node)) return pipe(node.items, Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.map((scalar) => String(scalar.value)), Option.toArray)));
|
|
12921
|
+
return [];
|
|
12922
|
+
};
|
|
12923
|
+
const publishTriggerOffsetsOf = (source) => {
|
|
12924
|
+
if (!pipe(runScriptsOf(source), Array.some(({ text }) => PUBLISH.test(text)))) return [];
|
|
12925
|
+
const { contents } = parseDocument(source);
|
|
12926
|
+
const triggers = pipe(pairIn(TRIGGER_KEY)(contents), Option.map(({ value }) => triggersOf(value)), Option.getOrElse(() => []));
|
|
12927
|
+
if (pipe(triggers, Array.every((trigger) => trigger === MANUAL))) return [];
|
|
12928
|
+
return Option.toArray(keyOffsetIn(TRIGGER_KEY)(contents));
|
|
12935
12929
|
};
|
|
12936
|
-
const stepsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map((seq) => pipe(seq.items, Array.map(stepOf))), Option.getOrElse(() => []));
|
|
12937
|
-
const unqueuedOffsetsOf = (steps) => pipe(steps, Array.flatMap((step, index) => pipe(step.offset, Option.filter(() => step.opensReleasePr && !Array.some(Array.drop(steps, index), (later) => later.turnsOnAutoMerge)), Option.toArray)));
|
|
12938
|
-
const releasePrOffsetsOf = (source) => pipe(pairsNamed("steps")(source), Array.flatMap(({ value }) => unqueuedOffsetsOf(stepsOf(value))));
|
|
12939
12930
|
/** @internal */
|
|
12940
|
-
const
|
|
12941
|
-
rule: RULE$
|
|
12931
|
+
const checkPublishTrigger = workflowCheck({
|
|
12932
|
+
rule: RULE$13,
|
|
12933
|
+
message: MESSAGE$4,
|
|
12934
|
+
offsetsOf: publishTriggerOffsetsOf
|
|
12935
|
+
});
|
|
12936
|
+
// src/features/check-workflows/model/release-please.ts
|
|
12937
|
+
const RULE$12 = "release-please";
|
|
12938
|
+
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
12939
|
+
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
12940
|
+
const FIRST$3 = 1;
|
|
12941
|
+
const MESSAGE$3 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch-publish` for the workspace.";
|
|
12942
|
+
const checkReleasePleaseSteps = workflowCheck({
|
|
12943
|
+
rule: RULE$12,
|
|
12942
12944
|
message: MESSAGE$3,
|
|
12943
|
-
offsetsOf:
|
|
12945
|
+
offsetsOf: scalarKeyOffsets({
|
|
12946
|
+
name: "uses",
|
|
12947
|
+
matches: (value) => RELEASE_PLEASE.test(value)
|
|
12948
|
+
})
|
|
12949
|
+
});
|
|
12950
|
+
const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* checkReleasePleaseFiles(root) {
|
|
12951
|
+
const files = yield* RepositoryFiles;
|
|
12952
|
+
const names = yield* files.listedFiles(root);
|
|
12953
|
+
return pipe(names, Array.filter((name) => RELEASE_PLEASE_FILE.test(name)), Array.map((name) => ({
|
|
12954
|
+
file: files.join(root, name),
|
|
12955
|
+
line: FIRST$3,
|
|
12956
|
+
column: FIRST$3,
|
|
12957
|
+
rule: RULE$12,
|
|
12958
|
+
message: MESSAGE$3
|
|
12959
|
+
})));
|
|
12960
|
+
});
|
|
12961
|
+
/** @internal */
|
|
12962
|
+
const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleasePlease(root) {
|
|
12963
|
+
const found = yield* Effect.all([checkReleasePleaseSteps(root), checkReleasePleaseFiles(root)], { concurrency: "unbounded" });
|
|
12964
|
+
return Array.flatten(found);
|
|
12944
12965
|
});
|
|
12945
12966
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
12946
12967
|
const CONCURRENCY_KEY = "concurrency";
|
|
12947
12968
|
const QUEUE_KEY = "queue";
|
|
12948
|
-
const RULE$
|
|
12969
|
+
const RULE$11 = "workflow-queue";
|
|
12949
12970
|
const MESSAGE$2 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
12950
12971
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
12951
12972
|
/** @internal */
|
|
12952
12973
|
const checkWorkflowQueues = workflowCheck({
|
|
12953
|
-
rule: RULE$
|
|
12974
|
+
rule: RULE$11,
|
|
12954
12975
|
message: MESSAGE$2,
|
|
12955
12976
|
offsetsOf: queueOffsetsOf
|
|
12956
12977
|
});
|
|
12957
12978
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
12958
|
-
const RULE$
|
|
12979
|
+
const RULE$10 = "workflow-commit";
|
|
12959
12980
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
12960
12981
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
12961
12982
|
const MESSAGE$1 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
@@ -12963,10 +12984,19 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
12963
12984
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
12964
12985
|
/** @internal */
|
|
12965
12986
|
const checkWorkflowCommits = workflowCheck({
|
|
12966
|
-
rule: RULE$
|
|
12987
|
+
rule: RULE$10,
|
|
12967
12988
|
message: MESSAGE$1,
|
|
12968
12989
|
offsetsOf: commitOffsetsOf
|
|
12969
12990
|
});
|
|
12991
|
+
// src/features/check-workflows/model/workflow-lint.ts
|
|
12992
|
+
const checkWorkflowLint = checkSection({
|
|
12993
|
+
name: "checkWorkflowLint",
|
|
12994
|
+
rule: "workflow-lint",
|
|
12995
|
+
pick: fu4Section,
|
|
12996
|
+
pathspecs: (config) => workflowPathspecs({ config }),
|
|
12997
|
+
lint: lint$2,
|
|
12998
|
+
detail: () => ""
|
|
12999
|
+
});
|
|
12970
13000
|
// src/app/tool-use.ts
|
|
12971
13001
|
/** @internal */
|
|
12972
13002
|
const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
@@ -12977,15 +13007,18 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
12977
13007
|
checkWorkflowQueues(root),
|
|
12978
13008
|
checkWorkflowCommits(root),
|
|
12979
13009
|
checkFullHistoryCheckout(root),
|
|
12980
|
-
|
|
13010
|
+
checkReleasePlease(root),
|
|
13011
|
+
checkPublishTrigger(root),
|
|
12981
13012
|
checkRestrictedRules(root),
|
|
12982
|
-
checkMarkdown(root)
|
|
13013
|
+
checkMarkdown(root),
|
|
13014
|
+
checkStructure(root),
|
|
13015
|
+
checkWorkflowLint(root)
|
|
12983
13016
|
], { concurrency: "unbounded" });
|
|
12984
13017
|
return Array.flatten(found);
|
|
12985
13018
|
});
|
|
12986
13019
|
// src/features/ban-comments/model/found-comment.ts
|
|
12987
|
-
const taggedError$
|
|
12988
|
-
var CommentsUnreadable = class extends taggedError$
|
|
13020
|
+
const taggedError$2 = Schema.TaggedError;
|
|
13021
|
+
var CommentsUnreadable = class extends taggedError$2()("CommentsUnreadable", {
|
|
12989
13022
|
reader: Schema.String,
|
|
12990
13023
|
message: Schema.String
|
|
12991
13024
|
}) {};
|
|
@@ -13073,7 +13106,7 @@ const COMMENT_NODES = [
|
|
|
13073
13106
|
"block_comment",
|
|
13074
13107
|
"multiline_comment"
|
|
13075
13108
|
];
|
|
13076
|
-
const START$
|
|
13109
|
+
const START$8 = 0;
|
|
13077
13110
|
const NEXT = 1;
|
|
13078
13111
|
const NONE$1 = [];
|
|
13079
13112
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13126,7 +13159,7 @@ const markupComment = (source) => (node) => {
|
|
|
13126
13159
|
}];
|
|
13127
13160
|
};
|
|
13128
13161
|
const textComments = (grammars, grammar) => (text) => {
|
|
13129
|
-
const shift = shifted(text.startIndex ?? START$
|
|
13162
|
+
const shift = shifted(text.startIndex ?? START$8);
|
|
13130
13163
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13131
13164
|
};
|
|
13132
13165
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13162,11 +13195,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
13162
13195
|
}[reader](source);
|
|
13163
13196
|
};
|
|
13164
13197
|
// src/features/ban-comments/model/comments.ts
|
|
13165
|
-
const RULE$
|
|
13198
|
+
const RULE$9 = "comment";
|
|
13166
13199
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
13167
13200
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13168
13201
|
const READ_CONCURRENCY$5 = 64;
|
|
13169
|
-
const START$
|
|
13202
|
+
const START$7 = 0;
|
|
13170
13203
|
const FIRST_LINE$4 = 1;
|
|
13171
13204
|
const FIRST_COLUMN$3 = 1;
|
|
13172
13205
|
const READERS$1 = [
|
|
@@ -13214,8 +13247,8 @@ const NO_SETTINGS = {
|
|
|
13214
13247
|
ignorePatterns: []
|
|
13215
13248
|
};
|
|
13216
13249
|
const NONE = [];
|
|
13217
|
-
const taggedError$
|
|
13218
|
-
var CommentConfigUnreadable = class extends taggedError$
|
|
13250
|
+
const taggedError$1 = Schema.TaggedError;
|
|
13251
|
+
var CommentConfigUnreadable = class extends taggedError$1()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
13219
13252
|
const shebangReader = (source) => {
|
|
13220
13253
|
if (!String$1.startsWith(SHEBANG)(source)) return Option.none();
|
|
13221
13254
|
return pipe(SHEBANG_READERS, Array.findFirst(([pattern]) => pattern.test(source)));
|
|
@@ -13223,23 +13256,23 @@ const shebangReader = (source) => {
|
|
|
13223
13256
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13224
13257
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13225
13258
|
const lineBefore = (source, index) => {
|
|
13226
|
-
const lines = pipe(source, String$1.slice(START$
|
|
13259
|
+
const lines = pipe(source, String$1.slice(START$7, index), String$1.split("\n"));
|
|
13227
13260
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13228
13261
|
};
|
|
13229
13262
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13230
|
-
const isShebang = ({ index, text }) => index === START$
|
|
13263
|
+
const isShebang = ({ index, text }) => index === START$7 && String$1.startsWith(SHEBANG)(text);
|
|
13231
13264
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13232
13265
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
13233
13266
|
file,
|
|
13234
13267
|
...positionOf(source)(index),
|
|
13235
|
-
rule: RULE$
|
|
13268
|
+
rule: RULE$9,
|
|
13236
13269
|
message: MESSAGE
|
|
13237
13270
|
});
|
|
13238
13271
|
const unreadableProblem = (file, message) => ({
|
|
13239
13272
|
file,
|
|
13240
13273
|
line: FIRST_LINE$4,
|
|
13241
13274
|
column: FIRST_COLUMN$3,
|
|
13242
|
-
rule: RULE$
|
|
13275
|
+
rule: RULE$9,
|
|
13243
13276
|
message: `msch could not read the comments in this file: ${message}`
|
|
13244
13277
|
});
|
|
13245
13278
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13389,7 +13422,7 @@ const UNUSED_RULE = "unused-catalog-entry";
|
|
|
13389
13422
|
const STALE_MESSAGE = "excludes a version from `minimumReleaseAge` that the lockfile no longer resolves. Remove the entry: it only exempted that one version while it was new.";
|
|
13390
13423
|
const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
|
|
13391
13424
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
13392
|
-
const decodeManifest$
|
|
13425
|
+
const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
13393
13426
|
const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
|
|
13394
13427
|
const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
|
|
13395
13428
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
@@ -13418,7 +13451,7 @@ const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root
|
|
|
13418
13451
|
const files = yield* RepositoryFiles;
|
|
13419
13452
|
const listed = yield* files.listedFiles(root);
|
|
13420
13453
|
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$4 });
|
|
13421
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
13454
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$2(text))), Array.flatMap(referencesIn));
|
|
13422
13455
|
const fromOverrides = pipe(fieldsOf$1(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13423
13456
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13424
13457
|
});
|
|
@@ -13460,93 +13493,6 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
|
|
|
13460
13493
|
onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$3), fieldsOf$1(settings))
|
|
13461
13494
|
});
|
|
13462
13495
|
});
|
|
13463
|
-
// src/features/check-runtime-version/model/node-version.ts
|
|
13464
|
-
const RULE$7 = "node-version";
|
|
13465
|
-
const MINIMUM = 26;
|
|
13466
|
-
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
13467
|
-
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
13468
|
-
const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
|
|
13469
|
-
const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
|
|
13470
|
-
const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
|
|
13471
|
-
const PINNED_VERSION = /^\s*v?(?<major>\d+)/u;
|
|
13472
|
-
const BASE_IMAGE = /^FROM[ \t]+(?:--\S+[ \t]+)*(?:[\w.-]+(?::\d+)?\/)*node:(?<major>\d+)/gimu;
|
|
13473
|
-
const SETUP_INPUT = /\bnode-version:[ \t]*["']?v?(?<major>\d+)/gu;
|
|
13474
|
-
const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t]+)v?(?<major>\d+)/gmu;
|
|
13475
|
-
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
13476
|
-
const ALTERNATIVE = "||";
|
|
13477
|
-
const ENGINES_KEY = "\"engines\"";
|
|
13478
|
-
const START$5 = 0;
|
|
13479
|
-
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13480
|
-
const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
|
|
13481
|
-
const Manifest = Schema.Struct({
|
|
13482
|
-
private: Schema.optional(Schema.Boolean),
|
|
13483
|
-
publishConfig: Schema.optional(Schema.Unknown),
|
|
13484
|
-
engines: Schema.optional(Engines)
|
|
13485
|
-
});
|
|
13486
|
-
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
13487
|
-
const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
|
|
13488
|
-
const isOld = (major) => major < MINIMUM;
|
|
13489
|
-
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
13490
|
-
const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
13491
|
-
onNone: () => true,
|
|
13492
|
-
onSome: isOld
|
|
13493
|
-
}));
|
|
13494
|
-
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
|
|
13495
|
-
const problemAt$3 = ({ entry, source, index }, message) => ({
|
|
13496
|
-
file: entry.file,
|
|
13497
|
-
...positionOf(source)(index),
|
|
13498
|
-
rule: RULE$7,
|
|
13499
|
-
message
|
|
13500
|
-
});
|
|
13501
|
-
const offsetOf$1 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$5));
|
|
13502
|
-
const unstatedProblem = (entry, source) => problemAt$3({
|
|
13503
|
-
entry,
|
|
13504
|
-
source,
|
|
13505
|
-
index: START$5
|
|
13506
|
-
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
13507
|
-
const rangeProblem = (entry, source) => (range) => problemAt$3({
|
|
13508
|
-
entry,
|
|
13509
|
-
source,
|
|
13510
|
-
index: offsetOf$1(source, ENGINES_KEY)
|
|
13511
|
-
}, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
|
|
13512
|
-
const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
13513
|
-
const rangeOf$1 = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
|
|
13514
|
-
const manifestProblems = (entry, source) => {
|
|
13515
|
-
const manifest = decodeManifest(source);
|
|
13516
|
-
if (Option.isNone(manifest)) return [];
|
|
13517
|
-
const range = rangeOf$1(manifest.value);
|
|
13518
|
-
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
13519
|
-
return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
|
|
13520
|
-
};
|
|
13521
|
-
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt$3({
|
|
13522
|
-
entry,
|
|
13523
|
-
source,
|
|
13524
|
-
index: found.index ?? START$5
|
|
13525
|
-
}, `${SUPPORTED} \`${String$1.trim(found[START$5])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
13526
|
-
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt$3({
|
|
13527
|
-
entry,
|
|
13528
|
-
source,
|
|
13529
|
-
index: START$5
|
|
13530
|
-
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
13531
|
-
const problemsIn$5 = (entry, source) => {
|
|
13532
|
-
if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
|
|
13533
|
-
if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
|
|
13534
|
-
if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
|
|
13535
|
-
if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
|
|
13536
|
-
return pinnedProblems(SETUP_INPUT)(entry, source);
|
|
13537
|
-
};
|
|
13538
|
-
const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.test(entry.name) || STEP_FILE.test(entry.name) || isToolVersions(entry);
|
|
13539
|
-
/** @internal */
|
|
13540
|
-
const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
|
|
13541
|
-
const files = yield* RepositoryFiles;
|
|
13542
|
-
const listed = yield* listedFiles(root);
|
|
13543
|
-
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$1}`, ...EXCLUDED]);
|
|
13544
|
-
const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
|
|
13545
|
-
name,
|
|
13546
|
-
file: files.join(root, name)
|
|
13547
|
-
})))];
|
|
13548
|
-
return yield* scanText(sources, problemsIn$5);
|
|
13549
|
-
});
|
|
13550
13496
|
// src/features/check-skills/model/skill-entry.ts
|
|
13551
13497
|
const ENTRY_RULE = "unlocked-skill";
|
|
13552
13498
|
const VISIBLE_RULE = "skill-source-visible";
|
|
@@ -13554,7 +13500,7 @@ const CONFIG_FILE = "vite.config.ts";
|
|
|
13554
13500
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13555
13501
|
const SOURCE = "masseater/skills";
|
|
13556
13502
|
const PRESET = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
|
|
13557
|
-
const START$
|
|
13503
|
+
const START$6 = 0;
|
|
13558
13504
|
const LOCAL_PREFIX = "./";
|
|
13559
13505
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
13560
13506
|
const Source = Schema.Struct({
|
|
@@ -13563,11 +13509,11 @@ const Source = Schema.Struct({
|
|
|
13563
13509
|
});
|
|
13564
13510
|
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
13565
13511
|
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
13566
|
-
const taggedError
|
|
13567
|
-
var SkillsConfigUnreadable = class extends taggedError
|
|
13568
|
-
const problemAt$
|
|
13512
|
+
const taggedError = Schema.TaggedError;
|
|
13513
|
+
var SkillsConfigUnreadable = class extends taggedError()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13514
|
+
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
13569
13515
|
file,
|
|
13570
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
13516
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$6))),
|
|
13571
13517
|
rule,
|
|
13572
13518
|
message
|
|
13573
13519
|
});
|
|
@@ -13587,20 +13533,20 @@ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root
|
|
|
13587
13533
|
})));
|
|
13588
13534
|
});
|
|
13589
13535
|
const entryProblems = ({ file, text, sources }) => {
|
|
13590
|
-
const at = problemAt$
|
|
13536
|
+
const at = problemAt$3(ENTRY_RULE, file, text);
|
|
13591
13537
|
return pipe(Record.get(sources, SOURCE), Option.match({
|
|
13592
13538
|
onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
|
|
13593
13539
|
onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
|
|
13594
13540
|
}));
|
|
13595
13541
|
};
|
|
13596
13542
|
const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
|
|
13597
|
-
const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$
|
|
13543
|
+
const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$3(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
|
|
13598
13544
|
const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
|
|
13599
13545
|
const files = yield* RepositoryFiles;
|
|
13600
13546
|
const file = files.join(root, RENOVATE_FILE$1);
|
|
13601
13547
|
const text = yield* files.readFile(file);
|
|
13602
13548
|
if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
|
|
13603
|
-
return [problemAt$
|
|
13549
|
+
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`)];
|
|
13604
13550
|
});
|
|
13605
13551
|
/** @internal */
|
|
13606
13552
|
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
@@ -13614,7 +13560,7 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
13614
13560
|
];
|
|
13615
13561
|
});
|
|
13616
13562
|
// src/features/check-skills/model/published-skills.ts
|
|
13617
|
-
const RULE$
|
|
13563
|
+
const RULE$8 = "published-skills";
|
|
13618
13564
|
const KEYWORD = "tanstack-intent";
|
|
13619
13565
|
const SKILLS = "skills";
|
|
13620
13566
|
const MANIFEST_FILE = "package.json";
|
|
@@ -13623,11 +13569,11 @@ const FIRST$2 = 1;
|
|
|
13623
13569
|
const SUCCEEDED = 0;
|
|
13624
13570
|
const SYNC = "Run vp exec intent maintainer sync in the repository root.";
|
|
13625
13571
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
13626
|
-
const problemAt$
|
|
13572
|
+
const problemAt$2 = (file, message) => ({
|
|
13627
13573
|
file,
|
|
13628
13574
|
line: FIRST$2,
|
|
13629
13575
|
column: FIRST$2,
|
|
13630
|
-
rule: RULE$
|
|
13576
|
+
rule: RULE$8,
|
|
13631
13577
|
message
|
|
13632
13578
|
});
|
|
13633
13579
|
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))));
|
|
@@ -13650,30 +13596,30 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
13650
13596
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
13651
13597
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
13652
13598
|
}, Effect.scoped);
|
|
13653
|
-
const problemsIn$
|
|
13599
|
+
const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
13654
13600
|
const files = yield* RepositoryFiles;
|
|
13655
13601
|
const directory = files.join(root, project.directory);
|
|
13656
13602
|
const manifest = files.join(directory, MANIFEST_FILE);
|
|
13657
13603
|
const skills = skillDirectoriesIn(files, directory);
|
|
13658
|
-
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$
|
|
13604
|
+
if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without TanStack Intent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1} with vp exec intent maintainer add, so agents in the repositories that install it load guidance for the installed version.`)];
|
|
13659
13605
|
const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
13660
|
-
return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$
|
|
13606
|
+
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)];
|
|
13661
13607
|
});
|
|
13662
13608
|
/** @internal */
|
|
13663
13609
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
13664
13610
|
const projects = yield* publishedProjects(root);
|
|
13665
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
13611
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$6(root, project), { concurrency: 1 });
|
|
13666
13612
|
return Array.flatten(problems);
|
|
13667
13613
|
});
|
|
13668
13614
|
// src/features/check-skills/model/skill-files.ts
|
|
13669
|
-
const RULE$
|
|
13615
|
+
const RULE$7 = "skill-file";
|
|
13670
13616
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
13671
13617
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
13672
13618
|
const MARKDOWN = ".md";
|
|
13673
13619
|
const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
|
|
13674
13620
|
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
13675
13621
|
const HEADING = /^# (?<title>.+)$/mu;
|
|
13676
|
-
const NAME_KEY = /^name:/mu;
|
|
13622
|
+
const NAME_KEY$1 = /^name:/mu;
|
|
13677
13623
|
const LICENSE_KEY = /^license:/mu;
|
|
13678
13624
|
const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
|
|
13679
13625
|
const LINK = /\]\((?<target>[^)\s]+)\)/gu;
|
|
@@ -13683,7 +13629,7 @@ const GITHUB = "https://github.com/";
|
|
|
13683
13629
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
13684
13630
|
const BLANK = /\s+/u;
|
|
13685
13631
|
const SEPARATOR$2 = "/";
|
|
13686
|
-
const START$
|
|
13632
|
+
const START$5 = 0;
|
|
13687
13633
|
const FIRST$1 = 1;
|
|
13688
13634
|
const READ_CONCURRENCY$3 = 16;
|
|
13689
13635
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
@@ -13693,50 +13639,50 @@ const Frontmatter = Schema.Struct({
|
|
|
13693
13639
|
metadata: Schema.optional(Metadata)
|
|
13694
13640
|
});
|
|
13695
13641
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
13696
|
-
const offsetOf = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
13642
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$5));
|
|
13697
13643
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
13698
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
13644
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$5].length), Option.getOrElse(() => START$5));
|
|
13699
13645
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
13700
13646
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
13701
13647
|
const bodyStart = bodyStartOf(source);
|
|
13702
13648
|
const body = String$1.slice(bodyStart)(source);
|
|
13703
13649
|
const heading = groupOf$2("title")(HEADING.exec(body));
|
|
13704
13650
|
return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
|
|
13705
|
-
index: offsetOf(source, NAME_KEY),
|
|
13651
|
+
index: offsetOf$1(source, NAME_KEY$1),
|
|
13706
13652
|
message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
|
|
13707
13653
|
})), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
|
|
13708
|
-
index: bodyStart + offsetOf(body, HEADING),
|
|
13654
|
+
index: bodyStart + offsetOf$1(body, HEADING),
|
|
13709
13655
|
message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
|
|
13710
13656
|
})), Option.toArray)];
|
|
13711
13657
|
};
|
|
13712
13658
|
const derivedProblems = (source, derived) => pipe(String$1.split(String$1.trim(derived), BLANK), Array.filter((url) => String$1.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)), Array.map((url) => ({
|
|
13713
|
-
index: offsetOf(source, url),
|
|
13659
|
+
index: offsetOf$1(source, url),
|
|
13714
13660
|
message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`
|
|
13715
13661
|
})));
|
|
13716
13662
|
const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
|
|
13717
13663
|
...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
|
|
13718
13664
|
...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
|
|
13719
|
-
index: offsetOf(skill.source, LICENSE_KEY),
|
|
13665
|
+
index: offsetOf$1(skill.source, LICENSE_KEY),
|
|
13720
13666
|
message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
|
|
13721
13667
|
})), Option.toArray),
|
|
13722
13668
|
...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
|
|
13723
13669
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
13724
13670
|
file: skill.file,
|
|
13725
13671
|
...positionOf(skill.source)(index),
|
|
13726
|
-
rule: RULE$
|
|
13672
|
+
rule: RULE$7,
|
|
13727
13673
|
message
|
|
13728
13674
|
})));
|
|
13729
13675
|
const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
13730
13676
|
target,
|
|
13731
|
-
index: found.index ?? START$
|
|
13677
|
+
index: found.index ?? START$5
|
|
13732
13678
|
})), Option.toArray);
|
|
13733
|
-
const rangeOf = (found) => {
|
|
13734
|
-
const start = found.index ?? START$
|
|
13735
|
-
return [start, start + found[START$
|
|
13679
|
+
const rangeOf$1 = (found) => {
|
|
13680
|
+
const start = found.index ?? START$5;
|
|
13681
|
+
return [start, start + found[START$5].length];
|
|
13736
13682
|
};
|
|
13737
13683
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
13738
13684
|
const linksIn = (source) => {
|
|
13739
|
-
const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf));
|
|
13685
|
+
const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
|
|
13740
13686
|
return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
|
|
13741
13687
|
};
|
|
13742
13688
|
const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
@@ -13750,11 +13696,11 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
13750
13696
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
13751
13697
|
file,
|
|
13752
13698
|
...positionOf(source)(index),
|
|
13753
|
-
rule: RULE$
|
|
13699
|
+
rule: RULE$7,
|
|
13754
13700
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
13755
13701
|
})));
|
|
13756
13702
|
});
|
|
13757
|
-
const problemsIn$
|
|
13703
|
+
const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
13758
13704
|
const files = yield* RepositoryFiles;
|
|
13759
13705
|
const file = files.join(root, name);
|
|
13760
13706
|
const directory = files.dirname(name);
|
|
@@ -13766,7 +13712,7 @@ const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13766
13712
|
file: files.join(root, entry),
|
|
13767
13713
|
line: FIRST$1,
|
|
13768
13714
|
column: FIRST$1,
|
|
13769
|
-
rule: RULE$
|
|
13715
|
+
rule: RULE$7,
|
|
13770
13716
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
13771
13717
|
})));
|
|
13772
13718
|
return [
|
|
@@ -13783,7 +13729,7 @@ const problemsIn$3 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13783
13729
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
13784
13730
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13785
13731
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
|
|
13786
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
13732
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$3 });
|
|
13787
13733
|
return Array.flatten(found);
|
|
13788
13734
|
});
|
|
13789
13735
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -13846,7 +13792,7 @@ const cargoEntries = (text) => {
|
|
|
13846
13792
|
};
|
|
13847
13793
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
13848
13794
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
13849
|
-
const RULE$
|
|
13795
|
+
const RULE$6 = "version-downgrade";
|
|
13850
13796
|
const DEFAULT_BASE = "origin/main";
|
|
13851
13797
|
const READ_CONCURRENCY$2 = 16;
|
|
13852
13798
|
const READERS = [
|
|
@@ -13872,7 +13818,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
13872
13818
|
file,
|
|
13873
13819
|
line: lineOf(text, entry),
|
|
13874
13820
|
column: FIRST_LINE$1,
|
|
13875
|
-
rule: RULE$
|
|
13821
|
+
rule: RULE$6,
|
|
13876
13822
|
message: message(old, entry)
|
|
13877
13823
|
})), Option.toArray)));
|
|
13878
13824
|
};
|
|
@@ -13911,7 +13857,7 @@ const READ_CONCURRENCY$1 = 16;
|
|
|
13911
13857
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
13912
13858
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
13913
13859
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
13914
|
-
const problemsIn$
|
|
13860
|
+
const problemsIn$4 = (file, source) => {
|
|
13915
13861
|
const at = positionOf(source);
|
|
13916
13862
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
|
|
13917
13863
|
file,
|
|
@@ -13929,7 +13875,7 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13929
13875
|
const file = files.join(root, name);
|
|
13930
13876
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13931
13877
|
onNone: () => [],
|
|
13932
|
-
onSome: (source) => problemsIn$
|
|
13878
|
+
onSome: (source) => problemsIn$4(file, source)
|
|
13933
13879
|
})));
|
|
13934
13880
|
}, { concurrency: READ_CONCURRENCY$1 });
|
|
13935
13881
|
return Array.flatten(found);
|
|
@@ -13937,22 +13883,22 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13937
13883
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
13938
13884
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
13939
13885
|
const NUL = "\0";
|
|
13940
|
-
const START$
|
|
13886
|
+
const START$4 = 0;
|
|
13941
13887
|
const HEX = 16;
|
|
13942
13888
|
const CODE_POINT_WIDTH = 4;
|
|
13943
13889
|
const READ_CONCURRENCY = 64;
|
|
13944
|
-
const RULE$
|
|
13945
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
13890
|
+
const RULE$5 = "hidden-unicode";
|
|
13891
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$4)(character), Option.getOrElse(() => START$4), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
13946
13892
|
const problemOf$1 = (file, source) => (found) => {
|
|
13947
|
-
const hex = hexOf(found[START$
|
|
13893
|
+
const hex = hexOf(found[START$4]);
|
|
13948
13894
|
return {
|
|
13949
13895
|
file,
|
|
13950
|
-
...positionOf(source)(found.index ?? START$
|
|
13951
|
-
rule: RULE$
|
|
13896
|
+
...positionOf(source)(found.index ?? START$4),
|
|
13897
|
+
rule: RULE$5,
|
|
13952
13898
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
13953
13899
|
};
|
|
13954
13900
|
};
|
|
13955
|
-
const problemsIn$
|
|
13901
|
+
const problemsIn$3 = (file, source) => {
|
|
13956
13902
|
if (String$1.includes(NUL)(source)) return [];
|
|
13957
13903
|
return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf$1(file, source)));
|
|
13958
13904
|
};
|
|
@@ -13964,25 +13910,25 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
13964
13910
|
const file = files.join(root, name);
|
|
13965
13911
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
13966
13912
|
onNone: () => [],
|
|
13967
|
-
onSome: (source) => problemsIn$
|
|
13913
|
+
onSome: (source) => problemsIn$3(file, source)
|
|
13968
13914
|
})));
|
|
13969
13915
|
}, { concurrency: READ_CONCURRENCY });
|
|
13970
13916
|
return Array.flatten(found);
|
|
13971
13917
|
});
|
|
13972
13918
|
// src/features/find-unneeded-files/model/alchemy-patch.ts
|
|
13973
|
-
const RULE$
|
|
13919
|
+
const RULE$4 = "alchemy-patch";
|
|
13974
13920
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
13975
13921
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
13976
|
-
const START$
|
|
13922
|
+
const START$3 = 0;
|
|
13977
13923
|
const problemOf = (file, position, name) => ({
|
|
13978
13924
|
file,
|
|
13979
13925
|
...position,
|
|
13980
|
-
rule: RULE$
|
|
13926
|
+
rule: RULE$4,
|
|
13981
13927
|
message: `patches ${name}. A patch breaks on every Alchemy release. Define the missing setting as a custom resource in the stack and delete the patch.`
|
|
13982
13928
|
});
|
|
13983
|
-
const problemsIn = (file, patched) => (source) => {
|
|
13929
|
+
const problemsIn$2 = (file, patched) => (source) => {
|
|
13984
13930
|
const at = positionOf(source);
|
|
13985
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
13931
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$3));
|
|
13986
13932
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
13987
13933
|
};
|
|
13988
13934
|
/** @internal */
|
|
@@ -13992,12 +13938,12 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
|
|
|
13992
13938
|
const text = yield* files.readFile(file);
|
|
13993
13939
|
const manifest = yield* workspaceManifest(root);
|
|
13994
13940
|
const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
13995
|
-
return pipe(text, Option.map(problemsIn(file, patched)), Option.getOrElse(() => []));
|
|
13941
|
+
return pipe(text, Option.map(problemsIn$2(file, patched)), Option.getOrElse(() => []));
|
|
13996
13942
|
});
|
|
13997
13943
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
13998
13944
|
const MSCH = "@r_masseater/msch";
|
|
13999
|
-
const SCOPE = "@r_masseater/";
|
|
14000
|
-
const RULE$
|
|
13945
|
+
const SCOPE$1 = "@r_masseater/";
|
|
13946
|
+
const RULE$3 = "applied-package";
|
|
14001
13947
|
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
14002
13948
|
const NOT_FOUND = -1;
|
|
14003
13949
|
const SEPARATOR$1 = "/";
|
|
@@ -14018,7 +13964,7 @@ const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin
|
|
|
14018
13964
|
return Record.keys(bin);
|
|
14019
13965
|
}
|
|
14020
13966
|
}));
|
|
14021
|
-
const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE$
|
|
13967
|
+
const manifestOf = Option.liftThrowable((name) => fileURLToPath(import.meta.resolve(`${name}/${MANIFEST_FILE$3}`)));
|
|
14022
13968
|
const installedPackage = Effect.fn("installedPackage")(function* installedPackage(name) {
|
|
14023
13969
|
const files = yield* RepositoryFiles;
|
|
14024
13970
|
const text = yield* pipe(manifestOf(name), Option.match({
|
|
@@ -14036,18 +13982,18 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
14036
13982
|
onNone: () => Effect.succeed(Option.none()),
|
|
14037
13983
|
onSome: (file) => readManifest(files.dirname(file))
|
|
14038
13984
|
}));
|
|
14039
|
-
const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE)));
|
|
13985
|
+
const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
|
|
14040
13986
|
return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
|
|
14041
13987
|
});
|
|
14042
|
-
const problemAt = (file, source) => (index, name) => ({
|
|
13988
|
+
const problemAt$1 = (file, source) => (index, name) => ({
|
|
14043
13989
|
file,
|
|
14044
13990
|
...positionOf(source)(index),
|
|
14045
|
-
rule: RULE$
|
|
13991
|
+
rule: RULE$3,
|
|
14046
13992
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
14047
13993
|
});
|
|
14048
13994
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
14049
13995
|
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
14050
|
-
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt(file, source)(found.index ?? NOT_FOUND, entry.name)))));
|
|
13996
|
+
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)))));
|
|
14051
13997
|
const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
|
|
14052
13998
|
onEmpty: () => "",
|
|
14053
13999
|
onNonEmpty: Array.max(BY_LENGTH)
|
|
@@ -14059,7 +14005,7 @@ const consumersIn = Effect.fn("consumersIn")(function* consumersIn(root, directo
|
|
|
14059
14005
|
});
|
|
14060
14006
|
const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appliedNames, directory) {
|
|
14061
14007
|
const files = yield* RepositoryFiles;
|
|
14062
|
-
const file = files.join(root, directory, MANIFEST_FILE$
|
|
14008
|
+
const file = files.join(root, directory, MANIFEST_FILE$3);
|
|
14063
14009
|
const text = yield* files.readFile(file);
|
|
14064
14010
|
const manifest = yield* readManifest(files.join(root, directory));
|
|
14065
14011
|
return pipe(Option.all({
|
|
@@ -14067,7 +14013,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
|
|
|
14067
14013
|
declared: manifest
|
|
14068
14014
|
}), Option.match({
|
|
14069
14015
|
onNone: () => [],
|
|
14070
|
-
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt(file, source)(index, name)), Option.toArray)))
|
|
14016
|
+
onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$1(file, source)(index, name)), Option.toArray)))
|
|
14071
14017
|
}));
|
|
14072
14018
|
});
|
|
14073
14019
|
const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
|
|
@@ -14097,7 +14043,7 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14097
14043
|
return yield* appliedPackageProblems(root, applied);
|
|
14098
14044
|
});
|
|
14099
14045
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14100
|
-
const RULE = "replaced-tool";
|
|
14046
|
+
const RULE$2 = "replaced-tool";
|
|
14101
14047
|
const FIRST = 1;
|
|
14102
14048
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14103
14049
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
@@ -14178,7 +14124,7 @@ const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern
|
|
|
14178
14124
|
file,
|
|
14179
14125
|
line: FIRST,
|
|
14180
14126
|
column: FIRST,
|
|
14181
|
-
rule: RULE,
|
|
14127
|
+
rule: RULE$2,
|
|
14182
14128
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14183
14129
|
})));
|
|
14184
14130
|
/** @internal */
|
|
@@ -14207,7 +14153,7 @@ const SETUP_PATTERNS = [
|
|
|
14207
14153
|
];
|
|
14208
14154
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14209
14155
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14210
|
-
const START = 0;
|
|
14156
|
+
const START$2 = 0;
|
|
14211
14157
|
const LAST_SEGMENT = 1;
|
|
14212
14158
|
const FIRST_LINE = 1;
|
|
14213
14159
|
const FIRST_COLUMN = 1;
|
|
@@ -14277,7 +14223,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14277
14223
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14278
14224
|
return directoriesOf(roots);
|
|
14279
14225
|
});
|
|
14280
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START), (end) => String$1.slice(START, end)(name));
|
|
14226
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$2), (end) => String$1.slice(START$2, end)(name));
|
|
14281
14227
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14282
14228
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14283
14229
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14312,6 +14258,128 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14312
14258
|
if (Option.isNone(workspace)) return [];
|
|
14313
14259
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14314
14260
|
});
|
|
14261
|
+
// src/features/check-package-scope/model/package-scope.ts
|
|
14262
|
+
const RULE$1 = "package-scope";
|
|
14263
|
+
const SCOPE = "@r_masseater/";
|
|
14264
|
+
const NAME_KEY = "\"name\"";
|
|
14265
|
+
const START$1 = 0;
|
|
14266
|
+
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14267
|
+
const Manifest$1 = Schema.Struct({
|
|
14268
|
+
name: Schema.optional(Schema.String),
|
|
14269
|
+
private: Schema.optional(Schema.Boolean),
|
|
14270
|
+
publishConfig: Schema.optional(Schema.Unknown)
|
|
14271
|
+
});
|
|
14272
|
+
const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
|
|
14273
|
+
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14274
|
+
const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
14275
|
+
const problemsIn$1 = (entry, source) => pipe(decodeManifest$1(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
|
|
14276
|
+
file: entry.file,
|
|
14277
|
+
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$1))),
|
|
14278
|
+
rule: RULE$1,
|
|
14279
|
+
message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
|
|
14280
|
+
})), Option.toArray);
|
|
14281
|
+
/** @internal */
|
|
14282
|
+
const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageScope(root) {
|
|
14283
|
+
const files = yield* RepositoryFiles;
|
|
14284
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$1]);
|
|
14285
|
+
return yield* scanText(pipe(manifests, Array.map((name) => ({
|
|
14286
|
+
name,
|
|
14287
|
+
file: files.join(root, name)
|
|
14288
|
+
}))), problemsIn$1);
|
|
14289
|
+
});
|
|
14290
|
+
// src/features/check-runtime-version/model/node-version.ts
|
|
14291
|
+
const RULE = "node-version";
|
|
14292
|
+
const MINIMUM = 26;
|
|
14293
|
+
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
14294
|
+
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
14295
|
+
const VERSION_FILE = /(?:^|\/)(?:\.node-version|\.nvmrc)$/u;
|
|
14296
|
+
const DOCKERFILE = /(?:^|\/)(?:Dockerfile|Containerfile)[^/]*$/u;
|
|
14297
|
+
const STEP_FILE = /^\.github\/.*\.ya?ml$|(?:^|\/)action\.ya?ml$/u;
|
|
14298
|
+
const PINNED_VERSION = /^\s*v?(?<major>\d+)/u;
|
|
14299
|
+
const BASE_IMAGE = /^FROM[ \t]+(?:--\S+[ \t]+)*(?:[\w.-]+(?::\d+)?\/)*node:(?<major>\d+)/gimu;
|
|
14300
|
+
const SETUP_INPUT = /\bnode-version:[ \t]*["']?v?(?<major>\d+)/gu;
|
|
14301
|
+
const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t]+)v?(?<major>\d+)/gmu;
|
|
14302
|
+
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
14303
|
+
const ALTERNATIVE = "||";
|
|
14304
|
+
const ENGINES_KEY = "\"engines\"";
|
|
14305
|
+
const START = 0;
|
|
14306
|
+
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14307
|
+
const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
|
|
14308
|
+
const Manifest = Schema.Struct({
|
|
14309
|
+
private: Schema.optional(Schema.Boolean),
|
|
14310
|
+
publishConfig: Schema.optional(Schema.Unknown),
|
|
14311
|
+
engines: Schema.optional(Engines)
|
|
14312
|
+
});
|
|
14313
|
+
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
14314
|
+
const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
|
|
14315
|
+
const isOld = (major) => major < MINIMUM;
|
|
14316
|
+
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
14317
|
+
const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
14318
|
+
onNone: () => true,
|
|
14319
|
+
onSome: isOld
|
|
14320
|
+
}));
|
|
14321
|
+
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some(floorIsOld));
|
|
14322
|
+
const problemAt = ({ entry, source, index }, message) => ({
|
|
14323
|
+
file: entry.file,
|
|
14324
|
+
...positionOf(source)(index),
|
|
14325
|
+
rule: RULE,
|
|
14326
|
+
message
|
|
14327
|
+
});
|
|
14328
|
+
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START));
|
|
14329
|
+
const unstatedProblem = (entry, source) => problemAt({
|
|
14330
|
+
entry,
|
|
14331
|
+
source,
|
|
14332
|
+
index: START
|
|
14333
|
+
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
14334
|
+
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
14335
|
+
entry,
|
|
14336
|
+
source,
|
|
14337
|
+
index: offsetOf(source, ENGINES_KEY)
|
|
14338
|
+
}, `${SUPPORTED} engines.node is "${range}", which admits an older one. Set it to ">=${String(MINIMUM)}".`);
|
|
14339
|
+
const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14340
|
+
const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
|
|
14341
|
+
const manifestProblems = (entry, source) => {
|
|
14342
|
+
const manifest = decodeManifest(source);
|
|
14343
|
+
if (Option.isNone(manifest)) return [];
|
|
14344
|
+
const range = rangeOf(manifest.value);
|
|
14345
|
+
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
14346
|
+
return pipe(range, Option.filter(admitsOld), Option.map(rangeProblem(entry, source)), Option.toArray);
|
|
14347
|
+
};
|
|
14348
|
+
const pinnedProblems = (pattern) => (entry, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.filter((found) => Option.exists(majorOf(found), isOld)), Array.map((found) => problemAt({
|
|
14349
|
+
entry,
|
|
14350
|
+
source,
|
|
14351
|
+
index: found.index ?? START
|
|
14352
|
+
}, `${SUPPORTED} \`${String$1.trim(found[START])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
14353
|
+
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
14354
|
+
entry,
|
|
14355
|
+
source,
|
|
14356
|
+
index: START
|
|
14357
|
+
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
14358
|
+
const problemsIn = (entry, source) => {
|
|
14359
|
+
if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
|
|
14360
|
+
if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
|
|
14361
|
+
if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
|
|
14362
|
+
if (isToolVersions(entry)) return pinnedProblems(TOOL_VERSION)(entry, source);
|
|
14363
|
+
return pinnedProblems(SETUP_INPUT)(entry, source);
|
|
14364
|
+
};
|
|
14365
|
+
const isVersionSource = (entry) => VERSION_FILE.test(entry.name) || DOCKERFILE.test(entry.name) || STEP_FILE.test(entry.name) || isToolVersions(entry);
|
|
14366
|
+
/** @internal */
|
|
14367
|
+
const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersion(root) {
|
|
14368
|
+
const files = yield* RepositoryFiles;
|
|
14369
|
+
const listed = yield* listedFiles(root);
|
|
14370
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED]);
|
|
14371
|
+
const sources = [...pipe(listed, Array.filter(isVersionSource)), ...pipe(manifests, Array.map((name) => ({
|
|
14372
|
+
name,
|
|
14373
|
+
file: files.join(root, name)
|
|
14374
|
+
})))];
|
|
14375
|
+
return yield* scanText(sources, problemsIn);
|
|
14376
|
+
});
|
|
14377
|
+
// src/app/manifest-checks.ts
|
|
14378
|
+
/** @internal */
|
|
14379
|
+
const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
|
|
14380
|
+
const found = yield* Effect.all([checkNodeVersion(root), checkPackageScope(root)], { concurrency: "unbounded" });
|
|
14381
|
+
return Array.flatten(found);
|
|
14382
|
+
});
|
|
14315
14383
|
// src/app/tracked-text.ts
|
|
14316
14384
|
/** @internal */
|
|
14317
14385
|
const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedText(root) {
|
|
@@ -14322,7 +14390,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
|
|
|
14322
14390
|
checkUnneededFiles(root),
|
|
14323
14391
|
checkReplacedTools(root),
|
|
14324
14392
|
checkAlchemyPatch(root),
|
|
14325
|
-
|
|
14393
|
+
checkManifests(root),
|
|
14326
14394
|
checkSkillFiles(root),
|
|
14327
14395
|
checkSkillEntry(root),
|
|
14328
14396
|
checkPublishedSkills(root),
|
|
@@ -14351,27 +14419,6 @@ const checkAll = Effect.fn("checkAll")(function* checkAll(root) {
|
|
|
14351
14419
|
], { concurrency: "unbounded" });
|
|
14352
14420
|
return Array.flatten(found);
|
|
14353
14421
|
});
|
|
14354
|
-
// src/app/output.ts
|
|
14355
|
-
const taggedError = Schema.TaggedError;
|
|
14356
|
-
var ProblemsFound = class extends taggedError()("ProblemsFound", { count: Schema.Finite }) {};
|
|
14357
|
-
/** @internal */
|
|
14358
|
-
const writeStdout = Effect.fn("writeStdout")(function* writeStdout(text) {
|
|
14359
|
-
const stdio = yield* Stdio.Stdio;
|
|
14360
|
-
yield* Stream.make(text).pipe(Stream.run(stdio.stdout()), Effect.orDie);
|
|
14361
|
-
});
|
|
14362
|
-
// src/app/runtime.ts
|
|
14363
|
-
const reportFailure = (cause) => Effect.gen(function* report() {
|
|
14364
|
-
const stdio = yield* Stdio.Stdio;
|
|
14365
|
-
if (Cause.findErrorOption(cause).pipe(Option.exists(Schema.is(ProblemsFound)))) return;
|
|
14366
|
-
yield* Stream.make(`${Cause.pretty(cause)}\n`).pipe(Stream.run(stdio.stderr()), Effect.orDie);
|
|
14367
|
-
});
|
|
14368
|
-
const tracing = Otlp.layerFromConfig({ resource: { serviceName: "msch" } }).pipe(Layer.provide(OtlpSerialization.layerJson), Layer.provide(FetchHttpClient.layer));
|
|
14369
|
-
/** @internal */
|
|
14370
|
-
const runCli = (program) => {
|
|
14371
|
-
const services = Layer.mergeAll(nodeRepositoryFiles, tracing).pipe(Layer.provideMerge(nodeServicesLayer));
|
|
14372
|
-
const main = Layer.build(services).pipe(Effect.flatMap((context) => Effect.provideContext(program.pipe(Effect.tapCause(reportFailure)), context)), Effect.scoped);
|
|
14373
|
-
runMain(main, { disableErrorReporting: true });
|
|
14374
|
-
};
|
|
14375
14422
|
// bin/msch.ts
|
|
14376
14423
|
const NO_PROBLEMS = 0;
|
|
14377
14424
|
const ONE_FAILURE = 1;
|
|
@@ -14406,7 +14453,7 @@ const checkEverything = Effect.fn("checkEverything")(function* checkEverything(r
|
|
|
14406
14453
|
const toolFailures = yield* toolChecks(root, []);
|
|
14407
14454
|
return yield* failWhenAny(problems.length + toolFailures);
|
|
14408
14455
|
});
|
|
14409
|
-
|
|
14456
|
+
const msch = Effect.gen(function* msch() {
|
|
14410
14457
|
const stdio = yield* Stdio.Stdio;
|
|
14411
14458
|
const files = yield* RepositoryFiles;
|
|
14412
14459
|
const args = yield* stdio.args;
|
|
@@ -14414,7 +14461,8 @@ runCli(Effect.gen(function* msch() {
|
|
|
14414
14461
|
if (args.includes("--json")) return yield* writeJson(root);
|
|
14415
14462
|
if (Array.isReadonlyArrayNonEmpty(args)) return yield* toolChecks(root, args).pipe(Effect.flatMap(failWhenAny));
|
|
14416
14463
|
return yield* checkEverything(root);
|
|
14417
|
-
})
|
|
14464
|
+
});
|
|
14465
|
+
runCli(msch);
|
|
14418
14466
|
export {};
|
|
14419
14467
|
|
|
14420
14468
|
//# sourceMappingURL=cli.mjs.map
|