@r_masseater/msch 0.103.0 → 0.110.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +348 -864
- package/dist/cli.mjs.map +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.mjs +412 -7
- package/dist/config.mjs.map +1 -1
- package/dist/{index-uu_6hUYh.d.mts → index-BjHoDbVQ.d.mts} +2 -1
- package/dist/{published-DDN36qgu.mjs → published-DRs5iHkQ.mjs} +13 -72
- package/dist/published-DRs5iHkQ.mjs.map +1 -0
- package/dist/{repository-text-B1wK0ETA.mjs → repository-text-BZqpXNEe.mjs} +79 -12
- package/dist/repository-text-BZqpXNEe.mjs.map +1 -0
- package/dist/workspace-projects-ycyXdQRo.mjs +69 -0
- package/dist/workspace-projects-ycyXdQRo.mjs.map +1 -0
- package/dist/workspace-settings.d.mts +1 -1
- package/dist/workspace-settings.mjs +4 -2
- package/dist/workspace-settings.mjs.map +1 -1
- package/package.json +5 -5
- package/dist/published-DDN36qgu.mjs.map +0 -1
- package/dist/repository-text-B1wK0ETA.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { i as nodeRepositoryFiles, n as NODE_MODULES, o as TOOL_NAME$1, r as RepositoryFiles, s as groupOf, t as MSCH_CACHE } from "./repository-files-DbZY3I_3.mjs";
|
|
3
|
-
import { $ as isIdentifier, A as uniqueByReference, B as getTextOfJSDocComment, C as moduleSpecifierOf, D as resolvedSymbol, E as referencedSymbols, F as SymbolFlags, G as isCallExpression, H as isArrowFunction, I as SyntaxKind, J as isEnumDeclaration, K as isClassDeclaration, L as getJSDocTags, M as IndexKind, N as InternalSymbolName, O as symbolAt, P as SignatureKind, Q as isFunctionExpression, R as getLeadingCommentRanges, S as moduleSpecifierLiteralOf, St as isVariableStatement, T as propertyNamesOf, U as isBinaryExpression, V as isArrayLiteralExpression, W as isBlock, X as isExpressionStatement, Y as isExportDeclaration, Z as isFunctionDeclaration, _ as isGenericDeclaration, _t as isTypeLiteralNode, a as problemAtPosition, at as isNumericLiteral, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, ct as isPropertyAccessExpression, d as contains, dt as isSatisfiesExpression, et as isImportDeclaration, f as declarationsOf, ft as isSignatureDeclaration, g as isExternalDeclaration, gt as isTypeAliasDeclaration, h as importedModulesOf, ht as isStringLiteral, i as problemAt$
|
|
4
|
-
import { B as
|
|
3
|
+
import { $ as isIdentifier, A as uniqueByReference, B as getTextOfJSDocComment, C as moduleSpecifierOf, D as resolvedSymbol, E as referencedSymbols, F as SymbolFlags, G as isCallExpression, H as isArrowFunction, I as SyntaxKind, J as isEnumDeclaration, K as isClassDeclaration, L as getJSDocTags, M as IndexKind, N as InternalSymbolName, O as symbolAt, P as SignatureKind, Q as isFunctionExpression, R as getLeadingCommentRanges, S as moduleSpecifierLiteralOf, St as isVariableStatement, T as propertyNamesOf, U as isBinaryExpression, V as isArrayLiteralExpression, W as isBlock, X as isExpressionStatement, Y as isExportDeclaration, Z as isFunctionDeclaration, _ as isGenericDeclaration, _t as isTypeLiteralNode, a as problemAtPosition, at as isNumericLiteral, b as isTypeDeclaration, bt as isVariableDeclaration, c as carriesTag, ct as isPropertyAccessExpression, d as contains, dt as isSatisfiesExpression, et as isImportDeclaration, f as declarationsOf, ft as isSignatureDeclaration, g as isExternalDeclaration, gt as isTypeAliasDeclaration, h as importedModulesOf, ht as isStringLiteral, i as problemAt$6, it as isNewExpression, j as API, k as symbolAtLocation, l as childrenOf$3, lt as isPropertyAssignment, m as descendantsOf, mt as isSpreadElement, nt as isModuleBlock, o as problemInFile, ot as isObjectLiteralExpression, p as declaresAType, pt as isSourceFile, q as isElementAccessExpression, r as formatProblem, rt as isModuleDeclaration, s as sortProblems, st as isParenthesizedExpression, t as ProblemList, tt as isInterfaceDeclaration, u as columnOf, ut as isReturnStatement, v as isInsideAny, vt as isTypeReferenceNode, w as packageOf$1, x as lineOf$5, xt as isVariableDeclarationList, y as isOutsideDeclaration, yt as isUnionTypeNode, z as getNameOfDeclaration } from "./problem-BP2B-3M4.mjs";
|
|
4
|
+
import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$4, H as installedManifest, I as keyName, L as literalOf, N as workspaceConfigOf, P as KeySchema, R as nestedValues, S as RUN_TASKS, T as hasVerifyTask, U as readManifest, V as dependencyEntries, W as workspaceDependencies$1, _ as deployEntries, a as workspaceConfigs, c as publicEntriesOf, d as isIndexSkill, f as FRONTMATTER, g as bundledEntries, h as workspaceLinks, i as publishedWorkspaces, l as draftArticlesIn, o as entryNameOf, p as splitFrontmatter, r as packedWorkspaces, s as isBinEntry, u as publishedArticlesIn, w as definesTask, y as shadcnUiOf, z as propertyValue } from "./published-DRs5iHkQ.mjs";
|
|
5
|
+
import { a as workspaceManifest, i as workspaceProjects, n as unmatchedWorkspacePatterns, r as workspaceDirectories, t as publishedProjects } from "./workspace-projects-ycyXdQRo.mjs";
|
|
5
6
|
import { a as parent, i as join, n as isInside, t as baseName$1 } from "./path-DUttmo2s.mjs";
|
|
6
7
|
import { n as DECISION_TIMEOUT_MS, r as JAPANESE, t as DECISION_MODEL } from "./config-BBdsNPSO.mjs";
|
|
8
|
+
import { a as MSCH_TASK_COMMANDS, d as namedWorkspaces, f as patternOf$1, l as isIgnored, n as secretsOf, r as textIgnoresOf, s as existsAt, t as builtTextRuleNames } from "./repository-text-BZqpXNEe.mjs";
|
|
7
9
|
import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
|
|
8
10
|
import { g as decisionTestRules, n as MARKDOWN_RULES, p as lint$3, r as markdownIgnoresOf, x as exempt } from "./define-lint-preset-Jiu7pMHB.mjs";
|
|
9
|
-
import { a as MSCH_TASK_COMMANDS, n as secretsOf, r as textIgnoresOf, t as builtTextRuleNames } from "./repository-text-B1wK0ETA.mjs";
|
|
10
11
|
import { builtinModules, isBuiltin } from "node:module";
|
|
11
12
|
import { VpToolsError, findCiDrift, runVpa } from "@r_masseater/vite-plus-adopt";
|
|
12
13
|
import { Array as Array$1, Boolean as Boolean$1, Clock, Config, Console, Context, Effect, Equal, FileSystem, Function, HashMap, HashSet, Match, Metric, Number as Number$1, Option, Order, Path, Predicate, Record, Result, Runtime, Schedule, Schema, SchemaTransformation, Stdio, Stream, String as String$1, pipe } from "effect";
|
|
@@ -18,7 +19,7 @@ import { DEPENDENCY_SECTIONS, PACKAGE_JSON_FILE, ROOT_SUBPATH, RUNTIME_SECTIONS,
|
|
|
18
19
|
import { findPackageJson } from "@r_masseater/masseater-utils/kestrion/node";
|
|
19
20
|
import { decodePackageJson, decodeVersionedPackageJson, readPackageJson, readRawPackageJson, readVersionedPackageJson, updatePackageJson, writePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
|
|
20
21
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
21
|
-
import { Parser,
|
|
22
|
+
import { Parser, isPair, isScalar, parse as parse$1, parseDocument, visit } from "yaml";
|
|
22
23
|
import { fileURLToPath } from "node:url";
|
|
23
24
|
import treeSitter from "@vscode/tree-sitter-wasm";
|
|
24
25
|
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
@@ -42,7 +43,7 @@ import { Base64 } from "effect/encoding";
|
|
|
42
43
|
import { dual } from "effect/Function";
|
|
43
44
|
// package.json
|
|
44
45
|
var name = "@r_masseater/msch";
|
|
45
|
-
var version = "0.
|
|
46
|
+
var version = "0.110.0";
|
|
46
47
|
var homepage = "https://github.com/masseater/ecosystems/tree/main/libs/msch#readme";
|
|
47
48
|
var repository = {
|
|
48
49
|
"type": "git",
|
|
@@ -434,7 +435,7 @@ const mentions$1 = (needle) => ({ api }) => (configPath) => Effect.gen(function*
|
|
|
434
435
|
return pipe(texts, Array$1.some((text) => Option.exists(text, includesNeedle)));
|
|
435
436
|
});
|
|
436
437
|
// src/entities/project/model/inputs.ts
|
|
437
|
-
const SEPARATOR$
|
|
438
|
+
const SEPARATOR$27 = "/";
|
|
438
439
|
const SCOPE_PREFIX$1 = "@";
|
|
439
440
|
const HIDDEN_PREFIX = ".";
|
|
440
441
|
const encodeOptions = Schema.encodeEffect(Schema.fromJsonString(Schema.Unknown));
|
|
@@ -476,14 +477,14 @@ const closureOf$3 = Effect.fn("closureOf")(function* closureOf(root, configPath)
|
|
|
476
477
|
const directories = yield* workspaceClosure(directory);
|
|
477
478
|
return {
|
|
478
479
|
directories,
|
|
479
|
-
prefixes: pipe(directories, Array$1.map((found) => `${files.relative(root, found)}${SEPARATOR$
|
|
480
|
+
prefixes: pipe(directories, Array$1.map((found) => `${files.relative(root, found)}${SEPARATOR$27}`))
|
|
480
481
|
};
|
|
481
482
|
});
|
|
482
483
|
const scopedNames = (modules) => (name) => Effect.gen(function* listScope() {
|
|
483
484
|
const files = yield* RepositoryFiles;
|
|
484
485
|
if (!String$1.startsWith(SCOPE_PREFIX$1)(name)) return [name];
|
|
485
486
|
const scoped = yield* files.readDirectory(files.join(modules, name));
|
|
486
|
-
return pipe(scoped, Array$1.map((entry) => `${name}${SEPARATOR$
|
|
487
|
+
return pipe(scoped, Array$1.map((entry) => `${name}${SEPARATOR$27}${entry}`));
|
|
487
488
|
});
|
|
488
489
|
const installedNames$1 = Effect.fn("installedNames")(function* installedNames(modules) {
|
|
489
490
|
const listed = yield* (yield* RepositoryFiles).readDirectory(modules);
|
|
@@ -636,36 +637,8 @@ const runTasksOf = Effect.fn("runTasksOf")(function* runTasksOf(root, directory)
|
|
|
636
637
|
tasks: tasksIn$1(program)
|
|
637
638
|
})));
|
|
638
639
|
});
|
|
639
|
-
// src/entities/workspace/model/workspace-names.ts
|
|
640
|
-
const ALTERNATIVE$2 = "|";
|
|
641
|
-
const SCOPE$3 = /^@[^/]+\//u;
|
|
642
|
-
const SPECIAL$1 = /[$()*+.?[\\\]^{|}]/gu;
|
|
643
|
-
/** @internal */
|
|
644
|
-
const patternOf$1 = (names) => {
|
|
645
|
-
const alternatives = pipe(names, Array$1.map(String$1.replaceAll(SPECIAL$1, String.raw`\$&`)));
|
|
646
|
-
return new RegExp(`(?<![\\p{L}\\p{N}_-])(?:${Array$1.join(alternatives, ALTERNATIVE$2)})(?![\\p{L}\\p{N}_-])`, "gu");
|
|
647
|
-
};
|
|
648
|
-
const namedIn = (basename) => ({ directory, packageName }) => {
|
|
649
|
-
const unscoped = pipe(packageName, Option.map(String$1.replace(SCOPE$3, "")));
|
|
650
|
-
return {
|
|
651
|
-
directory,
|
|
652
|
-
names: pipe([
|
|
653
|
-
Option.some(directory),
|
|
654
|
-
Option.some(basename(directory)),
|
|
655
|
-
packageName,
|
|
656
|
-
unscoped
|
|
657
|
-
], Array$1.getSomes, Array$1.dedupe),
|
|
658
|
-
packageName
|
|
659
|
-
};
|
|
660
|
-
};
|
|
661
|
-
/** @internal */
|
|
662
|
-
const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(root) {
|
|
663
|
-
const files = yield* RepositoryFiles;
|
|
664
|
-
const projects = yield* workspaceProjects(root);
|
|
665
|
-
return pipe(projects, Array$1.map(namedIn((directory) => files.basename(directory))));
|
|
666
|
-
});
|
|
667
640
|
// src/entities/workspace/model/cargo-crates.ts
|
|
668
|
-
const SEPARATOR$
|
|
641
|
+
const SEPARATOR$26 = "/";
|
|
669
642
|
const SUCCESS$7 = 0;
|
|
670
643
|
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
671
644
|
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
@@ -705,7 +678,7 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
705
678
|
}, Effect.scoped);
|
|
706
679
|
/** @internal */
|
|
707
680
|
const owningWorkspace = (directories) => (directory) => {
|
|
708
|
-
const owners = pipe(directories, Array$1.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
681
|
+
const owners = pipe(directories, Array$1.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$26}`)(directory)));
|
|
709
682
|
return Array$1.last(Array$1.sort(owners, String$1.Order));
|
|
710
683
|
};
|
|
711
684
|
// src/entities/workspace/model/plugins.ts
|
|
@@ -713,7 +686,7 @@ const PLUGIN_FILE$4 = ".claude-plugin/plugin.json";
|
|
|
713
686
|
const SKILLS_DIRECTORY = "skills";
|
|
714
687
|
const SKILL_FILE$4 = "SKILL.md";
|
|
715
688
|
const CONCURRENCY$4 = 16;
|
|
716
|
-
const SEPARATOR$
|
|
689
|
+
const SEPARATOR$25 = "/";
|
|
717
690
|
const PluginManifest$1 = Schema.fromJsonString(Schema.Struct({
|
|
718
691
|
name: Schema.String,
|
|
719
692
|
description: Schema.optionalKey(Schema.String),
|
|
@@ -729,7 +702,7 @@ const skillIn = Effect.fn("skillIn")(function* skillIn(scan, { plugin, skills },
|
|
|
729
702
|
const directory = files.join(skills, name);
|
|
730
703
|
const file = files.join(directory, SKILL_FILE$4);
|
|
731
704
|
const source = yield* files.readFile(file);
|
|
732
|
-
const prefix = `${files.relative(scan.root, directory)}${SEPARATOR$
|
|
705
|
+
const prefix = `${files.relative(scan.root, directory)}${SEPARATOR$25}`;
|
|
733
706
|
const inside = pipe(scan.listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.map((entry) => files.join(scan.root, entry)));
|
|
734
707
|
return pipe(source, Option.flatMap((text) => pipe(splitFrontmatter(text), Option.map((frontmatter) => ({
|
|
735
708
|
plugin,
|
|
@@ -742,7 +715,7 @@ const skillIn = Effect.fn("skillIn")(function* skillIn(scan, { plugin, skills },
|
|
|
742
715
|
})))));
|
|
743
716
|
});
|
|
744
717
|
const filesUnder = Effect.fn("filesUnder")(function* filesUnder(scan, directory) {
|
|
745
|
-
const prefix = `${(yield* RepositoryFiles).relative(scan.root, directory)}${SEPARATOR$
|
|
718
|
+
const prefix = `${(yield* RepositoryFiles).relative(scan.root, directory)}${SEPARATOR$25}`;
|
|
746
719
|
return pipe(scan.listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.map(String$1.slice(prefix.length)));
|
|
747
720
|
});
|
|
748
721
|
const skillsOf$1 = Effect.fn("skillsOf")(function* skillsOf(scan, plugin, directory) {
|
|
@@ -805,10 +778,10 @@ const namesSkill = (skill) => (text) => new RegExp(namePattern(skill), "u").test
|
|
|
805
778
|
const SKILLS_START = "<!-- skills:generated -->";
|
|
806
779
|
const SKILLS_END = "<!-- /skills:generated -->";
|
|
807
780
|
// src/shared/lib/text-position.ts
|
|
808
|
-
const START$
|
|
781
|
+
const START$34 = 0;
|
|
809
782
|
const FIRST_COLUMN$8 = 1;
|
|
810
783
|
const positionOf = (source) => (index) => {
|
|
811
|
-
const before = pipe(source, String$1.slice(START$
|
|
784
|
+
const before = pipe(source, String$1.slice(START$34, index), String$1.split("\n"));
|
|
812
785
|
return {
|
|
813
786
|
line: before.length,
|
|
814
787
|
column: pipe(Array$1.last(before), Option.match({
|
|
@@ -1087,7 +1060,7 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
1087
1060
|
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;
|
|
1088
1061
|
const LOCKFILE$1 = /(?:^|\/)(?:[^/]*\.lock|[^/]*-lock\.(?:json|ya?ml))$/u;
|
|
1089
1062
|
const TOOL_VERSIONS = /(?:^|\/)(?:\.?mise(?:\.[^/]+)?\.toml|\.tool-versions)$/u;
|
|
1090
|
-
const READ_CONCURRENCY$
|
|
1063
|
+
const READ_CONCURRENCY$40 = 64;
|
|
1091
1064
|
const isScannedText = ({ name }) => SCANNED_FILE.test(name) && !LOCKFILE$1.test(name);
|
|
1092
1065
|
const isToolVersions = ({ name }) => TOOL_VERSIONS.test(name);
|
|
1093
1066
|
/** @internal */
|
|
@@ -1110,56 +1083,56 @@ const scanText = Effect.fn("scanText")(function* scanText(listed, foundIn) {
|
|
|
1110
1083
|
const found = yield* Effect.forEach(listed, (entry) => files.readFile(entry.file).pipe(Effect.map(Option.match({
|
|
1111
1084
|
onNone: () => [],
|
|
1112
1085
|
onSome: (source) => foundIn(entry, source)
|
|
1113
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
1086
|
+
}))), { concurrency: READ_CONCURRENCY$40 });
|
|
1114
1087
|
return Array$1.flatten(found);
|
|
1115
1088
|
});
|
|
1116
1089
|
// src/features/check-overrides/model/git-subpath.ts
|
|
1117
1090
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
1118
1091
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
1119
|
-
const RULE$
|
|
1092
|
+
const RULE$75 = "git-subpath-dependency";
|
|
1120
1093
|
const WHOLE_MATCH$4 = 0;
|
|
1121
|
-
const problemAt$
|
|
1094
|
+
const problemAt$5 = ({ file }, source) => (found) => ({
|
|
1122
1095
|
file,
|
|
1123
1096
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
1124
|
-
rule: RULE$
|
|
1097
|
+
rule: RULE$75,
|
|
1125
1098
|
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])}\`.`
|
|
1126
1099
|
});
|
|
1127
|
-
const problemsIn$
|
|
1100
|
+
const problemsIn$23 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array$1.map(problemAt$5(entry, source)));
|
|
1128
1101
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
1129
1102
|
/** @internal */
|
|
1130
1103
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
1131
1104
|
const listed = yield* listedFiles(root);
|
|
1132
|
-
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$
|
|
1105
|
+
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$23);
|
|
1133
1106
|
});
|
|
1134
1107
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
1135
|
-
const RULE$
|
|
1108
|
+
const RULE$74 = "unnamed-restriction";
|
|
1136
1109
|
const WHOLE_MATCH$3 = 0;
|
|
1137
1110
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-[a-z]+(?:-[a-z]+)*\\b`, "gu");
|
|
1138
|
-
const problemsIn$
|
|
1111
|
+
const problemsIn$22 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(UNNAMED)(source)), Array$1.map((found) => ({
|
|
1139
1112
|
file: entry.file,
|
|
1140
1113
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
1141
|
-
rule: RULE$
|
|
1114
|
+
rule: RULE$74,
|
|
1142
1115
|
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.`
|
|
1143
1116
|
})));
|
|
1144
1117
|
/** @internal */
|
|
1145
1118
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
1146
1119
|
const listed = yield* listedFiles(root);
|
|
1147
|
-
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$
|
|
1120
|
+
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$22);
|
|
1148
1121
|
});
|
|
1149
1122
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
1150
|
-
const RULE$
|
|
1123
|
+
const RULE$73 = "named-type-exemption";
|
|
1151
1124
|
const WHOLE_MATCH$2 = 0;
|
|
1152
1125
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
1153
|
-
const problemsIn$
|
|
1126
|
+
const problemsIn$21 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array$1.map((found) => ({
|
|
1154
1127
|
file: entry.file,
|
|
1155
1128
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
1156
|
-
rule: RULE$
|
|
1129
|
+
rule: RULE$73,
|
|
1157
1130
|
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."
|
|
1158
1131
|
})));
|
|
1159
1132
|
/** @internal */
|
|
1160
1133
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
1161
1134
|
const listed = yield* listedFiles(root);
|
|
1162
|
-
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$
|
|
1135
|
+
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$21);
|
|
1163
1136
|
});
|
|
1164
1137
|
// src/shared/lib/registries.ts
|
|
1165
1138
|
const TRAILING_SLASH$1 = /\/*$/u;
|
|
@@ -1169,21 +1142,21 @@ const INSTALL_REGISTRY = "https://npm.flatt.tech/";
|
|
|
1169
1142
|
const withTrailingSlash = (url) => `${String$1.replace(TRAILING_SLASH$1, "")(url)}/`;
|
|
1170
1143
|
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)))));
|
|
1171
1144
|
// src/features/check-overrides/model/package-registry.ts
|
|
1172
|
-
const RULE$
|
|
1145
|
+
const RULE$72 = "package-registry";
|
|
1173
1146
|
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
1174
1147
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
1175
1148
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
1176
1149
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
1177
|
-
const START$
|
|
1150
|
+
const START$33 = 0;
|
|
1178
1151
|
const REASON$3 = `Installs go through Takumi Guard (${INSTALL_REGISTRY}), which blocks known-malicious packages before they are installed.`;
|
|
1179
1152
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
1180
1153
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
1181
1154
|
const isRequired = (found) => withTrailingSlash(found) === INSTALL_REGISTRY;
|
|
1182
|
-
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
1155
|
+
const offsetIn$1 = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$33));
|
|
1183
1156
|
const workspaceProblem = ({ file, source }, registry) => ({
|
|
1184
1157
|
file,
|
|
1185
1158
|
...positionOf(source)(offsetIn$1(WORKSPACE_REGISTRY.exec(source))),
|
|
1186
|
-
rule: RULE$
|
|
1159
|
+
rule: RULE$72,
|
|
1187
1160
|
message: Option.match(registry, {
|
|
1188
1161
|
onNone: () => `${REASON$3} Set \`registry: ${INSTALL_REGISTRY}\` in ${WORKSPACE_FILE$6}.`,
|
|
1189
1162
|
onSome: (value) => `${REASON$3} \`registry\` is ${value}. Set it to ${INSTALL_REGISTRY}.`
|
|
@@ -1191,9 +1164,9 @@ const workspaceProblem = ({ file, source }, registry) => ({
|
|
|
1191
1164
|
});
|
|
1192
1165
|
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) => ({
|
|
1193
1166
|
file: entry.file,
|
|
1194
|
-
...positionOf(source)(found.index ?? START$
|
|
1195
|
-
rule: RULE$
|
|
1196
|
-
message: `${REASON$3} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
1167
|
+
...positionOf(source)(found.index ?? START$33),
|
|
1168
|
+
rule: RULE$72,
|
|
1169
|
+
message: `${REASON$3} This .npmrc overrides it with \`${String$1.trim(found[START$33])}\`. Remove the line.`
|
|
1197
1170
|
})));
|
|
1198
1171
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root) {
|
|
1199
1172
|
const files = yield* RepositoryFiles;
|
|
@@ -3317,15 +3290,15 @@ minimatch.Minimatch = Minimatch;
|
|
|
3317
3290
|
minimatch.escape = escape;
|
|
3318
3291
|
minimatch.unescape = unescape;
|
|
3319
3292
|
// ../path-kit/src/entities/glob/model/glob.ts
|
|
3320
|
-
const NEGATION$
|
|
3293
|
+
const NEGATION$1 = "!";
|
|
3321
3294
|
const matcher = (patterns) => {
|
|
3322
3295
|
const compiled = pipe(patterns, Array$1.map((pattern) => new Minimatch(pattern, { dot: true })));
|
|
3323
3296
|
return (path) => pipe(compiled, Array$1.some((glob) => glob.match(path)));
|
|
3324
3297
|
};
|
|
3325
|
-
String$1.startsWith(NEGATION$
|
|
3298
|
+
String$1.startsWith(NEGATION$1);
|
|
3326
3299
|
String$1.slice(1);
|
|
3327
3300
|
// src/entities/package/model/specifiers.ts
|
|
3328
|
-
const START$
|
|
3301
|
+
const START$32 = 0;
|
|
3329
3302
|
const FieldsSchema = Schema.Record(Schema.String, Schema.Unknown);
|
|
3330
3303
|
const decodeFields$1 = Schema.decodeUnknownOption(FieldsSchema);
|
|
3331
3304
|
const decodeString$1 = Schema.decodeUnknownOption(Schema.String);
|
|
@@ -3343,7 +3316,7 @@ const quoted$1 = (text) => String$1.replaceAll(/[$()*+.?[\\\]^{|}]/gu, String.ra
|
|
|
3343
3316
|
/** @internal */
|
|
3344
3317
|
const manifestPattern = ({ name, specifier }) => new RegExp(`"${quoted$1(name)}"\\s*:\\s*"${quoted$1(specifier)}"`, "u");
|
|
3345
3318
|
/** @internal */
|
|
3346
|
-
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
3319
|
+
const offsetIn = (source) => (pattern) => pipe(Option.fromNullishOr(pattern.exec(source)), Option.map(({ index }) => index), Option.getOrElse(() => START$32));
|
|
3347
3320
|
const SECTIONS$1 = [
|
|
3348
3321
|
"dependencies",
|
|
3349
3322
|
"devDependencies",
|
|
@@ -3377,7 +3350,7 @@ const SELF_HOMEPAGE = homepage;
|
|
|
3377
3350
|
const SELF_DIRECTORY = repository.directory;
|
|
3378
3351
|
const RENOVATE_PRESET = `github>${pipe(repository.url, String$1.replace(GIT_PREFIX, ""), String$1.replace(GIT_SUFFIX, ""), String$1.replace(GITHUB$6, ""))}//${SELF_DIRECTORY}/renovate`;
|
|
3379
3352
|
// src/features/check-overrides/model/removed-peers.ts
|
|
3380
|
-
const RULE$
|
|
3353
|
+
const RULE$71 = "removed-peer";
|
|
3381
3354
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
3382
3355
|
const REMOVED = "-";
|
|
3383
3356
|
const PARENT_SEPARATOR = ">";
|
|
@@ -3400,16 +3373,16 @@ const removesPeer = ({ target, parent }) => ({ peer, dependent }) => peer === ta
|
|
|
3400
3373
|
onSome: (name) => name === dependent
|
|
3401
3374
|
});
|
|
3402
3375
|
const isRemoval = (value) => value === REMOVED;
|
|
3403
|
-
const problemAt$
|
|
3376
|
+
const problemAt$4 = (file, { key, line, column }) => ({ peer, dependent }) => ({
|
|
3404
3377
|
file,
|
|
3405
3378
|
line,
|
|
3406
3379
|
column,
|
|
3407
|
-
rule: RULE$
|
|
3380
|
+
rule: RULE$71,
|
|
3408
3381
|
message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
|
|
3409
3382
|
});
|
|
3410
3383
|
const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
|
|
3411
3384
|
const firstRemovedPeer = (peers) => (removal) => pipe(peers, Array$1.findFirst(removesPeer(removal)));
|
|
3412
|
-
const removedPeerProblems = (peers) => ({ file, source, overrides }) => pipe(overrideKeysOf(source)(removalsIn(overrides)), Array$1.flatMap((located) => pipe(removalOf(located.key), Option.flatMap(firstRemovedPeer(peers)), Option.map(problemAt$
|
|
3385
|
+
const removedPeerProblems = (peers) => ({ file, source, overrides }) => pipe(overrideKeysOf(source)(removalsIn(overrides)), Array$1.flatMap((located) => pipe(removalOf(located.key), Option.flatMap(firstRemovedPeer(peers)), Option.map(problemAt$4(file, located)), Option.toArray)));
|
|
3413
3386
|
const requiredPeersOf = (dependent, manifest) => pipe(Record.keys(manifest.peerDependencies ?? {}), Array$1.difference(optionalPeerNames(manifest)), Array$1.map((peer) => ({
|
|
3414
3387
|
peer,
|
|
3415
3388
|
dependent
|
|
@@ -3438,42 +3411,42 @@ const checkRemovedPeers = Effect.fn("checkRemovedPeers")(function* checkRemovedP
|
|
|
3438
3411
|
});
|
|
3439
3412
|
});
|
|
3440
3413
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
3441
|
-
const RULE$
|
|
3414
|
+
const RULE$70 = "colocated-git-patterns";
|
|
3442
3415
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
3443
|
-
const ROOT$
|
|
3444
|
-
const NEGATION
|
|
3445
|
-
const COMMENT
|
|
3416
|
+
const ROOT$3 = ".";
|
|
3417
|
+
const NEGATION = "!";
|
|
3418
|
+
const COMMENT = "#";
|
|
3446
3419
|
const ANY_DEPTH = "**";
|
|
3447
3420
|
const FLOATING_PREFIX = `${ANY_DEPTH}/`;
|
|
3448
3421
|
const LEADING_SLASHES = /^\/+/u;
|
|
3449
3422
|
const TRAILING_SLASHES = /\/+$/u;
|
|
3450
3423
|
const SPACES = /\s+/u;
|
|
3451
|
-
const FIRST$
|
|
3452
|
-
const READ_CONCURRENCY$
|
|
3424
|
+
const FIRST$26 = 1;
|
|
3425
|
+
const READ_CONCURRENCY$39 = 16;
|
|
3453
3426
|
const withoutPrefix = (prefix, text) => {
|
|
3454
3427
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
3455
3428
|
return text;
|
|
3456
3429
|
};
|
|
3457
3430
|
const isAnchored = (pattern) => {
|
|
3458
|
-
const body = withoutPrefix(NEGATION
|
|
3431
|
+
const body = withoutPrefix(NEGATION, pattern);
|
|
3459
3432
|
return pipe(body, String$1.replace(TRAILING_SLASHES, ""), String$1.includes("/"));
|
|
3460
3433
|
};
|
|
3461
3434
|
const segmentsOf = ({ directory, pattern }) => {
|
|
3462
|
-
const body = withoutPrefix(NEGATION
|
|
3435
|
+
const body = withoutPrefix(NEGATION, pattern);
|
|
3463
3436
|
const trimmed = pipe(body, String$1.replace(LEADING_SLASHES, ""), String$1.replace(TRAILING_SLASHES, ""));
|
|
3464
3437
|
const own = String$1.split("/")(trimmed);
|
|
3465
|
-
if (directory === ROOT$
|
|
3438
|
+
if (directory === ROOT$3) return own;
|
|
3466
3439
|
return [...String$1.split("/")(directory), ...own];
|
|
3467
3440
|
};
|
|
3468
3441
|
const depthOf = (directory) => String$1.split("/")(directory).length;
|
|
3469
3442
|
const entryOf$2 = (file, kind, directory) => (line, index) => {
|
|
3470
3443
|
const [pattern, ...values] = pipe(String$1.trim(line), String$1.split(SPACES));
|
|
3471
|
-
if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT
|
|
3444
|
+
if (String$1.isEmpty(pattern) || String$1.startsWith(COMMENT)(pattern)) return Option.none();
|
|
3472
3445
|
return Option.some({
|
|
3473
3446
|
file,
|
|
3474
3447
|
kind,
|
|
3475
3448
|
directory,
|
|
3476
|
-
line: index + FIRST$
|
|
3449
|
+
line: index + FIRST$26,
|
|
3477
3450
|
pattern,
|
|
3478
3451
|
values: Array$1.join(values, " ")
|
|
3479
3452
|
});
|
|
@@ -3485,12 +3458,12 @@ const entriesIn$2 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
3485
3458
|
const toEntry = entryOf$2(absolute, files.basename(file), files.dirname(file));
|
|
3486
3459
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array$1.map(toEntry), Array$1.getSomes);
|
|
3487
3460
|
});
|
|
3488
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
3461
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$70)(entry.file, {
|
|
3489
3462
|
line: entry.line,
|
|
3490
|
-
column: FIRST$
|
|
3463
|
+
column: FIRST$26
|
|
3491
3464
|
}, message);
|
|
3492
3465
|
const misplacedMessage = (kind, workspaces) => {
|
|
3493
|
-
if (workspaces.length === FIRST$
|
|
3466
|
+
if (workspaces.length === FIRST$26) {
|
|
3494
3467
|
const workspace = Array$1.join(workspaces, "");
|
|
3495
3468
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
3496
3469
|
}
|
|
@@ -3518,7 +3491,7 @@ const misplaced = Effect.fn("misplaced")(function* misplaced(root, workspaces, e
|
|
|
3518
3491
|
if (Array$1.isReadonlyArrayEmpty(deepest)) return Option.none();
|
|
3519
3492
|
return Option.some(patternProblem(entry, misplacedMessage(entry.kind, deepest)));
|
|
3520
3493
|
});
|
|
3521
|
-
const isFloating = (pattern) => !String$1.startsWith(NEGATION
|
|
3494
|
+
const isFloating = (pattern) => !String$1.startsWith(NEGATION)(pattern) && (!isAnchored(pattern) || String$1.startsWith(FLOATING_PREFIX)(pattern));
|
|
3522
3495
|
const ownLevelName = (pattern) => {
|
|
3523
3496
|
if (isFloating(pattern)) return Option.some(pattern);
|
|
3524
3497
|
const name = withoutPrefix("/", pattern);
|
|
@@ -3530,7 +3503,7 @@ const sameName = (outer, name) => {
|
|
|
3530
3503
|
};
|
|
3531
3504
|
const coveredBy = (entry, name) => (outer) => outer.kind === entry.kind && outer.values === entry.values && isFloating(outer.pattern) && isInside(outer.directory)(entry.directory) && sameName(outer.pattern, name);
|
|
3532
3505
|
const outerName = ({ directory, kind }) => {
|
|
3533
|
-
if (directory === ROOT$
|
|
3506
|
+
if (directory === ROOT$3) return `the root ${kind}`;
|
|
3534
3507
|
return `${directory}/${kind}`;
|
|
3535
3508
|
};
|
|
3536
3509
|
const repeated = (entries) => (entry) => {
|
|
@@ -3540,21 +3513,21 @@ const repeated = (entries) => (entry) => {
|
|
|
3540
3513
|
/** @internal */
|
|
3541
3514
|
const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(function* checkColocatedGitPatterns(root) {
|
|
3542
3515
|
const patternFiles = yield* (yield* RepositoryFiles).matchingFiles(root, PATTERN_FILES);
|
|
3543
|
-
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$2(root, file), { concurrency: READ_CONCURRENCY$
|
|
3516
|
+
const read = yield* Effect.forEach(patternFiles, (file) => entriesIn$2(root, file), { concurrency: READ_CONCURRENCY$39 });
|
|
3544
3517
|
const entries = Array$1.flatten(read);
|
|
3545
3518
|
const workspaces = yield* workspaceDirectories(root);
|
|
3546
|
-
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$
|
|
3519
|
+
const misplacedFound = yield* Effect.forEach(entries, (entry) => misplaced(root, workspaces, entry), { concurrency: READ_CONCURRENCY$39 });
|
|
3547
3520
|
const repeatedFound = pipe(entries, Array$1.map(repeated(entries)));
|
|
3548
3521
|
return Array$1.getSomes([...misplacedFound, ...repeatedFound]);
|
|
3549
3522
|
});
|
|
3550
3523
|
// src/features/check-placement/model/colocated-tests.ts
|
|
3551
|
-
const RULE$
|
|
3552
|
-
const FIRST$
|
|
3553
|
-
const READ_CONCURRENCY$
|
|
3524
|
+
const RULE$69 = "colocated-test";
|
|
3525
|
+
const FIRST$25 = 1;
|
|
3526
|
+
const READ_CONCURRENCY$38 = 64;
|
|
3554
3527
|
const ROOT_SUBPATH$2 = ".";
|
|
3555
3528
|
const NAME_GROUP$1 = "name";
|
|
3556
3529
|
const SPECIFIER_GROUP = "specifier";
|
|
3557
|
-
const SCRIPT$
|
|
3530
|
+
const SCRIPT$1 = /\.[cm]?[jt]sx?$/u;
|
|
3558
3531
|
const TEST_FILE$4 = /\.test\.[cm]?[jt]sx?$/u;
|
|
3559
3532
|
const MANIFEST_NAME = /package\.json$/u;
|
|
3560
3533
|
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
|
|
@@ -3569,13 +3542,13 @@ const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test n
|
|
|
3569
3542
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
3570
3543
|
const problemFor$10 = (test, message) => ({
|
|
3571
3544
|
file: test.file,
|
|
3572
|
-
line: FIRST$
|
|
3573
|
-
column: FIRST$
|
|
3574
|
-
rule: RULE$
|
|
3545
|
+
line: FIRST$25,
|
|
3546
|
+
column: FIRST$25,
|
|
3547
|
+
rule: RULE$69,
|
|
3575
3548
|
message: `${test.base} ${message}`
|
|
3576
3549
|
});
|
|
3577
|
-
const groupsOf$
|
|
3578
|
-
const namesSibling = (source) => pipe([...groupsOf$
|
|
3550
|
+
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);
|
|
3551
|
+
const namesSibling = (source) => pipe([...groupsOf$1(source, RELATIVE_REFERENCE, NAME_GROUP$1), ...groupsOf$1(source, DIRNAME_REFERENCE, NAME_GROUP$1)], Array$1.some((name) => !TEST_FILE$4.test(name)));
|
|
3579
3552
|
const ownerOf$5 = (packages, name) => {
|
|
3580
3553
|
const owners = pipe(packages, Array$1.filter((directory) => String$1.startsWith(directory)(name)));
|
|
3581
3554
|
return Array$1.last(Array$1.sort(owners, byLength$2));
|
|
@@ -3599,7 +3572,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
3599
3572
|
});
|
|
3600
3573
|
const refersToOwnDirectory = Effect.fn("refersToOwnDirectory")(function* refersToOwnDirectory(context, test, source) {
|
|
3601
3574
|
if (namesSibling(source)) return true;
|
|
3602
|
-
const specifiers = groupsOf$
|
|
3575
|
+
const specifiers = groupsOf$1(source, MODULE_SPECIFIER, SPECIFIER_GROUP);
|
|
3603
3576
|
if (Array$1.isReadonlyArrayEmpty(specifiers)) return false;
|
|
3604
3577
|
const own = yield* ownSpecifiers(context, test);
|
|
3605
3578
|
return pipe(specifiers, Array$1.some((specifier) => pipe(own, Array$1.contains(specifier))));
|
|
@@ -3625,7 +3598,7 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
3625
3598
|
root,
|
|
3626
3599
|
packages: pipe(names, Array$1.filter((name) => files.basename(name) === PACKAGE_JSON_FILE), Array$1.map(String$1.replace(MANIFEST_NAME, "")))
|
|
3627
3600
|
};
|
|
3628
|
-
const tests = pipe(names, Array$1.filter((name) => SCRIPT$
|
|
3601
|
+
const tests = pipe(names, Array$1.filter((name) => SCRIPT$1.test(name)), Array$1.map((name) => {
|
|
3629
3602
|
const file = files.join(root, name);
|
|
3630
3603
|
return {
|
|
3631
3604
|
name,
|
|
@@ -3634,12 +3607,12 @@ const checkColocatedTests = Effect.fn("checkColocatedTests")(function* checkColo
|
|
|
3634
3607
|
directory: files.dirname(file)
|
|
3635
3608
|
};
|
|
3636
3609
|
}));
|
|
3637
|
-
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$
|
|
3610
|
+
const found = yield* Effect.forEach(tests, (test) => problemIn$8(context, test), { concurrency: READ_CONCURRENCY$38 });
|
|
3638
3611
|
return Array$1.getSomes(found);
|
|
3639
3612
|
});
|
|
3640
3613
|
// src/shared/lib/agent-docs.ts
|
|
3641
3614
|
const AGENT_DOC$1 = /(?:^|\/)(?:AGENTS|CLAUDE)\.md$/u;
|
|
3642
|
-
const READ_CONCURRENCY$
|
|
3615
|
+
const READ_CONCURRENCY$37 = 16;
|
|
3643
3616
|
const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblems(root, problemIn) {
|
|
3644
3617
|
const files = yield* RepositoryFiles;
|
|
3645
3618
|
const listed = yield* files.listedFiles(root);
|
|
@@ -3648,33 +3621,33 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
3648
3621
|
const file = files.join(root, name);
|
|
3649
3622
|
const problemOf = Option.flatMap(problemIn(file));
|
|
3650
3623
|
return files.readFile(file).pipe(Effect.map(problemOf));
|
|
3651
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
3624
|
+
}, { concurrency: READ_CONCURRENCY$37 });
|
|
3652
3625
|
return Array$1.getSomes(found);
|
|
3653
3626
|
});
|
|
3654
3627
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
3655
3628
|
const RECOMMENDED_LINES = 200;
|
|
3656
|
-
const FIRST$
|
|
3657
|
-
const RULE$
|
|
3629
|
+
const FIRST$24 = 1;
|
|
3630
|
+
const RULE$68 = "agent-docs-length";
|
|
3658
3631
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
3659
3632
|
const problemFor$9 = (file) => (lines) => {
|
|
3660
3633
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
3661
3634
|
return Option.some({
|
|
3662
3635
|
file,
|
|
3663
3636
|
line: 201,
|
|
3664
|
-
column: FIRST$
|
|
3665
|
-
rule: RULE$
|
|
3637
|
+
column: FIRST$24,
|
|
3638
|
+
rule: RULE$68,
|
|
3666
3639
|
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.`
|
|
3667
3640
|
});
|
|
3668
3641
|
};
|
|
3669
3642
|
/** @internal */
|
|
3670
3643
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$9(file)(lineCount(source)));
|
|
3671
3644
|
// src/features/check-placement/model/claude-link.ts
|
|
3672
|
-
const RULE$
|
|
3645
|
+
const RULE$67 = "claude-md-link";
|
|
3673
3646
|
const CLAUDE = "CLAUDE.md";
|
|
3674
3647
|
const AGENTS = "AGENTS.md";
|
|
3675
|
-
const FIRST$
|
|
3676
|
-
const READ_CONCURRENCY$
|
|
3677
|
-
const MESSAGE$
|
|
3648
|
+
const FIRST$23 = 1;
|
|
3649
|
+
const READ_CONCURRENCY$36 = 16;
|
|
3650
|
+
const MESSAGE$14 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
3678
3651
|
/** @internal */
|
|
3679
3652
|
const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLinks(root) {
|
|
3680
3653
|
const files = yield* RepositoryFiles;
|
|
@@ -3686,22 +3659,22 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3686
3659
|
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
3687
3660
|
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
3688
3661
|
file: path,
|
|
3689
|
-
line: FIRST$
|
|
3690
|
-
column: FIRST$
|
|
3691
|
-
rule: RULE$
|
|
3692
|
-
message: MESSAGE$
|
|
3662
|
+
line: FIRST$23,
|
|
3663
|
+
column: FIRST$23,
|
|
3664
|
+
rule: RULE$67,
|
|
3665
|
+
message: MESSAGE$14
|
|
3693
3666
|
})));
|
|
3694
3667
|
});
|
|
3695
3668
|
const claude = pipe(listed, Array$1.filter((name) => files.basename(name) === CLAUDE));
|
|
3696
|
-
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$
|
|
3669
|
+
const found = yield* Effect.forEach(claude, problemOf, { concurrency: READ_CONCURRENCY$36 });
|
|
3697
3670
|
return Array$1.getSomes(found);
|
|
3698
3671
|
});
|
|
3699
3672
|
// src/features/check-placement/model/dangling-links.ts
|
|
3700
|
-
const RULE$
|
|
3701
|
-
const SEPARATOR$
|
|
3702
|
-
const FIRST$
|
|
3703
|
-
const READ_CONCURRENCY$
|
|
3704
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
3673
|
+
const RULE$66 = "dangling-link";
|
|
3674
|
+
const SEPARATOR$24 = "/";
|
|
3675
|
+
const FIRST$22 = 1;
|
|
3676
|
+
const READ_CONCURRENCY$35 = 16;
|
|
3677
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$24}`)(name);
|
|
3705
3678
|
/** @internal */
|
|
3706
3679
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
3707
3680
|
const files = yield* RepositoryFiles;
|
|
@@ -3711,19 +3684,19 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
3711
3684
|
const link = yield* files.readLink(file);
|
|
3712
3685
|
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) => ({
|
|
3713
3686
|
file,
|
|
3714
|
-
line: FIRST$
|
|
3715
|
-
column: FIRST$
|
|
3716
|
-
rule: RULE$
|
|
3687
|
+
line: FIRST$22,
|
|
3688
|
+
column: FIRST$22,
|
|
3689
|
+
rule: RULE$66,
|
|
3717
3690
|
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.`
|
|
3718
3691
|
})));
|
|
3719
3692
|
});
|
|
3720
|
-
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$
|
|
3693
|
+
const found = yield* Effect.forEach(links, problemOf, { concurrency: READ_CONCURRENCY$35 });
|
|
3721
3694
|
return Array$1.getSomes(found);
|
|
3722
3695
|
});
|
|
3723
3696
|
// src/features/check-placement/model/member-sources.ts
|
|
3724
3697
|
const ROOT_WORKSPACE$1 = ".";
|
|
3725
|
-
const FIRST$
|
|
3726
|
-
const SEPARATOR$
|
|
3698
|
+
const FIRST$21 = 1;
|
|
3699
|
+
const SEPARATOR$23 = "/";
|
|
3727
3700
|
const EXCLUDED$7 = [
|
|
3728
3701
|
":(exclude,attr:linguist-vendored)",
|
|
3729
3702
|
":(exclude,attr:linguist-generated)",
|
|
@@ -3743,12 +3716,12 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
3743
3716
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
3744
3717
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
3745
3718
|
file,
|
|
3746
|
-
line: FIRST$
|
|
3747
|
-
column: FIRST$
|
|
3719
|
+
line: FIRST$21,
|
|
3720
|
+
column: FIRST$21,
|
|
3748
3721
|
rule,
|
|
3749
3722
|
message
|
|
3750
3723
|
});
|
|
3751
|
-
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array$1.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$
|
|
3724
|
+
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array$1.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$23}`)(name)), (owners) => Array$1.last(Array$1.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
3752
3725
|
workspace,
|
|
3753
3726
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
3754
3727
|
})));
|
|
@@ -3771,9 +3744,9 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
3771
3744
|
}));
|
|
3772
3745
|
});
|
|
3773
3746
|
// src/features/check-placement/model/deployed-readme.ts
|
|
3774
|
-
const RULE$
|
|
3747
|
+
const RULE$65 = "deployed-readme";
|
|
3775
3748
|
const ROOT_DIRECTORY$4 = "";
|
|
3776
|
-
const READ_CONCURRENCY$
|
|
3749
|
+
const READ_CONCURRENCY$34 = 16;
|
|
3777
3750
|
const MISSING_MESSAGE$2 = "is missing. This workspace has an Alchemy stack that serves an address, so give it a README.md that says what it is and links its URL.";
|
|
3778
3751
|
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.";
|
|
3779
3752
|
const ADDRESS_KEYS = [
|
|
@@ -3811,14 +3784,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
3811
3784
|
const readme = yield* readReadme({
|
|
3812
3785
|
root,
|
|
3813
3786
|
directory,
|
|
3814
|
-
rule: RULE$
|
|
3787
|
+
rule: RULE$65,
|
|
3815
3788
|
missingMessage: MISSING_MESSAGE$2
|
|
3816
3789
|
});
|
|
3817
3790
|
return Result.match(readme, {
|
|
3818
3791
|
onFailure: Option.some,
|
|
3819
3792
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
3820
3793
|
file,
|
|
3821
|
-
rule: RULE$
|
|
3794
|
+
rule: RULE$65,
|
|
3822
3795
|
message: NO_URL_MESSAGE
|
|
3823
3796
|
})))
|
|
3824
3797
|
});
|
|
@@ -3829,16 +3802,16 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
3829
3802
|
const listed = yield* files.listedFiles(root);
|
|
3830
3803
|
const directories = yield* workspaceDirectories(root);
|
|
3831
3804
|
const candidates = pipe(listed, Array$1.filter((file) => STACK_FILE.test(file)));
|
|
3832
|
-
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$
|
|
3805
|
+
const deploying = yield* Effect.filter(candidates, (file) => deploysTo(root, file), { concurrency: READ_CONCURRENCY$34 });
|
|
3833
3806
|
const owners = pipe(deploying, Array$1.map((file) => pipe(owningWorkspace(directories)(files.dirname(file)), Option.getOrElse(() => ROOT_DIRECTORY$4))), Array$1.dedupe);
|
|
3834
|
-
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$
|
|
3807
|
+
const found = yield* Effect.forEach(owners, (directory) => problemIn$7(root, directory), { concurrency: READ_CONCURRENCY$34 });
|
|
3835
3808
|
return Array$1.getSomes(found);
|
|
3836
3809
|
});
|
|
3837
3810
|
// src/features/check-placement/model/nested-docs.ts
|
|
3838
|
-
const RULE$
|
|
3811
|
+
const RULE$64 = "nested-docs";
|
|
3839
3812
|
const CONFIG_FILE$9 = "vite.config.ts";
|
|
3840
|
-
const SEPARATOR$
|
|
3841
|
-
const READ_CONCURRENCY$
|
|
3813
|
+
const SEPARATOR$22 = "/";
|
|
3814
|
+
const READ_CONCURRENCY$33 = 64;
|
|
3842
3815
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
3843
3816
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
3844
3817
|
const README = /^README(?:\.[^/]+)?$/iu;
|
|
@@ -3847,8 +3820,8 @@ const MISSING_RULE = "workspace-agents-md";
|
|
|
3847
3820
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
3848
3821
|
const taggedError$13 = Schema.TaggedError;
|
|
3849
3822
|
var RootConfigUnreadable = class extends taggedError$13()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
3850
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
3851
|
-
const problemFor$8 = problemInFile(RULE$
|
|
3823
|
+
const isNested = (name) => String$1.includes(SEPARATOR$22)(name);
|
|
3824
|
+
const problemFor$8 = problemInFile(RULE$64);
|
|
3852
3825
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
3853
3826
|
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.";
|
|
3854
3827
|
const MISSING_MESSAGE$1 = "has no AGENTS.md next to it. This repository sets msch.workspaceAgentsMd, so every workspace describes what it is for and the rules that apply only there in its own AGENTS.md.";
|
|
@@ -3895,7 +3868,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
3895
3868
|
workspaces: pipe(directories, Array$1.map((directory) => files.join(root, directory)), HashSet.fromIterable),
|
|
3896
3869
|
workspaceAgentDocs
|
|
3897
3870
|
};
|
|
3898
|
-
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$
|
|
3871
|
+
const found = yield* Effect.forEach(nested, (name) => problemIn$6(root, allowed, name), { concurrency: READ_CONCURRENCY$33 });
|
|
3899
3872
|
const missing = missingProblems({
|
|
3900
3873
|
required: workspaceAgentDocs,
|
|
3901
3874
|
directories: pipe(directories, Array$1.map((directory) => files.join(root, directory))),
|
|
@@ -3905,15 +3878,15 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
3905
3878
|
return [...Array$1.getSomes(found), ...missing];
|
|
3906
3879
|
});
|
|
3907
3880
|
// src/features/check-placement/model/published-readme.ts
|
|
3908
|
-
const RULE$
|
|
3909
|
-
const READ_CONCURRENCY$
|
|
3910
|
-
const MESSAGE$
|
|
3881
|
+
const RULE$63 = "published-readme";
|
|
3882
|
+
const READ_CONCURRENCY$32 = 16;
|
|
3883
|
+
const MESSAGE$13 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
3911
3884
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
3912
3885
|
const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory }) {
|
|
3913
3886
|
const readme = yield* readReadme({
|
|
3914
3887
|
root,
|
|
3915
3888
|
directory,
|
|
3916
|
-
rule: RULE$
|
|
3889
|
+
rule: RULE$63,
|
|
3917
3890
|
missingMessage: MISSING_MESSAGE
|
|
3918
3891
|
});
|
|
3919
3892
|
return Result.match(readme, {
|
|
@@ -3924,8 +3897,8 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
3924
3897
|
file,
|
|
3925
3898
|
line,
|
|
3926
3899
|
column,
|
|
3927
|
-
rule: RULE$
|
|
3928
|
-
message: MESSAGE$
|
|
3900
|
+
rule: RULE$63,
|
|
3901
|
+
message: MESSAGE$13
|
|
3929
3902
|
};
|
|
3930
3903
|
}))
|
|
3931
3904
|
});
|
|
@@ -3933,14 +3906,14 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, { directory
|
|
|
3933
3906
|
/** @internal */
|
|
3934
3907
|
const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPublishedReadme(root) {
|
|
3935
3908
|
const projects = yield* publishedProjects(root);
|
|
3936
|
-
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$
|
|
3909
|
+
const found = yield* Effect.forEach(projects, (project) => problemIn$5(root, project), { concurrency: READ_CONCURRENCY$32 });
|
|
3937
3910
|
return Array$1.getSomes(found);
|
|
3938
3911
|
});
|
|
3939
3912
|
// src/features/check-placement/model/published-tests.ts
|
|
3940
|
-
const RULE$
|
|
3913
|
+
const RULE$62 = "published-tests";
|
|
3941
3914
|
const FILE_START = 1;
|
|
3942
3915
|
const TEST_FILE$3 = /\.test\.[cm]?[jt]sx?$/u;
|
|
3943
|
-
const MESSAGE$
|
|
3916
|
+
const MESSAGE$12 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
3944
3917
|
const testedIn = (listed) => (prefix) => pipe(listed, Array$1.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$3.test(file)));
|
|
3945
3918
|
const problemFor$7 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
3946
3919
|
const files = yield* RepositoryFiles;
|
|
@@ -3951,8 +3924,8 @@ const problemFor$7 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
3951
3924
|
file: files.join(absolute, PACKAGE_JSON_FILE),
|
|
3952
3925
|
line: FILE_START,
|
|
3953
3926
|
column: FILE_START,
|
|
3954
|
-
rule: RULE$
|
|
3955
|
-
message: MESSAGE$
|
|
3927
|
+
rule: RULE$62,
|
|
3928
|
+
message: MESSAGE$12
|
|
3956
3929
|
});
|
|
3957
3930
|
});
|
|
3958
3931
|
/** @internal */
|
|
@@ -3965,30 +3938,30 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
3965
3938
|
return Array$1.getSomes(found);
|
|
3966
3939
|
});
|
|
3967
3940
|
// src/features/check-placement/model/root-docs.ts
|
|
3968
|
-
const RULE$
|
|
3969
|
-
const SEPARATOR$
|
|
3970
|
-
const FIRST$
|
|
3941
|
+
const RULE$61 = "root-docs";
|
|
3942
|
+
const SEPARATOR$21 = "/";
|
|
3943
|
+
const FIRST$20 = 1;
|
|
3971
3944
|
const MARKDOWN$6 = /\.(?:md|mdx|markdown)$/iu;
|
|
3972
3945
|
const ALLOWED$1 = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
3973
|
-
const MESSAGE$
|
|
3974
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
3946
|
+
const MESSAGE$11 = "is a hand-written document outside the places documents belong. Hand-written text goes only in the root README.md, AGENTS.md, CLAUDE.md, ARCHITECTURE.md and DESIGN.md, and under docs/. Move what is still true and not already told by the code into one of them, and delete this file.";
|
|
3947
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$21)(name) && MARKDOWN$6.test(name) && !ALLOWED$1.test(name);
|
|
3975
3948
|
/** @internal */
|
|
3976
3949
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
3977
3950
|
const files = yield* RepositoryFiles;
|
|
3978
3951
|
const names = yield* files.listedFiles(root);
|
|
3979
3952
|
return pipe(names, Array$1.filter(isStrayRootDoc), Array$1.map((name) => ({
|
|
3980
3953
|
file: files.join(root, name),
|
|
3981
|
-
line: FIRST$
|
|
3982
|
-
column: FIRST$
|
|
3983
|
-
rule: RULE$
|
|
3984
|
-
message: `${name} ${MESSAGE$
|
|
3954
|
+
line: FIRST$20,
|
|
3955
|
+
column: FIRST$20,
|
|
3956
|
+
rule: RULE$61,
|
|
3957
|
+
message: `${name} ${MESSAGE$11}`
|
|
3985
3958
|
})));
|
|
3986
3959
|
});
|
|
3987
3960
|
// src/features/check-placement/model/root-readme.ts
|
|
3988
|
-
const RULE$
|
|
3961
|
+
const RULE$60 = "root-readme";
|
|
3989
3962
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
3990
|
-
const READ_CONCURRENCY$
|
|
3991
|
-
const START$
|
|
3963
|
+
const READ_CONCURRENCY$31 = 16;
|
|
3964
|
+
const START$31 = 0;
|
|
3992
3965
|
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
3993
3966
|
const RELATIVE$2 = /^\.\//u;
|
|
3994
3967
|
const MarketplacePlugin = Schema.Struct({
|
|
@@ -4024,17 +3997,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
4024
3997
|
onNone: () => ownNames(plugins, names),
|
|
4025
3998
|
onSome: () => [directory]
|
|
4026
3999
|
}));
|
|
4027
|
-
const problemsIn$
|
|
4000
|
+
const problemsIn$20 = (file, source, plugins) => (workspace) => {
|
|
4028
4001
|
const message = messageFor$4(workspace.directory);
|
|
4029
4002
|
const at = positionOf(source);
|
|
4030
4003
|
const pattern = patternFor(plugins)(workspace);
|
|
4031
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$
|
|
4004
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$60)(file, at(found.index ?? START$31), message)));
|
|
4032
4005
|
};
|
|
4033
4006
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
4034
4007
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
4035
4008
|
return pipe(text, Option.match({
|
|
4036
4009
|
onNone: () => [],
|
|
4037
|
-
onSome: (source) => pipe(workspaces, Array$1.flatMap(problemsIn$
|
|
4010
|
+
onSome: (source) => pipe(workspaces, Array$1.flatMap(problemsIn$20(file, source, plugins)))
|
|
4038
4011
|
}));
|
|
4039
4012
|
});
|
|
4040
4013
|
/** @internal */
|
|
@@ -4045,7 +4018,7 @@ const checkRootReadme = Effect.fn("checkRootReadme")(function* checkRootReadme(r
|
|
|
4045
4018
|
const named = yield* namedWorkspaces(root);
|
|
4046
4019
|
const workspaces = pipe(named, Array$1.filter((workspace) => !isCheckPolicy(workspace)));
|
|
4047
4020
|
const plugins = yield* marketplacePlugins(root);
|
|
4048
|
-
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$
|
|
4021
|
+
const found = yield* Effect.forEach(readmes, (name) => problemsInReadme(files.join(root, name), workspaces, plugins), { concurrency: READ_CONCURRENCY$31 });
|
|
4049
4022
|
return Array$1.flatten(found);
|
|
4050
4023
|
});
|
|
4051
4024
|
// src/features/check-placement/model/doc-placement.ts
|
|
@@ -4065,10 +4038,10 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
4065
4038
|
return Array$1.flatten(found);
|
|
4066
4039
|
});
|
|
4067
4040
|
// src/features/check-placement/model/docs-mirror.ts
|
|
4068
|
-
const RULE$
|
|
4041
|
+
const RULE$59 = "docs-mirror";
|
|
4069
4042
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
4070
4043
|
const MIRROR_LIMIT = 3;
|
|
4071
|
-
const READ_CONCURRENCY$
|
|
4044
|
+
const READ_CONCURRENCY$30 = 16;
|
|
4072
4045
|
const SPECIAL = /[$()*+.?[\\\]^{|}]/gu;
|
|
4073
4046
|
const BEFORE = String.raw`(?<![\w@/.-])`;
|
|
4074
4047
|
const AFTER = String.raw`(?![\w@.-])`;
|
|
@@ -4090,7 +4063,7 @@ const problemFor$6 = (file, source, mentions) => pipe(Array$1.head(mentions), Op
|
|
|
4090
4063
|
file,
|
|
4091
4064
|
line,
|
|
4092
4065
|
column,
|
|
4093
|
-
rule: RULE$
|
|
4066
|
+
rule: RULE$59,
|
|
4094
4067
|
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.`
|
|
4095
4068
|
};
|
|
4096
4069
|
}), Option.toArray);
|
|
@@ -4105,7 +4078,7 @@ const workspacesOf$1 = Effect.fn("workspacesOf")(function* workspacesOf(root) {
|
|
|
4105
4078
|
return yield* Effect.forEach(directories, (directory) => readManifest(files.join(root, directory)).pipe(Effect.map((manifest) => ({
|
|
4106
4079
|
directory,
|
|
4107
4080
|
names: [directory, ...pipe(manifest, Option.flatMap(({ name }) => Option.fromUndefinedOr(name)), Option.toArray)]
|
|
4108
|
-
}))), { concurrency: READ_CONCURRENCY$
|
|
4081
|
+
}))), { concurrency: READ_CONCURRENCY$30 });
|
|
4109
4082
|
});
|
|
4110
4083
|
/** @internal */
|
|
4111
4084
|
const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(root) {
|
|
@@ -4118,24 +4091,24 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
4118
4091
|
onNone: () => [],
|
|
4119
4092
|
onSome: (text) => problemIn$4(workspaces)(doc, file, text)
|
|
4120
4093
|
})));
|
|
4121
|
-
}, { concurrency: READ_CONCURRENCY$
|
|
4094
|
+
}, { concurrency: READ_CONCURRENCY$30 });
|
|
4122
4095
|
return Array$1.flatten(found);
|
|
4123
4096
|
});
|
|
4124
4097
|
// src/features/check-placement/model/ignored-sources.ts
|
|
4125
|
-
const RULE$
|
|
4098
|
+
const RULE$58 = "ignored-sources";
|
|
4126
4099
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
4127
|
-
const FIRST$
|
|
4128
|
-
const MESSAGE$
|
|
4100
|
+
const FIRST$19 = 1;
|
|
4101
|
+
const MESSAGE$10 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
4129
4102
|
/** @internal */
|
|
4130
4103
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
4131
4104
|
const files = yield* RepositoryFiles;
|
|
4132
4105
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
4133
4106
|
return pipe(ignored, Array$1.map((file) => ({
|
|
4134
4107
|
file: files.join(root, file),
|
|
4135
|
-
line: FIRST$
|
|
4136
|
-
column: FIRST$
|
|
4137
|
-
rule: RULE$
|
|
4138
|
-
message: MESSAGE$
|
|
4108
|
+
line: FIRST$19,
|
|
4109
|
+
column: FIRST$19,
|
|
4110
|
+
rule: RULE$58,
|
|
4111
|
+
message: MESSAGE$10
|
|
4139
4112
|
})));
|
|
4140
4113
|
});
|
|
4141
4114
|
// src/features/check-placement/model/public-entries.ts
|
|
@@ -12715,7 +12688,7 @@ var english_verbs_default = [
|
|
|
12715
12688
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
12716
12689
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
12717
12690
|
const SEGMENT_RULE = "slice-segment-name";
|
|
12718
|
-
const SEPARATOR$
|
|
12691
|
+
const SEPARATOR$19 = "/";
|
|
12719
12692
|
const NEXT$3 = 1;
|
|
12720
12693
|
const WORD_SEPARATOR$1 = "-";
|
|
12721
12694
|
const MINIMUM_WORDS = 2;
|
|
@@ -12731,7 +12704,7 @@ const SEGMENTS = /* @__PURE__ */ new Set([
|
|
|
12731
12704
|
]);
|
|
12732
12705
|
const DEPLOY_MARKER = /(?:^|[.-])entrypoints?(?=[.-]|$)|\.worker(?=\.)/iu;
|
|
12733
12706
|
const INDEX = /\/index(?:\.[a-z]+)*\.[cm]?[jt]sx?$/u;
|
|
12734
|
-
const SCRIPT
|
|
12707
|
+
const SCRIPT = /\.[cm]?[jt]sx?$/u;
|
|
12735
12708
|
const VERBS = new Set(english_verbs_default);
|
|
12736
12709
|
const SLICE_MESSAGE$1 = "is not named <verb>-<object>. Name a feature slice after the one operation it performs, starting with an English verb (for example check-layout, sync-manuscripts).";
|
|
12737
12710
|
const SEGMENT_MESSAGE = "is a folder in a slice that is not one of the segments ui, model, api, lib or config. Name the segment after its purpose and put the code in one of them; a segment that grows holds folders of its own.";
|
|
@@ -12741,7 +12714,7 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
12741
12714
|
return words.length >= MINIMUM_WORDS && Option.exists(Array$1.head(words), (word) => VERBS.has(word));
|
|
12742
12715
|
};
|
|
12743
12716
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
12744
|
-
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT
|
|
12717
|
+
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT.test(path)), Option.flatMap((path) => Array$1.head(String$1.split(String$1.slice(13)(path), SEPARATOR$19))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$19}${FEATURES$1}${slice}`));
|
|
12745
12718
|
const SLICE_LAYERS = [
|
|
12746
12719
|
"features",
|
|
12747
12720
|
"entities",
|
|
@@ -12749,26 +12722,26 @@ const SLICE_LAYERS = [
|
|
|
12749
12722
|
"pages"
|
|
12750
12723
|
];
|
|
12751
12724
|
const SLICE_DEPTHS = [3, 4];
|
|
12752
|
-
const pathPrefix = (parts, depth) => Array$1.join(Array$1.take(parts, depth), SEPARATOR$
|
|
12725
|
+
const pathPrefix = (parts, depth) => Array$1.join(Array$1.take(parts, depth), SEPARATOR$19);
|
|
12753
12726
|
const isInSliceLayer = (parts) => {
|
|
12754
12727
|
const [source, layer] = parts;
|
|
12755
|
-
return `${source}${SEPARATOR$
|
|
12728
|
+
return `${source}${SEPARATOR$19}` === SOURCE$2 && Array$1.contains(SLICE_LAYERS, layer ?? "");
|
|
12756
12729
|
};
|
|
12757
12730
|
const indexedSlice = (owned) => {
|
|
12758
|
-
const parts = String$1.split(owned.inner, SEPARATOR$
|
|
12731
|
+
const parts = String$1.split(owned.inner, SEPARATOR$19);
|
|
12759
12732
|
const depth = parts.length - NEXT$3;
|
|
12760
|
-
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array$1.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$
|
|
12733
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array$1.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$19}${pathPrefix(parts, depth)}`));
|
|
12761
12734
|
};
|
|
12762
12735
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
12763
|
-
const parts = String$1.split(inner, SEPARATOR$
|
|
12764
|
-
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$
|
|
12765
|
-
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT
|
|
12766
|
-
return pipe(SLICE_DEPTHS, Array$1.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$
|
|
12736
|
+
const parts = String$1.split(inner, SEPARATOR$19);
|
|
12737
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$19}${pathPrefix(parts, depth)}`);
|
|
12738
|
+
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
12739
|
+
return pipe(SLICE_DEPTHS, Array$1.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$19}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
12767
12740
|
};
|
|
12768
12741
|
const deployNamed = ({ workspace, inner }) => {
|
|
12769
12742
|
if (!String$1.startsWith(SOURCE$2)(inner)) return Option.none();
|
|
12770
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
12771
|
-
return pipe(Array$1.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$
|
|
12743
|
+
const segments = String$1.split(inner, SEPARATOR$19);
|
|
12744
|
+
return pipe(Array$1.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$19}${Array$1.join(Array$1.take(segments, index + NEXT$3), SEPARATOR$19)}`));
|
|
12772
12745
|
};
|
|
12773
12746
|
/** @internal */
|
|
12774
12747
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -12811,7 +12784,7 @@ const LAYER_ITEMS = [
|
|
|
12811
12784
|
"attribute_item",
|
|
12812
12785
|
"inner_attribute_item"
|
|
12813
12786
|
];
|
|
12814
|
-
const READ_CONCURRENCY$
|
|
12787
|
+
const READ_CONCURRENCY$29 = 64;
|
|
12815
12788
|
const EXCLUDED$6 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12816
12789
|
const NONE$4 = [];
|
|
12817
12790
|
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.";
|
|
@@ -12887,17 +12860,17 @@ const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModule
|
|
|
12887
12860
|
if (!Array$1.isReadonlyArrayNonEmpty(sources)) return NONE$4;
|
|
12888
12861
|
const language = yield* loadLanguage(GRAMMAR$1).pipe(Effect.orDie);
|
|
12889
12862
|
const parse = parsedWith(language);
|
|
12890
|
-
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$
|
|
12863
|
+
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$29 });
|
|
12891
12864
|
return [...sliceNameProblems(root, files.join, sources), ...Array$1.flatMap(Array$1.getSomes(read), problemsOf$4)];
|
|
12892
12865
|
});
|
|
12893
12866
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
12894
|
-
const RULE$
|
|
12895
|
-
const FIRST$
|
|
12896
|
-
const problemOf$
|
|
12867
|
+
const RULE$57 = "shadcn-ui-alias";
|
|
12868
|
+
const FIRST$18 = 1;
|
|
12869
|
+
const problemOf$12 = (directory, { file, alias }) => ({
|
|
12897
12870
|
file,
|
|
12898
|
-
line: FIRST$
|
|
12899
|
-
column: FIRST$
|
|
12900
|
-
rule: RULE$
|
|
12871
|
+
line: FIRST$18,
|
|
12872
|
+
column: FIRST$18,
|
|
12873
|
+
rule: RULE$57,
|
|
12901
12874
|
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/*".`
|
|
12902
12875
|
});
|
|
12903
12876
|
/** @internal */
|
|
@@ -12909,7 +12882,7 @@ const shadcnAliasProblems = Effect.fn("shadcnAliasProblems")(function* shadcnAli
|
|
|
12909
12882
|
onNone: () => Effect.succeed(false),
|
|
12910
12883
|
onSome: (target) => files.isDirectory(files.join(root, directory, target)).pipe(Effect.map(Option.getOrElse(() => false)))
|
|
12911
12884
|
})) return Array$1.empty();
|
|
12912
|
-
return [problemOf$
|
|
12885
|
+
return [problemOf$12(directory, found.value)];
|
|
12913
12886
|
});
|
|
12914
12887
|
// src/features/check-placement/model/source-aliases.ts
|
|
12915
12888
|
const ALIAS_RULE = "source-alias";
|
|
@@ -12958,11 +12931,11 @@ const SCRIPTS = "scripts-directory";
|
|
|
12958
12931
|
const CODE_IN_BIN = "code-in-bin";
|
|
12959
12932
|
const BIN = "bin";
|
|
12960
12933
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
12961
|
-
const WORKFLOW_DIRECTORY
|
|
12962
|
-
const SEPARATOR$
|
|
12934
|
+
const WORKFLOW_DIRECTORY = ".github/";
|
|
12935
|
+
const SEPARATOR$18 = "/";
|
|
12963
12936
|
const CURRENT = "./";
|
|
12964
|
-
const READ_CONCURRENCY$
|
|
12965
|
-
const FIRST$
|
|
12937
|
+
const READ_CONCURRENCY$28 = 8;
|
|
12938
|
+
const FIRST$17 = 1;
|
|
12966
12939
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
12967
12940
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
12968
12941
|
const COMMAND_FILE$1 = /^bin\/[^/]+$/u;
|
|
@@ -12977,7 +12950,7 @@ const runsIn = ({ text, start }) => pipe(Array$1.fromIterable(String$1.matchAll(
|
|
|
12977
12950
|
start
|
|
12978
12951
|
})), Option.toArray)));
|
|
12979
12952
|
const targetPaths = (held) => pipe(targetsIn(held), Array$1.map(withoutCurrent));
|
|
12980
|
-
const entriesOf
|
|
12953
|
+
const entriesOf = (manifest) => {
|
|
12981
12954
|
const bins = targetPaths(manifest.bin);
|
|
12982
12955
|
return {
|
|
12983
12956
|
all: [
|
|
@@ -12991,22 +12964,22 @@ const entriesOf$1 = (manifest) => {
|
|
|
12991
12964
|
const declaredEntries = Effect.fn("declaredEntries")(function* declaredEntries(root, directory) {
|
|
12992
12965
|
const files = yield* RepositoryFiles;
|
|
12993
12966
|
const manifest = yield* readManifest(files.join(root, directory));
|
|
12994
|
-
return pipe(manifest, Option.map(entriesOf
|
|
12967
|
+
return pipe(manifest, Option.map(entriesOf), Option.getOrElse(() => NO_ENTRIES));
|
|
12995
12968
|
});
|
|
12996
|
-
const isCommand
|
|
12969
|
+
const isCommand = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
12997
12970
|
const commandFilesIn$1 = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
12998
12971
|
const files = yield* RepositoryFiles;
|
|
12999
12972
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
13000
|
-
return pipe(names, Array$1.map((name) => `${BIN}${SEPARATOR$
|
|
12973
|
+
return pipe(names, Array$1.map((name) => `${BIN}${SEPARATOR$18}${name}`), Array$1.filter(isCommand));
|
|
13001
12974
|
});
|
|
13002
12975
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
13003
12976
|
const files = yield* RepositoryFiles;
|
|
13004
12977
|
const listed = yield* files.listedFiles(root);
|
|
13005
|
-
const workflows = pipe(listed, Array$1.filter(String$1.startsWith(WORKFLOW_DIRECTORY
|
|
13006
|
-
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$
|
|
12978
|
+
const workflows = pipe(listed, Array$1.filter(String$1.startsWith(WORKFLOW_DIRECTORY)));
|
|
12979
|
+
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$28 });
|
|
13007
12980
|
return pipe(Array$1.getSomes(texts), Array$1.join("\n"));
|
|
13008
12981
|
});
|
|
13009
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$
|
|
12982
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$18));
|
|
13010
12983
|
const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array$1.filter(({ path }) => !COMMAND$1.test(path) && !Array$1.contains(entries.all, path)), Array$1.map(({ path, start }) => ({
|
|
13011
12984
|
file,
|
|
13012
12985
|
...positionOf(source)(start),
|
|
@@ -13014,7 +12987,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array$1.
|
|
|
13014
12987
|
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.`
|
|
13015
12988
|
})));
|
|
13016
12989
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array$1.flatMap(stringsIn), Array$1.flatMap(runsIn));
|
|
13017
|
-
const problemsIn$
|
|
12990
|
+
const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
13018
12991
|
const files = yield* RepositoryFiles;
|
|
13019
12992
|
const config = yield* workspaceConfigOf(root, directory);
|
|
13020
12993
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -13030,8 +13003,8 @@ const problemsIn$21 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
13030
13003
|
const isRun = (path) => Array$1.contains(runPaths, path) || Array$1.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
13031
13004
|
const unrun = pipe(commands, Array$1.filter((path) => !isRun(path)), Array$1.map((path) => ({
|
|
13032
13005
|
file: files.join(root, directory, path),
|
|
13033
|
-
line: FIRST$
|
|
13034
|
-
column: FIRST$
|
|
13006
|
+
line: FIRST$17,
|
|
13007
|
+
column: FIRST$17,
|
|
13035
13008
|
rule: UNRUN,
|
|
13036
13009
|
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.`
|
|
13037
13010
|
})));
|
|
@@ -13043,21 +13016,21 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
13043
13016
|
const isDirectory = yield* files.isDirectory(file);
|
|
13044
13017
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
13045
13018
|
file,
|
|
13046
|
-
line: FIRST$
|
|
13047
|
-
column: FIRST$
|
|
13019
|
+
line: FIRST$17,
|
|
13020
|
+
column: FIRST$17,
|
|
13048
13021
|
rule: SCRIPTS,
|
|
13049
13022
|
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.`
|
|
13050
13023
|
})));
|
|
13051
13024
|
});
|
|
13052
|
-
const isCommandFile = (path) => isCommand
|
|
13025
|
+
const isCommandFile = (path) => isCommand(path) || COMMAND_FILE$1.test(path) && NOT_COMMAND.test(path);
|
|
13053
13026
|
const codeInBinProblems = Effect.fn("codeInBinProblems")(function* codeInBinProblems(root, directory) {
|
|
13054
13027
|
const files = yield* RepositoryFiles;
|
|
13055
13028
|
const listed = yield* files.listedFiles(root);
|
|
13056
|
-
const prefix = workspacePath(directory, `${BIN}${SEPARATOR$
|
|
13057
|
-
return pipe(listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.filter((file) => !isCommandFile(`${BIN}${SEPARATOR$
|
|
13029
|
+
const prefix = workspacePath(directory, `${BIN}${SEPARATOR$18}`);
|
|
13030
|
+
return pipe(listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.filter((file) => !isCommandFile(`${BIN}${SEPARATOR$18}${String$1.slice(prefix.length)(file)}`)), Array$1.map((file) => ({
|
|
13058
13031
|
file: files.join(root, file),
|
|
13059
|
-
line: FIRST$
|
|
13060
|
-
column: FIRST$
|
|
13032
|
+
line: FIRST$17,
|
|
13033
|
+
column: FIRST$17,
|
|
13061
13034
|
rule: CODE_IN_BIN,
|
|
13062
13035
|
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.`
|
|
13063
13036
|
})));
|
|
@@ -13066,9 +13039,9 @@ const codeInBinProblems = Effect.fn("codeInBinProblems")(function* codeInBinProb
|
|
|
13066
13039
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
13067
13040
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
13068
13041
|
const workflows = yield* workflowText(root);
|
|
13069
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
13070
|
-
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13071
|
-
const code = yield* Effect.forEach(all, (directory) => codeInBinProblems(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13042
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$19(root, directory, workflows), { concurrency: READ_CONCURRENCY$28 });
|
|
13043
|
+
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$28 });
|
|
13044
|
+
const code = yield* Effect.forEach(all, (directory) => codeInBinProblems(root, directory), { concurrency: READ_CONCURRENCY$28 });
|
|
13072
13045
|
return [
|
|
13073
13046
|
...Array$1.flatten(found),
|
|
13074
13047
|
...Array$1.getSomes(scripts),
|
|
@@ -13076,14 +13049,14 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
13076
13049
|
];
|
|
13077
13050
|
});
|
|
13078
13051
|
// src/features/check-repository-layout/model/path-mention.ts
|
|
13079
|
-
const START$
|
|
13052
|
+
const START$30 = 0;
|
|
13080
13053
|
const QUOTES$1 = ["\"", "'"];
|
|
13081
13054
|
const firstIndex = (source, needles) => {
|
|
13082
13055
|
const found = pipe(needles, Array$1.flatMap((needle) => Option.toArray(String$1.indexOf(needle)(source))));
|
|
13083
13056
|
return Array$1.head(Array$1.sort(found, Order.Number));
|
|
13084
13057
|
};
|
|
13085
13058
|
const quoted = (text) => pipe(QUOTES$1, Array$1.map((quote) => `${quote}${text}${quote}`));
|
|
13086
|
-
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$
|
|
13059
|
+
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$30));
|
|
13087
13060
|
// src/features/check-repository-layout/model/cargo-paths.ts
|
|
13088
13061
|
const MEMBER_LISTS = [
|
|
13089
13062
|
"members",
|
|
@@ -13099,17 +13072,17 @@ const WORKSPACE = "workspace";
|
|
|
13099
13072
|
const PATCH = "patch";
|
|
13100
13073
|
const PATCH_DEPTH = 2;
|
|
13101
13074
|
const WORKSPACE_DEPTH = 1;
|
|
13102
|
-
const START$
|
|
13103
|
-
const WILDCARD$
|
|
13075
|
+
const START$29 = 0;
|
|
13076
|
+
const WILDCARD$4 = /[*?[]/u;
|
|
13104
13077
|
const KEY_SEPARATOR$1 = ".";
|
|
13105
13078
|
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
13106
13079
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
13107
13080
|
const decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));
|
|
13108
|
-
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$
|
|
13109
|
-
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$
|
|
13081
|
+
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$29).pipe(Option.exists((name) => name === PATCH));
|
|
13082
|
+
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$29).pipe(Option.exists((name) => name === WORKSPACE)) && Array$1.contains(MEMBER_LISTS, key);
|
|
13110
13083
|
const namedPaths = (trail, key, value) => {
|
|
13111
13084
|
const field = Array$1.join([...trail, key], KEY_SEPARATOR$1);
|
|
13112
|
-
if (listsMembers(trail, key)) return pipe(decodeStrings(value), Option.getOrElse(() => []), Array$1.filter((member) => !WILDCARD$
|
|
13085
|
+
if (listsMembers(trail, key)) return pipe(decodeStrings(value), Option.getOrElse(() => []), Array$1.filter((member) => !WILDCARD$4.test(member)), Array$1.map((member) => ({
|
|
13113
13086
|
field,
|
|
13114
13087
|
target: member
|
|
13115
13088
|
})));
|
|
@@ -13127,38 +13100,10 @@ const cargoMentions = (source) => pipe(Option.liftThrowable(() => getStaticTOMLV
|
|
|
13127
13100
|
candidates: [target],
|
|
13128
13101
|
index: indexOfText(source)(target)
|
|
13129
13102
|
})));
|
|
13130
|
-
// src/features/check-repository-layout/model/path-existence.ts
|
|
13131
|
-
const WILDCARD$4 = /[*?[]/u;
|
|
13132
|
-
const SEPARATOR$21 = "/";
|
|
13133
|
-
const FIRST$17 = 0;
|
|
13134
|
-
/** @internal */
|
|
13135
|
-
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
13136
|
-
const files = yield* RepositoryFiles;
|
|
13137
|
-
return yield* files.exists(files.join(root, path));
|
|
13138
|
-
});
|
|
13139
|
-
/** @internal */
|
|
13140
|
-
const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, path) {
|
|
13141
|
-
const files = yield* RepositoryFiles;
|
|
13142
|
-
const directory = yield* files.isDirectory(files.join(root, path));
|
|
13143
|
-
return Option.getOrElse(directory, () => false);
|
|
13144
|
-
});
|
|
13145
|
-
/** @internal */
|
|
13146
|
-
const staticPrefix = (path) => {
|
|
13147
|
-
const prefix = Array$1.headNonEmpty(String$1.split(path, WILDCARD$4));
|
|
13148
|
-
if (String$1.endsWith(SEPARATOR$21)(prefix)) return String$1.slice(FIRST$17, -1)(prefix);
|
|
13149
|
-
return prefix;
|
|
13150
|
-
};
|
|
13151
|
-
/** @internal */
|
|
13152
|
-
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
13153
|
-
const prefix = staticPrefix(path);
|
|
13154
|
-
if (String$1.isEmpty(prefix)) return false;
|
|
13155
|
-
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR$21}`]);
|
|
13156
|
-
return Array$1.isReadonlyArrayNonEmpty(ignored);
|
|
13157
|
-
});
|
|
13158
13103
|
// src/features/check-repository-layout/model/tsconfig-paths.ts
|
|
13159
13104
|
const WRAP_OFFSET$2 = 1;
|
|
13160
13105
|
const WILDCARD$3 = /[*?[{]/u;
|
|
13161
|
-
const SEPARATOR$
|
|
13106
|
+
const SEPARATOR$17 = "/";
|
|
13162
13107
|
const RELATIVE$1 = ".";
|
|
13163
13108
|
const JSON_EXTENSION = ".json";
|
|
13164
13109
|
const isObject = (node) => Predicate.isReadonlyObject(node) && node["type"] === "ObjectExpression";
|
|
@@ -13166,7 +13111,7 @@ const firstObject = (node) => {
|
|
|
13166
13111
|
if (isObject(node)) return Option.some(node);
|
|
13167
13112
|
return pipe(childrenOf$4(node), Array$1.findFirst(firstObject));
|
|
13168
13113
|
};
|
|
13169
|
-
const leadingDirectory = (pattern) => pipe(String$1.split(pattern, SEPARATOR$
|
|
13114
|
+
const leadingDirectory = (pattern) => pipe(String$1.split(pattern, SEPARATOR$17), Array$1.takeWhile((segment) => !WILDCARD$3.test(segment)), Array$1.join(SEPARATOR$17));
|
|
13170
13115
|
const listed$2 = (root) => (name, candidatesOf, valuesOf = stringsIn) => pipe(propertyValue(name)(root), Option.toArray, Array$1.flatMap(valuesOf), Array$1.map(({ text, start }) => ({
|
|
13171
13116
|
field: name,
|
|
13172
13117
|
text,
|
|
@@ -13193,40 +13138,40 @@ const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMention
|
|
|
13193
13138
|
])));
|
|
13194
13139
|
});
|
|
13195
13140
|
// src/features/check-repository-layout/model/config-paths.ts
|
|
13196
|
-
const RULE$
|
|
13141
|
+
const RULE$56 = "config-path";
|
|
13197
13142
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
13198
13143
|
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
13199
13144
|
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
13200
13145
|
const OUTSIDE = "..";
|
|
13201
|
-
const READ_CONCURRENCY$
|
|
13202
|
-
const isMissing$
|
|
13146
|
+
const READ_CONCURRENCY$27 = 8;
|
|
13147
|
+
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, file, mention) {
|
|
13203
13148
|
const files = yield* RepositoryFiles;
|
|
13204
13149
|
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)));
|
|
13205
13150
|
if (!Array$1.isReadonlyArrayNonEmpty(relatives)) return false;
|
|
13206
|
-
const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), { concurrency: READ_CONCURRENCY$
|
|
13151
|
+
const present = yield* Effect.forEach(relatives, (relative) => existsAt(root, relative), { concurrency: READ_CONCURRENCY$27 });
|
|
13207
13152
|
if (pipe(present, Array$1.some(Boolean))) return false;
|
|
13208
|
-
const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), { concurrency: READ_CONCURRENCY$
|
|
13153
|
+
const ignored = yield* Effect.forEach(relatives, (relative) => isIgnored(root, relative), { concurrency: READ_CONCURRENCY$27 });
|
|
13209
13154
|
return !pipe(ignored, Array$1.some(Boolean));
|
|
13210
13155
|
});
|
|
13211
13156
|
const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
13212
|
-
const problemOf$
|
|
13157
|
+
const problemOf$11 = (file, source) => (mention) => ({
|
|
13213
13158
|
file,
|
|
13214
13159
|
...positionOf(source)(mention.index),
|
|
13215
|
-
rule: RULE$
|
|
13160
|
+
rule: RULE$56,
|
|
13216
13161
|
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
13217
13162
|
});
|
|
13218
13163
|
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
13219
13164
|
if (CARGO_MANIFEST.test(file)) return cargoMentions(source);
|
|
13220
13165
|
return yield* tsconfigMentions(file, source);
|
|
13221
13166
|
});
|
|
13222
|
-
const problemsIn$
|
|
13167
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, name) {
|
|
13223
13168
|
const files = yield* RepositoryFiles;
|
|
13224
13169
|
const file = files.join(root, name);
|
|
13225
13170
|
const source = yield* files.readFile(file);
|
|
13226
13171
|
if (Option.isNone(source)) return [];
|
|
13227
13172
|
const mentions = yield* mentionsIn(file, source.value);
|
|
13228
|
-
const missing = yield* Effect.filter(mentions, (mention) => isMissing$
|
|
13229
|
-
return pipe(Array$1.sort(missing, byIndex), Array$1.map(problemOf$
|
|
13173
|
+
const missing = yield* Effect.filter(mentions, (mention) => isMissing$1(root, file, mention), { concurrency: READ_CONCURRENCY$27 });
|
|
13174
|
+
return pipe(Array$1.sort(missing, byIndex), Array$1.map(problemOf$11(file, source.value)));
|
|
13230
13175
|
});
|
|
13231
13176
|
const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatterns(root) {
|
|
13232
13177
|
const files = yield* RepositoryFiles;
|
|
@@ -13237,7 +13182,7 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
13237
13182
|
return pipe(patterns, Array$1.map((pattern) => ({
|
|
13238
13183
|
file,
|
|
13239
13184
|
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
13240
|
-
rule: RULE$
|
|
13185
|
+
rule: RULE$56,
|
|
13241
13186
|
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
13242
13187
|
})));
|
|
13243
13188
|
});
|
|
@@ -13245,23 +13190,23 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
13245
13190
|
const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPaths(root) {
|
|
13246
13191
|
const owned = yield* (yield* RepositoryFiles).ownedFiles(root);
|
|
13247
13192
|
const configs = pipe(owned, Array$1.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)));
|
|
13248
|
-
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$
|
|
13193
|
+
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$18(root, name), { concurrency: READ_CONCURRENCY$27 }), unmatchedPatterns(root)], { concurrency: "unbounded" });
|
|
13249
13194
|
return [...Array$1.flatten(found), ...patterns];
|
|
13250
13195
|
});
|
|
13251
13196
|
// src/features/check-repository-layout/model/crates.ts
|
|
13252
|
-
const RULE$
|
|
13197
|
+
const RULE$55 = "unverified-crate";
|
|
13253
13198
|
const VERSION_RULE = "release-version";
|
|
13254
13199
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
13255
13200
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
13256
13201
|
const CONFIG_FILE$8 = "vite.config.ts";
|
|
13257
|
-
const SEPARATOR$
|
|
13202
|
+
const SEPARATOR$16 = "/";
|
|
13258
13203
|
const FIRST$16 = 1;
|
|
13259
|
-
const READ_CONCURRENCY$
|
|
13204
|
+
const READ_CONCURRENCY$26 = 8;
|
|
13260
13205
|
const problemFor$5 = (crate, message) => ({
|
|
13261
13206
|
file: crate.manifest,
|
|
13262
13207
|
line: FIRST$16,
|
|
13263
13208
|
column: FIRST$16,
|
|
13264
|
-
rule: RULE$
|
|
13209
|
+
rule: RULE$55,
|
|
13265
13210
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
13266
13211
|
});
|
|
13267
13212
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -13274,7 +13219,7 @@ const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories
|
|
|
13274
13219
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
13275
13220
|
const files = yield* RepositoryFiles;
|
|
13276
13221
|
const directory = files.relative(root, files.dirname(crate.manifest));
|
|
13277
|
-
const workspace = pipe(directories, Array$1.findFirst((candidate) => pipe(APP_DIRECTORIES, Array$1.map((inner) => pipe([candidate, inner], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$
|
|
13222
|
+
const workspace = pipe(directories, Array$1.findFirst((candidate) => pipe(APP_DIRECTORIES, Array$1.map((inner) => pipe([candidate, inner], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$16))), Array$1.contains(directory))));
|
|
13278
13223
|
if (Option.isNone(workspace)) return Option.none();
|
|
13279
13224
|
const text = yield* files.readFile(files.join(root, workspace.value, PACKAGE_JSON_FILE));
|
|
13280
13225
|
const version = pipe(text, Option.flatMap(decodePackageJson), Option.flatMap(({ version: own }) => Option.fromUndefinedOr(own)));
|
|
@@ -13293,11 +13238,11 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
13293
13238
|
if (!(yield* files.exists(files.join(root, CARGO_FILE$1)))) return [];
|
|
13294
13239
|
const directories = yield* workspaceDirectories(root);
|
|
13295
13240
|
const crates = yield* cratesIn(root);
|
|
13296
|
-
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$
|
|
13241
|
+
const found = yield* Effect.forEach(crates, (crate) => Effect.all([problemIn$3(root, directories, crate), versionProblemIn(root, directories, crate)], { concurrency: "unbounded" }), { concurrency: READ_CONCURRENCY$26 });
|
|
13297
13242
|
return Array$1.getSomes(Array$1.flatten(found));
|
|
13298
13243
|
});
|
|
13299
13244
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
13300
|
-
const RULE$
|
|
13245
|
+
const RULE$54 = "deploy-entry-pattern";
|
|
13301
13246
|
const FALLOW_KEYS = [
|
|
13302
13247
|
"entry",
|
|
13303
13248
|
"entryPoints",
|
|
@@ -13315,8 +13260,8 @@ const NEGATED = "!";
|
|
|
13315
13260
|
const ROOT_WORKSPACE = ".";
|
|
13316
13261
|
const WRAP_OFFSET$1 = 1;
|
|
13317
13262
|
const NO_OFFSET = 0;
|
|
13318
|
-
const READ_CONCURRENCY$
|
|
13319
|
-
const MESSAGE$
|
|
13263
|
+
const READ_CONCURRENCY$25 = 8;
|
|
13264
|
+
const MESSAGE$9 = "selects deploy entries by their name or location. A deploy entry is the file that an Alchemy resource names in main, and its name and place change with the code. Use workspaceSettings().lint.deployEntries in lint settings; fallow reads main from the stack by itself.";
|
|
13320
13265
|
const decodeKey$1 = Schema.decodeUnknownOption(KeySchema);
|
|
13321
13266
|
const FALLOW = {
|
|
13322
13267
|
keys: FALLOW_KEYS,
|
|
@@ -13352,7 +13297,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
13352
13297
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
13353
13298
|
return pipe(patternsIn(kind.keys)(parsed.program), Array$1.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
13354
13299
|
});
|
|
13355
|
-
const problemsIn$
|
|
13300
|
+
const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
13356
13301
|
const { root, file, kind, workspaces, entries } = request;
|
|
13357
13302
|
const files = yield* RepositoryFiles;
|
|
13358
13303
|
const path = files.join(root, file);
|
|
@@ -13368,8 +13313,8 @@ const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
13368
13313
|
return pipe(Array$1.getSomes(flagged), Array$1.map(({ text: pattern, start }) => ({
|
|
13369
13314
|
file: path,
|
|
13370
13315
|
...positionOf(text.value)(start - kind.offset),
|
|
13371
|
-
rule: RULE$
|
|
13372
|
-
message: `${pattern} ${MESSAGE$
|
|
13316
|
+
rule: RULE$54,
|
|
13317
|
+
message: `${pattern} ${MESSAGE$9}`
|
|
13373
13318
|
})));
|
|
13374
13319
|
});
|
|
13375
13320
|
/** @internal */
|
|
@@ -13391,17 +13336,17 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
13391
13336
|
}];
|
|
13392
13337
|
return [];
|
|
13393
13338
|
}));
|
|
13394
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
13339
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$17({
|
|
13395
13340
|
root,
|
|
13396
13341
|
file,
|
|
13397
13342
|
kind,
|
|
13398
13343
|
workspaces,
|
|
13399
13344
|
entries
|
|
13400
|
-
}), { concurrency: READ_CONCURRENCY$
|
|
13345
|
+
}), { concurrency: READ_CONCURRENCY$25 });
|
|
13401
13346
|
return Array$1.flatten(found);
|
|
13402
13347
|
});
|
|
13403
13348
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
13404
|
-
const RULE$
|
|
13349
|
+
const RULE$53 = "listed-entry";
|
|
13405
13350
|
const ENTRY_KEYS = [
|
|
13406
13351
|
"entry",
|
|
13407
13352
|
"entryPoints",
|
|
@@ -13409,9 +13354,9 @@ const ENTRY_KEYS = [
|
|
|
13409
13354
|
];
|
|
13410
13355
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
13411
13356
|
const WILDCARD$2 = /[*?{[]/u;
|
|
13412
|
-
const SEPARATOR$
|
|
13357
|
+
const SEPARATOR$15 = "/";
|
|
13413
13358
|
const WRAP_OFFSET = 1;
|
|
13414
|
-
const READ_CONCURRENCY$
|
|
13359
|
+
const READ_CONCURRENCY$24 = 8;
|
|
13415
13360
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
13416
13361
|
const isEntryProperty = (node) => node["type"] === "Property" && pipe(decodeKey(node["key"]), Option.exists((key) => Array$1.contains(ENTRY_KEYS, keyName(key))));
|
|
13417
13362
|
const entryPatternsIn = (node) => {
|
|
@@ -13421,8 +13366,8 @@ const entryPatternsIn = (node) => {
|
|
|
13421
13366
|
})));
|
|
13422
13367
|
return pipe(childrenOf$4(node), Array$1.flatMap(entryPatternsIn));
|
|
13423
13368
|
};
|
|
13424
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array$1.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$
|
|
13425
|
-
const problemsIn$
|
|
13369
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array$1.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$15}`)(text))) || String$1.includes(SEPARATOR$15)(text) && !WILDCARD$2.test(text);
|
|
13370
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
13426
13371
|
const files = yield* RepositoryFiles;
|
|
13427
13372
|
const path = files.join(root, file);
|
|
13428
13373
|
const text = yield* files.readFile(path);
|
|
@@ -13431,7 +13376,7 @@ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
13431
13376
|
return pipe(entryPatternsIn(parsed.program), Array$1.filter(namesOneFile(directories)), Array$1.map(({ text: pattern, start }) => ({
|
|
13432
13377
|
file: path,
|
|
13433
13378
|
...positionOf(text.value)(start),
|
|
13434
|
-
rule: RULE$
|
|
13379
|
+
rule: RULE$53,
|
|
13435
13380
|
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.`
|
|
13436
13381
|
})));
|
|
13437
13382
|
});
|
|
@@ -13439,11 +13384,11 @@ const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
13439
13384
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
13440
13385
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13441
13386
|
const directories = yield* workspaceDirectories(root);
|
|
13442
|
-
const found = yield* Effect.forEach(pipe(listed, Array$1.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
13387
|
+
const found = yield* Effect.forEach(pipe(listed, Array$1.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$16(root, file, directories), { concurrency: READ_CONCURRENCY$24 });
|
|
13443
13388
|
return Array$1.flatten(found);
|
|
13444
13389
|
});
|
|
13445
13390
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
13446
|
-
const RULE$
|
|
13391
|
+
const RULE$52 = "root-workspace-path";
|
|
13447
13392
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
13448
13393
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
13449
13394
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
@@ -13459,10 +13404,10 @@ const mentions = (directory) => (text) => {
|
|
|
13459
13404
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
13460
13405
|
}));
|
|
13461
13406
|
};
|
|
13462
|
-
const problemsIn$
|
|
13407
|
+
const problemsIn$15 = (file, source, directories) => (found) => pipe(directories, Array$1.filter((directory) => mentions(directory)(found.text)), Array$1.map((directory) => ({
|
|
13463
13408
|
file,
|
|
13464
13409
|
...positionOf(source)(found.start),
|
|
13465
|
-
rule: RULE$
|
|
13410
|
+
rule: RULE$52,
|
|
13466
13411
|
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.`
|
|
13467
13412
|
})));
|
|
13468
13413
|
/** @internal */
|
|
@@ -13473,13 +13418,13 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
13473
13418
|
if (Option.isNone(source)) return [];
|
|
13474
13419
|
const directories = yield* workspaceDirectories(root);
|
|
13475
13420
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
13476
|
-
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$
|
|
13421
|
+
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$15(file, source.value, directories)));
|
|
13477
13422
|
});
|
|
13478
13423
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
13479
|
-
const RULE$
|
|
13424
|
+
const RULE$51 = "hidden-verify";
|
|
13480
13425
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
13481
13426
|
const FIRST$14 = 1;
|
|
13482
|
-
const READ_CONCURRENCY$
|
|
13427
|
+
const READ_CONCURRENCY$23 = 8;
|
|
13483
13428
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
13484
13429
|
const config = yield* workspaceConfigOf(root, directory);
|
|
13485
13430
|
if (Option.isNone(config)) return Option.none();
|
|
@@ -13490,19 +13435,19 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
13490
13435
|
file,
|
|
13491
13436
|
line: FIRST$14,
|
|
13492
13437
|
column: FIRST$14,
|
|
13493
|
-
rule: RULE$
|
|
13438
|
+
rule: RULE$51,
|
|
13494
13439
|
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}.`
|
|
13495
13440
|
}).pipe(Option.filter(() => verified));
|
|
13496
13441
|
});
|
|
13497
13442
|
/** @internal */
|
|
13498
13443
|
const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVerify(root) {
|
|
13499
13444
|
const directories = yield* workspaceDirectories(root);
|
|
13500
|
-
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13445
|
+
const found = yield* Effect.forEach(directories, (directory) => problemIn$2(root, directory), { concurrency: READ_CONCURRENCY$23 });
|
|
13501
13446
|
return Array$1.getSomes(found);
|
|
13502
13447
|
});
|
|
13503
13448
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
13504
|
-
const RULE$
|
|
13505
|
-
const READ_CONCURRENCY$
|
|
13449
|
+
const RULE$50 = "shared-uncached-task";
|
|
13450
|
+
const READ_CONCURRENCY$22 = 8;
|
|
13506
13451
|
const SHARED = 2;
|
|
13507
13452
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
13508
13453
|
const UncachedTask = Schema.Struct({
|
|
@@ -13544,19 +13489,19 @@ const problemsOf$3 = (definitions) => {
|
|
|
13544
13489
|
return pipe(definitions, Array$1.map(({ file, position, name, command }) => ({
|
|
13545
13490
|
file,
|
|
13546
13491
|
...position,
|
|
13547
|
-
rule: RULE$
|
|
13492
|
+
rule: RULE$50,
|
|
13548
13493
|
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.`
|
|
13549
13494
|
})));
|
|
13550
13495
|
};
|
|
13551
13496
|
/** @internal */
|
|
13552
13497
|
const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function* checkSharedUncachedTasks(root) {
|
|
13553
13498
|
const directories = yield* workspaceDirectories(root);
|
|
13554
|
-
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13499
|
+
const found = yield* Effect.forEach(directories, (directory) => definitionsIn(root, directory), { concurrency: READ_CONCURRENCY$22 });
|
|
13555
13500
|
return pipe(Array$1.flatten(found), Array$1.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array$1.flatMap(problemsOf$3));
|
|
13556
13501
|
});
|
|
13557
13502
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
13558
|
-
const RULE$
|
|
13559
|
-
const READ_CONCURRENCY$
|
|
13503
|
+
const RULE$49 = "unlocked-task";
|
|
13504
|
+
const READ_CONCURRENCY$21 = 8;
|
|
13560
13505
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
13561
13506
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
13562
13507
|
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))));
|
|
@@ -13567,13 +13512,13 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
13567
13512
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array$1.filter(tracksLockfiles), Array$1.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
13568
13513
|
file,
|
|
13569
13514
|
...positionOf(source)(task.start),
|
|
13570
|
-
rule: RULE$
|
|
13515
|
+
rule: RULE$49,
|
|
13571
13516
|
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.`
|
|
13572
13517
|
})), Option.toArray)));
|
|
13573
13518
|
/** @internal */
|
|
13574
13519
|
const checkUnlockedTasks = Effect.fn("checkUnlockedTasks")(function* checkUnlockedTasks(root) {
|
|
13575
13520
|
const directories = yield* workspaceDirectories(root);
|
|
13576
|
-
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$
|
|
13521
|
+
const found = yield* Effect.forEach(directories, (directory) => runTasksOf(root, directory), { concurrency: READ_CONCURRENCY$21 });
|
|
13577
13522
|
return pipe(Array$1.getSomes(found), Array$1.flatMap(problemsOf$2));
|
|
13578
13523
|
});
|
|
13579
13524
|
// src/features/check-repository-layout/model/task-checks.ts
|
|
@@ -13586,296 +13531,6 @@ const checkTasks = Effect.fn("checkTasks")(function* checkTasks(root) {
|
|
|
13586
13531
|
], { concurrency: "unbounded" });
|
|
13587
13532
|
return Array$1.flatten(found);
|
|
13588
13533
|
});
|
|
13589
|
-
// src/features/check-repository-layout/model/workflow-nodes.ts
|
|
13590
|
-
const MISSING_OFFSET = 0;
|
|
13591
|
-
const isRanged = (node) => isScalar(node) || isMap(node) || isSeq(node);
|
|
13592
|
-
/** @internal */
|
|
13593
|
-
const isText$1 = (node) => isScalar(node) && typeof node.value === "string";
|
|
13594
|
-
const isTextPair = (pair) => isPair(pair) && isText$1(pair.key);
|
|
13595
|
-
const offsetOf$3 = (node) => pipe(Option.liftPredicate(node, isRanged), Option.flatMap((ranged) => Option.fromNullishOr(ranged.range)), Option.map(([start]) => start), Option.getOrElse(() => MISSING_OFFSET));
|
|
13596
|
-
/** @internal */
|
|
13597
|
-
const stringOf = (node) => pipe(Option.liftPredicate(node, isText$1), Option.map((scalar) => ({
|
|
13598
|
-
text: scalar.value,
|
|
13599
|
-
offset: offsetOf$3(scalar)
|
|
13600
|
-
})));
|
|
13601
|
-
/** @internal */
|
|
13602
|
-
const childOf = (key) => (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.get(key, true)), Option.getOrUndefined);
|
|
13603
|
-
/** @internal */
|
|
13604
|
-
const workingDirectoryOf = (owner) => {
|
|
13605
|
-
const run = childOf("run")(childOf("defaults")(owner));
|
|
13606
|
-
return stringOf(childOf("working-directory")(run));
|
|
13607
|
-
};
|
|
13608
|
-
/** @internal */
|
|
13609
|
-
const itemsOf = (node) => pipe(Option.liftPredicate(node, isSeq), Option.map((seq) => seq.items), Option.getOrElse(() => []));
|
|
13610
|
-
const pairsOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []));
|
|
13611
|
-
/** @internal */
|
|
13612
|
-
const entriesOf = (node) => pipe(pairsOf(node), Array$1.filter(isTextPair), Array$1.map((pair) => [pair.key.value, pair.value]));
|
|
13613
|
-
/** @internal */
|
|
13614
|
-
const scalarsIn = (source) => {
|
|
13615
|
-
const found = [];
|
|
13616
|
-
visit(parseDocument(source), { Scalar: (_key, node) => {
|
|
13617
|
-
found.push(...Option.toArray(stringOf(node)));
|
|
13618
|
-
} });
|
|
13619
|
-
return found;
|
|
13620
|
-
};
|
|
13621
|
-
// src/features/check-repository-layout/model/workflow-references.ts
|
|
13622
|
-
const ROOT$3 = ".";
|
|
13623
|
-
const LOCAL$1 = "./";
|
|
13624
|
-
const NEGATION = "!";
|
|
13625
|
-
const SEPARATOR$17 = "/";
|
|
13626
|
-
const LINE$1 = "\n";
|
|
13627
|
-
const UNRESOLVED_MARKERS = [
|
|
13628
|
-
"${{",
|
|
13629
|
-
"$",
|
|
13630
|
-
"{"
|
|
13631
|
-
];
|
|
13632
|
-
const ABSOLUTE_MARKERS = ["/", "~"];
|
|
13633
|
-
const FILE_INPUT_SUFFIX = "-file";
|
|
13634
|
-
const DEPENDENCY_PATH_INPUT = "cache-dependency-path";
|
|
13635
|
-
const FILTER_KEYS$1 = ["paths", "paths-ignore"];
|
|
13636
|
-
const HASH_FILES = /hashFiles\((?<arguments>[^)]*)\)/gu;
|
|
13637
|
-
const QUOTED$2 = /'(?<path>[^']*)'/gu;
|
|
13638
|
-
const SCRIPT = /^[\w.@/-]+\.(?:ts|mts|cts|sh)$/u;
|
|
13639
|
-
const TOKEN_SEPARATOR = /[\s;&|()<>"'`=]+/u;
|
|
13640
|
-
/** @internal */
|
|
13641
|
-
const ACTION_DEFINITIONS = ["action.yml", "action.yaml"];
|
|
13642
|
-
const containsAny = (markers) => (path) => pipe(markers, Array$1.some((marker) => String$1.includes(marker)(path)));
|
|
13643
|
-
const startsWithAny = (markers) => (path) => pipe(markers, Array$1.some((marker) => String$1.startsWith(marker)(path)));
|
|
13644
|
-
const isLiteralPath = (path) => String$1.isNonEmpty(path) && !containsAny(UNRESOLVED_MARKERS)(path) && !startsWithAny(ABSOLUTE_MARKERS)(path);
|
|
13645
|
-
const withoutLocal = (path) => {
|
|
13646
|
-
if (String$1.startsWith(LOCAL$1)(path)) return String$1.slice(2)(path);
|
|
13647
|
-
return path;
|
|
13648
|
-
};
|
|
13649
|
-
const joinPath = (base, path) => {
|
|
13650
|
-
const relative = withoutLocal(String$1.trim(path));
|
|
13651
|
-
if (base === ROOT$3) return relative;
|
|
13652
|
-
return `${base}${SEPARATOR$17}${relative}`;
|
|
13653
|
-
};
|
|
13654
|
-
const reference = (kind, field, base = ROOT$3) => ({ text, offset }) => {
|
|
13655
|
-
const path = String$1.trim(text);
|
|
13656
|
-
if (!isLiteralPath(path) || !isLiteralPath(base)) return [];
|
|
13657
|
-
return [{
|
|
13658
|
-
kind,
|
|
13659
|
-
field,
|
|
13660
|
-
path: joinPath(base, path),
|
|
13661
|
-
offset
|
|
13662
|
-
}];
|
|
13663
|
-
};
|
|
13664
|
-
const isPositive = ({ text }) => !String$1.startsWith(NEGATION)(String$1.trim(text));
|
|
13665
|
-
const globsIn = (field, node) => pipe(itemsOf(node), Array$1.flatMap((item) => Option.toArray(stringOf(item))), Array$1.filter(isPositive), Array$1.flatMap(reference("glob", field)));
|
|
13666
|
-
const filtersOf = ([event, filters]) => pipe(FILTER_KEYS$1, Array$1.flatMap((key) => globsIn(`on.${event}.${key}`, childOf(key)(filters))));
|
|
13667
|
-
const directoryOf$2 = (located, base) => pipe(located, Option.map(({ text }) => joinPath(ROOT$3, text)), Option.getOrElse(() => base));
|
|
13668
|
-
const located = (kind, field, base = ROOT$3) => (found) => pipe(found, Option.toArray, Array$1.flatMap(reference(kind, field, base)));
|
|
13669
|
-
const localUses = (node) => pipe(stringOf(childOf("uses")(node)), Option.filter(({ text }) => String$1.startsWith(LOCAL$1)(text)));
|
|
13670
|
-
const scriptsIn = (field, base) => ({ text, offset }) => pipe(String$1.split(text, TOKEN_SEPARATOR), Array$1.filter((token) => SCRIPT.test(token)), Array$1.dedupe, Array$1.flatMap((token) => reference("script", field, base)({
|
|
13671
|
-
text: token,
|
|
13672
|
-
offset
|
|
13673
|
-
})));
|
|
13674
|
-
const isFileInput = ([key]) => String$1.endsWith(FILE_INPUT_SUFFIX)(key) || key === DEPENDENCY_PATH_INPUT;
|
|
13675
|
-
const linesOf$2 = ({ text, offset }) => pipe(String$1.split(text, LINE$1), Array$1.map((line) => ({
|
|
13676
|
-
text: line,
|
|
13677
|
-
offset
|
|
13678
|
-
})));
|
|
13679
|
-
const fileInputOf = (field) => ([key, value]) => pipe(stringOf(value), Option.toArray, Array$1.flatMap(linesOf$2), Array$1.flatMap(reference("glob", `${field}.with.${key}`)));
|
|
13680
|
-
const fileInputsIn = (field, step) => pipe(entriesOf(childOf("with")(step)), Array$1.filter(isFileInput), Array$1.flatMap(fileInputOf(field)));
|
|
13681
|
-
const stepReferences = (job, base) => (step, index) => {
|
|
13682
|
-
const field = `jobs.${job}.steps[${index}]`;
|
|
13683
|
-
const own = stringOf(childOf("working-directory")(step));
|
|
13684
|
-
const directory = directoryOf$2(own, base);
|
|
13685
|
-
return [
|
|
13686
|
-
...located("action", `${field}.uses`)(localUses(step)),
|
|
13687
|
-
...located("directory", `${field}.working-directory`)(own),
|
|
13688
|
-
...pipe(stringOf(childOf("run")(step)), Option.toArray, Array$1.flatMap(scriptsIn(`${field}.run`, directory))),
|
|
13689
|
-
...fileInputsIn(field, step)
|
|
13690
|
-
];
|
|
13691
|
-
};
|
|
13692
|
-
const jobReferences = (base) => ([job, node]) => {
|
|
13693
|
-
const own = workingDirectoryOf(node);
|
|
13694
|
-
const steps = itemsOf(childOf("steps")(node));
|
|
13695
|
-
const directory = directoryOf$2(own, base);
|
|
13696
|
-
return [
|
|
13697
|
-
...located("file", `jobs.${job}.uses`)(localUses(node)),
|
|
13698
|
-
...located("directory", `jobs.${job}.defaults.run.working-directory`)(own),
|
|
13699
|
-
...pipe(steps, Array$1.flatMap(stepReferences(job, directory)))
|
|
13700
|
-
];
|
|
13701
|
-
};
|
|
13702
|
-
const groupsOf$1 = (pattern, group) => ({ text, offset }) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(text)), Array$1.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap((groups) => Option.fromNullishOr(groups[group])), Option.toArray)), Array$1.map((value) => ({
|
|
13703
|
-
text: value,
|
|
13704
|
-
offset
|
|
13705
|
-
})));
|
|
13706
|
-
const hashFilesIn = (source) => pipe(scalarsIn(source), Array$1.flatMap(groupsOf$1(HASH_FILES, "arguments")), Array$1.flatMap(groupsOf$1(QUOTED$2, "path")), Array$1.filter(isPositive), Array$1.flatMap(reference("glob", "hashFiles")));
|
|
13707
|
-
const jobsOf = (source) => entriesOf(childOf("jobs")(parseDocument(source).contents));
|
|
13708
|
-
/** @internal */
|
|
13709
|
-
const workflowReferences = (source) => {
|
|
13710
|
-
const root = parseDocument(source).contents;
|
|
13711
|
-
const workflowDefault = workingDirectoryOf(root);
|
|
13712
|
-
const base = directoryOf$2(workflowDefault, ROOT$3);
|
|
13713
|
-
return [
|
|
13714
|
-
...pipe(entriesOf(childOf("on")(root)), Array$1.flatMap(filtersOf)),
|
|
13715
|
-
...located("directory", "defaults.run.working-directory")(workflowDefault),
|
|
13716
|
-
...pipe(jobsOf(source), Array$1.flatMap(jobReferences(base))),
|
|
13717
|
-
...hashFilesIn(source)
|
|
13718
|
-
];
|
|
13719
|
-
};
|
|
13720
|
-
const pathInputOf = (step) => childOf("path")(childOf("with")(step));
|
|
13721
|
-
const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray, Array$1.flatMap(linesOf$2), Array$1.map(({ text }) => joinPath(ROOT$3, text)), Array$1.filter(isLiteralPath));
|
|
13722
|
-
/** @internal */
|
|
13723
|
-
const producedPaths = (source) => pipe(jobsOf(source), Array$1.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array$1.flatMap(outputPathsOf));
|
|
13724
|
-
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
13725
|
-
const RULE$55 = "workflow-path";
|
|
13726
|
-
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
13727
|
-
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
13728
|
-
const READ_CONCURRENCY$23 = 8;
|
|
13729
|
-
const SEPARATOR$16 = "/";
|
|
13730
|
-
const EXPECTED = {
|
|
13731
|
-
action: "a directory with action.yml",
|
|
13732
|
-
directory: "a directory",
|
|
13733
|
-
file: "a file",
|
|
13734
|
-
glob: "a pattern that matches a tracked file",
|
|
13735
|
-
script: "a file"
|
|
13736
|
-
};
|
|
13737
|
-
const isWorkflow = (file) => String$1.startsWith(WORKFLOW_DIRECTORY)(file) && pipe(WORKFLOW_EXTENSIONS, Array$1.some((extension) => String$1.endsWith(extension)(file)));
|
|
13738
|
-
const matchesAny = Effect.fn("matchesAny")(function* matchesAny(root, pathspecs) {
|
|
13739
|
-
const matched = yield* (yield* RepositoryFiles).matchingFiles(root, pathspecs);
|
|
13740
|
-
return Array$1.isReadonlyArrayNonEmpty(matched);
|
|
13741
|
-
});
|
|
13742
|
-
const matchesGlob = (root, path) => matchesAny(root, [`:(glob)${path}`]);
|
|
13743
|
-
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
13744
|
-
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$16}${name}`), { concurrency: 1 });
|
|
13745
|
-
return pipe(found, Array$1.some(Boolean));
|
|
13746
|
-
});
|
|
13747
|
-
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array$1.drop(index), Array$1.join(SEPARATOR$16))}`;
|
|
13748
|
-
const RESOLVERS = {
|
|
13749
|
-
action: hasAction,
|
|
13750
|
-
directory: isDirectoryAt,
|
|
13751
|
-
file: existsAt,
|
|
13752
|
-
glob: matchesGlob,
|
|
13753
|
-
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
13754
|
-
if (yield* existsAt(root, path)) return true;
|
|
13755
|
-
const segments = String$1.split(path, SEPARATOR$16);
|
|
13756
|
-
return yield* matchesAny(root, Array$1.makeBy(segments.length, suffixAt(segments)));
|
|
13757
|
-
})
|
|
13758
|
-
};
|
|
13759
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$16}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$16}`)(path);
|
|
13760
|
-
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
13761
|
-
const prefix = staticPrefix(found.path);
|
|
13762
|
-
if (pipe(produced, Array$1.some(overlaps(prefix)))) return false;
|
|
13763
|
-
if (yield* RESOLVERS[found.kind](root, found.path)) return false;
|
|
13764
|
-
return !(yield* isIgnored(root, found.path));
|
|
13765
|
-
});
|
|
13766
|
-
const problemOf$11 = (file, source) => (found) => ({
|
|
13767
|
-
file,
|
|
13768
|
-
...positionOf(source)(found.offset),
|
|
13769
|
-
rule: RULE$55,
|
|
13770
|
-
message: `${found.field} names ${found.path}, which is not ${EXPECTED[found.kind]} in this repository. Point it at a path that exists or remove it.`
|
|
13771
|
-
});
|
|
13772
|
-
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
13773
|
-
const files = yield* RepositoryFiles;
|
|
13774
|
-
const file = files.join(root, workflow);
|
|
13775
|
-
const source = yield* files.readFile(file);
|
|
13776
|
-
if (Option.isNone(source)) return [];
|
|
13777
|
-
const produced = producedPaths(source.value);
|
|
13778
|
-
const missing = yield* Effect.filter(workflowReferences(source.value), (found) => isMissing$1(root, produced, found));
|
|
13779
|
-
return pipe(missing, Array$1.map(problemOf$11(file, source.value)));
|
|
13780
|
-
});
|
|
13781
|
-
/** @internal */
|
|
13782
|
-
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
13783
|
-
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13784
|
-
const found = yield* Effect.forEach(pipe(listed, Array$1.filter(isWorkflow)), (workflow) => problemsIn$16(root, workflow), { concurrency: READ_CONCURRENCY$23 });
|
|
13785
|
-
return Array$1.flatten(found);
|
|
13786
|
-
});
|
|
13787
|
-
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
13788
|
-
const PATH_FILTER = "workflow-path-filter";
|
|
13789
|
-
const PACKAGE$2 = "workflow-package";
|
|
13790
|
-
const WORKFLOW$1 = /^\.github\/workflows\/(?<name>[^/]+)\.ya?ml$/u;
|
|
13791
|
-
const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
13792
|
-
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
13793
|
-
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
13794
|
-
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
13795
|
-
const START$29 = 0;
|
|
13796
|
-
const READ_CONCURRENCY$22 = 8;
|
|
13797
|
-
const SEPARATOR$15 = "/";
|
|
13798
|
-
const WORD_SEPARATORS = /[-_]/gu;
|
|
13799
|
-
const SPACE = " ";
|
|
13800
|
-
const FILTER_MESSAGE = "A workflow that reacts to changes under listed paths needs a new entry for every package and drifts from the packages it is meant to cover. Run the generic pipeline on every push and let it decide from the workspace what changed.";
|
|
13801
|
-
const packageMessage = (what, directory) => `${what} names the workspace ${directory}. A workflow or job made for one package does not scale: give the package a vp task and let the generic pipeline (verify, deploy, release, daily, task) find it.`;
|
|
13802
|
-
const keysOf = (node) => pipe(Option.liftPredicate(node, isMap), Option.map((map) => map.items), Option.getOrElse(() => []), Array$1.filter(isPair), Array$1.flatMap(({ key }) => Option.toArray(stringOf(key))));
|
|
13803
|
-
const problemAt$4 = ({ file, source }, rule, message) => (offset) => ({
|
|
13804
|
-
file,
|
|
13805
|
-
...positionOf(source)(offset),
|
|
13806
|
-
rule,
|
|
13807
|
-
message
|
|
13808
|
-
});
|
|
13809
|
-
const pathFiltersIn = (file, source) => {
|
|
13810
|
-
const root = parseDocument(source).contents;
|
|
13811
|
-
const triggers = pipe(entriesOf(childOf("on")(root)), Array$1.flatMap(([, trigger]) => keysOf(trigger)), Array$1.filter(({ text }) => Array$1.contains(FILTER_KEYS, text)));
|
|
13812
|
-
const actions = pipe(scalarsIn(source), Array$1.filter(({ text }) => PATHS_FILTER_ACTION.test(text)));
|
|
13813
|
-
return pipe([...triggers, ...actions], Array$1.map(({ offset }) => problemAt$4({
|
|
13814
|
-
file,
|
|
13815
|
-
source
|
|
13816
|
-
}, PATH_FILTER, FILTER_MESSAGE)(offset)));
|
|
13817
|
-
};
|
|
13818
|
-
const matching$1 = (workspaces, text) => pipe(workspaces, Array$1.findFirst(({ names }) => Array$1.isReadonlyArrayNonEmpty(names) && Option.isSome(String$1.match(patternOf$1(names))(text))), Option.map(({ directory }) => directory));
|
|
13819
|
-
const named$1 = (workspaces, text) => Option.orElse(matching$1(workspaces, text), () => matching$1(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
13820
|
-
const containing = (workspaces, path) => pipe(workspaces, Array$1.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$15}`)(path)), Option.map(({ directory }) => directory));
|
|
13821
|
-
const namesIn$2 = (name, source) => {
|
|
13822
|
-
const root = parseDocument(source).contents;
|
|
13823
|
-
return [
|
|
13824
|
-
{
|
|
13825
|
-
text: name,
|
|
13826
|
-
offset: START$29
|
|
13827
|
-
},
|
|
13828
|
-
...Option.toArray(stringOf(childOf("name")(root))),
|
|
13829
|
-
...keysOf(childOf("jobs")(root))
|
|
13830
|
-
];
|
|
13831
|
-
};
|
|
13832
|
-
const filtersIn = (source) => pipe(scalarsIn(source), Array$1.flatMap(({ text, offset }) => pipe(Array$1.fromIterable(String$1.matchAll(PACKAGE_FILTER)(text)), Array$1.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap((groups) => Option.fromNullishOr(groups["value"])), Option.toArray)), Array$1.map((value) => ({
|
|
13833
|
-
text: value,
|
|
13834
|
-
offset
|
|
13835
|
-
})))));
|
|
13836
|
-
const reported = (where, offset, what) => (found) => pipe(found, Option.map((directory) => problemAt$4(where, PACKAGE$2, packageMessage(what, directory))(offset)), Option.toArray);
|
|
13837
|
-
const packagesIn$1 = (workspaces, { file, name, source }) => {
|
|
13838
|
-
const where = {
|
|
13839
|
-
file,
|
|
13840
|
-
source
|
|
13841
|
-
};
|
|
13842
|
-
const fromNames = pipe(namesIn$2(name, source), Array$1.flatMap(({ text, offset }) => reported(where, offset, `"${text}"`)(named$1(workspaces, text))));
|
|
13843
|
-
const referenced = pipe(workflowReferences(source), Array$1.filter(({ field }) => !String$1.startsWith("on.")(field)), Array$1.flatMap(({ field, path, offset }) => reported(where, offset, field)(containing(workspaces, path))));
|
|
13844
|
-
const filtered = pipe(filtersIn(source), Array$1.flatMap(({ text, offset }) => reported(where, offset, `--filter ${text}`)(matching$1(workspaces, text))));
|
|
13845
|
-
return [
|
|
13846
|
-
...fromNames,
|
|
13847
|
-
...referenced,
|
|
13848
|
-
...filtered
|
|
13849
|
-
];
|
|
13850
|
-
};
|
|
13851
|
-
const actionProblems = (workspaces, file, name) => pipe(named$1(workspaces, name), Option.map((directory) => ({
|
|
13852
|
-
file,
|
|
13853
|
-
line: 1,
|
|
13854
|
-
column: 1,
|
|
13855
|
-
rule: PACKAGE$2,
|
|
13856
|
-
message: packageMessage(`The action ${name}`, directory)
|
|
13857
|
-
})), Option.toArray);
|
|
13858
|
-
/** @internal */
|
|
13859
|
-
const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkflowScale(root) {
|
|
13860
|
-
const files = yield* RepositoryFiles;
|
|
13861
|
-
const listed = yield* files.listedFiles(root);
|
|
13862
|
-
const workspaces = yield* namedWorkspaces(root);
|
|
13863
|
-
const workflows = pipe(listed, Array$1.flatMap((name) => pipe(groupOf("name")(WORKFLOW$1.exec(name)), Option.map((stem) => ({
|
|
13864
|
-
name,
|
|
13865
|
-
stem
|
|
13866
|
-
})), Option.toArray)));
|
|
13867
|
-
const found = yield* Effect.forEach(workflows, ({ name, stem }) => Effect.gen(function* problemsOf() {
|
|
13868
|
-
const file = files.join(root, name);
|
|
13869
|
-
const source = yield* files.readFile(file);
|
|
13870
|
-
return pipe(source, Option.map((text) => [...pathFiltersIn(file, text), ...packagesIn$1(workspaces, {
|
|
13871
|
-
file,
|
|
13872
|
-
name: stem,
|
|
13873
|
-
source: text
|
|
13874
|
-
})]), Option.getOrElse(() => []));
|
|
13875
|
-
}), { concurrency: READ_CONCURRENCY$22 });
|
|
13876
|
-
const actions = pipe(listed, Array$1.flatMap((name) => pipe(groupOf("name")(ACTION.exec(name)), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
|
|
13877
|
-
return [...Array$1.flatten(found), ...actions];
|
|
13878
|
-
});
|
|
13879
13534
|
// src/features/check-repository-layout/model/workspace-checks.ts
|
|
13880
13535
|
/** @internal */
|
|
13881
13536
|
const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(root) {
|
|
@@ -13886,9 +13541,7 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
13886
13541
|
checkDeployEntryPatterns(root),
|
|
13887
13542
|
checkFallowEntries(root),
|
|
13888
13543
|
checkRootWorkspacePaths(root),
|
|
13889
|
-
checkTasks(root)
|
|
13890
|
-
checkWorkflowPaths(root),
|
|
13891
|
-
checkWorkflowScale(root)
|
|
13544
|
+
checkTasks(root)
|
|
13892
13545
|
], { concurrency: "unbounded" });
|
|
13893
13546
|
return Array$1.flatten(found);
|
|
13894
13547
|
});
|
|
@@ -14174,12 +13827,12 @@ const baseRevision = Effect.fn("baseRevision")(function* baseRevision(root) {
|
|
|
14174
13827
|
return yield* files.mergeBase(root, base);
|
|
14175
13828
|
});
|
|
14176
13829
|
// src/features/check-migration-order/model/migration-order.ts
|
|
14177
|
-
const RULE$
|
|
13830
|
+
const RULE$48 = "migration-order";
|
|
14178
13831
|
const SNAPSHOT = "snapshot.json";
|
|
14179
13832
|
const MIGRATION = "migration.sql";
|
|
14180
13833
|
const SNAPSHOTS = [`*/${SNAPSHOT}`];
|
|
14181
13834
|
const FIRST$13 = 1;
|
|
14182
|
-
const READ_CONCURRENCY$
|
|
13835
|
+
const READ_CONCURRENCY$20 = 16;
|
|
14183
13836
|
const isSnapshot = (basename) => (file) => basename(file) === SNAPSHOT;
|
|
14184
13837
|
const migrationAt = Effect.fn("migrationAt")(function* migrationAt(root, base, file) {
|
|
14185
13838
|
const files = yield* RepositoryFiles;
|
|
@@ -14208,7 +13861,7 @@ const outOfOrder = (root, base, join) => (migrations) => pipe(latestOf(migration
|
|
|
14208
13861
|
file: join(root, file),
|
|
14209
13862
|
line: FIRST$13,
|
|
14210
13863
|
column: FIRST$13,
|
|
14211
|
-
rule: RULE$
|
|
13864
|
+
rule: RULE$48,
|
|
14212
13865
|
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}.`
|
|
14213
13866
|
})))), Option.getOrElse(() => []));
|
|
14214
13867
|
/** @internal */
|
|
@@ -14219,7 +13872,7 @@ const checkMigrationOrder = Effect.fn("checkMigrationOrder")(function* checkMigr
|
|
|
14219
13872
|
if (Option.isNone(found)) return [];
|
|
14220
13873
|
const [listed, changed] = yield* Effect.all([files.matchingFiles(root, SNAPSHOTS), files.changedFiles(root, base)], { concurrency: "unbounded" });
|
|
14221
13874
|
const snapshots = pipe([...listed, ...changed], Array$1.filter(isSnapshot(files.basename)), Array$1.dedupe);
|
|
14222
|
-
const migrations = yield* Effect.forEach(snapshots, (file) => migrationAt(root, base, file), { concurrency: READ_CONCURRENCY$
|
|
13875
|
+
const migrations = yield* Effect.forEach(snapshots, (file) => migrationAt(root, base, file), { concurrency: READ_CONCURRENCY$20 });
|
|
14223
13876
|
return pipe(Array$1.getSomes(migrations), Array$1.groupBy(({ directory }) => directory), Record.values, Array$1.flatMap(outOfOrder(root, base, files.join)));
|
|
14224
13877
|
});
|
|
14225
13878
|
// src/shared/lib/bundle-error.ts
|
|
@@ -14259,7 +13912,7 @@ const unresolvedFrom = (entries) => Effect.acquireUseRelease(Effect.tryPromise({
|
|
|
14259
13912
|
catch: bundleErrorDetail
|
|
14260
13913
|
}), (bundle) => Effect.promise(() => bundle.close())).pipe(Effect.map(({ output }) => unresolvedIn(pipe(output, Array$1.filter(isChunk$1)))));
|
|
14261
13914
|
// src/features/check-plugin-dependencies/model/plugin-dependencies.ts
|
|
14262
|
-
const RULE$
|
|
13915
|
+
const RULE$47 = "plugin-dependencies";
|
|
14263
13916
|
const PLUGIN_FILE$3 = ".claude-plugin/plugin.json";
|
|
14264
13917
|
const LOCK_FILE = "bun.lock";
|
|
14265
13918
|
const SOURCE_FILE$1 = /\.[cm]?[jt]sx?$/u;
|
|
@@ -14268,7 +13921,7 @@ const SUCCESS$6 = 0;
|
|
|
14268
13921
|
const NOT_STARTED = -1;
|
|
14269
13922
|
const DETAIL_LINES = 3;
|
|
14270
13923
|
const PLUGIN_CONCURRENCY = 2;
|
|
14271
|
-
const problemFor$4 = problemInFile(RULE$
|
|
13924
|
+
const problemFor$4 = problemInFile(RULE$47);
|
|
14272
13925
|
const hasDependencies = Effect.fn("hasDependencies")(function* hasDependencies(directory) {
|
|
14273
13926
|
const files = yield* RepositoryFiles;
|
|
14274
13927
|
const text = yield* files.readFile(files.join(directory, PACKAGE_JSON_FILE));
|
|
@@ -14487,7 +14140,7 @@ const bundleScopeOf = ({ manifest, workspace }) => ({
|
|
|
14487
14140
|
});
|
|
14488
14141
|
const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
14489
14142
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
14490
|
-
const RULE$
|
|
14143
|
+
const RULE$46 = "optional-peer";
|
|
14491
14144
|
const REQUIRED_RULE = "required-peer";
|
|
14492
14145
|
const START$27 = 0;
|
|
14493
14146
|
const SINGLE$1 = 1;
|
|
@@ -14504,7 +14157,7 @@ const positionIn = (located, key, name) => {
|
|
|
14504
14157
|
const problemFor$3 = (located, name, importers) => ({
|
|
14505
14158
|
file: located.file,
|
|
14506
14159
|
...positionIn(located, DEPENDENCIES_KEY, name),
|
|
14507
|
-
rule: RULE$
|
|
14160
|
+
rule: RULE$46,
|
|
14508
14161
|
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.`
|
|
14509
14162
|
});
|
|
14510
14163
|
const requiredPeerAdvice = (fromStack) => {
|
|
@@ -14540,7 +14193,7 @@ const requiredPeerProblems = ({ located, manifest, used }) => {
|
|
|
14540
14193
|
}));
|
|
14541
14194
|
};
|
|
14542
14195
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
14543
|
-
const RULE$
|
|
14196
|
+
const RULE$45 = "side-effects";
|
|
14544
14197
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
14545
14198
|
const START$26 = 0;
|
|
14546
14199
|
const FIRST$12 = 1;
|
|
@@ -14592,13 +14245,13 @@ const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source),
|
|
|
14592
14245
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array$1.sortBy(largest), Array$1.head, Option.map((worst) => ({
|
|
14593
14246
|
file,
|
|
14594
14247
|
...positionOf(source)(keyIndex$1(source)),
|
|
14595
|
-
rule: RULE$
|
|
14248
|
+
rule: RULE$45,
|
|
14596
14249
|
message: messageOf$5(worst, excesses.length)
|
|
14597
14250
|
})), Option.toArray);
|
|
14598
14251
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
14599
|
-
const RULE$
|
|
14252
|
+
const RULE$44 = "top-level-effect";
|
|
14600
14253
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
14601
|
-
const READ_CONCURRENCY$
|
|
14254
|
+
const READ_CONCURRENCY$19 = 16;
|
|
14602
14255
|
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.";
|
|
14603
14256
|
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.";
|
|
14604
14257
|
const isEffect = (statement) => {
|
|
@@ -14609,10 +14262,10 @@ const messageOf$4 = (statement) => {
|
|
|
14609
14262
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
14610
14263
|
return STATEMENT_MESSAGE;
|
|
14611
14264
|
};
|
|
14612
|
-
const problemsIn$
|
|
14265
|
+
const problemsIn$14 = (api) => (file) => (source) => {
|
|
14613
14266
|
const retained = api.createSourceFile(file, source);
|
|
14614
|
-
const problems = pipe(retained.sourceFile.statements, Array$1.fromIterable, Array$1.filter(isEffect), Array$1.map((statement) => problemAt$
|
|
14615
|
-
rule: RULE$
|
|
14267
|
+
const problems = pipe(retained.sourceFile.statements, Array$1.fromIterable, Array$1.filter(isEffect), Array$1.map((statement) => problemAt$6({
|
|
14268
|
+
rule: RULE$44,
|
|
14616
14269
|
message: messageOf$4(statement)
|
|
14617
14270
|
})(statement)));
|
|
14618
14271
|
retained.dispose();
|
|
@@ -14625,7 +14278,7 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
14625
14278
|
const names = yield* files.ownedFiles(root);
|
|
14626
14279
|
const owned = new Set(pipe(names, Array$1.map((name) => files.join(root, name))));
|
|
14627
14280
|
const sources = pipe(modules, Array$1.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
14628
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
14281
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$14(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$19 });
|
|
14629
14282
|
return Array$1.flatten(found);
|
|
14630
14283
|
}, Effect.scoped);
|
|
14631
14284
|
const BUNDLED_RULE = "bundled-side-effects";
|
|
@@ -14655,7 +14308,7 @@ const bundledSideEffectProblems = Effect.fn("bundledSideEffectProblems")(functio
|
|
|
14655
14308
|
const manifests = new Set(pipe(owned, Array$1.filter((file) => files.basename(file) === PACKAGE_JSON_FILE)));
|
|
14656
14309
|
const ownedSet = new Set(owned);
|
|
14657
14310
|
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));
|
|
14658
|
-
const undeclared = yield* Effect.forEach(directories, undeclaredAt, { concurrency: READ_CONCURRENCY$
|
|
14311
|
+
const undeclared = yield* Effect.forEach(directories, undeclaredAt, { concurrency: READ_CONCURRENCY$19 });
|
|
14659
14312
|
const at = problemAtIndex(BUNDLED_RULE)(located.file, located.source);
|
|
14660
14313
|
const index = nameIndex$1(located.source);
|
|
14661
14314
|
return pipe(Array$1.getSomes(undeclared), Array$1.map((found) => at(index, undeclaredMessage(files, root)(found))));
|
|
@@ -14781,7 +14434,7 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
14781
14434
|
return Array$1.flatten(found);
|
|
14782
14435
|
});
|
|
14783
14436
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
14784
|
-
const RULE$
|
|
14437
|
+
const RULE$43 = "legacy-typescript";
|
|
14785
14438
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
14786
14439
|
const COMPILER = "typescript";
|
|
14787
14440
|
const CURRENT_MAJOR = 7;
|
|
@@ -14812,12 +14465,12 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
14812
14465
|
file,
|
|
14813
14466
|
line: lineOf$4(source)(legacy.id),
|
|
14814
14467
|
column: FIRST$11,
|
|
14815
|
-
rule: RULE$
|
|
14468
|
+
rule: RULE$43,
|
|
14816
14469
|
message: messageOf$3(legacy, dependentsOf$1(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
14817
14470
|
})));
|
|
14818
14471
|
});
|
|
14819
14472
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
14820
|
-
const RULE$
|
|
14473
|
+
const RULE$42 = "worker-bundle";
|
|
14821
14474
|
const BUNDLE_CONCURRENCY = 4;
|
|
14822
14475
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
14823
14476
|
const CONDITIONS = [
|
|
@@ -14828,7 +14481,7 @@ const CONDITIONS = [
|
|
|
14828
14481
|
"module",
|
|
14829
14482
|
"default"
|
|
14830
14483
|
];
|
|
14831
|
-
const problemFor$2 = problemInFile(RULE$
|
|
14484
|
+
const problemFor$2 = problemInFile(RULE$42);
|
|
14832
14485
|
const problemOf$10 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
14833
14486
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
14834
14487
|
const built = yield* Effect.tryPromise({
|
|
@@ -14884,10 +14537,11 @@ const enabledRulesIn = Effect.fn("enabledRulesIn")(function* enabledRulesIn(root
|
|
|
14884
14537
|
const expectationsIn = Effect.fn("expectationsIn")(function* expectationsIn(root) {
|
|
14885
14538
|
const enabledRules = yield* enabledRulesIn(root);
|
|
14886
14539
|
const published = yield* publishedArticlesIn(root);
|
|
14540
|
+
const drafts = yield* draftArticlesIn(root);
|
|
14887
14541
|
return {
|
|
14888
14542
|
enabledRules,
|
|
14889
14543
|
text: {
|
|
14890
|
-
ignores: textIgnoresOf(published),
|
|
14544
|
+
ignores: textIgnoresOf([...published, ...drafts]),
|
|
14891
14545
|
builtRuleNames: builtTextRuleNames
|
|
14892
14546
|
},
|
|
14893
14547
|
markdown: {
|
|
@@ -15002,7 +14656,7 @@ const weakeningsOf = (expected) => (config) => [
|
|
|
15002
14656
|
...secretWeakenings(config.h56m, expected.secrets)
|
|
15003
14657
|
];
|
|
15004
14658
|
// src/app/disabled-rules.ts
|
|
15005
|
-
const RULE$
|
|
14659
|
+
const RULE$41 = "disabled-rule";
|
|
15006
14660
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
15007
14661
|
const START$24 = 0;
|
|
15008
14662
|
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;
|
|
@@ -15016,7 +14670,7 @@ const sideConfigs = Effect.fn("sideConfigs")(function* sideConfigs(root) {
|
|
|
15016
14670
|
const files = yield* RepositoryFiles;
|
|
15017
14671
|
const listed = yield* files.listedFiles(root);
|
|
15018
14672
|
const isExempt = matcher(exempt);
|
|
15019
|
-
return pipe(listed, Array$1.filter((name) => SIDE_CONFIG.test(name) && !isExempt(name)), Array$1.map((name) => problemAtIndex(RULE$
|
|
14673
|
+
return pipe(listed, Array$1.filter((name) => SIDE_CONFIG.test(name) && !isExempt(name)), Array$1.map((name) => problemAtIndex(RULE$41)(files.join(root, name), "")(START$24, SIDE_CONFIG_MESSAGE)));
|
|
15020
14674
|
});
|
|
15021
14675
|
const configWeakenings = Effect.fn("configWeakenings")(function* configWeakenings(root, source) {
|
|
15022
14676
|
const file = (yield* RepositoryFiles).join(root, CONFIG_FILE$5);
|
|
@@ -15028,7 +14682,7 @@ const configWeakenings = Effect.fn("configWeakenings")(function* configWeakening
|
|
|
15028
14682
|
})
|
|
15029
14683
|
});
|
|
15030
14684
|
const expected = yield* expectationsIn(root);
|
|
15031
|
-
const at = problemAtIndex(RULE$
|
|
14685
|
+
const at = problemAtIndex(RULE$41)(file, source);
|
|
15032
14686
|
return pipe(weakeningsOf(expected)(config), Array$1.map(({ anchor, message }) => at(Option.getOrElse(String$1.indexOf(anchor)(source), () => START$24), message)));
|
|
15033
14687
|
});
|
|
15034
14688
|
/** @internal */
|
|
@@ -15036,7 +14690,7 @@ const checkDisabledRules = Effect.fn("checkDisabledRules")(function* checkDisabl
|
|
|
15036
14690
|
const files = yield* RepositoryFiles;
|
|
15037
14691
|
const text = yield* files.readFile(files.join(root, CONFIG_FILE$5));
|
|
15038
14692
|
if (Option.isNone(text)) return [];
|
|
15039
|
-
return [...yield* configWeakenings(root, text.value).pipe(Effect.catchTag("DisabledRulesConfigUnreadable", ({ file, reason }) => Effect.succeed([problemAtIndex(RULE$
|
|
14693
|
+
return [...yield* configWeakenings(root, text.value).pipe(Effect.catchTag("DisabledRulesConfigUnreadable", ({ file, reason }) => Effect.succeed([problemAtIndex(RULE$41)(file, "")(START$24, `msch could not load this file: ${reason}`)]))), ...yield* sideConfigs(root)];
|
|
15040
14694
|
});
|
|
15041
14695
|
// src/app/build-checks.ts
|
|
15042
14696
|
/** @internal */
|
|
@@ -15132,7 +14786,7 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
15132
14786
|
imports: importedFilesOf(checker)(sourceFile)
|
|
15133
14787
|
})), Array$1.filter((facts) => Array$1.isReadonlyArrayNonEmpty(facts.values) || Array$1.isReadonlyArrayNonEmpty(facts.imports)));
|
|
15134
14788
|
// src/features/check-value-owners/model/name-lists.ts
|
|
15135
|
-
const RULE$
|
|
14789
|
+
const RULE$40 = "hand-written-names";
|
|
15136
14790
|
const TEST_FILE$1 = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
15137
14791
|
const nameListOf = (site) => {
|
|
15138
14792
|
if (TEST_FILE$1.test(site.file) || site.values.length < 2) return Option.none();
|
|
@@ -15147,7 +14801,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
15147
14801
|
file,
|
|
15148
14802
|
line,
|
|
15149
14803
|
column,
|
|
15150
|
-
rule: RULE$
|
|
14804
|
+
rule: RULE$40,
|
|
15151
14805
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
15152
14806
|
});
|
|
15153
14807
|
const problemOf$9 = ({ list, reason }) => listedProblem({
|
|
@@ -15220,7 +14874,7 @@ const ownerValuesOf = (checker) => (declaration) => {
|
|
|
15220
14874
|
const type = checker.getTypeAtLocation(declaration.name);
|
|
15221
14875
|
return finiteValuesOf(checker)(type).pipe(Option.orElse(() => objectValuesOf(checker)(type)));
|
|
15222
14876
|
};
|
|
15223
|
-
const annotationProblem = (message) => problemAt$
|
|
14877
|
+
const annotationProblem = (message) => problemAt$6({
|
|
15224
14878
|
rule: "owner-annotation",
|
|
15225
14879
|
message
|
|
15226
14880
|
});
|
|
@@ -15356,7 +15010,7 @@ const shapeProblem = (site, matches) => {
|
|
|
15356
15010
|
onNone: () => "Derive it from the library type, for example with Pick, instead of copying its properties.",
|
|
15357
15011
|
onSome: () => "Use the library type instead of copying it."
|
|
15358
15012
|
});
|
|
15359
|
-
return problemAt$
|
|
15013
|
+
return problemAt$6({
|
|
15360
15014
|
rule: "library-shape",
|
|
15361
15015
|
message: `This shape copies ${shown}. ${advice}`
|
|
15362
15016
|
})(site.node);
|
|
@@ -15457,7 +15111,7 @@ const derivedVerdict = (context) => (site) => {
|
|
|
15457
15111
|
const added = pipe(site.values, Array$1.filter((value) => !isSubsetOf([value], held)));
|
|
15458
15112
|
if (!Array$1.isReadonlyArrayNonEmpty(owners) || !Array$1.isReadonlyArrayNonEmpty(added)) return verdict$1([], []);
|
|
15459
15113
|
const message = `This set adds ${formatValues(added)} to ${describeOwners(owners)}. Add the values to the owner, or register the wider set as its own concept.`;
|
|
15460
|
-
return verdict$1([problemAt$
|
|
15114
|
+
return verdict$1([problemAt$6({
|
|
15461
15115
|
rule: "owner-extension",
|
|
15462
15116
|
message
|
|
15463
15117
|
})(site.node)], []);
|
|
@@ -15479,7 +15133,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
15479
15133
|
const owners = pipe(context.owners, Array$1.filter((owner) => isSubsetOf(site.values, owner.values)));
|
|
15480
15134
|
if (Array$1.isReadonlyArrayNonEmpty(owners)) {
|
|
15481
15135
|
const message = `The values ${formatValues(site.values)} are owned by ${describeOwners(owners)}. Derive this set from the owner instead of restating it.`;
|
|
15482
|
-
return verdict$1([problemAt$
|
|
15136
|
+
return verdict$1([problemAt$6({
|
|
15483
15137
|
rule: "owner-value-set",
|
|
15484
15138
|
message
|
|
15485
15139
|
})(site.node)], []);
|
|
@@ -15487,7 +15141,7 @@ const originalVerdict = (context) => (site) => {
|
|
|
15487
15141
|
const candidates = libraryCandidates(context)(site);
|
|
15488
15142
|
if (Array$1.isReadonlyArrayNonEmpty(candidates)) {
|
|
15489
15143
|
const message = `The values ${formatValues(site.values)} restate a dependency type: ${listCandidates(candidates)}. Derive this set from the library type.`;
|
|
15490
|
-
return verdict$1([problemAt$
|
|
15144
|
+
return verdict$1([problemAt$6({
|
|
15491
15145
|
rule: "library-value-set",
|
|
15492
15146
|
message
|
|
15493
15147
|
})(site.node)], []);
|
|
@@ -15518,7 +15172,7 @@ const isValuePosition = (node) => {
|
|
|
15518
15172
|
const { parent } = node;
|
|
15519
15173
|
return VALUE_PARENT_KINDS.has(parent.kind) || pipe(VALUE_SLOTS, Array$1.some((isSlot) => isSlot(node, parent)));
|
|
15520
15174
|
};
|
|
15521
|
-
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array$1.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array$1.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array$1.map(String)))))), Option.filter((owners) => Array$1.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$
|
|
15175
|
+
const ownedLiteralProblem = (context) => (literal) => Option.fromUndefinedOr(context.checker.getContextualType(literal)).pipe(Option.filter((contextual) => vocabularyOf(context.checker)(contextual).pipe(Option.exists((vocabulary) => !vocabulary.admitsUnnamedValues))), Option.map(() => pipe(contextSymbolsOf(context.checker)(literal), Array$1.flatMap((symbol) => ownersBehind(context)(symbol, [])), uniqueByReference, Array$1.filter((owner) => isSubsetOf([literal.text], pipe(owner.values, Array$1.map(String)))))), Option.filter((owners) => Array$1.isReadonlyArrayNonEmpty(owners)), Option.map((owners) => problemAt$6({
|
|
15522
15176
|
rule: "owned-literal",
|
|
15523
15177
|
message: `${literal.getText()} is a value of ${describeOwners(owners)}. Write it through the owner's binding instead of as a literal.`
|
|
15524
15178
|
})(literal)));
|
|
@@ -15938,7 +15592,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
15938
15592
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
15939
15593
|
}, Effect.scoped);
|
|
15940
15594
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
15941
|
-
const RULE$
|
|
15595
|
+
const RULE$39 = "namespace-destructuring";
|
|
15942
15596
|
const LOCAL = /^[.#/]/u;
|
|
15943
15597
|
const messageOf$2 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
15944
15598
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -15953,8 +15607,8 @@ const destructuredName = (declaration) => {
|
|
|
15953
15607
|
if (declaration.name.kind !== SyntaxKind.ObjectBindingPattern) return Option.none();
|
|
15954
15608
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
15955
15609
|
};
|
|
15956
|
-
const problemOf$8 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$
|
|
15957
|
-
rule: RULE$
|
|
15610
|
+
const problemOf$8 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$6({
|
|
15611
|
+
rule: RULE$39,
|
|
15958
15612
|
message: messageOf$2(name)
|
|
15959
15613
|
})), Option.map((report) => report(declaration)));
|
|
15960
15614
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -15962,7 +15616,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
15962
15616
|
return pipe(descendantsOf(sourceFile), Array$1.filter(isVariableDeclaration), Array$1.map(problemOf$8(names)), Array$1.getSomes);
|
|
15963
15617
|
};
|
|
15964
15618
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
15965
|
-
const RULE$
|
|
15619
|
+
const RULE$38 = "pass-through-wrapper";
|
|
15966
15620
|
const SINGLE_STATEMENT = 1;
|
|
15967
15621
|
const SINGLE_DECLARATION = 1;
|
|
15968
15622
|
const THIS_PARAMETER = "this";
|
|
@@ -16058,8 +15712,8 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
16058
15712
|
};
|
|
16059
15713
|
const problemOf$7 = (checker) => (candidate) => {
|
|
16060
15714
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
16061
|
-
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$
|
|
16062
|
-
rule: RULE$
|
|
15715
|
+
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$6({
|
|
15716
|
+
rule: RULE$38,
|
|
16063
15717
|
message: messageOf$1(forward.callee.getText())
|
|
16064
15718
|
})(candidate.name)));
|
|
16065
15719
|
};
|
|
@@ -16082,7 +15736,7 @@ const repositoryOrigin = Effect.fn("repositoryOrigin")(function* repositoryOrigi
|
|
|
16082
15736
|
/** @internal */
|
|
16083
15737
|
const slugOf = ({ owner, name }) => `${owner}/${name}`;
|
|
16084
15738
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
16085
|
-
const RULE$
|
|
15739
|
+
const RULE$37 = "known-plugins";
|
|
16086
15740
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
16087
15741
|
const MARKETPLACE_FILE$2 = ".claude-plugin/marketplace.json";
|
|
16088
15742
|
const GITHUB$5 = "github";
|
|
@@ -16103,7 +15757,7 @@ const MarketplaceSchema = Schema.Struct({
|
|
|
16103
15757
|
plugins: Schema.Array(Schema.Struct({ name: Schema.String }))
|
|
16104
15758
|
});
|
|
16105
15759
|
const decodeMarketplace = Schema.decodeUnknownOption(Schema.fromJsonString(MarketplaceSchema));
|
|
16106
|
-
const problem$5 = problemInFile(RULE$
|
|
15760
|
+
const problem$5 = problemInFile(RULE$37);
|
|
16107
15761
|
const knownFrom = (repository, marketplace, settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(marketplace.name)), Option.exists(({ source }) => source.source === GITHUB$5 && source.repo === repository));
|
|
16108
15762
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
16109
15763
|
const pluginProblems = (marketplace, file, settings) => {
|
|
@@ -16128,20 +15782,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
16128
15782
|
}));
|
|
16129
15783
|
});
|
|
16130
15784
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
16131
|
-
const RULE$
|
|
15785
|
+
const RULE$36 = "missing-hook";
|
|
16132
15786
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
16133
15787
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
16134
15788
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
16135
15789
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
16136
15790
|
const PLUGIN_ROOT = "..";
|
|
16137
|
-
const READ_CONCURRENCY$
|
|
15791
|
+
const READ_CONCURRENCY$18 = 16;
|
|
16138
15792
|
const START$23 = 0;
|
|
16139
15793
|
const referenceOf$1 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
16140
15794
|
path,
|
|
16141
15795
|
index: found.index ?? START$23
|
|
16142
15796
|
})), Option.toArray);
|
|
16143
15797
|
const referencesIn = (pattern, source) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.flatMap(referenceOf$1));
|
|
16144
|
-
const problemsIn$
|
|
15798
|
+
const problemsIn$13 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
16145
15799
|
const files = yield* RepositoryFiles;
|
|
16146
15800
|
const text = yield* files.readFile(file);
|
|
16147
15801
|
if (Option.isNone(text)) return [];
|
|
@@ -16153,7 +15807,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
16153
15807
|
return pipe(missing, Array$1.map(({ path, index }) => ({
|
|
16154
15808
|
file,
|
|
16155
15809
|
...positionOf(source)(index),
|
|
16156
|
-
rule: RULE$
|
|
15810
|
+
rule: RULE$36,
|
|
16157
15811
|
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.`
|
|
16158
15812
|
})));
|
|
16159
15813
|
});
|
|
@@ -16177,7 +15831,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
16177
15831
|
}];
|
|
16178
15832
|
return [];
|
|
16179
15833
|
}));
|
|
16180
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
15834
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$13, { concurrency: READ_CONCURRENCY$18 });
|
|
16181
15835
|
return Array$1.flatten(found);
|
|
16182
15836
|
});
|
|
16183
15837
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -16206,7 +15860,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
16206
15860
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
16207
15861
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
16208
15862
|
// src/features/check-documented-commands/model/commands.ts
|
|
16209
|
-
const RULE$
|
|
15863
|
+
const RULE$35 = "documented-commands";
|
|
16210
15864
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
16211
15865
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
16212
15866
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -16281,10 +15935,10 @@ const whereOf = (scope, file) => {
|
|
|
16281
15935
|
return `the package that holds ${file}`;
|
|
16282
15936
|
};
|
|
16283
15937
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array$1.some(hasTask$1(graph, task)));
|
|
16284
|
-
const problemsIn$
|
|
15938
|
+
const problemsIn$12 = (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 }) => ({
|
|
16285
15939
|
file: absolute(file),
|
|
16286
15940
|
...positionOf(text)(match.index ?? START$22),
|
|
16287
|
-
rule: RULE$
|
|
15941
|
+
rule: RULE$35,
|
|
16288
15942
|
message: `${match[START$22]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
16289
15943
|
})), Option.toArray)));
|
|
16290
15944
|
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$11), Array$1.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
@@ -16309,14 +15963,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
16309
15963
|
file: absolute(Array$1.headNonEmpty(commanded).file),
|
|
16310
15964
|
line: ONE$2,
|
|
16311
15965
|
column: ONE$2,
|
|
16312
|
-
rule: RULE$
|
|
15966
|
+
rule: RULE$35,
|
|
16313
15967
|
message: "msch could not list the tasks with `vp run --json`"
|
|
16314
15968
|
}],
|
|
16315
|
-
onSome: (found) => pipe(commanded, Array$1.flatMap((document) => problemsIn$
|
|
15969
|
+
onSome: (found) => pipe(commanded, Array$1.flatMap((document) => problemsIn$12(found, absolute, document)))
|
|
16316
15970
|
});
|
|
16317
15971
|
});
|
|
16318
15972
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
16319
|
-
const RULE$
|
|
15973
|
+
const RULE$34 = "legacy-web";
|
|
16320
15974
|
const FIRST_COLUMN$7 = 1;
|
|
16321
15975
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
16322
15976
|
const Finding = Schema.Struct({
|
|
@@ -16355,7 +16009,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
16355
16009
|
file: files.join(root, file),
|
|
16356
16010
|
line,
|
|
16357
16011
|
column: FIRST_COLUMN$7,
|
|
16358
|
-
rule: RULE$
|
|
16012
|
+
rule: RULE$34,
|
|
16359
16013
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
16360
16014
|
});
|
|
16361
16015
|
return pipe(scan.guides, Array$1.flatMap(({ guideId, rules }) => pipe(rules, Array$1.flatMap(({ ruleId, findings }) => pipe(findings, Array$1.map(problemOf(guideId, ruleId)))))));
|
|
@@ -16425,9 +16079,9 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
16425
16079
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
16426
16080
|
const EXTENSION$1 = /\.[^./]+$/u;
|
|
16427
16081
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
16428
|
-
const READ_CONCURRENCY$
|
|
16429
|
-
const RULE$
|
|
16430
|
-
const MESSAGE$
|
|
16082
|
+
const READ_CONCURRENCY$17 = 64;
|
|
16083
|
+
const RULE$33 = "shell-script";
|
|
16084
|
+
const MESSAGE$8 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
|
|
16431
16085
|
const HookSchema = Schema.Struct({
|
|
16432
16086
|
command: Schema.optional(Schema.String),
|
|
16433
16087
|
args: Schema.String.pipe(Schema.Array, Schema.optional)
|
|
@@ -16458,65 +16112,8 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
16458
16112
|
return files.readFile(file).pipe(Effect.map(Option.exists((source) => SHELL_SHEBANG.test(source))));
|
|
16459
16113
|
};
|
|
16460
16114
|
const candidates = pipe(names, Array$1.filter((name) => !isSessionStartHook(name)));
|
|
16461
|
-
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$
|
|
16462
|
-
return pipe(shell, Array$1.map((name) => problemInFile(RULE$
|
|
16463
|
-
});
|
|
16464
|
-
// src/shared/lib/workflow-files.ts
|
|
16465
|
-
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
16466
|
-
const READ_CONCURRENCY$17 = 16;
|
|
16467
|
-
const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
16468
|
-
const files = yield* RepositoryFiles;
|
|
16469
|
-
const names = yield* files.listedFiles(root);
|
|
16470
|
-
const found = yield* Effect.forEach(pipe(names, Array$1.filter((name) => WORKFLOW_FILE.test(name))), (name) => {
|
|
16471
|
-
const file = files.join(root, name);
|
|
16472
|
-
return files.readFile(file).pipe(Effect.map(Option.map((source) => ({
|
|
16473
|
-
file,
|
|
16474
|
-
source
|
|
16475
|
-
}))));
|
|
16476
|
-
}, { concurrency: READ_CONCURRENCY$17 });
|
|
16477
|
-
return Array$1.getSomes(found);
|
|
16478
|
-
});
|
|
16479
|
-
// src/shared/lib/workflow-run.ts
|
|
16480
|
-
const RUN_KEY = "run";
|
|
16481
|
-
const START$21 = 0;
|
|
16482
|
-
const startOf$1 = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$21));
|
|
16483
|
-
const runScriptsOf = (source) => {
|
|
16484
|
-
const found = [];
|
|
16485
|
-
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
16486
|
-
if (isPair(pair) && isScalar(pair.key) && pair.key.value === RUN_KEY && isScalar(pair.value) && typeof pair.value.value === "string") found.push({
|
|
16487
|
-
text: pair.value.value,
|
|
16488
|
-
start: startOf$1(pair.value.range)
|
|
16489
|
-
});
|
|
16490
|
-
} });
|
|
16491
|
-
return found;
|
|
16492
|
-
};
|
|
16493
|
-
// src/features/check-scripts/model/workflows.ts
|
|
16494
|
-
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
16495
|
-
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
16496
|
-
const COMMENT = "#";
|
|
16497
|
-
const RULE$38 = "workflow-script";
|
|
16498
|
-
const ONE_COMMAND = 1;
|
|
16499
|
-
const MESSAGE$13 = "runs more than one command. Keep a step to one command, `vp run <task>` or `vp exec <bin>`, and put the logic in a Vite+ task in TypeScript.";
|
|
16500
|
-
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
16501
|
-
const chainsCommands = (line) => COMMAND_CHAIN.test(String$1.replaceAll(QUOTED$1, "")(line));
|
|
16502
|
-
const runsMoreThanOneCommand = ({ text }) => {
|
|
16503
|
-
const lines = pipe(String$1.split("\n")(text), Array$1.map(String$1.trim), Array$1.filter(isCommand));
|
|
16504
|
-
return lines.length > ONE_COMMAND || pipe(lines, Array$1.some(chainsCommands));
|
|
16505
|
-
};
|
|
16506
|
-
const problemsIn$12 = (file) => (source) => {
|
|
16507
|
-
const at = positionOf(source);
|
|
16508
|
-
return pipe(runScriptsOf(source), Array$1.filter(runsMoreThanOneCommand), Array$1.map(({ start }) => problemAtPosition(RULE$38)(file, at(start), MESSAGE$13)));
|
|
16509
|
-
};
|
|
16510
|
-
/** @internal */
|
|
16511
|
-
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
16512
|
-
const workflows = yield* readWorkflows(root);
|
|
16513
|
-
return pipe(workflows, Array$1.flatMap(({ file, source }) => problemsIn$12(file)(source)));
|
|
16514
|
-
});
|
|
16515
|
-
// src/features/check-scripts/model/script-checks.ts
|
|
16516
|
-
/** @internal */
|
|
16517
|
-
const checkScripts = Effect.fn("checkScripts")(function* checkScripts(root) {
|
|
16518
|
-
const found = yield* Effect.all([checkShellScripts(root), checkWorkflows(root)], { concurrency: "unbounded" });
|
|
16519
|
-
return Array$1.flatten(found);
|
|
16115
|
+
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$17 });
|
|
16116
|
+
return pipe(shell, Array$1.map((name) => problemInFile(RULE$33)(files.join(root, name), MESSAGE$8)));
|
|
16520
16117
|
});
|
|
16521
16118
|
// src/features/check-structure/model/structure.ts
|
|
16522
16119
|
const checkStructure = checkSection({
|
|
@@ -16590,6 +16187,20 @@ const problemsOf = (source) => pipe(simpleCommands(source.text), Array$1.flatMap
|
|
|
16590
16187
|
message: message(String$1.trim(Array$1.join(words, " ")))
|
|
16591
16188
|
})))));
|
|
16592
16189
|
const commandProblems$2 = (sources) => pipe(sources, Array$1.flatMap(problemsOf));
|
|
16190
|
+
// src/shared/lib/workflow-run.ts
|
|
16191
|
+
const RUN_KEY = "run";
|
|
16192
|
+
const START$21 = 0;
|
|
16193
|
+
const startOf$1 = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$21));
|
|
16194
|
+
const runScriptsOf = (source) => {
|
|
16195
|
+
const found = [];
|
|
16196
|
+
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
16197
|
+
if (isPair(pair) && isScalar(pair.key) && pair.key.value === RUN_KEY && isScalar(pair.value) && typeof pair.value.value === "string") found.push({
|
|
16198
|
+
text: pair.value.value,
|
|
16199
|
+
start: startOf$1(pair.value.range)
|
|
16200
|
+
});
|
|
16201
|
+
} });
|
|
16202
|
+
return found;
|
|
16203
|
+
};
|
|
16593
16204
|
// src/features/check-vite-plus/model/doc-sources.ts
|
|
16594
16205
|
const FENCE$2 = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \t]*\n)(?<body>[\s\S]*?)^```[ \t]*$/gmu;
|
|
16595
16206
|
const INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\n]+)`(?!`)/gu;
|
|
@@ -16740,7 +16351,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
16740
16351
|
return Array$1.flatten(found);
|
|
16741
16352
|
});
|
|
16742
16353
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
16743
|
-
const RULE$
|
|
16354
|
+
const RULE$32 = "package-script";
|
|
16744
16355
|
const LIFECYCLE = [
|
|
16745
16356
|
"preinstall",
|
|
16746
16357
|
"install",
|
|
@@ -16763,26 +16374,26 @@ const LIFECYCLE = [
|
|
|
16763
16374
|
const problemOf$6 = ({ file, position, name }) => ({
|
|
16764
16375
|
file,
|
|
16765
16376
|
...position,
|
|
16766
|
-
rule: RULE$
|
|
16377
|
+
rule: RULE$32,
|
|
16767
16378
|
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.`
|
|
16768
16379
|
});
|
|
16769
16380
|
const packageScriptProblems = (sources) => pipe(sources, Array$1.filter(({ kind, name }) => kind === "script" && !Array$1.contains(LIFECYCLE, name)), Array$1.map(problemOf$6));
|
|
16770
16381
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
16771
|
-
const RULE$
|
|
16382
|
+
const RULE$31 = "vite-plus-block";
|
|
16772
16383
|
const MARKER = Array$1.join([
|
|
16773
16384
|
"<!--",
|
|
16774
16385
|
"VITE PLUS START",
|
|
16775
16386
|
"-->"
|
|
16776
16387
|
], "");
|
|
16777
|
-
const MESSAGE$
|
|
16388
|
+
const MESSAGE$7 = "holds the Vite+ block that `vp create --agent` and `vp migrate --agent` write, and every `vp config` rewrites it. Delete the block with its markers. The vite-plus skill reads the same guidance from node_modules/vite-plus/AGENTS.md.";
|
|
16778
16389
|
const problemIn = (file) => (source) => {
|
|
16779
16390
|
const index = String$1.indexOf(MARKER)(source);
|
|
16780
16391
|
if (Option.isNone(index)) return Option.none();
|
|
16781
16392
|
return Option.some({
|
|
16782
16393
|
file,
|
|
16783
16394
|
...positionOf(source)(index.value),
|
|
16784
|
-
rule: RULE$
|
|
16785
|
-
message: MESSAGE$
|
|
16395
|
+
rule: RULE$31,
|
|
16396
|
+
message: MESSAGE$7
|
|
16786
16397
|
});
|
|
16787
16398
|
};
|
|
16788
16399
|
/** @internal */
|
|
@@ -16797,51 +16408,6 @@ const checkVitePlus = Effect.fn("checkVitePlus")(function* checkVitePlus(root) {
|
|
|
16797
16408
|
...blocks
|
|
16798
16409
|
];
|
|
16799
16410
|
});
|
|
16800
|
-
// src/features/check-workflows/model/workflow-yaml.ts
|
|
16801
|
-
const pairsNamed = (name) => (source) => {
|
|
16802
|
-
const found = [];
|
|
16803
|
-
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
16804
|
-
if (isPair(pair) && isScalar(pair.key) && pair.key.value === name) found.push(pair);
|
|
16805
|
-
} });
|
|
16806
|
-
return found;
|
|
16807
|
-
};
|
|
16808
|
-
const pairIn = (name) => (node) => pipe(Option.liftPredicate(node, isMap), Option.flatMap((map) => Array$1.findFirst(map.items, (item) => isScalar(item.key) && item.key.value === name)));
|
|
16809
|
-
const keyOffsetIn = (name) => (node) => pipe(pairIn(name)(node), Option.flatMap(({ key }) => Option.liftPredicate(key, isScalar)), Option.flatMap((key) => Option.fromNullishOr(key.range)), Option.map(([start]) => start));
|
|
16810
|
-
const workflowCheck = ({ rule, message, offsetsOf }) => Effect.fn(rule)(function* checkWorkflows(root) {
|
|
16811
|
-
const workflows = yield* readWorkflows(root);
|
|
16812
|
-
return pipe(workflows, Array$1.flatMap(({ file, source }) => {
|
|
16813
|
-
const at = positionOf(source);
|
|
16814
|
-
return pipe(offsetsOf(source), Array$1.map((offset) => {
|
|
16815
|
-
const { line, column } = at(offset);
|
|
16816
|
-
return {
|
|
16817
|
-
file,
|
|
16818
|
-
line,
|
|
16819
|
-
column,
|
|
16820
|
-
rule,
|
|
16821
|
-
message
|
|
16822
|
-
};
|
|
16823
|
-
}));
|
|
16824
|
-
}));
|
|
16825
|
-
});
|
|
16826
|
-
const scalarKeyOffsets = ({ name, matches }) => (source) => pipe(pairsNamed(name)(source), Array$1.filter(({ value }) => isScalar(value) && matches(String(value.value))), Array$1.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap((scalar) => Option.fromNullishOr(scalar.range)), Option.map(([start]) => start), Option.toArray)));
|
|
16827
|
-
const triggersOf = (node) => {
|
|
16828
|
-
if (isScalar(node)) return [String(node.value)];
|
|
16829
|
-
if (isSeq(node)) return pipe(node.items, Array$1.filter(isScalar), Array$1.map((item) => String(item.value)));
|
|
16830
|
-
if (isMap(node)) return pipe(node.items, Array$1.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.map((scalar) => String(scalar.value)), Option.toArray)));
|
|
16831
|
-
return [];
|
|
16832
|
-
};
|
|
16833
|
-
// src/features/check-workflows/model/full-history-checkout.ts
|
|
16834
|
-
const DEPTH_KEY = "fetch-depth";
|
|
16835
|
-
const WHOLE_HISTORY = "0";
|
|
16836
|
-
/** @internal */
|
|
16837
|
-
const checkFullHistoryCheckout = workflowCheck({
|
|
16838
|
-
rule: "full-history-checkout",
|
|
16839
|
-
message: "fetches the whole history with `fetch-depth: 0`. Fetch only the commits the job reads.",
|
|
16840
|
-
offsetsOf: scalarKeyOffsets({
|
|
16841
|
-
name: DEPTH_KEY,
|
|
16842
|
-
matches: (value) => value === WHOLE_HISTORY
|
|
16843
|
-
})
|
|
16844
|
-
});
|
|
16845
16411
|
// src/features/check-workflows/model/ci-drift.ts
|
|
16846
16412
|
const SETUP_RULE$1 = "ci-setup";
|
|
16847
16413
|
const REF_RULE = "ci-template-ref";
|
|
@@ -16858,100 +16424,23 @@ const checkCiDrift = Effect.fn("checkCiDrift")(function* checkCiDrift(root) {
|
|
|
16858
16424
|
const drifts = yield* findCiDrift(root);
|
|
16859
16425
|
return pipe(drifts, Array$1.map(problemOf$5));
|
|
16860
16426
|
});
|
|
16861
|
-
// src/features/check-workflows/model/publish-trigger.ts
|
|
16862
|
-
const RULE$34 = "publish-trigger";
|
|
16863
|
-
const PUBLISH = /\bmsch\s+publish\s+(?:plan|npm|release)\b/u;
|
|
16864
|
-
const MANUAL = "workflow_dispatch";
|
|
16865
|
-
const TRIGGER_KEY$1 = "on";
|
|
16866
|
-
const MESSAGE$10 = "publishes with `msch publish plan`, `npm` or `release` from a trigger other than `workflow_dispatch`. Keep those steps in a workflow that only `workflow_dispatch` starts, and start it on a push to main with `msch publish dispatch`.";
|
|
16867
|
-
const publishTriggerOffsetsOf = (source) => {
|
|
16868
|
-
if (!pipe(runScriptsOf(source), Array$1.some(({ text }) => PUBLISH.test(text)))) return [];
|
|
16869
|
-
const { contents } = parseDocument(source);
|
|
16870
|
-
const triggers = pipe(pairIn(TRIGGER_KEY$1)(contents), Option.map(({ value }) => triggersOf(value)), Option.getOrElse(() => []));
|
|
16871
|
-
if (pipe(triggers, Array$1.every((trigger) => trigger === MANUAL))) return [];
|
|
16872
|
-
return Option.toArray(keyOffsetIn(TRIGGER_KEY$1)(contents));
|
|
16873
|
-
};
|
|
16874
|
-
/** @internal */
|
|
16875
|
-
const checkPublishTrigger = workflowCheck({
|
|
16876
|
-
rule: RULE$34,
|
|
16877
|
-
message: MESSAGE$10,
|
|
16878
|
-
offsetsOf: publishTriggerOffsetsOf
|
|
16879
|
-
});
|
|
16880
16427
|
// src/features/check-workflows/model/release-please.ts
|
|
16881
|
-
const RULE$
|
|
16882
|
-
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
16428
|
+
const RULE$30 = "release-please";
|
|
16883
16429
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
16884
16430
|
const FIRST$8 = 1;
|
|
16885
|
-
const MESSAGE$
|
|
16886
|
-
|
|
16887
|
-
|
|
16888
|
-
message: MESSAGE$9,
|
|
16889
|
-
offsetsOf: scalarKeyOffsets({
|
|
16890
|
-
name: "uses",
|
|
16891
|
-
matches: (value) => RELEASE_PLEASE.test(value)
|
|
16892
|
-
})
|
|
16893
|
-
});
|
|
16894
|
-
const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* checkReleasePleaseFiles(root) {
|
|
16431
|
+
const MESSAGE$6 = "releases with release-please. Releases are manual: bump the version in a PR, then run the publish workflow, which runs `msch publish` for the workspace.";
|
|
16432
|
+
/** @internal */
|
|
16433
|
+
const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleasePlease(root) {
|
|
16895
16434
|
const files = yield* RepositoryFiles;
|
|
16896
16435
|
const names = yield* files.listedFiles(root);
|
|
16897
16436
|
return pipe(names, Array$1.filter((name) => RELEASE_PLEASE_FILE.test(name)), Array$1.map((name) => ({
|
|
16898
16437
|
file: files.join(root, name),
|
|
16899
16438
|
line: FIRST$8,
|
|
16900
16439
|
column: FIRST$8,
|
|
16901
|
-
rule: RULE$
|
|
16902
|
-
message: MESSAGE$
|
|
16440
|
+
rule: RULE$30,
|
|
16441
|
+
message: MESSAGE$6
|
|
16903
16442
|
})));
|
|
16904
16443
|
});
|
|
16905
|
-
/** @internal */
|
|
16906
|
-
const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleasePlease(root) {
|
|
16907
|
-
const found = yield* Effect.all([checkReleasePleaseSteps(root), checkReleasePleaseFiles(root)], { concurrency: "unbounded" });
|
|
16908
|
-
return Array$1.flatten(found);
|
|
16909
|
-
});
|
|
16910
|
-
// src/features/check-workflows/model/workflow-cancel.ts
|
|
16911
|
-
const RULE$32 = "workflow-cancel";
|
|
16912
|
-
const PUSH = "push";
|
|
16913
|
-
const TRIGGER_KEY = "on";
|
|
16914
|
-
const CONCURRENCY_KEY$1 = "concurrency";
|
|
16915
|
-
const CANCEL_KEY = "cancel-in-progress";
|
|
16916
|
-
const TRUE = "true";
|
|
16917
|
-
const MESSAGE$8 = "cancels in progress for the whole workflow that a push starts. A newer push then stops a deploy that is running and leaves it half done. Put `cancel-in-progress: true` on the `concurrency` of the jobs that a later push redoes, and leave the deploy and release jobs on the default.";
|
|
16918
|
-
const cancelsOnPush = (contents) => pipe(pairIn(TRIGGER_KEY)(contents), Option.map(({ value }) => triggersOf(value)), Option.exists(Array$1.contains(PUSH)));
|
|
16919
|
-
const cancelOffsetsOf = (source) => {
|
|
16920
|
-
const { contents } = parseDocument(source);
|
|
16921
|
-
if (!cancelsOnPush(contents)) return [];
|
|
16922
|
-
return pipe(pairIn(CONCURRENCY_KEY$1)(contents), Option.flatMap((concurrency) => pipe(pairIn(CANCEL_KEY)(concurrency.value), Option.filter(({ value }) => isScalar(value) && String(value.value) === TRUE), Option.flatMap(() => keyOffsetIn(CANCEL_KEY)(concurrency.value)))), Option.toArray);
|
|
16923
|
-
};
|
|
16924
|
-
/** @internal */
|
|
16925
|
-
const checkWorkflowCancel = workflowCheck({
|
|
16926
|
-
rule: RULE$32,
|
|
16927
|
-
message: MESSAGE$8,
|
|
16928
|
-
offsetsOf: cancelOffsetsOf
|
|
16929
|
-
});
|
|
16930
|
-
// src/features/check-workflows/model/workflow-queue.ts
|
|
16931
|
-
const CONCURRENCY_KEY = "concurrency";
|
|
16932
|
-
const QUEUE_KEY = "queue";
|
|
16933
|
-
const RULE$31 = "workflow-queue";
|
|
16934
|
-
const MESSAGE$7 = "queues runs with `queue`. A queued group runs every old push one by one, so a long run holds back the newest commit for hours. Drop `queue`: a job that later pushes redo gets `cancel-in-progress: true`, and a deploy or release job keeps the default, which lets the running one finish and replaces the waiting one with the newest run.";
|
|
16935
|
-
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array$1.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
16936
|
-
/** @internal */
|
|
16937
|
-
const checkWorkflowQueues = workflowCheck({
|
|
16938
|
-
rule: RULE$31,
|
|
16939
|
-
message: MESSAGE$7,
|
|
16940
|
-
offsetsOf: queueOffsetsOf
|
|
16941
|
-
});
|
|
16942
|
-
// src/features/check-workflows/model/workflow-commits.ts
|
|
16943
|
-
const RULE$30 = "workflow-commit";
|
|
16944
|
-
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
16945
|
-
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
16946
|
-
const MESSAGE$6 = "commits or pushes from a workflow. A bot commit leaves generated files out of review and races the next push. Regenerate the files in a commit hook (for example `.vite-hooks/pre-commit`) so they land in the author's commit, and let CI only check that they are current.";
|
|
16947
|
-
const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source), Array$1.filter(({ value }) => isScalar(value) && typeof value.value === "string" && pattern.test(value.value)), Array$1.flatMap(({ key }) => pipe(Option.liftPredicate(key, isScalar), Option.flatMap(({ range }) => Option.fromNullishOr(range)), Option.map(([start]) => start), Option.toArray)));
|
|
16948
|
-
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
16949
|
-
/** @internal */
|
|
16950
|
-
const checkWorkflowCommits = workflowCheck({
|
|
16951
|
-
rule: RULE$30,
|
|
16952
|
-
message: MESSAGE$6,
|
|
16953
|
-
offsetsOf: commitOffsetsOf
|
|
16954
|
-
});
|
|
16955
16444
|
// src/features/check-workflows/model/workflow-lint.ts
|
|
16956
16445
|
const checkWorkflowLint = checkSection({
|
|
16957
16446
|
name: "checkWorkflowLint",
|
|
@@ -16968,14 +16457,9 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
|
|
|
16968
16457
|
checkVitePlus(root),
|
|
16969
16458
|
checkMissingHooks(root),
|
|
16970
16459
|
checkKnownPlugins(root),
|
|
16971
|
-
|
|
16972
|
-
checkWorkflowQueues(root),
|
|
16973
|
-
checkWorkflowCancel(root),
|
|
16974
|
-
checkWorkflowCommits(root),
|
|
16460
|
+
checkShellScripts(root),
|
|
16975
16461
|
checkCiDrift(root),
|
|
16976
|
-
checkFullHistoryCheckout(root),
|
|
16977
16462
|
checkReleasePlease(root),
|
|
16978
|
-
checkPublishTrigger(root),
|
|
16979
16463
|
checkRestrictedRules(root),
|
|
16980
16464
|
checkTypeExemptions(root),
|
|
16981
16465
|
checkMarkdown(root),
|