@r_masseater/msch 0.42.0 → 0.47.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 +10 -9
- package/dist/cargo-inputs.d.mts +1 -0
- package/dist/cargo-inputs.mjs +149 -94
- package/dist/cargo-inputs.mjs.map +1 -1
- package/dist/changed.d.mts +1 -0
- package/dist/changed.mjs +178 -0
- package/dist/changed.mjs.map +1 -0
- package/dist/cli-contract-BY7vwgKc.mjs +41 -0
- package/dist/cli-contract-BY7vwgKc.mjs.map +1 -0
- package/dist/cli.mjs +757 -938
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +3 -1
- package/dist/config.mjs +19 -9
- 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-DKJku2ZR.mjs → define-lint-preset-CxzPzVuB.mjs} +15 -24
- package/dist/define-lint-preset-CxzPzVuB.mjs.map +1 -0
- package/dist/{package-vbK0Qycn.mjs → dependencies-v59cxwTD.mjs} +186 -165
- package/dist/dependencies-v59cxwTD.mjs.map +1 -0
- package/dist/{ignored-directories-CfACwIvu.mjs → ignored-directories-thSB0IAT.mjs} +13 -6
- package/dist/ignored-directories-thSB0IAT.mjs.map +1 -0
- package/dist/{index-BwiAHe_u.d.mts → index-DL7PSp7j.d.mts} +3 -3
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/locked-closure-paths-Dtqs8uBU.mjs +7 -0
- package/dist/locked-closure-paths-Dtqs8uBU.mjs.map +1 -0
- package/dist/locked-inputs.d.mts +12 -0
- package/dist/locked-inputs.mjs +20 -0
- package/dist/locked-inputs.mjs.map +1 -0
- package/dist/oxlint.mjs +2 -1
- package/dist/oxlint.mjs.map +1 -1
- package/dist/package-Bdv6W97F.mjs +144 -0
- package/dist/package-Bdv6W97F.mjs.map +1 -0
- package/dist/project-DeQcAglt.mjs +464 -0
- package/dist/project-DeQcAglt.mjs.map +1 -0
- package/dist/publish.mjs +413 -169
- package/dist/publish.mjs.map +1 -1
- package/dist/reachable-Cc-255L3.mjs +13 -0
- package/dist/reachable-Cc-255L3.mjs.map +1 -0
- package/dist/{repository-files-CPfBA4mf.mjs → repository-files-aXwrITdF.mjs} +3 -2
- package/dist/repository-files-aXwrITdF.mjs.map +1 -0
- package/dist/{runtime-Dc5gCUSF.mjs → runtime-GbrDfB8K.mjs} +2 -2
- package/dist/{runtime-Dc5gCUSF.mjs.map → runtime-GbrDfB8K.mjs.map} +1 -1
- package/dist/started-once-CkTooI_o.mjs +13 -0
- package/dist/started-once-CkTooI_o.mjs.map +1 -0
- package/dist/{cli-contract-DdTV5DaG.mjs → syntax-ct2fFLtv.mjs} +9 -45
- package/dist/syntax-ct2fFLtv.mjs.map +1 -0
- package/dist/workspace-settings.mjs +8 -32
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +41 -33
- package/skills/msch-checks/SKILL.md +1 -1
- package/skills/publishing/SKILL.md +6 -4
- package/skills/repository-config/SKILL.md +14 -9
- package/skills/workspace-settings/SKILL.md +33 -3
- package/src/app/vite.d.ts +2 -0
- package/dist/cli-contract-DdTV5DaG.mjs.map +0 -1
- package/dist/define-lint-preset-DKJku2ZR.mjs.map +0 -1
- package/dist/ignored-directories-CfACwIvu.mjs.map +0 -1
- package/dist/package-vbK0Qycn.mjs.map +0 -1
- package/dist/repository-files-CPfBA4mf.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
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
|
|
3
|
-
import {
|
|
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 cratesIn, b as runTasksOf, c as workspaceLinks, d as deployEntries, f as namedWorkspaces, h as shadcnUiOf, l as lockedGraph, o as owningWorkspace, p as patternOf$1, r as readManifest, t as MANIFEST_FILE$3, u as lockedPackages, v as workspaceDirectories, w as VERIFY_TASK, y as workspaceManifest, z as propertyValue } from "./dependencies-v59cxwTD.mjs";
|
|
3
|
+
import { C as valueKey, S as schemaTypeOf, _ as formatValues, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as recordsIn, l as mentions$1, m as isObjectType, n as contentKey, o as projectInputs, p as describeLibraryType, r as keepOnly, t as implementationFingerprint, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./project-DeQcAglt.mjs";
|
|
4
|
+
import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-aXwrITdF.mjs";
|
|
5
|
+
import { a as publicEntriesOf, i as EntryManifestJson, r as publishedWorkspaces } from "./package-Bdv6W97F.mjs";
|
|
4
6
|
import { n as JAPANESE, t as COMMENT_DIRECTIVES } from "./comment-directives-5-f_qs1E.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { n as
|
|
7
|
+
import { t as startedOnce } from "./started-once-CkTooI_o.mjs";
|
|
8
|
+
import { $ as isSpreadElement, A as isBlock, B as isInterfaceDeclaration, C as getJSDocTags, D as isArrayLiteralExpression, E as getTextOfJSDocComment, F as isExportDeclaration, G as isObjectLiteralExpression, H as isModuleDeclaration, I as isFunctionDeclaration, J as isPropertyAssignment, K as isParenthesizedExpression, L as isFunctionExpression, M as isClassDeclaration, N as isElementAccessExpression, O as isArrowFunction, P as isEnumDeclaration, Q as isSourceFile, R as isIdentifier, S as SyntaxKind, T as getNameOfDeclaration, U as isNewExpression, V as isModuleBlock, W as isNumericLiteral, X as isSatisfiesExpression, Y as isReturnStatement, Z as isSignatureDeclaration, _ as uniqueByReference, a as descendantsOf, at as isVariableDeclaration, c as isGenericDeclaration, d as lineOf$3, et as isStringLiteral, f as packageOf$1, g as symbolAt, i as declarationsOf, it as isUnionTypeNode, j as isCallExpression, k as isBinaryExpression, l as isInsideAny, m as referencedSymbols, n as columnOf, nt as isTypeLiteralNode, o as importedModulesOf, ot as isVariableDeclarationList, p as propertyNamesOf, q as isPropertyAccessExpression, r as contains, rt as isTypeReferenceNode, s as isExternalDeclaration, st as isVariableStatement, t as childrenOf$3, tt as isTypeAliasDeclaration, u as isTypeDeclaration, x as SignatureKind, z as isImportDeclaration } from "./syntax-ct2fFLtv.mjs";
|
|
9
|
+
import { a as problemAt$9, i as formatProblem, n as ProblemList, o as sortProblems } from "./cli-contract-BY7vwgKc.mjs";
|
|
10
|
+
import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-GbrDfB8K.mjs";
|
|
7
11
|
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
8
|
-
import { Array,
|
|
12
|
+
import { Array, Config, Effect, FileSystem, HashMap, HashSet, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Schema, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
9
13
|
import { updateWorkspaceManifest } from "@pnpm/workspace.workspace-manifest-writer";
|
|
10
14
|
import { ChildProcess } from "effect/process";
|
|
11
15
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
@@ -49,11 +53,36 @@ const overrideProblem = (located) => (report) => {
|
|
|
49
53
|
});
|
|
50
54
|
return Option.none();
|
|
51
55
|
};
|
|
56
|
+
// src/features/check-overrides/model/override-records.ts
|
|
57
|
+
const RECORDS = [
|
|
58
|
+
NODE_MODULES,
|
|
59
|
+
".cache",
|
|
60
|
+
"msch",
|
|
61
|
+
"overrides"
|
|
62
|
+
];
|
|
63
|
+
const NO_PROBLEMS$1 = [];
|
|
64
|
+
const keyOf$1 = Effect.fn("keyOf")(function* keyOf(root, inputs) {
|
|
65
|
+
const files = yield* RepositoryFiles;
|
|
66
|
+
const implementation = yield* implementationFingerprint(import.meta.dirname);
|
|
67
|
+
return yield* contentKey([implementation], pipe(inputs, Array.map((file) => [file, files.join(root, file)])));
|
|
68
|
+
});
|
|
69
|
+
const unlessPassed = Effect.fn("unlessPassed")(function* unlessPassed(root, inputs, check) {
|
|
70
|
+
const files = yield* RepositoryFiles;
|
|
71
|
+
const key = yield* keyOf$1(root, inputs);
|
|
72
|
+
const records = yield* recordsIn(files.join(root, ...RECORDS));
|
|
73
|
+
if (Array.contains(records.passed, key)) {
|
|
74
|
+
yield* Effect.annotateCurrentSpan({ "msch.overrides.recorded": true });
|
|
75
|
+
return NO_PROBLEMS$1;
|
|
76
|
+
}
|
|
77
|
+
const problems = yield* check;
|
|
78
|
+
if (Array.isReadonlyArrayEmpty(problems)) yield* keepOnly(records, [key]);
|
|
79
|
+
return problems;
|
|
80
|
+
});
|
|
52
81
|
// src/shared/lib/text-position.ts
|
|
53
|
-
const START$
|
|
82
|
+
const START$19 = 0;
|
|
54
83
|
const FIRST_COLUMN$4 = 1;
|
|
55
84
|
const positionOf = (source) => (index) => {
|
|
56
|
-
const before = pipe(source, String$1.slice(START$
|
|
85
|
+
const before = pipe(source, String$1.slice(START$19, index), String$1.split("\n"));
|
|
57
86
|
return {
|
|
58
87
|
line: before.length,
|
|
59
88
|
column: pipe(Array.last(before), Option.match({
|
|
@@ -104,7 +133,7 @@ const AdvisorySchema = Schema.Struct({
|
|
|
104
133
|
github_advisory_id: Schema.String
|
|
105
134
|
});
|
|
106
135
|
const AuditReport = Schema.fromJsonString(Schema.Struct({ advisories: Schema.Record(Schema.String, AdvisorySchema) }));
|
|
107
|
-
const SCOPE_PREFIX
|
|
136
|
+
const SCOPE_PREFIX = "@";
|
|
108
137
|
const NAME_START = 0;
|
|
109
138
|
const SEPARATOR_LENGTH = 1;
|
|
110
139
|
const PEER_CONTEXT_START = "(";
|
|
@@ -128,8 +157,8 @@ const advisoriesIn = (output) => Option.match(Schema.decodeOption(AuditReport)(o
|
|
|
128
157
|
onSome: (report) => sorted(pipe(Record.values(report.advisories), Array.map((advisory) => `${advisory.module_name} ${advisory.github_advisory_id}`)))
|
|
129
158
|
});
|
|
130
159
|
const separatorOf = (key) => {
|
|
131
|
-
if (!String$1.startsWith(SCOPE_PREFIX
|
|
132
|
-
return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX
|
|
160
|
+
if (!String$1.startsWith(SCOPE_PREFIX)(key)) return String$1.indexOf(SCOPE_PREFIX)(key);
|
|
161
|
+
return pipe(String$1.slice(SEPARATOR_LENGTH)(key), String$1.indexOf(SCOPE_PREFIX), Option.map((index) => index + SEPARATOR_LENGTH));
|
|
133
162
|
};
|
|
134
163
|
const withoutPeerContext = (version) => Option.match(String$1.indexOf(PEER_CONTEXT_START)(version), {
|
|
135
164
|
onNone: () => version,
|
|
@@ -198,10 +227,10 @@ const withBaselineProbe = (overrides) => ({
|
|
|
198
227
|
[BASELINE_PROBE]: REMOVED_DEPENDENCY
|
|
199
228
|
});
|
|
200
229
|
// src/features/check-overrides/model/overrides.ts
|
|
201
|
-
const WORKSPACE_FILE$
|
|
230
|
+
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
202
231
|
const RESOLUTION_FILES = [
|
|
203
232
|
"*package.json",
|
|
204
|
-
WORKSPACE_FILE$
|
|
233
|
+
WORKSPACE_FILE$6,
|
|
205
234
|
"pnpm-lock.yaml",
|
|
206
235
|
".npmrc",
|
|
207
236
|
"patches/*"
|
|
@@ -298,16 +327,12 @@ const resolutionWith = Effect.fn("resolutionWith")(function* resolutionWith(work
|
|
|
298
327
|
advisories
|
|
299
328
|
})(depPaths);
|
|
300
329
|
}, Effect.scoped);
|
|
301
|
-
const problemsFor = Effect.fn("problemsFor")(function* problemsFor(
|
|
330
|
+
const problemsFor$1 = Effect.fn("problemsFor")(function* problemsFor(workspace, keys) {
|
|
302
331
|
const path = yield* Path.Path;
|
|
303
|
-
const
|
|
304
|
-
root,
|
|
305
|
-
files: yield* trackedResolutionFiles(root),
|
|
306
|
-
overrides
|
|
307
|
-
};
|
|
332
|
+
const { root, overrides } = workspace;
|
|
308
333
|
const baseline = yield* resolutionWith(workspace, BASELINE_PROBE, withBaselineProbe(overrides));
|
|
309
334
|
const judgeAgainstBaseline = judge(baseline);
|
|
310
|
-
const file = path.join(root, WORKSPACE_FILE$
|
|
335
|
+
const file = path.join(root, WORKSPACE_FILE$6);
|
|
311
336
|
const problemOf = (located) => resolutionWith(workspace, located.key, withoutOverride(located.key)(overrides)).pipe(Effect.map((candidate) => overrideProblem({
|
|
312
337
|
...located,
|
|
313
338
|
file
|
|
@@ -319,18 +344,23 @@ const problemsFor = Effect.fn("problemsFor")(function* problemsFor(root, overrid
|
|
|
319
344
|
const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root) {
|
|
320
345
|
const fs = yield* FileSystem.FileSystem;
|
|
321
346
|
const path = yield* Path.Path;
|
|
322
|
-
const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$
|
|
347
|
+
const source = yield* fs.readFileString(path.join(root, WORKSPACE_FILE$6)).pipe(Effect.option);
|
|
323
348
|
const manifest = yield* workspaceManifest(root);
|
|
324
349
|
const overrides = pipe(manifest, Option.flatMap((found) => Option.fromUndefinedOr(found.overrides)), Option.getOrElse(() => ({})));
|
|
325
350
|
const keys = pipe(source, Option.map((text) => overrideKeysOf(text)(overrides)), Option.getOrElse(() => []));
|
|
326
351
|
if (!Array.isReadonlyArrayNonEmpty(keys)) return [];
|
|
327
|
-
|
|
352
|
+
const files = yield* trackedResolutionFiles(root);
|
|
353
|
+
return yield* unlessPassed(root, files, problemsFor$1({
|
|
354
|
+
root,
|
|
355
|
+
files,
|
|
356
|
+
overrides
|
|
357
|
+
}, keys));
|
|
328
358
|
});
|
|
329
359
|
// src/shared/lib/scanned-files.ts
|
|
330
360
|
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
361
|
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
332
362
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
333
|
-
const READ_CONCURRENCY$
|
|
363
|
+
const READ_CONCURRENCY$30 = 64;
|
|
334
364
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
335
365
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
336
366
|
/** @internal */
|
|
@@ -353,18 +383,18 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, problemsIn) {
|
|
|
353
383
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
354
384
|
onNone: () => [],
|
|
355
385
|
onSome: (source) => problemsIn(entry, source)
|
|
356
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
386
|
+
}))), { concurrency: READ_CONCURRENCY$30 });
|
|
357
387
|
return Array.flatten(found);
|
|
358
388
|
});
|
|
359
389
|
// src/features/check-overrides/model/git-subpath.ts
|
|
360
390
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
361
391
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
362
|
-
const RULE$
|
|
392
|
+
const RULE$49 = "git-subpath-dependency";
|
|
363
393
|
const WHOLE_MATCH$3 = 0;
|
|
364
394
|
const problemAt$8 = ({ file }, source) => (found) => ({
|
|
365
395
|
file,
|
|
366
396
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
367
|
-
rule: RULE$
|
|
397
|
+
rule: RULE$49,
|
|
368
398
|
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
399
|
});
|
|
370
400
|
const problemsIn$16 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array.map(problemAt$8(entry, source)));
|
|
@@ -375,13 +405,13 @@ const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(r
|
|
|
375
405
|
return yield* scanText(pipe(listed, Array.filter(isDependencyFile)), problemsIn$16);
|
|
376
406
|
});
|
|
377
407
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
378
|
-
const RULE$
|
|
408
|
+
const RULE$48 = "unnamed-restriction";
|
|
379
409
|
const WHOLE_MATCH$2 = 0;
|
|
380
410
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
381
411
|
const problemsIn$15 = (entry, source) => pipe(Array.fromIterable(String$1.matchAll(UNNAMED)(source)), Array.map((found) => ({
|
|
382
412
|
file: entry.file,
|
|
383
413
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
384
|
-
rule: RULE$
|
|
414
|
+
rule: RULE$48,
|
|
385
415
|
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
416
|
})));
|
|
387
417
|
/** @internal */
|
|
@@ -390,41 +420,41 @@ const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRe
|
|
|
390
420
|
return yield* scanText(pipe(listed, Array.filter(isScannedText)), problemsIn$15);
|
|
391
421
|
});
|
|
392
422
|
// src/features/check-overrides/model/package-registry.ts
|
|
393
|
-
const RULE$
|
|
423
|
+
const RULE$47 = "package-registry";
|
|
394
424
|
const REGISTRY = "https://npm.flatt.tech/";
|
|
395
425
|
const TRAILING_SLASH = /\/$/u;
|
|
396
|
-
const WORKSPACE_FILE$
|
|
426
|
+
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
397
427
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
398
428
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
399
429
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
400
|
-
const START$
|
|
430
|
+
const START$18 = 0;
|
|
401
431
|
const REASON = `Installs go through Takumi Guard (${REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
402
432
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
403
433
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
404
434
|
const withoutSlash = String$1.replace(TRAILING_SLASH, "");
|
|
405
435
|
const isGuarded = (registry) => withoutSlash(registry) === withoutSlash(REGISTRY);
|
|
406
|
-
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
436
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$18));
|
|
407
437
|
const workspaceProblem = (file, source, registry) => ({
|
|
408
438
|
file,
|
|
409
|
-
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
410
|
-
rule: RULE$
|
|
439
|
+
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
440
|
+
rule: RULE$47,
|
|
411
441
|
message: Option.match(registry, {
|
|
412
|
-
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$
|
|
442
|
+
onNone: () => `${REASON} Set \`registry: ${REGISTRY}\` in ${WORKSPACE_FILE$5}.`,
|
|
413
443
|
onSome: (value) => `${REASON} \`registry\` is ${value}. Set it to ${REGISTRY}.`
|
|
414
444
|
})
|
|
415
445
|
});
|
|
416
446
|
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
447
|
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$
|
|
448
|
+
...positionOf(source)(found.index ?? START$18),
|
|
449
|
+
rule: RULE$47,
|
|
450
|
+
message: `${REASON} This .npmrc overrides it with \`${String$1.trim(found[START$18])}\`. Remove the line.`
|
|
421
451
|
})));
|
|
422
452
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
423
453
|
const files = yield* RepositoryFiles;
|
|
424
454
|
const manifest = yield* workspaceManifest(root);
|
|
425
455
|
if (Option.isNone(manifest) || Option.exists(registryOf(manifest.value), isGuarded)) return [];
|
|
426
456
|
const registry = registryOf(manifest.value);
|
|
427
|
-
const file = files.join(root, WORKSPACE_FILE$
|
|
457
|
+
const file = files.join(root, WORKSPACE_FILE$5);
|
|
428
458
|
const read = yield* files.readFile(file);
|
|
429
459
|
const source = Option.getOrElse(read, () => "");
|
|
430
460
|
return [workspaceProblem(file, source, registry)];
|
|
@@ -436,7 +466,7 @@ const checkPackageRegistry = Effect.fn("checkPackageRegistry")(function* checkPa
|
|
|
436
466
|
return [...yield* checkWorkspace(root), ...overrides];
|
|
437
467
|
});
|
|
438
468
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
439
|
-
const RULE$
|
|
469
|
+
const RULE$46 = "colocated-git-patterns";
|
|
440
470
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
441
471
|
const ROOT$2 = ".";
|
|
442
472
|
const SEPARATOR$21 = "/";
|
|
@@ -447,8 +477,8 @@ const FLOATING_PREFIX = `${ANY_DEPTH}${SEPARATOR$21}`;
|
|
|
447
477
|
const LEADING_SLASHES = /^\/+/u;
|
|
448
478
|
const TRAILING_SLASHES = /\/+$/u;
|
|
449
479
|
const SPACES = /\s+/u;
|
|
450
|
-
const FIRST$
|
|
451
|
-
const READ_CONCURRENCY$
|
|
480
|
+
const FIRST$24 = 1;
|
|
481
|
+
const READ_CONCURRENCY$29 = 16;
|
|
452
482
|
const isInside = (directory) => (inner) => inner !== directory && (directory === ROOT$2 || String$1.startsWith(`${directory}${SEPARATOR$21}`)(inner));
|
|
453
483
|
const withoutPrefix = (prefix, text) => {
|
|
454
484
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
@@ -473,7 +503,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
|
473
503
|
file,
|
|
474
504
|
kind,
|
|
475
505
|
directory,
|
|
476
|
-
line: index + FIRST$
|
|
506
|
+
line: index + FIRST$24,
|
|
477
507
|
pattern,
|
|
478
508
|
values: Array.join(values, " ")
|
|
479
509
|
});
|
|
@@ -488,12 +518,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
488
518
|
const problemAt$7 = (entry, message) => ({
|
|
489
519
|
file: entry.file,
|
|
490
520
|
line: entry.line,
|
|
491
|
-
column: FIRST$
|
|
492
|
-
rule: RULE$
|
|
521
|
+
column: FIRST$24,
|
|
522
|
+
rule: RULE$46,
|
|
493
523
|
message
|
|
494
524
|
});
|
|
495
525
|
const misplacedMessage = (kind, workspaces) => {
|
|
496
|
-
if (workspaces.length === FIRST$
|
|
526
|
+
if (workspaces.length === FIRST$24) {
|
|
497
527
|
const workspace = Array.join(workspaces, "");
|
|
498
528
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
499
529
|
}
|
|
@@ -543,17 +573,17 @@ const repeated = (entries) => (entry) => {
|
|
|
543
573
|
/** @internal */
|
|
544
574
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
545
575
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
546
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$
|
|
576
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$1(root, file), { concurrency: READ_CONCURRENCY$29 });
|
|
547
577
|
const entries = Array.flatten(read);
|
|
548
578
|
const workspaces = yield* workspaceDirectories(root);
|
|
549
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
579
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$29 });
|
|
550
580
|
const repeatedFound = pipe(entries, Array.map(repeated(entries)));
|
|
551
581
|
return Array.getSomes([...misplacedFound, ...repeatedFound]);
|
|
552
582
|
});
|
|
553
583
|
// src/features/check-placement/model/colocated-tests.ts
|
|
554
|
-
const RULE$
|
|
555
|
-
const FIRST$
|
|
556
|
-
const READ_CONCURRENCY$
|
|
584
|
+
const RULE$45 = "colocated-test";
|
|
585
|
+
const FIRST$23 = 1;
|
|
586
|
+
const READ_CONCURRENCY$28 = 64;
|
|
557
587
|
const ROOT_SUBPATH = ".";
|
|
558
588
|
const NAME_GROUP = "name";
|
|
559
589
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -566,20 +596,20 @@ const SPEC_FILE = /\.spec\.[cm]?[jt]sx?$/u;
|
|
|
566
596
|
const RELATIVE_REFERENCE = /["'`]\.\/(?<name>[^/"'`]+)/gu;
|
|
567
597
|
const DIRNAME_REFERENCE = /import\.meta\.dirname\s*,\s*["'](?<name>[^/"']+)["']/gu;
|
|
568
598
|
const MODULE_SPECIFIER = /(?:\bfrom\s+|\bimport\s*\(\s*|\bimport\s+|\bvi\.mock\(\s*)["'](?<specifier>[^"'.#][^"']*)["']/gu;
|
|
569
|
-
const EXCLUDED$
|
|
599
|
+
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
570
600
|
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
601
|
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$
|
|
602
|
+
const Manifest$5 = Schema.Struct({
|
|
573
603
|
name: Schema.optional(Schema.String),
|
|
574
604
|
exports: Schema.optional(Schema.Unknown)
|
|
575
605
|
});
|
|
576
|
-
const decodeManifest$
|
|
606
|
+
const decodeManifest$9 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$5));
|
|
577
607
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
578
608
|
const problemFor$7 = (test, message) => ({
|
|
579
609
|
file: test.file,
|
|
580
|
-
line: FIRST$
|
|
581
|
-
column: FIRST$
|
|
582
|
-
rule: RULE$
|
|
610
|
+
line: FIRST$23,
|
|
611
|
+
column: FIRST$23,
|
|
612
|
+
rule: RULE$45,
|
|
583
613
|
message: `${test.base} ${message}`
|
|
584
614
|
});
|
|
585
615
|
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);
|
|
@@ -599,7 +629,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
599
629
|
if (Option.isNone(owner)) return [];
|
|
600
630
|
const text = yield* files.readFile(files.join(context.root, owner.value, MANIFEST_FILE$3));
|
|
601
631
|
const join = (target) => files.join(context.root, owner.value, target);
|
|
602
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
632
|
+
return pipe(text, Option.flatMap(decodeManifest$9), Option.map(specifiersBeside({
|
|
603
633
|
join,
|
|
604
634
|
dirname: files.dirname,
|
|
605
635
|
directory: test.directory
|
|
@@ -627,7 +657,7 @@ const problemIn$6 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
|
627
657
|
/** @internal */
|
|
628
658
|
const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColocatedTests(root) {
|
|
629
659
|
const files = yield* RepositoryFiles;
|
|
630
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
660
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$6);
|
|
631
661
|
const names = pipe(listed, Array.filter(String$1.isNonEmpty));
|
|
632
662
|
const context = {
|
|
633
663
|
root,
|
|
@@ -642,12 +672,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
642
672
|
directory: files.dirname(file)
|
|
643
673
|
};
|
|
644
674
|
}));
|
|
645
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$
|
|
675
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$6(context, test), { concurrency: READ_CONCURRENCY$28 });
|
|
646
676
|
return Array.getSomes(found);
|
|
647
677
|
});
|
|
648
678
|
// src/shared/lib/agent-docs.ts
|
|
649
679
|
const AGENT_DOC = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
650
|
-
const READ_CONCURRENCY$
|
|
680
|
+
const READ_CONCURRENCY$27 = 16;
|
|
651
681
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
652
682
|
const files = yield* RepositoryFiles;
|
|
653
683
|
const listed = yield* files.listedFiles(root);
|
|
@@ -656,33 +686,33 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
656
686
|
const file = files.join(root, name);
|
|
657
687
|
const problemOf = Option.flatMap(problemIn(file));
|
|
658
688
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
659
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
689
|
+
}, { concurrency: READ_CONCURRENCY$27 });
|
|
660
690
|
return Array.getSomes(found);
|
|
661
691
|
});
|
|
662
692
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
663
693
|
const RECOMMENDED_LINES = 200;
|
|
664
|
-
const FIRST$
|
|
665
|
-
const RULE$
|
|
694
|
+
const FIRST$22 = 1;
|
|
695
|
+
const RULE$44 = "agent-docs-length";
|
|
666
696
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
667
697
|
const problemFor$6 = (file) => (lines) => {
|
|
668
698
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
669
699
|
return Option.some({
|
|
670
700
|
file,
|
|
671
701
|
line: 201,
|
|
672
|
-
column: FIRST$
|
|
673
|
-
rule: RULE$
|
|
702
|
+
column: FIRST$22,
|
|
703
|
+
rule: RULE$44,
|
|
674
704
|
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
705
|
});
|
|
676
706
|
};
|
|
677
707
|
/** @internal */
|
|
678
708
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$6(file)(lineCount(source)));
|
|
679
709
|
// src/features/check-placement/model/claude-link.ts
|
|
680
|
-
const RULE$
|
|
710
|
+
const RULE$43 = "claude-md-link";
|
|
681
711
|
const CLAUDE = "CLAUDE.md";
|
|
682
712
|
const AGENTS = "AGENTS.md";
|
|
683
|
-
const FIRST$
|
|
684
|
-
const READ_CONCURRENCY$
|
|
685
|
-
const MESSAGE$
|
|
713
|
+
const FIRST$21 = 1;
|
|
714
|
+
const READ_CONCURRENCY$26 = 16;
|
|
715
|
+
const MESSAGE$15 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
686
716
|
/** @internal */
|
|
687
717
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
688
718
|
const files = yield* RepositoryFiles;
|
|
@@ -694,21 +724,21 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
694
724
|
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
695
725
|
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
696
726
|
file: path,
|
|
697
|
-
line: FIRST$
|
|
698
|
-
column: FIRST$
|
|
699
|
-
rule: RULE$
|
|
700
|
-
message: MESSAGE$
|
|
727
|
+
line: FIRST$21,
|
|
728
|
+
column: FIRST$21,
|
|
729
|
+
rule: RULE$43,
|
|
730
|
+
message: MESSAGE$15
|
|
701
731
|
})));
|
|
702
732
|
});
|
|
703
733
|
const claude = pipe(listed, Array.filter((name) => files.basename(name) === CLAUDE));
|
|
704
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
734
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$26 });
|
|
705
735
|
return Array.getSomes(found);
|
|
706
736
|
});
|
|
707
737
|
// src/features/check-placement/model/dangling-links.ts
|
|
708
|
-
const RULE$
|
|
738
|
+
const RULE$42 = "dangling-link";
|
|
709
739
|
const SEPARATOR$20 = "/";
|
|
710
|
-
const FIRST$
|
|
711
|
-
const READ_CONCURRENCY$
|
|
740
|
+
const FIRST$20 = 1;
|
|
741
|
+
const READ_CONCURRENCY$25 = 16;
|
|
712
742
|
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$20}`)(name);
|
|
713
743
|
/** @internal */
|
|
714
744
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
@@ -719,21 +749,21 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
719
749
|
const link = yield* files.readLink(file);
|
|
720
750
|
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) => ({
|
|
721
751
|
file,
|
|
722
|
-
line: FIRST$
|
|
723
|
-
column: FIRST$
|
|
724
|
-
rule: RULE$
|
|
752
|
+
line: FIRST$20,
|
|
753
|
+
column: FIRST$20,
|
|
754
|
+
rule: RULE$42,
|
|
725
755
|
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.`
|
|
726
756
|
})));
|
|
727
757
|
});
|
|
728
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
758
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$25 });
|
|
729
759
|
return Array.getSomes(found);
|
|
730
760
|
});
|
|
731
761
|
// src/features/check-placement/model/nested-docs.ts
|
|
732
|
-
const RULE$
|
|
762
|
+
const RULE$41 = "nested-docs";
|
|
733
763
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
734
764
|
const SEPARATOR$19 = "/";
|
|
735
|
-
const FIRST$
|
|
736
|
-
const READ_CONCURRENCY$
|
|
765
|
+
const FIRST$19 = 1;
|
|
766
|
+
const READ_CONCURRENCY$24 = 64;
|
|
737
767
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
738
768
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
739
769
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
@@ -743,9 +773,9 @@ var RootConfigUnreadable = class extends taggedError$5()("RootConfigUnreadable",
|
|
|
743
773
|
const isNested = (name) => String$1.includes(SEPARATOR$19)(name);
|
|
744
774
|
const problemFor$5 = (file, message) => ({
|
|
745
775
|
file,
|
|
746
|
-
line: FIRST$
|
|
747
|
-
column: FIRST$
|
|
748
|
-
rule: RULE$
|
|
776
|
+
line: FIRST$19,
|
|
777
|
+
column: FIRST$19,
|
|
778
|
+
rule: RULE$41,
|
|
749
779
|
message
|
|
750
780
|
});
|
|
751
781
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
@@ -792,25 +822,25 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
792
822
|
workspaces: pipe(directories, Array.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
793
823
|
workspaceAgentDocs
|
|
794
824
|
};
|
|
795
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
825
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$5(root, allowed, name), { concurrency: READ_CONCURRENCY$24 });
|
|
796
826
|
return Array.getSomes(found);
|
|
797
827
|
});
|
|
798
828
|
// src/features/check-placement/model/published-readme.ts
|
|
799
|
-
const RULE$
|
|
829
|
+
const RULE$40 = "published-readme";
|
|
800
830
|
const README_FILE = "README.md";
|
|
801
|
-
const READ_CONCURRENCY$
|
|
802
|
-
const MESSAGE$
|
|
831
|
+
const READ_CONCURRENCY$23 = 16;
|
|
832
|
+
const MESSAGE$14 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
803
833
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
804
|
-
const FILE_START$
|
|
834
|
+
const FILE_START$1 = 1;
|
|
805
835
|
const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
806
836
|
const files = yield* RepositoryFiles;
|
|
807
837
|
const file = files.join(root, directory, README_FILE);
|
|
808
838
|
const text = yield* files.readFile(file);
|
|
809
839
|
if (Option.isNone(text)) return Option.some({
|
|
810
840
|
file,
|
|
811
|
-
line: FILE_START$
|
|
812
|
-
column: FILE_START$
|
|
813
|
-
rule: RULE$
|
|
841
|
+
line: FILE_START$1,
|
|
842
|
+
column: FILE_START$1,
|
|
843
|
+
rule: RULE$40,
|
|
814
844
|
message: MISSING_MESSAGE
|
|
815
845
|
});
|
|
816
846
|
return pipe(text, Option.flatMap((source) => pipe(Option.fromNullishOr(JAPANESE.exec(source)), Option.map((found) => {
|
|
@@ -819,23 +849,23 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
819
849
|
file,
|
|
820
850
|
line,
|
|
821
851
|
column,
|
|
822
|
-
rule: RULE$
|
|
823
|
-
message: MESSAGE$
|
|
852
|
+
rule: RULE$40,
|
|
853
|
+
message: MESSAGE$14
|
|
824
854
|
};
|
|
825
855
|
}))));
|
|
826
856
|
});
|
|
827
857
|
/** @internal */
|
|
828
858
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
829
859
|
const projects = yield* publishedProjects(root);
|
|
830
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$
|
|
860
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$4(root, project), { concurrency: READ_CONCURRENCY$23 });
|
|
831
861
|
return Array.getSomes(found);
|
|
832
862
|
});
|
|
833
863
|
// src/features/check-placement/model/published-tests.ts
|
|
834
|
-
const RULE$
|
|
864
|
+
const RULE$39 = "published-tests";
|
|
835
865
|
const MANIFEST_FILE$2 = "package.json";
|
|
836
|
-
const FILE_START
|
|
866
|
+
const FILE_START = 1;
|
|
837
867
|
const TEST_FILE$1 = /\.test\.[cm]?[jt]sx?$/u;
|
|
838
|
-
const MESSAGE$
|
|
868
|
+
const MESSAGE$13 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
839
869
|
const testedIn = (listed) => (prefix) => pipe(listed, Array.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$1.test(file)));
|
|
840
870
|
const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
841
871
|
const files = yield* RepositoryFiles;
|
|
@@ -844,10 +874,10 @@ const problemFor$4 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
844
874
|
if (testedIn(listed)(prefix)) return Option.none();
|
|
845
875
|
return Option.some({
|
|
846
876
|
file: files.join(absolute, MANIFEST_FILE$2),
|
|
847
|
-
line: FILE_START
|
|
848
|
-
column: FILE_START
|
|
849
|
-
rule: RULE$
|
|
850
|
-
message: MESSAGE$
|
|
877
|
+
line: FILE_START,
|
|
878
|
+
column: FILE_START,
|
|
879
|
+
rule: RULE$39,
|
|
880
|
+
message: MESSAGE$13
|
|
851
881
|
});
|
|
852
882
|
});
|
|
853
883
|
/** @internal */
|
|
@@ -860,12 +890,12 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
860
890
|
return Array.getSomes(found);
|
|
861
891
|
});
|
|
862
892
|
// src/features/check-placement/model/root-docs.ts
|
|
863
|
-
const RULE$
|
|
893
|
+
const RULE$38 = "root-docs";
|
|
864
894
|
const SEPARATOR$18 = "/";
|
|
865
|
-
const FIRST$
|
|
895
|
+
const FIRST$18 = 1;
|
|
866
896
|
const MARKDOWN$1 = /\.(?:md|mdx|markdown)$/iu;
|
|
867
897
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
868
|
-
const MESSAGE$
|
|
898
|
+
const MESSAGE$12 = "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
899
|
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$18)(name) && MARKDOWN$1.test(name) && !ALLOWED.test(name);
|
|
870
900
|
/** @internal */
|
|
871
901
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
@@ -873,17 +903,17 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
873
903
|
const names = yield* files.listedFiles(root);
|
|
874
904
|
return pipe(names, Array.filter(isStrayRootDoc), Array.map((name) => ({
|
|
875
905
|
file: files.join(root, name),
|
|
876
|
-
line: FIRST$
|
|
877
|
-
column: FIRST$
|
|
878
|
-
rule: RULE$
|
|
879
|
-
message: `${name} ${MESSAGE$
|
|
906
|
+
line: FIRST$18,
|
|
907
|
+
column: FIRST$18,
|
|
908
|
+
rule: RULE$38,
|
|
909
|
+
message: `${name} ${MESSAGE$12}`
|
|
880
910
|
})));
|
|
881
911
|
});
|
|
882
912
|
// src/features/check-placement/model/root-readme.ts
|
|
883
|
-
const RULE$
|
|
913
|
+
const RULE$37 = "root-readme";
|
|
884
914
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
885
|
-
const READ_CONCURRENCY$
|
|
886
|
-
const START$
|
|
915
|
+
const READ_CONCURRENCY$22 = 16;
|
|
916
|
+
const START$17 = 0;
|
|
887
917
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
888
918
|
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
889
919
|
const RELATIVE$1 = /^\.\//u;
|
|
@@ -928,8 +958,8 @@ const problemsIn$14 = (file, source, plugins) => (workspace) => {
|
|
|
928
958
|
const pattern = patternFor(plugins)(workspace);
|
|
929
959
|
return pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.map((found) => ({
|
|
930
960
|
file,
|
|
931
|
-
...at(found.index ?? START$
|
|
932
|
-
rule: RULE$
|
|
961
|
+
...at(found.index ?? START$17),
|
|
962
|
+
rule: RULE$37,
|
|
933
963
|
message
|
|
934
964
|
})));
|
|
935
965
|
};
|
|
@@ -948,7 +978,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
948
978
|
const named = yield* namedWorkspaces(root);
|
|
949
979
|
const workspaces = pipe(named, Array.filter((workspace) => !isCheckPolicy(workspace)));
|
|
950
980
|
const plugins = yield* marketplacePlugins(root);
|
|
951
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
981
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$22 });
|
|
952
982
|
return Array.flatten(found);
|
|
953
983
|
});
|
|
954
984
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -967,10 +997,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
967
997
|
return Array.flatten(found);
|
|
968
998
|
});
|
|
969
999
|
// src/features/check-placement/model/docs-mirror.ts
|
|
970
|
-
const RULE$
|
|
1000
|
+
const RULE$36 = "docs-mirror";
|
|
971
1001
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
972
1002
|
const MIRROR_LIMIT = 3;
|
|
973
|
-
const READ_CONCURRENCY$
|
|
1003
|
+
const READ_CONCURRENCY$21 = 16;
|
|
974
1004
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
975
1005
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
976
1006
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -992,7 +1022,7 @@ const problemFor$3 = (file, source, mentions) => pipe(Array.head(mentions), Opti
|
|
|
992
1022
|
file,
|
|
993
1023
|
line,
|
|
994
1024
|
column,
|
|
995
|
-
rule: RULE$
|
|
1025
|
+
rule: RULE$36,
|
|
996
1026
|
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.`
|
|
997
1027
|
};
|
|
998
1028
|
}), Option.toArray);
|
|
@@ -1007,7 +1037,7 @@ const workspacesOf = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
1007
1037
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
1008
1038
|
directory,
|
|
1009
1039
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
1010
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1040
|
+
}))), { concurrency: READ_CONCURRENCY$21 });
|
|
1011
1041
|
});
|
|
1012
1042
|
/** @internal */
|
|
1013
1043
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -1020,31 +1050,31 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
1020
1050
|
onNone: () => [],
|
|
1021
1051
|
onSome: (text) => problemIn$3(workspaces)(doc, file, text)
|
|
1022
1052
|
})));
|
|
1023
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
1053
|
+
}, { concurrency: READ_CONCURRENCY$21 });
|
|
1024
1054
|
return Array.flatten(found);
|
|
1025
1055
|
});
|
|
1026
1056
|
// src/features/check-placement/model/ignored-sources.ts
|
|
1027
|
-
const RULE$
|
|
1057
|
+
const RULE$35 = "ignored-sources";
|
|
1028
1058
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
1029
|
-
const FIRST$
|
|
1030
|
-
const MESSAGE$
|
|
1059
|
+
const FIRST$17 = 1;
|
|
1060
|
+
const MESSAGE$11 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
1031
1061
|
/** @internal */
|
|
1032
1062
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
1033
1063
|
const files = yield* RepositoryFiles;
|
|
1034
1064
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
1035
1065
|
return pipe(ignored, Array.map((file) => ({
|
|
1036
1066
|
file: files.join(root, file),
|
|
1037
|
-
line: FIRST$
|
|
1038
|
-
column: FIRST$
|
|
1039
|
-
rule: RULE$
|
|
1040
|
-
message: MESSAGE$
|
|
1067
|
+
line: FIRST$17,
|
|
1068
|
+
column: FIRST$17,
|
|
1069
|
+
rule: RULE$35,
|
|
1070
|
+
message: MESSAGE$11
|
|
1041
1071
|
})));
|
|
1042
1072
|
});
|
|
1043
1073
|
// src/features/check-placement/model/member-sources.ts
|
|
1044
1074
|
const ROOT_WORKSPACE$1 = ".";
|
|
1045
|
-
const FIRST$
|
|
1075
|
+
const FIRST$16 = 1;
|
|
1046
1076
|
const SEPARATOR$16 = "/";
|
|
1047
|
-
const EXCLUDED$
|
|
1077
|
+
const EXCLUDED$5 = [
|
|
1048
1078
|
":(exclude,attr:linguist-vendored)",
|
|
1049
1079
|
":(exclude,attr:linguist-generated)",
|
|
1050
1080
|
":(exclude,attr:linguist-documentation)"
|
|
@@ -1057,14 +1087,14 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
1057
1087
|
const files = yield* RepositoryFiles;
|
|
1058
1088
|
return {
|
|
1059
1089
|
workspaces: yield* memberWorkspaces(root),
|
|
1060
|
-
listed: yield* files.matchingFiles(root, EXCLUDED$
|
|
1090
|
+
listed: yield* files.matchingFiles(root, EXCLUDED$5)
|
|
1061
1091
|
};
|
|
1062
1092
|
});
|
|
1063
1093
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
1064
1094
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
1065
1095
|
file,
|
|
1066
|
-
line: FIRST$
|
|
1067
|
-
column: FIRST$
|
|
1096
|
+
line: FIRST$16,
|
|
1097
|
+
column: FIRST$16,
|
|
1068
1098
|
rule,
|
|
1069
1099
|
message
|
|
1070
1100
|
});
|
|
@@ -1105,16 +1135,8 @@ var GrammarUnreadable = class extends taggedError$4()("GrammarUnreadable", {
|
|
|
1105
1135
|
message: Schema.String
|
|
1106
1136
|
}) {};
|
|
1107
1137
|
const PARSER_KEY = "parser";
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
return (key, start) => Option.getOrElse(Option.fromNullishOr(started.get(key)), () => {
|
|
1111
|
-
const promise = start();
|
|
1112
|
-
started.set(key, promise);
|
|
1113
|
-
return promise;
|
|
1114
|
-
});
|
|
1115
|
-
};
|
|
1116
|
-
const initParser = cache();
|
|
1117
|
-
const loadOnce = cache();
|
|
1138
|
+
const initParser = startedOnce();
|
|
1139
|
+
const loadOnce = startedOnce();
|
|
1118
1140
|
const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
|
|
1119
1141
|
const loadLanguage = (grammar) => {
|
|
1120
1142
|
const unreadable = (cause) => GrammarUnreadable.make({
|
|
@@ -9712,8 +9734,8 @@ const LAYER_ITEMS = [
|
|
|
9712
9734
|
"attribute_item",
|
|
9713
9735
|
"inner_attribute_item"
|
|
9714
9736
|
];
|
|
9715
|
-
const READ_CONCURRENCY$
|
|
9716
|
-
const EXCLUDED$
|
|
9737
|
+
const READ_CONCURRENCY$20 = 64;
|
|
9738
|
+
const EXCLUDED$4 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
9717
9739
|
const NONE$2 = [];
|
|
9718
9740
|
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.";
|
|
9719
9741
|
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.";
|
|
@@ -9756,7 +9778,7 @@ const PROBLEMS = {
|
|
|
9756
9778
|
skipped: () => NONE$2,
|
|
9757
9779
|
misplaced: () => NONE$2
|
|
9758
9780
|
};
|
|
9759
|
-
const problemsOf$
|
|
9781
|
+
const problemsOf$4 = (read) => PROBLEMS[kindOf$1(read.source.inner)](read);
|
|
9760
9782
|
const misnamedSlice = ({ crate, inner }, root, join) => {
|
|
9761
9783
|
const modulePath = modulePathOf(inner);
|
|
9762
9784
|
return pipe(Option.liftPredicate(modulePath, (path) => path.length >= 2), Option.filter((path) => Option.contains(Array.head(path), FEATURES)), Option.flatMap((path) => Array.last(Array.take(path, 2))), Option.filter((slice) => !isFeatureName(slice)), Option.map((slice) => join(root, crate, "src", FEATURES, slice)));
|
|
@@ -9780,7 +9802,7 @@ const isRead = ({ inner }) => {
|
|
|
9780
9802
|
};
|
|
9781
9803
|
const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
9782
9804
|
const files = yield* RepositoryFiles;
|
|
9783
|
-
const listed = yield* files.matchingFiles(root, EXCLUDED$
|
|
9805
|
+
const listed = yield* files.matchingFiles(root, EXCLUDED$4);
|
|
9784
9806
|
const owner = crateOf(crateDirectories(listed));
|
|
9785
9807
|
return pipe(listed, Array.filter((name) => RUST_FILE.test(name)), Array.flatMap((name) => Option.toArray(Option.map(owner(name), (owned) => ({
|
|
9786
9808
|
...owned,
|
|
@@ -9794,22 +9816,43 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
9794
9816
|
if (!Array.isReadonlyArrayNonEmpty(sources)) return NONE$2;
|
|
9795
9817
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
9796
9818
|
const parse = parsedWith(language);
|
|
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$
|
|
9798
|
-
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$
|
|
9819
|
+
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$20 });
|
|
9820
|
+
return [...sliceNameProblems(root, files.join, sources), ...Array.flatMap(Array.getSomes(read), problemsOf$4)];
|
|
9821
|
+
});
|
|
9822
|
+
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
9823
|
+
const RULE$34 = "shadcn-ui-alias";
|
|
9824
|
+
const FIRST$15 = 1;
|
|
9825
|
+
const problemOf$8 = (directory, { file, alias }) => ({
|
|
9826
|
+
file,
|
|
9827
|
+
line: FIRST$15,
|
|
9828
|
+
column: FIRST$15,
|
|
9829
|
+
rule: RULE$34,
|
|
9830
|
+
message: `aliases.ui "${alias}" in ${directory}/components.json does not resolve to a directory through the imports of ${directory}/package.json. shadcn lint and msch then cannot tell which files are the design-system components. Point the alias at a "#/" import, such as "#/shared/ui", and map "#/*" to "./src/*".`
|
|
9831
|
+
});
|
|
9832
|
+
/** @internal */
|
|
9833
|
+
const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAliasProblems(root, directory) {
|
|
9834
|
+
const files = yield* RepositoryFiles;
|
|
9835
|
+
const found = yield* shadcnUiOf(root, directory);
|
|
9836
|
+
if (Option.isNone(found)) return Array.empty();
|
|
9837
|
+
if (yield* Option.match(found.value.target, {
|
|
9838
|
+
onNone: () => Effect.succeed(false),
|
|
9839
|
+
onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
|
|
9840
|
+
})) return Array.empty();
|
|
9841
|
+
return [problemOf$8(directory, found.value)];
|
|
9799
9842
|
});
|
|
9800
9843
|
// src/features/check-placement/model/source-aliases.ts
|
|
9801
9844
|
const ALIAS_RULE = "source-alias";
|
|
9802
|
-
const FIRST$
|
|
9845
|
+
const FIRST$14 = 1;
|
|
9803
9846
|
const SOURCE_ALIAS = "#/*";
|
|
9804
9847
|
const SOURCE_TARGET = "./src/*";
|
|
9805
9848
|
const SOURCE_PREFIX = /^\.\/src(?:\/|$)/u;
|
|
9806
9849
|
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.`;
|
|
9807
|
-
const Manifest$
|
|
9808
|
-
const decodeManifest$
|
|
9850
|
+
const Manifest$4 = Schema.Struct({ imports: Schema.optional(Schema.Unknown) });
|
|
9851
|
+
const decodeManifest$8 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$4));
|
|
9809
9852
|
const problemAt$6 = (file, rule, message) => ({
|
|
9810
9853
|
file,
|
|
9811
|
-
line: FIRST$
|
|
9812
|
-
column: FIRST$
|
|
9854
|
+
line: FIRST$14,
|
|
9855
|
+
column: FIRST$14,
|
|
9813
9856
|
rule,
|
|
9814
9857
|
message
|
|
9815
9858
|
});
|
|
@@ -9823,13 +9866,13 @@ const aliasProblems = Effect.fn("aliasProblems")(function* aliasProblems(root, w
|
|
|
9823
9866
|
const files = yield* RepositoryFiles;
|
|
9824
9867
|
const manifest = files.join(root, workspace, MANIFEST_FILE$3);
|
|
9825
9868
|
const text = yield* files.readFile(manifest);
|
|
9826
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
9869
|
+
return pipe(text, Option.flatMap(decodeManifest$8), 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}`)));
|
|
9827
9870
|
});
|
|
9828
9871
|
/** @internal */
|
|
9829
9872
|
const checkSourceAliases = Effect.fn("checkSourceAliases")(function* checkSourceAliases(root) {
|
|
9830
9873
|
const workspaces = yield* memberWorkspaces(root);
|
|
9831
|
-
const
|
|
9832
|
-
return Array.flatten
|
|
9874
|
+
const found = yield* Effect.forEach(workspaces, (workspace) => Effect.all([aliasProblems(root, workspace), shadcnAliasProblems(root, workspace)], { concurrency: 1 }), { concurrency: 1 });
|
|
9875
|
+
return pipe(found, Array.flatten, Array.flatten);
|
|
9833
9876
|
});
|
|
9834
9877
|
// src/features/check-placement/model/placement-checks.ts
|
|
9835
9878
|
/** @internal */
|
|
@@ -9856,18 +9899,18 @@ const SCRIPTS_DIRECTORY = "scripts";
|
|
|
9856
9899
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
9857
9900
|
const SEPARATOR$13 = "/";
|
|
9858
9901
|
const CURRENT = "./";
|
|
9859
|
-
const READ_CONCURRENCY$
|
|
9860
|
-
const FIRST$
|
|
9902
|
+
const READ_CONCURRENCY$19 = 8;
|
|
9903
|
+
const FIRST$13 = 1;
|
|
9861
9904
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
9862
9905
|
const COMMAND = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
9863
9906
|
const NOT_COMMAND = /\.(?:test|d|test\.support)\.[cm]?ts$/u;
|
|
9864
|
-
const Manifest$
|
|
9907
|
+
const Manifest$3 = Schema.Struct({
|
|
9865
9908
|
bin: Schema.optional(Schema.Unknown),
|
|
9866
9909
|
main: Schema.optional(Schema.Unknown),
|
|
9867
9910
|
exports: Schema.optional(Schema.Unknown)
|
|
9868
9911
|
});
|
|
9869
9912
|
const TargetMap = Schema.Record(Schema.String, Schema.Unknown);
|
|
9870
|
-
const decodeManifest$
|
|
9913
|
+
const decodeManifest$7 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$3));
|
|
9871
9914
|
const decodeTarget = Schema.decodeUnknownOption(Schema.String);
|
|
9872
9915
|
const decodeTargetMap = Schema.decodeUnknownOption(TargetMap);
|
|
9873
9916
|
const NO_ENTRIES = {
|
|
@@ -9894,7 +9937,7 @@ const entriesOf$2 = (manifest) => {
|
|
|
9894
9937
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
9895
9938
|
const files = yield* RepositoryFiles;
|
|
9896
9939
|
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
9897
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
9940
|
+
return pipe(text, Option.flatMap(decodeManifest$7), Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
9898
9941
|
});
|
|
9899
9942
|
const isCommand$1 = (path) => COMMAND.test(path) && !NOT_COMMAND.test(path);
|
|
9900
9943
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -9906,7 +9949,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
9906
9949
|
const files = yield* RepositoryFiles;
|
|
9907
9950
|
const listed = yield* files.listedFiles(root);
|
|
9908
9951
|
const workflows = pipe(listed, Array.filter(String$1.startsWith(WORKFLOW_DIRECTORY$1)));
|
|
9909
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
9952
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$19 });
|
|
9910
9953
|
return pipe(Array.getSomes(texts), Array.join("\n"));
|
|
9911
9954
|
});
|
|
9912
9955
|
const workspacePath = (directory, path) => pipe([directory, path], Array.filter(String$1.isNonEmpty), Array.join(SEPARATOR$13));
|
|
@@ -9933,8 +9976,8 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
9933
9976
|
const isRun = (path) => Array.contains(runPaths, path) || Array.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
9934
9977
|
const unrun = pipe(commands, Array.filter((path) => !isRun(path)), Array.map((path) => ({
|
|
9935
9978
|
file: files.join(root, directory, path),
|
|
9936
|
-
line: FIRST$
|
|
9937
|
-
column: FIRST$
|
|
9979
|
+
line: FIRST$13,
|
|
9980
|
+
column: FIRST$13,
|
|
9938
9981
|
rule: UNRUN,
|
|
9939
9982
|
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.`
|
|
9940
9983
|
})));
|
|
@@ -9946,8 +9989,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
9946
9989
|
const isDirectory = yield* files.isDirectory(file);
|
|
9947
9990
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
9948
9991
|
file,
|
|
9949
|
-
line: FIRST$
|
|
9950
|
-
column: FIRST$
|
|
9992
|
+
line: FIRST$13,
|
|
9993
|
+
column: FIRST$13,
|
|
9951
9994
|
rule: SCRIPTS,
|
|
9952
9995
|
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.`
|
|
9953
9996
|
})));
|
|
@@ -9956,56 +9999,26 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
9956
9999
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
9957
10000
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
9958
10001
|
const workflows = yield* workflowText(root);
|
|
9959
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$13(root, directory, workflows), { concurrency: READ_CONCURRENCY$
|
|
9960
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10002
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$13(root, directory, workflows), { concurrency: READ_CONCURRENCY$19 });
|
|
10003
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$19 });
|
|
9961
10004
|
return [...Array.flatten(found), ...Array.getSomes(scripts)];
|
|
9962
10005
|
});
|
|
9963
10006
|
// src/features/check-repository-layout/model/crates.ts
|
|
9964
|
-
const RULE$
|
|
10007
|
+
const RULE$33 = "unverified-crate";
|
|
9965
10008
|
const VERSION_RULE = "release-version";
|
|
9966
10009
|
const MANIFEST_FILE$1 = "package.json";
|
|
9967
10010
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
9968
|
-
const CARGO_FILE = "Cargo.toml";
|
|
10011
|
+
const CARGO_FILE$1 = "Cargo.toml";
|
|
9969
10012
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
9970
10013
|
const SEPARATOR$12 = "/";
|
|
9971
|
-
const FIRST$
|
|
9972
|
-
const READ_CONCURRENCY$
|
|
9973
|
-
const CrateEntry = Schema.Struct({
|
|
9974
|
-
name: Schema.String,
|
|
9975
|
-
version: Schema.String,
|
|
9976
|
-
manifest_path: Schema.String
|
|
9977
|
-
});
|
|
10014
|
+
const FIRST$12 = 1;
|
|
10015
|
+
const READ_CONCURRENCY$18 = 8;
|
|
9978
10016
|
const PackageVersion = Schema.fromJsonString(Schema.Struct({ version: Schema.String }));
|
|
9979
|
-
const CrateList = Schema.fromJsonString(Schema.Struct({ packages: Schema.Array(CrateEntry) }));
|
|
9980
|
-
const decodeCrateList = Schema.decodeUnknownEffect(CrateList);
|
|
9981
|
-
const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
9982
|
-
const output = yield* (yield* ChildProcess.make("cargo", [
|
|
9983
|
-
"metadata",
|
|
9984
|
-
"--no-deps",
|
|
9985
|
-
"--format-version",
|
|
9986
|
-
"1",
|
|
9987
|
-
"--offline"
|
|
9988
|
-
], {
|
|
9989
|
-
cwd: root,
|
|
9990
|
-
extendEnv: true,
|
|
9991
|
-
stdin: "ignore"
|
|
9992
|
-
})).stdout.pipe(Stream.decodeText(), Stream.mkString);
|
|
9993
|
-
const list = yield* decodeCrateList(output);
|
|
9994
|
-
return pipe(list.packages, Array.map((crate) => ({
|
|
9995
|
-
name: crate.name,
|
|
9996
|
-
version: crate.version,
|
|
9997
|
-
manifest: crate.manifest_path
|
|
9998
|
-
})));
|
|
9999
|
-
}, Effect.scoped);
|
|
10000
|
-
const owningWorkspace = (directories) => (directory) => {
|
|
10001
|
-
const owners = pipe(directories, Array.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$12}`)(directory)));
|
|
10002
|
-
return Array.last(Array.sort(owners, String$1.Order));
|
|
10003
|
-
};
|
|
10004
10017
|
const problemFor$2 = (crate, message) => ({
|
|
10005
10018
|
file: crate.manifest,
|
|
10006
|
-
line: FIRST$
|
|
10007
|
-
column: FIRST$
|
|
10008
|
-
rule: RULE$
|
|
10019
|
+
line: FIRST$12,
|
|
10020
|
+
column: FIRST$12,
|
|
10021
|
+
rule: RULE$33,
|
|
10009
10022
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
10010
10023
|
});
|
|
10011
10024
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -10025,8 +10038,8 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
10025
10038
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
10026
10039
|
return Option.some({
|
|
10027
10040
|
file: crate.manifest,
|
|
10028
|
-
line: FIRST$
|
|
10029
|
-
column: FIRST$
|
|
10041
|
+
line: FIRST$12,
|
|
10042
|
+
column: FIRST$12,
|
|
10030
10043
|
rule: VERSION_RULE,
|
|
10031
10044
|
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
10045
|
});
|
|
@@ -10034,14 +10047,14 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
10034
10047
|
/** @internal */
|
|
10035
10048
|
const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
10036
10049
|
const files = yield* RepositoryFiles;
|
|
10037
|
-
if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return [];
|
|
10050
|
+
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
10038
10051
|
const directories = yield* workspaceDirectories(root);
|
|
10039
10052
|
const crates = yield* cratesIn(root);
|
|
10040
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
10053
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$2(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$18 });
|
|
10041
10054
|
return Array.getSomes(Array.flatten(found));
|
|
10042
10055
|
});
|
|
10043
10056
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
10044
|
-
const RULE$
|
|
10057
|
+
const RULE$32 = "deploy-entry-pattern";
|
|
10045
10058
|
const FALLOW_KEYS = [
|
|
10046
10059
|
"entry",
|
|
10047
10060
|
"entryPoints",
|
|
@@ -10059,8 +10072,8 @@ const NEGATED = "!";
|
|
|
10059
10072
|
const ROOT_WORKSPACE = ".";
|
|
10060
10073
|
const WRAP_OFFSET$1 = 1;
|
|
10061
10074
|
const NO_OFFSET = 0;
|
|
10062
|
-
const READ_CONCURRENCY$
|
|
10063
|
-
const MESSAGE$
|
|
10075
|
+
const READ_CONCURRENCY$17 = 8;
|
|
10076
|
+
const MESSAGE$10 = "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.";
|
|
10064
10077
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
10065
10078
|
const FALLOW = {
|
|
10066
10079
|
keys: FALLOW_KEYS,
|
|
@@ -10112,8 +10125,8 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
10112
10125
|
return pipe(Array.getSomes(flagged), Array.map(({ text: pattern, start }) => ({
|
|
10113
10126
|
file: path,
|
|
10114
10127
|
...positionOf(text.value)(start - kind.offset),
|
|
10115
|
-
rule: RULE$
|
|
10116
|
-
message: `${pattern} ${MESSAGE$
|
|
10128
|
+
rule: RULE$32,
|
|
10129
|
+
message: `${pattern} ${MESSAGE$10}`
|
|
10117
10130
|
})));
|
|
10118
10131
|
});
|
|
10119
10132
|
/** @internal */
|
|
@@ -10141,11 +10154,11 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
10141
10154
|
kind,
|
|
10142
10155
|
workspaces,
|
|
10143
10156
|
entries
|
|
10144
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10157
|
+
}), { concurrency: READ_CONCURRENCY$17 });
|
|
10145
10158
|
return Array.flatten(found);
|
|
10146
10159
|
});
|
|
10147
10160
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
10148
|
-
const RULE$
|
|
10161
|
+
const RULE$31 = "listed-entry";
|
|
10149
10162
|
const ENTRY_KEYS = [
|
|
10150
10163
|
"entry",
|
|
10151
10164
|
"entryPoints",
|
|
@@ -10155,7 +10168,7 @@ const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?
|
|
|
10155
10168
|
const WILDCARD$3 = /[*?{[]/u;
|
|
10156
10169
|
const SEPARATOR$11 = "/";
|
|
10157
10170
|
const WRAP_OFFSET = 1;
|
|
10158
|
-
const READ_CONCURRENCY$
|
|
10171
|
+
const READ_CONCURRENCY$16 = 8;
|
|
10159
10172
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
10160
10173
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array.contains(ENTRY_KEYS, keyName(key))));
|
|
10161
10174
|
const entryPatternsIn = (node) => {
|
|
@@ -10175,7 +10188,7 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10175
10188
|
return pipe(entryPatternsIn(parsed.program), Array.filter(namesOneFile(directories)), Array.map(({ text: pattern, start }) => ({
|
|
10176
10189
|
file: path,
|
|
10177
10190
|
...positionOf(text.value)(start),
|
|
10178
|
-
rule: RULE$
|
|
10191
|
+
rule: RULE$31,
|
|
10179
10192
|
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.`
|
|
10180
10193
|
})));
|
|
10181
10194
|
});
|
|
@@ -10183,70 +10196,70 @@ const problemsIn$11 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
10183
10196
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
10184
10197
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10185
10198
|
const directories = yield* workspaceDirectories(root);
|
|
10186
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$11(root, file, directories), { concurrency: READ_CONCURRENCY$
|
|
10199
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$11(root, file, directories), { concurrency: READ_CONCURRENCY$16 });
|
|
10187
10200
|
return Array.flatten(found);
|
|
10188
10201
|
});
|
|
10189
|
-
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10190
|
-
const RULE$27 = "hidden-verify";
|
|
10191
|
-
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10192
|
-
const FIRST$10 = 1;
|
|
10193
|
-
const READ_CONCURRENCY$13 = 8;
|
|
10194
|
-
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10195
|
-
const config = yield* workspaceConfigOf(root, directory);
|
|
10196
|
-
if (Option.isNone(config)) return Option.none();
|
|
10197
|
-
const { file, program } = config.value;
|
|
10198
|
-
if (definesTask(VERIFY_TASK)(program)) return Option.none();
|
|
10199
|
-
const verified = yield* hasVerifyTask(file);
|
|
10200
|
-
return Option.some({
|
|
10201
|
-
file,
|
|
10202
|
-
line: FIRST$10,
|
|
10203
|
-
column: FIRST$10,
|
|
10204
|
-
rule: RULE$27,
|
|
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}.`
|
|
10206
|
-
}).pipe(Option.filter(() => verified));
|
|
10207
|
-
});
|
|
10208
|
-
/** @internal */
|
|
10209
|
-
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10210
|
-
const directories = yield* workspaceDirectories(root);
|
|
10211
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$13 });
|
|
10212
|
-
return Array.getSomes(found);
|
|
10213
|
-
});
|
|
10214
10202
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
10215
|
-
const RULE$
|
|
10216
|
-
const CONFIG_FILE$
|
|
10203
|
+
const RULE$30 = "root-workspace-path";
|
|
10204
|
+
const CONFIG_FILE$4 = "vite.config.ts";
|
|
10217
10205
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
10218
10206
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
10219
|
-
const FIRST$
|
|
10207
|
+
const FIRST$11 = 0;
|
|
10220
10208
|
const NEXT$2 = 1;
|
|
10221
10209
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
10222
|
-
const mentions
|
|
10210
|
+
const mentions = (directory) => (text) => {
|
|
10223
10211
|
const parts = String$1.split(text, directory);
|
|
10224
10212
|
return pipe(Array.drop(parts, NEXT$2), Array.some((after, index) => {
|
|
10225
10213
|
const before = parts[index] ?? "";
|
|
10226
10214
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
10227
|
-
const following = String$1.slice(FIRST$
|
|
10215
|
+
const following = String$1.slice(FIRST$11, NEXT$2)(after);
|
|
10228
10216
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
10229
10217
|
}));
|
|
10230
10218
|
};
|
|
10231
|
-
const problemsIn$10 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions
|
|
10219
|
+
const problemsIn$10 = (file, source, directories) => (found) => pipe(directories, Array.filter((directory) => mentions(directory)(found.text)), Array.map((directory) => ({
|
|
10232
10220
|
file,
|
|
10233
10221
|
...positionOf(source)(found.start),
|
|
10234
|
-
rule: RULE$
|
|
10235
|
-
message: `${directory} is a workspace. The root ${CONFIG_FILE$
|
|
10222
|
+
rule: RULE$30,
|
|
10223
|
+
message: `${directory} is a workspace. The root ${CONFIG_FILE$4} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$4}: msch.lint, msch.devDependencies or its verify task.`
|
|
10236
10224
|
})));
|
|
10237
10225
|
/** @internal */
|
|
10238
10226
|
const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* checkRootWorkspacePaths(root) {
|
|
10239
10227
|
const files = yield* RepositoryFiles;
|
|
10240
|
-
const file = files.join(root, CONFIG_FILE$
|
|
10228
|
+
const file = files.join(root, CONFIG_FILE$4);
|
|
10241
10229
|
const source = yield* files.readFile(file);
|
|
10242
10230
|
if (Option.isNone(source)) return [];
|
|
10243
10231
|
const directories = yield* workspaceDirectories(root);
|
|
10244
10232
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
10245
10233
|
return pipe(stringsIn(parsed.program), Array.flatMap(problemsIn$10(file, source.value, directories)));
|
|
10246
10234
|
});
|
|
10235
|
+
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
10236
|
+
const RULE$29 = "hidden-verify";
|
|
10237
|
+
const CONFIG_FILE$3 = "vite.config.ts";
|
|
10238
|
+
const FIRST$10 = 1;
|
|
10239
|
+
const READ_CONCURRENCY$15 = 8;
|
|
10240
|
+
const problemIn$1 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
10241
|
+
const config = yield* workspaceConfigOf(root, directory);
|
|
10242
|
+
if (Option.isNone(config)) return Option.none();
|
|
10243
|
+
const { file, program } = config.value;
|
|
10244
|
+
if (definesTask(VERIFY_TASK)(program)) return Option.none();
|
|
10245
|
+
const verified = yield* hasVerifyTask(file);
|
|
10246
|
+
return Option.some({
|
|
10247
|
+
file,
|
|
10248
|
+
line: FIRST$10,
|
|
10249
|
+
column: FIRST$10,
|
|
10250
|
+
rule: RULE$29,
|
|
10251
|
+
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$3}. The root verify reads ${CONFIG_FILE$3} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$3}.`
|
|
10252
|
+
}).pipe(Option.filter(() => verified));
|
|
10253
|
+
});
|
|
10254
|
+
/** @internal */
|
|
10255
|
+
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
10256
|
+
const directories = yield* workspaceDirectories(root);
|
|
10257
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$1(root, directory), { concurrency: READ_CONCURRENCY$15 });
|
|
10258
|
+
return Array.getSomes(found);
|
|
10259
|
+
});
|
|
10247
10260
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
10248
|
-
const RULE$
|
|
10249
|
-
const READ_CONCURRENCY$
|
|
10261
|
+
const RULE$28 = "shared-uncached-task";
|
|
10262
|
+
const READ_CONCURRENCY$14 = 8;
|
|
10250
10263
|
const SHARED = 2;
|
|
10251
10264
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
10252
10265
|
const UncachedTask = Schema.Struct({
|
|
@@ -10282,21 +10295,53 @@ const definitionsIn = Effect.fn("definitionsIn")(function* definitionsIn(root, d
|
|
|
10282
10295
|
source
|
|
10283
10296
|
})(task))));
|
|
10284
10297
|
});
|
|
10285
|
-
const problemsOf$
|
|
10298
|
+
const problemsOf$3 = (definitions) => {
|
|
10286
10299
|
const directories = pipe(definitions, Array.map(({ directory }) => directory), Array.dedupe);
|
|
10287
10300
|
if (directories.length < SHARED) return [];
|
|
10288
10301
|
return pipe(definitions, Array.map(({ file, position, name, command }) => ({
|
|
10289
10302
|
file,
|
|
10290
10303
|
...position,
|
|
10291
|
-
rule: RULE$
|
|
10304
|
+
rule: RULE$28,
|
|
10292
10305
|
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.`
|
|
10293
10306
|
})));
|
|
10294
10307
|
};
|
|
10295
10308
|
/** @internal */
|
|
10296
10309
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
10297
10310
|
const directories = yield* workspaceDirectories(root);
|
|
10298
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
10299
|
-
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$
|
|
10311
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$14 });
|
|
10312
|
+
return pipe(Array.flatten(found), Array.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array.flatMap(problemsOf$3));
|
|
10313
|
+
});
|
|
10314
|
+
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
10315
|
+
const RULE$27 = "unlocked-task";
|
|
10316
|
+
const READ_CONCURRENCY$13 = 8;
|
|
10317
|
+
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
10318
|
+
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
10319
|
+
const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array.findFirst(Array.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
|
|
10320
|
+
const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Option.flatMap(literalOf), Option.match({
|
|
10321
|
+
onNone: () => Option.isNone(propertyValue("cache")(task.value)),
|
|
10322
|
+
onSome: (cache) => cache !== false
|
|
10323
|
+
}));
|
|
10324
|
+
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array.filter(tracksLockfiles), Array.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
10325
|
+
file,
|
|
10326
|
+
...positionOf(source)(task.start),
|
|
10327
|
+
rule: RULE$27,
|
|
10328
|
+
message: `The task ${keyName(task.key)} runs ${command} with inputs written by hand. It then reruns after every lockfile change, and it does not rerun when a dependency of a dependency moves. Set cache to LOCKED from @r_masseater/msch/locked-inputs.`
|
|
10329
|
+
})), Option.toArray)));
|
|
10330
|
+
/** @internal */
|
|
10331
|
+
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
10332
|
+
const directories = yield* workspaceDirectories(root);
|
|
10333
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$13 });
|
|
10334
|
+
return pipe(Array.getSomes(found), Array.flatMap(problemsOf$2));
|
|
10335
|
+
});
|
|
10336
|
+
// src/features/check-repository-layout/model/task-checks.ts
|
|
10337
|
+
/** @internal */
|
|
10338
|
+
const checkTasks = Effect.fn("checkTasks")(function* checkTasks(root) {
|
|
10339
|
+
const found = yield* Effect.all([
|
|
10340
|
+
checkHiddenVerify(root),
|
|
10341
|
+
checkSharedUncachedTasks(root),
|
|
10342
|
+
checkUnlockedTasks(root)
|
|
10343
|
+
], { concurrency: "unbounded" });
|
|
10344
|
+
return Array.flatten(found);
|
|
10300
10345
|
});
|
|
10301
10346
|
// src/features/check-repository-layout/model/workflow-nodes.ts
|
|
10302
10347
|
const MISSING_OFFSET = 0;
|
|
@@ -10434,13 +10479,13 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
10434
10479
|
/** @internal */
|
|
10435
10480
|
const producedPaths = (source) => pipe(jobsOf(source), Array.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array.flatMap(outputPathsOf));
|
|
10436
10481
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
10437
|
-
const RULE$
|
|
10482
|
+
const RULE$26 = "workflow-path";
|
|
10438
10483
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
10439
10484
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
10440
|
-
const READ_CONCURRENCY$
|
|
10485
|
+
const READ_CONCURRENCY$12 = 8;
|
|
10441
10486
|
const WILDCARD$2 = /[*?[]/u;
|
|
10442
10487
|
const SEPARATOR$9 = "/";
|
|
10443
|
-
const FIRST$
|
|
10488
|
+
const FIRST$9 = 0;
|
|
10444
10489
|
const EXPECTED = {
|
|
10445
10490
|
action: "a directory with action.yml",
|
|
10446
10491
|
directory: "a directory",
|
|
@@ -10481,7 +10526,7 @@ const RESOLVERS = {
|
|
|
10481
10526
|
};
|
|
10482
10527
|
const staticPrefix = (path) => {
|
|
10483
10528
|
const prefix = Array.headNonEmpty(String$1.split(path, WILDCARD$2));
|
|
10484
|
-
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$
|
|
10529
|
+
if (String$1.endsWith(SEPARATOR$9)(prefix)) return String$1.slice(FIRST$9, -1)(prefix);
|
|
10485
10530
|
return prefix;
|
|
10486
10531
|
};
|
|
10487
10532
|
const isIgnored$1 = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
@@ -10500,7 +10545,7 @@ const isMissing = Effect.fn("isMissing")(function* isMissing(root, produced, fou
|
|
|
10500
10545
|
const problemOf$7 = (file, source) => (found) => ({
|
|
10501
10546
|
file,
|
|
10502
10547
|
...positionOf(source)(found.offset),
|
|
10503
|
-
rule: RULE$
|
|
10548
|
+
rule: RULE$26,
|
|
10504
10549
|
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.`
|
|
10505
10550
|
});
|
|
10506
10551
|
const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
@@ -10515,7 +10560,7 @@ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, workflow
|
|
|
10515
10560
|
/** @internal */
|
|
10516
10561
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
10517
10562
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
10518
|
-
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$9(root, workflow), { concurrency: READ_CONCURRENCY$
|
|
10563
|
+
const found = yield* Effect.forEach(pipe(listed, Array.filter(isWorkflow)), (workflow) => problemsIn$9(root, workflow), { concurrency: READ_CONCURRENCY$12 });
|
|
10519
10564
|
return Array.flatten(found);
|
|
10520
10565
|
});
|
|
10521
10566
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -10526,8 +10571,8 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
10526
10571
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
10527
10572
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
10528
10573
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
10529
|
-
const START$
|
|
10530
|
-
const READ_CONCURRENCY$
|
|
10574
|
+
const START$16 = 0;
|
|
10575
|
+
const READ_CONCURRENCY$11 = 8;
|
|
10531
10576
|
const SEPARATOR$8 = "/";
|
|
10532
10577
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
10533
10578
|
const SPACE = " ";
|
|
@@ -10557,7 +10602,7 @@ const namesIn = (name, source) => {
|
|
|
10557
10602
|
return [
|
|
10558
10603
|
{
|
|
10559
10604
|
text: name,
|
|
10560
|
-
offset: START$
|
|
10605
|
+
offset: START$16
|
|
10561
10606
|
},
|
|
10562
10607
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
10563
10608
|
...keysOf$1(childOf("jobs")(root))
|
|
@@ -10607,7 +10652,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
|
|
|
10607
10652
|
name: stem,
|
|
10608
10653
|
source: text
|
|
10609
10654
|
})]), Option.getOrElse(() => []));
|
|
10610
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
10655
|
+
}), { concurrency: READ_CONCURRENCY$11 });
|
|
10611
10656
|
const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
10612
10657
|
return [...Array.flatten(found), ...actions];
|
|
10613
10658
|
});
|
|
@@ -10619,21 +10664,20 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
10619
10664
|
checkCrates(root),
|
|
10620
10665
|
checkDeployEntryPatterns(root),
|
|
10621
10666
|
checkFallowEntries(root),
|
|
10622
|
-
checkHiddenVerify(root),
|
|
10623
10667
|
checkRootWorkspacePaths(root),
|
|
10624
|
-
|
|
10668
|
+
checkTasks(root),
|
|
10625
10669
|
checkWorkflowPaths(root),
|
|
10626
10670
|
checkWorkflowScale(root)
|
|
10627
10671
|
], { concurrency: "unbounded" });
|
|
10628
10672
|
return Array.flatten(found);
|
|
10629
10673
|
});
|
|
10630
10674
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
10631
|
-
const RULE$
|
|
10675
|
+
const RULE$25 = "legacy-typescript";
|
|
10632
10676
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
10633
10677
|
const COMPILER = "typescript";
|
|
10634
10678
|
const CURRENT_MAJOR = 7;
|
|
10635
10679
|
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
10636
|
-
const FIRST$
|
|
10680
|
+
const FIRST$8 = 1;
|
|
10637
10681
|
const legacyOf = (id) => {
|
|
10638
10682
|
const { name, version } = parse$1(id);
|
|
10639
10683
|
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
@@ -10644,8 +10688,8 @@ const legacyOf = (id) => {
|
|
|
10644
10688
|
};
|
|
10645
10689
|
const dependentsOf = (nodes) => (id) => pipe(nodes, Array.filter(({ dependencies }) => Array.contains(dependencies, id)), Array.map((node) => `\`${node.id}\``));
|
|
10646
10690
|
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
10647
|
-
onNone: () => FIRST$
|
|
10648
|
-
onSome: (index) => index + FIRST$
|
|
10691
|
+
onNone: () => FIRST$8,
|
|
10692
|
+
onSome: (index) => index + FIRST$8
|
|
10649
10693
|
}));
|
|
10650
10694
|
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)}.`;
|
|
10651
10695
|
/** @internal */
|
|
@@ -10658,396 +10702,17 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
10658
10702
|
return pipe(Option.getOrElse(nodes, () => []), Array.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array.map((legacy) => ({
|
|
10659
10703
|
file,
|
|
10660
10704
|
line: lineOf$2(source)(legacy.id),
|
|
10661
|
-
column: FIRST$
|
|
10662
|
-
rule: RULE$
|
|
10705
|
+
column: FIRST$8,
|
|
10706
|
+
rule: RULE$25,
|
|
10663
10707
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
10664
10708
|
})));
|
|
10665
10709
|
});
|
|
10666
|
-
// src/shared/lib/values.ts
|
|
10667
|
-
const SCHEMA_TYPE_PROPERTIES = ["Type", "_output"];
|
|
10668
|
-
const MINIMUM_SET_SIZE = 2;
|
|
10669
|
-
const DATA_FIRST_ARITY = 2;
|
|
10670
|
-
const valueKey = (value) => `${typeof value}:${String(value)}`;
|
|
10671
|
-
const literalValueOf = (type) => {
|
|
10672
|
-
if (type.isStringLiteralType() || type.isNumberLiteralType()) return Option.some(type.value);
|
|
10673
|
-
return Option.none();
|
|
10674
|
-
};
|
|
10675
|
-
const literalValuesOf = (types) => {
|
|
10676
|
-
const values = pipe(types, Array.map((member) => literalValueOf(member)), Array.getSomes, Array.dedupeWith((left, right) => valueKey(left) === valueKey(right)));
|
|
10677
|
-
if (values.length !== types.length || values.length < MINIMUM_SET_SIZE) return Option.none();
|
|
10678
|
-
return Option.some(values);
|
|
10679
|
-
};
|
|
10680
|
-
const literalUnionOf = (type) => {
|
|
10681
|
-
if (!type.isUnionType()) return Option.none();
|
|
10682
|
-
return literalValuesOf(type.getTypes());
|
|
10683
|
-
};
|
|
10684
|
-
const elementTypeOf = (checker, type) => {
|
|
10685
|
-
if (!checker.isArrayLikeType(type)) return Option.none();
|
|
10686
|
-
return Option.fromUndefinedOr(checker.getIndexTypeOfType(type, IndexKind.Number));
|
|
10687
|
-
};
|
|
10688
|
-
const schemaTypeOf = (checker) => (type) => Array.findFirst(SCHEMA_TYPE_PROPERTIES, (name) => Option.fromUndefinedOr(checker.getPropertyOfType(type, name))).pipe(Option.map((property) => checker.getTypeOfSymbol(property)));
|
|
10689
|
-
const finiteValuesOf = (checker) => (type) => literalUnionOf(type).pipe(Option.orElse(() => elementTypeOf(checker, type).pipe(Option.flatMap(literalUnionOf))), Option.orElse(() => schemaTypeOf(checker)(type).pipe(Option.flatMap(literalUnionOf))));
|
|
10690
|
-
const vocabularyOf = (checker) => (type) => {
|
|
10691
|
-
if (!type.isUnionType()) return Option.none();
|
|
10692
|
-
const optionalIds = /* @__PURE__ */ new Set([checker.getUndefinedType().id, checker.getNullType().id]);
|
|
10693
|
-
const members = pipe(type.getTypes(), Array.filter((member) => !optionalIds.has(member.id)));
|
|
10694
|
-
const values = Array.getSomes(pipe(members, Array.map((member) => literalValueOf(member))));
|
|
10695
|
-
if (values.length < MINIMUM_SET_SIZE) return Option.none();
|
|
10696
|
-
return Option.some({
|
|
10697
|
-
values,
|
|
10698
|
-
admitsUnnamedValues: values.length !== members.length
|
|
10699
|
-
});
|
|
10700
|
-
};
|
|
10701
|
-
const isSubsetOf = Function.dual(DATA_FIRST_ARITY, (subset, superset) => {
|
|
10702
|
-
const held = new Set(pipe(superset, Array.map((value) => valueKey(value))));
|
|
10703
|
-
return pipe(subset, Array.every((value) => held.has(valueKey(value))));
|
|
10704
|
-
});
|
|
10705
|
-
const sameValues = Function.dual(DATA_FIRST_ARITY, (left, right) => left.length === right.length && isSubsetOf(left, right));
|
|
10706
|
-
const valueText = (value) => {
|
|
10707
|
-
if (typeof value === "string") return `"${value}"`;
|
|
10708
|
-
return String(value);
|
|
10709
|
-
};
|
|
10710
|
-
const formatValues = (values) => pipe(values, Array.map(valueText), Array.join(" | "));
|
|
10711
|
-
// src/entities/project/model/library.ts
|
|
10712
|
-
const NAMESPACE_DEPTH_LIMIT = 8;
|
|
10713
|
-
const EMPTY_INDEX = {
|
|
10714
|
-
vocabularies: [],
|
|
10715
|
-
shapes: []
|
|
10716
|
-
};
|
|
10717
|
-
const isObjectType = (checker) => (type) => !type.isUnionType() && !type.isLiteralType() && checker.getApparentType(type).id === type.id && Array.isReadonlyArrayNonEmpty(checker.getPropertiesOfType(type));
|
|
10718
|
-
const describeLibraryType = (type) => `${type.typeName} from ${type.specifier}`;
|
|
10719
|
-
const locationOf = (declaration) => ({
|
|
10720
|
-
file: declaration.getSourceFile().fileName,
|
|
10721
|
-
pos: declaration.pos,
|
|
10722
|
-
kind: declaration.kind
|
|
10723
|
-
});
|
|
10724
|
-
const declarationKey = (location) => `${location.file}#${String(location.pos)}#${String(location.kind)}`;
|
|
10725
|
-
const shapeOf = (checker) => (source, declaration, type) => Array.filter([{
|
|
10726
|
-
...source,
|
|
10727
|
-
declaration: locationOf(declaration),
|
|
10728
|
-
propertyNames: propertyNamesOf(checker)(type)
|
|
10729
|
-
}], () => isObjectType(checker)(type));
|
|
10730
|
-
const declaredTypeIndex = (walk, exported) => {
|
|
10731
|
-
const declaration = Array.findFirst(declarationsOf(exported.symbol), isTypeDeclaration);
|
|
10732
|
-
if (Option.isNone(declaration) || isGenericDeclaration(declaration.value)) return EMPTY_INDEX;
|
|
10733
|
-
const located = {
|
|
10734
|
-
specifier: walk.entry.specifier,
|
|
10735
|
-
typeName: exported.typeName
|
|
10736
|
-
};
|
|
10737
|
-
const type = walk.checker.getDeclaredTypeOfSymbol(exported.symbol);
|
|
10738
|
-
return {
|
|
10739
|
-
vocabularies: vocabularyOf(walk.checker)(type).pipe(Option.map((vocabulary) => ({
|
|
10740
|
-
...located,
|
|
10741
|
-
vocabulary
|
|
10742
|
-
})), Option.toArray),
|
|
10743
|
-
shapes: shapeOf(walk.checker)({
|
|
10744
|
-
...located,
|
|
10745
|
-
form: "declared"
|
|
10746
|
-
}, declaration.value, type)
|
|
10747
|
-
};
|
|
10748
|
-
};
|
|
10749
|
-
const schemaTypeIndex = (walk, located) => (declaration, schemaType) => ({
|
|
10750
|
-
vocabularies: vocabularyOf(walk.checker)(schemaType).pipe(Option.map((vocabulary) => ({
|
|
10751
|
-
...located,
|
|
10752
|
-
vocabulary
|
|
10753
|
-
})), Option.toArray),
|
|
10754
|
-
shapes: shapeOf(walk.checker)({
|
|
10755
|
-
...located,
|
|
10756
|
-
form: "schema"
|
|
10757
|
-
}, declaration, schemaType)
|
|
10758
|
-
});
|
|
10759
|
-
const schemaValueIndex = (walk, exported) => {
|
|
10760
|
-
const declaration = Array.findFirst(declarationsOf(exported.symbol), isVariableDeclaration);
|
|
10761
|
-
if (Option.isNone(declaration)) return EMPTY_INDEX;
|
|
10762
|
-
const valueType = walk.checker.getTypeOfSymbolAtLocation(exported.symbol, declaration.value);
|
|
10763
|
-
const located = {
|
|
10764
|
-
specifier: walk.entry.specifier,
|
|
10765
|
-
typeName: `(typeof ${exported.typeName})["Type"]`
|
|
10766
|
-
};
|
|
10767
|
-
return Option.match(schemaTypeOf(walk.checker)(valueType), {
|
|
10768
|
-
onNone: () => EMPTY_INDEX,
|
|
10769
|
-
onSome: (schemaType) => schemaTypeIndex(walk, located)(declaration.value, schemaType)
|
|
10770
|
-
});
|
|
10771
|
-
};
|
|
10772
|
-
const mergeIndexes = (indexes) => ({
|
|
10773
|
-
vocabularies: pipe(indexes, Array.flatMap((index) => index.vocabularies)),
|
|
10774
|
-
shapes: pipe(indexes, Array.flatMap((index) => index.shapes))
|
|
10775
|
-
});
|
|
10776
|
-
const isNamespace = (symbol) => pipe(declarationsOf(symbol), Array.some((declaration) => isModuleDeclaration(declaration)));
|
|
10777
|
-
const indexUnder = (walk, visit) => {
|
|
10778
|
-
const symbol = resolvedSymbol(walk.checker)(visit.exported);
|
|
10779
|
-
const named = {
|
|
10780
|
-
symbol,
|
|
10781
|
-
typeName: `${visit.qualifier}${visit.exported.name}`
|
|
10782
|
-
};
|
|
10783
|
-
const own = mergeIndexes([declaredTypeIndex(walk, named), schemaValueIndex(walk, named)]);
|
|
10784
|
-
if (!isNamespace(symbol) || visit.ancestors.length >= NAMESPACE_DEPTH_LIMIT || visit.ancestors.includes(symbol)) return own;
|
|
10785
|
-
const nested = pipe(walk.checker.getExportsOfModule(symbol), Array.map((member) => indexUnder(walk, {
|
|
10786
|
-
exported: member,
|
|
10787
|
-
qualifier: `${named.typeName}.`,
|
|
10788
|
-
ancestors: [...visit.ancestors, symbol]
|
|
10789
|
-
})));
|
|
10790
|
-
return mergeIndexes([own, ...nested]);
|
|
10791
|
-
};
|
|
10792
|
-
const exportAssignmentOf = (moduleSymbol) => Option.fromUndefinedOr(moduleSymbol.getExports().get(InternalSymbolName.ExportEquals));
|
|
10793
|
-
const indexOfEntry = (checker) => (entry) => {
|
|
10794
|
-
const moduleSymbol = Option.fromUndefinedOr(checker.getSymbolOfSourceFile(entry.declarationsPath));
|
|
10795
|
-
if (Option.isNone(moduleSymbol)) return EMPTY_INDEX;
|
|
10796
|
-
const walk = {
|
|
10797
|
-
checker,
|
|
10798
|
-
entry
|
|
10799
|
-
};
|
|
10800
|
-
const roots = Option.match(exportAssignmentOf(moduleSymbol.value), {
|
|
10801
|
-
onNone: () => checker.getExportsOfModule(moduleSymbol.value),
|
|
10802
|
-
onSome: (assigned) => [resolvedSymbol(checker)(assigned)]
|
|
10803
|
-
});
|
|
10804
|
-
return mergeIndexes(pipe(roots, Array.map((exported) => indexUnder(walk, {
|
|
10805
|
-
exported,
|
|
10806
|
-
qualifier: "",
|
|
10807
|
-
ancestors: []
|
|
10808
|
-
}))));
|
|
10809
|
-
};
|
|
10810
|
-
const libraryCache = () => {
|
|
10811
|
-
const indexes = /* @__PURE__ */ new Map();
|
|
10812
|
-
return { indexOf: (entry, compute) => Option.match(Option.fromUndefinedOr(indexes.get(entry.declarationsPath)), {
|
|
10813
|
-
onSome: (index) => ({
|
|
10814
|
-
index,
|
|
10815
|
-
cached: true
|
|
10816
|
-
}),
|
|
10817
|
-
onNone: () => {
|
|
10818
|
-
const index = compute();
|
|
10819
|
-
indexes.set(entry.declarationsPath, index);
|
|
10820
|
-
return {
|
|
10821
|
-
index,
|
|
10822
|
-
cached: false
|
|
10823
|
-
};
|
|
10824
|
-
}
|
|
10825
|
-
}) };
|
|
10826
|
-
};
|
|
10827
|
-
const indexEntry = (cache) => (checker) => (entry) => Effect.sync(() => cache.indexOf(entry, () => indexOfEntry(checker)(entry))).pipe(Effect.tap(({ index, cached }) => Effect.annotateCurrentSpan({
|
|
10828
|
-
"msch.library.cached": cached,
|
|
10829
|
-
"msch.library.vocabularies": index.vocabularies.length,
|
|
10830
|
-
"msch.library.shapes": index.shapes.length
|
|
10831
|
-
})), Effect.map(({ index }) => index), Effect.withSpan("indexLibraryEntry", { attributes: { "msch.library.specifier": entry.specifier } }));
|
|
10832
|
-
const libraryIndex = (cache) => (checker) => (entries) => pipe(entries, (items) => Effect.forEach(items, indexEntry(cache)(checker), { concurrency: 1 }), Effect.map(mergeIndexes), Effect.withSpan("libraryIndex"));
|
|
10833
|
-
// src/entities/project/model/telemetry.ts
|
|
10834
|
-
const RSS_LINE = /^VmRSS:\s+(?<kib>\d+) kB$/mu;
|
|
10835
|
-
const BYTES_PER_KIB = 1024;
|
|
10836
|
-
const UNKNOWN_RSS = 0;
|
|
10837
|
-
const kibibytesIn = (status) => Option.fromNullishOr(RSS_LINE.exec(status)).pipe(Option.flatMap((match) => Option.fromUndefinedOr(match.groups)), Option.flatMap((groups) => Option.fromUndefinedOr(groups["kib"])));
|
|
10838
|
-
const residentBytesOf = (pid) => Effect.gen(function* residentBytes() {
|
|
10839
|
-
const status = yield* (yield* RepositoryFiles).readFile(`/proc/${pid}/status`);
|
|
10840
|
-
return pipe(status, Option.flatMap(kibibytesIn), Option.flatMap(Number$1.parse), Option.map((kib) => kib * BYTES_PER_KIB), Option.getOrElse(() => UNKNOWN_RSS));
|
|
10841
|
-
});
|
|
10842
|
-
const childPids = Effect.gen(function* childPids() {
|
|
10843
|
-
const files = yield* RepositoryFiles;
|
|
10844
|
-
const pid = String(process.pid);
|
|
10845
|
-
const children = yield* files.readFile(`/proc/${pid}/task/${pid}/children`);
|
|
10846
|
-
return pipe(children, Option.map((text) => pipe(String$1.trim(text), String$1.split(" "), Array.filter(String$1.isNonEmpty))), Option.getOrElse(() => []));
|
|
10847
|
-
});
|
|
10848
|
-
const annotateMemory = Effect.gen(function* annotateMemory() {
|
|
10849
|
-
const own = yield* residentBytesOf(String(process.pid));
|
|
10850
|
-
const pids = yield* childPids;
|
|
10851
|
-
const children = yield* Effect.forEach(pids, (pid) => residentBytesOf(pid), { concurrency: 1 });
|
|
10852
|
-
const { heapUsed } = process.memoryUsage();
|
|
10853
|
-
yield* Effect.annotateCurrentSpan({
|
|
10854
|
-
"process.memory.rss": own,
|
|
10855
|
-
"process.memory.heap_used": heapUsed,
|
|
10856
|
-
"msch.compiler.memory.rss": Number$1.sumAll(children)
|
|
10857
|
-
});
|
|
10858
|
-
});
|
|
10859
|
-
const annotateResources = (api) => Effect.gen(function* annotateCompiler() {
|
|
10860
|
-
yield* annotateMemory;
|
|
10861
|
-
const { totals } = api.getTimingInfo();
|
|
10862
|
-
yield* Effect.annotateCurrentSpan({
|
|
10863
|
-
"msch.compiler.requests": totals.requestCount,
|
|
10864
|
-
"msch.compiler.round_trip_ms": totals.roundTripMs,
|
|
10865
|
-
"msch.compiler.server_ms": totals.serverTimeMs
|
|
10866
|
-
});
|
|
10867
|
-
});
|
|
10868
|
-
// src/entities/project/model/project.ts
|
|
10869
|
-
const CONFIG_PATHSPEC = `:(glob)**/tsconfig.json`;
|
|
10870
|
-
const HIDDEN_PREFIX$1 = ".";
|
|
10871
|
-
const SKIPPED_DIRECTORIES = /* @__PURE__ */ new Set([
|
|
10872
|
-
NODE_MODULES,
|
|
10873
|
-
"dist",
|
|
10874
|
-
"coverage"
|
|
10875
|
-
]);
|
|
10876
|
-
const isVisible = (file) => pipe(String$1.split(file, "/"), Array.every((segment) => !String$1.startsWith(HIDDEN_PREFIX$1)(segment) && !SKIPPED_DIRECTORIES.has(segment)));
|
|
10877
|
-
const listConfigFiles = (root) => Effect.gen(function* configFilesUnder() {
|
|
10878
|
-
const files = yield* RepositoryFiles;
|
|
10879
|
-
const listed = yield* files.matchingFiles(root, [CONFIG_PATHSPEC]);
|
|
10880
|
-
const visible = pipe(listed, Array.filter(isVisible), Array.map((file) => files.join(root, file)));
|
|
10881
|
-
return Array.sort(visible, Order.String);
|
|
10882
|
-
});
|
|
10883
|
-
const parseConfig = (api) => (configPath) => Option.some(api.parseConfigFile(configPath)).pipe(Option.filter((parsed) => Array.isReadonlyArrayNonEmpty(parsed.fileNames)));
|
|
10884
|
-
const nearestPackageDirectory = (directory, root) => Effect.gen(function* nearestPackage() {
|
|
10885
|
-
const files = yield* RepositoryFiles;
|
|
10886
|
-
const hasManifest = yield* files.exists(files.join(directory, MANIFEST_FILE$3));
|
|
10887
|
-
const parent = files.dirname(directory);
|
|
10888
|
-
if (hasManifest || directory === root || parent === directory) return directory;
|
|
10889
|
-
return yield* nearestPackageDirectory(parent, root);
|
|
10890
|
-
});
|
|
10891
|
-
const packageDirectoryOf = (root) => (directory) => nearestPackageDirectory(directory, root);
|
|
10892
|
-
const packageInfoOf = Effect.fn("packageInfoOf")(function* packageInfoOf(configPath, root) {
|
|
10893
|
-
const files = yield* RepositoryFiles;
|
|
10894
|
-
const directory = yield* nearestPackageDirectory(files.dirname(configPath), root);
|
|
10895
|
-
const manifest = yield* readManifest(directory);
|
|
10896
|
-
return {
|
|
10897
|
-
directory,
|
|
10898
|
-
name: manifest.pipe(Option.flatMap((found) => Option.fromUndefinedOr(found.name))),
|
|
10899
|
-
workspaceDependencies: manifest.pipe(Option.map(workspaceDependencies), Option.getOrElse(() => []))
|
|
10900
|
-
};
|
|
10901
|
-
});
|
|
10902
|
-
const NO_CHECK_PRAGMA = /^\/\/\s*@ts-nocheck/u;
|
|
10903
|
-
const FILE_START = 0;
|
|
10904
|
-
const skipsTypeChecking = (sourceFile) => pipe(getLeadingCommentRanges(sourceFile.text, FILE_START) ?? [], Array.some((range) => NO_CHECK_PRAGMA.test(String$1.slice(range.pos, range.end)(sourceFile.text))));
|
|
10905
|
-
const buildProject = Effect.fn("buildProject")(function* buildProject({ compiler: { api, libraries }, generated }, parsed, info) {
|
|
10906
|
-
const entries = yield* dependencyEntries(info.directory);
|
|
10907
|
-
const program = yield* Effect.sync(() => api.createProgram([...parsed.fileNames, ...pipe(entries, Array.map((entry) => entry.declarationsPath))], {
|
|
10908
|
-
...parsed.options,
|
|
10909
|
-
noEmit: true
|
|
10910
|
-
})).pipe(Effect.withSpan("createProgram"));
|
|
10911
|
-
const { checker } = program.getProject();
|
|
10912
|
-
const library = yield* libraryIndex(libraries)(checker)(entries);
|
|
10913
|
-
const projectFiles = new Set(pipe(parsed.fileNames, Array.filter((fileName) => !generated.includes(fileName))));
|
|
10914
|
-
return {
|
|
10915
|
-
packageName: info.name,
|
|
10916
|
-
workspaceDependencies: info.workspaceDependencies,
|
|
10917
|
-
program,
|
|
10918
|
-
checker,
|
|
10919
|
-
sourceFiles: pipe(program.getSourceFileNames(), Array.filter((fileName) => projectFiles.has(fileName)), Array.flatMap((fileName) => Option.toArray(Option.fromUndefinedOr(program.getSourceFile(fileName)))), Array.filter((sourceFile) => !sourceFile.isDeclarationFile && !skipsTypeChecking(sourceFile))),
|
|
10920
|
-
library
|
|
10921
|
-
};
|
|
10922
|
-
});
|
|
10923
|
-
const typeScriptCompiler = Effect.acquireRelease(Effect.sync(() => ({
|
|
10924
|
-
api: new API({ collectTiming: true }),
|
|
10925
|
-
libraries: libraryCache()
|
|
10926
|
-
})), ({ api }) => Effect.sync(() => {
|
|
10927
|
-
api.close();
|
|
10928
|
-
}));
|
|
10929
|
-
const loadProject = Effect.fn("loadProject")(function* loadProject(workspace, configPath) {
|
|
10930
|
-
const { compiler, root } = workspace;
|
|
10931
|
-
const parsed = parseConfig(compiler.api)(configPath);
|
|
10932
|
-
if (Option.isNone(parsed)) return Option.none();
|
|
10933
|
-
const info = yield* packageInfoOf(configPath, root);
|
|
10934
|
-
const project = yield* buildProject(workspace, parsed.value, info);
|
|
10935
|
-
yield* Effect.annotateCurrentSpan({
|
|
10936
|
-
"msch.project.config": configPath,
|
|
10937
|
-
"msch.project.program_files": project.program.getSourceFileNames().length,
|
|
10938
|
-
"msch.project.source_files": project.sourceFiles.length
|
|
10939
|
-
});
|
|
10940
|
-
yield* annotateResources(compiler.api);
|
|
10941
|
-
return Option.some(project);
|
|
10942
|
-
});
|
|
10943
|
-
const releaseProject = (project) => Effect.sync(() => {
|
|
10944
|
-
project.program.dispose();
|
|
10945
|
-
});
|
|
10946
|
-
const withProject = (workspace) => (configPath) => (work) => Effect.acquireUseRelease(loadProject(workspace, configPath), (loaded) => Option.match(loaded, {
|
|
10947
|
-
onNone: () => Effect.succeedNone,
|
|
10948
|
-
onSome: (project) => work(project).pipe(Effect.asSome)
|
|
10949
|
-
}), (loaded) => Option.match(loaded, {
|
|
10950
|
-
onNone: () => Effect.void,
|
|
10951
|
-
onSome: releaseProject
|
|
10952
|
-
}));
|
|
10953
|
-
const mentions = (needle) => ({ api }) => (configPath) => Effect.gen(function* mentionsNeedle() {
|
|
10954
|
-
const files = yield* RepositoryFiles;
|
|
10955
|
-
const fileNames = Option.match(parseConfig(api)(configPath), {
|
|
10956
|
-
onNone: () => [],
|
|
10957
|
-
onSome: (parsed) => parsed.fileNames
|
|
10958
|
-
});
|
|
10959
|
-
const texts = yield* Effect.forEach(fileNames, (fileName) => files.readFile(fileName), { concurrency: 1 });
|
|
10960
|
-
const includesNeedle = String$1.includes(needle);
|
|
10961
|
-
return pipe(texts, Array.some((text) => Option.exists(text, includesNeedle)));
|
|
10962
|
-
});
|
|
10963
|
-
// src/entities/project/model/inputs.ts
|
|
10964
|
-
const SEPARATOR$7 = "/";
|
|
10965
|
-
const SCOPE_PREFIX = "@";
|
|
10966
|
-
const HIDDEN_PREFIX = ".";
|
|
10967
|
-
const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
10968
|
-
const nearestManifestDirectory = Effect.fn("nearestManifestDirectory")(function* nearestManifestDirectory(start) {
|
|
10969
|
-
const files = yield* RepositoryFiles;
|
|
10970
|
-
let directory = start;
|
|
10971
|
-
let parent = files.dirname(directory);
|
|
10972
|
-
while (parent !== directory && !(yield* files.exists(files.join(directory, "package.json")))) {
|
|
10973
|
-
directory = parent;
|
|
10974
|
-
parent = files.dirname(directory);
|
|
10975
|
-
}
|
|
10976
|
-
return directory;
|
|
10977
|
-
});
|
|
10978
|
-
const dependenciesOf = Effect.fn("dependenciesOf")(function* dependenciesOf(directory) {
|
|
10979
|
-
const files = yield* RepositoryFiles;
|
|
10980
|
-
const manifest = yield* readManifest(directory);
|
|
10981
|
-
const names = Option.match(manifest, {
|
|
10982
|
-
onNone: () => [],
|
|
10983
|
-
onSome: workspaceDependencies
|
|
10984
|
-
});
|
|
10985
|
-
return yield* Effect.forEach(names, (name) => files.realPath(files.join(directory, NODE_MODULES, name)), { concurrency: 1 });
|
|
10986
|
-
});
|
|
10987
|
-
const workspaceClosure = Effect.fn("workspaceClosure")(function* workspaceClosure(start) {
|
|
10988
|
-
const seen = /* @__PURE__ */ new Set([start]);
|
|
10989
|
-
const queue = [start];
|
|
10990
|
-
for (const directory of queue) {
|
|
10991
|
-
const next = yield* dependenciesOf(directory);
|
|
10992
|
-
for (const dependency of next) if (!seen.has(dependency)) {
|
|
10993
|
-
seen.add(dependency);
|
|
10994
|
-
queue.push(dependency);
|
|
10995
|
-
}
|
|
10996
|
-
}
|
|
10997
|
-
return [...seen];
|
|
10998
|
-
});
|
|
10999
|
-
const isUnder = (prefixes) => (file) => pipe(prefixes, Array.some((prefix) => String$1.startsWith(prefix)(file)));
|
|
11000
|
-
const closureOf$1 = Effect.fn("closureOf")(function* closureOf(root, configPath) {
|
|
11001
|
-
const files = yield* RepositoryFiles;
|
|
11002
|
-
const directory = yield* packageDirectoryOf(root)(files.dirname(configPath));
|
|
11003
|
-
const directories = yield* workspaceClosure(directory);
|
|
11004
|
-
return {
|
|
11005
|
-
directories,
|
|
11006
|
-
prefixes: pipe(directories, Array.map((found) => `${files.relative(root, found)}${SEPARATOR$7}`))
|
|
11007
|
-
};
|
|
11008
|
-
});
|
|
11009
|
-
const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
|
|
11010
|
-
const files = yield* RepositoryFiles;
|
|
11011
|
-
if (!String$1.startsWith(SCOPE_PREFIX)(name)) return [name];
|
|
11012
|
-
const scoped = yield* files.readDirectory(files.join(modules, name));
|
|
11013
|
-
return pipe(scoped, Array.map((entry) => `${name}${SEPARATOR$7}${entry}`));
|
|
11014
|
-
});
|
|
11015
|
-
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
11016
|
-
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
11017
|
-
const nested = yield* pipe(listed, Array.filter((name) => !String$1.startsWith(HIDDEN_PREFIX)(name)), (items) => Effect.forEach(items, scopedNames(modules), { concurrency: 1 }));
|
|
11018
|
-
return Array.flatten(nested);
|
|
11019
|
-
});
|
|
11020
|
-
const installedPackages = Effect.fn("installedPackages")(function* installedPackages(root, directory) {
|
|
11021
|
-
const files = yield* RepositoryFiles;
|
|
11022
|
-
const modules = files.join(directory, NODE_MODULES);
|
|
11023
|
-
const names = yield* installedNames$1(modules);
|
|
11024
|
-
return yield* Effect.forEach(names, (name) => files.realPath(files.join(modules, name)).pipe(Effect.map((found) => files.relative(root, found))), { concurrency: 1 });
|
|
11025
|
-
});
|
|
11026
|
-
const dependencyVersions = Effect.fn("dependencyVersions")(function* dependencyVersions(root, directories) {
|
|
11027
|
-
const installed = yield* Effect.forEach(Array.dedupe([root, ...directories]), (directory) => installedPackages(root, directory), { concurrency: 1 });
|
|
11028
|
-
return Array.sort(Array.dedupe(Array.flatten(installed)), Order.String);
|
|
11029
|
-
});
|
|
11030
|
-
const projectInputs = ({ workspace: { compiler, root }, listed }) => (configPath) => Effect.gen(function* collectInputs() {
|
|
11031
|
-
const files = yield* RepositoryFiles;
|
|
11032
|
-
const parsed = parseConfig(compiler.api)(configPath);
|
|
11033
|
-
if (Option.isNone(parsed)) return Option.none();
|
|
11034
|
-
const closure = yield* closureOf$1(root, configPath);
|
|
11035
|
-
const dependencies = yield* dependencyVersions(root, closure.directories);
|
|
11036
|
-
const options = yield* encodeOptions(parsed.value.options).pipe(Effect.orElseSucceed(() => ""));
|
|
11037
|
-
const sources = pipe(parsed.value.fileNames, Array.map((fileName) => files.relative(root, fileName)));
|
|
11038
|
-
const shared = pipe(listed, Array.filter(isUnder(closure.prefixes)));
|
|
11039
|
-
return Option.some({
|
|
11040
|
-
options,
|
|
11041
|
-
files: Array.sort(Array.dedupe([...sources, ...shared]), Order.String),
|
|
11042
|
-
dependencies
|
|
11043
|
-
});
|
|
11044
|
-
});
|
|
11045
10710
|
// src/features/measure-install-size/model/import-graph.ts
|
|
11046
10711
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
11047
10712
|
const SUBPATH_IMPORT = "#";
|
|
11048
10713
|
const WILDCARD$1 = "*";
|
|
11049
10714
|
const SCOPE$2 = "@";
|
|
11050
|
-
const SEPARATOR$
|
|
10715
|
+
const SEPARATOR$7 = "/";
|
|
11051
10716
|
const SOURCE_SUFFIXES = [
|
|
11052
10717
|
"",
|
|
11053
10718
|
".ts",
|
|
@@ -11059,9 +10724,9 @@ const PLAIN_SEGMENTS = 1;
|
|
|
11059
10724
|
const ImportsField = Schema.Struct({ imports: Schema.optional(Schema.Record(Schema.String, Schema.String)) });
|
|
11060
10725
|
const decodeImports = Schema.decodeOption(Schema.fromJsonString(ImportsField));
|
|
11061
10726
|
const packageNameOf = (specifier) => {
|
|
11062
|
-
const segments = String$1.split(specifier, SEPARATOR$
|
|
11063
|
-
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$
|
|
11064
|
-
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$
|
|
10727
|
+
const segments = String$1.split(specifier, SEPARATOR$7);
|
|
10728
|
+
if (String$1.startsWith(SCOPE$2)(specifier)) return pipe(segments, Array.take(SCOPED_SEGMENTS), Array.join(SEPARATOR$7));
|
|
10729
|
+
return pipe(segments, Array.take(PLAIN_SEGMENTS), Array.join(SEPARATOR$7));
|
|
11065
10730
|
};
|
|
11066
10731
|
const literalText = (specifier) => pipe(Option.liftPredicate(specifier, isStringLiteral), Option.map((literal) => literal.text));
|
|
11067
10732
|
const runtimeSpecifierOf = (statement) => {
|
|
@@ -11156,7 +10821,7 @@ const InstalledManifest = Schema.Struct({
|
|
|
11156
10821
|
peerDependencies: DependencyMap,
|
|
11157
10822
|
peerDependenciesMeta: PeerMeta
|
|
11158
10823
|
});
|
|
11159
|
-
const decodeManifest$
|
|
10824
|
+
const decodeManifest$6 = Schema.decodeOption(Schema.fromJsonString(InstalledManifest));
|
|
11160
10825
|
const keysOf = (map) => pipe(Option.fromUndefinedOr(map), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
11161
10826
|
const isOptionalPeer = (manifest, name) => pipe(Option.fromUndefinedOr(manifest.peerDependenciesMeta), Option.flatMap(Record.get(name)), Option.exists((meta) => meta.optional === true));
|
|
11162
10827
|
const installedNames = (manifest) => [
|
|
@@ -11167,7 +10832,7 @@ const installedNames = (manifest) => [
|
|
|
11167
10832
|
const childrenOf$1 = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
11168
10833
|
const files = yield* RepositoryFiles;
|
|
11169
10834
|
const text = yield* files.readFile(files.join(directory, MANIFEST_FILE$3));
|
|
11170
|
-
return pipe(text, Option.flatMap(decodeManifest$
|
|
10835
|
+
return pipe(text, Option.flatMap(decodeManifest$6), Option.map(installedNames), Option.getOrElse(() => []), Array.map((child) => [directory, child]));
|
|
11171
10836
|
});
|
|
11172
10837
|
const resolveFrom = (from, name) => Effect.gen(function* resolvePackage() {
|
|
11173
10838
|
const files = yield* RepositoryFiles;
|
|
@@ -11229,11 +10894,11 @@ const LISTED_LARGEST = 5;
|
|
|
11229
10894
|
const SIZE_CONCURRENCY = 32;
|
|
11230
10895
|
const MEGABYTE = 1e6;
|
|
11231
10896
|
const MEGABYTE_DIGITS = 1;
|
|
11232
|
-
const START$
|
|
10897
|
+
const START$15 = 0;
|
|
11233
10898
|
const SINGLE_ENTRY = 1;
|
|
11234
10899
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
11235
10900
|
const usageHint = (dependency, entryCount) => {
|
|
11236
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
10901
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$15 && dependency.entries.length < entryCount)) return "";
|
|
11237
10902
|
return ` (imported only from ${Array.join(dependency.entries, ", ")})`;
|
|
11238
10903
|
};
|
|
11239
10904
|
const listed = ({ largest, entryCount }) => pipe(largest, Array.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array.join(", "));
|
|
@@ -11242,7 +10907,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
11242
10907
|
const { workspace, total } = overrun;
|
|
11243
10908
|
const config = yield* files.readFile(workspace.configFile);
|
|
11244
10909
|
const source = Option.getOrElse(config, () => "");
|
|
11245
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
10910
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$15);
|
|
11246
10911
|
return {
|
|
11247
10912
|
file: workspace.configFile,
|
|
11248
10913
|
...positionOf(source)(index),
|
|
@@ -11259,7 +10924,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
11259
10924
|
const everything = pipe(closures, Array.flatMap(([, packages]) => Array.fromIterable(packages)), HashSet.fromIterable);
|
|
11260
10925
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
11261
10926
|
const sizes = HashMap.fromIterable(measured);
|
|
11262
|
-
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
10927
|
+
const sizeOf = (packages) => Number$1.sumAll(pipe(Array.fromIterable(packages), Array.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$15))));
|
|
11263
10928
|
return {
|
|
11264
10929
|
closures,
|
|
11265
10930
|
sizeOf,
|
|
@@ -11292,11 +10957,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
11292
10957
|
})];
|
|
11293
10958
|
});
|
|
11294
10959
|
const stackProblems = (file, source, dependencies) => {
|
|
11295
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$
|
|
10960
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY)(source), () => START$15);
|
|
11296
10961
|
const rest = String$1.slice(section)(source);
|
|
11297
10962
|
return pipe(Record.toEntries(dependencies), Array.filter(([, specifier]) => specifier === STACK_CATALOG), Array.map(([name]) => ({
|
|
11298
10963
|
file,
|
|
11299
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
10964
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$15)),
|
|
11300
10965
|
rule: STACK_DEPENDENCY,
|
|
11301
10966
|
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.`
|
|
11302
10967
|
})));
|
|
@@ -11806,12 +11471,7 @@ const CACHE_DIRECTORY = [
|
|
|
11806
11471
|
"value-owners"
|
|
11807
11472
|
];
|
|
11808
11473
|
const CACHE_SUFFIX = ".json";
|
|
11809
|
-
const MANIFEST_ENTRY = "package.json";
|
|
11810
|
-
const SOURCE_ENTRY = "src";
|
|
11811
|
-
const LOWER_LAYERS = ["entities", "shared"];
|
|
11812
|
-
const PATH_SEPARATOR = "/";
|
|
11813
11474
|
const EMPTY = "";
|
|
11814
|
-
const NOT_INSTALLED = [];
|
|
11815
11475
|
const FIELD_SEPARATOR = "\0";
|
|
11816
11476
|
const LINE_SEPARATOR = "\n";
|
|
11817
11477
|
const ValueSchema = Schema.Union([Schema.String, Schema.Finite]);
|
|
@@ -11857,55 +11517,10 @@ const fileDigest = (hash) => {
|
|
|
11857
11517
|
});
|
|
11858
11518
|
};
|
|
11859
11519
|
const digestEntries = (digestFile) => (named) => Effect.forEach(named, ([name, file]) => digestFile(file).pipe(Effect.map((found) => entryOf(name, found))), { concurrency: 1 });
|
|
11860
|
-
const walked = (directory) => Effect.gen(function* walkFrom() {
|
|
11861
|
-
const files = yield* RepositoryFiles;
|
|
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
|
-
};
|
|
11899
|
-
});
|
|
11900
|
-
const fingerprintOf = Effect.fn("fingerprintOf")(function* fingerprintOf(hash) {
|
|
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));
|
|
11904
|
-
});
|
|
11905
11520
|
const analysisCache = Effect.fn("analysisCache")(function* analysisCache(root, owners) {
|
|
11906
11521
|
const files = yield* RepositoryFiles;
|
|
11907
11522
|
const hash = yield* hasher;
|
|
11908
|
-
const fingerprint = yield*
|
|
11523
|
+
const fingerprint = yield* implementationFingerprint(import.meta.dirname);
|
|
11909
11524
|
const salt = yield* hash(Array.join([fingerprint, String$1.replaceAll(root, EMPTY)(owners)], FIELD_SEPARATOR));
|
|
11910
11525
|
return {
|
|
11911
11526
|
root,
|
|
@@ -12002,7 +11617,7 @@ const duplicateProblems = (relative) => (sites) => {
|
|
|
12002
11617
|
}))));
|
|
12003
11618
|
};
|
|
12004
11619
|
// src/features/check-value-owners/model/name-lists.ts
|
|
12005
|
-
const RULE$
|
|
11620
|
+
const RULE$24 = "hand-written-names";
|
|
12006
11621
|
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
12007
11622
|
const nameListOf = (site) => {
|
|
12008
11623
|
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -12017,7 +11632,7 @@ const problemOf$6 = ({ list, reason }) => ({
|
|
|
12017
11632
|
file: list.site.file,
|
|
12018
11633
|
line: list.site.line,
|
|
12019
11634
|
column: list.site.column,
|
|
12020
|
-
rule: RULE$
|
|
11635
|
+
rule: RULE$24,
|
|
12021
11636
|
message: `The names ${formatValues(list.names)} are listed by hand, but ${reason}`
|
|
12022
11637
|
});
|
|
12023
11638
|
// src/features/check-value-owners/model/declared-names.ts
|
|
@@ -12058,7 +11673,7 @@ const declaredNameProblem = ({ literals, relative }) => {
|
|
|
12058
11673
|
const PATH_PREFIX = /^(?:!|\.\/)+/u;
|
|
12059
11674
|
const GLOB = /[*?{[]/u;
|
|
12060
11675
|
const EXTENSION$1 = /\.[^./]+$/u;
|
|
12061
|
-
const SEPARATOR$
|
|
11676
|
+
const SEPARATOR$6 = "/";
|
|
12062
11677
|
const ROOT = ".";
|
|
12063
11678
|
const namedPath = (repository, file) => (name) => {
|
|
12064
11679
|
const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
|
|
@@ -12067,12 +11682,12 @@ const namedPath = (repository, file) => (name) => {
|
|
|
12067
11682
|
return pipe([fromFile, bare], Array.findFirst((path) => HashSet.has(repository.paths, path)));
|
|
12068
11683
|
};
|
|
12069
11684
|
const kindOf = (repository) => (path) => {
|
|
12070
|
-
if (HashSet.has(repository.directories, path)) return SEPARATOR$
|
|
11685
|
+
if (HashSet.has(repository.directories, path)) return SEPARATOR$6;
|
|
12071
11686
|
return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array.head), Option.getOrElse(() => path));
|
|
12072
11687
|
};
|
|
12073
11688
|
const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
|
|
12074
11689
|
const coversDirectory = (repository) => (group) => pipe(Array.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
|
|
12075
|
-
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$
|
|
11690
|
+
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$6}${kindOf(repository)(path)}`), Record.values, Array.findFirst(coversDirectory(repository)), Option.flatMap(Array.head), Option.map(repository.dirname));
|
|
12076
11691
|
const directoryLabel = (directory) => {
|
|
12077
11692
|
if (directory === ROOT) return "the repository root";
|
|
12078
11693
|
return directory;
|
|
@@ -12123,16 +11738,16 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
|
|
|
12123
11738
|
};
|
|
12124
11739
|
// src/features/check-value-owners/model/repository-names.ts
|
|
12125
11740
|
const MANIFEST$2 = "package.json";
|
|
12126
|
-
const SEPARATOR$
|
|
11741
|
+
const SEPARATOR$5 = "/";
|
|
12127
11742
|
const FIRST_SEGMENT = 1;
|
|
12128
11743
|
const ManifestJson = Schema.fromJsonString(Schema.Struct({ name: Schema.optionalKey(Schema.String) }));
|
|
12129
|
-
const decodeManifest$
|
|
11744
|
+
const decodeManifest$5 = Schema.decodeUnknownOption(ManifestJson);
|
|
12130
11745
|
const prefixesOf = (file) => {
|
|
12131
|
-
const segments = pipe(file, String$1.split(SEPARATOR$
|
|
12132
|
-
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$
|
|
11746
|
+
const segments = pipe(file, String$1.split(SEPARATOR$5));
|
|
11747
|
+
return pipe(Array.range(FIRST_SEGMENT, segments.length), Array.map((count) => pipe(Array.take(segments, count), Array.join(SEPARATOR$5))));
|
|
12133
11748
|
};
|
|
12134
11749
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array.dropRight(FIRST_SEGMENT));
|
|
12135
|
-
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$
|
|
11750
|
+
const nameOf = (text) => pipe(text, Option.flatMap(decodeManifest$5), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
12136
11751
|
const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNamesOf(root) {
|
|
12137
11752
|
const files = yield* RepositoryFiles;
|
|
12138
11753
|
const listed = yield* files.listedFiles(root);
|
|
@@ -12151,7 +11766,7 @@ const repositoryNamesOf = Effect.fn("repositoryNamesOf")(function* repositoryNam
|
|
|
12151
11766
|
});
|
|
12152
11767
|
// src/features/check-value-owners/model/check.ts
|
|
12153
11768
|
const scanOwners = Effect.fn("scanOwners")(function* scanOwners(workspace, configPaths) {
|
|
12154
|
-
const ownerConfigs = yield* pipe(configPaths, Effect.filter(mentions(`@${OWNER_TAG}`)(workspace.compiler)));
|
|
11769
|
+
const ownerConfigs = yield* pipe(configPaths, Effect.filter(mentions$1(`@${OWNER_TAG}`)(workspace.compiler)));
|
|
12155
11770
|
const scans = yield* Effect.forEach(ownerConfigs, (configPath) => withProject(workspace)(configPath)((project) => Effect.sync(() => ownersIn(project))), { concurrency: 1 });
|
|
12156
11771
|
return combineOwnerScans(Array.getSomes(scans));
|
|
12157
11772
|
});
|
|
@@ -12244,7 +11859,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
12244
11859
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
12245
11860
|
}, Effect.scoped);
|
|
12246
11861
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
12247
|
-
const RULE$
|
|
11862
|
+
const RULE$23 = "namespace-destructuring";
|
|
12248
11863
|
const LOCAL = /^[.#/]/u;
|
|
12249
11864
|
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.`;
|
|
12250
11865
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -12260,7 +11875,7 @@ const destructuredName = (declaration) => {
|
|
|
12260
11875
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
12261
11876
|
};
|
|
12262
11877
|
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$9({
|
|
12263
|
-
rule: RULE$
|
|
11878
|
+
rule: RULE$23,
|
|
12264
11879
|
message: messageOf$1(name)
|
|
12265
11880
|
})), Option.map((report) => report(declaration)));
|
|
12266
11881
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -12268,7 +11883,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
12268
11883
|
return pipe(descendantsOf(sourceFile), Array.filter(isVariableDeclaration), Array.map(problemOf$5(names)), Array.getSomes);
|
|
12269
11884
|
};
|
|
12270
11885
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
12271
|
-
const RULE$
|
|
11886
|
+
const RULE$22 = "pass-through-wrapper";
|
|
12272
11887
|
const SINGLE_STATEMENT = 1;
|
|
12273
11888
|
const SINGLE_DECLARATION = 1;
|
|
12274
11889
|
const THIS_PARAMETER = "this";
|
|
@@ -12365,7 +11980,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
12365
11980
|
const problemOf$4 = (checker) => (candidate) => {
|
|
12366
11981
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
12367
11982
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$9({
|
|
12368
|
-
rule: RULE$
|
|
11983
|
+
rule: RULE$22,
|
|
12369
11984
|
message: messageOf(forward.callee.getText())
|
|
12370
11985
|
})(candidate.name)));
|
|
12371
11986
|
};
|
|
@@ -12374,17 +11989,17 @@ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(so
|
|
|
12374
11989
|
/** @internal */
|
|
12375
11990
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
|
|
12376
11991
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
12377
|
-
const RULE$
|
|
11992
|
+
const RULE$21 = "missing-hook";
|
|
12378
11993
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
12379
11994
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
12380
11995
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12381
11996
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
12382
11997
|
const PLUGIN_ROOT = "..";
|
|
12383
|
-
const READ_CONCURRENCY$
|
|
12384
|
-
const START$
|
|
11998
|
+
const READ_CONCURRENCY$10 = 16;
|
|
11999
|
+
const START$14 = 0;
|
|
12385
12000
|
const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
|
|
12386
12001
|
path,
|
|
12387
|
-
index: found.index ?? START$
|
|
12002
|
+
index: found.index ?? START$14
|
|
12388
12003
|
})), Option.toArray);
|
|
12389
12004
|
const referencesIn$1 = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap(referenceOf$1));
|
|
12390
12005
|
const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
@@ -12399,7 +12014,7 @@ const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
12399
12014
|
return pipe(missing, Array.map(({ path, index }) => ({
|
|
12400
12015
|
file,
|
|
12401
12016
|
...positionOf(source)(index),
|
|
12402
|
-
rule: RULE$
|
|
12017
|
+
rule: RULE$21,
|
|
12403
12018
|
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.`
|
|
12404
12019
|
})));
|
|
12405
12020
|
});
|
|
@@ -12423,14 +12038,14 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
12423
12038
|
}];
|
|
12424
12039
|
return [];
|
|
12425
12040
|
}));
|
|
12426
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$8, { concurrency: READ_CONCURRENCY$
|
|
12041
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$8, { concurrency: READ_CONCURRENCY$10 });
|
|
12427
12042
|
return Array.flatten(found);
|
|
12428
12043
|
});
|
|
12429
12044
|
// src/shared/lib/section-check.ts
|
|
12430
12045
|
const taggedError$3 = Schema.TaggedError;
|
|
12431
12046
|
var SectionConfigUnreadable = class extends taggedError$3()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
12432
12047
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
12433
|
-
const FIRST$
|
|
12048
|
+
const FIRST$7 = 1;
|
|
12434
12049
|
const sectionAt = (file, pick) => Effect.gen(function* readSection() {
|
|
12435
12050
|
if (!(yield* (yield* RepositoryFiles).exists(file))) return Option.none();
|
|
12436
12051
|
const config = yield* Effect.tryPromise({
|
|
@@ -12441,8 +12056,8 @@ const sectionAt = (file, pick) => Effect.gen(function* readSection() {
|
|
|
12441
12056
|
});
|
|
12442
12057
|
const failureAt = (file, rule, message) => [{
|
|
12443
12058
|
file,
|
|
12444
|
-
line: FIRST$
|
|
12445
|
-
column: FIRST$
|
|
12059
|
+
line: FIRST$7,
|
|
12060
|
+
column: FIRST$7,
|
|
12446
12061
|
rule,
|
|
12447
12062
|
message
|
|
12448
12063
|
}];
|
|
@@ -12464,7 +12079,7 @@ const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
|
12464
12079
|
onSuccess: (found) => pipe(found, Array.filter(({ severity }) => severity === "error"), Array.map((diagnostic) => ({
|
|
12465
12080
|
file: files.join(root, diagnostic.path),
|
|
12466
12081
|
line: diagnostic.line,
|
|
12467
|
-
column: diagnostic.column ?? FIRST$
|
|
12082
|
+
column: diagnostic.column ?? FIRST$7,
|
|
12468
12083
|
rule: check.rule,
|
|
12469
12084
|
message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`
|
|
12470
12085
|
})))
|
|
@@ -12484,10 +12099,10 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
12484
12099
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
12485
12100
|
const EXTENSION = /\.[^./]+$/u;
|
|
12486
12101
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
12487
|
-
const READ_CONCURRENCY$
|
|
12488
|
-
const FIRST$
|
|
12489
|
-
const RULE$
|
|
12490
|
-
const MESSAGE$
|
|
12102
|
+
const READ_CONCURRENCY$9 = 64;
|
|
12103
|
+
const FIRST$6 = 1;
|
|
12104
|
+
const RULE$20 = "shell-script";
|
|
12105
|
+
const MESSAGE$9 = "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.";
|
|
12491
12106
|
const HookSchema = Schema.Struct({
|
|
12492
12107
|
command: Schema.optional(Schema.String),
|
|
12493
12108
|
args: Schema.optional(Schema.Array(Schema.String))
|
|
@@ -12507,10 +12122,10 @@ const baseName = (name) => pipe(String$1.split("/")(name), Array.last, Option.ge
|
|
|
12507
12122
|
const hasExtension = (name) => EXTENSION.test(baseName(name));
|
|
12508
12123
|
const problemFor$1 = (file) => ({
|
|
12509
12124
|
file,
|
|
12510
|
-
line: FIRST$
|
|
12511
|
-
column: FIRST$
|
|
12512
|
-
rule: RULE$
|
|
12513
|
-
message: MESSAGE$
|
|
12125
|
+
line: FIRST$6,
|
|
12126
|
+
column: FIRST$6,
|
|
12127
|
+
rule: RULE$20,
|
|
12128
|
+
message: MESSAGE$9
|
|
12514
12129
|
});
|
|
12515
12130
|
/** @internal */
|
|
12516
12131
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
@@ -12526,12 +12141,12 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
12526
12141
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
12527
12142
|
};
|
|
12528
12143
|
const candidates = pipe(names, Array.filter((name) => !isSessionStartHook(name)));
|
|
12529
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
12144
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$9 });
|
|
12530
12145
|
return pipe(shell, Array.map((name) => problemFor$1(files.join(root, name))));
|
|
12531
12146
|
});
|
|
12532
12147
|
// src/shared/lib/workflow-files.ts
|
|
12533
12148
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
12534
|
-
const READ_CONCURRENCY$
|
|
12149
|
+
const READ_CONCURRENCY$8 = 16;
|
|
12535
12150
|
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
12536
12151
|
const files = yield* RepositoryFiles;
|
|
12537
12152
|
const names = yield* files.listedFiles(root);
|
|
@@ -12541,13 +12156,13 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
12541
12156
|
file,
|
|
12542
12157
|
source
|
|
12543
12158
|
}))));
|
|
12544
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
12159
|
+
}, { concurrency: READ_CONCURRENCY$8 });
|
|
12545
12160
|
return Array.getSomes(found);
|
|
12546
12161
|
});
|
|
12547
12162
|
// src/shared/lib/workflow-run.ts
|
|
12548
12163
|
const RUN_KEY = "run";
|
|
12549
|
-
const START$
|
|
12550
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
12164
|
+
const START$13 = 0;
|
|
12165
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$13));
|
|
12551
12166
|
const runScriptsOf = (source) => {
|
|
12552
12167
|
const found = [];
|
|
12553
12168
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -12562,9 +12177,9 @@ const runScriptsOf = (source) => {
|
|
|
12562
12177
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
12563
12178
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12564
12179
|
const COMMENT = "#";
|
|
12565
|
-
const RULE$
|
|
12180
|
+
const RULE$19 = "workflow-script";
|
|
12566
12181
|
const ONE_COMMAND = 1;
|
|
12567
|
-
const MESSAGE$
|
|
12182
|
+
const MESSAGE$8 = "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.";
|
|
12568
12183
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
12569
12184
|
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
12570
12185
|
const runsMoreThanOneCommand = ({ text }) => {
|
|
@@ -12576,8 +12191,8 @@ const problemsIn$7 = (file) => (source) => {
|
|
|
12576
12191
|
return pipe(runScriptsOf(source), Array.filter(runsMoreThanOneCommand), Array.map(({ start }) => ({
|
|
12577
12192
|
file,
|
|
12578
12193
|
...at(start),
|
|
12579
|
-
rule: RULE$
|
|
12580
|
-
message: MESSAGE$
|
|
12194
|
+
rule: RULE$19,
|
|
12195
|
+
message: MESSAGE$8
|
|
12581
12196
|
})));
|
|
12582
12197
|
};
|
|
12583
12198
|
/** @internal */
|
|
@@ -12603,12 +12218,12 @@ const checkStructure = checkSection({
|
|
|
12603
12218
|
// src/features/check-vite-plus/model/command-words.ts
|
|
12604
12219
|
const CONTINUATION = /\\\n/gu;
|
|
12605
12220
|
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
12606
|
-
const SEPARATOR$
|
|
12221
|
+
const SEPARATOR$4 = /&&|\|\||[;|\n`]|\$\(/u;
|
|
12607
12222
|
const BLANK$1 = /\s+/u;
|
|
12608
12223
|
const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
|
|
12609
12224
|
const QUOTE = "\"\"";
|
|
12610
12225
|
const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array.filter(String$1.isNonEmpty), Array.dropWhile((word) => ASSIGNMENT.test(word)));
|
|
12611
|
-
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$
|
|
12226
|
+
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$4), Array.map(wordsOf), Array.filter(Array.isReadonlyArrayNonEmpty));
|
|
12612
12227
|
// src/features/check-vite-plus/model/command-problems.ts
|
|
12613
12228
|
const PACKAGE_MANAGERS = [
|
|
12614
12229
|
"pnpm",
|
|
@@ -12686,28 +12301,28 @@ const docSources = (file) => (source) => {
|
|
|
12686
12301
|
})));
|
|
12687
12302
|
};
|
|
12688
12303
|
// src/features/check-vite-plus/model/command-sources.ts
|
|
12689
|
-
const ROOT_DIRECTORY = ".";
|
|
12304
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
12690
12305
|
const COMMAND_KEY = "command";
|
|
12691
12306
|
const ARGUMENTS_KEY = "args";
|
|
12692
|
-
const EXCLUDED$
|
|
12693
|
-
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$
|
|
12307
|
+
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12308
|
+
const MANIFESTS = [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$3];
|
|
12694
12309
|
const STEP_FILES = [
|
|
12695
12310
|
":(glob).github/workflows/*.yml",
|
|
12696
12311
|
":(glob).github/workflows/*.yaml",
|
|
12697
12312
|
":(glob)**/action.yml",
|
|
12698
12313
|
":(glob)**/action.yaml",
|
|
12699
|
-
...EXCLUDED$
|
|
12314
|
+
...EXCLUDED$3
|
|
12700
12315
|
];
|
|
12701
12316
|
const HOOK_FILES = [":(glob).vite-hooks/*"];
|
|
12702
12317
|
const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
|
|
12703
12318
|
const AGENT_DOCS = [
|
|
12704
12319
|
":(glob)**/AGENTS.md",
|
|
12705
12320
|
":(glob)**/CLAUDE.md",
|
|
12706
|
-
...EXCLUDED$
|
|
12321
|
+
...EXCLUDED$3
|
|
12707
12322
|
];
|
|
12708
|
-
const READ_CONCURRENCY$
|
|
12709
|
-
const START$
|
|
12710
|
-
const FIRST$
|
|
12323
|
+
const READ_CONCURRENCY$7 = 16;
|
|
12324
|
+
const START$12 = 0;
|
|
12325
|
+
const FIRST$5 = 1;
|
|
12711
12326
|
const LINE = "\n";
|
|
12712
12327
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
12713
12328
|
const decodeCommandText = Schema.decodeUnknownOption(CommandText);
|
|
@@ -12716,7 +12331,7 @@ const decodeScripts = Schema.decodeUnknownOption(Schema.fromJsonString(Scripts))
|
|
|
12716
12331
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
12717
12332
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12718
12333
|
const NO_SOURCES = [];
|
|
12719
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
12334
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$12));
|
|
12720
12335
|
const scriptSources = (file) => (source) => pipe(decodeScripts(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array.map(([name, text]) => {
|
|
12721
12336
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
12722
12337
|
return {
|
|
@@ -12738,8 +12353,8 @@ const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE
|
|
|
12738
12353
|
kind: "hook",
|
|
12739
12354
|
file,
|
|
12740
12355
|
position: {
|
|
12741
|
-
line: index + FIRST$
|
|
12742
|
-
column: FIRST$
|
|
12356
|
+
line: index + FIRST$5,
|
|
12357
|
+
column: FIRST$5
|
|
12743
12358
|
},
|
|
12744
12359
|
name,
|
|
12745
12360
|
text
|
|
@@ -12776,7 +12391,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
12776
12391
|
return pipe(tasks, Array.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
12777
12392
|
});
|
|
12778
12393
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
12779
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
12394
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$7 });
|
|
12780
12395
|
return Array.flatten(found);
|
|
12781
12396
|
});
|
|
12782
12397
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -12788,7 +12403,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
12788
12403
|
onSome: sourcesOf(file, name)
|
|
12789
12404
|
});
|
|
12790
12405
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
12791
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
12406
|
+
}, { concurrency: READ_CONCURRENCY$7 });
|
|
12792
12407
|
return Array.flatten(found);
|
|
12793
12408
|
});
|
|
12794
12409
|
/** @internal */
|
|
@@ -12807,12 +12422,12 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
12807
12422
|
readSources(root, hooks, hookSources),
|
|
12808
12423
|
readSources(root, AGENT_FILES, agentSources),
|
|
12809
12424
|
readSources(root, docs, docSources),
|
|
12810
|
-
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY, ...workspaces]))
|
|
12425
|
+
workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY$1, ...workspaces]))
|
|
12811
12426
|
], { concurrency: "unbounded" });
|
|
12812
12427
|
return Array.flatten(found);
|
|
12813
12428
|
});
|
|
12814
12429
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
12815
|
-
const RULE$
|
|
12430
|
+
const RULE$18 = "package-script";
|
|
12816
12431
|
const LIFECYCLE = [
|
|
12817
12432
|
"preinstall",
|
|
12818
12433
|
"install",
|
|
@@ -12835,26 +12450,26 @@ const LIFECYCLE = [
|
|
|
12835
12450
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
12836
12451
|
file,
|
|
12837
12452
|
...position,
|
|
12838
|
-
rule: RULE$
|
|
12453
|
+
rule: RULE$18,
|
|
12839
12454
|
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.`
|
|
12840
12455
|
});
|
|
12841
12456
|
const packageScriptProblems = (sources) => pipe(sources, Array.filter(({ kind, name }) => kind === "script" && !Array.contains(LIFECYCLE, name)), Array.map(problemOf$3));
|
|
12842
12457
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
12843
|
-
const RULE$
|
|
12458
|
+
const RULE$17 = "vite-plus-block";
|
|
12844
12459
|
const MARKER = Array.join([
|
|
12845
12460
|
"<!--",
|
|
12846
12461
|
"VITE PLUS START",
|
|
12847
12462
|
"-->"
|
|
12848
12463
|
], "");
|
|
12849
|
-
const MESSAGE$
|
|
12464
|
+
const MESSAGE$7 = "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.";
|
|
12850
12465
|
const problemIn = (file) => (source) => {
|
|
12851
12466
|
const index = String$1.indexOf(MARKER)(source);
|
|
12852
12467
|
if (Option.isNone(index)) return Option.none();
|
|
12853
12468
|
return Option.some({
|
|
12854
12469
|
file,
|
|
12855
12470
|
...positionOf(source)(index.value),
|
|
12856
|
-
rule: RULE$
|
|
12857
|
-
message: MESSAGE$
|
|
12471
|
+
rule: RULE$17,
|
|
12472
|
+
message: MESSAGE$7
|
|
12858
12473
|
});
|
|
12859
12474
|
};
|
|
12860
12475
|
/** @internal */
|
|
@@ -12909,11 +12524,11 @@ const checkFullHistoryCheckout = workflowCheck({
|
|
|
12909
12524
|
})
|
|
12910
12525
|
});
|
|
12911
12526
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
12912
|
-
const RULE$
|
|
12527
|
+
const RULE$15 = "publish-trigger";
|
|
12913
12528
|
const PUBLISH = /\bmsch-publish\b/u;
|
|
12914
12529
|
const MANUAL = "workflow_dispatch";
|
|
12915
12530
|
const TRIGGER_KEY = "on";
|
|
12916
|
-
const MESSAGE$
|
|
12531
|
+
const MESSAGE$5 = "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
12532
|
const triggersOf = (node) => {
|
|
12918
12533
|
if (isScalar(node)) return [String(node.value)];
|
|
12919
12534
|
if (isSeq(node)) return pipe(node.items, Array.filter(isScalar), Array.map((item) => String(item.value)));
|
|
@@ -12929,19 +12544,19 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
12929
12544
|
};
|
|
12930
12545
|
/** @internal */
|
|
12931
12546
|
const checkPublishTrigger = workflowCheck({
|
|
12932
|
-
rule: RULE$
|
|
12933
|
-
message: MESSAGE$
|
|
12547
|
+
rule: RULE$15,
|
|
12548
|
+
message: MESSAGE$5,
|
|
12934
12549
|
offsetsOf: publishTriggerOffsetsOf
|
|
12935
12550
|
});
|
|
12936
12551
|
// src/features/check-workflows/model/release-please.ts
|
|
12937
|
-
const RULE$
|
|
12552
|
+
const RULE$14 = "release-please";
|
|
12938
12553
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
12939
12554
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
12940
|
-
const FIRST$
|
|
12941
|
-
const MESSAGE$
|
|
12555
|
+
const FIRST$4 = 1;
|
|
12556
|
+
const MESSAGE$4 = "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
12557
|
const checkReleasePleaseSteps = workflowCheck({
|
|
12943
|
-
rule: RULE$
|
|
12944
|
-
message: MESSAGE$
|
|
12558
|
+
rule: RULE$14,
|
|
12559
|
+
message: MESSAGE$4,
|
|
12945
12560
|
offsetsOf: scalarKeyOffsets({
|
|
12946
12561
|
name: "uses",
|
|
12947
12562
|
matches: (value) => RELEASE_PLEASE.test(value)
|
|
@@ -12952,10 +12567,10 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
12952
12567
|
const names = yield* files.listedFiles(root);
|
|
12953
12568
|
return pipe(names, Array.filter((name) => RELEASE_PLEASE_FILE.test(name)), Array.map((name) => ({
|
|
12954
12569
|
file: files.join(root, name),
|
|
12955
|
-
line: FIRST$
|
|
12956
|
-
column: FIRST$
|
|
12957
|
-
rule: RULE$
|
|
12958
|
-
message: MESSAGE$
|
|
12570
|
+
line: FIRST$4,
|
|
12571
|
+
column: FIRST$4,
|
|
12572
|
+
rule: RULE$14,
|
|
12573
|
+
message: MESSAGE$4
|
|
12959
12574
|
})));
|
|
12960
12575
|
});
|
|
12961
12576
|
/** @internal */
|
|
@@ -12966,26 +12581,26 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
12966
12581
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
12967
12582
|
const CONCURRENCY_KEY = "concurrency";
|
|
12968
12583
|
const QUEUE_KEY = "queue";
|
|
12969
|
-
const RULE$
|
|
12970
|
-
const MESSAGE$
|
|
12584
|
+
const RULE$13 = "workflow-queue";
|
|
12585
|
+
const MESSAGE$3 = "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.";
|
|
12971
12586
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
12972
12587
|
/** @internal */
|
|
12973
12588
|
const checkWorkflowQueues = workflowCheck({
|
|
12974
|
-
rule: RULE$
|
|
12975
|
-
message: MESSAGE$
|
|
12589
|
+
rule: RULE$13,
|
|
12590
|
+
message: MESSAGE$3,
|
|
12976
12591
|
offsetsOf: queueOffsetsOf
|
|
12977
12592
|
});
|
|
12978
12593
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
12979
|
-
const RULE$
|
|
12594
|
+
const RULE$12 = "workflow-commit";
|
|
12980
12595
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
12981
12596
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
12982
|
-
const MESSAGE$
|
|
12597
|
+
const MESSAGE$2 = "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.";
|
|
12983
12598
|
const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source), Array.filter(({ value }) => isScalar(value) && typeof value.value === "string" && pattern.test(value.value)), Array.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap(({ range }) => Option.fromNullishOr(range)), Option.map(([start]) => start), Option.toArray)));
|
|
12984
12599
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
12985
12600
|
/** @internal */
|
|
12986
12601
|
const checkWorkflowCommits = workflowCheck({
|
|
12987
|
-
rule: RULE$
|
|
12988
|
-
message: MESSAGE$
|
|
12602
|
+
rule: RULE$12,
|
|
12603
|
+
message: MESSAGE$2,
|
|
12989
12604
|
offsetsOf: commitOffsetsOf
|
|
12990
12605
|
});
|
|
12991
12606
|
// src/features/check-workflows/model/workflow-lint.ts
|
|
@@ -13106,7 +12721,7 @@ const COMMENT_NODES = [
|
|
|
13106
12721
|
"block_comment",
|
|
13107
12722
|
"multiline_comment"
|
|
13108
12723
|
];
|
|
13109
|
-
const START$
|
|
12724
|
+
const START$11 = 0;
|
|
13110
12725
|
const NEXT = 1;
|
|
13111
12726
|
const NONE$1 = [];
|
|
13112
12727
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
@@ -13159,7 +12774,7 @@ const markupComment = (source) => (node) => {
|
|
|
13159
12774
|
}];
|
|
13160
12775
|
};
|
|
13161
12776
|
const textComments = (grammars, grammar) => (text) => {
|
|
13162
|
-
const shift = shifted(text.startIndex ?? START$
|
|
12777
|
+
const shift = shifted(text.startIndex ?? START$11);
|
|
13163
12778
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array.map(shift)));
|
|
13164
12779
|
};
|
|
13165
12780
|
const embeddedComments = (grammars) => (node) => {
|
|
@@ -13195,11 +12810,11 @@ const commentsWith = (grammars) => (reader, source) => {
|
|
|
13195
12810
|
}[reader](source);
|
|
13196
12811
|
};
|
|
13197
12812
|
// src/features/ban-comments/model/comments.ts
|
|
13198
|
-
const RULE$
|
|
12813
|
+
const RULE$11 = "comment";
|
|
13199
12814
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
13200
12815
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
13201
|
-
const READ_CONCURRENCY$
|
|
13202
|
-
const START$
|
|
12816
|
+
const READ_CONCURRENCY$6 = 64;
|
|
12817
|
+
const START$10 = 0;
|
|
13203
12818
|
const FIRST_LINE$4 = 1;
|
|
13204
12819
|
const FIRST_COLUMN$3 = 1;
|
|
13205
12820
|
const READERS$1 = [
|
|
@@ -13233,7 +12848,7 @@ const SHEBANG = "#!";
|
|
|
13233
12848
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
13234
12849
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
13235
12850
|
const DELIMITERS = /^(?:\/\/|\/\*|<!--|<#|#|--)|(?:\*\/|-->|#>)$/gu;
|
|
13236
|
-
const MESSAGE = "Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.";
|
|
12851
|
+
const MESSAGE$1 = "Comments are not written in this repository. Say it with names and types in the code, put the reason in the commit message, and delete the comment.";
|
|
13237
12852
|
const Patterns = Schema.Array(Schema.String);
|
|
13238
12853
|
const CommentSettings = Schema.Struct({ allow: Patterns });
|
|
13239
12854
|
const MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });
|
|
@@ -13256,23 +12871,23 @@ const shebangReader = (source) => {
|
|
|
13256
12871
|
const readerOf = (name, source) => pipe(READERS$1, Array.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
13257
12872
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
13258
12873
|
const lineBefore = (source, index) => {
|
|
13259
|
-
const lines = pipe(source, String$1.slice(START$
|
|
12874
|
+
const lines = pipe(source, String$1.slice(START$10, index), String$1.split("\n"));
|
|
13260
12875
|
return Option.getOrElse(Array.last(lines), () => "");
|
|
13261
12876
|
};
|
|
13262
12877
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
13263
|
-
const isShebang = ({ index, text }) => index === START$
|
|
12878
|
+
const isShebang = ({ index, text }) => index === START$10 && String$1.startsWith(SHEBANG)(text);
|
|
13264
12879
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
13265
12880
|
const problemOf$2 = (file, source) => ({ index }) => ({
|
|
13266
12881
|
file,
|
|
13267
12882
|
...positionOf(source)(index),
|
|
13268
|
-
rule: RULE$
|
|
13269
|
-
message: MESSAGE
|
|
12883
|
+
rule: RULE$11,
|
|
12884
|
+
message: MESSAGE$1
|
|
13270
12885
|
});
|
|
13271
12886
|
const unreadableProblem = (file, message) => ({
|
|
13272
12887
|
file,
|
|
13273
12888
|
line: FIRST_LINE$4,
|
|
13274
12889
|
column: FIRST_COLUMN$3,
|
|
13275
|
-
rule: RULE$
|
|
12890
|
+
rule: RULE$11,
|
|
13276
12891
|
message: `msch could not read the comments in this file: ${message}`
|
|
13277
12892
|
});
|
|
13278
12893
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -13327,10 +12942,14 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
13327
12942
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
13328
12943
|
onNone: () => Effect.succeed(NONE),
|
|
13329
12944
|
onSome: (source) => problemsIn(entry, source)
|
|
13330
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
12945
|
+
}))), { concurrency: READ_CONCURRENCY$6 });
|
|
13331
12946
|
return Array.flatten(found);
|
|
13332
12947
|
});
|
|
13333
12948
|
// src/features/ban-tools/model/banned-tool.ts
|
|
12949
|
+
const PROGRAM_SOURCE = /\.(?:[cm]?[jt]sx?|rs|cs|go)$/u;
|
|
12950
|
+
const CONFIG_SOURCE = /(?:^|\/)[^/]*\.config\.[cm]?[jt]s$/u;
|
|
12951
|
+
const isProgramSource = ({ name }) => PROGRAM_SOURCE.test(name) && !CONFIG_SOURCE.test(name);
|
|
12952
|
+
const spawnPattern = (program) => new RegExp(String.raw`(?:\bcommand["']?\s*[:=]\s*|(?:\bspawn\w*|\bexec\w*|\bexeca|Command::new|ChildProcess\.make)\(\s*|\$\(\s*|\$\s*(?=\x60))["'\x60](?:${program})(?=["'\x60\s])`, "gu");
|
|
13334
12953
|
const FIRST_LINE$3 = 1;
|
|
13335
12954
|
const FIRST_COLUMN$2 = 1;
|
|
13336
12955
|
const WHOLE_MATCH$1 = 0;
|
|
@@ -13362,18 +12981,23 @@ const RENAMES = [
|
|
|
13362
12981
|
[/(?:^|\/)(?:[^/]+)?\.dockerignore$/u, ".containerignore"],
|
|
13363
12982
|
[/(?:^|\/)docker-compose(?:\.[^/]+)?\.ya?ml$/u, "compose.yaml"]
|
|
13364
12983
|
];
|
|
12984
|
+
const SPAWN_PATTERNS$1 = [spawnPattern("docker(?:-compose)?")];
|
|
13365
12985
|
const COMMAND_PATTERNS$1 = [
|
|
13366
12986
|
/(?<![\w./@-])docker[ \t]+(?:build|buildx|compose|run|push|pull|login|logout|exec|tag|image|images|ps|rm|rmi|stop|start|kill|save|load|create|cp|inspect|logs|network|volume|system|manifest|context|container)\b/gu,
|
|
13367
12987
|
/(?<![\w./@-])docker-compose[ \t]+(?:up|down|build|run|exec|pull|push|ps|logs|stop|start|restart|config)\b/gu,
|
|
13368
|
-
|
|
12988
|
+
...SPAWN_PATTERNS$1,
|
|
13369
12989
|
/\buses:\s*["']?docker(?:\/[\w.-]+|:\/\/)/gu
|
|
13370
12990
|
];
|
|
12991
|
+
const patternsFor$1 = (entry) => {
|
|
12992
|
+
if (isProgramSource(entry)) return SPAWN_PATTERNS$1;
|
|
12993
|
+
return COMMAND_PATTERNS$1;
|
|
12994
|
+
};
|
|
13371
12995
|
const renameOf = ({ name }) => pipe(RENAMES, Array.findFirst(([pattern]) => pattern.test(name)), Option.map(([, renamed]) => renamed));
|
|
13372
12996
|
const DOCKER = {
|
|
13373
12997
|
fileRule: "docker-file",
|
|
13374
12998
|
commandRule: "docker-command",
|
|
13375
12999
|
isFile: (entry) => Option.isSome(renameOf(entry)),
|
|
13376
|
-
patternsFor:
|
|
13000
|
+
patternsFor: patternsFor$1,
|
|
13377
13001
|
fileMessage: (entry) => `Docker is not used in this repository: podman builds and runs containers. Name this file ${Option.getOrElse(renameOf(entry), () => "for podman")}, the name podman reads.`,
|
|
13378
13002
|
commandMessage: (command) => `Docker is not used in this repository. Replace \`${command}\` with podman, which takes the same arguments.`
|
|
13379
13003
|
};
|
|
@@ -13381,6 +13005,7 @@ const DOCKER = {
|
|
|
13381
13005
|
const checkDocker = (root) => checkBannedTool(root, DOCKER);
|
|
13382
13006
|
// src/features/ban-tools/model/python.ts
|
|
13383
13007
|
const PYTHON_FILE = /(?:\.(?:py|pyi|pyw|pyx|ipynb)|(?:^|\/)(?:pyproject\.toml|uv\.lock|uv\.toml|poetry\.lock|Pipfile|Pipfile\.lock|setup\.cfg|tox\.ini|pytest\.ini|\.python-version|requirements[^/]*\.txt))$/u;
|
|
13008
|
+
const SPAWN_PATTERNS = [spawnPattern(String.raw`python[\d.]*|pip3?|pipx|uvx?|poetry`)];
|
|
13384
13009
|
const COMMAND_PATTERNS = [
|
|
13385
13010
|
/(?<![\w./@-])python[\d.]*[ \t]+(?:[-"'$./]|\S+\.py\b)/gu,
|
|
13386
13011
|
/(?<![\w./@-])pip3?[ \t]+(?:install|uninstall|download|freeze|wheel|compile|sync)\b/gu,
|
|
@@ -13388,11 +13013,12 @@ const COMMAND_PATTERNS = [
|
|
|
13388
13013
|
/(?<![\w./@-])uvx[ \t]+[^\s=:,;)|&]/gu,
|
|
13389
13014
|
/(?<![\w./@-])uv[ \t]+(?:run|sync|lock|pip|tool|venv|add|remove|python|export|build|publish|init|tree|cache|self)\b/gu,
|
|
13390
13015
|
/(?<![\w./@-])poetry[ \t]+(?:run|install|add|lock|build|publish|shell|export)\b/gu,
|
|
13391
|
-
|
|
13016
|
+
...SPAWN_PATTERNS,
|
|
13392
13017
|
/\buses:\s*["']?(?:actions\/setup-python|astral-sh\/setup-uv|astral-sh\/ruff-action|pypa\/[\w.-]+|snok\/install-poetry|abatilo\/actions-poetry|conda-incubator\/setup-miniconda|mamba-org\/setup-micromamba|pdm-project\/setup-pdm)\b/gu
|
|
13393
13018
|
];
|
|
13394
13019
|
const TOOL_PATTERNS$1 = [/^[ \t]*["']?(?:python|uv|pipx|poetry|ruff|pdm|hatch|pipx:[^"'\s=]+)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
13395
13020
|
const patternsFor = (entry) => {
|
|
13021
|
+
if (isProgramSource(entry)) return SPAWN_PATTERNS;
|
|
13396
13022
|
if (isToolVersions(entry)) return [...COMMAND_PATTERNS, ...TOOL_PATTERNS$1];
|
|
13397
13023
|
return COMMAND_PATTERNS;
|
|
13398
13024
|
};
|
|
@@ -13407,7 +13033,7 @@ const PYTHON = {
|
|
|
13407
13033
|
/** @internal */
|
|
13408
13034
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
13409
13035
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
13410
|
-
const WORKSPACE_FILE$
|
|
13036
|
+
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
13411
13037
|
const MANIFEST$1 = /(?:^|\/)package\.json$/u;
|
|
13412
13038
|
const CATALOG_PROTOCOL = "catalog:";
|
|
13413
13039
|
const DEFAULT_CATALOG = "default";
|
|
@@ -13416,25 +13042,25 @@ const WILDCARD = "*";
|
|
|
13416
13042
|
const FIRST_LINE$2 = 1;
|
|
13417
13043
|
const FIRST_COLUMN$1 = 1;
|
|
13418
13044
|
const SCOPED_NAME = /^(?<name>@?[^@]+)(?:@(?<versions>.+))?$/u;
|
|
13419
|
-
const READ_CONCURRENCY$
|
|
13045
|
+
const READ_CONCURRENCY$5 = 16;
|
|
13420
13046
|
const STALE_RULE = "stale-release-age-exclude";
|
|
13421
13047
|
const UNUSED_RULE = "unused-catalog-entry";
|
|
13422
13048
|
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.";
|
|
13423
13049
|
const UNUSED_MESSAGE = "is a catalog entry no package refers to. Remove it, so the catalog holds only versions in use.";
|
|
13424
|
-
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
13425
|
-
const decodeManifest$
|
|
13426
|
-
const decodeFields$
|
|
13427
|
-
const decodeString$
|
|
13050
|
+
const FieldsSchema$1 = Schema.Record(Schema.String, Schema.Unknown);
|
|
13051
|
+
const decodeManifest$4 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema$1));
|
|
13052
|
+
const decodeFields$2 = Schema.decodeUnknownOption(FieldsSchema$1);
|
|
13053
|
+
const decodeString$2 = Schema.decodeUnknownOption(Schema.String);
|
|
13428
13054
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13429
|
-
const fieldsOf$
|
|
13430
|
-
const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf$
|
|
13055
|
+
const fieldsOf$2 = (value) => Option.getOrElse(decodeFields$2(value), () => ({}));
|
|
13056
|
+
const entriesOf = (catalog) => (held) => pipe(Record.keys(fieldsOf$2(held)), Array.map((name) => ({
|
|
13431
13057
|
catalog,
|
|
13432
13058
|
name
|
|
13433
13059
|
})));
|
|
13434
|
-
const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(Record.toEntries(fieldsOf$
|
|
13060
|
+
const catalogEntries = (settings) => [...entriesOf(DEFAULT_CATALOG)(settings["catalog"]), ...pipe(Record.toEntries(fieldsOf$2(settings["catalogs"])), Array.flatMap(([catalog, held]) => entriesOf(catalog)(held)))];
|
|
13435
13061
|
const catalogOf = (specifier) => pipe(Option.liftPredicate(specifier, String$1.startsWith(CATALOG_PROTOCOL)), Option.map(String$1.slice(8)), Option.map((name) => Option.getOrElse(Option.liftPredicate(name, String$1.isNonEmpty), () => DEFAULT_CATALOG)));
|
|
13436
|
-
const referenceOf = ([name, specifier]) => pipe(decodeString$
|
|
13437
|
-
const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf$
|
|
13062
|
+
const referenceOf = ([name, specifier]) => pipe(decodeString$2(specifier), Option.flatMap(catalogOf), Option.map((catalog) => `${catalog}:${name}`), Option.toArray);
|
|
13063
|
+
const referencesIn = (manifest) => pipe(Record.values(manifest), Array.flatMap((section) => pipe(fieldsOf$2(section), Record.toEntries, Array.flatMap(referenceOf))));
|
|
13438
13064
|
const versionsOf = (raw) => pipe(Option.fromUndefinedOr(raw), Option.map((listed) => pipe(String$1.split(listed, VERSION_SEPARATOR), Array.map(String$1.trim))), Option.getOrElse(() => []));
|
|
13439
13065
|
const isLocked = (keys) => (resolved) => pipe(keys, Array.some((key) => key === resolved || String$1.startsWith(`${resolved}(`)(key)));
|
|
13440
13066
|
const hasPackage = (keys) => (name) => pipe(keys, Array.some(String$1.startsWith(`${name}@`)));
|
|
@@ -13450,18 +13076,18 @@ const lockedKeys = (root) => lockedPackages(root).pipe(Effect.orElseSucceed(() =
|
|
|
13450
13076
|
const usedReferences = Effect.fn("usedReferences")(function* usedReferences(root, settings) {
|
|
13451
13077
|
const files = yield* RepositoryFiles;
|
|
13452
13078
|
const listed = yield* files.listedFiles(root);
|
|
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$
|
|
13454
|
-
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$
|
|
13455
|
-
const fromOverrides = pipe(fieldsOf$
|
|
13079
|
+
const manifests = yield* Effect.forEach(pipe(listed, Array.filter((name) => MANIFEST$1.test(name))), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$5 });
|
|
13080
|
+
const fromManifests = pipe(Array.getSomes(manifests), Array.flatMap((text) => Option.toArray(decodeManifest$4(text))), Array.flatMap(referencesIn));
|
|
13081
|
+
const fromOverrides = pipe(fieldsOf$2(settings["overrides"]), Record.toEntries, Array.flatMap(referenceOf));
|
|
13456
13082
|
return /* @__PURE__ */ new Set([...fromManifests, ...fromOverrides]);
|
|
13457
13083
|
});
|
|
13458
13084
|
const lineOf$1 = (source) => (needle) => pipe(String$1.split(source, "\n"), Array.findFirstIndex((line) => needle.test(line)), Option.match({
|
|
13459
13085
|
onNone: () => FIRST_LINE$2,
|
|
13460
13086
|
onSome: (index) => index + FIRST_LINE$2
|
|
13461
13087
|
}));
|
|
13462
|
-
const quoted = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
13463
|
-
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "u");
|
|
13464
|
-
const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted(entry)}["']?\\s*$`, "u");
|
|
13088
|
+
const quoted$1 = (name) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(name);
|
|
13089
|
+
const entryLine = (name) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "u");
|
|
13090
|
+
const excludeLine = (entry) => new RegExp(`^\\s+-\\s+["']?${quoted$1(entry)}["']?\\s*$`, "u");
|
|
13465
13091
|
const problemAt$4 = ({ file, at }, rule, message) => (name, needle) => ({
|
|
13466
13092
|
file,
|
|
13467
13093
|
line: at(needle),
|
|
@@ -13490,7 +13116,7 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
|
|
|
13490
13116
|
const manifest = yield* workspaceManifest(root);
|
|
13491
13117
|
return yield* Option.match(manifest, {
|
|
13492
13118
|
onNone: () => Effect.succeed([]),
|
|
13493
|
-
onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$
|
|
13119
|
+
onSome: (settings) => findingsIn(root, files.join(root, WORKSPACE_FILE$4), fieldsOf$2(settings))
|
|
13494
13120
|
});
|
|
13495
13121
|
});
|
|
13496
13122
|
// src/features/check-skills/model/skill-entry.ts
|
|
@@ -13499,8 +13125,8 @@ const VISIBLE_RULE = "skill-source-visible";
|
|
|
13499
13125
|
const CONFIG_FILE = "vite.config.ts";
|
|
13500
13126
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
13501
13127
|
const SOURCE = "masseater/skills";
|
|
13502
|
-
const PRESET = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
|
|
13503
|
-
const START$
|
|
13128
|
+
const PRESET$1 = "github>masseater/masseater.dev//libs/vite-plus-adopt/renovate";
|
|
13129
|
+
const START$9 = 0;
|
|
13504
13130
|
const LOCAL_PREFIX = "./";
|
|
13505
13131
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
13506
13132
|
const Source = Schema.Struct({
|
|
@@ -13513,7 +13139,7 @@ const taggedError = Schema.TaggedError;
|
|
|
13513
13139
|
var SkillsConfigUnreadable = class extends taggedError()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
13514
13140
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
13515
13141
|
file,
|
|
13516
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
13142
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$9))),
|
|
13517
13143
|
rule,
|
|
13518
13144
|
message
|
|
13519
13145
|
});
|
|
@@ -13545,8 +13171,8 @@ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root
|
|
|
13545
13171
|
const files = yield* RepositoryFiles;
|
|
13546
13172
|
const file = files.join(root, RENOVATE_FILE$1);
|
|
13547
13173
|
const text = yield* files.readFile(file);
|
|
13548
|
-
if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
|
|
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}.`)];
|
|
13174
|
+
if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
|
|
13175
|
+
return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE}.`)];
|
|
13550
13176
|
});
|
|
13551
13177
|
/** @internal */
|
|
13552
13178
|
const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
|
|
@@ -13560,20 +13186,20 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
13560
13186
|
];
|
|
13561
13187
|
});
|
|
13562
13188
|
// src/features/check-skills/model/published-skills.ts
|
|
13563
|
-
const RULE$
|
|
13189
|
+
const RULE$10 = "published-skills";
|
|
13564
13190
|
const KEYWORD = "tanstack-intent";
|
|
13565
13191
|
const SKILLS = "skills";
|
|
13566
13192
|
const MANIFEST_FILE = "package.json";
|
|
13567
13193
|
const SKILL_FILE$1 = "SKILL.md";
|
|
13568
|
-
const FIRST$
|
|
13194
|
+
const FIRST$3 = 1;
|
|
13569
13195
|
const SUCCEEDED = 0;
|
|
13570
13196
|
const SYNC = "Run vp exec intent maintainer sync in the repository root.";
|
|
13571
13197
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
13572
13198
|
const problemAt$2 = (file, message) => ({
|
|
13573
13199
|
file,
|
|
13574
|
-
line: FIRST$
|
|
13575
|
-
column: FIRST$
|
|
13576
|
-
rule: RULE$
|
|
13200
|
+
line: FIRST$3,
|
|
13201
|
+
column: FIRST$3,
|
|
13202
|
+
rule: RULE$10,
|
|
13577
13203
|
message
|
|
13578
13204
|
});
|
|
13579
13205
|
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))));
|
|
@@ -13612,7 +13238,7 @@ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPu
|
|
|
13612
13238
|
return Array.flatten(problems);
|
|
13613
13239
|
});
|
|
13614
13240
|
// src/features/check-skills/model/skill-files.ts
|
|
13615
|
-
const RULE$
|
|
13241
|
+
const RULE$9 = "skill-file";
|
|
13616
13242
|
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
13617
13243
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
13618
13244
|
const MARKDOWN = ".md";
|
|
@@ -13628,10 +13254,10 @@ const FRAGMENT = /#.*$/u;
|
|
|
13628
13254
|
const GITHUB = "https://github.com/";
|
|
13629
13255
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
13630
13256
|
const BLANK = /\s+/u;
|
|
13631
|
-
const SEPARATOR$
|
|
13632
|
-
const START$
|
|
13633
|
-
const FIRST$
|
|
13634
|
-
const READ_CONCURRENCY$
|
|
13257
|
+
const SEPARATOR$3 = "/";
|
|
13258
|
+
const START$8 = 0;
|
|
13259
|
+
const FIRST$2 = 1;
|
|
13260
|
+
const READ_CONCURRENCY$4 = 16;
|
|
13635
13261
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
13636
13262
|
const Frontmatter = Schema.Struct({
|
|
13637
13263
|
name: Schema.optional(Schema.String),
|
|
@@ -13639,9 +13265,9 @@ const Frontmatter = Schema.Struct({
|
|
|
13639
13265
|
metadata: Schema.optional(Metadata)
|
|
13640
13266
|
});
|
|
13641
13267
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
13642
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
13268
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$8));
|
|
13643
13269
|
const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$2(yaml))));
|
|
13644
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
13270
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$8].length), Option.getOrElse(() => START$8));
|
|
13645
13271
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
13646
13272
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
13647
13273
|
const bodyStart = bodyStartOf(source);
|
|
@@ -13669,16 +13295,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
13669
13295
|
]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
|
|
13670
13296
|
file: skill.file,
|
|
13671
13297
|
...positionOf(skill.source)(index),
|
|
13672
|
-
rule: RULE$
|
|
13298
|
+
rule: RULE$9,
|
|
13673
13299
|
message
|
|
13674
13300
|
})));
|
|
13675
13301
|
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) => ({
|
|
13676
13302
|
target,
|
|
13677
|
-
index: found.index ?? START$
|
|
13303
|
+
index: found.index ?? START$8
|
|
13678
13304
|
})), Option.toArray);
|
|
13679
13305
|
const rangeOf$1 = (found) => {
|
|
13680
|
-
const start = found.index ?? START$
|
|
13681
|
-
return [start, start + found[START$
|
|
13306
|
+
const start = found.index ?? START$8;
|
|
13307
|
+
return [start, start + found[START$8].length];
|
|
13682
13308
|
};
|
|
13683
13309
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
|
|
13684
13310
|
const linksIn = (source) => {
|
|
@@ -13696,7 +13322,7 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
13696
13322
|
return pipe(missing, Array.map(({ target, index }) => ({
|
|
13697
13323
|
file,
|
|
13698
13324
|
...positionOf(source)(index),
|
|
13699
|
-
rule: RULE$
|
|
13325
|
+
rule: RULE$9,
|
|
13700
13326
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
13701
13327
|
})));
|
|
13702
13328
|
});
|
|
@@ -13704,15 +13330,15 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13704
13330
|
const files = yield* RepositoryFiles;
|
|
13705
13331
|
const file = files.join(root, name);
|
|
13706
13332
|
const directory = files.dirname(name);
|
|
13707
|
-
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$
|
|
13333
|
+
const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$3}`)));
|
|
13708
13334
|
const text = yield* files.readFile(file);
|
|
13709
13335
|
const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
|
|
13710
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
13336
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$4 });
|
|
13711
13337
|
const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
|
|
13712
13338
|
file: files.join(root, entry),
|
|
13713
|
-
line: FIRST$
|
|
13714
|
-
column: FIRST$
|
|
13715
|
-
rule: RULE$
|
|
13339
|
+
line: FIRST$2,
|
|
13340
|
+
column: FIRST$2,
|
|
13341
|
+
rule: RULE$9,
|
|
13716
13342
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
13717
13343
|
})));
|
|
13718
13344
|
return [
|
|
@@ -13729,7 +13355,7 @@ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
13729
13355
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
13730
13356
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13731
13357
|
const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name)));
|
|
13732
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$
|
|
13358
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$4 });
|
|
13733
13359
|
return Array.flatten(found);
|
|
13734
13360
|
});
|
|
13735
13361
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -13744,16 +13370,16 @@ const CARGO_SECTIONS = [
|
|
|
13744
13370
|
"dev-dependencies",
|
|
13745
13371
|
"build-dependencies"
|
|
13746
13372
|
];
|
|
13747
|
-
const decodeFields = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
13373
|
+
const decodeFields$1 = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
13748
13374
|
const decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
13749
|
-
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
13375
|
+
const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
|
|
13750
13376
|
const decodeVersioned = Schema.decodeUnknownOption(Schema.Struct({ version: Schema.String }));
|
|
13751
|
-
const decodeSpec = (value) => Option.orElse(decodeString(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
|
|
13377
|
+
const decodeSpec = (value) => Option.orElse(decodeString$1(value), () => Option.map(decodeVersioned(value), ({ version }) => version));
|
|
13752
13378
|
const PackageManager = Schema.String.check(Schema.isPattern(/^[^@]+@[^+]+/u));
|
|
13753
13379
|
const decodePackageManager = Schema.decodeUnknownOption(PackageManager);
|
|
13754
|
-
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
13755
|
-
const fieldOf = (name) => (value) => fieldsOf(value)[name];
|
|
13756
|
-
const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
13380
|
+
const fieldsOf$1 = (value) => Option.getOrElse(decodeFields$1(value), () => ({}));
|
|
13381
|
+
const fieldOf = (name) => (value) => fieldsOf$1(value)[name];
|
|
13382
|
+
const entriesIn = (section) => (held) => pipe(Record.toEntries(fieldsOf$1(held)), Array.flatMap(([name, value]) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
13757
13383
|
key: `${section}:${name}`,
|
|
13758
13384
|
name,
|
|
13759
13385
|
spec
|
|
@@ -13768,15 +13394,15 @@ const packageManagerOf = (value) => pipe(decodePackageManager(value), Option.map
|
|
|
13768
13394
|
};
|
|
13769
13395
|
}), Option.toArray);
|
|
13770
13396
|
const manifestEntries = (text) => {
|
|
13771
|
-
const manifest = fieldsOf(Option.getOrUndefined(decodeJson(text)));
|
|
13397
|
+
const manifest = fieldsOf$1(Option.getOrUndefined(decodeJson(text)));
|
|
13772
13398
|
return [...sectionsIn(MANIFEST_SECTIONS)(manifest), ...packageManagerOf(manifest["packageManager"])];
|
|
13773
13399
|
};
|
|
13774
|
-
const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
13400
|
+
const catalogsIn = (held) => pipe(Record.toEntries(fieldsOf$1(held)), Array.flatMap(([name, catalog]) => entriesIn(`catalogs.${name}`)(catalog)));
|
|
13775
13401
|
const workspaceEntries = (text) => {
|
|
13776
|
-
const settings = fieldsOf(Option.getOrUndefined(Option.liftThrowable(() => parse$2(text))()));
|
|
13402
|
+
const settings = fieldsOf$1(Option.getOrUndefined(Option.liftThrowable(() => parse$2(text))()));
|
|
13777
13403
|
return [...sectionsIn(["catalog", "overrides"])(settings), ...catalogsIn(settings["catalogs"])];
|
|
13778
13404
|
};
|
|
13779
|
-
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf), Option.getOrElse(() => ({})));
|
|
13405
|
+
const parseToml = (text) => pipe(Option.liftThrowable(() => getStaticTOMLValue(parseTOML(text)))(), Option.map(fieldsOf$1), Option.getOrElse(() => ({})));
|
|
13780
13406
|
const singleEntry = (key, value) => pipe(decodeSpec(value), Option.map((spec) => ({
|
|
13781
13407
|
key,
|
|
13782
13408
|
name: key,
|
|
@@ -13792,9 +13418,9 @@ const cargoEntries = (text) => {
|
|
|
13792
13418
|
};
|
|
13793
13419
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
13794
13420
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
13795
|
-
const RULE$
|
|
13421
|
+
const RULE$8 = "version-downgrade";
|
|
13796
13422
|
const DEFAULT_BASE = "origin/main";
|
|
13797
|
-
const READ_CONCURRENCY$
|
|
13423
|
+
const READ_CONCURRENCY$3 = 16;
|
|
13798
13424
|
const READERS = [
|
|
13799
13425
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
13800
13426
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -13818,7 +13444,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
13818
13444
|
file,
|
|
13819
13445
|
line: lineOf(text, entry),
|
|
13820
13446
|
column: FIRST_LINE$1,
|
|
13821
|
-
rule: RULE$
|
|
13447
|
+
rule: RULE$8,
|
|
13822
13448
|
message: message(old, entry)
|
|
13823
13449
|
})), Option.toArray)));
|
|
13824
13450
|
};
|
|
@@ -13844,7 +13470,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
13844
13470
|
before: read(before),
|
|
13845
13471
|
after: read(after)
|
|
13846
13472
|
})), Option.getOrElse(() => []));
|
|
13847
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
13473
|
+
}), { concurrency: READ_CONCURRENCY$3 });
|
|
13848
13474
|
return Array.flatten(found);
|
|
13849
13475
|
});
|
|
13850
13476
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -13853,9 +13479,13 @@ const AUTOMERGE_OFF = /["']?platformAutomerge["']?\s*:\s*false/gu;
|
|
|
13853
13479
|
const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)["']/gu;
|
|
13854
13480
|
const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
13855
13481
|
const CAP_RULE = "renovate-version-cap";
|
|
13856
|
-
const
|
|
13482
|
+
const PRESET_RULE = "renovate-msch-preset";
|
|
13483
|
+
const PRESET = "github>masseater/masseater.dev//libs/msch/renovate";
|
|
13484
|
+
const START$7 = 0;
|
|
13485
|
+
const READ_CONCURRENCY$2 = 16;
|
|
13857
13486
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
13858
13487
|
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.";
|
|
13488
|
+
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
13859
13489
|
const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
13860
13490
|
const problemsIn$4 = (file, source) => {
|
|
13861
13491
|
const at = positionOf(source);
|
|
@@ -13865,7 +13495,16 @@ const problemsIn$4 = (file, source) => {
|
|
|
13865
13495
|
rule,
|
|
13866
13496
|
message
|
|
13867
13497
|
})));
|
|
13868
|
-
return [
|
|
13498
|
+
return [
|
|
13499
|
+
...found(AUTOMERGE_OFF, AUTOMERGE_RULE, AUTOMERGE_MESSAGE),
|
|
13500
|
+
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
13501
|
+
...pipe([{
|
|
13502
|
+
file,
|
|
13503
|
+
...at(START$7),
|
|
13504
|
+
rule: PRESET_RULE,
|
|
13505
|
+
message: PRESET_MESSAGE
|
|
13506
|
+
}], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
13507
|
+
];
|
|
13869
13508
|
};
|
|
13870
13509
|
/** @internal */
|
|
13871
13510
|
const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* checkRenovateSettings(root) {
|
|
@@ -13877,24 +13516,24 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
13877
13516
|
onNone: () => [],
|
|
13878
13517
|
onSome: (source) => problemsIn$4(file, source)
|
|
13879
13518
|
})));
|
|
13880
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
13519
|
+
}, { concurrency: READ_CONCURRENCY$2 });
|
|
13881
13520
|
return Array.flatten(found);
|
|
13882
13521
|
});
|
|
13883
13522
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
13884
13523
|
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;
|
|
13885
13524
|
const NUL = "\0";
|
|
13886
|
-
const START$
|
|
13525
|
+
const START$6 = 0;
|
|
13887
13526
|
const HEX = 16;
|
|
13888
13527
|
const CODE_POINT_WIDTH = 4;
|
|
13889
|
-
const READ_CONCURRENCY = 64;
|
|
13890
|
-
const RULE$
|
|
13891
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
13528
|
+
const READ_CONCURRENCY$1 = 64;
|
|
13529
|
+
const RULE$7 = "hidden-unicode";
|
|
13530
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$6)(character), Option.getOrElse(() => START$6), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
13892
13531
|
const problemOf$1 = (file, source) => (found) => {
|
|
13893
|
-
const hex = hexOf(found[START$
|
|
13532
|
+
const hex = hexOf(found[START$6]);
|
|
13894
13533
|
return {
|
|
13895
13534
|
file,
|
|
13896
|
-
...positionOf(source)(found.index ?? START$
|
|
13897
|
-
rule: RULE$
|
|
13535
|
+
...positionOf(source)(found.index ?? START$6),
|
|
13536
|
+
rule: RULE$7,
|
|
13898
13537
|
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}.`
|
|
13899
13538
|
};
|
|
13900
13539
|
};
|
|
@@ -13912,29 +13551,29 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
13912
13551
|
onNone: () => [],
|
|
13913
13552
|
onSome: (source) => problemsIn$3(file, source)
|
|
13914
13553
|
})));
|
|
13915
|
-
}, { concurrency: READ_CONCURRENCY });
|
|
13554
|
+
}, { concurrency: READ_CONCURRENCY$1 });
|
|
13916
13555
|
return Array.flatten(found);
|
|
13917
13556
|
});
|
|
13918
13557
|
// src/features/find-unneeded-files/model/alchemy-patch.ts
|
|
13919
|
-
const RULE$
|
|
13920
|
-
const WORKSPACE_FILE$
|
|
13558
|
+
const RULE$6 = "alchemy-patch";
|
|
13559
|
+
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
13921
13560
|
const ALCHEMY$1 = /^(?:alchemy|@alchemy\.run\/[^@]+)(?:@.*)?$/u;
|
|
13922
|
-
const START$
|
|
13561
|
+
const START$5 = 0;
|
|
13923
13562
|
const problemOf = (file, position, name) => ({
|
|
13924
13563
|
file,
|
|
13925
13564
|
...position,
|
|
13926
|
-
rule: RULE$
|
|
13565
|
+
rule: RULE$6,
|
|
13927
13566
|
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.`
|
|
13928
13567
|
});
|
|
13929
13568
|
const problemsIn$2 = (file, patched) => (source) => {
|
|
13930
13569
|
const at = positionOf(source);
|
|
13931
|
-
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$
|
|
13570
|
+
const offsetOf = (name) => pipe(String$1.indexOf(name)(source), Option.getOrElse(() => START$5));
|
|
13932
13571
|
return pipe(patched, Array.filter((name) => ALCHEMY$1.test(name)), Array.map((name) => problemOf(file, at(offsetOf(name)), name)));
|
|
13933
13572
|
};
|
|
13934
13573
|
/** @internal */
|
|
13935
13574
|
const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyPatch(root) {
|
|
13936
13575
|
const files = yield* RepositoryFiles;
|
|
13937
|
-
const file = files.join(root, WORKSPACE_FILE$
|
|
13576
|
+
const file = files.join(root, WORKSPACE_FILE$3);
|
|
13938
13577
|
const text = yield* files.readFile(file);
|
|
13939
13578
|
const manifest = yield* workspaceManifest(root);
|
|
13940
13579
|
const patched = pipe(manifest, Option.flatMap(({ patchedDependencies }) => Option.fromUndefinedOr(patchedDependencies)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
@@ -13943,10 +13582,10 @@ const checkAlchemyPatch = Effect.fn("checkAlchemyPatch")(function* checkAlchemyP
|
|
|
13943
13582
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
13944
13583
|
const MSCH = "@r_masseater/msch";
|
|
13945
13584
|
const SCOPE$1 = "@r_masseater/";
|
|
13946
|
-
const RULE$
|
|
13947
|
-
const WORKSPACE_FILE$
|
|
13585
|
+
const RULE$5 = "applied-package";
|
|
13586
|
+
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
13948
13587
|
const NOT_FOUND = -1;
|
|
13949
|
-
const SEPARATOR$
|
|
13588
|
+
const SEPARATOR$2 = "/";
|
|
13950
13589
|
const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
|
|
13951
13590
|
const BinMap = Schema.Record(Schema.String, Schema.String);
|
|
13952
13591
|
const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
|
|
@@ -13960,7 +13599,7 @@ const declaredNames = (manifest) => pipe([
|
|
|
13960
13599
|
const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
|
|
13961
13600
|
onNone: () => [],
|
|
13962
13601
|
onSome: (bin) => {
|
|
13963
|
-
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$
|
|
13602
|
+
if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$2), Array.lastNonEmpty)];
|
|
13964
13603
|
return Record.keys(bin);
|
|
13965
13604
|
}
|
|
13966
13605
|
}));
|
|
@@ -13988,17 +13627,17 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
13988
13627
|
const problemAt$1 = (file, source) => (index, name) => ({
|
|
13989
13628
|
file,
|
|
13990
13629
|
...positionOf(source)(index),
|
|
13991
|
-
rule: RULE$
|
|
13630
|
+
rule: RULE$5,
|
|
13992
13631
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
13993
13632
|
});
|
|
13994
13633
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
13995
13634
|
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
13996
13635
|
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)))));
|
|
13997
|
-
const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$
|
|
13636
|
+
const ownerOf = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$2}`)(name)), Array.match({
|
|
13998
13637
|
onEmpty: () => "",
|
|
13999
13638
|
onNonEmpty: Array.max(BY_LENGTH)
|
|
14000
13639
|
}));
|
|
14001
|
-
const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$
|
|
13640
|
+
const isScannedSource = (entry) => isScannedText(entry) && !String$1.endsWith("package.json")(entry.name) && entry.name !== WORKSPACE_FILE$2;
|
|
14002
13641
|
const consumersIn = Effect.fn("consumersIn")(function* consumersIn(root, directories) {
|
|
14003
13642
|
const files = yield* RepositoryFiles;
|
|
14004
13643
|
return yield* pipe(directories, Effect.filter((directory) => readManifest(files.join(root, directory)).pipe(Effect.map(Option.exists((manifest) => manifest.name !== MSCH && Array.contains(declaredNames(manifest), MSCH))))));
|
|
@@ -14043,8 +13682,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
14043
13682
|
return yield* appliedPackageProblems(root, applied);
|
|
14044
13683
|
});
|
|
14045
13684
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
14046
|
-
const RULE$
|
|
14047
|
-
const FIRST = 1;
|
|
13685
|
+
const RULE$4 = "replaced-tool";
|
|
13686
|
+
const FIRST$1 = 1;
|
|
14048
13687
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
14049
13688
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
14050
13689
|
const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
|
|
@@ -14122,9 +13761,9 @@ const REPLACED = [
|
|
|
14122
13761
|
];
|
|
14123
13762
|
const problemFor = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
14124
13763
|
file,
|
|
14125
|
-
line: FIRST,
|
|
14126
|
-
column: FIRST,
|
|
14127
|
-
rule: RULE$
|
|
13764
|
+
line: FIRST$1,
|
|
13765
|
+
column: FIRST$1,
|
|
13766
|
+
rule: RULE$4,
|
|
14128
13767
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
14129
13768
|
})));
|
|
14130
13769
|
/** @internal */
|
|
@@ -14134,9 +13773,9 @@ const checkReplacedTools = Effect.fn("checkReplacedTools")(function* checkReplac
|
|
|
14134
13773
|
return pipe(present, Array.flatMap((entry) => Option.toArray(problemFor(entry))));
|
|
14135
13774
|
});
|
|
14136
13775
|
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
14137
|
-
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
13776
|
+
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
14138
13777
|
const PNPM_DIRECTORY = ".pnpm/";
|
|
14139
|
-
const SEPARATOR = "/";
|
|
13778
|
+
const SEPARATOR$1 = "/";
|
|
14140
13779
|
const FOREIGN_LOCKFILE = /(?:^|\/)(?:package-lock\.json|npm-shrinkwrap\.json|yarn\.lock|bun\.lockb?)$/u;
|
|
14141
13780
|
const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
|
|
14142
13781
|
const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
|
|
@@ -14153,7 +13792,7 @@ const SETUP_PATTERNS = [
|
|
|
14153
13792
|
];
|
|
14154
13793
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
14155
13794
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
14156
|
-
const START$
|
|
13795
|
+
const START$4 = 0;
|
|
14157
13796
|
const LAST_SEGMENT = 1;
|
|
14158
13797
|
const FIRST_LINE = 1;
|
|
14159
13798
|
const FIRST_COLUMN = 1;
|
|
@@ -14182,7 +13821,7 @@ const generatedCargoConfig = (entry, source) => {
|
|
|
14182
13821
|
if (String$1.isNonEmpty(String$1.trim(String$1.replaceAll(PNPM_CARGO_BLOCK, "")(source)))) return [];
|
|
14183
13822
|
return [pnpmCargoConfig(entry)];
|
|
14184
13823
|
};
|
|
14185
|
-
const cargoOutsidePnpm = problemAtStart(CARGO_RULE, `pnpm does not manage these crates. Set \`cargo: { enabled: true }\` in ${WORKSPACE_FILE} so pnpm install fetches the crates and the Rust toolchain.`);
|
|
13824
|
+
const cargoOutsidePnpm = problemAtStart(CARGO_RULE, `pnpm does not manage these crates. Set \`cargo: { enabled: true }\` in ${WORKSPACE_FILE$1} so pnpm install fetches the crates and the Rust toolchain.`);
|
|
14186
13825
|
const setupProblem = ({ file }, source, advice) => (found) => ({
|
|
14187
13826
|
file,
|
|
14188
13827
|
...positionOf(source)(found.index ?? WHOLE_MATCH),
|
|
@@ -14206,10 +13845,10 @@ const isCargoManifest = matches(CARGO_MANIFEST_FILE);
|
|
|
14206
13845
|
const isForeignLockfile = matches(FOREIGN_LOCKFILE);
|
|
14207
13846
|
const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
|
|
14208
13847
|
const isPnpmOutput = matches(PNPM_OUTPUT);
|
|
14209
|
-
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
|
|
13848
|
+
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
|
|
14210
13849
|
const ancestorsOf = (directory) => {
|
|
14211
|
-
const parts = String$1.split(directory, SEPARATOR);
|
|
14212
|
-
return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
|
|
13850
|
+
const parts = String$1.split(directory, SEPARATOR$1);
|
|
13851
|
+
return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR$1)), Array.filter((ancestor) => ancestor !== directory));
|
|
14213
13852
|
};
|
|
14214
13853
|
const readsCargoLock = (manifests, workspaces) => ({ name }) => {
|
|
14215
13854
|
const directory = directoryOf(name);
|
|
@@ -14223,7 +13862,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
14223
13862
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
14224
13863
|
return directoriesOf(roots);
|
|
14225
13864
|
});
|
|
14226
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
13865
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$4), (end) => String$1.slice(START$4, end)(name));
|
|
14227
13866
|
const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
|
|
14228
13867
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
14229
13868
|
const cargoProblems = (present, enabled) => {
|
|
@@ -14258,24 +13897,87 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
14258
13897
|
if (Option.isNone(workspace)) return [];
|
|
14259
13898
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
14260
13899
|
});
|
|
13900
|
+
// src/features/check-exact-versions/model/exact-versions.ts
|
|
13901
|
+
const RULE$3 = "version-range";
|
|
13902
|
+
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
13903
|
+
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
13904
|
+
const PROTOCOL = /^[a-z+]+:/u;
|
|
13905
|
+
const PATH_LIKE = "/";
|
|
13906
|
+
const START$3 = 0;
|
|
13907
|
+
const SECTIONS = [
|
|
13908
|
+
"dependencies",
|
|
13909
|
+
"devDependencies",
|
|
13910
|
+
"optionalDependencies"
|
|
13911
|
+
];
|
|
13912
|
+
const EXCLUDED$2 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
13913
|
+
const MESSAGE = "is a range. The lockfile decides the version anyway, so a range only lets the next install move it without a diff. Write the exact version the lockfile resolves; `msch-publish` widens `dependencies` and `peerDependencies` to `^` in the published package.";
|
|
13914
|
+
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
13915
|
+
const decodeFields = Schema.decodeUnknownOption(FieldsSchema);
|
|
13916
|
+
const decodeManifest$3 = Schema.decodeUnknownOption(Schema.fromJsonString(FieldsSchema));
|
|
13917
|
+
const decodeString = Schema.decodeUnknownOption(Schema.String);
|
|
13918
|
+
const fieldsOf = (value) => Option.getOrElse(decodeFields(value), () => ({}));
|
|
13919
|
+
const versionOf = (specifier) => Option.getOrElse(groupOf$2("version")(ALIAS.exec(specifier)), () => specifier);
|
|
13920
|
+
/** @internal */
|
|
13921
|
+
const isRange = (specifier) => {
|
|
13922
|
+
const version = versionOf(specifier);
|
|
13923
|
+
return !PROTOCOL.test(version) && !String$1.includes(PATH_LIKE)(version) && semver.valid(version) === null;
|
|
13924
|
+
};
|
|
13925
|
+
const specifiedIn = (held) => pipe(fieldsOf(held), Record.toEntries, Array.flatMap(([name, value]) => pipe(decodeString(value), Option.map((specifier) => ({
|
|
13926
|
+
name,
|
|
13927
|
+
specifier
|
|
13928
|
+
})), Option.toArray)));
|
|
13929
|
+
const quoted = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.raw`\$&`)(text);
|
|
13930
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$3));
|
|
13931
|
+
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array.filter(({ specifier }) => isRange(specifier)), Array.map((range) => ({
|
|
13932
|
+
file,
|
|
13933
|
+
...positionOf(source)(offsetIn(source)(pattern(range))),
|
|
13934
|
+
rule: RULE$3,
|
|
13935
|
+
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
13936
|
+
})));
|
|
13937
|
+
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted(name)}"\\s*:\\s*"${quoted(specifier)}"`, "u");
|
|
13938
|
+
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted(name)}["']?:`, "mu");
|
|
13939
|
+
const manifestProblems$1 = (entry, source) => pipe(decodeManifest$3(source), Option.map((manifest) => pipe(SECTIONS, Array.flatMap((section) => specifiedIn(manifest[section])), problemsFor(entry.file, source, manifestPattern))), Option.getOrElse(() => []));
|
|
13940
|
+
const catalogSpecifiers = (settings) => [...specifiedIn(settings["catalog"]), ...pipe(fieldsOf(settings["catalogs"]), Record.values, Array.flatMap(specifiedIn))];
|
|
13941
|
+
const catalogProblems = Effect.fn("catalogProblems")(function* catalogProblems(root) {
|
|
13942
|
+
const files = yield* RepositoryFiles;
|
|
13943
|
+
const file = files.join(root, WORKSPACE_FILE);
|
|
13944
|
+
const settings = yield* workspaceManifest(root);
|
|
13945
|
+
const source = yield* files.readFile(file);
|
|
13946
|
+
return pipe(Option.all({
|
|
13947
|
+
settings,
|
|
13948
|
+
source
|
|
13949
|
+
}), Option.map(({ settings: held, source: text }) => problemsFor(file, text, catalogPattern)(catalogSpecifiers(fieldsOf(held)))), Option.getOrElse(() => []));
|
|
13950
|
+
});
|
|
13951
|
+
/** @internal */
|
|
13952
|
+
const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactVersions(root) {
|
|
13953
|
+
const files = yield* RepositoryFiles;
|
|
13954
|
+
const manifests = yield* files.matchingFiles(root, [`:(glob)**/${MANIFEST_FILE$3}`, ...EXCLUDED$2]);
|
|
13955
|
+
const listed = pipe(manifests, Array.map((name) => ({
|
|
13956
|
+
name,
|
|
13957
|
+
file: files.join(root, name)
|
|
13958
|
+
})));
|
|
13959
|
+
const fromManifests = yield* scanText(listed, manifestProblems$1);
|
|
13960
|
+
const fromCatalogs = yield* catalogProblems(root);
|
|
13961
|
+
return [...fromManifests, ...fromCatalogs];
|
|
13962
|
+
});
|
|
14261
13963
|
// src/features/check-package-scope/model/package-scope.ts
|
|
14262
|
-
const RULE$
|
|
13964
|
+
const RULE$2 = "package-scope";
|
|
14263
13965
|
const SCOPE = "@r_masseater/";
|
|
14264
13966
|
const NAME_KEY = "\"name\"";
|
|
14265
|
-
const START$
|
|
13967
|
+
const START$2 = 0;
|
|
14266
13968
|
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14267
|
-
const Manifest$
|
|
13969
|
+
const Manifest$2 = Schema.Struct({
|
|
14268
13970
|
name: Schema.optional(Schema.String),
|
|
14269
13971
|
private: Schema.optional(Schema.Boolean),
|
|
14270
13972
|
publishConfig: Schema.optional(Schema.Unknown)
|
|
14271
13973
|
});
|
|
14272
|
-
const decodeManifest$
|
|
13974
|
+
const decodeManifest$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$2));
|
|
14273
13975
|
const isPublished$1 = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14274
13976
|
const unscopedName = (manifest) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(SCOPE)(name)));
|
|
14275
|
-
const problemsIn$1 = (entry, source) => pipe(decodeManifest$
|
|
13977
|
+
const problemsIn$1 = (entry, source) => pipe(decodeManifest$2(source), Option.filter(isPublished$1), Option.flatMap(unscopedName), Option.map((name) => ({
|
|
14276
13978
|
file: entry.file,
|
|
14277
|
-
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$
|
|
14278
|
-
rule: RULE$
|
|
13979
|
+
...positionOf(source)(pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$2))),
|
|
13980
|
+
rule: RULE$2,
|
|
14279
13981
|
message: `Packages are published only under the ${SCOPE} scope. Rename "${name}" to "${SCOPE}${String$1.replace(/^@[^/]+\//u, "")(name)}".`
|
|
14280
13982
|
})), Option.toArray);
|
|
14281
13983
|
/** @internal */
|
|
@@ -14288,7 +13990,7 @@ const checkPackageScope = Effect.fn("checkPackageScope")(function* checkPackageS
|
|
|
14288
13990
|
}))), problemsIn$1);
|
|
14289
13991
|
});
|
|
14290
13992
|
// src/features/check-runtime-version/model/node-version.ts
|
|
14291
|
-
const RULE = "node-version";
|
|
13993
|
+
const RULE$1 = "node-version";
|
|
14292
13994
|
const MINIMUM = 26;
|
|
14293
13995
|
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
14294
13996
|
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
@@ -14302,15 +14004,15 @@ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t
|
|
|
14302
14004
|
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
14303
14005
|
const ALTERNATIVE = "||";
|
|
14304
14006
|
const ENGINES_KEY = "\"engines\"";
|
|
14305
|
-
const START = 0;
|
|
14007
|
+
const START$1 = 0;
|
|
14306
14008
|
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
14307
14009
|
const Engines = Schema.Struct({ node: Schema.optional(Schema.String) });
|
|
14308
|
-
const Manifest = Schema.Struct({
|
|
14010
|
+
const Manifest$1 = Schema.Struct({
|
|
14309
14011
|
private: Schema.optional(Schema.Boolean),
|
|
14310
14012
|
publishConfig: Schema.optional(Schema.Unknown),
|
|
14311
14013
|
engines: Schema.optional(Engines)
|
|
14312
14014
|
});
|
|
14313
|
-
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
14015
|
+
const decodeManifest$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest$1));
|
|
14314
14016
|
const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
|
|
14315
14017
|
const isOld = (major) => major < MINIMUM;
|
|
14316
14018
|
const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
|
|
@@ -14322,14 +14024,14 @@ const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array.some
|
|
|
14322
14024
|
const problemAt = ({ entry, source, index }, message) => ({
|
|
14323
14025
|
file: entry.file,
|
|
14324
14026
|
...positionOf(source)(index),
|
|
14325
|
-
rule: RULE,
|
|
14027
|
+
rule: RULE$1,
|
|
14326
14028
|
message
|
|
14327
14029
|
});
|
|
14328
|
-
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START));
|
|
14030
|
+
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$1));
|
|
14329
14031
|
const unstatedProblem = (entry, source) => problemAt({
|
|
14330
14032
|
entry,
|
|
14331
14033
|
source,
|
|
14332
|
-
index: START
|
|
14034
|
+
index: START$1
|
|
14333
14035
|
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
14334
14036
|
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
14335
14037
|
entry,
|
|
@@ -14339,7 +14041,7 @@ const rangeProblem = (entry, source) => (range) => problemAt({
|
|
|
14339
14041
|
const isPublished = (manifest) => manifest.private !== true && Predicate.isNotUndefined(manifest.publishConfig);
|
|
14340
14042
|
const rangeOf = (manifest) => pipe(Option.fromUndefinedOr(manifest.engines), Option.flatMap(({ node }) => Option.fromUndefinedOr(node)));
|
|
14341
14043
|
const manifestProblems = (entry, source) => {
|
|
14342
|
-
const manifest = decodeManifest(source);
|
|
14044
|
+
const manifest = decodeManifest$1(source);
|
|
14343
14045
|
if (Option.isNone(manifest)) return [];
|
|
14344
14046
|
const range = rangeOf(manifest.value);
|
|
14345
14047
|
if (Option.isNone(range) && isPublished(manifest.value)) return [unstatedProblem(entry, source)];
|
|
@@ -14348,12 +14050,12 @@ const manifestProblems = (entry, source) => {
|
|
|
14348
14050
|
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
14051
|
entry,
|
|
14350
14052
|
source,
|
|
14351
|
-
index: found.index ?? START
|
|
14352
|
-
}, `${SUPPORTED} \`${String$1.trim(found[START])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
14053
|
+
index: found.index ?? START$1
|
|
14054
|
+
}, `${SUPPORTED} \`${String$1.trim(found[START$1])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
14353
14055
|
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
14354
14056
|
entry,
|
|
14355
14057
|
source,
|
|
14356
|
-
index: START
|
|
14058
|
+
index: START$1
|
|
14357
14059
|
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
14358
14060
|
const problemsIn = (entry, source) => {
|
|
14359
14061
|
if (MANIFEST.test(entry.name)) return manifestProblems(entry, source);
|
|
@@ -14374,10 +14076,127 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
|
|
|
14374
14076
|
})))];
|
|
14375
14077
|
return yield* scanText(sources, problemsIn);
|
|
14376
14078
|
});
|
|
14079
|
+
// src/features/check-unused-workspaces/model/unused-workspaces.ts
|
|
14080
|
+
const RULE = "unused-workspace";
|
|
14081
|
+
const CARGO_FILE = "Cargo.toml";
|
|
14082
|
+
const ROOT_DIRECTORY = "";
|
|
14083
|
+
const TASK_SEPARATOR = "#";
|
|
14084
|
+
const SEPARATOR = "/";
|
|
14085
|
+
const START = 0;
|
|
14086
|
+
const FIRST = 1;
|
|
14087
|
+
const READ_CONCURRENCY = 8;
|
|
14088
|
+
const LIBRARY_KINDS = [
|
|
14089
|
+
"lib",
|
|
14090
|
+
"rlib",
|
|
14091
|
+
"proc-macro"
|
|
14092
|
+
];
|
|
14093
|
+
const PROGRAM_KINDS = [
|
|
14094
|
+
"bin",
|
|
14095
|
+
"cdylib",
|
|
14096
|
+
"staticlib",
|
|
14097
|
+
"dylib"
|
|
14098
|
+
];
|
|
14099
|
+
const Manifest = Schema.Struct({
|
|
14100
|
+
name: Schema.optional(Schema.String),
|
|
14101
|
+
private: Schema.optional(Schema.Boolean),
|
|
14102
|
+
exports: Schema.optional(Schema.Unknown),
|
|
14103
|
+
main: Schema.optional(Schema.Unknown),
|
|
14104
|
+
bin: Schema.optional(Schema.Unknown)
|
|
14105
|
+
});
|
|
14106
|
+
const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
|
|
14107
|
+
const isDependedOn = (links) => ({ directory }) => pipe(links, Array.some(({ from, to }) => to === directory && from !== directory));
|
|
14108
|
+
const isKind = (kinds) => (kind) => Array.contains(kinds, kind);
|
|
14109
|
+
const isLibraryCrate = ({ kinds }) => pipe(kinds, Array.some(isKind(LIBRARY_KINDS))) && !pipe(kinds, Array.some(isKind(PROGRAM_KINDS)));
|
|
14110
|
+
const NO_CARGO = {
|
|
14111
|
+
libraries: [],
|
|
14112
|
+
links: []
|
|
14113
|
+
};
|
|
14114
|
+
const cargoFacts = Effect.fn("cargoFacts")(function* cargoFacts(root, directories) {
|
|
14115
|
+
const files = yield* RepositoryFiles;
|
|
14116
|
+
if (!(yield* files.exists(files.join(root, CARGO_FILE)))) return NO_CARGO;
|
|
14117
|
+
const crates = yield* cratesIn(root);
|
|
14118
|
+
const ownerOf = (path) => owningWorkspace(directories)(files.relative(root, path));
|
|
14119
|
+
const linksOf = (manifest, paths) => {
|
|
14120
|
+
const owner = ownerOf(files.dirname(manifest));
|
|
14121
|
+
const linkTo = (path) => Option.zipWith(owner, ownerOf(path), (from, to) => ({
|
|
14122
|
+
from,
|
|
14123
|
+
to
|
|
14124
|
+
}));
|
|
14125
|
+
return pipe(paths, Array.flatMap((path) => Option.toArray(linkTo(path))));
|
|
14126
|
+
};
|
|
14127
|
+
return {
|
|
14128
|
+
libraries: pipe(crates, Array.filter(isLibraryCrate), Array.flatMap(({ manifest }) => Option.toArray(ownerOf(files.dirname(manifest))))),
|
|
14129
|
+
links: pipe(crates, Array.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)))
|
|
14130
|
+
};
|
|
14131
|
+
});
|
|
14132
|
+
const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START, at)(text)), Option.filter(String$1.isNonEmpty));
|
|
14133
|
+
const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directory) {
|
|
14134
|
+
const config = yield* workspaceConfigOf(root, directory);
|
|
14135
|
+
return pipe(config, Option.map(({ program }) => pipe(nestedValues(RUN_TASKS)(program), Array.flatMap(stringsIn), Array.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))))), Option.getOrElse(() => []));
|
|
14136
|
+
});
|
|
14137
|
+
const isWithin = (directory) => (file) => String$1.startsWith(`${directory}${SEPARATOR}`)(file);
|
|
14138
|
+
const memberOf = Effect.fn("memberOf")(function* memberOf(request) {
|
|
14139
|
+
const { root, directory, crateLibraries, deployed } = request;
|
|
14140
|
+
const files = yield* RepositoryFiles;
|
|
14141
|
+
const text = yield* files.readFile(files.join(root, directory, MANIFEST_FILE$3));
|
|
14142
|
+
return pipe(text, Option.flatMap(decodeManifest), Option.map((manifest) => ({
|
|
14143
|
+
directory,
|
|
14144
|
+
name: Option.fromUndefinedOr(manifest.name),
|
|
14145
|
+
library: Predicate.isNotUndefined(manifest.exports) || Predicate.isNotUndefined(manifest.main) || Array.contains(crateLibraries, directory),
|
|
14146
|
+
entry: manifest.private !== true || Predicate.isNotUndefined(manifest.bin) || pipe(deployed, Array.some(isWithin(directory)))
|
|
14147
|
+
})));
|
|
14148
|
+
});
|
|
14149
|
+
const linksTo = (members, from) => (name) => pipe(members, Array.filter((member) => Option.contains(member.name, name)), Array.map(({ directory }) => ({
|
|
14150
|
+
from,
|
|
14151
|
+
to: directory
|
|
14152
|
+
})));
|
|
14153
|
+
const taskLinks = Effect.fn("taskLinks")(function* taskLinks(root, members) {
|
|
14154
|
+
const sources = [ROOT_DIRECTORY, ...pipe(members, Array.map(({ directory }) => directory))];
|
|
14155
|
+
const found = yield* Effect.forEach(sources, (from) => {
|
|
14156
|
+
const toLinks = Array.flatMap(linksTo(members, from));
|
|
14157
|
+
return taskTargets(root, from).pipe(Effect.map(toLinks));
|
|
14158
|
+
}, { concurrency: READ_CONCURRENCY });
|
|
14159
|
+
return Array.flatten(found);
|
|
14160
|
+
});
|
|
14161
|
+
/** @internal */
|
|
14162
|
+
const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* checkUnusedWorkspaces(root) {
|
|
14163
|
+
const files = yield* RepositoryFiles;
|
|
14164
|
+
const directories = yield* workspaceDirectories(root);
|
|
14165
|
+
const [cargo, deployed, lockedLinks] = yield* Effect.all([
|
|
14166
|
+
cargoFacts(root, directories),
|
|
14167
|
+
deployEntries(root),
|
|
14168
|
+
workspaceLinks(root)
|
|
14169
|
+
], { concurrency: "unbounded" });
|
|
14170
|
+
const found = yield* Effect.forEach(directories, (directory) => memberOf({
|
|
14171
|
+
root,
|
|
14172
|
+
directory,
|
|
14173
|
+
crateLibraries: cargo.libraries,
|
|
14174
|
+
deployed
|
|
14175
|
+
}), { concurrency: READ_CONCURRENCY });
|
|
14176
|
+
const members = Array.getSomes(found);
|
|
14177
|
+
const tasks = yield* taskLinks(root, members);
|
|
14178
|
+
const links = [
|
|
14179
|
+
...lockedLinks,
|
|
14180
|
+
...cargo.links,
|
|
14181
|
+
...tasks
|
|
14182
|
+
];
|
|
14183
|
+
return pipe(members, Array.filter(({ library, entry }) => library && !entry), Array.filter((member) => !isDependedOn(links)(member)), Array.map(({ directory }) => ({
|
|
14184
|
+
file: files.join(root, directory, MANIFEST_FILE$3),
|
|
14185
|
+
line: FIRST,
|
|
14186
|
+
column: FIRST,
|
|
14187
|
+
rule: RULE,
|
|
14188
|
+
message: `${directory} is a private library, and no other workspace depends on it through package.json, a Cargo path dependency or a task. Delete it, or depend on it from the code that uses it.`
|
|
14189
|
+
})));
|
|
14190
|
+
});
|
|
14377
14191
|
// src/app/manifest-checks.ts
|
|
14378
14192
|
/** @internal */
|
|
14379
14193
|
const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root) {
|
|
14380
|
-
const found = yield* Effect.all([
|
|
14194
|
+
const found = yield* Effect.all([
|
|
14195
|
+
checkNodeVersion(root),
|
|
14196
|
+
checkPackageScope(root),
|
|
14197
|
+
checkUnusedWorkspaces(root),
|
|
14198
|
+
checkExactVersions(root)
|
|
14199
|
+
], { concurrency: "unbounded" });
|
|
14381
14200
|
return Array.flatten(found);
|
|
14382
14201
|
});
|
|
14383
14202
|
// src/app/tracked-text.ts
|