@r_masseater/msch 0.130.0 → 0.131.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +925 -387
- package/dist/cli.mjs.map +1 -1
- package/dist/config-B3SYjao5.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +2 -2
- package/dist/decision-rules.d.mts +1 -1
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-PLWK5HYf.mjs → define-lint-preset-D3jb88wH.mjs} +1 -2
- package/dist/define-lint-preset-D3jb88wH.mjs.map +1 -0
- package/dist/{index-BUNJ7vH_.d.mts → index-CJ-DPimM.d.mts} +0 -1
- package/dist/lint.d.mts +1 -1
- package/dist/lint.mjs +1 -1
- package/dist/{repository-text-Dy8EkFIh.mjs → repository-text-muPQZel7.mjs} +2 -2
- package/dist/{repository-text-Dy8EkFIh.mjs.map → repository-text-muPQZel7.mjs.map} +1 -1
- package/package.json +1 -1
- package/skills/msch-checks/SKILL.md +1 -1
- package/skills/msch-publishing/SKILL.md +1 -1
- package/skills/msch-repository-config/SKILL.md +1 -1
- package/skills/msch-workspace-settings/SKILL.md +1 -1
- package/dist/define-lint-preset-PLWK5HYf.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { decodePackageJson, decodeVersionedPackageJson, readPackageJson, readRaw
|
|
|
14
14
|
import { a as workspaceConfigs, c as publicEntriesOf, d as FRONTMATTER, f as splitFrontmatter, g as deployEntries, h as bundledEntries$1, i as publishedWorkspaces, l as modDirectories, m as workspaceLinks, o as entryNameOf, r as packedWorkspaces, s as isBinEntry, u as INDEX_SKILL, v as shadcnUiOf } from "./published-BdMq0wXq.mjs";
|
|
15
15
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
16
16
|
import { i as USAGE_SPOOL, n as DECISION_TIMEOUT_MS, r as JAPANESE, t as DECISION_MODEL } from "./config-B3SYjao5.mjs";
|
|
17
|
-
import { c as forgetBuilt, d as existsAt, g as patternOf$1, h as namedWorkspaces, i as GIT_HOOKS, l as lastBuilt, p as isIgnored, s as MDLCT_BIN, t as BUILT_ALLOWANCES } from "./repository-text-
|
|
17
|
+
import { c as forgetBuilt, d as existsAt, g as patternOf$1, h as namedWorkspaces, i as GIT_HOOKS, l as lastBuilt, p as isIgnored, s as MDLCT_BIN, t as BUILT_ALLOWANCES } from "./repository-text-muPQZel7.mjs";
|
|
18
18
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
19
19
|
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
20
20
|
import { t as startedOnce } from "./started-once-BN_hLlmU.mjs";
|
|
@@ -23,11 +23,10 @@ import { rolldown } from "rolldown";
|
|
|
23
23
|
import { stripVTControlCharacters } from "node:util";
|
|
24
24
|
import { builtinModules, isBuiltin as isBuiltin$1 } from "node:module";
|
|
25
25
|
import semver from "semver";
|
|
26
|
-
import { g as decisionTestRules, p as lint$3, x as exempt } from "./define-lint-preset-
|
|
26
|
+
import { g as decisionTestRules, p as lint$3, x as exempt } from "./define-lint-preset-D3jb88wH.mjs";
|
|
27
27
|
import { NO_PATH, describeReference, diagnosticDetail, linksIn as linksIn$1, lint, markdownPathspecs, referenceOf as referenceOf$2, y8Section } from "@r_masseater/y8";
|
|
28
28
|
import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
|
|
29
|
-
import { Parser, isPair, isScalar, parse as parse$1, parseDocument, visit as visit$1 } from "yaml";
|
|
30
|
-
import { VpToolsError, findCiDrift, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
29
|
+
import { Parser, isMap, isNode, isPair, isScalar, isSeq, parse as parse$1, parseDocument, visit as visit$1 } from "yaml";
|
|
31
30
|
import { fu4Section, lint as lint$2, workflowPathspecs } from "@r_masseater/fu4";
|
|
32
31
|
import { isComment, isTag, isText } from "domhandler";
|
|
33
32
|
import { DomUtils, parseDocument as parseDocument$1 } from "htmlparser2";
|
|
@@ -40,16 +39,18 @@ import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
|
|
|
40
39
|
import { runMainWith } from "@r_masseater/masseater-utils/node-main";
|
|
41
40
|
import { sdkAgentQuery } from "@r_masseater/masseater-utils/agent-query";
|
|
42
41
|
import { dual } from "effect/Function";
|
|
42
|
+
import { readWorkspaceManifest as readWorkspaceManifest$1 } from "@pnpm/workspace.workspace-manifest-reader";
|
|
43
43
|
import { judgeText } from "@r_masseater/oxlint-plugin-decision";
|
|
44
44
|
import { finished, mustSucceed, outputOf, succeeds, writeOutputs } from "@r_masseater/masseater-utils/github-workflow";
|
|
45
45
|
import { CALLS_METRIC, mergeTallies, talliesIn, usageMetricsOf } from "@r_masseater/masseater-utils/usage-meter/report";
|
|
46
46
|
import { Base64 } from "effect/encoding";
|
|
47
47
|
import { arch, platform } from "node:os";
|
|
48
|
+
import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
48
49
|
import { Buffer } from "node:buffer";
|
|
49
50
|
import { createZstdDecompress } from "node:zlib";
|
|
50
51
|
// package.json
|
|
51
52
|
var name = "@r_masseater/msch";
|
|
52
|
-
var version = "0.
|
|
53
|
+
var version = "0.131.1";
|
|
53
54
|
var homepage = "https://github.com/masseater/ecosystems/tree/main/libs/msch#readme";
|
|
54
55
|
var repository = {
|
|
55
56
|
"type": "git",
|
|
@@ -65,9 +66,9 @@ const rootFlags = {
|
|
|
65
66
|
...hookFlags
|
|
66
67
|
};
|
|
67
68
|
// src/app/output.ts
|
|
68
|
-
const taggedError$
|
|
69
|
+
const taggedError$16 = Schema.TaggedError;
|
|
69
70
|
const NO_PROBLEMS$2 = 0;
|
|
70
|
-
var ProblemsFound = class extends taggedError$
|
|
71
|
+
var ProblemsFound = class extends taggedError$16()("ProblemsFound", { count: Schema.Finite }) {
|
|
71
72
|
[Runtime.errorReported] = false;
|
|
72
73
|
};
|
|
73
74
|
/** @internal */
|
|
@@ -785,10 +786,10 @@ const namesSkill = (skill) => (text) => new RegExp(namePattern(skill), "u").test
|
|
|
785
786
|
const SKILLS_START = "<!-- skills:generated -->";
|
|
786
787
|
const SKILLS_END = "<!-- /skills:generated -->";
|
|
787
788
|
// src/shared/lib/text-position.ts
|
|
788
|
-
const START$
|
|
789
|
+
const START$37 = 0;
|
|
789
790
|
const FIRST_COLUMN$8 = 1;
|
|
790
791
|
const positionOf = (source) => (index) => {
|
|
791
|
-
const before = pipe(source, String$1.slice(START$
|
|
792
|
+
const before = pipe(source, String$1.slice(START$37, index), String$1.split("\n"));
|
|
792
793
|
return {
|
|
793
794
|
line: before.length,
|
|
794
795
|
column: pipe(Array$1.last(before), Option.match({
|
|
@@ -948,8 +949,8 @@ const RESOLUTION_FILES = [
|
|
|
948
949
|
];
|
|
949
950
|
const RESOLUTION_CONCURRENCY = 2;
|
|
950
951
|
const SUCCEEDED$1 = 0;
|
|
951
|
-
const taggedError$
|
|
952
|
-
var OverrideResolutionFailed = class extends taggedError$
|
|
952
|
+
const taggedError$15 = Schema.TaggedError;
|
|
953
|
+
var OverrideResolutionFailed = class extends taggedError$15()("OverrideResolutionFailed", {
|
|
953
954
|
override: Schema.String,
|
|
954
955
|
output: Schema.String
|
|
955
956
|
}) {};
|
|
@@ -1067,7 +1068,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
1067
1068
|
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;
|
|
1068
1069
|
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
1069
1070
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
1070
|
-
const READ_CONCURRENCY$
|
|
1071
|
+
const READ_CONCURRENCY$41 = 64;
|
|
1071
1072
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
1072
1073
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
1073
1074
|
/** @internal */
|
|
@@ -1090,56 +1091,72 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, foundIn) {
|
|
|
1090
1091
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
1091
1092
|
onNone: () => [],
|
|
1092
1093
|
onSome: (source) => foundIn(entry, source)
|
|
1093
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1094
|
+
}))), { concurrency: READ_CONCURRENCY$41 });
|
|
1095
|
+
return Array$1.flatten(found);
|
|
1096
|
+
});
|
|
1097
|
+
/** @internal */
|
|
1098
|
+
const problemsInFiles = Effect.fn("problemsInFiles")(function* problemsInFiles(root, names, problemsIn) {
|
|
1099
|
+
const files = yield* RepositoryFiles;
|
|
1100
|
+
const found = yield* Effect.forEach(names, (name) => {
|
|
1101
|
+
const file = files.join(root, name);
|
|
1102
|
+
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
1103
|
+
onNone: () => [],
|
|
1104
|
+
onSome: (source) => problemsIn({
|
|
1105
|
+
file,
|
|
1106
|
+
name,
|
|
1107
|
+
source
|
|
1108
|
+
})
|
|
1109
|
+
})));
|
|
1110
|
+
}, { concurrency: READ_CONCURRENCY$41 });
|
|
1094
1111
|
return Array$1.flatten(found);
|
|
1095
1112
|
});
|
|
1096
1113
|
// src/features/check-overrides/model/git-subpath.ts
|
|
1097
1114
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
1098
1115
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
1099
|
-
const RULE$
|
|
1116
|
+
const RULE$83 = "git-subpath-dependency";
|
|
1100
1117
|
const WHOLE_MATCH$4 = 0;
|
|
1101
1118
|
const problemAt$5 = ({ file }, source) => (found) => ({
|
|
1102
1119
|
file,
|
|
1103
1120
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
1104
|
-
rule: RULE$
|
|
1121
|
+
rule: RULE$83,
|
|
1105
1122
|
message: `Git subpath dependencies are banned. Publish the package to npm and depend on a released version instead of \`${String$1.trim(found[WHOLE_MATCH$4])}\`.`
|
|
1106
1123
|
});
|
|
1107
|
-
const problemsIn$
|
|
1124
|
+
const problemsIn$25 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array$1.map(problemAt$5(entry, source)));
|
|
1108
1125
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
1109
1126
|
/** @internal */
|
|
1110
1127
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
1111
1128
|
const listed = yield* listedFiles(root);
|
|
1112
|
-
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$
|
|
1129
|
+
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$25);
|
|
1113
1130
|
});
|
|
1114
1131
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
1115
|
-
const RULE$
|
|
1132
|
+
const RULE$82 = "unnamed-restriction";
|
|
1116
1133
|
const WHOLE_MATCH$3 = 0;
|
|
1117
1134
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-[a-z]+(?:-[a-z]+)*\\b`, "gu");
|
|
1118
|
-
const problemsIn$
|
|
1135
|
+
const problemsIn$24 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(UNNAMED)(source)), Array$1.map((found) => ({
|
|
1119
1136
|
file: entry.file,
|
|
1120
1137
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
1121
|
-
rule: RULE$
|
|
1138
|
+
rule: RULE$82,
|
|
1122
1139
|
message: `${found[WHOLE_MATCH$3]} is not used in this repository, because its name does not say what an entry protects. Ban a package in dependencyRules.banned, and write any other restriction as a rule in msch-lint whose name states the intent.`
|
|
1123
1140
|
})));
|
|
1124
1141
|
/** @internal */
|
|
1125
1142
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
1126
1143
|
const listed = yield* listedFiles(root);
|
|
1127
|
-
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$
|
|
1144
|
+
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$24);
|
|
1128
1145
|
});
|
|
1129
1146
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
1130
|
-
const RULE$
|
|
1147
|
+
const RULE$81 = "named-type-exemption";
|
|
1131
1148
|
const WHOLE_MATCH$2 = 0;
|
|
1132
1149
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
1133
|
-
const problemsIn$
|
|
1150
|
+
const problemsIn$23 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array$1.map((found) => ({
|
|
1134
1151
|
file: entry.file,
|
|
1135
1152
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
1136
|
-
rule: RULE$
|
|
1153
|
+
rule: RULE$81,
|
|
1137
1154
|
message: "exempts a type from a lint rule by its name. Such a list is written by hand for every dependency and only grows. msch-lint/readonly-parameters reads where each type is declared and exempts the types of packages and of the language by itself, so remove the entry. For another rule, add a rule to msch-lint that reads the declaration."
|
|
1138
1155
|
})));
|
|
1139
1156
|
/** @internal */
|
|
1140
1157
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
1141
1158
|
const listed = yield* listedFiles(root);
|
|
1142
|
-
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$
|
|
1159
|
+
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$23);
|
|
1143
1160
|
});
|
|
1144
1161
|
// src/shared/lib/registries.ts
|
|
1145
1162
|
const TRAILING_SLASH$1 = /\/*$/u;
|
|
@@ -1149,37 +1166,37 @@ const INSTALL_REGISTRY = "https://npm.flatt.tech/";
|
|
|
1149
1166
|
const withTrailingSlash = (url) => `${String$1.replace(TRAILING_SLASH$1, "")(url)}/`;
|
|
1150
1167
|
const scopeOfName = (name) => pipe(Option.liftPredicate(name, String$1.startsWith("@")), Option.flatMap((scoped) => pipe(String$1.indexOf(SCOPE_SEPARATOR)(scoped), Option.map((end) => String$1.takeLeft(scoped, end + 1)))));
|
|
1151
1168
|
// src/features/check-overrides/model/package-registry.ts
|
|
1152
|
-
const RULE$
|
|
1169
|
+
const RULE$80 = "package-registry";
|
|
1153
1170
|
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
1154
1171
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
1155
1172
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
1156
1173
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
1157
|
-
const START$
|
|
1174
|
+
const START$36 = 0;
|
|
1158
1175
|
const REASON$4 = `Installs go through Takumi Guard (${INSTALL_REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
1159
1176
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
1160
1177
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
1161
|
-
const isRequired = (found) => withTrailingSlash(found) === INSTALL_REGISTRY;
|
|
1162
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
1178
|
+
const isRequired$1 = (found) => withTrailingSlash(found) === INSTALL_REGISTRY;
|
|
1179
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$36));
|
|
1163
1180
|
const workspaceProblem = ({ file, source }, registry) => ({
|
|
1164
1181
|
file,
|
|
1165
1182
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
1166
|
-
rule: RULE$
|
|
1183
|
+
rule: RULE$80,
|
|
1167
1184
|
message: Option.match(registry, {
|
|
1168
1185
|
onNone: () => `${REASON$4} Set \`registry: ${INSTALL_REGISTRY}\` in ${WORKSPACE_FILE$6}.`,
|
|
1169
1186
|
onSome: (value) => `${REASON$4} \`registry\` is ${value}. Set it to ${INSTALL_REGISTRY}.`
|
|
1170
1187
|
})
|
|
1171
1188
|
});
|
|
1172
|
-
const npmrcProblems = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array$1.filter((found) => !Option.exists(groupOf("value")(found), isRequired)), Array$1.map((found) => ({
|
|
1189
|
+
const npmrcProblems = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array$1.filter((found) => !Option.exists(groupOf("value")(found), isRequired$1)), Array$1.map((found) => ({
|
|
1173
1190
|
file: entry.file,
|
|
1174
|
-
...positionOf(source)(found.index ?? START$
|
|
1175
|
-
rule: RULE$
|
|
1176
|
-
message: `${REASON$4} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
1191
|
+
...positionOf(source)(found.index ?? START$36),
|
|
1192
|
+
rule: RULE$80,
|
|
1193
|
+
message: `${REASON$4} This .npmrc overrides it with \`${String$1.trim(found[START$36])}\`. Remove the line.`
|
|
1177
1194
|
})));
|
|
1178
1195
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
1179
1196
|
const files = yield* RepositoryFiles;
|
|
1180
1197
|
const manifest = yield* workspaceManifest(root);
|
|
1181
1198
|
const registry = pipe(manifest, Option.flatMap(registryOf));
|
|
1182
|
-
const guarded = registry.pipe(Option.getOrElse(() => PUBLIC_REGISTRY), isRequired);
|
|
1199
|
+
const guarded = registry.pipe(Option.getOrElse(() => PUBLIC_REGISTRY), isRequired$1);
|
|
1183
1200
|
if (Option.isNone(manifest) || guarded) return [];
|
|
1184
1201
|
const file = files.join(root, WORKSPACE_FILE$6);
|
|
1185
1202
|
const read = yield* files.readFile(file);
|
|
@@ -1222,7 +1239,7 @@ const renovatePresetOf = Effect.fn("renovatePresetOf")(function* renovatePresetO
|
|
|
1222
1239
|
// src/entities/package/model/stack-catalog.ts
|
|
1223
1240
|
const STACK_CATALOG = "catalog:stack";
|
|
1224
1241
|
// src/entities/package/model/specifiers.ts
|
|
1225
|
-
const START$
|
|
1242
|
+
const START$35 = 0;
|
|
1226
1243
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
1227
1244
|
const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
|
|
1228
1245
|
const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
|
|
@@ -1240,7 +1257,7 @@ const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.ra
|
|
|
1240
1257
|
/** @internal */
|
|
1241
1258
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
1242
1259
|
/** @internal */
|
|
1243
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
1260
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$35));
|
|
1244
1261
|
const SECTIONS$1 = [
|
|
1245
1262
|
"dependencies",
|
|
1246
1263
|
"devDependencies",
|
|
@@ -1401,11 +1418,12 @@ const GITHUB$5 = "https://github.com/";
|
|
|
1401
1418
|
const SELF_NAME = name;
|
|
1402
1419
|
const SELF_HOMEPAGE = homepage;
|
|
1403
1420
|
const SELF_DIRECTORY = repository.directory;
|
|
1404
|
-
const
|
|
1421
|
+
const SELF_REPOSITORY = pipe(repository.url, String$1.replace(GIT_PREFIX, ""), String$1.replace(GIT_SUFFIX, ""), String$1.replace(GITHUB$5, ""));
|
|
1422
|
+
const RENOVATE_PRESET = `github>${SELF_REPOSITORY}//${SELF_DIRECTORY}/renovate`;
|
|
1405
1423
|
/** @internal */
|
|
1406
1424
|
const RENOVATE_PRESET_SETTINGS = renovate_default;
|
|
1407
1425
|
// src/features/check-overrides/model/removed-peers.ts
|
|
1408
|
-
const RULE$
|
|
1426
|
+
const RULE$79 = "removed-peer";
|
|
1409
1427
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
1410
1428
|
const REMOVED = "-";
|
|
1411
1429
|
const PARENT_SEPARATOR = ">";
|
|
@@ -1432,7 +1450,7 @@ const problemAt$4 = (file, { key, line, column }) => ({ peer, dependent }) => ({
|
|
|
1432
1450
|
file,
|
|
1433
1451
|
line,
|
|
1434
1452
|
column,
|
|
1435
|
-
rule: RULE$
|
|
1453
|
+
rule: RULE$79,
|
|
1436
1454
|
message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
|
|
1437
1455
|
});
|
|
1438
1456
|
const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
|
|
@@ -3570,7 +3588,7 @@ const matcher = (patterns) => {
|
|
|
3570
3588
|
String$1.startsWith(NEGATION$1);
|
|
3571
3589
|
String$1.slice(1);
|
|
3572
3590
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
3573
|
-
const RULE$
|
|
3591
|
+
const RULE$78 = "colocated-git-patterns";
|
|
3574
3592
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
3575
3593
|
const ROOT$3 = ".";
|
|
3576
3594
|
const NEGATION = "!";
|
|
@@ -3580,8 +3598,8 @@ const FLOATING_PREFIX = `${ANY_DEPTH}/`;
|
|
|
3580
3598
|
const LEADING_SLASHES = /^\/+/u;
|
|
3581
3599
|
const TRAILING_SLASHES = /\/+$/u;
|
|
3582
3600
|
const SPACES = /\s+/u;
|
|
3583
|
-
const FIRST$
|
|
3584
|
-
const READ_CONCURRENCY$
|
|
3601
|
+
const FIRST$28 = 1;
|
|
3602
|
+
const READ_CONCURRENCY$40 = 16;
|
|
3585
3603
|
const withoutPrefix = (prefix, text) => {
|
|
3586
3604
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
3587
3605
|
return text;
|
|
@@ -3605,7 +3623,7 @@ const entryOf$2 = (file, kind, directory) => (line, index) => {
|
|
|
3605
3623
|
file,
|
|
3606
3624
|
kind,
|
|
3607
3625
|
directory,
|
|
3608
|
-
line: index + FIRST$
|
|
3626
|
+
line: index + FIRST$28,
|
|
3609
3627
|
pattern,
|
|
3610
3628
|
values: Array$1.join(values, " ")
|
|
3611
3629
|
});
|
|
@@ -3617,12 +3635,12 @@ const entriesIn$2 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
3617
3635
|
const toEntry = entryOf$2(absolute, files.basename(file), files.dirname(file));
|
|
3618
3636
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array$1.map(toEntry), Array$1.getSomes);
|
|
3619
3637
|
});
|
|
3620
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
3638
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$78)(entry.file, {
|
|
3621
3639
|
line: entry.line,
|
|
3622
|
-
column: FIRST$
|
|
3640
|
+
column: FIRST$28
|
|
3623
3641
|
}, message);
|
|
3624
3642
|
const misplacedMessage = (kind, workspaces) => {
|
|
3625
|
-
if (workspaces.length === FIRST$
|
|
3643
|
+
if (workspaces.length === FIRST$28) {
|
|
3626
3644
|
const workspace = Array$1.join(workspaces, "");
|
|
3627
3645
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
3628
3646
|
}
|
|
@@ -3672,17 +3690,17 @@ const repeated = (entries) => (entry) => {
|
|
|
3672
3690
|
/** @internal */
|
|
3673
3691
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
3674
3692
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
3675
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$2(root, file), { concurrency: READ_CONCURRENCY$
|
|
3693
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$2(root, file), { concurrency: READ_CONCURRENCY$40 });
|
|
3676
3694
|
const entries = Array$1.flatten(read);
|
|
3677
3695
|
const workspaces = yield* workspaceDirectories(root);
|
|
3678
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
3696
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$40 });
|
|
3679
3697
|
const repeatedFound = pipe(entries, Array$1.map(repeated(entries)));
|
|
3680
3698
|
return Array$1.getSomes([...misplacedFound, ...repeatedFound]);
|
|
3681
3699
|
});
|
|
3682
3700
|
// src/features/check-placement/model/colocated-tests.ts
|
|
3683
|
-
const RULE$
|
|
3684
|
-
const FIRST$
|
|
3685
|
-
const READ_CONCURRENCY$
|
|
3701
|
+
const RULE$77 = "colocated-test";
|
|
3702
|
+
const FIRST$27 = 1;
|
|
3703
|
+
const READ_CONCURRENCY$39 = 64;
|
|
3686
3704
|
const ROOT_SUBPATH$1 = ".";
|
|
3687
3705
|
const NAME_GROUP$2 = "name";
|
|
3688
3706
|
const SPECIFIER_GROUP = "specifier";
|
|
@@ -3701,9 +3719,9 @@ const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test n
|
|
|
3701
3719
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
3702
3720
|
const problemFor$11 = (test, message) => ({
|
|
3703
3721
|
file: test.file,
|
|
3704
|
-
line: FIRST$
|
|
3705
|
-
column: FIRST$
|
|
3706
|
-
rule: RULE$
|
|
3722
|
+
line: FIRST$27,
|
|
3723
|
+
column: FIRST$27,
|
|
3724
|
+
rule: RULE$77,
|
|
3707
3725
|
message: `${test.base} ${message}`
|
|
3708
3726
|
});
|
|
3709
3727
|
const groupsOf$1 = (source, pattern, group) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((match) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap((groups) => Option.fromUndefinedOr(groups[group])))), Array$1.getSomes);
|
|
@@ -3766,12 +3784,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
3766
3784
|
directory: files.dirname(file)
|
|
3767
3785
|
};
|
|
3768
3786
|
}));
|
|
3769
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$
|
|
3787
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$39 });
|
|
3770
3788
|
return Array$1.getSomes(found);
|
|
3771
3789
|
});
|
|
3772
3790
|
// src/shared/lib/agent-docs.ts
|
|
3773
3791
|
const AGENT_DOC$1 = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
3774
|
-
const READ_CONCURRENCY$
|
|
3792
|
+
const READ_CONCURRENCY$38 = 16;
|
|
3775
3793
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
3776
3794
|
const files = yield* RepositoryFiles;
|
|
3777
3795
|
const listed = yield* files.listedFiles(root);
|
|
@@ -3780,32 +3798,32 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
3780
3798
|
const file = files.join(root, name);
|
|
3781
3799
|
const problemOf = Option.flatMap(problemIn(file));
|
|
3782
3800
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
3783
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
3801
|
+
}, { concurrency: READ_CONCURRENCY$38 });
|
|
3784
3802
|
return Array$1.getSomes(found);
|
|
3785
3803
|
});
|
|
3786
3804
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
3787
3805
|
const RECOMMENDED_LINES = 200;
|
|
3788
|
-
const FIRST$
|
|
3789
|
-
const RULE$
|
|
3806
|
+
const FIRST$26 = 1;
|
|
3807
|
+
const RULE$76 = "agent-docs-length";
|
|
3790
3808
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
3791
3809
|
const problemFor$10 = (file) => (lines) => {
|
|
3792
3810
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
3793
3811
|
return Option.some({
|
|
3794
3812
|
file,
|
|
3795
3813
|
line: 201,
|
|
3796
|
-
column: FIRST$
|
|
3797
|
-
rule: RULE$
|
|
3814
|
+
column: FIRST$26,
|
|
3815
|
+
rule: RULE$76,
|
|
3798
3816
|
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.`
|
|
3799
3817
|
});
|
|
3800
3818
|
};
|
|
3801
3819
|
/** @internal */
|
|
3802
3820
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$10(file)(lineCount(source)));
|
|
3803
3821
|
// src/features/check-placement/model/claude-link.ts
|
|
3804
|
-
const RULE$
|
|
3822
|
+
const RULE$75 = "claude-md-link";
|
|
3805
3823
|
const CLAUDE = "CLAUDE.md";
|
|
3806
3824
|
const AGENTS = "AGENTS.md";
|
|
3807
|
-
const FIRST$
|
|
3808
|
-
const READ_CONCURRENCY$
|
|
3825
|
+
const FIRST$25 = 1;
|
|
3826
|
+
const READ_CONCURRENCY$37 = 16;
|
|
3809
3827
|
const MESSAGE$15 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
3810
3828
|
/** @internal */
|
|
3811
3829
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
@@ -3818,21 +3836,21 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3818
3836
|
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
3819
3837
|
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
3820
3838
|
file: path,
|
|
3821
|
-
line: FIRST$
|
|
3822
|
-
column: FIRST$
|
|
3823
|
-
rule: RULE$
|
|
3839
|
+
line: FIRST$25,
|
|
3840
|
+
column: FIRST$25,
|
|
3841
|
+
rule: RULE$75,
|
|
3824
3842
|
message: MESSAGE$15
|
|
3825
3843
|
})));
|
|
3826
3844
|
});
|
|
3827
3845
|
const claude = pipe(listed, Array$1.filter((name) => files.basename(name) === CLAUDE));
|
|
3828
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
3846
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$37 });
|
|
3829
3847
|
return Array$1.getSomes(found);
|
|
3830
3848
|
});
|
|
3831
3849
|
// src/features/check-placement/model/dangling-links.ts
|
|
3832
|
-
const RULE$
|
|
3850
|
+
const RULE$74 = "dangling-link";
|
|
3833
3851
|
const SEPARATOR$26 = "/";
|
|
3834
|
-
const FIRST$
|
|
3835
|
-
const READ_CONCURRENCY$
|
|
3852
|
+
const FIRST$24 = 1;
|
|
3853
|
+
const READ_CONCURRENCY$36 = 16;
|
|
3836
3854
|
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$26}`)(name);
|
|
3837
3855
|
/** @internal */
|
|
3838
3856
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
@@ -3843,18 +3861,18 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
3843
3861
|
const link = yield* files.readLink(file);
|
|
3844
3862
|
return pipe(link, Option.map((target) => files.relative(root, files.resolve(files.dirname(file), target))), Option.filter((target) => !pipe(listed, Array$1.some(holds(target)))), Option.map((target) => ({
|
|
3845
3863
|
file,
|
|
3846
|
-
line: FIRST$
|
|
3847
|
-
column: FIRST$
|
|
3848
|
-
rule: RULE$
|
|
3864
|
+
line: FIRST$24,
|
|
3865
|
+
column: FIRST$24,
|
|
3866
|
+
rule: RULE$74,
|
|
3849
3867
|
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.`
|
|
3850
3868
|
})));
|
|
3851
3869
|
});
|
|
3852
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
3870
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$36 });
|
|
3853
3871
|
return Array$1.getSomes(found);
|
|
3854
3872
|
});
|
|
3855
3873
|
// src/features/check-placement/model/member-sources.ts
|
|
3856
3874
|
const ROOT_WORKSPACE$1 = ".";
|
|
3857
|
-
const FIRST$
|
|
3875
|
+
const FIRST$23 = 1;
|
|
3858
3876
|
const SEPARATOR$25 = "/";
|
|
3859
3877
|
const EXCLUDED$7 = [
|
|
3860
3878
|
":(exclude,attr:linguist-vendored)",
|
|
@@ -3875,8 +3893,8 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
3875
3893
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
3876
3894
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
3877
3895
|
file,
|
|
3878
|
-
line: FIRST$
|
|
3879
|
-
column: FIRST$
|
|
3896
|
+
line: FIRST$23,
|
|
3897
|
+
column: FIRST$23,
|
|
3880
3898
|
rule,
|
|
3881
3899
|
message
|
|
3882
3900
|
});
|
|
@@ -3903,9 +3921,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
3903
3921
|
}));
|
|
3904
3922
|
});
|
|
3905
3923
|
// src/features/check-placement/model/deployed-readme.ts
|
|
3906
|
-
const RULE$
|
|
3924
|
+
const RULE$73 = "deployed-readme";
|
|
3907
3925
|
const ROOT_DIRECTORY$4 = "";
|
|
3908
|
-
const READ_CONCURRENCY$
|
|
3926
|
+
const READ_CONCURRENCY$35 = 16;
|
|
3909
3927
|
const MISSING_MESSAGE$3 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
3910
3928
|
const NO_URL_MESSAGE = "has no https:// URL. This workspace has an Alchemy stack that serves an address, so link the URL it is served at.";
|
|
3911
3929
|
const ADDRESS_KEYS = [
|
|
@@ -3943,14 +3961,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
3943
3961
|
const readme = yield* readReadme({
|
|
3944
3962
|
root,
|
|
3945
3963
|
directory,
|
|
3946
|
-
rule: RULE$
|
|
3964
|
+
rule: RULE$73,
|
|
3947
3965
|
missingMessage: MISSING_MESSAGE$3
|
|
3948
3966
|
});
|
|
3949
3967
|
return Result.match(readme, {
|
|
3950
3968
|
onFailure: Option.some,
|
|
3951
3969
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
3952
3970
|
file,
|
|
3953
|
-
rule: RULE$
|
|
3971
|
+
rule: RULE$73,
|
|
3954
3972
|
message: NO_URL_MESSAGE
|
|
3955
3973
|
})))
|
|
3956
3974
|
});
|
|
@@ -3961,26 +3979,26 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
3961
3979
|
const listed = yield* files.listedFiles(root);
|
|
3962
3980
|
const directories = yield* workspaceDirectories(root);
|
|
3963
3981
|
const candidates = pipe(listed, Array$1.filter((file) => STACK_FILE.test(file)));
|
|
3964
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
3982
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$35 });
|
|
3965
3983
|
const owners = pipe(deploying, Array$1.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array$1.dedupe);
|
|
3966
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
3984
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$35 });
|
|
3967
3985
|
return Array$1.getSomes(found);
|
|
3968
3986
|
});
|
|
3969
3987
|
// src/features/check-placement/model/nested-docs.ts
|
|
3970
|
-
const RULE$
|
|
3988
|
+
const RULE$72 = "nested-docs";
|
|
3971
3989
|
const CONFIG_FILE$9 = "vite.config.ts";
|
|
3972
3990
|
const SEPARATOR$24 = "/";
|
|
3973
|
-
const READ_CONCURRENCY$
|
|
3991
|
+
const READ_CONCURRENCY$34 = 64;
|
|
3974
3992
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
3975
3993
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
3976
3994
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
3977
3995
|
const MANIFEST$4 = "package.json";
|
|
3978
3996
|
const MISSING_RULE = "workspace-agents-md";
|
|
3979
3997
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
3980
|
-
const taggedError$
|
|
3981
|
-
var RootConfigUnreadable = class extends taggedError$
|
|
3998
|
+
const taggedError$14 = Schema.TaggedError;
|
|
3999
|
+
var RootConfigUnreadable = class extends taggedError$14()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
3982
4000
|
const isNested = (name) => String$1.includes(SEPARATOR$24)(name);
|
|
3983
|
-
const problemFor$9 = problemInFile(RULE$
|
|
4001
|
+
const problemFor$9 = problemInFile(RULE$72);
|
|
3984
4002
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
3985
4003
|
const WORKSPACE_AGENT_DOCS_MESSAGE = "belongs only at the repository root or as AGENTS.md directly in a workspace, the directory that holds its package.json. Move what agents need there and delete this file.";
|
|
3986
4004
|
const MISSING_MESSAGE$2 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
@@ -4027,7 +4045,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
4027
4045
|
workspaces: pipe(directories, Array$1.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
4028
4046
|
workspaceAgentDocs
|
|
4029
4047
|
};
|
|
4030
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
4048
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$34 });
|
|
4031
4049
|
const missing = missingProblems({
|
|
4032
4050
|
required: workspaceAgentDocs,
|
|
4033
4051
|
directories: pipe(directories, Array$1.map((directory) => files.join(root, directory))),
|
|
@@ -4037,15 +4055,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
4037
4055
|
return [...Array$1.getSomes(found), ...missing];
|
|
4038
4056
|
});
|
|
4039
4057
|
// src/features/check-placement/model/published-readme.ts
|
|
4040
|
-
const RULE$
|
|
4041
|
-
const READ_CONCURRENCY$
|
|
4058
|
+
const RULE$71 = "published-readme";
|
|
4059
|
+
const READ_CONCURRENCY$33 = 16;
|
|
4042
4060
|
const MESSAGE$14 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
4043
4061
|
const MISSING_MESSAGE$1 = "is missing. This package is published to npm, so give it an English README.md.";
|
|
4044
4062
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
4045
4063
|
const readme = yield* readReadme({
|
|
4046
4064
|
root,
|
|
4047
4065
|
directory,
|
|
4048
|
-
rule: RULE$
|
|
4066
|
+
rule: RULE$71,
|
|
4049
4067
|
missingMessage: MISSING_MESSAGE$1
|
|
4050
4068
|
});
|
|
4051
4069
|
return Result.match(readme, {
|
|
@@ -4056,7 +4074,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
4056
4074
|
file,
|
|
4057
4075
|
line,
|
|
4058
4076
|
column,
|
|
4059
|
-
rule: RULE$
|
|
4077
|
+
rule: RULE$71,
|
|
4060
4078
|
message: MESSAGE$14
|
|
4061
4079
|
};
|
|
4062
4080
|
}))
|
|
@@ -4065,11 +4083,11 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
4065
4083
|
/** @internal */
|
|
4066
4084
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
4067
4085
|
const projects = yield* publishedProjects(root);
|
|
4068
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$
|
|
4086
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$33 });
|
|
4069
4087
|
return Array$1.getSomes(found);
|
|
4070
4088
|
});
|
|
4071
4089
|
// src/features/check-placement/model/published-tests.ts
|
|
4072
|
-
const RULE$
|
|
4090
|
+
const RULE$70 = "published-tests";
|
|
4073
4091
|
const FILE_START = 1;
|
|
4074
4092
|
const TEST_FILE$3 = /\.test\.[cm]?[jt]sx?$/u;
|
|
4075
4093
|
const MESSAGE$13 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
@@ -4083,7 +4101,7 @@ const problemFor$8 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
4083
4101
|
file: files.join(absolute, PACKAGE_JSON_FILE),
|
|
4084
4102
|
line: FILE_START,
|
|
4085
4103
|
column: FILE_START,
|
|
4086
|
-
rule: RULE$
|
|
4104
|
+
rule: RULE$70,
|
|
4087
4105
|
message: MESSAGE$13
|
|
4088
4106
|
});
|
|
4089
4107
|
});
|
|
@@ -4097,9 +4115,9 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
4097
4115
|
return Array$1.getSomes(found);
|
|
4098
4116
|
});
|
|
4099
4117
|
// src/features/check-placement/model/root-docs.ts
|
|
4100
|
-
const RULE$
|
|
4118
|
+
const RULE$69 = "root-docs";
|
|
4101
4119
|
const SEPARATOR$23 = "/";
|
|
4102
|
-
const FIRST$
|
|
4120
|
+
const FIRST$22 = 1;
|
|
4103
4121
|
const MARKDOWN$7 = /\.(?:md|mdx|markdown)$/iu;
|
|
4104
4122
|
const ALLOWED$1 = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
4105
4123
|
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.";
|
|
@@ -4110,17 +4128,17 @@ const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
|
4110
4128
|
const names = yield* files.listedFiles(root);
|
|
4111
4129
|
return pipe(names, Array$1.filter(isStrayRootDoc), Array$1.map((name) => ({
|
|
4112
4130
|
file: files.join(root, name),
|
|
4113
|
-
line: FIRST$
|
|
4114
|
-
column: FIRST$
|
|
4115
|
-
rule: RULE$
|
|
4131
|
+
line: FIRST$22,
|
|
4132
|
+
column: FIRST$22,
|
|
4133
|
+
rule: RULE$69,
|
|
4116
4134
|
message: `${name} ${MESSAGE$12}`
|
|
4117
4135
|
})));
|
|
4118
4136
|
});
|
|
4119
4137
|
// src/features/check-placement/model/root-readme.ts
|
|
4120
|
-
const RULE$
|
|
4138
|
+
const RULE$68 = "root-readme";
|
|
4121
4139
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
4122
|
-
const READ_CONCURRENCY$
|
|
4123
|
-
const START$
|
|
4140
|
+
const READ_CONCURRENCY$32 = 16;
|
|
4141
|
+
const START$34 = 0;
|
|
4124
4142
|
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
4125
4143
|
const RELATIVE$4 = /^\.\//u;
|
|
4126
4144
|
const MarketplacePlugin = Schema.Struct({
|
|
@@ -4156,17 +4174,17 @@ const patternFor = (plugins) => ({ directory, names }) => Array$1.findFirst(plug
|
|
|
4156
4174
|
onNone: () => ownNames(plugins, names),
|
|
4157
4175
|
onSome: () => [directory]
|
|
4158
4176
|
}), patternOf$1);
|
|
4159
|
-
const problemsIn$
|
|
4177
|
+
const problemsIn$22 = (file, source, plugins) => (workspace) => {
|
|
4160
4178
|
const message = messageFor$5(workspace.directory);
|
|
4161
4179
|
const at = positionOf(source);
|
|
4162
4180
|
const pattern = patternFor(plugins)(workspace);
|
|
4163
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$
|
|
4181
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$68)(file, at(found.index ?? START$34), message)));
|
|
4164
4182
|
};
|
|
4165
4183
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
4166
4184
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
4167
4185
|
return pipe(text, Option.match({
|
|
4168
4186
|
onNone: () => [],
|
|
4169
|
-
onSome: (source) => pipe(workspaces, Array$1.flatMap(problemsIn$
|
|
4187
|
+
onSome: (source) => pipe(workspaces, Array$1.flatMap(problemsIn$22(file, source, plugins)))
|
|
4170
4188
|
}));
|
|
4171
4189
|
});
|
|
4172
4190
|
/** @internal */
|
|
@@ -4177,7 +4195,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
4177
4195
|
const named = yield* namedWorkspaces(root);
|
|
4178
4196
|
const workspaces = pipe(named, Array$1.filter((workspace) => !isCheckPolicy(workspace)));
|
|
4179
4197
|
const plugins = yield* marketplacePlugins(root);
|
|
4180
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
4198
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$32 });
|
|
4181
4199
|
return Array$1.flatten(found);
|
|
4182
4200
|
});
|
|
4183
4201
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -4197,10 +4215,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
4197
4215
|
return Array$1.flatten(found);
|
|
4198
4216
|
});
|
|
4199
4217
|
// src/features/check-placement/model/docs-mirror.ts
|
|
4200
|
-
const RULE$
|
|
4218
|
+
const RULE$67 = "docs-mirror";
|
|
4201
4219
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
4202
4220
|
const MIRROR_LIMIT = 3;
|
|
4203
|
-
const READ_CONCURRENCY$
|
|
4221
|
+
const READ_CONCURRENCY$31 = 16;
|
|
4204
4222
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
4205
4223
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
4206
4224
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -4222,7 +4240,7 @@ const problemFor$7 = (file, source, mentions) => pipe(Array$1.head(mentions), Op
|
|
|
4222
4240
|
file,
|
|
4223
4241
|
line,
|
|
4224
4242
|
column,
|
|
4225
|
-
rule: RULE$
|
|
4243
|
+
rule: RULE$67,
|
|
4226
4244
|
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.`
|
|
4227
4245
|
};
|
|
4228
4246
|
}), Option.toArray);
|
|
@@ -4237,7 +4255,7 @@ const workspacesOf$1 = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
4237
4255
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
4238
4256
|
directory,
|
|
4239
4257
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
4240
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
4258
|
+
}))), { concurrency: READ_CONCURRENCY$31 });
|
|
4241
4259
|
});
|
|
4242
4260
|
/** @internal */
|
|
4243
4261
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -4250,13 +4268,13 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
4250
4268
|
onNone: () => [],
|
|
4251
4269
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
4252
4270
|
})));
|
|
4253
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
4271
|
+
}, { concurrency: READ_CONCURRENCY$31 });
|
|
4254
4272
|
return Array$1.flatten(found);
|
|
4255
4273
|
});
|
|
4256
4274
|
// src/features/check-placement/model/ignored-sources.ts
|
|
4257
|
-
const RULE$
|
|
4275
|
+
const RULE$66 = "ignored-sources";
|
|
4258
4276
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
4259
|
-
const FIRST$
|
|
4277
|
+
const FIRST$21 = 1;
|
|
4260
4278
|
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.";
|
|
4261
4279
|
/** @internal */
|
|
4262
4280
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
@@ -4264,9 +4282,9 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
4264
4282
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
4265
4283
|
return pipe(ignored, Array$1.map((file) => ({
|
|
4266
4284
|
file: files.join(root, file),
|
|
4267
|
-
line: FIRST$
|
|
4268
|
-
column: FIRST$
|
|
4269
|
-
rule: RULE$
|
|
4285
|
+
line: FIRST$21,
|
|
4286
|
+
column: FIRST$21,
|
|
4287
|
+
rule: RULE$66,
|
|
4270
4288
|
message: MESSAGE$11
|
|
4271
4289
|
})));
|
|
4272
4290
|
});
|
|
@@ -4296,8 +4314,8 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
|
|
|
4296
4314
|
return Array$1.flatten(entries);
|
|
4297
4315
|
});
|
|
4298
4316
|
// src/shared/lib/tree-sitter.ts
|
|
4299
|
-
const taggedError$
|
|
4300
|
-
var GrammarUnreadable = class extends taggedError$
|
|
4317
|
+
const taggedError$13 = Schema.TaggedError;
|
|
4318
|
+
var GrammarUnreadable = class extends taggedError$13()("GrammarUnreadable", {
|
|
4301
4319
|
grammar: Schema.String,
|
|
4302
4320
|
message: Schema.String
|
|
4303
4321
|
}) {};
|
|
@@ -4392,7 +4410,7 @@ const kindOf$1 = (inner) => {
|
|
|
4392
4410
|
const isSliceIndex = (modulePath) => modulePath.length === 2 && Option.exists(Array$1.head(modulePath), (layer) => Array$1.contains(SLICED_LAYERS, layer));
|
|
4393
4411
|
// src/features/check-placement/model/rust-syntax.ts
|
|
4394
4412
|
const IGNORED_ITEMS = ["line_comment", "block_comment"];
|
|
4395
|
-
const NEXT$
|
|
4413
|
+
const NEXT$6 = 1;
|
|
4396
4414
|
const ALLOCATOR = "global_allocator";
|
|
4397
4415
|
const field = (node, name) => Option.fromNullishOr(node.childForFieldName(name));
|
|
4398
4416
|
const namedChildren = (node) => pipe(node.namedChildren, Array$1.flatMap((child) => Option.toArray(Option.fromNullishOr(child))));
|
|
@@ -4401,8 +4419,8 @@ const itemOf = (node) => ({
|
|
|
4401
4419
|
name: Option.map(field(node, "name"), (name) => name.text),
|
|
4402
4420
|
inline: Option.isSome(field(node, "body")),
|
|
4403
4421
|
visible: Array$1.some(namedChildren(node), (child) => child.type === "visibility_modifier"),
|
|
4404
|
-
line: node.startPosition.row + NEXT$
|
|
4405
|
-
column: node.startPosition.column + NEXT$
|
|
4422
|
+
line: node.startPosition.row + NEXT$6,
|
|
4423
|
+
column: node.startPosition.column + NEXT$6
|
|
4406
4424
|
});
|
|
4407
4425
|
const replacesAllocator = (root) => pipe(root.descendantsOfType("attribute"), Array$1.flatMap((node) => Option.toArray(Option.fromNullishOr(node))), Array$1.some((attribute) => Option.exists(Array$1.head(namedChildren(attribute)), (name) => name.text === ALLOCATOR)));
|
|
4408
4426
|
const readRustFile = (root) => ({
|
|
@@ -12848,7 +12866,7 @@ const SLICE_RULE$1 = "feature-slice-name";
|
|
|
12848
12866
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
12849
12867
|
const SEGMENT_RULE = "slice-segment-name";
|
|
12850
12868
|
const SEPARATOR$21 = "/";
|
|
12851
|
-
const NEXT$
|
|
12869
|
+
const NEXT$5 = 1;
|
|
12852
12870
|
const WORD_SEPARATOR$1 = "-";
|
|
12853
12871
|
const MINIMUM_WORDS = 2;
|
|
12854
12872
|
const FEATURES$1 = "src/features/";
|
|
@@ -12888,19 +12906,19 @@ const isInSliceLayer = (parts) => {
|
|
|
12888
12906
|
};
|
|
12889
12907
|
const indexedSlice = (owned) => {
|
|
12890
12908
|
const parts = String$1.split(owned.inner, SEPARATOR$21);
|
|
12891
|
-
const depth = parts.length - NEXT$
|
|
12909
|
+
const depth = parts.length - NEXT$5;
|
|
12892
12910
|
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array$1.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$21}${pathPrefix(parts, depth)}`));
|
|
12893
12911
|
};
|
|
12894
12912
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
12895
12913
|
const parts = String$1.split(inner, SEPARATOR$21);
|
|
12896
12914
|
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$21}${pathPrefix(parts, depth)}`);
|
|
12897
|
-
const isSegmentFolder = (depth) => parts.length > depth + NEXT$
|
|
12898
|
-
return pipe(SLICE_DEPTHS, Array$1.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$21}${pathPrefix(parts, depth + NEXT$
|
|
12915
|
+
const isSegmentFolder = (depth) => parts.length > depth + NEXT$5 && SCRIPT.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
12916
|
+
return pipe(SLICE_DEPTHS, Array$1.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$21}${pathPrefix(parts, depth + NEXT$5)}`));
|
|
12899
12917
|
};
|
|
12900
12918
|
const deployNamed = ({ workspace, inner }) => {
|
|
12901
12919
|
if (!String$1.startsWith(SOURCE$2)(inner)) return Option.none();
|
|
12902
12920
|
const segments = String$1.split(inner, SEPARATOR$21);
|
|
12903
|
-
return pipe(Array$1.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$21}${Array$1.join(Array$1.take(segments, index + NEXT$
|
|
12921
|
+
return pipe(Array$1.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$21}${Array$1.join(Array$1.take(segments, index + NEXT$5), SEPARATOR$21)}`));
|
|
12904
12922
|
};
|
|
12905
12923
|
/** @internal */
|
|
12906
12924
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -12943,7 +12961,7 @@ const LAYER_ITEMS = [
|
|
|
12943
12961
|
"attribute_item",
|
|
12944
12962
|
"inner_attribute_item"
|
|
12945
12963
|
];
|
|
12946
|
-
const READ_CONCURRENCY$
|
|
12964
|
+
const READ_CONCURRENCY$30 = 64;
|
|
12947
12965
|
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12948
12966
|
const NONE$4 = [];
|
|
12949
12967
|
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.";
|
|
@@ -13019,17 +13037,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
13019
13037
|
if (!Array$1.isReadonlyArrayNonEmpty(sources)) return NONE$4;
|
|
13020
13038
|
const language = yield* loadLanguage(GRAMMAR$1).pipe(Effect.orDie);
|
|
13021
13039
|
const parse = parsedWith(language);
|
|
13022
|
-
const read = yield* Effect.forEach(pipe(sources, Array$1.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$
|
|
13040
|
+
const read = yield* Effect.forEach(pipe(sources, Array$1.filter(isRead)), (source) => files.readFile(source.file).pipe(Effect.map(Option.flatMap((text) => parse(source, text)))), { concurrency: READ_CONCURRENCY$30 });
|
|
13023
13041
|
return [...sliceNameProblems(root, files.join, sources), ...Array$1.flatMap(Array$1.getSomes(read), problemsOf$4)];
|
|
13024
13042
|
});
|
|
13025
13043
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
13026
|
-
const RULE$
|
|
13027
|
-
const FIRST$
|
|
13044
|
+
const RULE$65 = "shadcn-ui-alias";
|
|
13045
|
+
const FIRST$20 = 1;
|
|
13028
13046
|
const problemOf$12 = (directory, { file, alias }) => ({
|
|
13029
13047
|
file,
|
|
13030
|
-
line: FIRST$
|
|
13031
|
-
column: FIRST$
|
|
13032
|
-
rule: RULE$
|
|
13048
|
+
line: FIRST$20,
|
|
13049
|
+
column: FIRST$20,
|
|
13050
|
+
rule: RULE$65,
|
|
13033
13051
|
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/*".`
|
|
13034
13052
|
});
|
|
13035
13053
|
/** @internal */
|
|
@@ -13093,8 +13111,8 @@ const SCRIPTS_DIRECTORY = "scripts";
|
|
|
13093
13111
|
const WORKFLOW_DIRECTORY = ".github/";
|
|
13094
13112
|
const SEPARATOR$20 = "/";
|
|
13095
13113
|
const CURRENT = "./";
|
|
13096
|
-
const READ_CONCURRENCY$
|
|
13097
|
-
const FIRST$
|
|
13114
|
+
const READ_CONCURRENCY$29 = 8;
|
|
13115
|
+
const FIRST$19 = 1;
|
|
13098
13116
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
13099
13117
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
13100
13118
|
const COMMAND_FILE$1 = /^bin\/[^/]+$/u;
|
|
@@ -13109,7 +13127,7 @@ const runsIn = ({ text, start }) => pipe(Array$1.fromIterable(String$1.matchAll(
|
|
|
13109
13127
|
start
|
|
13110
13128
|
})), Option.toArray)));
|
|
13111
13129
|
const targetPaths = (held) => pipe(targetsIn(held), Array$1.map(withoutCurrent));
|
|
13112
|
-
const entriesOf$
|
|
13130
|
+
const entriesOf$2 = (manifest) => {
|
|
13113
13131
|
const bins = targetPaths(manifest.bin);
|
|
13114
13132
|
return {
|
|
13115
13133
|
all: [
|
|
@@ -13123,7 +13141,7 @@ const entriesOf$1 = (manifest) => {
|
|
|
13123
13141
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
13124
13142
|
const files = yield* RepositoryFiles;
|
|
13125
13143
|
const manifest = yield* readManifest(files.join(root, directory));
|
|
13126
|
-
return pipe(manifest, Option.map(entriesOf$
|
|
13144
|
+
return pipe(manifest, Option.map(entriesOf$2), Option.getOrElse(() => NO_ENTRIES));
|
|
13127
13145
|
});
|
|
13128
13146
|
const isCommand = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
13129
13147
|
const commandFilesIn$1 = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
@@ -13135,7 +13153,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
13135
13153
|
const files = yield* RepositoryFiles;
|
|
13136
13154
|
const listed = yield* files.listedFiles(root);
|
|
13137
13155
|
const workflows = pipe(listed, Array$1.filter(String$1.startsWith(WORKFLOW_DIRECTORY)));
|
|
13138
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
13156
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$29 });
|
|
13139
13157
|
return pipe(Array$1.getSomes(texts), Array$1.join("\n"));
|
|
13140
13158
|
});
|
|
13141
13159
|
const workspacePath = (directory, path) => pipe([directory, path], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$20));
|
|
@@ -13146,7 +13164,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array$1.
|
|
|
13146
13164
|
message: `A task runs ${path}. Put each file that a task runs at ${BIN}/<name>.ts, the one place where every workspace keeps its commands, so that fallow and the other tools find it without a list of files.`
|
|
13147
13165
|
})));
|
|
13148
13166
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array$1.flatMap(stringsIn), Array$1.flatMap(runsIn));
|
|
13149
|
-
const problemsIn$
|
|
13167
|
+
const problemsIn$21 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
13150
13168
|
const files = yield* RepositoryFiles;
|
|
13151
13169
|
const config = yield* workspaceConfigOf(root, directory);
|
|
13152
13170
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -13162,8 +13180,8 @@ const problemsIn$20 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
13162
13180
|
const isRun = (path) => Array$1.contains(runPaths, path) || Array$1.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
13163
13181
|
const unrun = pipe(commands, Array$1.filter((path) => !isRun(path)), Array$1.map((path) => ({
|
|
13164
13182
|
file: files.join(root, directory, path),
|
|
13165
|
-
line: FIRST$
|
|
13166
|
-
column: FIRST$
|
|
13183
|
+
line: FIRST$19,
|
|
13184
|
+
column: FIRST$19,
|
|
13167
13185
|
rule: UNRUN,
|
|
13168
13186
|
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.`
|
|
13169
13187
|
})));
|
|
@@ -13175,8 +13193,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
13175
13193
|
const isDirectory = yield* files.isDirectory(file);
|
|
13176
13194
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
13177
13195
|
file,
|
|
13178
|
-
line: FIRST$
|
|
13179
|
-
column: FIRST$
|
|
13196
|
+
line: FIRST$19,
|
|
13197
|
+
column: FIRST$19,
|
|
13180
13198
|
rule: SCRIPTS,
|
|
13181
13199
|
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.`
|
|
13182
13200
|
})));
|
|
@@ -13188,8 +13206,8 @@ const codeInBinProblems = Effect.fn("codeInBinProblems")(function* codeInBinProb
|
|
|
13188
13206
|
const prefix = workspacePath(directory, `${BIN}${SEPARATOR$20}`);
|
|
13189
13207
|
return pipe(listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.filter((file) => !isCommandFile(`${BIN}${SEPARATOR$20}${String$1.slice(prefix.length)(file)}`)), Array$1.map((file) => ({
|
|
13190
13208
|
file: files.join(root, file),
|
|
13191
|
-
line: FIRST$
|
|
13192
|
-
column: FIRST$
|
|
13209
|
+
line: FIRST$19,
|
|
13210
|
+
column: FIRST$19,
|
|
13193
13211
|
rule: CODE_IN_BIN,
|
|
13194
13212
|
message: `${file} is in ${BIN}/ but is not a command. Put only commands at ${BIN}/<name>.ts and the code that they share in the package own source, in a slice under src/, so that fallow judges it as ordinary code instead of as an entry point that is never reported unused.`
|
|
13195
13213
|
})));
|
|
@@ -13198,9 +13216,9 @@ const codeInBinProblems = Effect.fn("codeInBinProblems")(function* codeInBinProb
|
|
|
13198
13216
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
13199
13217
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
13200
13218
|
const workflows = yield* workflowText(root);
|
|
13201
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
13202
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13203
|
-
const code = yield* Effect.forEach(all, (directory) => codeInBinProblems(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13219
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$21(root, directory, workflows), { concurrency: READ_CONCURRENCY$29 });
|
|
13220
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$29 });
|
|
13221
|
+
const code = yield* Effect.forEach(all, (directory) => codeInBinProblems(root, directory), { concurrency: READ_CONCURRENCY$29 });
|
|
13204
13222
|
return [
|
|
13205
13223
|
...Array$1.flatten(found),
|
|
13206
13224
|
...Array$1.getSomes(scripts),
|
|
@@ -13208,14 +13226,14 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
13208
13226
|
];
|
|
13209
13227
|
});
|
|
13210
13228
|
// src/features/check-repository-layout/model/path-mention.ts
|
|
13211
|
-
const START$
|
|
13229
|
+
const START$33 = 0;
|
|
13212
13230
|
const QUOTES = ["\"", "'"];
|
|
13213
13231
|
const firstIndex = (source, needles) => {
|
|
13214
13232
|
const found = pipe(needles, Array$1.flatMap((needle) => Option.toArray(String$1.indexOf(needle)(source))));
|
|
13215
13233
|
return Array$1.head(Array$1.sort(found, Order.Number));
|
|
13216
13234
|
};
|
|
13217
13235
|
const quoted = (text) => pipe(QUOTES, Array$1.map((quote) => `${quote}${text}${quote}`));
|
|
13218
|
-
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$
|
|
13236
|
+
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$33));
|
|
13219
13237
|
// src/features/check-repository-layout/model/cargo-paths.ts
|
|
13220
13238
|
const MEMBER_LISTS = [
|
|
13221
13239
|
"members",
|
|
@@ -13231,14 +13249,14 @@ const WORKSPACE = "workspace";
|
|
|
13231
13249
|
const PATCH = "patch";
|
|
13232
13250
|
const PATCH_DEPTH = 2;
|
|
13233
13251
|
const WORKSPACE_DEPTH = 1;
|
|
13234
|
-
const START$
|
|
13252
|
+
const START$32 = 0;
|
|
13235
13253
|
const WILDCARD$4 = /[*?[]/u;
|
|
13236
13254
|
const KEY_SEPARATOR$1 = ".";
|
|
13237
13255
|
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
13238
13256
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13239
13257
|
const decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));
|
|
13240
|
-
const declaresPath = (trail) => pipe(Array$1.last(trail), Option.exists((name) => Array$1.contains(DEPENDENCY_TABLES, name))) || trail.length === PATCH_DEPTH && Array$1.get(trail, START$
|
|
13241
|
-
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$
|
|
13258
|
+
const declaresPath = (trail) => pipe(Array$1.last(trail), Option.exists((name) => Array$1.contains(DEPENDENCY_TABLES, name))) || trail.length === PATCH_DEPTH && Array$1.get(trail, START$32).pipe(Option.exists((name) => name === PATCH));
|
|
13259
|
+
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$32).pipe(Option.exists((name) => name === WORKSPACE)) && Array$1.contains(MEMBER_LISTS, key);
|
|
13242
13260
|
const namedPaths = (trail, key, value) => {
|
|
13243
13261
|
const field = Array$1.join([...trail, key], KEY_SEPARATOR$1);
|
|
13244
13262
|
if (listsMembers(trail, key)) return pipe(decodeStrings(value), Option.getOrElse(() => []), Array$1.filter((member) => !WILDCARD$4.test(member)), Array$1.map((member) => ({
|
|
@@ -13297,39 +13315,39 @@ const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMention
|
|
|
13297
13315
|
])));
|
|
13298
13316
|
});
|
|
13299
13317
|
// src/features/check-repository-layout/model/config-paths.ts
|
|
13300
|
-
const RULE$
|
|
13318
|
+
const RULE$64 = "config-path";
|
|
13301
13319
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
13302
13320
|
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
13303
13321
|
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
13304
13322
|
const OUTSIDE = "..";
|
|
13305
|
-
const READ_CONCURRENCY$
|
|
13323
|
+
const READ_CONCURRENCY$28 = 8;
|
|
13306
13324
|
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, file, mention) {
|
|
13307
13325
|
const files = yield* RepositoryFiles;
|
|
13308
13326
|
const relatives = pipe(mention.candidates, Array$1.map((candidate) => files.relative(root, files.resolve(files.dirname(file), candidate))), Array$1.filter((relative) => !String$1.startsWith(OUTSIDE)(relative)));
|
|
13309
13327
|
if (!Array$1.isReadonlyArrayNonEmpty(relatives)) return false;
|
|
13310
|
-
const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), { concurrency: READ_CONCURRENCY$
|
|
13328
|
+
const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), { concurrency: READ_CONCURRENCY$28 });
|
|
13311
13329
|
if (pipe(present, Array$1.some(Boolean))) return false;
|
|
13312
|
-
const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), { concurrency: READ_CONCURRENCY$
|
|
13330
|
+
const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), { concurrency: READ_CONCURRENCY$28 });
|
|
13313
13331
|
return !pipe(ignored, Array$1.some(Boolean));
|
|
13314
13332
|
});
|
|
13315
13333
|
const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
13316
13334
|
const problemOf$11 = (file, source) => (mention) => ({
|
|
13317
13335
|
file,
|
|
13318
13336
|
...positionOf(source)(mention.index),
|
|
13319
|
-
rule: RULE$
|
|
13337
|
+
rule: RULE$64,
|
|
13320
13338
|
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
13321
13339
|
});
|
|
13322
13340
|
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
13323
13341
|
if (CARGO_MANIFEST.test(file)) return cargoMentions(source);
|
|
13324
13342
|
return yield* tsconfigMentions(file, source);
|
|
13325
13343
|
});
|
|
13326
|
-
const problemsIn$
|
|
13344
|
+
const problemsIn$20 = Effect.fn("problemsIn")(function* problemsIn(root, name) {
|
|
13327
13345
|
const files = yield* RepositoryFiles;
|
|
13328
13346
|
const file = files.join(root, name);
|
|
13329
13347
|
const source = yield* files.readFile(file);
|
|
13330
13348
|
if (Option.isNone(source)) return [];
|
|
13331
13349
|
const mentions = yield* mentionsIn(file, source.value);
|
|
13332
|
-
const missing = yield* Effect.filter(mentions, (mention) => isMissing$1(root, file, mention), { concurrency: READ_CONCURRENCY$
|
|
13350
|
+
const missing = yield* Effect.filter(mentions, (mention) => isMissing$1(root, file, mention), { concurrency: READ_CONCURRENCY$28 });
|
|
13333
13351
|
return pipe(Array$1.sort(missing, byIndex), Array$1.map(problemOf$11(file, source.value)));
|
|
13334
13352
|
});
|
|
13335
13353
|
const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatterns(root) {
|
|
@@ -13341,7 +13359,7 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
13341
13359
|
return pipe(patterns, Array$1.map((pattern) => ({
|
|
13342
13360
|
file,
|
|
13343
13361
|
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
13344
|
-
rule: RULE$
|
|
13362
|
+
rule: RULE$64,
|
|
13345
13363
|
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
13346
13364
|
})));
|
|
13347
13365
|
});
|
|
@@ -13349,23 +13367,23 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
13349
13367
|
const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPaths(root) {
|
|
13350
13368
|
const owned = yield* (yield* RepositoryFiles).ownedFiles(root);
|
|
13351
13369
|
const configs = pipe(owned, Array$1.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)));
|
|
13352
|
-
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$
|
|
13370
|
+
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$20(root, name), { concurrency: READ_CONCURRENCY$28 }), unmatchedPatterns(root)], { concurrency: "unbounded" });
|
|
13353
13371
|
return [...Array$1.flatten(found), ...patterns];
|
|
13354
13372
|
});
|
|
13355
13373
|
// src/features/check-repository-layout/model/crates.ts
|
|
13356
|
-
const RULE$
|
|
13374
|
+
const RULE$63 = "unverified-crate";
|
|
13357
13375
|
const VERSION_RULE = "release-version";
|
|
13358
13376
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
13359
13377
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
13360
13378
|
const CONFIG_FILE$8 = "vite.config.ts";
|
|
13361
13379
|
const SEPARATOR$18 = "/";
|
|
13362
|
-
const FIRST$
|
|
13363
|
-
const READ_CONCURRENCY$
|
|
13380
|
+
const FIRST$18 = 1;
|
|
13381
|
+
const READ_CONCURRENCY$27 = 8;
|
|
13364
13382
|
const problemFor$6 = (crate, message) => ({
|
|
13365
13383
|
file: crate.manifest,
|
|
13366
|
-
line: FIRST$
|
|
13367
|
-
column: FIRST$
|
|
13368
|
-
rule: RULE$
|
|
13384
|
+
line: FIRST$18,
|
|
13385
|
+
column: FIRST$18,
|
|
13386
|
+
rule: RULE$63,
|
|
13369
13387
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
13370
13388
|
});
|
|
13371
13389
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -13385,8 +13403,8 @@ const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemI
|
|
|
13385
13403
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
13386
13404
|
return Option.some({
|
|
13387
13405
|
file: crate.manifest,
|
|
13388
|
-
line: FIRST$
|
|
13389
|
-
column: FIRST$
|
|
13406
|
+
line: FIRST$18,
|
|
13407
|
+
column: FIRST$18,
|
|
13390
13408
|
rule: VERSION_RULE,
|
|
13391
13409
|
message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${PACKAGE_JSON_FILE} is ${version.value}. msch publish releases the version in package.json, so bump both in the same PR.`
|
|
13392
13410
|
});
|
|
@@ -13400,11 +13418,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
13400
13418
|
const crates = yield* cratesIn(root);
|
|
13401
13419
|
const notAtRoot = yield* Effect.cached(lintedPerWorkspace(files.join(root, CONFIG_FILE$8)));
|
|
13402
13420
|
const unverified = (crate) => problemIn$3(root, directories, crate).pipe(Effect.when(notAtRoot), Effect.map(Option.flatten));
|
|
13403
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([unverified(crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
13421
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([unverified(crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$27 });
|
|
13404
13422
|
return Array$1.getSomes(Array$1.flatten(found));
|
|
13405
13423
|
});
|
|
13406
13424
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
13407
|
-
const RULE$
|
|
13425
|
+
const RULE$62 = "deploy-entry-pattern";
|
|
13408
13426
|
const FALLOW_KEYS = [
|
|
13409
13427
|
"entry",
|
|
13410
13428
|
"entryPoints",
|
|
@@ -13422,7 +13440,7 @@ const NEGATED = "!";
|
|
|
13422
13440
|
const ROOT_WORKSPACE = ".";
|
|
13423
13441
|
const WRAP_OFFSET$1 = 1;
|
|
13424
13442
|
const NO_OFFSET = 0;
|
|
13425
|
-
const READ_CONCURRENCY$
|
|
13443
|
+
const READ_CONCURRENCY$26 = 8;
|
|
13426
13444
|
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.";
|
|
13427
13445
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
13428
13446
|
const FALLOW = {
|
|
@@ -13459,7 +13477,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
13459
13477
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
13460
13478
|
return pipe(patternsIn(kind.keys)(parsed.program), Array$1.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
13461
13479
|
});
|
|
13462
|
-
const problemsIn$
|
|
13480
|
+
const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
13463
13481
|
const { root, file, kind, workspaces, entries } = request;
|
|
13464
13482
|
const files = yield* RepositoryFiles;
|
|
13465
13483
|
const path = files.join(root, file);
|
|
@@ -13475,7 +13493,7 @@ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
13475
13493
|
return pipe(Array$1.getSomes(flagged), Array$1.map(({ text: pattern, start }) => ({
|
|
13476
13494
|
file: path,
|
|
13477
13495
|
...positionOf(text.value)(start - kind.offset),
|
|
13478
|
-
rule: RULE$
|
|
13496
|
+
rule: RULE$62,
|
|
13479
13497
|
message: `${pattern} ${MESSAGE$10}`
|
|
13480
13498
|
})));
|
|
13481
13499
|
});
|
|
@@ -13498,17 +13516,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
13498
13516
|
}];
|
|
13499
13517
|
return [];
|
|
13500
13518
|
}));
|
|
13501
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
13519
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$19({
|
|
13502
13520
|
root,
|
|
13503
13521
|
file,
|
|
13504
13522
|
kind,
|
|
13505
13523
|
workspaces,
|
|
13506
13524
|
entries
|
|
13507
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
13525
|
+
}), { concurrency: READ_CONCURRENCY$26 });
|
|
13508
13526
|
return Array$1.flatten(found);
|
|
13509
13527
|
});
|
|
13510
13528
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
13511
|
-
const RULE$
|
|
13529
|
+
const RULE$61 = "listed-entry";
|
|
13512
13530
|
const ENTRY_KEYS = [
|
|
13513
13531
|
"entry",
|
|
13514
13532
|
"entryPoints",
|
|
@@ -13518,7 +13536,7 @@ const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?
|
|
|
13518
13536
|
const WILDCARD$2 = /[*?{[]/u;
|
|
13519
13537
|
const SEPARATOR$17 = "/";
|
|
13520
13538
|
const WRAP_OFFSET = 1;
|
|
13521
|
-
const READ_CONCURRENCY$
|
|
13539
|
+
const READ_CONCURRENCY$25 = 8;
|
|
13522
13540
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
13523
13541
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array$1.contains(ENTRY_KEYS, keyName(key))));
|
|
13524
13542
|
const entryPatternsIn = (node) => {
|
|
@@ -13529,7 +13547,7 @@ const entryPatternsIn = (node) => {
|
|
|
13529
13547
|
return pipe(childrenOf$4(node), Array$1.flatMap(entryPatternsIn));
|
|
13530
13548
|
};
|
|
13531
13549
|
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array$1.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$17}`)(text))) || String$1.includes(SEPARATOR$17)(text) && !WILDCARD$2.test(text);
|
|
13532
|
-
const problemsIn$
|
|
13550
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
13533
13551
|
const files = yield* RepositoryFiles;
|
|
13534
13552
|
const path = files.join(root, file);
|
|
13535
13553
|
const text = yield* files.readFile(path);
|
|
@@ -13538,7 +13556,7 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
13538
13556
|
return pipe(entryPatternsIn(parsed.program), Array$1.filter(namesOneFile(directories)), Array$1.map(({ text: pattern, start }) => ({
|
|
13539
13557
|
file: path,
|
|
13540
13558
|
...positionOf(text.value)(start),
|
|
13541
|
-
rule: RULE$
|
|
13559
|
+
rule: RULE$61,
|
|
13542
13560
|
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.`
|
|
13543
13561
|
})));
|
|
13544
13562
|
});
|
|
@@ -13546,30 +13564,30 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
13546
13564
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
13547
13565
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13548
13566
|
const directories = yield* workspaceDirectories(root);
|
|
13549
|
-
const found = yield* Effect.forEach(pipe(listed, Array$1.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
13567
|
+
const found = yield* Effect.forEach(pipe(listed, Array$1.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$18(root, file, directories), { concurrency: READ_CONCURRENCY$25 });
|
|
13550
13568
|
return Array$1.flatten(found);
|
|
13551
13569
|
});
|
|
13552
13570
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
13553
|
-
const RULE$
|
|
13571
|
+
const RULE$60 = "root-workspace-path";
|
|
13554
13572
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
13555
13573
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
13556
13574
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
13557
|
-
const FIRST$
|
|
13558
|
-
const NEXT$
|
|
13575
|
+
const FIRST$17 = 0;
|
|
13576
|
+
const NEXT$4 = 1;
|
|
13559
13577
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
13560
13578
|
const mentions = (directory) => (text) => {
|
|
13561
13579
|
const parts = String$1.split(text, directory);
|
|
13562
|
-
return pipe(Array$1.drop(parts, NEXT$
|
|
13580
|
+
return pipe(Array$1.drop(parts, NEXT$4), Array$1.some((after, index) => {
|
|
13563
13581
|
const before = parts[index] ?? "";
|
|
13564
|
-
const previous = String$1.slice(before.length - NEXT$
|
|
13565
|
-
const following = String$1.slice(FIRST$
|
|
13582
|
+
const previous = String$1.slice(before.length - NEXT$4)(before);
|
|
13583
|
+
const following = String$1.slice(FIRST$17, NEXT$4)(after);
|
|
13566
13584
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
13567
13585
|
}));
|
|
13568
13586
|
};
|
|
13569
|
-
const problemsIn$
|
|
13587
|
+
const problemsIn$17 = (file, source, directories) => (found) => pipe(directories, Array$1.filter((directory) => mentions(directory)(found.text)), Array$1.map((directory) => ({
|
|
13570
13588
|
file,
|
|
13571
13589
|
...positionOf(source)(found.start),
|
|
13572
|
-
rule: RULE$
|
|
13590
|
+
rule: RULE$60,
|
|
13573
13591
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$7} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$7}: msch.lint, msch.devDependencies or its verify task.`
|
|
13574
13592
|
})));
|
|
13575
13593
|
/** @internal */
|
|
@@ -13580,13 +13598,13 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
13580
13598
|
if (Option.isNone(source)) return [];
|
|
13581
13599
|
const directories = yield* workspaceDirectories(root);
|
|
13582
13600
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
13583
|
-
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$
|
|
13601
|
+
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$17(file, source.value, directories)));
|
|
13584
13602
|
});
|
|
13585
13603
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
13586
|
-
const RULE$
|
|
13604
|
+
const RULE$59 = "hidden-verify";
|
|
13587
13605
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
13588
|
-
const FIRST$
|
|
13589
|
-
const READ_CONCURRENCY$
|
|
13606
|
+
const FIRST$16 = 1;
|
|
13607
|
+
const READ_CONCURRENCY$24 = 8;
|
|
13590
13608
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
13591
13609
|
const config = yield* workspaceConfigOf(root, directory);
|
|
13592
13610
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -13595,21 +13613,21 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
13595
13613
|
const verified = yield* hasVerifyTask(file);
|
|
13596
13614
|
return Option.some({
|
|
13597
13615
|
file,
|
|
13598
|
-
line: FIRST$
|
|
13599
|
-
column: FIRST$
|
|
13600
|
-
rule: RULE$
|
|
13616
|
+
line: FIRST$16,
|
|
13617
|
+
column: FIRST$16,
|
|
13618
|
+
rule: RULE$59,
|
|
13601
13619
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$6}. The root verify reads ${CONFIG_FILE$6} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$6}.`
|
|
13602
13620
|
}).pipe(Option.filter(() => verified));
|
|
13603
13621
|
});
|
|
13604
13622
|
/** @internal */
|
|
13605
13623
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
13606
13624
|
const directories = yield* workspaceDirectories(root);
|
|
13607
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13625
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$24 });
|
|
13608
13626
|
return Array$1.getSomes(found);
|
|
13609
13627
|
});
|
|
13610
13628
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
13611
|
-
const RULE$
|
|
13612
|
-
const READ_CONCURRENCY$
|
|
13629
|
+
const RULE$58 = "shared-uncached-task";
|
|
13630
|
+
const READ_CONCURRENCY$23 = 8;
|
|
13613
13631
|
const SHARED = 2;
|
|
13614
13632
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
13615
13633
|
const UncachedTask = Schema.Struct({
|
|
@@ -13651,19 +13669,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
13651
13669
|
return pipe(definitions, Array$1.map(({ file, position, name, command }) => ({
|
|
13652
13670
|
file,
|
|
13653
13671
|
...position,
|
|
13654
|
-
rule: RULE$
|
|
13672
|
+
rule: RULE$58,
|
|
13655
13673
|
message: `The uncached task ${name} (${command}) is written the same way in ${Array$1.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.`
|
|
13656
13674
|
})));
|
|
13657
13675
|
};
|
|
13658
13676
|
/** @internal */
|
|
13659
13677
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
13660
13678
|
const directories = yield* workspaceDirectories(root);
|
|
13661
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13679
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$23 });
|
|
13662
13680
|
return pipe(Array$1.flatten(found), Array$1.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array$1.flatMap(problemsOf$3));
|
|
13663
13681
|
});
|
|
13664
13682
|
// src/features/check-repository-layout/model/tested-verify.ts
|
|
13665
|
-
const RULE$
|
|
13666
|
-
const READ_CONCURRENCY$
|
|
13683
|
+
const RULE$57 = "tested-verify";
|
|
13684
|
+
const READ_CONCURRENCY$22 = 8;
|
|
13667
13685
|
const TESTS = new Set(TEST_TASK_NAMES);
|
|
13668
13686
|
const RUNS_TESTS = /\b(?:vp|cargo) test\b/u;
|
|
13669
13687
|
const edgesOf = (task) => pipe(Option.toArray(propertyValue("dependsOn")(task.value)), Array$1.flatMap(stringsIn), Array$1.map((at) => ({
|
|
@@ -13686,24 +13704,24 @@ const testedEdges = (tasks) => {
|
|
|
13686
13704
|
const byName = new Map(pipe(tasks, Array$1.map(named$1)));
|
|
13687
13705
|
return edgesFrom(byName, /* @__PURE__ */ new Set())(TASK_NAMES.verify);
|
|
13688
13706
|
};
|
|
13689
|
-
const problemsIn$
|
|
13707
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, directory) {
|
|
13690
13708
|
const config = yield* workspaceConfigOf(root, directory);
|
|
13691
13709
|
return pipe(Option.toArray(config), Array$1.flatMap(({ file, source, program }) => pipe(testedEdges(runTasksIn(program)), Array$1.map(({ to, at }) => ({
|
|
13692
13710
|
file,
|
|
13693
13711
|
...positionOf(source)(at.start),
|
|
13694
|
-
rule: RULE$
|
|
13712
|
+
rule: RULE$57,
|
|
13695
13713
|
message: `The verify task of ${directory} runs tests through ${to}. verify is what the pre-push hook runs, and tests run in CI through the root ci task, which runs the test and cargo-test tasks of every workspace. Move them into this workspace's test or cargo-test task, and take them out of verify.`
|
|
13696
13714
|
})))));
|
|
13697
13715
|
});
|
|
13698
13716
|
/** @internal */
|
|
13699
13717
|
const checkTestedVerify = Effect.fn("checkTestedVerify")(function* checkTestedVerify(root) {
|
|
13700
13718
|
const directories = yield* workspaceDirectories(root);
|
|
13701
|
-
const found = yield* Effect.forEach(directories, (directory) => problemsIn$
|
|
13719
|
+
const found = yield* Effect.forEach(directories, (directory) => problemsIn$16(root, directory), { concurrency: READ_CONCURRENCY$22 });
|
|
13702
13720
|
return Array$1.flatten(found);
|
|
13703
13721
|
});
|
|
13704
13722
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
13705
|
-
const RULE$
|
|
13706
|
-
const READ_CONCURRENCY$
|
|
13723
|
+
const RULE$56 = "unlocked-task";
|
|
13724
|
+
const READ_CONCURRENCY$21 = 8;
|
|
13707
13725
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
13708
13726
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
13709
13727
|
const commandOf = (task) => pipe(propertyValue("command")(task.value), Option.getOrElse(() => task.value), literalOf, Option.flatMap(decodeCommand), Option.flatMap((command) => Array$1.findFirst(Array$1.ensure(command), (line) => READS_DEPENDENCIES.test(line))));
|
|
@@ -13714,13 +13732,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
13714
13732
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array$1.filter(tracksLockfiles), Array$1.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
13715
13733
|
file,
|
|
13716
13734
|
...positionOf(source)(task.start),
|
|
13717
|
-
rule: RULE$
|
|
13735
|
+
rule: RULE$56,
|
|
13718
13736
|
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.`
|
|
13719
13737
|
})), Option.toArray)));
|
|
13720
13738
|
/** @internal */
|
|
13721
13739
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
13722
13740
|
const directories = yield* workspaceDirectories(root);
|
|
13723
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13741
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
13724
13742
|
return pipe(Array$1.getSomes(found), Array$1.flatMap(problemsOf$2));
|
|
13725
13743
|
});
|
|
13726
13744
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -13848,7 +13866,7 @@ const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(a
|
|
|
13848
13866
|
}).pipe(Effect.map((packages) => [entry, packages])), { concurrency: 1 });
|
|
13849
13867
|
});
|
|
13850
13868
|
// src/features/measure-install-size/model/installed-closure.ts
|
|
13851
|
-
const EMPTY$
|
|
13869
|
+
const EMPTY$5 = 0;
|
|
13852
13870
|
const installedNames = (manifest) => [...namesIn$1(manifest, ["dependencies", "optionalDependencies"]), ...pipe(namesIn$1(manifest, ["peerDependencies"]), Array$1.difference(optionalPeerNames(manifest)))];
|
|
13853
13871
|
const childrenOf$2 = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
13854
13872
|
const files = yield* RepositoryFiles;
|
|
@@ -13891,7 +13909,7 @@ const directorySize = (directory) => Effect.gen(function* sizeOfDirectory() {
|
|
|
13891
13909
|
const names = yield* files.readDirectory(directory);
|
|
13892
13910
|
const entries = pipe(names, Array$1.filter((name) => name !== NODE_MODULES$2), Array$1.map((name) => files.join(directory, name)));
|
|
13893
13911
|
const sizes = yield* Effect.forEach(entries, (entry) => files.isDirectory(entry).pipe(Effect.flatMap((kind) => {
|
|
13894
|
-
if (Option.isNone(kind)) return Effect.succeed(EMPTY$
|
|
13912
|
+
if (Option.isNone(kind)) return Effect.succeed(EMPTY$5);
|
|
13895
13913
|
if (kind.value) return directorySize(entry);
|
|
13896
13914
|
return files.fileSize(entry);
|
|
13897
13915
|
})), { concurrency: 1 });
|
|
@@ -13903,7 +13921,7 @@ const installedClosure = ({ provided, from, name }) => closureOf$2(provided, {
|
|
|
13903
13921
|
});
|
|
13904
13922
|
const installedSize = (directory) => {
|
|
13905
13923
|
if (String$1.includes(`/node_modules/`)(directory)) return directorySize(directory);
|
|
13906
|
-
return Effect.succeed(EMPTY$
|
|
13924
|
+
return Effect.succeed(EMPTY$5);
|
|
13907
13925
|
};
|
|
13908
13926
|
// src/features/measure-install-size/model/install-size.ts
|
|
13909
13927
|
const INSTALL_SIZE = "install-size";
|
|
@@ -13914,11 +13932,11 @@ const LISTED_LARGEST = 5;
|
|
|
13914
13932
|
const SIZE_CONCURRENCY = 32;
|
|
13915
13933
|
const MEGABYTE = 1e6;
|
|
13916
13934
|
const MEGABYTE_DIGITS = 1;
|
|
13917
|
-
const START$
|
|
13935
|
+
const START$31 = 0;
|
|
13918
13936
|
const SINGLE_ENTRY = 1;
|
|
13919
13937
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
13920
13938
|
const usageHint = (dependency, entryCount) => {
|
|
13921
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
13939
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$31 && dependency.entries.length < entryCount)) return "";
|
|
13922
13940
|
return ` (imported only from ${Array$1.join(dependency.entries, ", ")})`;
|
|
13923
13941
|
};
|
|
13924
13942
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array$1.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array$1.join(", "));
|
|
@@ -13927,7 +13945,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
13927
13945
|
const { workspace, total } = overrun;
|
|
13928
13946
|
const config = yield* files.readFile(workspace.configFile);
|
|
13929
13947
|
const source = Option.getOrElse(config, () => "");
|
|
13930
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
13948
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$31);
|
|
13931
13949
|
return {
|
|
13932
13950
|
file: workspace.configFile,
|
|
13933
13951
|
...positionOf(source)(index),
|
|
@@ -13944,7 +13962,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
13944
13962
|
const everything = pipe(closures, Array$1.flatMap(([, packages]) => Array$1.fromIterable(packages)), HashSet.fromIterable);
|
|
13945
13963
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
13946
13964
|
const sizes = HashMap.fromIterable(measured);
|
|
13947
|
-
const sizeOf = (packages) => packages.pipe(Array$1.fromIterable, Array$1.map((found) => sizes.pipe(HashMap.get(found), Option.getOrElse(() => START$
|
|
13965
|
+
const sizeOf = (packages) => packages.pipe(Array$1.fromIterable, Array$1.map((found) => sizes.pipe(HashMap.get(found), Option.getOrElse(() => START$31))), Number$1.sumAll);
|
|
13948
13966
|
return {
|
|
13949
13967
|
closures,
|
|
13950
13968
|
sizeOf,
|
|
@@ -13977,11 +13995,11 @@ const sizeProblems$1 = Effect.fn("sizeProblems")(function* sizeProblems(publishe
|
|
|
13977
13995
|
})];
|
|
13978
13996
|
});
|
|
13979
13997
|
const stackProblems = (file, source, dependencies) => {
|
|
13980
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
13998
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$31);
|
|
13981
13999
|
const rest = String$1.slice(section)(source);
|
|
13982
14000
|
return pipe(Record.toEntries(dependencies), Array$1.filter(([, specifier]) => specifier === STACK_CATALOG), Array$1.map(([name]) => ({
|
|
13983
14001
|
file,
|
|
13984
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
14002
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$31)),
|
|
13985
14003
|
rule: STACK_DEPENDENCY,
|
|
13986
14004
|
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.`
|
|
13987
14005
|
})));
|
|
@@ -14030,12 +14048,12 @@ const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
|
|
|
14030
14048
|
return yield* files.mergeBase(root, base);
|
|
14031
14049
|
});
|
|
14032
14050
|
// src/features/check-migration-order/model/migration-order.ts
|
|
14033
|
-
const RULE$
|
|
14051
|
+
const RULE$55 = "migration-order";
|
|
14034
14052
|
const SNAPSHOT = "snapshot.json";
|
|
14035
14053
|
const MIGRATION = "migration.sql";
|
|
14036
14054
|
const SNAPSHOTS = [`*/${SNAPSHOT}`];
|
|
14037
|
-
const FIRST$
|
|
14038
|
-
const READ_CONCURRENCY$
|
|
14055
|
+
const FIRST$15 = 1;
|
|
14056
|
+
const READ_CONCURRENCY$20 = 16;
|
|
14039
14057
|
const isSnapshot = (basename) => (file) => basename(file) === SNAPSHOT;
|
|
14040
14058
|
const migrationAt = Effect.fn("migrationAt")(function* migrationAt(root, base, file) {
|
|
14041
14059
|
const files = yield* RepositoryFiles;
|
|
@@ -14062,9 +14080,9 @@ const latestOf = (migrations) => pipe(migrations, Array$1.filter(({ applied }) =
|
|
|
14062
14080
|
const isBefore = (later) => (migration) => !migration.applied && Order.isLessThan(String$1.Order)(migration.folder, later.folder);
|
|
14063
14081
|
const outOfOrder = (root, base, join) => (migrations) => pipe(latestOf(migrations), Option.map((latest) => pipe(migrations, Array$1.filter(isBefore(latest)), Array$1.map(({ file, folder }) => ({
|
|
14064
14082
|
file: join(root, file),
|
|
14065
|
-
line: FIRST$
|
|
14066
|
-
column: FIRST$
|
|
14067
|
-
rule: RULE$
|
|
14083
|
+
line: FIRST$15,
|
|
14084
|
+
column: FIRST$15,
|
|
14085
|
+
rule: RULE$55,
|
|
14068
14086
|
message: `${folder} is new, but it sorts before ${latest.folder}, which ${base} already has. A database that has applied ${latest.folder} rejects an earlier migration, so delete ${folder} and generate it again after ${latest.folder}.`
|
|
14069
14087
|
})))), Option.getOrElse(() => []));
|
|
14070
14088
|
/** @internal */
|
|
@@ -14075,7 +14093,7 @@ const checkMigrationOrder = Effect.fn("checkMigrationOrder")(function* checkMigr
|
|
|
14075
14093
|
if (Option.isNone(found)) return [];
|
|
14076
14094
|
const [listed, changed] = yield* Effect.all([files.matchingFiles(root, SNAPSHOTS), files.changedFiles(root, base)], { concurrency: "unbounded" });
|
|
14077
14095
|
const snapshots = pipe([...listed, ...changed], Array$1.filter(isSnapshot(files.basename)), Array$1.dedupe);
|
|
14078
|
-
const migrations = yield* Effect.forEach(snapshots, (file) => migrationAt(root, base, file), { concurrency: READ_CONCURRENCY$
|
|
14096
|
+
const migrations = yield* Effect.forEach(snapshots, (file) => migrationAt(root, base, file), { concurrency: READ_CONCURRENCY$20 });
|
|
14079
14097
|
return pipe(Array$1.getSomes(migrations), Array$1.groupBy(({ directory }) => directory), Record.values, Array$1.flatMap(outOfOrder(root, base, files.join)));
|
|
14080
14098
|
});
|
|
14081
14099
|
// src/shared/lib/bundle-error.ts
|
|
@@ -14167,15 +14185,15 @@ const vendorFiles = Effect.fn("vendorFiles")(function* vendorFiles(request) {
|
|
|
14167
14185
|
return pipe(output.output, Array$1.filter(isChunk$2), Array$1.map((chunk) => [chunk.fileName, chunk.code]), Record.fromEntries, Record.set(`${request.name}.d.ts`, `export * from "${request.name}";\n`));
|
|
14168
14186
|
});
|
|
14169
14187
|
// src/features/check-mod-vendor/model/mod-vendor.ts
|
|
14170
|
-
const RULE$
|
|
14188
|
+
const RULE$54 = "mod-vendor";
|
|
14171
14189
|
const VENDOR = "vendor";
|
|
14172
14190
|
const SOURCE_FILE$2 = /\.[cm]?[jt]sx?$/u;
|
|
14173
14191
|
const RELATIVE$1 = /^\.\.?\//u;
|
|
14174
14192
|
const FILE_LIMIT = 1048576;
|
|
14175
14193
|
const TOTAL_LIMIT = 8388608;
|
|
14176
14194
|
const CONCURRENCY$6 = 4;
|
|
14177
|
-
const EMPTY$
|
|
14178
|
-
const problemFor$5 = problemInFile(RULE$
|
|
14195
|
+
const EMPTY$4 = "";
|
|
14196
|
+
const problemFor$5 = problemInFile(RULE$54);
|
|
14179
14197
|
const isModSource = (directory) => (file) => String$1.startsWith(directory)(file) && !String$1.startsWith(`${directory}${VENDOR}/`)(file) && SOURCE_FILE$2.test(file);
|
|
14180
14198
|
const sourcesOf$2 = (plugin, directory, join) => pipe(plugin.files, Array$1.filter(isModSource(directory)), Array$1.map((file) => join(plugin.directory, file)));
|
|
14181
14199
|
const modsOf = Effect.fn("modsOf")(function* modsOf(root, plugin) {
|
|
@@ -14191,7 +14209,7 @@ const modsOf = Effect.fn("modsOf")(function* modsOf(root, plugin) {
|
|
|
14191
14209
|
});
|
|
14192
14210
|
const wantedIn$1 = Effect.fn("wantedIn")(function* wantedIn(mod, file) {
|
|
14193
14211
|
const files = yield* RepositoryFiles;
|
|
14194
|
-
const declarations = (yield* files.readFile(file)).pipe(Option.getOrElse(() => EMPTY$
|
|
14212
|
+
const declarations = (yield* files.readFile(file)).pipe(Option.getOrElse(() => EMPTY$4), importedNames$1);
|
|
14195
14213
|
const directory = files.dirname(file);
|
|
14196
14214
|
const packagesOf = (specifier) => vendorPackageOf(mod.vendor, files.join(directory, specifier));
|
|
14197
14215
|
return pipe(declarations, Array$1.filter(({ specifier }) => RELATIVE$1.test(specifier)), Array$1.flatMap(({ specifier, names }) => pipe(packagesOf(specifier), Array$1.map((name) => [name, names]))));
|
|
@@ -14280,7 +14298,7 @@ const unresolvedFrom = (entries) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
|
14280
14298
|
catch: bundleErrorDetail
|
|
14281
14299
|
}), (bundle) => Effect.promise(() => bundle.close())).pipe(Effect.map(({ output }) => unresolvedIn(pipe(output, Array$1.filter(isChunk$1)))));
|
|
14282
14300
|
// src/features/check-plugin-dependencies/model/plugin-dependencies.ts
|
|
14283
|
-
const RULE$
|
|
14301
|
+
const RULE$53 = "plugin-dependencies";
|
|
14284
14302
|
const PLUGIN_FILE$3 = ".claude-plugin/plugin.json";
|
|
14285
14303
|
const LOCK_FILE = "bun.lock";
|
|
14286
14304
|
const SOURCE_FILE$1 = /\.[cm]?[jt]sx?$/u;
|
|
@@ -14289,7 +14307,7 @@ const SUCCESS$6 = 0;
|
|
|
14289
14307
|
const NOT_STARTED = -1;
|
|
14290
14308
|
const DETAIL_LINES = 3;
|
|
14291
14309
|
const PLUGIN_CONCURRENCY = 2;
|
|
14292
|
-
const problemFor$4 = problemInFile(RULE$
|
|
14310
|
+
const problemFor$4 = problemInFile(RULE$53);
|
|
14293
14311
|
const hasDependencies = Effect.fn("hasDependencies")(function* hasDependencies(directory) {
|
|
14294
14312
|
const files = yield* RepositoryFiles;
|
|
14295
14313
|
const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
|
|
@@ -14394,8 +14412,8 @@ const quote = (text) => pipe(Schema.encodeOption(Quoted)(text), Option.getOrElse
|
|
|
14394
14412
|
const builtins = new Set(builtinModules);
|
|
14395
14413
|
const always = () => true;
|
|
14396
14414
|
const never = () => false;
|
|
14397
|
-
const taggedError$
|
|
14398
|
-
var BundleFailed = class extends taggedError$
|
|
14415
|
+
const taggedError$12 = Schema.TaggedError;
|
|
14416
|
+
var BundleFailed = class extends taggedError$12()("BundleFailed", { detail: Schema.String }) {};
|
|
14399
14417
|
const failed = (error) => BundleFailed.make({ detail: bundleErrorDetail(error) });
|
|
14400
14418
|
const isBare = (specifier) => !String$1.startsWith(RELATIVE_PREFIX)(specifier) && !String$1.startsWith(SUBPATH_IMPORT)(specifier) && !ABSOLUTE.test(specifier) && !String$1.startsWith(VIRTUAL_PREFIX)(specifier);
|
|
14401
14419
|
const isBuiltin = (specifier) => String$1.startsWith(NODE_PROTOCOL)(specifier) || builtins.has(packageNameOf(specifier));
|
|
@@ -14518,9 +14536,9 @@ const bundleScopeOf = ({ manifest, workspace }) => ({
|
|
|
14518
14536
|
});
|
|
14519
14537
|
const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
14520
14538
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
14521
|
-
const RULE$
|
|
14539
|
+
const RULE$52 = "optional-peer";
|
|
14522
14540
|
const REQUIRED_RULE = "required-peer";
|
|
14523
|
-
const START$
|
|
14541
|
+
const START$30 = 0;
|
|
14524
14542
|
const SINGLE$3 = 1;
|
|
14525
14543
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
14526
14544
|
const PEER_META_KEY = "\"peerDependenciesMeta\"";
|
|
@@ -14528,14 +14546,14 @@ const importsPackage = (name) => ({ packages }) => Array$1.contains(packages, na
|
|
|
14528
14546
|
const loadsAtStartup = (name) => ({ startup }) => Array$1.contains(startup, name);
|
|
14529
14547
|
const labelsOf$1 = (importers) => pipe(importers, Array$1.map(({ entry }) => `\`${entry.label}\``), Array$1.dedupe, Array$1.join(", "));
|
|
14530
14548
|
const positionIn = (located, key, name) => {
|
|
14531
|
-
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$
|
|
14549
|
+
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$30);
|
|
14532
14550
|
const rest = String$1.slice(section)(located.source);
|
|
14533
|
-
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
14551
|
+
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$30));
|
|
14534
14552
|
};
|
|
14535
14553
|
const problemFor$3 = (located, name, importers) => ({
|
|
14536
14554
|
file: located.file,
|
|
14537
14555
|
...positionIn(located, DEPENDENCIES_KEY, name),
|
|
14538
|
-
rule: RULE$
|
|
14556
|
+
rule: RULE$52,
|
|
14539
14557
|
message: `${name} is imported only from ${labelsOf$1(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
14540
14558
|
});
|
|
14541
14559
|
const requiredPeerAdvice = (fromStack) => {
|
|
@@ -14550,7 +14568,7 @@ const optionalPeerProblems = ({ located, manifest, used }) => {
|
|
|
14550
14568
|
return pipe(Record.keys(manifest.dependencies ?? {}), Array$1.flatMap((name) => {
|
|
14551
14569
|
const importers = pipe(libraries, Array$1.filter(importsPackage(name)));
|
|
14552
14570
|
const neededByBin = pipe(bins, Array$1.some(importsPackage(name)));
|
|
14553
|
-
if (!(importers.length > START$
|
|
14571
|
+
if (!(importers.length > START$30 && importers.length < libraries.length) || neededByBin) return [];
|
|
14554
14572
|
return [problemFor$3(located, name, importers)];
|
|
14555
14573
|
}));
|
|
14556
14574
|
};
|
|
@@ -14571,10 +14589,10 @@ const requiredPeerProblems = ({ located, manifest, used }) => {
|
|
|
14571
14589
|
}));
|
|
14572
14590
|
};
|
|
14573
14591
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
14574
|
-
const RULE$
|
|
14592
|
+
const RULE$51 = "side-effects";
|
|
14575
14593
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
14576
|
-
const START$
|
|
14577
|
-
const FIRST$
|
|
14594
|
+
const START$29 = 0;
|
|
14595
|
+
const FIRST$14 = 1;
|
|
14578
14596
|
const LISTED_PACKAGES = 4;
|
|
14579
14597
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
14580
14598
|
const EXPORTS_KEY = "\"exports\"";
|
|
@@ -14597,7 +14615,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
14597
14615
|
label: entry.label,
|
|
14598
14616
|
member,
|
|
14599
14617
|
...extra
|
|
14600
|
-
}, ({ modules }) => modules > START$
|
|
14618
|
+
}, ({ modules }) => modules > START$29);
|
|
14601
14619
|
});
|
|
14602
14620
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
14603
14621
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -14614,37 +14632,37 @@ const importsOf$1 = (packages) => Array$1.match(packages, {
|
|
|
14614
14632
|
onNonEmpty: (names) => ` and imports ${listed(names)}`
|
|
14615
14633
|
});
|
|
14616
14634
|
const othersOf = (total) => {
|
|
14617
|
-
if (total <= FIRST$
|
|
14618
|
-
return ` The same happens for ${String(total - FIRST$
|
|
14635
|
+
if (total <= FIRST$14) return "";
|
|
14636
|
+
return ` The same happens for ${String(total - FIRST$14)} other exports.`;
|
|
14619
14637
|
};
|
|
14620
|
-
const messageOf$
|
|
14638
|
+
const messageOf$6 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf$1(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
14621
14639
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
14622
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
14640
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$29));
|
|
14623
14641
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array$1.sortBy(largest), Array$1.head, Option.map((worst) => ({
|
|
14624
14642
|
file,
|
|
14625
14643
|
...positionOf(source)(keyIndex$1(source)),
|
|
14626
|
-
rule: RULE$
|
|
14627
|
-
message: messageOf$
|
|
14644
|
+
rule: RULE$51,
|
|
14645
|
+
message: messageOf$6(worst, excesses.length)
|
|
14628
14646
|
})), Option.toArray);
|
|
14629
14647
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
14630
|
-
const RULE$
|
|
14648
|
+
const RULE$50 = "top-level-effect";
|
|
14631
14649
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
14632
|
-
const READ_CONCURRENCY$
|
|
14650
|
+
const READ_CONCURRENCY$19 = 16;
|
|
14633
14651
|
const IMPORT_MESSAGE = "imports a module only for its effect, but sideEffects in package.json does not list this file, so a bundler drops the import. Import what the module exports, or list the entry that exists for its effect in sideEffects.";
|
|
14634
14652
|
const STATEMENT_MESSAGE = "runs a statement at the top level for its effect, but sideEffects in package.json does not list this file, so a bundler drops the module when nothing it exports is used. Move the statement into a function that the caller runs, or list the entry that exists for its effect in sideEffects.";
|
|
14635
14653
|
const isEffect = (statement) => {
|
|
14636
14654
|
if (isExpressionStatement(statement)) return !isStringLiteral(statement.expression);
|
|
14637
14655
|
return isImportDeclaration(statement) && Predicate$1.isUndefined(statement.importClause);
|
|
14638
14656
|
};
|
|
14639
|
-
const messageOf$
|
|
14657
|
+
const messageOf$5 = (statement) => {
|
|
14640
14658
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
14641
14659
|
return STATEMENT_MESSAGE;
|
|
14642
14660
|
};
|
|
14643
|
-
const problemsIn$
|
|
14661
|
+
const problemsIn$15 = (api) => (file) => (source) => {
|
|
14644
14662
|
const retained = api.createSourceFile(file, source);
|
|
14645
14663
|
const problems = pipe(retained.sourceFile.statements, Array$1.fromIterable, Array$1.filter(isEffect), Array$1.map((statement) => problemAt$6({
|
|
14646
|
-
rule: RULE$
|
|
14647
|
-
message: messageOf$
|
|
14664
|
+
rule: RULE$50,
|
|
14665
|
+
message: messageOf$5(statement)
|
|
14648
14666
|
})(statement)));
|
|
14649
14667
|
retained.dispose();
|
|
14650
14668
|
return problems;
|
|
@@ -14656,11 +14674,11 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
14656
14674
|
const names = yield* files.ownedFiles(root);
|
|
14657
14675
|
const owned = new Set(pipe(names, Array$1.map((name) => files.join(root, name))));
|
|
14658
14676
|
const sources = pipe(modules, Array$1.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
14659
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
14677
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$15(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$19 });
|
|
14660
14678
|
return Array$1.flatten(found);
|
|
14661
14679
|
}, Effect.scoped);
|
|
14662
14680
|
const BUNDLED_RULE = "bundled-side-effects";
|
|
14663
|
-
const START$
|
|
14681
|
+
const START$28 = 0;
|
|
14664
14682
|
const NAME_KEY$2 = "\"name\"";
|
|
14665
14683
|
const packageDirectoryOf = (manifests, files) => (module) => {
|
|
14666
14684
|
const parent = files.dirname(module);
|
|
@@ -14677,7 +14695,7 @@ const undeclaredAt = Effect.fn("undeclaredAt")(function* undeclaredAt(directory)
|
|
|
14677
14695
|
})));
|
|
14678
14696
|
});
|
|
14679
14697
|
const undeclaredMessage = (files, root) => ({ directory, name }) => `bundles modules of \`${name}\`, whose package.json does not declare "sideEffects". A bundler reads that field from the package that owns each module, so it keeps every module that \`${name}\` re-exports, together with what those modules import, even when this package uses none of them. Declare "sideEffects": false in ${files.relative(root, files.join(directory, PACKAGE_JSON_FILE))}, and keep a module that must run for its effect out of that package.`;
|
|
14680
|
-
const nameIndex$1 = (source) => pipe(String$1.indexOf(NAME_KEY$2)(source), Option.getOrElse(() => START$
|
|
14698
|
+
const nameIndex$1 = (source) => pipe(String$1.indexOf(NAME_KEY$2)(source), Option.getOrElse(() => START$28));
|
|
14681
14699
|
/** @internal */
|
|
14682
14700
|
const bundledSideEffectProblems = Effect.fn("bundledSideEffectProblems")(function* bundledSideEffectProblems({ root, directory, located, used }) {
|
|
14683
14701
|
const files = yield* RepositoryFiles;
|
|
@@ -14686,7 +14704,7 @@ const bundledSideEffectProblems = Effect.fn("bundledSideEffectProblems")(functio
|
|
|
14686
14704
|
const manifests = new Set(pipe(owned, Array$1.filter((file) => files.basename(file) === PACKAGE_JSON_FILE)));
|
|
14687
14705
|
const ownedSet = new Set(owned);
|
|
14688
14706
|
const directories = pipe(used, Array$1.flatMap(({ modules }) => modules), Array$1.filter((module) => ownedSet.has(module)), Array$1.flatMap((module) => Option.toArray(packageDirectoryOf(manifests, files)(module))), Array$1.dedupe, Array$1.filter((found) => found !== directory), Array$1.sortBy(Order.String));
|
|
14689
|
-
const undeclared = yield* Effect.forEach(directories, undeclaredAt, { concurrency: READ_CONCURRENCY$
|
|
14707
|
+
const undeclared = yield* Effect.forEach(directories, undeclaredAt, { concurrency: READ_CONCURRENCY$19 });
|
|
14690
14708
|
const at = problemAtIndex(BUNDLED_RULE)(located.file, located.source);
|
|
14691
14709
|
const index = nameIndex$1(located.source);
|
|
14692
14710
|
return pipe(Array$1.getSomes(undeclared), Array$1.map((found) => at(index, undeclaredMessage(files, root)(found))));
|
|
@@ -14812,12 +14830,12 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
14812
14830
|
return Array$1.flatten(found);
|
|
14813
14831
|
});
|
|
14814
14832
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
14815
|
-
const RULE$
|
|
14833
|
+
const RULE$49 = "legacy-typescript";
|
|
14816
14834
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
14817
14835
|
const COMPILER = "typescript";
|
|
14818
14836
|
const CURRENT_MAJOR = 7;
|
|
14819
14837
|
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
14820
|
-
const FIRST$
|
|
14838
|
+
const FIRST$13 = 1;
|
|
14821
14839
|
const legacyOf = (id) => {
|
|
14822
14840
|
const { name, version } = parseDependencyPath(id);
|
|
14823
14841
|
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
@@ -14828,10 +14846,10 @@ const legacyOf = (id) => {
|
|
|
14828
14846
|
};
|
|
14829
14847
|
const dependentsOf$1 = (nodes) => (id) => pipe(nodes, Array$1.filter(({ dependencies }) => Array$1.contains(dependencies, id)), Array$1.map((node) => `\`${node.id}\``));
|
|
14830
14848
|
const lineOf$4 = (source) => (id) => pipe(String$1.split(source, "\n"), Array$1.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
14831
|
-
onNone: () => FIRST$
|
|
14832
|
-
onSome: (index) => index + FIRST$
|
|
14849
|
+
onNone: () => FIRST$13,
|
|
14850
|
+
onSome: (index) => index + FIRST$13
|
|
14833
14851
|
}));
|
|
14834
|
-
const messageOf$
|
|
14852
|
+
const messageOf$4 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array$1.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)}.`;
|
|
14835
14853
|
/** @internal */
|
|
14836
14854
|
const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(function* checkTypescriptGeneration(root) {
|
|
14837
14855
|
const files = yield* RepositoryFiles;
|
|
@@ -14842,13 +14860,13 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
14842
14860
|
return pipe(Option.getOrElse(nodes, () => []), Array$1.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array$1.map((legacy) => ({
|
|
14843
14861
|
file,
|
|
14844
14862
|
line: lineOf$4(source)(legacy.id),
|
|
14845
|
-
column: FIRST$
|
|
14846
|
-
rule: RULE$
|
|
14847
|
-
message: messageOf$
|
|
14863
|
+
column: FIRST$13,
|
|
14864
|
+
rule: RULE$49,
|
|
14865
|
+
message: messageOf$4(legacy, dependentsOf$1(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
14848
14866
|
})));
|
|
14849
14867
|
});
|
|
14850
14868
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
14851
|
-
const RULE$
|
|
14869
|
+
const RULE$48 = "worker-bundle";
|
|
14852
14870
|
const BUNDLE_CONCURRENCY = 4;
|
|
14853
14871
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
14854
14872
|
const CONDITIONS = [
|
|
@@ -14859,7 +14877,7 @@ const CONDITIONS = [
|
|
|
14859
14877
|
"module",
|
|
14860
14878
|
"default"
|
|
14861
14879
|
];
|
|
14862
|
-
const problemFor$2 = problemInFile(RULE$
|
|
14880
|
+
const problemFor$2 = problemInFile(RULE$48);
|
|
14863
14881
|
const problemOf$10 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
14864
14882
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
14865
14883
|
const built = yield* Effect.tryPromise({
|
|
@@ -14894,9 +14912,9 @@ const OFF = [
|
|
|
14894
14912
|
"allow",
|
|
14895
14913
|
0
|
|
14896
14914
|
];
|
|
14897
|
-
const taggedError$
|
|
14915
|
+
const taggedError$11 = Schema.TaggedError;
|
|
14898
14916
|
/** @internal */
|
|
14899
|
-
var DisabledRulesConfigUnreadable = class extends taggedError$
|
|
14917
|
+
var DisabledRulesConfigUnreadable = class extends taggedError$11()("DisabledRulesConfigUnreadable", {
|
|
14900
14918
|
file: Schema.String,
|
|
14901
14919
|
reason: Schema.String
|
|
14902
14920
|
}) {};
|
|
@@ -15080,10 +15098,10 @@ const weakeningsOf = (expected) => (config) => [
|
|
|
15080
15098
|
...builtWeakenings(expected.built)(config)
|
|
15081
15099
|
];
|
|
15082
15100
|
// src/app/unused-proper-nouns.ts
|
|
15083
|
-
const RULE$
|
|
15101
|
+
const RULE$47 = "unused-proper-noun";
|
|
15084
15102
|
const MARKDOWN$6 = "**/*.md";
|
|
15085
|
-
const START$
|
|
15086
|
-
const READ_CONCURRENCY$
|
|
15103
|
+
const START$27 = 0;
|
|
15104
|
+
const READ_CONCURRENCY$18 = 16;
|
|
15087
15105
|
const properNounsOf = (textlint) => {
|
|
15088
15106
|
const filters = sectionOf$1(sectionOf$1(textlint)["filters"]);
|
|
15089
15107
|
const allowlist = sectionOf$1(filters["allowlist"]);
|
|
@@ -15102,42 +15120,42 @@ const unusedProperNouns = Effect.fn("unusedProperNouns")(function* unusedProperN
|
|
|
15102
15120
|
if (Array$1.isReadonlyArrayEmpty(nouns)) return [];
|
|
15103
15121
|
const files = yield* RepositoryFiles;
|
|
15104
15122
|
const listed = yield* files.listedFiles(root);
|
|
15105
|
-
const texts = yield* Effect.forEach(checkedFiles(config.textlint, listed), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$
|
|
15123
|
+
const texts = yield* Effect.forEach(checkedFiles(config.textlint, listed), (name) => files.readFile(files.join(root, name)), { concurrency: READ_CONCURRENCY$18 });
|
|
15106
15124
|
const found = Array$1.getSomes(texts);
|
|
15107
|
-
const at = problemAtIndex(RULE$
|
|
15108
|
-
return pipe(nouns, Array$1.filter((noun) => !pipe(found, Array$1.some(String$1.includes(noun)))), Array$1.map((noun) => at(pipe(source, String$1.indexOf(`"${noun}"`), Option.getOrElse(() => START$
|
|
15125
|
+
const at = problemAtIndex(RULE$47)(file, source);
|
|
15126
|
+
return pipe(nouns, Array$1.filter((noun) => !pipe(found, Array$1.some(String$1.includes(noun)))), Array$1.map((noun) => at(pipe(source, String$1.indexOf(`"${noun}"`), Option.getOrElse(() => START$27)), `The proper noun "${noun}" is in textlint.properNouns, but no text the Japanese checks read contains it, so it lets nothing through. Remove it.`)));
|
|
15109
15127
|
});
|
|
15110
15128
|
// src/app/disabled-rules.ts
|
|
15111
|
-
const RULE$
|
|
15129
|
+
const RULE$46 = "disabled-rule";
|
|
15112
15130
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
15113
|
-
const START$
|
|
15131
|
+
const START$26 = 0;
|
|
15114
15132
|
const SIDE_CONFIG = /(?:^|\/)(?:\.oxlintrc(?:\.jsonc?)?|oxlint\.config\.[cm]?[jt]s|\.oxlintignore|\.eslintrc(?:\.\w+)?|eslint\.config\.[cm]?[jt]s|\.eslintignore|\.textlintrc(?:\.\w+)?|\.textlintignore|\.markdownlint(?:-cli2)?(?:\.\w+)?|\.markdownlintignore|\.prettierignore|\.oxfmtrc(?:\.jsonc?)?|knip\.jsonc?)$/u;
|
|
15115
15133
|
const SIDE_CONFIG_MESSAGE = "This file configures a check outside vite.config.ts, where msch cannot see whether it turns rules off. Delete it; msch builds every check setting in vite.config.ts.";
|
|
15116
15134
|
const sideConfigs = Effect.fn("sideConfigs")(function* sideConfigs(root) {
|
|
15117
15135
|
const files = yield* RepositoryFiles;
|
|
15118
15136
|
const listed = yield* files.listedFiles(root);
|
|
15119
15137
|
const isExempt = matcher(exempt);
|
|
15120
|
-
return pipe(listed, Array$1.filter((name) => SIDE_CONFIG.test(name) && !isExempt(name)), Array$1.map((name) => problemAtIndex(RULE$
|
|
15138
|
+
return pipe(listed, Array$1.filter((name) => SIDE_CONFIG.test(name) && !isExempt(name)), Array$1.map((name) => problemAtIndex(RULE$46)(files.join(root, name), "")(START$26, SIDE_CONFIG_MESSAGE)));
|
|
15121
15139
|
});
|
|
15122
15140
|
const configWeakenings = Effect.fn("configWeakenings")(function* configWeakenings(root, source) {
|
|
15123
15141
|
const file = (yield* RepositoryFiles).join(root, CONFIG_FILE$5);
|
|
15124
15142
|
const config = yield* resolvedConfig(file);
|
|
15125
15143
|
const expected = yield* expectationsIn(root);
|
|
15126
|
-
const at = problemAtIndex(RULE$
|
|
15144
|
+
const at = problemAtIndex(RULE$46)(file, source);
|
|
15127
15145
|
const unused = yield* unusedProperNouns({
|
|
15128
15146
|
root,
|
|
15129
15147
|
file,
|
|
15130
15148
|
source,
|
|
15131
15149
|
config
|
|
15132
15150
|
});
|
|
15133
|
-
return [...pipe(weakeningsOf(expected)(config), Array$1.map(({ anchor, message }) => at(Option.getOrElse(String$1.indexOf(anchor)(source), () => START$
|
|
15151
|
+
return [...pipe(weakeningsOf(expected)(config), Array$1.map(({ anchor, message }) => at(Option.getOrElse(String$1.indexOf(anchor)(source), () => START$26), message))), ...unused];
|
|
15134
15152
|
});
|
|
15135
15153
|
/** @internal */
|
|
15136
15154
|
const checkDisabledRules = Effect.fn("checkDisabledRules")(function* checkDisabledRules(root) {
|
|
15137
15155
|
const files = yield* RepositoryFiles;
|
|
15138
15156
|
const text = yield* files.readFile(files.join(root, CONFIG_FILE$5));
|
|
15139
15157
|
if (Option.isNone(text)) return [];
|
|
15140
|
-
return [...yield* configWeakenings(root, text.value).pipe(Effect.catchTag("DisabledRulesConfigUnreadable", ({ file, reason }) => Effect.succeed([problemAtIndex(RULE$
|
|
15158
|
+
return [...yield* configWeakenings(root, text.value).pipe(Effect.catchTag("DisabledRulesConfigUnreadable", ({ file, reason }) => Effect.succeed([problemAtIndex(RULE$46)(file, "")(START$26, `msch could not load this file: ${reason}`)]))), ...yield* sideConfigs(root)];
|
|
15141
15159
|
});
|
|
15142
15160
|
// src/app/build-checks.ts
|
|
15143
15161
|
/** @internal */
|
|
@@ -15234,7 +15252,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
15234
15252
|
imports: importedFilesOf(checker)(sourceFile)
|
|
15235
15253
|
})), Array$1.filter((facts) => Array$1.isReadonlyArrayNonEmpty(facts.values) || Array$1.isReadonlyArrayNonEmpty(facts.imports)));
|
|
15236
15254
|
// src/features/check-value-owners/model/name-lists.ts
|
|
15237
|
-
const RULE$
|
|
15255
|
+
const RULE$45 = "hand-written-names";
|
|
15238
15256
|
const TEST_FILE$1 = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
15239
15257
|
const nameListOf = (site) => {
|
|
15240
15258
|
if (TEST_FILE$1.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -15249,7 +15267,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
15249
15267
|
file,
|
|
15250
15268
|
line,
|
|
15251
15269
|
column,
|
|
15252
|
-
rule: RULE$
|
|
15270
|
+
rule: RULE$45,
|
|
15253
15271
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
15254
15272
|
});
|
|
15255
15273
|
const problemOf$9 = ({ list, reason }) => listedProblem({
|
|
@@ -15664,7 +15682,7 @@ const analyzeProject = ({ owners, sourceChecks }) => (project) => {
|
|
|
15664
15682
|
// src/features/check-value-owners/model/cache.ts
|
|
15665
15683
|
const CACHE_DIRECTORY = [...MSCH_CACHE, "value-owners"];
|
|
15666
15684
|
const CACHE_SUFFIX = ".json";
|
|
15667
|
-
const EMPTY$
|
|
15685
|
+
const EMPTY$3 = "";
|
|
15668
15686
|
const FIELD_SEPARATOR$1 = "\0";
|
|
15669
15687
|
const LINE_SEPARATOR$1 = "\n";
|
|
15670
15688
|
const ValueSchema = Schema.Union([Schema.String, Schema.Finite]);
|
|
@@ -15702,7 +15720,7 @@ const fileDigest = (hash) => {
|
|
|
15702
15720
|
onSome: Effect.succeed,
|
|
15703
15721
|
onNone: () => Effect.gen(function* readDigest() {
|
|
15704
15722
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
15705
|
-
const found = yield* hash(Option.getOrElse(text, () => EMPTY$
|
|
15723
|
+
const found = yield* hash(Option.getOrElse(text, () => EMPTY$3));
|
|
15706
15724
|
digests.set(file, found);
|
|
15707
15725
|
return found;
|
|
15708
15726
|
})
|
|
@@ -15713,7 +15731,7 @@ const analysisCache = Effect.fn("analysisCache")(function* analysisCache(root, o
|
|
|
15713
15731
|
const files = yield* RepositoryFiles;
|
|
15714
15732
|
const hash = yield* hasher;
|
|
15715
15733
|
const fingerprint = yield* implementationFingerprint(import.meta.dirname);
|
|
15716
|
-
const salt = yield* hash(Array$1.join([fingerprint, String$1.replaceAll(root, EMPTY$
|
|
15734
|
+
const salt = yield* hash(Array$1.join([fingerprint, String$1.replaceAll(root, EMPTY$3)(owners)], FIELD_SEPARATOR$1));
|
|
15717
15735
|
return {
|
|
15718
15736
|
root,
|
|
15719
15737
|
directory: files.join(root, ...CACHE_DIRECTORY),
|
|
@@ -15728,7 +15746,7 @@ const keyOf$1 = (cache) => (configPath, inputs) => Effect.gen(function* deriveKe
|
|
|
15728
15746
|
const header = [
|
|
15729
15747
|
cache.salt,
|
|
15730
15748
|
files.relative(cache.root, configPath),
|
|
15731
|
-
String$1.replaceAll(cache.root, EMPTY$
|
|
15749
|
+
String$1.replaceAll(cache.root, EMPTY$3)(inputs.options)
|
|
15732
15750
|
];
|
|
15733
15751
|
return yield* cache.hash(Array$1.join([
|
|
15734
15752
|
...header,
|
|
@@ -16040,9 +16058,9 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
16040
16058
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
16041
16059
|
}, Effect.scoped);
|
|
16042
16060
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
16043
|
-
const RULE$
|
|
16061
|
+
const RULE$44 = "namespace-destructuring";
|
|
16044
16062
|
const LOCAL = /^[.#/]/u;
|
|
16045
|
-
const messageOf$
|
|
16063
|
+
const messageOf$3 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
16046
16064
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
16047
16065
|
const importedNames = (sourceFile) => {
|
|
16048
16066
|
const bindings = pipe(sourceFile.statements, Array$1.filter(isImportDeclaration), Array$1.filter((declaration) => isPackage(declaration.moduleSpecifier)), Array$1.map((declaration) => Option.fromUndefinedOr(declaration.importClause)), Array$1.getSomes, Array$1.filter((clause) => clause.phaseModifier !== SyntaxKind.TypeKeyword), Array$1.map((clause) => Option.fromUndefinedOr(clause.namedBindings)), Array$1.getSomes);
|
|
@@ -16056,20 +16074,20 @@ const destructuredName = (declaration) => {
|
|
|
16056
16074
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
16057
16075
|
};
|
|
16058
16076
|
const problemOf$8 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$6({
|
|
16059
|
-
rule: RULE$
|
|
16060
|
-
message: messageOf$
|
|
16077
|
+
rule: RULE$44,
|
|
16078
|
+
message: messageOf$3(name)
|
|
16061
16079
|
})), Option.map((report) => report(declaration)));
|
|
16062
16080
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
16063
16081
|
const names = importedNames(sourceFile);
|
|
16064
16082
|
return pipe(descendantsOf(sourceFile), Array$1.filter(isVariableDeclaration), Array$1.map(problemOf$8(names)), Array$1.getSomes);
|
|
16065
16083
|
};
|
|
16066
16084
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
16067
|
-
const RULE$
|
|
16085
|
+
const RULE$43 = "pass-through-wrapper";
|
|
16068
16086
|
const SINGLE_STATEMENT = 1;
|
|
16069
16087
|
const SINGLE_DECLARATION = 1;
|
|
16070
16088
|
const THIS_PARAMETER = "this";
|
|
16071
16089
|
const NO_ARGUMENTS = [];
|
|
16072
|
-
const messageOf$
|
|
16090
|
+
const messageOf$2 = (callee) => `This function only passes its parameters to ${callee} unchanged. Call ${callee} directly and delete this function.`;
|
|
16073
16091
|
const unwrapped = (expression) => {
|
|
16074
16092
|
if (isParenthesizedExpression(expression)) return unwrapped(expression.expression);
|
|
16075
16093
|
return expression;
|
|
@@ -16161,8 +16179,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
16161
16179
|
const problemOf$7 = (checker) => (candidate) => {
|
|
16162
16180
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
16163
16181
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$6({
|
|
16164
|
-
rule: RULE$
|
|
16165
|
-
message: messageOf$
|
|
16182
|
+
rule: RULE$43,
|
|
16183
|
+
message: messageOf$2(forward.callee.getText())
|
|
16166
16184
|
})(candidate.name)));
|
|
16167
16185
|
};
|
|
16168
16186
|
const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(sourceFile), Array$1.map(candidateOf), Array$1.getSomes, Array$1.map(problemOf$7(checker)), Array$1.getSomes);
|
|
@@ -16170,7 +16188,7 @@ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(so
|
|
|
16170
16188
|
/** @internal */
|
|
16171
16189
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
|
|
16172
16190
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
16173
|
-
const RULE$
|
|
16191
|
+
const RULE$42 = "known-plugins";
|
|
16174
16192
|
const SETTINGS_FILE$3 = ".claude/settings.json";
|
|
16175
16193
|
const MARKETPLACE_FILE$2 = ".claude-plugin/marketplace.json";
|
|
16176
16194
|
const GITHUB$4 = "github";
|
|
@@ -16191,7 +16209,7 @@ const MarketplaceSchema = Schema.Struct({
|
|
|
16191
16209
|
plugins: Schema.Array(Schema.Struct({ name: Schema.String }))
|
|
16192
16210
|
});
|
|
16193
16211
|
const decodeMarketplace = Schema.decodeUnknownOption(Schema.fromJsonString(MarketplaceSchema));
|
|
16194
|
-
const problem$6 = problemInFile(RULE$
|
|
16212
|
+
const problem$6 = problemInFile(RULE$42);
|
|
16195
16213
|
const knownFrom = (repository, marketplace, settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(marketplace.name)), Option.exists(({ source }) => source.source === GITHUB$4 && source.repo === repository));
|
|
16196
16214
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
16197
16215
|
const pluginProblems = (marketplace, file, settings) => {
|
|
@@ -16216,20 +16234,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
16216
16234
|
}));
|
|
16217
16235
|
});
|
|
16218
16236
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
16219
|
-
const RULE$
|
|
16237
|
+
const RULE$41 = "missing-hook";
|
|
16220
16238
|
const SETTINGS_FILE$2 = /^\.claude\/settings\.json$/u;
|
|
16221
16239
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
16222
16240
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
16223
16241
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
16224
16242
|
const PLUGIN_ROOT$1 = "..";
|
|
16225
|
-
const READ_CONCURRENCY$
|
|
16226
|
-
const START$
|
|
16243
|
+
const READ_CONCURRENCY$17 = 16;
|
|
16244
|
+
const START$25 = 0;
|
|
16227
16245
|
const referenceOf = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
16228
16246
|
path,
|
|
16229
|
-
index: found.index ?? START$
|
|
16247
|
+
index: found.index ?? START$25
|
|
16230
16248
|
})), Option.toArray);
|
|
16231
16249
|
const referencesIn = (pattern, source) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.flatMap(referenceOf));
|
|
16232
|
-
const problemsIn$
|
|
16250
|
+
const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
16233
16251
|
const files = yield* RepositoryFiles;
|
|
16234
16252
|
const text = yield* files.readFile(file);
|
|
16235
16253
|
if (Option.isNone(text)) return [];
|
|
@@ -16241,7 +16259,7 @@ const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
16241
16259
|
return pipe(missing, Array$1.map(({ path, index }) => ({
|
|
16242
16260
|
file,
|
|
16243
16261
|
...positionOf(source)(index),
|
|
16244
|
-
rule: RULE$
|
|
16262
|
+
rule: RULE$41,
|
|
16245
16263
|
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.`
|
|
16246
16264
|
})));
|
|
16247
16265
|
});
|
|
@@ -16265,11 +16283,11 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
16265
16283
|
}];
|
|
16266
16284
|
return [];
|
|
16267
16285
|
}));
|
|
16268
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
16286
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$14, { concurrency: READ_CONCURRENCY$17 });
|
|
16269
16287
|
return Array$1.flatten(found);
|
|
16270
16288
|
});
|
|
16271
16289
|
// src/features/check-agent-settings/model/project-extensions.ts
|
|
16272
|
-
const RULE$
|
|
16290
|
+
const RULE$40 = "project-claude-extensions";
|
|
16273
16291
|
const SETTINGS_FILE$1 = ".claude/settings.json";
|
|
16274
16292
|
const SETUP_EVENT = "SessionStart";
|
|
16275
16293
|
const EXTENSION_DIRECTORIES = [
|
|
@@ -16285,8 +16303,8 @@ const decodeSettings$2 = Schema.decodeUnknownOption(Schema.fromJsonString(Settin
|
|
|
16285
16303
|
const hookProblems = (file, source) => pipe(decodeSettings$2(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.map(Record.keys), Option.getOrElse(() => []), Array$1.filter((event) => event !== SETUP_EVENT), Array$1.map((event) => {
|
|
16286
16304
|
const message = `runs a ${event} hook from the project settings. ${REASON$3}`;
|
|
16287
16305
|
return pipe(source, String$1.indexOf(`"${event}"`), Option.match({
|
|
16288
|
-
onNone: () => problemInFile(RULE$
|
|
16289
|
-
onSome: (index) => problemAtIndex(RULE$
|
|
16306
|
+
onNone: () => problemInFile(RULE$40)(file, message),
|
|
16307
|
+
onSome: (index) => problemAtIndex(RULE$40)(file, source)(index, message)
|
|
16290
16308
|
}));
|
|
16291
16309
|
}));
|
|
16292
16310
|
const checkProjectExtensions = Effect.fn("checkProjectExtensions")(function* checkProjectExtensions(root) {
|
|
@@ -16294,7 +16312,7 @@ const checkProjectExtensions = Effect.fn("checkProjectExtensions")(function* che
|
|
|
16294
16312
|
const settingsFile = files.join(root, SETTINGS_FILE$1);
|
|
16295
16313
|
const settings = yield* files.readFile(settingsFile);
|
|
16296
16314
|
const tracked = yield* files.trackedFiles(root, EXTENSION_DIRECTORIES);
|
|
16297
|
-
const extensionProblems = pipe(tracked, Array$1.filter((name) => pipe(EXTENSION_DIRECTORIES, Array$1.some((directory) => String$1.startsWith(directory)(name)))), Array$1.map((name) => problemInFile(RULE$
|
|
16315
|
+
const extensionProblems = pipe(tracked, Array$1.filter((name) => pipe(EXTENSION_DIRECTORIES, Array$1.some((directory) => String$1.startsWith(directory)(name)))), Array$1.map((name) => problemInFile(RULE$40)(files.join(root, name), `is a Claude Code extension in .claude. ${REASON$3}`)));
|
|
16298
16316
|
return [...Option.match(settings, {
|
|
16299
16317
|
onNone: () => [],
|
|
16300
16318
|
onSome: (source) => hookProblems(settingsFile, source)
|
|
@@ -16326,7 +16344,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
16326
16344
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
16327
16345
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
16328
16346
|
// src/features/check-documented-commands/model/commands.ts
|
|
16329
|
-
const RULE$
|
|
16347
|
+
const RULE$39 = "documented-commands";
|
|
16330
16348
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
16331
16349
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
16332
16350
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -16345,7 +16363,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
16345
16363
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
16346
16364
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
16347
16365
|
const ONE$2 = 1;
|
|
16348
|
-
const START$
|
|
16366
|
+
const START$24 = 0;
|
|
16349
16367
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE$1), Array$1.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
16350
16368
|
const filterOf = (tokens) => pipe(tokens, Array$1.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array$1.get(tokens, index + ONE$2)), Option.orElse(() => pipe(tokens, Array$1.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
16351
16369
|
const follows = (tokens) => (index) => pipe(Array$1.get(tokens, index - ONE$2), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -16401,11 +16419,11 @@ const whereOf = (scope, file) => {
|
|
|
16401
16419
|
return `the package that holds ${file}`;
|
|
16402
16420
|
};
|
|
16403
16421
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array$1.some(hasTask$1(graph, task)));
|
|
16404
|
-
const problemsIn$
|
|
16422
|
+
const problemsIn$13 = (graph, absolute, { file, text }) => pipe(Array$1.fromIterable(String$1.matchAll(COMMAND)(text)), Array$1.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
16405
16423
|
file: absolute(file),
|
|
16406
|
-
...positionOf(text)(match.index ?? START$
|
|
16407
|
-
rule: RULE$
|
|
16408
|
-
message: `${match[START$
|
|
16424
|
+
...positionOf(text)(match.index ?? START$24),
|
|
16425
|
+
rule: RULE$39,
|
|
16426
|
+
message: `${match[START$24]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
16409
16427
|
})), Option.toArray)));
|
|
16410
16428
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$12), Array$1.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
16411
16429
|
/** @internal */
|
|
@@ -16429,14 +16447,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
16429
16447
|
file: absolute(Array$1.headNonEmpty(commanded).file),
|
|
16430
16448
|
line: ONE$2,
|
|
16431
16449
|
column: ONE$2,
|
|
16432
|
-
rule: RULE$
|
|
16450
|
+
rule: RULE$39,
|
|
16433
16451
|
message: "msch could not list the tasks with `vp run --json`"
|
|
16434
16452
|
}],
|
|
16435
|
-
onSome: (found) => pipe(commanded, Array$1.flatMap((document) => problemsIn$
|
|
16453
|
+
onSome: (found) => pipe(commanded, Array$1.flatMap((document) => problemsIn$13(found, absolute, document)))
|
|
16436
16454
|
});
|
|
16437
16455
|
});
|
|
16438
16456
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
16439
|
-
const RULE$
|
|
16457
|
+
const RULE$38 = "legacy-web";
|
|
16440
16458
|
const FIRST_COLUMN$7 = 1;
|
|
16441
16459
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
16442
16460
|
const Finding = Schema.Struct({
|
|
@@ -16475,16 +16493,16 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
16475
16493
|
file: files.join(root, file),
|
|
16476
16494
|
line,
|
|
16477
16495
|
column: FIRST_COLUMN$7,
|
|
16478
|
-
rule: RULE$
|
|
16496
|
+
rule: RULE$38,
|
|
16479
16497
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
16480
16498
|
});
|
|
16481
16499
|
return pipe(scan.guides, Array$1.flatMap(({ guideId, rules }) => pipe(rules, Array$1.flatMap(({ ruleId, findings }) => pipe(findings, Array$1.map(problemOf(guideId, ruleId)))))));
|
|
16482
16500
|
});
|
|
16483
16501
|
// src/shared/lib/section-check.ts
|
|
16484
|
-
const taggedError$
|
|
16485
|
-
var SectionConfigUnreadable = class extends taggedError$
|
|
16502
|
+
const taggedError$10 = Schema.TaggedError;
|
|
16503
|
+
var SectionConfigUnreadable = class extends taggedError$10()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
16486
16504
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
16487
|
-
const FIRST$
|
|
16505
|
+
const FIRST$12 = 1;
|
|
16488
16506
|
const ONE$1 = 1;
|
|
16489
16507
|
const diagnostics = Metric.counter("lint.diagnostics", { description: "Diagnostics that each lint rule reported, before msch keeps only the errors" });
|
|
16490
16508
|
const countDiagnostics = (check, found) => Effect.forEach(found, (diagnostic) => diagnostics.pipe(Metric.withAttributes({
|
|
@@ -16525,7 +16543,7 @@ const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
|
16525
16543
|
onSuccess: (found) => pipe(found, Array$1.filter(({ severity }) => severity === "error"), Array$1.map((diagnostic) => ({
|
|
16526
16544
|
file: files.join(root, diagnostic.path),
|
|
16527
16545
|
line: diagnostic.line,
|
|
16528
|
-
column: diagnostic.column ?? FIRST$
|
|
16546
|
+
column: diagnostic.column ?? FIRST$12,
|
|
16529
16547
|
rule: check.rule,
|
|
16530
16548
|
message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`
|
|
16531
16549
|
})))
|
|
@@ -16547,8 +16565,8 @@ const EXTENSION$1 = /\.[^./]+$/u;
|
|
|
16547
16565
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
16548
16566
|
const PLUGIN_HOOKS = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
16549
16567
|
const PLUGIN_ROOT = /\$\{CLAUDE_PLUGIN_ROOT\}/gu;
|
|
16550
|
-
const READ_CONCURRENCY$
|
|
16551
|
-
const RULE$
|
|
16568
|
+
const READ_CONCURRENCY$16 = 64;
|
|
16569
|
+
const RULE$37 = "shell-script";
|
|
16552
16570
|
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 a SessionStart hook in .claude/settings.json, which installs the toolchain, and a script that a plugin's hooks/hooks.json runs to provide the plugin's dependencies before its TypeScript can load stay shell scripts.";
|
|
16553
16571
|
const HookSchema = Schema.Struct({
|
|
16554
16572
|
command: Schema.optional(Schema.String),
|
|
@@ -16576,7 +16594,7 @@ const pluginCommands = (hooksFile, source) => {
|
|
|
16576
16594
|
const hasExtension = (name) => EXTENSION$1.test(baseName$1(name));
|
|
16577
16595
|
const pluginSessionStarts = Effect.fn("pluginSessionStarts")(function* pluginSessionStarts(root, names) {
|
|
16578
16596
|
const files = yield* RepositoryFiles;
|
|
16579
|
-
const commands = yield* Effect.forEach(pipe(names, Array$1.filter((name) => PLUGIN_HOOKS.test(name))), (name) => files.readFile(files.join(root, name)).pipe(Effect.map((source) => pipe(source, Option.map((text) => pluginCommands(name, text)), Option.getOrElse(() => NO_TEXT)))), { concurrency: READ_CONCURRENCY$
|
|
16597
|
+
const commands = yield* Effect.forEach(pipe(names, Array$1.filter((name) => PLUGIN_HOOKS.test(name))), (name) => files.readFile(files.join(root, name)).pipe(Effect.map((source) => pipe(source, Option.map((text) => pluginCommands(name, text)), Option.getOrElse(() => NO_TEXT)))), { concurrency: READ_CONCURRENCY$16 });
|
|
16580
16598
|
return Array$1.flatten(commands);
|
|
16581
16599
|
});
|
|
16582
16600
|
/** @internal */
|
|
@@ -16594,8 +16612,8 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
16594
16612
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
16595
16613
|
};
|
|
16596
16614
|
const candidates = pipe(names, Array$1.filter((name) => !isSessionStartHook(name)));
|
|
16597
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
16598
|
-
return pipe(shell, Array$1.map((name) => problemInFile(RULE$
|
|
16615
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$16 });
|
|
16616
|
+
return pipe(shell, Array$1.map((name) => problemInFile(RULE$37)(files.join(root, name), MESSAGE$9)));
|
|
16599
16617
|
});
|
|
16600
16618
|
// src/features/check-structure/model/structure.ts
|
|
16601
16619
|
const checkStructure = checkSection({
|
|
@@ -16671,14 +16689,14 @@ const problemsOf = (source) => pipe(simpleCommands(source.text), Array$1.flatMap
|
|
|
16671
16689
|
const commandProblems$2 = (sources) => pipe(sources, Array$1.flatMap(problemsOf));
|
|
16672
16690
|
// src/shared/lib/workflow-run.ts
|
|
16673
16691
|
const RUN_KEY = "run";
|
|
16674
|
-
const START$
|
|
16675
|
-
const startOf$
|
|
16692
|
+
const START$23 = 0;
|
|
16693
|
+
const startOf$3 = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$23));
|
|
16676
16694
|
const runScriptsOf = (source) => {
|
|
16677
16695
|
const found = [];
|
|
16678
16696
|
visit$1(parseDocument(source), { Pair: (_key, pair) => {
|
|
16679
16697
|
if (isPair(pair) && isScalar(pair.key) && pair.key.value === RUN_KEY && isScalar(pair.value) && typeof pair.value.value === "string") found.push({
|
|
16680
16698
|
text: pair.value.value,
|
|
16681
|
-
start: startOf$
|
|
16699
|
+
start: startOf$3(pair.value.range)
|
|
16682
16700
|
});
|
|
16683
16701
|
} });
|
|
16684
16702
|
return found;
|
|
@@ -16728,16 +16746,16 @@ const AGENT_DOCS = [
|
|
|
16728
16746
|
":(glob)**/CLAUDE.md",
|
|
16729
16747
|
...EXCLUDED$5
|
|
16730
16748
|
];
|
|
16731
|
-
const READ_CONCURRENCY$
|
|
16732
|
-
const START$
|
|
16733
|
-
const FIRST$
|
|
16749
|
+
const READ_CONCURRENCY$15 = 16;
|
|
16750
|
+
const START$22 = 0;
|
|
16751
|
+
const FIRST$11 = 1;
|
|
16734
16752
|
const LINE = "\n";
|
|
16735
16753
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
16736
16754
|
const decodeCommandText = Schema.decodeUnknownOption(CommandText);
|
|
16737
16755
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
16738
16756
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
16739
16757
|
const NO_SOURCES = [];
|
|
16740
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
16758
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$22));
|
|
16741
16759
|
const scriptSources = (file) => (source) => pipe(decodePackageJson(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array$1.map(([name, text]) => {
|
|
16742
16760
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
16743
16761
|
return {
|
|
@@ -16759,8 +16777,8 @@ const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE
|
|
|
16759
16777
|
kind: "hook",
|
|
16760
16778
|
file,
|
|
16761
16779
|
position: {
|
|
16762
|
-
line: index + FIRST$
|
|
16763
|
-
column: FIRST$
|
|
16780
|
+
line: index + FIRST$11,
|
|
16781
|
+
column: FIRST$11
|
|
16764
16782
|
},
|
|
16765
16783
|
name,
|
|
16766
16784
|
text
|
|
@@ -16797,7 +16815,7 @@ const taskSources = Effect.fn("taskSources")(function* taskSources(root, directo
|
|
|
16797
16815
|
return pipe(tasks, Array$1.flatMap((task) => Option.toArray(taskSource(file, source)(task))));
|
|
16798
16816
|
});
|
|
16799
16817
|
const workspaceTasks = Effect.fn("workspaceTasks")(function* workspaceTasks(root, directories) {
|
|
16800
|
-
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$
|
|
16818
|
+
const found = yield* Effect.forEach(directories, (directory) => taskSources(root, directory), { concurrency: READ_CONCURRENCY$15 });
|
|
16801
16819
|
return Array$1.flatten(found);
|
|
16802
16820
|
});
|
|
16803
16821
|
const readSources = Effect.fn("readSources")(function* readSources(root, names, sourcesOf) {
|
|
@@ -16809,7 +16827,7 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
|
|
|
16809
16827
|
onSome: sourcesOf(file, name)
|
|
16810
16828
|
});
|
|
16811
16829
|
return files.readFile(file).pipe(Effect.map(sourcesIn));
|
|
16812
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
16830
|
+
}, { concurrency: READ_CONCURRENCY$15 });
|
|
16813
16831
|
return Array$1.flatten(found);
|
|
16814
16832
|
});
|
|
16815
16833
|
/** @internal */
|
|
@@ -16833,7 +16851,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
16833
16851
|
return Array$1.flatten(found);
|
|
16834
16852
|
});
|
|
16835
16853
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
16836
|
-
const RULE$
|
|
16854
|
+
const RULE$36 = "package-script";
|
|
16837
16855
|
const LIFECYCLE = [
|
|
16838
16856
|
"preinstall",
|
|
16839
16857
|
"install",
|
|
@@ -16856,12 +16874,12 @@ const LIFECYCLE = [
|
|
|
16856
16874
|
const problemOf$6 = ({ file, position, name }) => ({
|
|
16857
16875
|
file,
|
|
16858
16876
|
...position,
|
|
16859
|
-
rule: RULE$
|
|
16877
|
+
rule: RULE$36,
|
|
16860
16878
|
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.`
|
|
16861
16879
|
});
|
|
16862
16880
|
const packageScriptProblems = (sources) => pipe(sources, Array$1.filter(({ kind, name }) => kind === "script" && !Array$1.contains(LIFECYCLE, name)), Array$1.map(problemOf$6));
|
|
16863
16881
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
16864
|
-
const RULE$
|
|
16882
|
+
const RULE$35 = "vite-plus-block";
|
|
16865
16883
|
const MARKER = Array$1.join([
|
|
16866
16884
|
"<!--",
|
|
16867
16885
|
"VITE PLUS START",
|
|
@@ -16874,7 +16892,7 @@ const problemIn = (file) => (source) => {
|
|
|
16874
16892
|
return Option.some({
|
|
16875
16893
|
file,
|
|
16876
16894
|
...positionOf(source)(index.value),
|
|
16877
|
-
rule: RULE$
|
|
16895
|
+
rule: RULE$35,
|
|
16878
16896
|
message: MESSAGE$8
|
|
16879
16897
|
});
|
|
16880
16898
|
};
|
|
@@ -16890,13 +16908,478 @@ const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
|
|
|
16890
16908
|
...blocks
|
|
16891
16909
|
];
|
|
16892
16910
|
});
|
|
16911
|
+
// src/features/check-workflows/model/yaml-nodes.ts
|
|
16912
|
+
const EMPTY$2 = "";
|
|
16913
|
+
const ByStartDescending = Order.mapInput(Order.flip(Number$1.Order), ({ start }) => start);
|
|
16914
|
+
const NEWLINE$1 = "\n";
|
|
16915
|
+
const FIRST$10 = 0;
|
|
16916
|
+
const NEXT$3 = 1;
|
|
16917
|
+
const RANGE_END = 2;
|
|
16918
|
+
/** @internal */
|
|
16919
|
+
const scalarText = (node) => pipe(Option.liftPredicate(node, isScalar), Option.map(({ value }) => value), Option.filter(Predicate$1.isString), Option.getOrElse(() => EMPTY$2));
|
|
16920
|
+
/** @internal */
|
|
16921
|
+
const fieldOf$1 = (key) => (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => scalarText(map.get(key, true))), Option.getOrElse(() => EMPTY$2));
|
|
16922
|
+
/** @internal */
|
|
16923
|
+
const usesOf = fieldOf$1("uses");
|
|
16924
|
+
/** @internal */
|
|
16925
|
+
const lineStart = ({ source, offset }) => pipe(source, String$1.slice(FIRST$10, offset), String$1.lastIndexOf(NEWLINE$1), Option.map((index) => index + NEXT$3), Option.getOrElse(() => FIRST$10));
|
|
16926
|
+
const rangeOf$4 = (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMapNullishOr(({ range }) => range));
|
|
16927
|
+
/** @internal */
|
|
16928
|
+
const startOf$2 = (node) => pipe(rangeOf$4(node), Option.map(([start]) => start));
|
|
16929
|
+
/** @internal */
|
|
16930
|
+
const endOf = (node) => pipe(rangeOf$4(node), Option.map((range) => range[RANGE_END]));
|
|
16931
|
+
const insertAt = (text) => ({ start, end, text: insert }) => pipe(text, String$1.slice(FIRST$10, start)) + insert + pipe(text, String$1.slice(end));
|
|
16932
|
+
/** @internal */
|
|
16933
|
+
const applyEdits = ({ source, edits }) => pipe(Array$1.sort(edits, ByStartDescending), Array$1.match({
|
|
16934
|
+
onEmpty: () => source,
|
|
16935
|
+
onNonEmpty: ([edit, ...rest]) => applyEdits({
|
|
16936
|
+
source: insertAt(source)(edit),
|
|
16937
|
+
edits: rest
|
|
16938
|
+
})
|
|
16939
|
+
}));
|
|
16940
|
+
/** @internal */
|
|
16941
|
+
const itemsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map(({ items }) => items), Option.getOrElse(() => []));
|
|
16942
|
+
// src/features/check-workflows/model/apply-template.ts
|
|
16943
|
+
const LAST_NEWLINE = /\n?$/u;
|
|
16944
|
+
const NEWLINE = "\n";
|
|
16945
|
+
const rangeOf$3 = (node) => pipe(Option.liftPredicate(node, isNode), Option.flatMapNullishOr(({ range }) => range));
|
|
16946
|
+
const jobNamed = (source, name) => pipe(Option.liftPredicate(parseDocument(source).get("jobs", true), isMap), Option.flatMap(({ items }) => Array$1.findFirst(items, ({ key }) => scalarText(key) === name)));
|
|
16947
|
+
const pairSpan = (source, pair) => Option.all({
|
|
16948
|
+
start: Option.map(rangeOf$3(pair.key), ([offset]) => lineStart({
|
|
16949
|
+
source,
|
|
16950
|
+
offset
|
|
16951
|
+
})),
|
|
16952
|
+
end: Option.map(rangeOf$3(pair.value), ([, end]) => end)
|
|
16953
|
+
});
|
|
16954
|
+
const fieldOfJob = (source, job, field) => pipe(jobNamed(source, job), Option.flatMap(({ value }) => Option.liftPredicate(value, isMap)), Option.flatMap(({ items }) => Array$1.findFirst(items, ({ key }) => scalarText(key) === field)));
|
|
16955
|
+
const inputsSpan = (source, job) => pipe(fieldOfJob(source, job, "with"), Option.flatMap((pair) => pairSpan(source, pair)));
|
|
16956
|
+
const ownInputsEdit = (template, existing) => (job) => pipe(Option.all({
|
|
16957
|
+
into: inputsSpan(template, job),
|
|
16958
|
+
from: inputsSpan(existing, job)
|
|
16959
|
+
}), Option.map(({ into, from }) => ({
|
|
16960
|
+
start: into.start,
|
|
16961
|
+
end: into.end,
|
|
16962
|
+
text: pipe(existing, String$1.slice(from.start, from.end), String$1.replace(LAST_NEWLINE, NEWLINE))
|
|
16963
|
+
})));
|
|
16964
|
+
const applied = (template, existing) => {
|
|
16965
|
+
const edits = pipe(template.ownInputs, Array$1.map(ownInputsEdit(template.source, existing)), Array$1.getSomes);
|
|
16966
|
+
return applyEdits({
|
|
16967
|
+
source: template.source,
|
|
16968
|
+
edits
|
|
16969
|
+
});
|
|
16970
|
+
};
|
|
16971
|
+
/** @internal */
|
|
16972
|
+
const fromTemplate = ({ templates, name, source }) => pipe(templates, Array$1.findFirst((template) => template.name === name), Option.match({
|
|
16973
|
+
onNone: () => source,
|
|
16974
|
+
onSome: (template) => applied(template, source)
|
|
16975
|
+
}));
|
|
16976
|
+
// src/features/check-workflows/model/shared-actions.ts
|
|
16977
|
+
const ACTIONS_REF = "1f825b932e1a85233322991acd805c65b75dc358";
|
|
16978
|
+
const REPOSITORY = `${SELF_REPOSITORY}/.github`;
|
|
16979
|
+
const actionPath = (name) => `${REPOSITORY}/shared-actions/${name}`;
|
|
16980
|
+
const workflowPath = (file) => `${REPOSITORY}/workflows/${file}`;
|
|
16981
|
+
const SETUP_ACTION = actionPath("setup");
|
|
16982
|
+
const VERIFY_ACTION = actionPath("verify");
|
|
16983
|
+
const MAINTAIN_WORKFLOW_FILE = "maintain-caches.yml";
|
|
16984
|
+
const MAINTAIN_WORKFLOW = workflowPath(MAINTAIN_WORKFLOW_FILE);
|
|
16985
|
+
const KINDS = String.raw`${REPOSITORY}/(?:shared-actions|workflows)/`;
|
|
16986
|
+
const ACTIONS_USE = new RegExp(String.raw`^${KINDS}[^@]+@`, "u");
|
|
16987
|
+
const pinned = (path) => `${path}@${ACTIONS_REF}`;
|
|
16988
|
+
const CACHE_WORKFLOW = "cache.yml";
|
|
16989
|
+
const DEFAULT_BRANCH_ONLY = "github.ref == format('refs/heads/{0}', github.event.repository.default_branch)";
|
|
16990
|
+
const REGISTRY_ACCESS = `\${{ secrets.TAKUMI_GUARD_TOKEN }}`;
|
|
16991
|
+
const CACHE_WORKFLOW_SOURCE = Array$1.join([
|
|
16992
|
+
"name: cache",
|
|
16993
|
+
"",
|
|
16994
|
+
"on:",
|
|
16995
|
+
" schedule:",
|
|
16996
|
+
" - cron: \"47 * * * *\"",
|
|
16997
|
+
" workflow_dispatch:",
|
|
16998
|
+
"",
|
|
16999
|
+
"permissions: {}",
|
|
17000
|
+
"",
|
|
17001
|
+
"jobs:",
|
|
17002
|
+
" caches:",
|
|
17003
|
+
` if: ${DEFAULT_BRANCH_ONLY}`,
|
|
17004
|
+
" permissions:",
|
|
17005
|
+
" actions: write",
|
|
17006
|
+
" contents: read",
|
|
17007
|
+
` uses: ${pinned(MAINTAIN_WORKFLOW)}`,
|
|
17008
|
+
" secrets:",
|
|
17009
|
+
` TAKUMI_GUARD_TOKEN: ${REGISTRY_ACCESS}`,
|
|
17010
|
+
""
|
|
17011
|
+
], "\n");
|
|
17012
|
+
const PINNED_USE = new RegExp(String.raw`(?<use>${KINDS}[^@\s]+)@(?<ref>[0-9a-f]{40})`, "gu");
|
|
17013
|
+
const refsIn = (source) => pipe(source, String$1.matchAll(PINNED_USE), Array$1.fromIterable, Array$1.flatMap(({ groups }) => pipe(Option.fromNullishOr(groups), Option.flatMap(Record.get("ref")), Option.toArray)));
|
|
17014
|
+
const withoutRefs = (source) => pipe(source, String$1.replaceAll(PINNED_USE, "$<use>"));
|
|
17015
|
+
// src/features/check-workflows/model/cache-workflow.ts
|
|
17016
|
+
const INDENT$2 = " ";
|
|
17017
|
+
const CALL = "caches";
|
|
17018
|
+
const jobText = (jobs) => pipe([
|
|
17019
|
+
"",
|
|
17020
|
+
`${INDENT$2}${CALL}:`,
|
|
17021
|
+
`${INDENT$2}${INDENT$2}needs: [${pipe(jobs, Array$1.join(", "))}]`,
|
|
17022
|
+
`${INDENT$2}${INDENT$2}if: always() && ${DEFAULT_BRANCH_ONLY}`,
|
|
17023
|
+
`${INDENT$2}${INDENT$2}permissions:`,
|
|
17024
|
+
`${INDENT$2}${INDENT$2}${INDENT$2}actions: write`,
|
|
17025
|
+
`${INDENT$2}${INDENT$2}${INDENT$2}contents: read`,
|
|
17026
|
+
`${INDENT$2}${INDENT$2}uses: ${pinned(MAINTAIN_WORKFLOW)}`,
|
|
17027
|
+
`${INDENT$2}${INDENT$2}secrets:`,
|
|
17028
|
+
`${INDENT$2}${INDENT$2}${INDENT$2}TAKUMI_GUARD_TOKEN: ${REGISTRY_ACCESS}`
|
|
17029
|
+
], Array$1.map((line) => `${line}\n`), Array$1.join(""));
|
|
17030
|
+
/** @internal */
|
|
17031
|
+
const addMaintainJob = ({ source, jobs, telemetryNeeds }) => pipe(Option.liftPredicate(parseDocument(source).get("jobs", true), isMap), Option.flatMap(endOf), Option.match({
|
|
17032
|
+
onNone: () => source,
|
|
17033
|
+
onSome: (at) => applyEdits({
|
|
17034
|
+
source,
|
|
17035
|
+
edits: [{
|
|
17036
|
+
start: at,
|
|
17037
|
+
end: at,
|
|
17038
|
+
text: jobText(jobs)
|
|
17039
|
+
}, ...pipe(telemetryNeeds, Array$1.map((start) => ({
|
|
17040
|
+
start,
|
|
17041
|
+
end: start,
|
|
17042
|
+
text: `, ${CALL}`
|
|
17043
|
+
})))]
|
|
17044
|
+
})
|
|
17045
|
+
}));
|
|
17046
|
+
// src/features/check-workflows/model/drift.ts
|
|
17047
|
+
const SINGLE_REF = 1;
|
|
17048
|
+
/** @internal */
|
|
17049
|
+
const refDrift = (sources) => {
|
|
17050
|
+
const pinned = pipe(sources, Array$1.filter(({ source }) => !Array$1.isReadonlyArrayEmpty(refsIn(source))));
|
|
17051
|
+
if (new Set(pipe(pinned, Array$1.flatMap(({ source }) => refsIn(source)))).size <= SINGLE_REF) return [];
|
|
17052
|
+
return pipe(pinned, Array$1.map(({ file }) => ({
|
|
17053
|
+
file,
|
|
17054
|
+
reason: "ref"
|
|
17055
|
+
})));
|
|
17056
|
+
};
|
|
17057
|
+
/** @internal */
|
|
17058
|
+
const changeDrift = (changes) => pipe(changes, Array$1.flatMap(({ file, previous, setup, source }) => pipe([{
|
|
17059
|
+
reason: "setup",
|
|
17060
|
+
before: previous,
|
|
17061
|
+
after: setup
|
|
17062
|
+
}, {
|
|
17063
|
+
reason: "workflow",
|
|
17064
|
+
before: setup,
|
|
17065
|
+
after: source
|
|
17066
|
+
}], Array$1.filter(({ before, after }) => withoutRefs(before) !== withoutRefs(after)), Array$1.map(({ reason }) => ({
|
|
17067
|
+
file,
|
|
17068
|
+
reason
|
|
17069
|
+
})))));
|
|
17070
|
+
// src/features/check-workflows/model/rewrite-steps.ts
|
|
17071
|
+
const CACHE_USE = /^actions\/cache(?:\/(?:restore|save))?@/u;
|
|
17072
|
+
const SETUP_VP_USE = "voidzero-dev/setup-vp@";
|
|
17073
|
+
const CHECKOUT_USE = "actions/checkout@";
|
|
17074
|
+
const LOCAL_USE = /^(?:\$|\.)\/\.github\/actions\/(?<name>[^/@\s]+)$/u;
|
|
17075
|
+
const MANAGED_PATH = /\.cache\/pnpm|vpa\/tools|\.cache\/msch|store-path/u;
|
|
17076
|
+
const MANAGED_RUN = /npm\.flatt\.tech|vp install --frozen-lockfile|pnpm store (?:path|prune)|\.cache\/pnpm\/v/u;
|
|
17077
|
+
const VP_COMMAND = /(?:^|[\s;&|(])vpx?\s/u;
|
|
17078
|
+
const SETUP_INPUTS = [
|
|
17079
|
+
["cache", "\"true\""],
|
|
17080
|
+
["save", "\"false\""],
|
|
17081
|
+
["session-path", "\"true\""]
|
|
17082
|
+
];
|
|
17083
|
+
const INDENT$1 = " ";
|
|
17084
|
+
const FIRST$9 = 0;
|
|
17085
|
+
const runOf = fieldOf$1("run");
|
|
17086
|
+
const pathOf = (step) => pipe(Option.liftPredicate(step, isMap), Option.map((map) => scalarText(map.getIn(["with", "path"], true))), Option.getOrElse(() => ""));
|
|
17087
|
+
const isManaged = (step) => pipe(usesOf(step), String$1.startsWith(SETUP_VP_USE)) || CACHE_USE.test(usesOf(step)) && MANAGED_PATH.test(pathOf(step)) || MANAGED_RUN.test(runOf(step));
|
|
17088
|
+
const localAction = (step) => pipe(LOCAL_USE.exec(usesOf(step)), Option.fromNullishOr, Option.flatMapNullishOr(({ groups }) => groups), Option.flatMap(Record.get("name")));
|
|
17089
|
+
const isSetup = (localSetups) => (step) => pipe(usesOf(step), String$1.startsWith(`${SETUP_ACTION}@`)) || pipe(localAction(step), Option.exists((name) => localSetups.has(name)));
|
|
17090
|
+
const runsVp = (step) => pipe(usesOf(step), String$1.startsWith(`${VERIFY_ACTION}@`)) || VP_COMMAND.test(runOf(step));
|
|
17091
|
+
const valueOf$1 = (inputs, name, fallback) => {
|
|
17092
|
+
if (pipe(inputs, Array$1.contains(name))) return `\${{ inputs.${name} }}`;
|
|
17093
|
+
return fallback;
|
|
17094
|
+
};
|
|
17095
|
+
const inputLines = (inputs, pad) => [`${pad}with:`, ...pipe(SETUP_INPUTS, Array$1.map(([name, fallback]) => `${pad}${INDENT$1}${name}: ${valueOf$1(inputs, name, fallback)}`))];
|
|
17096
|
+
const prefixOf = (source, step) => pipe(startOf$2(step), Option.map((start) => pipe(source, String$1.slice(lineStart({
|
|
17097
|
+
source,
|
|
17098
|
+
offset: start
|
|
17099
|
+
}), start))), Option.getOrElse(() => ""));
|
|
17100
|
+
const setupText = ({ source, inputs }, sample) => {
|
|
17101
|
+
const prefix = prefixOf(source, sample);
|
|
17102
|
+
const pad = pipe(" ", String$1.repeat(prefix.length));
|
|
17103
|
+
return pipe([`${prefix}uses: ${pinned(SETUP_ACTION)}`, ...inputLines(inputs, pad)], Array$1.map((line) => `${line}\n`), Array$1.join(""));
|
|
17104
|
+
};
|
|
17105
|
+
const removal = (source, step) => Option.zipWith(startOf$2(step), endOf(step), (start, end) => ({
|
|
17106
|
+
start: lineStart({
|
|
17107
|
+
source,
|
|
17108
|
+
offset: start
|
|
17109
|
+
}),
|
|
17110
|
+
end,
|
|
17111
|
+
text: ""
|
|
17112
|
+
}));
|
|
17113
|
+
const replacement = (rewrite, step) => Option.map(removal(rewrite.source, step), (edit) => ({
|
|
17114
|
+
...edit,
|
|
17115
|
+
text: setupText(rewrite, step)
|
|
17116
|
+
}));
|
|
17117
|
+
const insertion = (rewrite, items) => {
|
|
17118
|
+
const offset = pipe(items, Array$1.findFirst((step) => pipe(usesOf(step), String$1.startsWith(CHECKOUT_USE))), Option.flatMap(endOf), Option.orElse(() => pipe(Array$1.head(items), Option.flatMap(startOf$2), Option.map((start) => lineStart({
|
|
17119
|
+
source: rewrite.source,
|
|
17120
|
+
offset: start
|
|
17121
|
+
})))));
|
|
17122
|
+
return Option.zipWith(offset, Array$1.head(items), (at, head) => ({
|
|
17123
|
+
start: at,
|
|
17124
|
+
end: at,
|
|
17125
|
+
text: setupText(rewrite, head)
|
|
17126
|
+
}));
|
|
17127
|
+
};
|
|
17128
|
+
const managedEdits = (rewrite, items) => {
|
|
17129
|
+
const hasSetup = pipe(items, Array$1.some(isSetup(rewrite.localSetups)));
|
|
17130
|
+
return pipe(items, Array$1.filter(isManaged), Array$1.map((step, index) => {
|
|
17131
|
+
if (index === FIRST$9 && !hasSetup) return replacement(rewrite, step);
|
|
17132
|
+
return removal(rewrite.source, step);
|
|
17133
|
+
}), Array$1.getSomes);
|
|
17134
|
+
};
|
|
17135
|
+
/** @internal */
|
|
17136
|
+
const stepEdits = (rewrite) => {
|
|
17137
|
+
if (!isSeq(rewrite.steps)) return [];
|
|
17138
|
+
const items = rewrite.steps.items;
|
|
17139
|
+
if (pipe(items, Array$1.some(isManaged))) return managedEdits(rewrite, items);
|
|
17140
|
+
const needsSetup = pipe(items, Array$1.some(runsVp));
|
|
17141
|
+
const hasSetup = pipe(items, Array$1.some(isSetup(rewrite.localSetups)));
|
|
17142
|
+
if (needsSetup && !hasSetup) return pipe(insertion(rewrite, items), Option.toArray);
|
|
17143
|
+
return [];
|
|
17144
|
+
};
|
|
17145
|
+
// src/features/check-workflows/model/rewrite-document.ts
|
|
17146
|
+
const AFTER_REF = /@.*$/u;
|
|
17147
|
+
const CLOSING_BRACKET = 1;
|
|
17148
|
+
const TELEMETRY_USE = /\/ci-telemetry@/u;
|
|
17149
|
+
const pinEdits = (document, source) => {
|
|
17150
|
+
const found = [];
|
|
17151
|
+
visit$1(document, { Pair: (_key, pair) => {
|
|
17152
|
+
if (isPair(pair) && scalarText(pair.key) === "uses" && isScalar(pair.value) && ACTIONS_USE.test(scalarText(pair.value))) pipe(Option.fromNullishOr(pair.value.range), Option.map(([start, end]) => ({
|
|
17153
|
+
start,
|
|
17154
|
+
end,
|
|
17155
|
+
text: pipe(source, String$1.slice(start, end), String$1.replace(AFTER_REF, `@${ACTIONS_REF}`))
|
|
17156
|
+
})), Option.map((edit) => found.push(edit)));
|
|
17157
|
+
} });
|
|
17158
|
+
return found;
|
|
17159
|
+
};
|
|
17160
|
+
const tableAt = (document, path) => pipe(Option.liftPredicate(document.getIn(path, true), isMap), Option.map(({ items }) => pipe(items, Array$1.map(({ key, value }) => [scalarText(key), value]))), Option.getOrElse(() => []));
|
|
17161
|
+
const jobsOf = (document) => pipe(tableAt(document, ["jobs"]), Array$1.map(([, job]) => job), Array$1.filter(isMap));
|
|
17162
|
+
const stepsOf = (job) => pipe(Option.liftPredicate(job, isMap), Option.map((map) => itemsOf(map.get("steps", true))), Option.getOrElse(() => []));
|
|
17163
|
+
const actionSteps = (document) => {
|
|
17164
|
+
const steps = document.getIn(["runs", "steps"], true);
|
|
17165
|
+
return itemsOf(steps);
|
|
17166
|
+
};
|
|
17167
|
+
const allSteps = (document) => pipe(jobsOf(document), Array$1.flatMap(stepsOf), Array$1.appendAll(actionSteps(document)));
|
|
17168
|
+
const includesSetup = (document) => pipe(allSteps(document), Array$1.some((step) => pipe(usesOf(step), String$1.startsWith(`${SETUP_ACTION}@`))));
|
|
17169
|
+
const callsMaintain = (document) => pipe(jobsOf(document), Array$1.some((job) => pipe(usesOf(job), String$1.startsWith(`${MAINTAIN_WORKFLOW}@`))));
|
|
17170
|
+
const reportsTelemetry = (job) => pipe(stepsOf(job), Array$1.some((step) => TELEMETRY_USE.test(usesOf(step))));
|
|
17171
|
+
const telemetryNeedsAt = (document) => pipe(jobsOf(document), Array$1.filter(reportsTelemetry), Array$1.flatMap((job) => pipe(Option.liftPredicate(job.getIn(["needs"], true), isSeq), Option.filter(({ flow }) => flow === true), Option.flatMap(({ range }) => Option.fromNullishOr(range)), Option.map(([, valueEnd]) => valueEnd - CLOSING_BRACKET), Option.toArray)));
|
|
17172
|
+
const inputNames = (document) => pipe(tableAt(document, ["inputs"]), Array$1.map(([name]) => name));
|
|
17173
|
+
/** @internal */
|
|
17174
|
+
const rewriteDocument = ({ source, localSetups }) => {
|
|
17175
|
+
const document = parseDocument(source);
|
|
17176
|
+
const inputs = inputNames(document);
|
|
17177
|
+
const edits = pipe([...pipe(jobsOf(document), Array$1.map((job) => job.get("steps", true))), document.getIn(["runs", "steps"], true)], Array$1.flatMap((steps) => stepEdits({
|
|
17178
|
+
steps,
|
|
17179
|
+
source,
|
|
17180
|
+
localSetups,
|
|
17181
|
+
inputs
|
|
17182
|
+
})), Array$1.appendAll(pinEdits(document, source)));
|
|
17183
|
+
const rewritten = applyEdits({
|
|
17184
|
+
source,
|
|
17185
|
+
edits
|
|
17186
|
+
});
|
|
17187
|
+
const result = parseDocument(rewritten);
|
|
17188
|
+
return {
|
|
17189
|
+
source: rewritten,
|
|
17190
|
+
includesSetup: includesSetup(result),
|
|
17191
|
+
callsMaintain: callsMaintain(result),
|
|
17192
|
+
telemetryNeeds: telemetryNeedsAt(result),
|
|
17193
|
+
jobs: pipe(tableAt(result, ["jobs"]), Array$1.filter(([, job]) => !reportsTelemetry(job)), Array$1.map(([name]) => name))
|
|
17194
|
+
};
|
|
17195
|
+
};
|
|
17196
|
+
// src/features/check-workflows/model/template-workflows.ts
|
|
17197
|
+
const UP_TO_DATE_SOURCE = Array$1.join([
|
|
17198
|
+
"name: up-to-date",
|
|
17199
|
+
"",
|
|
17200
|
+
"on:",
|
|
17201
|
+
" pull_request:",
|
|
17202
|
+
" types: [opened, synchronize, reopened, ready_for_review, edited]",
|
|
17203
|
+
" workflow_dispatch:",
|
|
17204
|
+
"",
|
|
17205
|
+
"permissions: {}",
|
|
17206
|
+
"",
|
|
17207
|
+
"jobs:",
|
|
17208
|
+
" up-to-date:",
|
|
17209
|
+
" permissions:",
|
|
17210
|
+
" actions: write",
|
|
17211
|
+
" contents: read",
|
|
17212
|
+
" pull-requests: read",
|
|
17213
|
+
` uses: ${pinned(workflowPath("up-to-date.yml"))}`,
|
|
17214
|
+
" with:",
|
|
17215
|
+
" full-check: false",
|
|
17216
|
+
" secrets:",
|
|
17217
|
+
` TAKUMI_GUARD_TOKEN: ${REGISTRY_ACCESS}`,
|
|
17218
|
+
""
|
|
17219
|
+
], "\n");
|
|
17220
|
+
const UPDATE_BRANCHES_SOURCE = Array$1.join([
|
|
17221
|
+
"name: update-branches",
|
|
17222
|
+
"",
|
|
17223
|
+
"on:",
|
|
17224
|
+
" push:",
|
|
17225
|
+
" branches: [main]",
|
|
17226
|
+
" workflow_dispatch:",
|
|
17227
|
+
"",
|
|
17228
|
+
"permissions: {}",
|
|
17229
|
+
"",
|
|
17230
|
+
"jobs:",
|
|
17231
|
+
" update-branches:",
|
|
17232
|
+
" permissions:",
|
|
17233
|
+
" actions: read",
|
|
17234
|
+
" contents: read",
|
|
17235
|
+
" id-token: write",
|
|
17236
|
+
` uses: ${pinned(workflowPath("update-branches.yml"))}`,
|
|
17237
|
+
""
|
|
17238
|
+
], "\n");
|
|
17239
|
+
/** @internal */
|
|
17240
|
+
const TEMPLATE_WORKFLOWS = [{
|
|
17241
|
+
name: "up-to-date.yml",
|
|
17242
|
+
source: UP_TO_DATE_SOURCE,
|
|
17243
|
+
ownInputs: ["up-to-date"]
|
|
17244
|
+
}, {
|
|
17245
|
+
name: "update-branches.yml",
|
|
17246
|
+
source: UPDATE_BRANCHES_SOURCE,
|
|
17247
|
+
ownInputs: []
|
|
17248
|
+
}];
|
|
17249
|
+
// src/features/check-workflows/model/sync-ci.ts
|
|
17250
|
+
const WORKFLOWS = ".github/workflows";
|
|
17251
|
+
const ACTIONS = ".github/actions";
|
|
17252
|
+
const YAML_FILE = /\.ya?ml$/u;
|
|
17253
|
+
const ACTION_FILES = ["action.yml", "action.yaml"];
|
|
17254
|
+
const SEQUENTIAL$3 = { concurrency: 1 };
|
|
17255
|
+
const entriesOf$1 = (directory) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readDirectory(directory)), Effect.map((entries) => Array$1.sort(entries, String$1.Order)), Effect.orElseSucceed(() => []));
|
|
17256
|
+
const readSource = (file, name) => FileSystem.FileSystem.pipe(Effect.flatMap((fs) => fs.readFileString(file)), Effect.map((source) => ({
|
|
17257
|
+
file,
|
|
17258
|
+
name,
|
|
17259
|
+
source
|
|
17260
|
+
})), Effect.orDie);
|
|
17261
|
+
const workflowSources = (root) => Effect.gen(function* readWorkflows() {
|
|
17262
|
+
const path = yield* Path.Path;
|
|
17263
|
+
const directory = path.join(root, WORKFLOWS);
|
|
17264
|
+
const entries = yield* entriesOf$1(directory);
|
|
17265
|
+
return yield* Effect.forEach(pipe(entries, Array$1.filter((entry) => YAML_FILE.test(entry))), (entry) => readSource(path.join(directory, entry), entry), SEQUENTIAL$3);
|
|
17266
|
+
});
|
|
17267
|
+
const actionFile = (directory, name) => Effect.gen(function* findActionFile() {
|
|
17268
|
+
const fs = yield* FileSystem.FileSystem;
|
|
17269
|
+
const path = yield* Path.Path;
|
|
17270
|
+
const found = yield* Effect.findFirst(pipe(ACTION_FILES, Array$1.map((file) => path.join(directory, name, file))), (candidate) => fs.exists(candidate).pipe(Effect.orElseSucceed(() => false)));
|
|
17271
|
+
return yield* Option.match(found, {
|
|
17272
|
+
onNone: () => Effect.succeedNone,
|
|
17273
|
+
onSome: (file) => readSource(file, name).pipe(Effect.asSome)
|
|
17274
|
+
});
|
|
17275
|
+
});
|
|
17276
|
+
const actionSources = (root) => Effect.gen(function* readActions() {
|
|
17277
|
+
const directory = (yield* Path.Path).join(root, ACTIONS);
|
|
17278
|
+
const names = yield* entriesOf$1(directory);
|
|
17279
|
+
const found = yield* Effect.forEach(names, (name) => actionFile(directory, name), SEQUENTIAL$3);
|
|
17280
|
+
return Array$1.getSomes(found);
|
|
17281
|
+
});
|
|
17282
|
+
const settle = (actions, known) => {
|
|
17283
|
+
const next = new Set(pipe(actions, Array$1.filter(({ source }) => rewriteDocument({
|
|
17284
|
+
source,
|
|
17285
|
+
localSetups: known
|
|
17286
|
+
}).includesSetup), Array$1.map(({ name }) => name)));
|
|
17287
|
+
if (next.size === known.size) return known;
|
|
17288
|
+
return settle(actions, next);
|
|
17289
|
+
};
|
|
17290
|
+
const rewriteAll = (sources, localSetups) => pipe(sources, Array$1.map((found) => ({
|
|
17291
|
+
...found,
|
|
17292
|
+
rewritten: rewriteDocument({
|
|
17293
|
+
source: found.source,
|
|
17294
|
+
localSetups
|
|
17295
|
+
})
|
|
17296
|
+
})));
|
|
17297
|
+
const cacheWorkflow = ({ root, workflows, usesSetup }) => Effect.gen(function* planCacheWorkflow() {
|
|
17298
|
+
const path = yield* Path.Path;
|
|
17299
|
+
if (!usesSetup || pipe(workflows, Array$1.some(({ rewritten }) => rewritten.callsMaintain))) return [];
|
|
17300
|
+
return [pipe(workflows, Array$1.findFirst(({ name }) => name === CACHE_WORKFLOW), Option.match({
|
|
17301
|
+
onNone: () => ({
|
|
17302
|
+
file: path.join(root, WORKFLOWS, CACHE_WORKFLOW),
|
|
17303
|
+
previous: "",
|
|
17304
|
+
setup: CACHE_WORKFLOW_SOURCE,
|
|
17305
|
+
source: CACHE_WORKFLOW_SOURCE
|
|
17306
|
+
}),
|
|
17307
|
+
onSome: ({ file, rewritten, source }) => {
|
|
17308
|
+
const maintained = addMaintainJob({
|
|
17309
|
+
source: rewritten.source,
|
|
17310
|
+
jobs: rewritten.jobs,
|
|
17311
|
+
telemetryNeeds: rewritten.telemetryNeeds
|
|
17312
|
+
});
|
|
17313
|
+
return {
|
|
17314
|
+
file,
|
|
17315
|
+
previous: source,
|
|
17316
|
+
setup: maintained,
|
|
17317
|
+
source: maintained
|
|
17318
|
+
};
|
|
17319
|
+
}
|
|
17320
|
+
}))];
|
|
17321
|
+
});
|
|
17322
|
+
const write = (root, { file, source }) => Effect.gen(function* writeChanged() {
|
|
17323
|
+
const fs = yield* FileSystem.FileSystem;
|
|
17324
|
+
const path = yield* Path.Path;
|
|
17325
|
+
yield* fs.writeFileString(file, source);
|
|
17326
|
+
const stdio = yield* Stdio.Stdio;
|
|
17327
|
+
yield* Stream.make(`Updated ${path.relative(root, file)}\n`).pipe(Stream.run(stdio.stdout()), Effect.orDie);
|
|
17328
|
+
});
|
|
17329
|
+
const OWN_CI = {
|
|
17330
|
+
changes: [],
|
|
17331
|
+
sources: []
|
|
17332
|
+
};
|
|
17333
|
+
const isHost = (root) => Effect.gen(function* findMaintainWorkflow() {
|
|
17334
|
+
const fs = yield* FileSystem.FileSystem;
|
|
17335
|
+
const path = yield* Path.Path;
|
|
17336
|
+
return yield* fs.exists(path.join(root, WORKFLOWS, MAINTAIN_WORKFLOW_FILE)).pipe(Effect.orElseSucceed(() => false));
|
|
17337
|
+
});
|
|
17338
|
+
const planRewrites = (root, workflows, actions) => Effect.gen(function* planChanges() {
|
|
17339
|
+
const localSetups = settle(actions, /* @__PURE__ */ new Set());
|
|
17340
|
+
const rewrittenWorkflows = rewriteAll(workflows, localSetups);
|
|
17341
|
+
const rewrittenActions = rewriteAll(actions, localSetups);
|
|
17342
|
+
const usesSetup = pipe([...rewrittenActions, ...rewrittenWorkflows], Array$1.some(({ rewritten }) => rewritten.includesSetup));
|
|
17343
|
+
const created = yield* cacheWorkflow({
|
|
17344
|
+
root,
|
|
17345
|
+
workflows: rewrittenWorkflows,
|
|
17346
|
+
usesSetup
|
|
17347
|
+
});
|
|
17348
|
+
const templates = pipe(TEMPLATE_WORKFLOWS, Array$1.filter(() => usesSetup));
|
|
17349
|
+
return {
|
|
17350
|
+
changes: pipe([...rewrittenActions, ...rewrittenWorkflows], Array$1.map(({ file, name, rewritten, source }) => ({
|
|
17351
|
+
file,
|
|
17352
|
+
previous: source,
|
|
17353
|
+
setup: rewritten.source,
|
|
17354
|
+
source: fromTemplate({
|
|
17355
|
+
templates,
|
|
17356
|
+
name,
|
|
17357
|
+
source: rewritten.source
|
|
17358
|
+
})
|
|
17359
|
+
})), Array$1.filter(({ previous, source }) => previous !== source), Array$1.filter(({ file }) => !pipe(created, Array$1.some((change) => change.file === file))), Array$1.appendAll(created)),
|
|
17360
|
+
sources: [...actions, ...workflows]
|
|
17361
|
+
};
|
|
17362
|
+
});
|
|
17363
|
+
const planned = (root) => Effect.gen(function* plan() {
|
|
17364
|
+
if (yield* isHost(root)) return OWN_CI;
|
|
17365
|
+
const workflows = yield* workflowSources(root);
|
|
17366
|
+
const actions = yield* actionSources(root);
|
|
17367
|
+
return yield* planRewrites(root, workflows, actions);
|
|
17368
|
+
});
|
|
17369
|
+
/** @internal */
|
|
17370
|
+
const findCiDrift = (root) => planned(root).pipe(Effect.map(({ changes, sources }) => [...changeDrift(changes), ...refDrift(sources)]));
|
|
17371
|
+
/** @internal */
|
|
17372
|
+
const syncCi = (root) => planned(root).pipe(Effect.flatMap(({ changes }) => Effect.forEach(changes, (change) => write(root, change), {
|
|
17373
|
+
...SEQUENTIAL$3,
|
|
17374
|
+
discard: true
|
|
17375
|
+
})));
|
|
16893
17376
|
// src/features/check-workflows/model/ci-drift.ts
|
|
16894
17377
|
const SETUP_RULE$1 = "ci-setup";
|
|
16895
17378
|
const REF_RULE = "ci-template-ref";
|
|
16896
17379
|
const WORKFLOW_RULE = "ci-template-workflow";
|
|
16897
|
-
const SETUP_MESSAGE = "differs from what `
|
|
16898
|
-
const REF_MESSAGE = "pins a different commit of the template than the other workflows. Run `
|
|
16899
|
-
const WORKFLOW_MESSAGE = "differs from the template's workflow, which Renovate does not update because it only moves the pinned commits. Run `
|
|
17380
|
+
const SETUP_MESSAGE = "differs from what `msch ci` writes. Run `msch ci`: it puts the shared `setup` action where a job runs `vp`, removes the hand-written cache steps and keeps the cache workflow that cleans up old entries.";
|
|
17381
|
+
const REF_MESSAGE = "pins a different commit of the template than the other workflows. Run `msch ci` to pin them all to one.";
|
|
17382
|
+
const WORKFLOW_MESSAGE = "differs from the template's workflow, which Renovate does not update because it only moves the pinned commits. Run `msch ci`: it writes the template's triggers and jobs, which call the shared queue workflows, and keeps the inputs the repository gives them.";
|
|
16900
17383
|
const setupProblem$1 = problemInFile(SETUP_RULE$1);
|
|
16901
17384
|
const refProblem = problemInFile(REF_RULE);
|
|
16902
17385
|
const workflowProblem = problemInFile(WORKFLOW_RULE);
|
|
@@ -16906,6 +17389,56 @@ const checkCiDrift = Effect.fn("checkCiDrift")(function* checkCiDrift(root) {
|
|
|
16906
17389
|
const drifts = yield* findCiDrift(root);
|
|
16907
17390
|
return pipe(drifts, Array$1.map(problemOf$5));
|
|
16908
17391
|
});
|
|
17392
|
+
// src/features/check-workflows/model/optional-inputs.ts
|
|
17393
|
+
const RULE$34 = "optional-input";
|
|
17394
|
+
const ACTION_FILE = /^\.github\/(?:.+\/)?action\.ya?ml$/u;
|
|
17395
|
+
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
17396
|
+
const START$21 = 0;
|
|
17397
|
+
const pairsAt = (document, path) => pipe(Option.liftPredicate(document.getIn(path, true), isMap), Option.map(({ items }) => items), Option.getOrElse(() => []));
|
|
17398
|
+
const declaredIn$2 = (name, document) => {
|
|
17399
|
+
if (ACTION_FILE.test(name)) return pipe(pairsAt(document, ["inputs"]), Array$1.map((pair) => ({
|
|
17400
|
+
kind: "input",
|
|
17401
|
+
pair
|
|
17402
|
+
})));
|
|
17403
|
+
return [...pipe(pairsAt(document, [
|
|
17404
|
+
"on",
|
|
17405
|
+
"workflow_call",
|
|
17406
|
+
"inputs"
|
|
17407
|
+
]), Array$1.map((pair) => ({
|
|
17408
|
+
kind: "input",
|
|
17409
|
+
pair
|
|
17410
|
+
}))), ...pipe(pairsAt(document, [
|
|
17411
|
+
"on",
|
|
17412
|
+
"workflow_call",
|
|
17413
|
+
"secrets"
|
|
17414
|
+
]), Array$1.map((pair) => ({
|
|
17415
|
+
kind: "secret",
|
|
17416
|
+
pair
|
|
17417
|
+
})))];
|
|
17418
|
+
};
|
|
17419
|
+
const isRequired = ({ pair }) => pipe(Option.liftPredicate(pair.value, isMap), Option.map((map) => map.get("required", true)), Option.exists((required) => isScalar(required) && required.value === true));
|
|
17420
|
+
const startOf$1 = ({ pair }) => pipe(Option.liftPredicate(pair.key, isScalar), Option.flatMapNullishOr(({ range }) => range), Option.map(([start]) => start), Option.getOrElse(() => START$21));
|
|
17421
|
+
const messageOf$1 = ({ kind, pair }) => `declares the ${kind} \`${scalarText(pair.key)}\` without \`required: true\`. Actions and reusable workflows take no optional ${kind}s: make it required and have every caller pass it, or remove it when no caller needs it.`;
|
|
17422
|
+
const problemsIn$12 = (file, name, source) => {
|
|
17423
|
+
const at = problemAtIndex(RULE$34)(file, source);
|
|
17424
|
+
return pipe(declaredIn$2(name, parseDocument(source)), Array$1.filter((declared) => !isRequired(declared)), Array$1.map((declared) => at(startOf$1(declared), messageOf$1(declared))));
|
|
17425
|
+
};
|
|
17426
|
+
/** @internal */
|
|
17427
|
+
const checkOptionalInputs = Effect.fn("checkOptionalInputs")(function* checkOptionalInputs(root) {
|
|
17428
|
+
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
17429
|
+
const names = pipe(listed, Array$1.filter((name) => ACTION_FILE.test(name) || WORKFLOW_FILE.test(name)));
|
|
17430
|
+
return yield* problemsInFiles(root, names, ({ file, name, source }) => problemsIn$12(file, name, source));
|
|
17431
|
+
});
|
|
17432
|
+
// src/features/check-workflows/model/installed-version.ts
|
|
17433
|
+
const RANGE_PREFIX = /^[\^~]/u;
|
|
17434
|
+
/** @internal */
|
|
17435
|
+
const staleProblem = ({ installed, declared }) => pipe(declared, Option.map(String$1.replace(RANGE_PREFIX, "")), Option.filter((exact) => exact !== installed), Option.map((exact) => `msch ${installed} is installed, but the repository declares ${exact}, so the files it writes would not match what the current checks expect. Run \`vp install\`, then run \`msch ci\` again.`));
|
|
17436
|
+
const declaredIn$1 = (root) => Effect.promise(() => readWorkspaceManifest$1(root)).pipe(Effect.map((workspace) => pipe(Option.fromNullishOr(workspace), Option.flatMapNullishOr(({ catalog }) => catalog), Option.flatMapNullishOr((catalog) => catalog[name]))));
|
|
17437
|
+
/** @internal */
|
|
17438
|
+
const installedVersionProblem = (root) => declaredIn$1(root).pipe(Effect.map((declared) => staleProblem({
|
|
17439
|
+
installed: version,
|
|
17440
|
+
declared
|
|
17441
|
+
})));
|
|
16909
17442
|
// src/features/check-workflows/model/release-please.ts
|
|
16910
17443
|
const RULE$33 = "release-please";
|
|
16911
17444
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
@@ -16942,6 +17475,7 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
16942
17475
|
checkProjectExtensions(root),
|
|
16943
17476
|
checkShellScripts(root),
|
|
16944
17477
|
checkCiDrift(root),
|
|
17478
|
+
checkOptionalInputs(root),
|
|
16945
17479
|
checkReleasePlease(root),
|
|
16946
17480
|
checkRestrictedRules(root),
|
|
16947
17481
|
checkTypeExemptions(root),
|
|
@@ -17018,8 +17552,8 @@ const tomlSourceComments = (source) => pipe(parseTOML(source).comments, Array$1.
|
|
|
17018
17552
|
text: String$1.slice(start, end)(source)
|
|
17019
17553
|
})));
|
|
17020
17554
|
// src/features/ban-comments/model/found-comment.ts
|
|
17021
|
-
const taggedError$
|
|
17022
|
-
var CommentsUnreadable = class extends taggedError$
|
|
17555
|
+
const taggedError$9 = Schema.TaggedError;
|
|
17556
|
+
var CommentsUnreadable = class extends taggedError$9()("CommentsUnreadable", {
|
|
17023
17557
|
reader: Schema.String,
|
|
17024
17558
|
message: Schema.String
|
|
17025
17559
|
}) {};
|
|
@@ -17212,7 +17746,7 @@ const RULE$32 = "comment";
|
|
|
17212
17746
|
const SUPPRESSION_RULE = "suppression";
|
|
17213
17747
|
const UNUSED_RULE = "unused-comment-allowance";
|
|
17214
17748
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
17215
|
-
const READ_CONCURRENCY$
|
|
17749
|
+
const READ_CONCURRENCY$14 = 64;
|
|
17216
17750
|
const START$19 = 0;
|
|
17217
17751
|
const SHEBANG = "#!";
|
|
17218
17752
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
@@ -17224,8 +17758,8 @@ const CommentSettings = Schema.Struct({ allow: Patterns });
|
|
|
17224
17758
|
const MschSettings = Schema.Struct({ comments: Schema.optional(CommentSettings) });
|
|
17225
17759
|
const RootConfig = Schema.Struct({ msch: Schema.optional(MschSettings) });
|
|
17226
17760
|
const NO_SETTINGS = { allow: [] };
|
|
17227
|
-
const taggedError$
|
|
17228
|
-
var CommentConfigUnreadable = class extends taggedError$
|
|
17761
|
+
const taggedError$8 = Schema.TaggedError;
|
|
17762
|
+
var CommentConfigUnreadable = class extends taggedError$8()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
17229
17763
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
17230
17764
|
const lineBefore = (source, index) => {
|
|
17231
17765
|
const lines = pipe(source, String$1.slice(START$19, index), String$1.split("\n"));
|
|
@@ -17296,7 +17830,7 @@ const checkComments = Effect.fn("checkComments")(function* checkComments(root) {
|
|
|
17296
17830
|
const found = yield* Effect.forEach(scanned, (entry) => files.readFile(entry.file).pipe(Effect.flatMap(Option.match({
|
|
17297
17831
|
onNone: () => Effect.succeed(NOTHING),
|
|
17298
17832
|
onSome: (source) => scan(entry, source)
|
|
17299
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
17833
|
+
}))), { concurrency: READ_CONCURRENCY$14 });
|
|
17300
17834
|
const used = HashSet.fromIterable(pipe(found, Array$1.flatMap(({ used: indexes }) => indexes)));
|
|
17301
17835
|
const unused = yield* unusedAllowances(root, settings, used);
|
|
17302
17836
|
return [...pipe(found, Array$1.flatMap(({ problems }) => problems)), ...unused];
|
|
@@ -17471,8 +18005,8 @@ const Source = Schema.Struct({
|
|
|
17471
18005
|
});
|
|
17472
18006
|
const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
|
|
17473
18007
|
const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
|
|
17474
|
-
const taggedError$
|
|
17475
|
-
var SkillsConfigUnreadable = class extends taggedError$
|
|
18008
|
+
const taggedError$7 = Schema.TaggedError;
|
|
18009
|
+
var SkillsConfigUnreadable = class extends taggedError$7()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
17476
18010
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
17477
18011
|
file,
|
|
17478
18012
|
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$18))),
|
|
@@ -17568,7 +18102,7 @@ const FRAGMENT = /#.*$/u;
|
|
|
17568
18102
|
const SEPARATOR$10 = "/";
|
|
17569
18103
|
const START$17 = 0;
|
|
17570
18104
|
const FIRST$7 = 1;
|
|
17571
|
-
const READ_CONCURRENCY$
|
|
18105
|
+
const READ_CONCURRENCY$13 = 16;
|
|
17572
18106
|
const Frontmatter = Schema.Struct({
|
|
17573
18107
|
name: Schema.optional(Schema.String),
|
|
17574
18108
|
license: Schema.optional(Schema.Unknown)
|
|
@@ -17634,7 +18168,7 @@ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
17634
18168
|
const inside = pipe(listed, Array$1.filter(String$1.startsWith(`${directory}${SEPARATOR$10}`)));
|
|
17635
18169
|
const text = yield* files.readFile(file);
|
|
17636
18170
|
const documents = pipe(inside, Array$1.filter(String$1.endsWith(MARKDOWN$5)), Array$1.map((entry) => files.join(root, entry)));
|
|
17637
|
-
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$
|
|
18171
|
+
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$13 });
|
|
17638
18172
|
const licenses = pipe(inside, Array$1.filter((entry) => files.dirname(entry) === directory), Array$1.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array$1.map((entry) => ({
|
|
17639
18173
|
file: files.join(root, entry),
|
|
17640
18174
|
line: FIRST$7,
|
|
@@ -17656,7 +18190,7 @@ const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
17656
18190
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
17657
18191
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
17658
18192
|
const skills = pipe(listed, Array$1.filter((name) => SKILL_FILE$2.test(name) && !INSTALLED.test(name) && !FIXTURE$1.test(name)));
|
|
17659
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$9(root, listed, name), { concurrency: READ_CONCURRENCY$
|
|
18193
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$9(root, listed, name), { concurrency: READ_CONCURRENCY$13 });
|
|
17660
18194
|
return Array$1.flatten(found);
|
|
17661
18195
|
});
|
|
17662
18196
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -17718,7 +18252,7 @@ const cargoEntries = (text) => {
|
|
|
17718
18252
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
17719
18253
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
17720
18254
|
const RULE$27 = "version-downgrade";
|
|
17721
|
-
const READ_CONCURRENCY$
|
|
18255
|
+
const READ_CONCURRENCY$12 = 16;
|
|
17722
18256
|
const READERS = [
|
|
17723
18257
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
17724
18258
|
[/^pnpm-workspace\.yaml$/u, workspaceEntries],
|
|
@@ -17762,7 +18296,7 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
|
|
|
17762
18296
|
before: read(before),
|
|
17763
18297
|
after: read(after)
|
|
17764
18298
|
})), Option.getOrElse(() => []));
|
|
17765
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
18299
|
+
}), { concurrency: READ_CONCURRENCY$12 });
|
|
17766
18300
|
return Array$1.flatten(found);
|
|
17767
18301
|
});
|
|
17768
18302
|
// src/features/check-version-downgrades/model/renovate-settings.ts
|
|
@@ -17788,7 +18322,7 @@ const REPOSITORY_CHOICES = [
|
|
|
17788
18322
|
const ADOPTER = "@r_masseater/vite-plus-adopt";
|
|
17789
18323
|
const DEFAULT_FILE = "renovate.json";
|
|
17790
18324
|
const START$16 = 0;
|
|
17791
|
-
const READ_CONCURRENCY$
|
|
18325
|
+
const READ_CONCURRENCY$11 = 16;
|
|
17792
18326
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
17793
18327
|
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.";
|
|
17794
18328
|
const PRESET_MESSAGE = `does not extend \`${RENOVATE_PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
@@ -17880,12 +18414,12 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
17880
18414
|
onNone: () => [],
|
|
17881
18415
|
onSome: (source) => problemsIn$8(adopter)(file, source)
|
|
17882
18416
|
})));
|
|
17883
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
18417
|
+
}, { concurrency: READ_CONCURRENCY$11 });
|
|
17884
18418
|
return Array$1.flatten(found);
|
|
17885
18419
|
});
|
|
17886
18420
|
// src/shared/lib/manifest-texts.ts
|
|
17887
18421
|
const MANIFEST$2 = /(?:^|\/)package\.json$/u;
|
|
17888
|
-
const READ_CONCURRENCY$
|
|
18422
|
+
const READ_CONCURRENCY$10 = 16;
|
|
17889
18423
|
/** @internal */
|
|
17890
18424
|
const manifestTexts = Effect.fn("manifestTexts")(function* manifestTexts(root) {
|
|
17891
18425
|
const files = yield* RepositoryFiles;
|
|
@@ -17894,7 +18428,7 @@ const manifestTexts = Effect.fn("manifestTexts")(function* manifestTexts(root) {
|
|
|
17894
18428
|
const read = yield* Effect.forEach(names, (file) => Effect.map(files.readFile(files.join(root, file)), Option.map((text) => ({
|
|
17895
18429
|
file,
|
|
17896
18430
|
text
|
|
17897
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
18431
|
+
}))), { concurrency: READ_CONCURRENCY$10 });
|
|
17898
18432
|
return Array$1.getSomes(read);
|
|
17899
18433
|
});
|
|
17900
18434
|
// src/features/check-version-downgrades/model/package-versions.ts
|
|
@@ -17903,7 +18437,7 @@ const UNSHIPPED = /(?:\.test\.[\w.]+$|(?:^|\/)(?:fixtures|__tests__|tests?)\/|(?
|
|
|
17903
18437
|
const UNVERSIONED$5 = "0.0.0";
|
|
17904
18438
|
const FIRST_LINE$3 = 1;
|
|
17905
18439
|
const FIRST_COLUMN$4 = 1;
|
|
17906
|
-
const READ_CONCURRENCY$
|
|
18440
|
+
const READ_CONCURRENCY$9 = 16;
|
|
17907
18441
|
const LAST_SEGMENT$1 = /[^/]*$/u;
|
|
17908
18442
|
const directoryOf$1 = (file) => String$1.replace(LAST_SEGMENT$1, "")(file);
|
|
17909
18443
|
const packageAt$1 = (file, text) => pipe(decodeVersionedPackageJson(text), Option.filter(({ private: hidden, version }) => hidden !== true && version !== UNVERSIONED$5), Option.map((manifest) => ({
|
|
@@ -17976,7 +18510,7 @@ const checkPackageVersions = Effect.fn("checkPackageVersions")(function* checkPa
|
|
|
17976
18510
|
rule: RULE$26,
|
|
17977
18511
|
message: message(pack, part, lowest)
|
|
17978
18512
|
})), Option.toArray);
|
|
17979
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
18513
|
+
}), { concurrency: READ_CONCURRENCY$9 });
|
|
17980
18514
|
return Array$1.flatten(found);
|
|
17981
18515
|
});
|
|
17982
18516
|
// src/features/find-unneeded-files/model/applied-packages.ts
|
|
@@ -18447,7 +18981,6 @@ const NUL = "\0";
|
|
|
18447
18981
|
const START$12 = 0;
|
|
18448
18982
|
const HEX = 16;
|
|
18449
18983
|
const CODE_POINT_WIDTH = 4;
|
|
18450
|
-
const READ_CONCURRENCY$9 = 64;
|
|
18451
18984
|
const RULE$20 = "hidden-unicode";
|
|
18452
18985
|
const hexOf = (character) => pipe(String$1.codePointAt(START$12)(character), Option.getOrElse(() => START$12), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
18453
18986
|
const problemOf$3 = (file, source) => (found) => {
|
|
@@ -18465,16 +18998,8 @@ const problemsIn$6 = (file, source) => {
|
|
|
18465
18998
|
};
|
|
18466
18999
|
/** @internal */
|
|
18467
19000
|
const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHiddenUnicode(root) {
|
|
18468
|
-
const
|
|
18469
|
-
|
|
18470
|
-
const found = yield* Effect.forEach(names, (name) => {
|
|
18471
|
-
const file = files.join(root, name);
|
|
18472
|
-
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
18473
|
-
onNone: () => [],
|
|
18474
|
-
onSome: (source) => problemsIn$6(file, source)
|
|
18475
|
-
})));
|
|
18476
|
-
}, { concurrency: READ_CONCURRENCY$9 });
|
|
18477
|
-
return Array$1.flatten(found);
|
|
19001
|
+
const names = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
19002
|
+
return yield* problemsInFiles(root, names, ({ file, source }) => problemsIn$6(file, source));
|
|
18478
19003
|
});
|
|
18479
19004
|
// src/app/document-checks.ts
|
|
18480
19005
|
/** @internal */
|
|
@@ -18574,8 +19099,8 @@ const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Liter
|
|
|
18574
19099
|
const isStrict = Schema.is(StrictPack);
|
|
18575
19100
|
const PackConfig = Schema.Struct({ pack: Schema.optional(Schema.Unknown) });
|
|
18576
19101
|
const decodePackConfig = Schema.decodeUnknownOption(PackConfig);
|
|
18577
|
-
const taggedError$
|
|
18578
|
-
var PackConfigUnreadable = class extends taggedError$
|
|
19102
|
+
const taggedError$6 = Schema.TaggedError;
|
|
19103
|
+
var PackConfigUnreadable = class extends taggedError$6()("PackConfigUnreadable", { file: Schema.String }) {};
|
|
18579
19104
|
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array$1.ensure(pack)), Option.exists(Array$1.some(isStrict)));
|
|
18580
19105
|
const problemFor = (file, source) => ({
|
|
18581
19106
|
file,
|
|
@@ -20490,9 +21015,9 @@ const rebutPrompt = (input) => lines([
|
|
|
20490
21015
|
]);
|
|
20491
21016
|
// src/features/check-with-agents/model/step.ts
|
|
20492
21017
|
const ATTEMPTS = 3;
|
|
20493
|
-
const taggedError$
|
|
21018
|
+
const taggedError$5 = Schema.TaggedError;
|
|
20494
21019
|
/** @internal */
|
|
20495
|
-
var StepFailed = class extends taggedError$
|
|
21020
|
+
var StepFailed = class extends taggedError$5()("StepFailed", { message: Schema.String }) {};
|
|
20496
21021
|
const retryNote = (failures) => pipe(Array$1.last(failures), Option.match({
|
|
20497
21022
|
onNone: () => "",
|
|
20498
21023
|
onSome: (reason) => `\n\nYour previous answer was rejected: ${reason} Answer again and fix that.`
|
|
@@ -21013,6 +21538,18 @@ const changedCommand = Command.make("changed", {
|
|
|
21013
21538
|
program: Argument.String("command").pipe(Argument.withDescription("The command to run, written after --")),
|
|
21014
21539
|
rest: Argument.String("argument").pipe(Argument.withDescription("The arguments of the command"), Argument.variadic())
|
|
21015
21540
|
}, changed).pipe(Command.withDescription("Runs a command with the paths of the workspaces whose inputs changed since it last passed"));
|
|
21541
|
+
// src/app/ci-command.ts
|
|
21542
|
+
const taggedError$4 = Schema.TaggedError;
|
|
21543
|
+
/** @internal */
|
|
21544
|
+
var StaleInstall = class extends taggedError$4()("StaleInstall", { message: Schema.String }) {};
|
|
21545
|
+
const ci = Effect.fn("ci")(function* ci() {
|
|
21546
|
+
const root = (yield* RepositoryFiles).resolve(".");
|
|
21547
|
+
const problem = yield* installedVersionProblem(root);
|
|
21548
|
+
if (Option.isSome(problem)) return yield* StaleInstall.make({ message: problem.value });
|
|
21549
|
+
return yield* syncCi(root);
|
|
21550
|
+
});
|
|
21551
|
+
/** @internal */
|
|
21552
|
+
const ciCommand = Command.make("ci", {}, ci).pipe(Command.withDescription("Puts the shared setup action into every job that runs vp, drops the hand-written Actions caches and writes the callers of the shared queue workflows"));
|
|
21016
21553
|
// src/app/lookup-report.ts
|
|
21017
21554
|
const NONE_FOUND = 0;
|
|
21018
21555
|
const LINE_BREAK$1 = "\n";
|
|
@@ -23554,6 +24091,7 @@ const unbumped = Effect.fn("unbumped")(function* unbumped() {
|
|
|
23554
24091
|
const SUBCOMMANDS = [
|
|
23555
24092
|
agentsCommand,
|
|
23556
24093
|
changedCommand,
|
|
24094
|
+
ciCommand,
|
|
23557
24095
|
exitsCommand,
|
|
23558
24096
|
judgeCommand,
|
|
23559
24097
|
publishCommand,
|