@r_masseater/msch 0.89.1 → 0.90.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +1045 -584
- package/dist/cli.mjs.map +1 -1
- package/dist/exits.mjs +1 -1
- package/dist/{upstream-exits-DtxgldU3.mjs → upstream-exits-nTTh2qcD.mjs} +2 -2
- package/dist/{upstream-exits-DtxgldU3.mjs.map → upstream-exits-nTTh2qcD.mjs.map} +1 -1
- package/dist/wake.mjs +1 -1
- package/package.json +2 -2
package/dist/cli.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { C as valueKey, S as schemaTypeOf, _ as formatValues, a as nearestManifestDirectory, b as literalValuesOf, c as listConfigFiles, d as withProject, f as declarationKey, g as finiteValuesOf, h as locationOf, i as installedPackages, l as mentions$1, m as isObjectType, n as keepOnly, o as projectInputs, p as describeLibraryType, r as recordsIn, t as contentKey, u as typeScriptCompiler, v as isSubsetOf, w as vocabularyOf, x as sameValues, y as literalUnionOf } from "./pass-records-CBvMwfN3.mjs";
|
|
3
|
-
import { n as NODE_MODULES, o as TOOL_NAME, r as RepositoryFiles, s as groupOf, t as MSCH_CACHE } from "./repository-files-B6PEvKWe.mjs";
|
|
3
|
+
import { n as NODE_MODULES, o as TOOL_NAME$1, r as RepositoryFiles, s as groupOf, t as MSCH_CACHE } from "./repository-files-B6PEvKWe.mjs";
|
|
4
4
|
import { t as workspaceManifest } from "./workspace-manifest-BAVyPzbA.mjs";
|
|
5
|
-
import { a as workspaceDeviations, c as tomlSourceComments, d as problemAtIndex, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-
|
|
5
|
+
import { a as workspaceDeviations, c as tomlSourceComments, d as problemAtIndex, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits, u as positionOf } from "./upstream-exits-nTTh2qcD.mjs";
|
|
6
6
|
import { a as parent, i as join, n as isInside, t as baseName } from "./path-DUttmo2s.mjs";
|
|
7
7
|
import { i as workspaceProjects, n as unmatchedWorkspacePatterns, o as installedManifest, r as workspaceDirectories, s as readManifest, t as publishedProjects } from "./workspace-projects-B-vCr6bx.mjs";
|
|
8
8
|
import { $ as isIdentifier, A as uniqueByReference, B as getTextOfJSDocComment, C as moduleSpecifierOf, E as referencedSymbols, F as SymbolFlags, G as isCallExpression, H as isArrowFunction, I as SyntaxKind, J as isEnumDeclaration, K as isClassDeclaration, L as getJSDocTags, O as symbolAt, P as SignatureKind, Q as isFunctionExpression, 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$7, it as isNewExpression, k as symbolAtLocation, l as childrenOf$1, 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, 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$3, xt as isVariableDeclarationList, y as isOutsideDeclaration, yt as isUnionTypeNode, z as getNameOfDeclaration } from "./problem-CUIz4TEI.mjs";
|
|
@@ -27,9 +27,9 @@ import { PACKAGE_JSON_FILE, RUNTIME_SECTIONS, binEntriesOf, namesIn, optionalPee
|
|
|
27
27
|
import { findPackageJson } from "@r_masseater/masseater-utils/kestrion/node";
|
|
28
28
|
import { decodePackageJson } from "@r_masseater/masseater-utils/kestrion/npm";
|
|
29
29
|
import { parse, resolveConfigFromFile } from "vite-plus";
|
|
30
|
+
import { isMap, isPair, isScalar, isSeq, parse as parse$1, parseDocument, visit } from "yaml";
|
|
30
31
|
import { fileURLToPath } from "node:url";
|
|
31
32
|
import { getStaticTOMLValue, parseTOML } from "toml-eslint-parser";
|
|
32
|
-
import { isMap, isPair, isScalar, isSeq, parse as parse$1, parseDocument, visit } from "yaml";
|
|
33
33
|
import { rolldown } from "rolldown";
|
|
34
34
|
import { stripVTControlCharacters } from "node:util";
|
|
35
35
|
import semver from "semver";
|
|
@@ -188,7 +188,7 @@ const namedWorkspaces = Effect.fn("namedWorkspaces")(function* namedWorkspaces(r
|
|
|
188
188
|
return pipe(projects, Array$1.map(namedIn((directory) => files.basename(directory))));
|
|
189
189
|
});
|
|
190
190
|
// src/entities/workspace/model/cargo-crates.ts
|
|
191
|
-
const SEPARATOR$
|
|
191
|
+
const SEPARATOR$24 = "/";
|
|
192
192
|
const SUCCESS$1 = 0;
|
|
193
193
|
const CrateTarget = Schema.Struct({ kind: Schema.Array(Schema.String) });
|
|
194
194
|
const CrateDependency = Schema.Struct({ path: Schema.optional(Schema.String) });
|
|
@@ -228,9 +228,100 @@ const cratesIn = Effect.fn("cratesIn")(function* cratesIn(root) {
|
|
|
228
228
|
}, Effect.scoped);
|
|
229
229
|
/** @internal */
|
|
230
230
|
const owningWorkspace = (directories) => (directory) => {
|
|
231
|
-
const owners = pipe(directories, Array$1.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$
|
|
231
|
+
const owners = pipe(directories, Array$1.filter((workspace) => directory === workspace || String$1.startsWith(`${workspace}${SEPARATOR$24}`)(directory)));
|
|
232
232
|
return Array$1.last(Array$1.sort(owners, String$1.Order));
|
|
233
233
|
};
|
|
234
|
+
// src/shared/lib/frontmatter.ts
|
|
235
|
+
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
236
|
+
const START$30 = 0;
|
|
237
|
+
const Fields = Schema.Record(Schema.String, Schema.Unknown);
|
|
238
|
+
const decodeFields$1 = Schema.decodeUnknownOption(Fields);
|
|
239
|
+
const splitFrontmatter = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.flatMap((found) => pipe(groupOf("yaml")(found), Option.flatMap(Option.liftThrowable((yaml) => parse$1(yaml))), Option.flatMap(decodeFields$1), Option.map((fields) => ({
|
|
240
|
+
fields,
|
|
241
|
+
body: String$1.slice(found[START$30].length)(source)
|
|
242
|
+
})))));
|
|
243
|
+
// src/entities/workspace/model/plugins.ts
|
|
244
|
+
const PLUGIN_FILE$2 = ".claude-plugin/plugin.json";
|
|
245
|
+
const SKILLS_DIRECTORY = "skills";
|
|
246
|
+
const SKILL_FILE$3 = "SKILL.md";
|
|
247
|
+
const CONCURRENCY$4 = 16;
|
|
248
|
+
const SEPARATOR$23 = "/";
|
|
249
|
+
const PluginManifest$1 = Schema.fromJsonString(Schema.Struct({
|
|
250
|
+
name: Schema.String,
|
|
251
|
+
description: Schema.optionalKey(Schema.String),
|
|
252
|
+
version: Schema.optionalKey(Schema.Unknown)
|
|
253
|
+
}));
|
|
254
|
+
const decodeManifest = Schema.decodeUnknownOption(PluginManifest$1);
|
|
255
|
+
const bySkillName = Order.mapInput(String$1.Order, ({ name }) => name);
|
|
256
|
+
const skillIn = Effect.fn("skillIn")(function* skillIn(scan, { plugin, skills }, name) {
|
|
257
|
+
const files = yield* RepositoryFiles;
|
|
258
|
+
const directory = files.join(skills, name);
|
|
259
|
+
const file = files.join(directory, SKILL_FILE$3);
|
|
260
|
+
const source = yield* files.readFile(file);
|
|
261
|
+
const prefix = `${files.relative(scan.root, directory)}${SEPARATOR$23}`;
|
|
262
|
+
const inside = pipe(scan.listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.map((entry) => files.join(scan.root, entry)));
|
|
263
|
+
return pipe(source, Option.flatMap((text) => pipe(splitFrontmatter(text), Option.map((frontmatter) => ({
|
|
264
|
+
plugin,
|
|
265
|
+
name,
|
|
266
|
+
directory,
|
|
267
|
+
file,
|
|
268
|
+
source: text,
|
|
269
|
+
frontmatter,
|
|
270
|
+
files: inside
|
|
271
|
+
})))));
|
|
272
|
+
});
|
|
273
|
+
const filesUnder = Effect.fn("filesUnder")(function* filesUnder(scan, directory) {
|
|
274
|
+
const prefix = `${(yield* RepositoryFiles).relative(scan.root, directory)}${SEPARATOR$23}`;
|
|
275
|
+
return pipe(scan.listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.map(String$1.slice(prefix.length)));
|
|
276
|
+
});
|
|
277
|
+
const skillsOf = Effect.fn("skillsOf")(function* skillsOf(scan, plugin, directory) {
|
|
278
|
+
const files = yield* RepositoryFiles;
|
|
279
|
+
const skills = files.join(directory, SKILLS_DIRECTORY);
|
|
280
|
+
const names = yield* files.readDirectory(skills);
|
|
281
|
+
const found = yield* Effect.forEach(names, (entry) => skillIn(scan, {
|
|
282
|
+
plugin,
|
|
283
|
+
skills
|
|
284
|
+
}, entry), { concurrency: CONCURRENCY$4 });
|
|
285
|
+
return Array$1.sort(Array$1.getSomes(found), bySkillName);
|
|
286
|
+
});
|
|
287
|
+
const pluginAt = Effect.fn("pluginAt")(function* pluginAt(scan, directory) {
|
|
288
|
+
const files = yield* RepositoryFiles;
|
|
289
|
+
const manifest = yield* files.readFile(files.join(directory, PLUGIN_FILE$2));
|
|
290
|
+
const decoded = pipe(manifest, Option.flatMap(decodeManifest));
|
|
291
|
+
if (Option.isNone(decoded)) return Option.none();
|
|
292
|
+
const { name } = decoded.value;
|
|
293
|
+
const inside = yield* filesUnder(scan, directory);
|
|
294
|
+
const skills = yield* skillsOf(scan, name, directory);
|
|
295
|
+
return Option.some({
|
|
296
|
+
name,
|
|
297
|
+
directory,
|
|
298
|
+
description: Option.fromUndefinedOr(decoded.value.description),
|
|
299
|
+
versioned: "version" in decoded.value,
|
|
300
|
+
files: inside,
|
|
301
|
+
skills
|
|
302
|
+
});
|
|
303
|
+
});
|
|
304
|
+
/** @internal */
|
|
305
|
+
const pluginsIn$1 = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
306
|
+
const files = yield* RepositoryFiles;
|
|
307
|
+
const projects = yield* workspaceProjects(root);
|
|
308
|
+
const listed = yield* files.listedFiles(root);
|
|
309
|
+
const found = yield* Effect.forEach(projects, ({ directory }) => pluginAt({
|
|
310
|
+
root,
|
|
311
|
+
listed
|
|
312
|
+
}, files.join(root, directory)), { concurrency: CONCURRENCY$4 });
|
|
313
|
+
return Array$1.getSomes(found);
|
|
314
|
+
});
|
|
315
|
+
const HYPHENATED = "-";
|
|
316
|
+
const BACKTICK$1 = "`";
|
|
317
|
+
const namePattern = (skill) => pipe(Option.liftPredicate(skill, String$1.includes(HYPHENATED)), Option.match({
|
|
318
|
+
onNone: () => String.raw`${BACKTICK$1}${skill}${BACKTICK$1}(?!\]\()`,
|
|
319
|
+
onSome: () => String.raw`(?<![\w/.@#-])${skill}(?![\w/#-]|\.[a-z])`
|
|
320
|
+
}));
|
|
321
|
+
/** @internal */
|
|
322
|
+
const namesSkill = (skill) => (text) => new RegExp(namePattern(skill), "u").test(text);
|
|
323
|
+
const SKILLS_START = "<!-- skills:generated -->";
|
|
324
|
+
const SKILLS_END = "<!-- /skills:generated -->";
|
|
234
325
|
// src/features/check-overrides/model/override-resolution.ts
|
|
235
326
|
const VerdictSchema = Schema.Literals([
|
|
236
327
|
"unused",
|
|
@@ -499,58 +590,58 @@ const checkOverrides = Effect.fn("checkOverrides")(function* checkOverrides(root
|
|
|
499
590
|
// src/features/check-overrides/model/git-subpath.ts
|
|
500
591
|
const DEPENDENCY_FILE = /(?:^|\/)(?:package\.json|pnpm-workspace\.ya?ml)$/u;
|
|
501
592
|
const GIT_SUBPATH = /(?<![^\s"':])[^\s"'#]+#(?:[^\s"'&]*&)*path:[^\s"']*/gu;
|
|
502
|
-
const RULE$
|
|
593
|
+
const RULE$76 = "git-subpath-dependency";
|
|
503
594
|
const WHOLE_MATCH$4 = 0;
|
|
504
595
|
const problemAt$6 = ({ file }, source) => (found) => ({
|
|
505
596
|
file,
|
|
506
597
|
...positionOf(source)(found.index ?? WHOLE_MATCH$4),
|
|
507
|
-
rule: RULE$
|
|
598
|
+
rule: RULE$76,
|
|
508
599
|
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])}\`.`
|
|
509
600
|
});
|
|
510
|
-
const problemsIn$
|
|
601
|
+
const problemsIn$25 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(GIT_SUBPATH)(source)), Array$1.map(problemAt$6(entry, source)));
|
|
511
602
|
const isDependencyFile = ({ name }) => DEPENDENCY_FILE.test(name);
|
|
512
603
|
/** @internal */
|
|
513
604
|
const checkGitSubpath = Effect.fn("checkGitSubpath")(function* checkGitSubpath(root) {
|
|
514
605
|
const listed = yield* listedFiles(root);
|
|
515
|
-
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$
|
|
606
|
+
return yield* scanText(pipe(listed, Array$1.filter(isDependencyFile)), problemsIn$25);
|
|
516
607
|
});
|
|
517
608
|
// src/features/check-overrides/model/restricted-rules.ts
|
|
518
|
-
const RULE$
|
|
609
|
+
const RULE$75 = "unnamed-restriction";
|
|
519
610
|
const WHOLE_MATCH$3 = 0;
|
|
520
611
|
const UNNAMED = new RegExp(`(?:[\\w@-]+/)?no-restricted-(?:imports|properties)\\b`, "gu");
|
|
521
|
-
const problemsIn$
|
|
612
|
+
const problemsIn$24 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(UNNAMED)(source)), Array$1.map((found) => ({
|
|
522
613
|
file: entry.file,
|
|
523
614
|
...positionOf(source)(found.index ?? WHOLE_MATCH$3),
|
|
524
|
-
rule: RULE$
|
|
615
|
+
rule: RULE$75,
|
|
525
616
|
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.`
|
|
526
617
|
})));
|
|
527
618
|
/** @internal */
|
|
528
619
|
const checkRestrictedRules = Effect.fn("checkRestrictedRules")(function* checkRestrictedRules(root) {
|
|
529
620
|
const listed = yield* listedFiles(root);
|
|
530
|
-
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$
|
|
621
|
+
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$24);
|
|
531
622
|
});
|
|
532
623
|
// src/features/check-overrides/model/type-exemptions.ts
|
|
533
|
-
const RULE$
|
|
624
|
+
const RULE$74 = "named-type-exemption";
|
|
534
625
|
const WHOLE_MATCH$2 = 0;
|
|
535
626
|
const SPECIFIER = new RegExp(`["']?\\bfrom["']?\\s*:\\s*["'](?:file|lib|package)["']`, "gu");
|
|
536
|
-
const problemsIn$
|
|
627
|
+
const problemsIn$23 = (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(SPECIFIER)(source)), Array$1.map((found) => ({
|
|
537
628
|
file: entry.file,
|
|
538
629
|
...positionOf(source)(found.index ?? WHOLE_MATCH$2),
|
|
539
|
-
rule: RULE$
|
|
630
|
+
rule: RULE$74,
|
|
540
631
|
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."
|
|
541
632
|
})));
|
|
542
633
|
/** @internal */
|
|
543
634
|
const checkTypeExemptions = Effect.fn("checkTypeExemptions")(function* checkTypeExemptions(root) {
|
|
544
635
|
const listed = yield* listedFiles(root);
|
|
545
|
-
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$
|
|
636
|
+
return yield* scanText(pipe(listed, Array$1.filter(isScannedText)), problemsIn$23);
|
|
546
637
|
});
|
|
547
638
|
// src/features/check-overrides/model/package-registry.ts
|
|
548
|
-
const RULE$
|
|
639
|
+
const RULE$73 = "package-registry";
|
|
549
640
|
const WORKSPACE_FILE$6 = "pnpm-workspace.yaml";
|
|
550
641
|
const NPMRC = /(?:^|\/)\.npmrc$/u;
|
|
551
642
|
const WORKSPACE_REGISTRY = /^registry:/mu;
|
|
552
643
|
const NPMRC_REGISTRY = /^[ \t]*registry[ \t]*=[ \t]*(?<value>\S*)/gmu;
|
|
553
|
-
const START$
|
|
644
|
+
const START$29 = 0;
|
|
554
645
|
const reasonOf = (registry) => {
|
|
555
646
|
if (registry === DEFAULT_SETTINGS.installRegistry) return `Installs go through Takumi Guard (${registry}), which blocks known-malicious packages before they are installed.`;
|
|
556
647
|
return `Installs go through ${registry}, the registry msch.installs.registry in the root vite.config.ts names.`;
|
|
@@ -562,11 +653,11 @@ const requiredOf = (registry) => ({
|
|
|
562
653
|
const decodeRegistry = Schema.decodeUnknownOption(Schema.Struct({ registry: Schema.optional(Schema.String) }));
|
|
563
654
|
const registryOf = (manifest) => pipe(decodeRegistry(manifest), Option.flatMap(({ registry }) => Option.fromUndefinedOr(registry)));
|
|
564
655
|
const isRequired = ({ registry }) => (found) => withTrailingSlash(found) === registry;
|
|
565
|
-
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$
|
|
656
|
+
const offsetIn = (found) => pipe(Option.fromNullishOr(found), Option.map(({ index }) => index), Option.getOrElse(() => START$29));
|
|
566
657
|
const workspaceProblem = (required, { file, source }, registry) => ({
|
|
567
658
|
file,
|
|
568
659
|
...positionOf(source)(offsetIn(WORKSPACE_REGISTRY.exec(source))),
|
|
569
|
-
rule: RULE$
|
|
660
|
+
rule: RULE$73,
|
|
570
661
|
message: Option.match(registry, {
|
|
571
662
|
onNone: () => `${required.reason} Set \`registry: ${required.registry}\` in ${WORKSPACE_FILE$6}.`,
|
|
572
663
|
onSome: (value) => `${required.reason} \`registry\` is ${value}. Set it to ${required.registry}.`
|
|
@@ -574,9 +665,9 @@ const workspaceProblem = (required, { file, source }, registry) => ({
|
|
|
574
665
|
});
|
|
575
666
|
const npmrcProblems = (required) => (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(NPMRC_REGISTRY)(source)), Array$1.filter((found) => !Option.exists(groupOf("value")(found), isRequired(required))), Array$1.map((found) => ({
|
|
576
667
|
file: entry.file,
|
|
577
|
-
...positionOf(source)(found.index ?? START$
|
|
578
|
-
rule: RULE$
|
|
579
|
-
message: `${required.reason} This .npmrc overrides it with \`${String$1.trim(found[START$
|
|
668
|
+
...positionOf(source)(found.index ?? START$29),
|
|
669
|
+
rule: RULE$73,
|
|
670
|
+
message: `${required.reason} This .npmrc overrides it with \`${String$1.trim(found[START$29])}\`. Remove the line.`
|
|
580
671
|
})));
|
|
581
672
|
const checkWorkspace = Effect.fn("checkWorkspace")(function* checkWorkspace(root, required) {
|
|
582
673
|
const files = yield* RepositoryFiles;
|
|
@@ -2727,7 +2818,7 @@ const scanPublishedManifests = Effect.fn("scanPublishedManifests")(function* sca
|
|
|
2727
2818
|
})), Option.getOrElse(() => [])));
|
|
2728
2819
|
});
|
|
2729
2820
|
// src/features/check-overrides/model/removed-peers.ts
|
|
2730
|
-
const RULE$
|
|
2821
|
+
const RULE$72 = "removed-peer";
|
|
2731
2822
|
const MSCH$1 = "@r_masseater/msch";
|
|
2732
2823
|
const WORKSPACE_FILE$5 = "pnpm-workspace.yaml";
|
|
2733
2824
|
const REMOVED = "-";
|
|
@@ -2755,7 +2846,7 @@ const problemAt$5 = (file, { key, line, column }) => ({ peer, dependent }) => ({
|
|
|
2755
2846
|
file,
|
|
2756
2847
|
line,
|
|
2757
2848
|
column,
|
|
2758
|
-
rule: RULE$
|
|
2849
|
+
rule: RULE$72,
|
|
2759
2850
|
message: `msch runs ${dependent}, which needs ${peer} as a peer, so removing ${peer} with the override ${key} breaks msch. Remove the override.`
|
|
2760
2851
|
});
|
|
2761
2852
|
const removalsIn = (overrides) => pipe(overrides, Record.filter(isRemoval));
|
|
@@ -2789,7 +2880,7 @@ const checkRemovedPeers = Effect.fn("checkRemovedPeers")(function* checkRemovedP
|
|
|
2789
2880
|
});
|
|
2790
2881
|
});
|
|
2791
2882
|
// src/features/check-placement/model/colocated-git-patterns.ts
|
|
2792
|
-
const RULE$
|
|
2883
|
+
const RULE$71 = "colocated-git-patterns";
|
|
2793
2884
|
const PATTERN_FILES = [":(glob)**/.gitignore", ":(glob)**/.gitattributes"];
|
|
2794
2885
|
const ROOT$3 = ".";
|
|
2795
2886
|
const NEGATION$1 = "!";
|
|
@@ -2799,7 +2890,7 @@ const FLOATING_PREFIX = `${ANY_DEPTH}/`;
|
|
|
2799
2890
|
const LEADING_SLASHES = /^\/+/u;
|
|
2800
2891
|
const TRAILING_SLASHES = /\/+$/u;
|
|
2801
2892
|
const SPACES = /\s+/u;
|
|
2802
|
-
const FIRST$
|
|
2893
|
+
const FIRST$25 = 1;
|
|
2803
2894
|
const READ_CONCURRENCY$33 = 16;
|
|
2804
2895
|
const withoutPrefix = (prefix, text) => {
|
|
2805
2896
|
if (String$1.startsWith(prefix)(text)) return String$1.slice(prefix.length)(text);
|
|
@@ -2824,7 +2915,7 @@ const entryOf$1 = (file, kind, directory) => (line, index) => {
|
|
|
2824
2915
|
file,
|
|
2825
2916
|
kind,
|
|
2826
2917
|
directory,
|
|
2827
|
-
line: index + FIRST$
|
|
2918
|
+
line: index + FIRST$25,
|
|
2828
2919
|
pattern,
|
|
2829
2920
|
values: Array$1.join(values, " ")
|
|
2830
2921
|
});
|
|
@@ -2836,12 +2927,12 @@ const entriesIn$1 = Effect.fn("entriesIn")(function* entriesIn(root, file) {
|
|
|
2836
2927
|
const toEntry = entryOf$1(absolute, files.basename(file), files.dirname(file));
|
|
2837
2928
|
return pipe(Option.getOrElse(text, () => ""), String$1.split("\n"), Array$1.map(toEntry), Array$1.getSomes);
|
|
2838
2929
|
});
|
|
2839
|
-
const patternProblem = (entry, message) => problemAtPosition(RULE$
|
|
2930
|
+
const patternProblem = (entry, message) => problemAtPosition(RULE$71)(entry.file, {
|
|
2840
2931
|
line: entry.line,
|
|
2841
|
-
column: FIRST$
|
|
2932
|
+
column: FIRST$25
|
|
2842
2933
|
}, message);
|
|
2843
2934
|
const misplacedMessage = (kind, workspaces) => {
|
|
2844
|
-
if (workspaces.length === FIRST$
|
|
2935
|
+
if (workspaces.length === FIRST$25) {
|
|
2845
2936
|
const workspace = Array$1.join(workspaces, "");
|
|
2846
2937
|
return `matches only paths inside the workspace ${workspace}. Move it to ${workspace}/${kind} and write it relative to that directory.`;
|
|
2847
2938
|
}
|
|
@@ -2899,14 +2990,14 @@ const checkColocatedGitPatterns = Effect.fn("checkColocatedGitPatterns")(functio
|
|
|
2899
2990
|
return Array$1.getSomes([...misplacedFound, ...repeatedFound]);
|
|
2900
2991
|
});
|
|
2901
2992
|
// src/features/check-placement/model/colocated-tests.ts
|
|
2902
|
-
const RULE$
|
|
2903
|
-
const FIRST$
|
|
2993
|
+
const RULE$70 = "colocated-test";
|
|
2994
|
+
const FIRST$24 = 1;
|
|
2904
2995
|
const READ_CONCURRENCY$32 = 64;
|
|
2905
2996
|
const ROOT_SUBPATH$1 = ".";
|
|
2906
2997
|
const NAME_GROUP = "name";
|
|
2907
2998
|
const SPECIFIER_GROUP = "specifier";
|
|
2908
2999
|
const SCRIPT$2 = /\.[cm]?[jt]sx?$/u;
|
|
2909
|
-
const TEST_FILE$
|
|
3000
|
+
const TEST_FILE$3 = /\.test\.[cm]?[jt]sx?$/u;
|
|
2910
3001
|
const MANIFEST_NAME = /package\.json$/u;
|
|
2911
3002
|
const SEPARATE_TEST_DIRECTORY = /(?:^|\/)(?:__tests__|__mocks__|tests?)\//u;
|
|
2912
3003
|
const SPEC_DIRECTORY = /(?:^|\/)specs?\//u;
|
|
@@ -2920,13 +3011,13 @@ const SIBLING_MESSAGE = "refers to nothing in its own directory. Move the test n
|
|
|
2920
3011
|
const byLength$2 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
2921
3012
|
const problemFor$9 = (test, message) => ({
|
|
2922
3013
|
file: test.file,
|
|
2923
|
-
line: FIRST$
|
|
2924
|
-
column: FIRST$
|
|
2925
|
-
rule: RULE$
|
|
3014
|
+
line: FIRST$24,
|
|
3015
|
+
column: FIRST$24,
|
|
3016
|
+
rule: RULE$70,
|
|
2926
3017
|
message: `${test.base} ${message}`
|
|
2927
3018
|
});
|
|
2928
|
-
const groupsOf$
|
|
2929
|
-
const namesSibling = (source) => pipe([...groupsOf$
|
|
3019
|
+
const groupsOf$2 = (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);
|
|
3020
|
+
const namesSibling = (source) => pipe([...groupsOf$2(source, RELATIVE_REFERENCE, NAME_GROUP), ...groupsOf$2(source, DIRNAME_REFERENCE, NAME_GROUP)], Array$1.some((name) => !TEST_FILE$3.test(name)));
|
|
2930
3021
|
const ownerOf$5 = (packages, name) => {
|
|
2931
3022
|
const owners = pipe(packages, Array$1.filter((directory) => String$1.startsWith(directory)(name)));
|
|
2932
3023
|
return Array$1.last(Array$1.sort(owners, byLength$2));
|
|
@@ -2950,7 +3041,7 @@ const ownSpecifiers = Effect.fn("ownSpecifiers")(function* ownSpecifiers(context
|
|
|
2950
3041
|
});
|
|
2951
3042
|
const refersToOwnDirectory = Effect.fn("refersToOwnDirectory")(function* refersToOwnDirectory(context, test, source) {
|
|
2952
3043
|
if (namesSibling(source)) return true;
|
|
2953
|
-
const specifiers = groupsOf$
|
|
3044
|
+
const specifiers = groupsOf$2(source, MODULE_SPECIFIER, SPECIFIER_GROUP);
|
|
2954
3045
|
if (Array$1.isReadonlyArrayEmpty(specifiers)) return false;
|
|
2955
3046
|
const own = yield* ownSpecifiers(context, test);
|
|
2956
3047
|
return pipe(specifiers, Array$1.some((specifier) => pipe(own, Array$1.contains(specifier))));
|
|
@@ -2963,7 +3054,7 @@ const refersIn = Effect.fn("refersIn")(function* refersIn(context, test) {
|
|
|
2963
3054
|
const inSeparateTestDirectory = (name) => SEPARATE_TEST_DIRECTORY.test(name) || SPEC_DIRECTORY.test(name) && SPEC_FILE.test(name);
|
|
2964
3055
|
const problemIn$8 = Effect.fn("problemIn")(function* problemIn(context, test) {
|
|
2965
3056
|
if (inSeparateTestDirectory(test.name)) return Option.some(problemFor$9(test, DIRECTORY_MESSAGE));
|
|
2966
|
-
if (!TEST_FILE$
|
|
3057
|
+
if (!TEST_FILE$3.test(test.name)) return Option.none();
|
|
2967
3058
|
if (yield* refersIn(context, test)) return Option.none();
|
|
2968
3059
|
return Option.some(problemFor$9(test, SIBLING_MESSAGE));
|
|
2969
3060
|
});
|
|
@@ -3004,26 +3095,26 @@ const agentDocProblems = Effect.fn("agentDocProblems")(function* agentDocProblem
|
|
|
3004
3095
|
});
|
|
3005
3096
|
// src/features/check-placement/model/agent-docs-length.ts
|
|
3006
3097
|
const RECOMMENDED_LINES = 200;
|
|
3007
|
-
const FIRST$
|
|
3008
|
-
const RULE$
|
|
3098
|
+
const FIRST$23 = 1;
|
|
3099
|
+
const RULE$69 = "agent-docs-length";
|
|
3009
3100
|
const lineCount = (source) => pipe(String$1.trimEnd(source), String$1.split("\n")).length;
|
|
3010
3101
|
const problemFor$8 = (file) => (lines) => {
|
|
3011
3102
|
if (lines <= RECOMMENDED_LINES) return Option.none();
|
|
3012
3103
|
return Option.some({
|
|
3013
3104
|
file,
|
|
3014
3105
|
line: 201,
|
|
3015
|
-
column: FIRST$
|
|
3016
|
-
rule: RULE$
|
|
3106
|
+
column: FIRST$23,
|
|
3107
|
+
rule: RULE$69,
|
|
3017
3108
|
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.`
|
|
3018
3109
|
});
|
|
3019
3110
|
};
|
|
3020
3111
|
/** @internal */
|
|
3021
3112
|
const checkAgentDocsLength = (root) => agentDocProblems(root, (file) => (source) => problemFor$8(file)(lineCount(source)));
|
|
3022
3113
|
// src/features/check-placement/model/claude-link.ts
|
|
3023
|
-
const RULE$
|
|
3114
|
+
const RULE$68 = "claude-md-link";
|
|
3024
3115
|
const CLAUDE = "CLAUDE.md";
|
|
3025
3116
|
const AGENTS = "AGENTS.md";
|
|
3026
|
-
const FIRST$
|
|
3117
|
+
const FIRST$22 = 1;
|
|
3027
3118
|
const READ_CONCURRENCY$30 = 16;
|
|
3028
3119
|
const MESSAGE$19 = "CLAUDE.md must be a symbolic link to AGENTS.md";
|
|
3029
3120
|
/** @internal */
|
|
@@ -3037,9 +3128,9 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3037
3128
|
const pointsElsewhere = pipe(target, Option.exists((value) => value !== AGENTS));
|
|
3038
3129
|
return pipe(Option.liftPredicate(file, () => !isLink || pointsElsewhere), Option.map((path) => ({
|
|
3039
3130
|
file: path,
|
|
3040
|
-
line: FIRST$
|
|
3041
|
-
column: FIRST$
|
|
3042
|
-
rule: RULE$
|
|
3131
|
+
line: FIRST$22,
|
|
3132
|
+
column: FIRST$22,
|
|
3133
|
+
rule: RULE$68,
|
|
3043
3134
|
message: MESSAGE$19
|
|
3044
3135
|
})));
|
|
3045
3136
|
});
|
|
@@ -3048,11 +3139,11 @@ const checkClaudeLinks = Effect.fn("checkClaudeLinks")(function* checkClaudeLink
|
|
|
3048
3139
|
return Array$1.getSomes(found);
|
|
3049
3140
|
});
|
|
3050
3141
|
// src/features/check-placement/model/dangling-links.ts
|
|
3051
|
-
const RULE$
|
|
3052
|
-
const SEPARATOR$
|
|
3053
|
-
const FIRST$
|
|
3142
|
+
const RULE$67 = "dangling-link";
|
|
3143
|
+
const SEPARATOR$22 = "/";
|
|
3144
|
+
const FIRST$21 = 1;
|
|
3054
3145
|
const READ_CONCURRENCY$29 = 16;
|
|
3055
|
-
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$
|
|
3146
|
+
const holds = (target) => (name) => name === target || String$1.startsWith(`${target}${SEPARATOR$22}`)(name);
|
|
3056
3147
|
/** @internal */
|
|
3057
3148
|
const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDanglingLinks(root) {
|
|
3058
3149
|
const files = yield* RepositoryFiles;
|
|
@@ -3062,9 +3153,9 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
3062
3153
|
const link = yield* files.readLink(file);
|
|
3063
3154
|
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) => ({
|
|
3064
3155
|
file,
|
|
3065
|
-
line: FIRST$
|
|
3066
|
-
column: FIRST$
|
|
3067
|
-
rule: RULE$
|
|
3156
|
+
line: FIRST$21,
|
|
3157
|
+
column: FIRST$21,
|
|
3158
|
+
rule: RULE$67,
|
|
3068
3159
|
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.`
|
|
3069
3160
|
})));
|
|
3070
3161
|
});
|
|
@@ -3073,8 +3164,8 @@ const checkDanglingLinks = Effect.fn("checkDanglingLinks")(function* checkDangli
|
|
|
3073
3164
|
});
|
|
3074
3165
|
// src/features/check-placement/model/member-sources.ts
|
|
3075
3166
|
const ROOT_WORKSPACE$1 = ".";
|
|
3076
|
-
const FIRST$
|
|
3077
|
-
const SEPARATOR$
|
|
3167
|
+
const FIRST$20 = 1;
|
|
3168
|
+
const SEPARATOR$21 = "/";
|
|
3078
3169
|
const EXCLUDED$6 = [
|
|
3079
3170
|
":(exclude,attr:linguist-vendored)",
|
|
3080
3171
|
":(exclude,attr:linguist-generated)",
|
|
@@ -3094,20 +3185,20 @@ const memberSources = Effect.fn("memberSources")(function* memberSources(root) {
|
|
|
3094
3185
|
const byLength$1 = Order.mapInput(Order.Number, (directory) => directory.length);
|
|
3095
3186
|
const fileProblem$1 = ({ file, rule, message }) => ({
|
|
3096
3187
|
file,
|
|
3097
|
-
line: FIRST$
|
|
3098
|
-
column: FIRST$
|
|
3188
|
+
line: FIRST$20,
|
|
3189
|
+
column: FIRST$20,
|
|
3099
3190
|
rule,
|
|
3100
3191
|
message
|
|
3101
3192
|
});
|
|
3102
|
-
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array$1.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$
|
|
3193
|
+
const ownerOf$4 = (workspaces) => (name) => pipe(workspaces, Array$1.filter((workspace) => String$1.startsWith(`${workspace}${SEPARATOR$21}`)(name)), (owners) => Array$1.last(Array$1.sort(owners, byLength$1)), Option.map((workspace) => ({
|
|
3103
3194
|
workspace,
|
|
3104
3195
|
inner: String$1.slice(workspace.length + 1)(name)
|
|
3105
3196
|
})));
|
|
3106
3197
|
// src/features/check-placement/model/readme-file.ts
|
|
3107
|
-
const README_FILE = "README.md";
|
|
3198
|
+
const README_FILE$1 = "README.md";
|
|
3108
3199
|
const readReadme = Effect.fn("readReadme")(function* readReadme({ root, directory, rule, missingMessage }) {
|
|
3109
3200
|
const files = yield* RepositoryFiles;
|
|
3110
|
-
const file = files.join(root, directory, README_FILE);
|
|
3201
|
+
const file = files.join(root, directory, README_FILE$1);
|
|
3111
3202
|
const text = yield* files.readFile(file);
|
|
3112
3203
|
return pipe(text, Option.match({
|
|
3113
3204
|
onNone: () => Result.fail(fileProblem$1({
|
|
@@ -3122,7 +3213,7 @@ const readReadme = Effect.fn("readReadme")(function* readReadme({ root, director
|
|
|
3122
3213
|
}));
|
|
3123
3214
|
});
|
|
3124
3215
|
// src/features/check-placement/model/deployed-readme.ts
|
|
3125
|
-
const RULE$
|
|
3216
|
+
const RULE$66 = "deployed-readme";
|
|
3126
3217
|
const ROOT_DIRECTORY$4 = "";
|
|
3127
3218
|
const READ_CONCURRENCY$28 = 16;
|
|
3128
3219
|
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.";
|
|
@@ -3162,14 +3253,14 @@ const problemIn$7 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
3162
3253
|
const readme = yield* readReadme({
|
|
3163
3254
|
root,
|
|
3164
3255
|
directory,
|
|
3165
|
-
rule: RULE$
|
|
3256
|
+
rule: RULE$66,
|
|
3166
3257
|
missingMessage: MISSING_MESSAGE$2
|
|
3167
3258
|
});
|
|
3168
3259
|
return Result.match(readme, {
|
|
3169
3260
|
onFailure: Option.some,
|
|
3170
3261
|
onSuccess: ({ file, source }) => pipe(Option.liftPredicate(source, (text) => !URL_PATTERN.test(text)), Option.map(() => fileProblem$1({
|
|
3171
3262
|
file,
|
|
3172
|
-
rule: RULE$
|
|
3263
|
+
rule: RULE$66,
|
|
3173
3264
|
message: NO_URL_MESSAGE
|
|
3174
3265
|
})))
|
|
3175
3266
|
});
|
|
@@ -3186,9 +3277,9 @@ const checkDeployedReadme = Effect.fn("checkDeployedReadme")(function* checkDepl
|
|
|
3186
3277
|
return Array$1.getSomes(found);
|
|
3187
3278
|
});
|
|
3188
3279
|
// src/features/check-placement/model/nested-docs.ts
|
|
3189
|
-
const RULE$
|
|
3280
|
+
const RULE$65 = "nested-docs";
|
|
3190
3281
|
const CONFIG_FILE$7 = "vite.config.ts";
|
|
3191
|
-
const SEPARATOR$
|
|
3282
|
+
const SEPARATOR$20 = "/";
|
|
3192
3283
|
const READ_CONCURRENCY$27 = 64;
|
|
3193
3284
|
const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
|
|
3194
3285
|
const WORKSPACE_AGENT_DOC = "AGENTS.md";
|
|
@@ -3198,8 +3289,8 @@ const MISSING_RULE = "workspace-agents-md";
|
|
|
3198
3289
|
const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
|
|
3199
3290
|
const taggedError$6 = Schema.TaggedError;
|
|
3200
3291
|
var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
|
|
3201
|
-
const isNested = (name) => String$1.includes(SEPARATOR$
|
|
3202
|
-
const problemFor$7 = problemInFile(RULE$
|
|
3292
|
+
const isNested = (name) => String$1.includes(SEPARATOR$20)(name);
|
|
3293
|
+
const problemFor$7 = problemInFile(RULE$65);
|
|
3203
3294
|
const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
|
|
3204
3295
|
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.";
|
|
3205
3296
|
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.";
|
|
@@ -3256,7 +3347,7 @@ const checkNestedDocs = Effect.fn("checkNestedDocs")(function* checkNestedDocs(r
|
|
|
3256
3347
|
return [...Array$1.getSomes(found), ...missing];
|
|
3257
3348
|
});
|
|
3258
3349
|
// src/features/check-placement/model/published-readme.ts
|
|
3259
|
-
const RULE$
|
|
3350
|
+
const RULE$64 = "published-readme";
|
|
3260
3351
|
const READ_CONCURRENCY$26 = 16;
|
|
3261
3352
|
const MESSAGE$18 = "contains Japanese. This package is published to npm, so write its README in English.";
|
|
3262
3353
|
const MISSING_MESSAGE = "is missing. This package is published to npm, so give it an English README.md.";
|
|
@@ -3264,7 +3355,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, english, {
|
|
|
3264
3355
|
const readme = yield* readReadme({
|
|
3265
3356
|
root,
|
|
3266
3357
|
directory,
|
|
3267
|
-
rule: RULE$
|
|
3358
|
+
rule: RULE$64,
|
|
3268
3359
|
missingMessage: MISSING_MESSAGE
|
|
3269
3360
|
});
|
|
3270
3361
|
return Result.match(readme, {
|
|
@@ -3275,7 +3366,7 @@ const problemIn$5 = Effect.fn("problemIn")(function* problemIn(root, english, {
|
|
|
3275
3366
|
file,
|
|
3276
3367
|
line,
|
|
3277
3368
|
column,
|
|
3278
|
-
rule: RULE$
|
|
3369
|
+
rule: RULE$64,
|
|
3279
3370
|
message: MESSAGE$18
|
|
3280
3371
|
};
|
|
3281
3372
|
}))
|
|
@@ -3290,11 +3381,11 @@ const checkPublishedReadme = Effect.fn("checkPublishedReadme")(function* checkPu
|
|
|
3290
3381
|
return Array$1.getSomes(found);
|
|
3291
3382
|
});
|
|
3292
3383
|
// src/features/check-placement/model/published-tests.ts
|
|
3293
|
-
const RULE$
|
|
3384
|
+
const RULE$63 = "published-tests";
|
|
3294
3385
|
const FILE_START = 1;
|
|
3295
|
-
const TEST_FILE$
|
|
3386
|
+
const TEST_FILE$2 = /\.test\.[cm]?[jt]sx?$/u;
|
|
3296
3387
|
const MESSAGE$17 = "belongs to a package published to npm that has no tests. Write tests for what the package offers before publishing it.";
|
|
3297
|
-
const testedIn = (listed) => (prefix) => pipe(listed, Array$1.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$
|
|
3388
|
+
const testedIn = (listed) => (prefix) => pipe(listed, Array$1.some((file) => String$1.startsWith(prefix)(file) && TEST_FILE$2.test(file)));
|
|
3298
3389
|
const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed, { directory }) {
|
|
3299
3390
|
const files = yield* RepositoryFiles;
|
|
3300
3391
|
const absolute = files.join(root, directory);
|
|
@@ -3304,7 +3395,7 @@ const problemFor$6 = Effect.fn("problemFor")(function* problemFor(root, listed,
|
|
|
3304
3395
|
file: files.join(absolute, PACKAGE_JSON_FILE),
|
|
3305
3396
|
line: FILE_START,
|
|
3306
3397
|
column: FILE_START,
|
|
3307
|
-
rule: RULE$
|
|
3398
|
+
rule: RULE$63,
|
|
3308
3399
|
message: MESSAGE$17
|
|
3309
3400
|
});
|
|
3310
3401
|
});
|
|
@@ -3318,30 +3409,30 @@ const checkPublishedTests = Effect.fn("checkPublishedTests")(function* checkPubl
|
|
|
3318
3409
|
return Array$1.getSomes(found);
|
|
3319
3410
|
});
|
|
3320
3411
|
// src/features/check-placement/model/root-docs.ts
|
|
3321
|
-
const RULE$
|
|
3322
|
-
const SEPARATOR$
|
|
3323
|
-
const FIRST$
|
|
3324
|
-
const MARKDOWN$
|
|
3412
|
+
const RULE$62 = "root-docs";
|
|
3413
|
+
const SEPARATOR$19 = "/";
|
|
3414
|
+
const FIRST$19 = 1;
|
|
3415
|
+
const MARKDOWN$5 = /\.(?:md|mdx|markdown)$/iu;
|
|
3325
3416
|
const ALLOWED = /^(?:README(?:\.[^/]+)?|AGENTS|CLAUDE|ARCHITECTURE|DESIGN|CHANGELOG|LICENSE|NOTICE)\.(?:md|mdx|markdown)$/iu;
|
|
3326
3417
|
const MESSAGE$16 = "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.";
|
|
3327
|
-
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$
|
|
3418
|
+
const isStrayRootDoc = (name) => !String$1.includes(SEPARATOR$19)(name) && MARKDOWN$5.test(name) && !ALLOWED.test(name);
|
|
3328
3419
|
/** @internal */
|
|
3329
3420
|
const checkRootDocs = Effect.fn("checkRootDocs")(function* checkRootDocs(root) {
|
|
3330
3421
|
const files = yield* RepositoryFiles;
|
|
3331
3422
|
const names = yield* files.listedFiles(root);
|
|
3332
3423
|
return pipe(names, Array$1.filter(isStrayRootDoc), Array$1.map((name) => ({
|
|
3333
3424
|
file: files.join(root, name),
|
|
3334
|
-
line: FIRST$
|
|
3335
|
-
column: FIRST$
|
|
3336
|
-
rule: RULE$
|
|
3425
|
+
line: FIRST$19,
|
|
3426
|
+
column: FIRST$19,
|
|
3427
|
+
rule: RULE$62,
|
|
3337
3428
|
message: `${name} ${MESSAGE$16}`
|
|
3338
3429
|
})));
|
|
3339
3430
|
});
|
|
3340
3431
|
// src/features/check-placement/model/root-readme.ts
|
|
3341
|
-
const RULE$
|
|
3432
|
+
const RULE$61 = "root-readme";
|
|
3342
3433
|
const ROOT_DOC = /^(?:README(?:\.[^/]+)?|AGENTS\.md|CLAUDE\.md)$/iu;
|
|
3343
3434
|
const READ_CONCURRENCY$25 = 16;
|
|
3344
|
-
const START$
|
|
3435
|
+
const START$28 = 0;
|
|
3345
3436
|
const CHECK_POLICY = "@r_masseater/msch";
|
|
3346
3437
|
const MARKETPLACE = ".claude-plugin/marketplace.json";
|
|
3347
3438
|
const RELATIVE$2 = /^\.\//u;
|
|
@@ -3378,17 +3469,17 @@ const patternFor = (plugins) => ({ directory, names }) => patternOf$1(Option.mat
|
|
|
3378
3469
|
onNone: () => ownNames(plugins, names),
|
|
3379
3470
|
onSome: () => [directory]
|
|
3380
3471
|
}));
|
|
3381
|
-
const problemsIn$
|
|
3472
|
+
const problemsIn$22 = (file, source, plugins) => (workspace) => {
|
|
3382
3473
|
const message = messageFor$2(workspace.directory);
|
|
3383
3474
|
const at = positionOf(source);
|
|
3384
3475
|
const pattern = patternFor(plugins)(workspace);
|
|
3385
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$
|
|
3476
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.map((found) => problemAtPosition(RULE$61)(file, at(found.index ?? START$28), message)));
|
|
3386
3477
|
};
|
|
3387
3478
|
const problemsInReadme = Effect.fn("problemsInReadme")(function* problemsInReadme(file, workspaces, plugins) {
|
|
3388
3479
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
3389
3480
|
return pipe(text, Option.match({
|
|
3390
3481
|
onNone: () => [],
|
|
3391
|
-
onSome: (source) => pipe(workspaces, Array$1.flatMap(problemsIn$
|
|
3482
|
+
onSome: (source) => pipe(workspaces, Array$1.flatMap(problemsIn$22(file, source, plugins)))
|
|
3392
3483
|
}));
|
|
3393
3484
|
});
|
|
3394
3485
|
/** @internal */
|
|
@@ -3419,7 +3510,7 @@ const checkDocPlacement = Effect.fn("checkDocPlacement")(function* checkDocPlace
|
|
|
3419
3510
|
return Array$1.flatten(found);
|
|
3420
3511
|
});
|
|
3421
3512
|
// src/features/check-placement/model/docs-mirror.ts
|
|
3422
|
-
const RULE$
|
|
3513
|
+
const RULE$60 = "docs-mirror";
|
|
3423
3514
|
const DOC = /(?:^|\/)(?:README|AGENTS|ARCHITECTURE|CLAUDE|SKILL)\.md$/u;
|
|
3424
3515
|
const MIRROR_LIMIT = 3;
|
|
3425
3516
|
const READ_CONCURRENCY$24 = 16;
|
|
@@ -3444,7 +3535,7 @@ const problemFor$5 = (file, source, mentions) => pipe(Array$1.head(mentions), Op
|
|
|
3444
3535
|
file,
|
|
3445
3536
|
line,
|
|
3446
3537
|
column,
|
|
3447
|
-
rule: RULE$
|
|
3538
|
+
rule: RULE$60,
|
|
3448
3539
|
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.`
|
|
3449
3540
|
};
|
|
3450
3541
|
}), Option.toArray);
|
|
@@ -3476,9 +3567,9 @@ const checkDocsMirror = Effect.fn("checkDocsMirror")(function* checkDocsMirror(r
|
|
|
3476
3567
|
return Array$1.flatten(found);
|
|
3477
3568
|
});
|
|
3478
3569
|
// src/features/check-placement/model/ignored-sources.ts
|
|
3479
|
-
const RULE$
|
|
3570
|
+
const RULE$59 = "ignored-sources";
|
|
3480
3571
|
const SOURCES = [":(glob)**/src/**", ":(exclude,glob)**/node_modules/**"];
|
|
3481
|
-
const FIRST$
|
|
3572
|
+
const FIRST$18 = 1;
|
|
3482
3573
|
const MESSAGE$15 = "is under src/ but .gitignore ignores it, so verify passes here while the file never reaches the commit. Narrow the pattern in .gitignore.";
|
|
3483
3574
|
/** @internal */
|
|
3484
3575
|
const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgnoredSources(root) {
|
|
@@ -3486,9 +3577,9 @@ const checkIgnoredSources = Effect.fn("checkIgnoredSources")(function* checkIgno
|
|
|
3486
3577
|
const ignored = yield* files.ignoredFiles(root, SOURCES);
|
|
3487
3578
|
return pipe(ignored, Array$1.map((file) => ({
|
|
3488
3579
|
file: files.join(root, file),
|
|
3489
|
-
line: FIRST$
|
|
3490
|
-
column: FIRST$
|
|
3491
|
-
rule: RULE$
|
|
3580
|
+
line: FIRST$18,
|
|
3581
|
+
column: FIRST$18,
|
|
3582
|
+
rule: RULE$59,
|
|
3492
3583
|
message: MESSAGE$15
|
|
3493
3584
|
})));
|
|
3494
3585
|
});
|
|
@@ -12035,7 +12126,7 @@ var english_verbs_default = [
|
|
|
12035
12126
|
const SLICE_RULE$1 = "feature-slice-name";
|
|
12036
12127
|
const ENTRY_RULE$2 = "deploy-entry-name";
|
|
12037
12128
|
const SEGMENT_RULE = "slice-segment-name";
|
|
12038
|
-
const SEPARATOR$
|
|
12129
|
+
const SEPARATOR$17 = "/";
|
|
12039
12130
|
const NEXT$3 = 1;
|
|
12040
12131
|
const WORD_SEPARATOR$1 = "-";
|
|
12041
12132
|
const MINIMUM_WORDS = 2;
|
|
@@ -12061,7 +12152,7 @@ const isVerbObjectBy = (separator) => (slice) => {
|
|
|
12061
12152
|
return words.length >= MINIMUM_WORDS && Option.exists(Array$1.head(words), (word) => VERBS.has(word));
|
|
12062
12153
|
};
|
|
12063
12154
|
const isVerbObject = isVerbObjectBy(WORD_SEPARATOR$1);
|
|
12064
|
-
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array$1.head(String$1.split(String$1.slice(13)(path), SEPARATOR$
|
|
12155
|
+
const misnamedSlice$1 = ({ workspace, inner }) => pipe(Option.liftPredicate(inner, (path) => String$1.startsWith(FEATURES$1)(path) && SCRIPT$1.test(path)), Option.flatMap((path) => Array$1.head(String$1.split(String$1.slice(13)(path), SEPARATOR$17))), Option.filter((slice) => !isVerbObject(slice)), Option.map((slice) => `${workspace}${SEPARATOR$17}${FEATURES$1}${slice}`));
|
|
12065
12156
|
const SLICE_LAYERS = [
|
|
12066
12157
|
"features",
|
|
12067
12158
|
"entities",
|
|
@@ -12069,26 +12160,26 @@ const SLICE_LAYERS = [
|
|
|
12069
12160
|
"pages"
|
|
12070
12161
|
];
|
|
12071
12162
|
const SLICE_DEPTHS = [3, 4];
|
|
12072
|
-
const pathPrefix = (parts, depth) => Array$1.join(Array$1.take(parts, depth), SEPARATOR$
|
|
12163
|
+
const pathPrefix = (parts, depth) => Array$1.join(Array$1.take(parts, depth), SEPARATOR$17);
|
|
12073
12164
|
const isInSliceLayer = (parts) => {
|
|
12074
12165
|
const [source, layer] = parts;
|
|
12075
|
-
return `${source}${SEPARATOR$
|
|
12166
|
+
return `${source}${SEPARATOR$17}` === SOURCE && Array$1.contains(SLICE_LAYERS, layer ?? "");
|
|
12076
12167
|
};
|
|
12077
12168
|
const indexedSlice = (owned) => {
|
|
12078
|
-
const parts = String$1.split(owned.inner, SEPARATOR$
|
|
12169
|
+
const parts = String$1.split(owned.inner, SEPARATOR$17);
|
|
12079
12170
|
const depth = parts.length - NEXT$3;
|
|
12080
|
-
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array$1.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$
|
|
12171
|
+
return pipe(Option.liftPredicate(depth, () => isInSliceLayer(parts) && INDEX.test(owned.inner) && Array$1.contains(SLICE_DEPTHS, depth)), Option.map(() => `${owned.workspace}${SEPARATOR$17}${pathPrefix(parts, depth)}`));
|
|
12081
12172
|
};
|
|
12082
12173
|
const misnamedSegment = (slices) => ({ workspace, inner }) => {
|
|
12083
|
-
const parts = String$1.split(inner, SEPARATOR$
|
|
12084
|
-
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$
|
|
12174
|
+
const parts = String$1.split(inner, SEPARATOR$17);
|
|
12175
|
+
const insideSlice = (depth) => slices.has(`${workspace}${SEPARATOR$17}${pathPrefix(parts, depth)}`);
|
|
12085
12176
|
const isSegmentFolder = (depth) => parts.length > depth + NEXT$3 && SCRIPT$1.test(inner) && !SEGMENTS.has(parts[depth] ?? "");
|
|
12086
|
-
return pipe(SLICE_DEPTHS, Array$1.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$
|
|
12177
|
+
return pipe(SLICE_DEPTHS, Array$1.findFirst(insideSlice), Option.filter(isSegmentFolder), Option.map((depth) => `${workspace}${SEPARATOR$17}${pathPrefix(parts, depth + NEXT$3)}`));
|
|
12087
12178
|
};
|
|
12088
12179
|
const deployNamed = ({ workspace, inner }) => {
|
|
12089
12180
|
if (!String$1.startsWith(SOURCE)(inner)) return Option.none();
|
|
12090
|
-
const segments = String$1.split(inner, SEPARATOR$
|
|
12091
|
-
return pipe(Array$1.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$
|
|
12181
|
+
const segments = String$1.split(inner, SEPARATOR$17);
|
|
12182
|
+
return pipe(Array$1.findFirstIndex(segments, (segment) => DEPLOY_MARKER.test(segment)), Option.map((index) => `${workspace}${SEPARATOR$17}${Array$1.join(Array$1.take(segments, index + NEXT$3), SEPARATOR$17)}`));
|
|
12092
12183
|
};
|
|
12093
12184
|
/** @internal */
|
|
12094
12185
|
const checkSourceNames = Effect.fn("checkSourceNames")(function* checkSourceNames(root) {
|
|
@@ -12133,7 +12224,7 @@ const LAYER_ITEMS = [
|
|
|
12133
12224
|
];
|
|
12134
12225
|
const READ_CONCURRENCY$23 = 64;
|
|
12135
12226
|
const EXCLUDED$5 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
12136
|
-
const NONE$
|
|
12227
|
+
const NONE$2 = [];
|
|
12137
12228
|
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.";
|
|
12138
12229
|
const LAYER_INDEX_MESSAGE = "defines code in a layer module. A layer module holds only mod declarations of its slices and use; put the code in a slice.";
|
|
12139
12230
|
const ENTRY_MESSAGE = "makes an inner module of a slice public. Declare it with plain mod and re-export what other slices use with pub use from the slice module.";
|
|
@@ -12148,12 +12239,12 @@ const isRootItem = (inner) => (item) => {
|
|
|
12148
12239
|
};
|
|
12149
12240
|
const isLayerItem = (item) => Array$1.contains(LAYER_ITEMS, item.kind) || item.kind === "mod_item" && !item.inline;
|
|
12150
12241
|
const entryProblems$1 = (file, modulePath, parsed) => {
|
|
12151
|
-
if (!isSliceIndex(modulePath)) return NONE$
|
|
12242
|
+
if (!isSliceIndex(modulePath)) return NONE$2;
|
|
12152
12243
|
return pipe(parsed.items, Array$1.filter((item) => item.kind === "mod_item" && item.visible), Array$1.map(itemProblem(file, ENTRY_RULE$1, ENTRY_MESSAGE)));
|
|
12153
12244
|
};
|
|
12154
12245
|
const moduleProblems = ({ source, parsed }) => entryProblems$1(source.file, modulePathOf(source.inner), parsed);
|
|
12155
12246
|
const testProblems = ({ source, parsed }) => {
|
|
12156
|
-
if (parsed.replacesAllocator) return NONE$
|
|
12247
|
+
if (parsed.replacesAllocator) return NONE$2;
|
|
12157
12248
|
return [fileProblem$1({
|
|
12158
12249
|
file: source.file,
|
|
12159
12250
|
rule: TEST_RULE,
|
|
@@ -12166,8 +12257,8 @@ const PROBLEMS = {
|
|
|
12166
12257
|
layer: (read) => strayItems(read, isLayerItem, LAYER_INDEX_MESSAGE),
|
|
12167
12258
|
test: testProblems,
|
|
12168
12259
|
module: moduleProblems,
|
|
12169
|
-
skipped: () => NONE$
|
|
12170
|
-
misplaced: () => NONE$
|
|
12260
|
+
skipped: () => NONE$2,
|
|
12261
|
+
misplaced: () => NONE$2
|
|
12171
12262
|
};
|
|
12172
12263
|
const problemsOf$4 = (read) => PROBLEMS[kindOf$1(read.source.inner)](read);
|
|
12173
12264
|
const misnamedSlice = ({ crate, inner }, root, join) => {
|
|
@@ -12204,20 +12295,20 @@ const rustSources = Effect.fn("rustSources")(function* rustSources(root) {
|
|
|
12204
12295
|
const checkRustModules = Effect.fn("checkRustModules")(function* checkRustModules(root) {
|
|
12205
12296
|
const files = yield* RepositoryFiles;
|
|
12206
12297
|
const sources = yield* rustSources(root);
|
|
12207
|
-
if (!Array$1.isReadonlyArrayNonEmpty(sources)) return NONE$
|
|
12298
|
+
if (!Array$1.isReadonlyArrayNonEmpty(sources)) return NONE$2;
|
|
12208
12299
|
const language = yield* loadLanguage(GRAMMAR).pipe(Effect.orDie);
|
|
12209
12300
|
const parse = parsedWith(language);
|
|
12210
12301
|
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$23 });
|
|
12211
12302
|
return [...sliceNameProblems(root, files.join, sources), ...Array$1.flatMap(Array$1.getSomes(read), problemsOf$4)];
|
|
12212
12303
|
});
|
|
12213
12304
|
// src/features/check-placement/model/shadcn-ui-alias.ts
|
|
12214
|
-
const RULE$
|
|
12215
|
-
const FIRST$
|
|
12305
|
+
const RULE$58 = "shadcn-ui-alias";
|
|
12306
|
+
const FIRST$17 = 1;
|
|
12216
12307
|
const problemOf$10 = (directory, { file, alias }) => ({
|
|
12217
12308
|
file,
|
|
12218
|
-
line: FIRST$
|
|
12219
|
-
column: FIRST$
|
|
12220
|
-
rule: RULE$
|
|
12309
|
+
line: FIRST$17,
|
|
12310
|
+
column: FIRST$17,
|
|
12311
|
+
rule: RULE$58,
|
|
12221
12312
|
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/*".`
|
|
12222
12313
|
});
|
|
12223
12314
|
/** @internal */
|
|
@@ -12279,10 +12370,10 @@ const CODE_IN_BIN = "code-in-bin";
|
|
|
12279
12370
|
const BIN = "bin";
|
|
12280
12371
|
const SCRIPTS_DIRECTORY = "scripts";
|
|
12281
12372
|
const WORKFLOW_DIRECTORY$1 = ".github/";
|
|
12282
|
-
const SEPARATOR$
|
|
12373
|
+
const SEPARATOR$16 = "/";
|
|
12283
12374
|
const CURRENT = "./";
|
|
12284
12375
|
const READ_CONCURRENCY$22 = 8;
|
|
12285
|
-
const FIRST$
|
|
12376
|
+
const FIRST$16 = 1;
|
|
12286
12377
|
const RUN_FILE = /(?:^|[\s;&|(])(?:node|vpx|tsx|bun|deno)\s+(?:-\S+\s+)*(?<file>[^\s;&|)]+\.[cm]?[jt]s)\b/gu;
|
|
12287
12378
|
const COMMAND$1 = /^bin\/[^/]+\.[cm]?ts$/u;
|
|
12288
12379
|
const COMMAND_FILE = /^bin\/[^/]+$/u;
|
|
@@ -12317,7 +12408,7 @@ const isCommand$1 = (path) => COMMAND$1.test(path) && !NOT_COMMAND.test(path);
|
|
|
12317
12408
|
const commandFilesIn = Effect.fn("commandFilesIn")(function* commandFilesIn(root, directory) {
|
|
12318
12409
|
const files = yield* RepositoryFiles;
|
|
12319
12410
|
const names = yield* files.readDirectory(files.join(root, directory, BIN));
|
|
12320
|
-
return pipe(names, Array$1.map((name) => `${BIN}${SEPARATOR$
|
|
12411
|
+
return pipe(names, Array$1.map((name) => `${BIN}${SEPARATOR$16}${name}`), Array$1.filter(isCommand$1));
|
|
12321
12412
|
});
|
|
12322
12413
|
const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
12323
12414
|
const files = yield* RepositoryFiles;
|
|
@@ -12326,7 +12417,7 @@ const workflowText = Effect.fn("workflowText")(function* workflowText(root) {
|
|
|
12326
12417
|
const texts = yield* Effect.forEach(workflows, (file) => files.readFile(files.join(root, file)), { concurrency: READ_CONCURRENCY$22 });
|
|
12327
12418
|
return pipe(Array$1.getSomes(texts), Array$1.join("\n"));
|
|
12328
12419
|
});
|
|
12329
|
-
const workspacePath = (directory, path) => pipe([directory, path], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$
|
|
12420
|
+
const workspacePath = (directory, path) => pipe([directory, path], Array$1.filter(String$1.isNonEmpty), Array$1.join(SEPARATOR$16));
|
|
12330
12421
|
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 }) => ({
|
|
12331
12422
|
file,
|
|
12332
12423
|
...positionOf(source)(start),
|
|
@@ -12334,7 +12425,7 @@ const outsideProblems = ({ file, source, runs, entries }) => pipe(runs, Array$1.
|
|
|
12334
12425
|
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.`
|
|
12335
12426
|
})));
|
|
12336
12427
|
const runsOf = (program) => pipe(nestedValues(RUN_TASKS)(program), Array$1.flatMap(stringsIn), Array$1.flatMap(runsIn));
|
|
12337
|
-
const problemsIn$
|
|
12428
|
+
const problemsIn$21 = Effect.fn("problemsIn")(function* problemsIn(root, directory, workflows) {
|
|
12338
12429
|
const files = yield* RepositoryFiles;
|
|
12339
12430
|
const config = yield* workspaceConfigOf(root, directory);
|
|
12340
12431
|
const entries = yield* declaredEntries(root, directory);
|
|
@@ -12350,8 +12441,8 @@ const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(root, directo
|
|
|
12350
12441
|
const isRun = (path) => Array$1.contains(runPaths, path) || Array$1.contains(entries.bins, path) || String$1.includes(workspacePath(directory, path))(workflows);
|
|
12351
12442
|
const unrun = pipe(commands, Array$1.filter((path) => !isRun(path)), Array$1.map((path) => ({
|
|
12352
12443
|
file: files.join(root, directory, path),
|
|
12353
|
-
line: FIRST$
|
|
12354
|
-
column: FIRST$
|
|
12444
|
+
line: FIRST$16,
|
|
12445
|
+
column: FIRST$16,
|
|
12355
12446
|
rule: UNRUN,
|
|
12356
12447
|
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.`
|
|
12357
12448
|
})));
|
|
@@ -12363,8 +12454,8 @@ const scriptsProblem = Effect.fn("scriptsProblem")(function* scriptsProblem(root
|
|
|
12363
12454
|
const isDirectory = yield* files.isDirectory(file);
|
|
12364
12455
|
return pipe(isDirectory, Option.filter(Boolean), Option.map(() => ({
|
|
12365
12456
|
file,
|
|
12366
|
-
line: FIRST$
|
|
12367
|
-
column: FIRST$
|
|
12457
|
+
line: FIRST$16,
|
|
12458
|
+
column: FIRST$16,
|
|
12368
12459
|
rule: SCRIPTS,
|
|
12369
12460
|
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.`
|
|
12370
12461
|
})));
|
|
@@ -12373,11 +12464,11 @@ const isCommandFile = (path) => isCommand$1(path) || COMMAND_FILE.test(path) &&
|
|
|
12373
12464
|
const codeInBinProblems = Effect.fn("codeInBinProblems")(function* codeInBinProblems(root, directory) {
|
|
12374
12465
|
const files = yield* RepositoryFiles;
|
|
12375
12466
|
const listed = yield* files.listedFiles(root);
|
|
12376
|
-
const prefix = workspacePath(directory, `${BIN}${SEPARATOR$
|
|
12377
|
-
return pipe(listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.filter((file) => !isCommandFile(`${BIN}${SEPARATOR$
|
|
12467
|
+
const prefix = workspacePath(directory, `${BIN}${SEPARATOR$16}`);
|
|
12468
|
+
return pipe(listed, Array$1.filter(String$1.startsWith(prefix)), Array$1.filter((file) => !isCommandFile(`${BIN}${SEPARATOR$16}${String$1.slice(prefix.length)(file)}`)), Array$1.map((file) => ({
|
|
12378
12469
|
file: files.join(root, file),
|
|
12379
|
-
line: FIRST$
|
|
12380
|
-
column: FIRST$
|
|
12470
|
+
line: FIRST$16,
|
|
12471
|
+
column: FIRST$16,
|
|
12381
12472
|
rule: CODE_IN_BIN,
|
|
12382
12473
|
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.`
|
|
12383
12474
|
})));
|
|
@@ -12386,7 +12477,7 @@ const codeInBinProblems = Effect.fn("codeInBinProblems")(function* codeInBinProb
|
|
|
12386
12477
|
const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkCommandEntries(root) {
|
|
12387
12478
|
const all = ["", ...yield* workspaceDirectories(root)];
|
|
12388
12479
|
const workflows = yield* workflowText(root);
|
|
12389
|
-
const found = yield* Effect.forEach(all, (directory) => problemsIn$
|
|
12480
|
+
const found = yield* Effect.forEach(all, (directory) => problemsIn$21(root, directory, workflows), { concurrency: READ_CONCURRENCY$22 });
|
|
12390
12481
|
const scripts = yield* Effect.forEach(all, (directory) => scriptsProblem(root, directory), { concurrency: READ_CONCURRENCY$22 });
|
|
12391
12482
|
const code = yield* Effect.forEach(all, (directory) => codeInBinProblems(root, directory), { concurrency: READ_CONCURRENCY$22 });
|
|
12392
12483
|
return [
|
|
@@ -12396,14 +12487,14 @@ const checkCommandEntries = Effect.fn("checkCommandEntries")(function* checkComm
|
|
|
12396
12487
|
];
|
|
12397
12488
|
});
|
|
12398
12489
|
// src/features/check-repository-layout/model/path-mention.ts
|
|
12399
|
-
const START$
|
|
12490
|
+
const START$27 = 0;
|
|
12400
12491
|
const QUOTES = ["\"", "'"];
|
|
12401
12492
|
const firstIndex = (source, needles) => {
|
|
12402
12493
|
const found = pipe(needles, Array$1.flatMap((needle) => Option.toArray(String$1.indexOf(needle)(source))));
|
|
12403
12494
|
return Array$1.head(Array$1.sort(found, Order.Number));
|
|
12404
12495
|
};
|
|
12405
12496
|
const quoted = (text) => pipe(QUOTES, Array$1.map((quote) => `${quote}${text}${quote}`));
|
|
12406
|
-
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$
|
|
12497
|
+
const indexOfText = (source) => (text) => pipe(firstIndex(source, quoted(text)), Option.orElse(() => firstIndex(source, [text])), Option.getOrElse(() => START$27));
|
|
12407
12498
|
// src/features/check-repository-layout/model/cargo-paths.ts
|
|
12408
12499
|
const MEMBER_LISTS = [
|
|
12409
12500
|
"members",
|
|
@@ -12419,14 +12510,14 @@ const WORKSPACE = "workspace";
|
|
|
12419
12510
|
const PATCH = "patch";
|
|
12420
12511
|
const PATCH_DEPTH = 2;
|
|
12421
12512
|
const WORKSPACE_DEPTH = 1;
|
|
12422
|
-
const START$
|
|
12513
|
+
const START$26 = 0;
|
|
12423
12514
|
const WILDCARD$4 = /[*?[]/u;
|
|
12424
12515
|
const KEY_SEPARATOR = ".";
|
|
12425
12516
|
const decodeTable = Schema.decodeUnknownOption(Schema.Record(Schema.String, Schema.Unknown));
|
|
12426
12517
|
const decodeStrings = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
12427
12518
|
const decodePath = Schema.decodeUnknownOption(Schema.Struct({ path: Schema.String }));
|
|
12428
|
-
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$
|
|
12429
|
-
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$
|
|
12519
|
+
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$26).pipe(Option.exists((name) => name === PATCH));
|
|
12520
|
+
const listsMembers = (trail, key) => trail.length === WORKSPACE_DEPTH && Array$1.get(trail, START$26).pipe(Option.exists((name) => name === WORKSPACE)) && Array$1.contains(MEMBER_LISTS, key);
|
|
12430
12521
|
const namedPaths = (trail, key, value) => {
|
|
12431
12522
|
const field = Array$1.join([...trail, key], KEY_SEPARATOR);
|
|
12432
12523
|
if (listsMembers(trail, key)) return pipe(decodeStrings(value), Option.getOrElse(() => []), Array$1.filter((member) => !WILDCARD$4.test(member)), Array$1.map((member) => ({
|
|
@@ -12449,8 +12540,8 @@ const cargoMentions = (source) => pipe(Option.liftThrowable(() => getStaticTOMLV
|
|
|
12449
12540
|
})));
|
|
12450
12541
|
// src/features/check-repository-layout/model/path-existence.ts
|
|
12451
12542
|
const WILDCARD$3 = /[*?[]/u;
|
|
12452
|
-
const SEPARATOR$
|
|
12453
|
-
const FIRST$
|
|
12543
|
+
const SEPARATOR$15 = "/";
|
|
12544
|
+
const FIRST$15 = 0;
|
|
12454
12545
|
/** @internal */
|
|
12455
12546
|
const existsAt = Effect.fn("existsAt")(function* existsAt(root, path) {
|
|
12456
12547
|
const files = yield* RepositoryFiles;
|
|
@@ -12465,20 +12556,20 @@ const isDirectoryAt = Effect.fn("isDirectoryAt")(function* isDirectoryAt(root, p
|
|
|
12465
12556
|
/** @internal */
|
|
12466
12557
|
const staticPrefix = (path) => {
|
|
12467
12558
|
const prefix = Array$1.headNonEmpty(String$1.split(path, WILDCARD$3));
|
|
12468
|
-
if (String$1.endsWith(SEPARATOR$
|
|
12559
|
+
if (String$1.endsWith(SEPARATOR$15)(prefix)) return String$1.slice(FIRST$15, -1)(prefix);
|
|
12469
12560
|
return prefix;
|
|
12470
12561
|
};
|
|
12471
12562
|
/** @internal */
|
|
12472
12563
|
const isIgnored = Effect.fn("isIgnored")(function* isIgnored(root, path) {
|
|
12473
12564
|
const prefix = staticPrefix(path);
|
|
12474
12565
|
if (String$1.isEmpty(prefix)) return false;
|
|
12475
|
-
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR$
|
|
12566
|
+
const ignored = yield* (yield* RepositoryFiles).ignoredPaths(root, [prefix, `${prefix}${SEPARATOR$15}`]);
|
|
12476
12567
|
return Array$1.isReadonlyArrayNonEmpty(ignored);
|
|
12477
12568
|
});
|
|
12478
12569
|
// src/features/check-repository-layout/model/tsconfig-paths.ts
|
|
12479
12570
|
const WRAP_OFFSET$2 = 1;
|
|
12480
12571
|
const WILDCARD$2 = /[*?[{]/u;
|
|
12481
|
-
const SEPARATOR$
|
|
12572
|
+
const SEPARATOR$14 = "/";
|
|
12482
12573
|
const RELATIVE$1 = ".";
|
|
12483
12574
|
const JSON_EXTENSION = ".json";
|
|
12484
12575
|
const isObject = (node) => Predicate.isReadonlyObject(node) && node["type"] === "ObjectExpression";
|
|
@@ -12486,7 +12577,7 @@ const firstObject = (node) => {
|
|
|
12486
12577
|
if (isObject(node)) return Option.some(node);
|
|
12487
12578
|
return pipe(childrenOf$2(node), Array$1.findFirst(firstObject));
|
|
12488
12579
|
};
|
|
12489
|
-
const leadingDirectory = (pattern) => pipe(String$1.split(pattern, SEPARATOR$
|
|
12580
|
+
const leadingDirectory = (pattern) => pipe(String$1.split(pattern, SEPARATOR$14), Array$1.takeWhile((segment) => !WILDCARD$2.test(segment)), Array$1.join(SEPARATOR$14));
|
|
12490
12581
|
const listed$2 = (root) => (name, candidatesOf, valuesOf = stringsIn) => pipe(propertyValue(name)(root), Option.toArray, Array$1.flatMap(valuesOf), Array$1.map(({ text, start }) => ({
|
|
12491
12582
|
field: name,
|
|
12492
12583
|
text,
|
|
@@ -12513,7 +12604,7 @@ const tsconfigMentions = Effect.fn("tsconfigMentions")(function* tsconfigMention
|
|
|
12513
12604
|
])));
|
|
12514
12605
|
});
|
|
12515
12606
|
// src/features/check-repository-layout/model/config-paths.ts
|
|
12516
|
-
const RULE$
|
|
12607
|
+
const RULE$57 = "config-path";
|
|
12517
12608
|
const WORKSPACE_FILE$4 = "pnpm-workspace.yaml";
|
|
12518
12609
|
const CARGO_MANIFEST = /(?:^|\/)Cargo\.toml$/u;
|
|
12519
12610
|
const TSCONFIG = /(?:^|\/)tsconfig(?:\.[\w-]+)?\.json$/u;
|
|
@@ -12532,14 +12623,14 @@ const byIndex = Order.mapInput(Order.Number, ({ index }) => index);
|
|
|
12532
12623
|
const problemOf$9 = (file, source) => (mention) => ({
|
|
12533
12624
|
file,
|
|
12534
12625
|
...positionOf(source)(mention.index),
|
|
12535
|
-
rule: RULE$
|
|
12626
|
+
rule: RULE$57,
|
|
12536
12627
|
message: `${mention.field} names ${mention.text}, which does not exist in this repository. Point it at a path that exists or remove the entry.`
|
|
12537
12628
|
});
|
|
12538
12629
|
const mentionsIn = Effect.fn("mentionsIn")(function* mentionsIn(file, source) {
|
|
12539
12630
|
if (CARGO_MANIFEST.test(file)) return cargoMentions(source);
|
|
12540
12631
|
return yield* tsconfigMentions(file, source);
|
|
12541
12632
|
});
|
|
12542
|
-
const problemsIn$
|
|
12633
|
+
const problemsIn$20 = Effect.fn("problemsIn")(function* problemsIn(root, name) {
|
|
12543
12634
|
const files = yield* RepositoryFiles;
|
|
12544
12635
|
const file = files.join(root, name);
|
|
12545
12636
|
const source = yield* files.readFile(file);
|
|
@@ -12557,7 +12648,7 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
12557
12648
|
return pipe(patterns, Array$1.map((pattern) => ({
|
|
12558
12649
|
file,
|
|
12559
12650
|
...positionOf(source.value)(indexOfText(source.value)(pattern)),
|
|
12560
|
-
rule: RULE$
|
|
12651
|
+
rule: RULE$57,
|
|
12561
12652
|
message: `packages lists ${pattern}, which matches no workspace package. Point it at directories that have a package.json or remove the entry.`
|
|
12562
12653
|
})));
|
|
12563
12654
|
});
|
|
@@ -12565,23 +12656,23 @@ const unmatchedPatterns = Effect.fn("unmatchedPatterns")(function* unmatchedPatt
|
|
|
12565
12656
|
const checkConfigPaths = Effect.fn("checkConfigPaths")(function* checkConfigPaths(root) {
|
|
12566
12657
|
const owned = yield* (yield* RepositoryFiles).ownedFiles(root);
|
|
12567
12658
|
const configs = pipe(owned, Array$1.filter((name) => CARGO_MANIFEST.test(name) || TSCONFIG.test(name)));
|
|
12568
|
-
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$
|
|
12659
|
+
const [found, patterns] = yield* Effect.all([Effect.forEach(configs, (name) => problemsIn$20(root, name), { concurrency: READ_CONCURRENCY$21 }), unmatchedPatterns(root)], { concurrency: "unbounded" });
|
|
12569
12660
|
return [...Array$1.flatten(found), ...patterns];
|
|
12570
12661
|
});
|
|
12571
12662
|
// src/features/check-repository-layout/model/crates.ts
|
|
12572
|
-
const RULE$
|
|
12663
|
+
const RULE$56 = "unverified-crate";
|
|
12573
12664
|
const VERSION_RULE = "release-version";
|
|
12574
12665
|
const APP_DIRECTORIES = ["", "src-tauri"];
|
|
12575
12666
|
const CARGO_FILE$1 = "Cargo.toml";
|
|
12576
12667
|
const CONFIG_FILE$6 = "vite.config.ts";
|
|
12577
|
-
const SEPARATOR$
|
|
12578
|
-
const FIRST$
|
|
12668
|
+
const SEPARATOR$13 = "/";
|
|
12669
|
+
const FIRST$14 = 1;
|
|
12579
12670
|
const READ_CONCURRENCY$20 = 8;
|
|
12580
12671
|
const problemFor$4 = (crate, message) => ({
|
|
12581
12672
|
file: crate.manifest,
|
|
12582
|
-
line: FIRST$
|
|
12583
|
-
column: FIRST$
|
|
12584
|
-
rule: RULE$
|
|
12673
|
+
line: FIRST$14,
|
|
12674
|
+
column: FIRST$14,
|
|
12675
|
+
rule: RULE$56,
|
|
12585
12676
|
message: `crate ${crate.name} ${message}, so vp run verify never checks it.`
|
|
12586
12677
|
});
|
|
12587
12678
|
const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories, crate) {
|
|
@@ -12594,15 +12685,15 @@ const problemIn$3 = Effect.fn("problemIn")(function* problemIn(root, directories
|
|
|
12594
12685
|
const versionProblemIn = Effect.fn("versionProblemIn")(function* versionProblemIn(root, directories, crate) {
|
|
12595
12686
|
const files = yield* RepositoryFiles;
|
|
12596
12687
|
const directory = files.relative(root, files.dirname(crate.manifest));
|
|
12597
|
-
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$
|
|
12688
|
+
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$13))), Array$1.contains(directory))));
|
|
12598
12689
|
if (Option.isNone(workspace)) return Option.none();
|
|
12599
12690
|
const text = yield* files.readFile(files.join(root, workspace.value, PACKAGE_JSON_FILE));
|
|
12600
12691
|
const version = pipe(text, Option.flatMap(decodePackageJson), Option.flatMap(({ version: own }) => Option.fromUndefinedOr(own)));
|
|
12601
12692
|
if (Option.isNone(version) || version.value === crate.version) return Option.none();
|
|
12602
12693
|
return Option.some({
|
|
12603
12694
|
file: crate.manifest,
|
|
12604
|
-
line: FIRST$
|
|
12605
|
-
column: FIRST$
|
|
12695
|
+
line: FIRST$14,
|
|
12696
|
+
column: FIRST$14,
|
|
12606
12697
|
rule: VERSION_RULE,
|
|
12607
12698
|
message: `crate ${crate.name} is version ${crate.version} but ${workspace.value}/${PACKAGE_JSON_FILE} is ${version.value}. msch-publish releases the version in package.json, so bump both in the same PR.`
|
|
12608
12699
|
});
|
|
@@ -12617,7 +12708,7 @@ const checkCrates = Effect.fn("checkCrates")(function* checkCrates(root) {
|
|
|
12617
12708
|
return Array$1.getSomes(Array$1.flatten(found));
|
|
12618
12709
|
});
|
|
12619
12710
|
// src/features/check-repository-layout/model/deploy-entry-patterns.ts
|
|
12620
|
-
const RULE$
|
|
12711
|
+
const RULE$55 = "deploy-entry-pattern";
|
|
12621
12712
|
const FALLOW_KEYS = [
|
|
12622
12713
|
"entry",
|
|
12623
12714
|
"entryPoints",
|
|
@@ -12672,7 +12763,7 @@ const patternsOf = Effect.fn("patternsOf")(function* patternsOf(file, text, kind
|
|
|
12672
12763
|
const parsed = yield* Effect.promise(() => parse(`${file}.ts`, kind.sourceOf(text), { lang: "ts" }));
|
|
12673
12764
|
return pipe(patternsIn(kind.keys)(parsed.program), Array$1.filter(({ text: pattern }) => !String$1.startsWith(NEGATED)(pattern)));
|
|
12674
12765
|
});
|
|
12675
|
-
const problemsIn$
|
|
12766
|
+
const problemsIn$19 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
12676
12767
|
const { root, file, kind, workspaces, entries } = request;
|
|
12677
12768
|
const files = yield* RepositoryFiles;
|
|
12678
12769
|
const path = files.join(root, file);
|
|
@@ -12688,7 +12779,7 @@ const problemsIn$17 = Effect.fn("problemsIn")(function* problemsIn(request) {
|
|
|
12688
12779
|
return pipe(Array$1.getSomes(flagged), Array$1.map(({ text: pattern, start }) => ({
|
|
12689
12780
|
file: path,
|
|
12690
12781
|
...positionOf(text.value)(start - kind.offset),
|
|
12691
|
-
rule: RULE$
|
|
12782
|
+
rule: RULE$55,
|
|
12692
12783
|
message: `${pattern} ${MESSAGE$14}`
|
|
12693
12784
|
})));
|
|
12694
12785
|
});
|
|
@@ -12711,7 +12802,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
12711
12802
|
}];
|
|
12712
12803
|
return [];
|
|
12713
12804
|
}));
|
|
12714
|
-
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$
|
|
12805
|
+
const found = yield* Effect.forEach(configs, ({ file, kind }) => problemsIn$19({
|
|
12715
12806
|
root,
|
|
12716
12807
|
file,
|
|
12717
12808
|
kind,
|
|
@@ -12721,7 +12812,7 @@ const checkDeployEntryPatterns = Effect.fn("checkDeployEntryPatterns")(function*
|
|
|
12721
12812
|
return Array$1.flatten(found);
|
|
12722
12813
|
});
|
|
12723
12814
|
// src/features/check-repository-layout/model/fallow-entries.ts
|
|
12724
|
-
const RULE$
|
|
12815
|
+
const RULE$54 = "listed-entry";
|
|
12725
12816
|
const ENTRY_KEYS = [
|
|
12726
12817
|
"entry",
|
|
12727
12818
|
"entryPoints",
|
|
@@ -12729,7 +12820,7 @@ const ENTRY_KEYS = [
|
|
|
12729
12820
|
];
|
|
12730
12821
|
const FALLOW_CONFIG = /(?:^|\/)(?:\.fallowrc\.jsonc?|fallow-plugin-[^/]+\.jsonc?|\.fallow\/plugins\/[^/]+\.jsonc?)$/u;
|
|
12731
12822
|
const WILDCARD$1 = /[*?{[]/u;
|
|
12732
|
-
const SEPARATOR$
|
|
12823
|
+
const SEPARATOR$12 = "/";
|
|
12733
12824
|
const WRAP_OFFSET = 1;
|
|
12734
12825
|
const READ_CONCURRENCY$18 = 8;
|
|
12735
12826
|
const decodeKey = Schema.decodeUnknownOption(KeySchema);
|
|
@@ -12741,8 +12832,8 @@ const entryPatternsIn = (node) => {
|
|
|
12741
12832
|
})));
|
|
12742
12833
|
return pipe(childrenOf$2(node), Array$1.flatMap(entryPatternsIn));
|
|
12743
12834
|
};
|
|
12744
|
-
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array$1.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$
|
|
12745
|
-
const problemsIn$
|
|
12835
|
+
const namesOneFile = (directories) => ({ text }) => pipe(directories, Array$1.some((directory) => String$1.startsWith(`${directory}${SEPARATOR$12}`)(text))) || String$1.includes(SEPARATOR$12)(text) && !WILDCARD$1.test(text);
|
|
12836
|
+
const problemsIn$18 = Effect.fn("problemsIn")(function* problemsIn(root, file, directories) {
|
|
12746
12837
|
const files = yield* RepositoryFiles;
|
|
12747
12838
|
const path = files.join(root, file);
|
|
12748
12839
|
const text = yield* files.readFile(path);
|
|
@@ -12751,7 +12842,7 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
12751
12842
|
return pipe(entryPatternsIn(parsed.program), Array$1.filter(namesOneFile(directories)), Array$1.map(({ text: pattern, start }) => ({
|
|
12752
12843
|
file: path,
|
|
12753
12844
|
...positionOf(text.value)(start),
|
|
12754
|
-
rule: RULE$
|
|
12845
|
+
rule: RULE$54,
|
|
12755
12846
|
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.`
|
|
12756
12847
|
})));
|
|
12757
12848
|
});
|
|
@@ -12759,15 +12850,15 @@ const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, file, d
|
|
|
12759
12850
|
const checkFallowEntries = Effect.fn("checkFallowEntries")(function* checkFallowEntries(root) {
|
|
12760
12851
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
12761
12852
|
const directories = yield* workspaceDirectories(root);
|
|
12762
|
-
const found = yield* Effect.forEach(pipe(listed, Array$1.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$
|
|
12853
|
+
const found = yield* Effect.forEach(pipe(listed, Array$1.filter((file) => FALLOW_CONFIG.test(file))), (file) => problemsIn$18(root, file, directories), { concurrency: READ_CONCURRENCY$18 });
|
|
12763
12854
|
return Array$1.flatten(found);
|
|
12764
12855
|
});
|
|
12765
12856
|
// src/features/check-repository-layout/model/root-workspace-paths.ts
|
|
12766
|
-
const RULE$
|
|
12857
|
+
const RULE$53 = "root-workspace-path";
|
|
12767
12858
|
const CONFIG_FILE$5 = "vite.config.ts";
|
|
12768
12859
|
const PATH_CHARACTER = /[\w.@/-]/u;
|
|
12769
12860
|
const NAME_CHARACTER = /[\w.@-]/u;
|
|
12770
|
-
const FIRST$
|
|
12861
|
+
const FIRST$13 = 0;
|
|
12771
12862
|
const NEXT$2 = 1;
|
|
12772
12863
|
const isBoundary = (character, allowed) => character === "" || !allowed.test(character);
|
|
12773
12864
|
const mentions = (directory) => (text) => {
|
|
@@ -12775,14 +12866,14 @@ const mentions = (directory) => (text) => {
|
|
|
12775
12866
|
return pipe(Array$1.drop(parts, NEXT$2), Array$1.some((after, index) => {
|
|
12776
12867
|
const before = parts[index] ?? "";
|
|
12777
12868
|
const previous = String$1.slice(before.length - NEXT$2)(before);
|
|
12778
|
-
const following = String$1.slice(FIRST$
|
|
12869
|
+
const following = String$1.slice(FIRST$13, NEXT$2)(after);
|
|
12779
12870
|
return isBoundary(previous, PATH_CHARACTER) && (following === "/" || isBoundary(following, NAME_CHARACTER));
|
|
12780
12871
|
}));
|
|
12781
12872
|
};
|
|
12782
|
-
const problemsIn$
|
|
12873
|
+
const problemsIn$17 = (file, source, directories) => (found) => pipe(directories, Array$1.filter((directory) => mentions(directory)(found.text)), Array$1.map((directory) => ({
|
|
12783
12874
|
file,
|
|
12784
12875
|
...positionOf(source)(found.start),
|
|
12785
|
-
rule: RULE$
|
|
12876
|
+
rule: RULE$53,
|
|
12786
12877
|
message: `${directory} is a workspace. The root ${CONFIG_FILE$5} holds what applies to every workspace, so move what only ${directory} needs into ${directory}/${CONFIG_FILE$5}: msch.lint, msch.devDependencies or its verify task.`
|
|
12787
12878
|
})));
|
|
12788
12879
|
/** @internal */
|
|
@@ -12793,12 +12884,12 @@ const checkRootWorkspacePaths = Effect.fn("checkRootWorkspacePaths")(function* c
|
|
|
12793
12884
|
if (Option.isNone(source)) return [];
|
|
12794
12885
|
const directories = yield* workspaceDirectories(root);
|
|
12795
12886
|
const parsed = yield* Effect.promise(() => parse(file, source.value, { lang: "ts" }));
|
|
12796
|
-
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$
|
|
12887
|
+
return pipe(stringsIn(parsed.program), Array$1.flatMap(problemsIn$17(file, source.value, directories)));
|
|
12797
12888
|
});
|
|
12798
12889
|
// src/features/check-repository-layout/model/hidden-verify.ts
|
|
12799
|
-
const RULE$
|
|
12890
|
+
const RULE$52 = "hidden-verify";
|
|
12800
12891
|
const CONFIG_FILE$4 = "vite.config.ts";
|
|
12801
|
-
const FIRST$
|
|
12892
|
+
const FIRST$12 = 1;
|
|
12802
12893
|
const READ_CONCURRENCY$17 = 8;
|
|
12803
12894
|
const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory) {
|
|
12804
12895
|
const config = yield* workspaceConfigOf(root, directory);
|
|
@@ -12808,9 +12899,9 @@ const problemIn$2 = Effect.fn("problemIn")(function* problemIn(root, directory)
|
|
|
12808
12899
|
const verified = yield* hasVerifyTask(file);
|
|
12809
12900
|
return Option.some({
|
|
12810
12901
|
file,
|
|
12811
|
-
line: FIRST$
|
|
12812
|
-
column: FIRST$
|
|
12813
|
-
rule: RULE$
|
|
12902
|
+
line: FIRST$12,
|
|
12903
|
+
column: FIRST$12,
|
|
12904
|
+
rule: RULE$52,
|
|
12814
12905
|
message: `${directory} gets its verify task from code outside ${CONFIG_FILE$4}. The root verify reads ${CONFIG_FILE$4} without running it, so it never runs this verify. Write run.tasks.verify in ${directory}/${CONFIG_FILE$4}.`
|
|
12815
12906
|
}).pipe(Option.filter(() => verified));
|
|
12816
12907
|
});
|
|
@@ -12821,7 +12912,7 @@ const checkHiddenVerify = Effect.fn("checkHiddenVerify")(function* checkHiddenVe
|
|
|
12821
12912
|
return Array$1.getSomes(found);
|
|
12822
12913
|
});
|
|
12823
12914
|
// src/features/check-repository-layout/model/shared-uncached-tasks.ts
|
|
12824
|
-
const RULE$
|
|
12915
|
+
const RULE$51 = "shared-uncached-task";
|
|
12825
12916
|
const READ_CONCURRENCY$16 = 8;
|
|
12826
12917
|
const SHARED = 2;
|
|
12827
12918
|
const OWN_PROGRAM = /^(?:node|vpx|bun|deno|tsx)$|\//u;
|
|
@@ -12864,7 +12955,7 @@ const problemsOf$3 = (definitions) => {
|
|
|
12864
12955
|
return pipe(definitions, Array$1.map(({ file, position, name, command }) => ({
|
|
12865
12956
|
file,
|
|
12866
12957
|
...position,
|
|
12867
|
-
rule: RULE$
|
|
12958
|
+
rule: RULE$51,
|
|
12868
12959
|
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.`
|
|
12869
12960
|
})));
|
|
12870
12961
|
};
|
|
@@ -12875,7 +12966,7 @@ const checkSharedUncachedTasks = Effect.fn("checkSharedUncachedTasks")(function*
|
|
|
12875
12966
|
return pipe(Array$1.flatten(found), Array$1.groupBy(({ name, definition }) => `${name}\u0000${definition}`), Record.values, Array$1.flatMap(problemsOf$3));
|
|
12876
12967
|
});
|
|
12877
12968
|
// src/features/check-repository-layout/model/unlocked-tasks.ts
|
|
12878
|
-
const RULE$
|
|
12969
|
+
const RULE$50 = "unlocked-task";
|
|
12879
12970
|
const READ_CONCURRENCY$15 = 8;
|
|
12880
12971
|
const READS_DEPENDENCIES = /^vp (?:test|pack|build)\b/u;
|
|
12881
12972
|
const decodeCommand = Schema.decodeUnknownOption(Schema.Union([Schema.String, Schema.NonEmptyArray(Schema.String)]));
|
|
@@ -12887,7 +12978,7 @@ const tracksLockfiles = (task) => pipe(propertyValue("cache")(task.value), Optio
|
|
|
12887
12978
|
const problemsOf$2 = ({ file, source, tasks }) => pipe(tasks, Array$1.filter(tracksLockfiles), Array$1.flatMap((task) => pipe(commandOf(task), Option.map((command) => ({
|
|
12888
12979
|
file,
|
|
12889
12980
|
...positionOf(source)(task.start),
|
|
12890
|
-
rule: RULE$
|
|
12981
|
+
rule: RULE$50,
|
|
12891
12982
|
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.`
|
|
12892
12983
|
})), Option.toArray)));
|
|
12893
12984
|
/** @internal */
|
|
@@ -12942,7 +13033,7 @@ const scalarsIn = (source) => {
|
|
|
12942
13033
|
const ROOT$2 = ".";
|
|
12943
13034
|
const LOCAL$1 = "./";
|
|
12944
13035
|
const NEGATION = "!";
|
|
12945
|
-
const SEPARATOR$
|
|
13036
|
+
const SEPARATOR$11 = "/";
|
|
12946
13037
|
const LINE$1 = "\n";
|
|
12947
13038
|
const UNRESOLVED_MARKERS = [
|
|
12948
13039
|
"${{",
|
|
@@ -12969,7 +13060,7 @@ const withoutLocal = (path) => {
|
|
|
12969
13060
|
const joinPath = (base, path) => {
|
|
12970
13061
|
const relative = withoutLocal(String$1.trim(path));
|
|
12971
13062
|
if (base === ROOT$2) return relative;
|
|
12972
|
-
return `${base}${SEPARATOR$
|
|
13063
|
+
return `${base}${SEPARATOR$11}${relative}`;
|
|
12973
13064
|
};
|
|
12974
13065
|
const reference = (kind, field, base = ROOT$2) => ({ text, offset }) => {
|
|
12975
13066
|
const path = String$1.trim(text);
|
|
@@ -13019,11 +13110,11 @@ const jobReferences = (base) => ([job, node]) => {
|
|
|
13019
13110
|
...pipe(steps, Array$1.flatMap(stepReferences(job, directory)))
|
|
13020
13111
|
];
|
|
13021
13112
|
};
|
|
13022
|
-
const groupsOf = (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) => ({
|
|
13113
|
+
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) => ({
|
|
13023
13114
|
text: value,
|
|
13024
13115
|
offset
|
|
13025
13116
|
})));
|
|
13026
|
-
const hashFilesIn = (source) => pipe(scalarsIn(source), Array$1.flatMap(groupsOf(HASH_FILES, "arguments")), Array$1.flatMap(groupsOf(QUOTED$2, "path")), Array$1.filter(isPositive), Array$1.flatMap(reference("glob", "hashFiles")));
|
|
13117
|
+
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")));
|
|
13027
13118
|
const jobsOf = (source) => entriesOf(childOf("jobs")(parseDocument(source).contents));
|
|
13028
13119
|
/** @internal */
|
|
13029
13120
|
const workflowReferences = (source) => {
|
|
@@ -13042,11 +13133,11 @@ const outputPathsOf = (step) => pipe(stringOf(pathInputOf(step)), Option.toArray
|
|
|
13042
13133
|
/** @internal */
|
|
13043
13134
|
const producedPaths = (source) => pipe(jobsOf(source), Array$1.flatMap(([, job]) => itemsOf(childOf("steps")(job))), Array$1.flatMap(outputPathsOf));
|
|
13044
13135
|
// src/features/check-repository-layout/model/workflow-paths.ts
|
|
13045
|
-
const RULE$
|
|
13136
|
+
const RULE$49 = "workflow-path";
|
|
13046
13137
|
const WORKFLOW_DIRECTORY = ".github/workflows/";
|
|
13047
13138
|
const WORKFLOW_EXTENSIONS = [".yml", ".yaml"];
|
|
13048
13139
|
const READ_CONCURRENCY$14 = 8;
|
|
13049
|
-
const SEPARATOR$
|
|
13140
|
+
const SEPARATOR$10 = "/";
|
|
13050
13141
|
const EXPECTED = {
|
|
13051
13142
|
action: "a directory with action.yml",
|
|
13052
13143
|
directory: "a directory",
|
|
@@ -13061,10 +13152,10 @@ const matchesAny = Effect.fn("matchesAny")(function* matchesAny(root, pathspecs)
|
|
|
13061
13152
|
});
|
|
13062
13153
|
const matchesGlob = (root, path) => matchesAny(root, [`:(glob)${path}`]);
|
|
13063
13154
|
const hasAction = Effect.fn("hasAction")(function* hasAction(root, path) {
|
|
13064
|
-
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$
|
|
13155
|
+
const found = yield* Effect.forEach(ACTION_DEFINITIONS, (name) => existsAt(root, `${path}${SEPARATOR$10}${name}`), { concurrency: 1 });
|
|
13065
13156
|
return pipe(found, Array$1.some(Boolean));
|
|
13066
13157
|
});
|
|
13067
|
-
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array$1.drop(index), Array$1.join(SEPARATOR$
|
|
13158
|
+
const suffixAt = (segments) => (index) => `:(glob)**/${pipe(segments, Array$1.drop(index), Array$1.join(SEPARATOR$10))}`;
|
|
13068
13159
|
const RESOLVERS = {
|
|
13069
13160
|
action: hasAction,
|
|
13070
13161
|
directory: isDirectoryAt,
|
|
@@ -13072,11 +13163,11 @@ const RESOLVERS = {
|
|
|
13072
13163
|
glob: matchesGlob,
|
|
13073
13164
|
script: Effect.fn("findsScript")(function* findsScript(root, path) {
|
|
13074
13165
|
if (yield* existsAt(root, path)) return true;
|
|
13075
|
-
const segments = String$1.split(path, SEPARATOR$
|
|
13166
|
+
const segments = String$1.split(path, SEPARATOR$10);
|
|
13076
13167
|
return yield* matchesAny(root, Array$1.makeBy(segments.length, suffixAt(segments)));
|
|
13077
13168
|
})
|
|
13078
13169
|
};
|
|
13079
|
-
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$
|
|
13170
|
+
const overlaps = (path) => (produced) => produced === path || String$1.startsWith(`${path}${SEPARATOR$10}`)(produced) || String$1.startsWith(`${produced}${SEPARATOR$10}`)(path);
|
|
13080
13171
|
const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, found) {
|
|
13081
13172
|
const prefix = staticPrefix(found.path);
|
|
13082
13173
|
if (pipe(produced, Array$1.some(overlaps(prefix)))) return false;
|
|
@@ -13086,10 +13177,10 @@ const isMissing$1 = Effect.fn("isMissing")(function* isMissing(root, produced, f
|
|
|
13086
13177
|
const problemOf$8 = (file, source) => (found) => ({
|
|
13087
13178
|
file,
|
|
13088
13179
|
...positionOf(source)(found.offset),
|
|
13089
|
-
rule: RULE$
|
|
13180
|
+
rule: RULE$49,
|
|
13090
13181
|
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.`
|
|
13091
13182
|
});
|
|
13092
|
-
const problemsIn$
|
|
13183
|
+
const problemsIn$16 = Effect.fn("problemsIn")(function* problemsIn(root, workflow) {
|
|
13093
13184
|
const files = yield* RepositoryFiles;
|
|
13094
13185
|
const file = files.join(root, workflow);
|
|
13095
13186
|
const source = yield* files.readFile(file);
|
|
@@ -13101,7 +13192,7 @@ const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn(root, workflo
|
|
|
13101
13192
|
/** @internal */
|
|
13102
13193
|
const checkWorkflowPaths = Effect.fn("checkWorkflowPaths")(function* checkWorkflowPaths(root) {
|
|
13103
13194
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
13104
|
-
const found = yield* Effect.forEach(pipe(listed, Array$1.filter(isWorkflow)), (workflow) => problemsIn$
|
|
13195
|
+
const found = yield* Effect.forEach(pipe(listed, Array$1.filter(isWorkflow)), (workflow) => problemsIn$16(root, workflow), { concurrency: READ_CONCURRENCY$14 });
|
|
13105
13196
|
return Array$1.flatten(found);
|
|
13106
13197
|
});
|
|
13107
13198
|
// src/features/check-repository-layout/model/workflow-scale.ts
|
|
@@ -13112,9 +13203,9 @@ const ACTION = /^\.github\/actions\/(?<name>[^/]+)\/action\.ya?ml$/u;
|
|
|
13112
13203
|
const FILTER_KEYS = ["paths", "paths-ignore"];
|
|
13113
13204
|
const PATHS_FILTER_ACTION = /(?:^|\/)paths-filter@/u;
|
|
13114
13205
|
const PACKAGE_FILTER = /(?:^|\s)(?:--filter|-F)(?:\s+|=)(?<quote>["']?)(?<value>[^\s"'$][^\s"']*)\k<quote>/gu;
|
|
13115
|
-
const START$
|
|
13206
|
+
const START$25 = 0;
|
|
13116
13207
|
const READ_CONCURRENCY$13 = 8;
|
|
13117
|
-
const SEPARATOR$
|
|
13208
|
+
const SEPARATOR$9 = "/";
|
|
13118
13209
|
const WORD_SEPARATORS = /[-_]/gu;
|
|
13119
13210
|
const SPACE = " ";
|
|
13120
13211
|
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.";
|
|
@@ -13137,13 +13228,13 @@ const pathFiltersIn = (file, source) => {
|
|
|
13137
13228
|
};
|
|
13138
13229
|
const matching = (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));
|
|
13139
13230
|
const named$1 = (workspaces, text) => Option.orElse(matching(workspaces, text), () => matching(workspaces, String$1.replaceAll(WORD_SEPARATORS, SPACE)(text)));
|
|
13140
|
-
const containing = (workspaces, path) => pipe(workspaces, Array$1.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$
|
|
13231
|
+
const containing = (workspaces, path) => pipe(workspaces, Array$1.findFirst(({ directory }) => path === directory || String$1.startsWith(`${directory}${SEPARATOR$9}`)(path)), Option.map(({ directory }) => directory));
|
|
13141
13232
|
const namesIn$2 = (name, source) => {
|
|
13142
13233
|
const root = parseDocument(source).contents;
|
|
13143
13234
|
return [
|
|
13144
13235
|
{
|
|
13145
13236
|
text: name,
|
|
13146
|
-
offset: START$
|
|
13237
|
+
offset: START$25
|
|
13147
13238
|
},
|
|
13148
13239
|
...Option.toArray(stringOf(childOf("name")(root))),
|
|
13149
13240
|
...keysOf(childOf("jobs")(root))
|
|
@@ -13214,14 +13305,14 @@ const checkWorkspaces = Effect.fn("checkWorkspaces")(function* checkWorkspaces(r
|
|
|
13214
13305
|
});
|
|
13215
13306
|
// src/shared/lib/package-name.ts
|
|
13216
13307
|
const SCOPE$1 = "@";
|
|
13217
|
-
const SEPARATOR$
|
|
13308
|
+
const SEPARATOR$8 = "/";
|
|
13218
13309
|
const SCOPED_SEGMENTS = 2;
|
|
13219
13310
|
const PLAIN_SEGMENTS = 1;
|
|
13220
13311
|
const segmentCount = (specifier) => {
|
|
13221
13312
|
if (String$1.startsWith(SCOPE$1)(specifier)) return SCOPED_SEGMENTS;
|
|
13222
13313
|
return PLAIN_SEGMENTS;
|
|
13223
13314
|
};
|
|
13224
|
-
const packageNameOf = (specifier) => pipe(String$1.split(specifier, SEPARATOR$
|
|
13315
|
+
const packageNameOf = (specifier) => pipe(String$1.split(specifier, SEPARATOR$8), Array$1.take(segmentCount(specifier)), Array$1.join(SEPARATOR$8));
|
|
13225
13316
|
// src/features/measure-install-size/model/import-graph.ts
|
|
13226
13317
|
const RELATIVE = /^\.\.?(?:\/|$)/u;
|
|
13227
13318
|
const SUBPATH_IMPORT$1 = "#";
|
|
@@ -13312,7 +13403,7 @@ const packagesByEntry = Effect.fn("packagesByEntry")(function* packagesByEntry(a
|
|
|
13312
13403
|
}).pipe(Effect.map((packages) => [entry, packages])), { concurrency: 1 });
|
|
13313
13404
|
});
|
|
13314
13405
|
// src/features/measure-install-size/model/installed-closure.ts
|
|
13315
|
-
const EMPTY$
|
|
13406
|
+
const EMPTY$2 = 0;
|
|
13316
13407
|
const installedNames = (manifest) => [...namesIn(manifest, ["dependencies", "optionalDependencies"]), ...pipe(namesIn(manifest, ["peerDependencies"]), Array$1.difference(optionalPeerNames(manifest)))];
|
|
13317
13408
|
const childrenOf = Effect.fn("childrenOf")(function* childrenOf(directory) {
|
|
13318
13409
|
const files = yield* RepositoryFiles;
|
|
@@ -13355,7 +13446,7 @@ const directorySize = (directory) => Effect.gen(function* sizeOfDirectory() {
|
|
|
13355
13446
|
const names = yield* files.readDirectory(directory);
|
|
13356
13447
|
const entries = pipe(names, Array$1.filter((name) => name !== NODE_MODULES), Array$1.map((name) => files.join(directory, name)));
|
|
13357
13448
|
const sizes = yield* Effect.forEach(entries, (entry) => files.isDirectory(entry).pipe(Effect.flatMap((kind) => {
|
|
13358
|
-
if (Option.isNone(kind)) return Effect.succeed(EMPTY$
|
|
13449
|
+
if (Option.isNone(kind)) return Effect.succeed(EMPTY$2);
|
|
13359
13450
|
if (kind.value) return directorySize(entry);
|
|
13360
13451
|
return files.fileSize(entry);
|
|
13361
13452
|
})), { concurrency: 1 });
|
|
@@ -13367,7 +13458,7 @@ const installedClosure = ({ provided, from, name }) => closureOf(provided, {
|
|
|
13367
13458
|
});
|
|
13368
13459
|
const installedSize = (directory) => {
|
|
13369
13460
|
if (String$1.includes(`/node_modules/`)(directory)) return directorySize(directory);
|
|
13370
|
-
return Effect.succeed(EMPTY$
|
|
13461
|
+
return Effect.succeed(EMPTY$2);
|
|
13371
13462
|
};
|
|
13372
13463
|
// src/features/measure-install-size/model/install-size.ts
|
|
13373
13464
|
const INSTALL_SIZE = "install-size";
|
|
@@ -13378,11 +13469,11 @@ const LISTED_LARGEST = 5;
|
|
|
13378
13469
|
const SIZE_CONCURRENCY = 32;
|
|
13379
13470
|
const MEGABYTE = 1e6;
|
|
13380
13471
|
const MEGABYTE_DIGITS = 1;
|
|
13381
|
-
const START$
|
|
13472
|
+
const START$24 = 0;
|
|
13382
13473
|
const SINGLE_ENTRY = 1;
|
|
13383
13474
|
const megabytes = (bytes) => `${(bytes / MEGABYTE).toFixed(MEGABYTE_DIGITS)} MB`;
|
|
13384
13475
|
const usageHint = (dependency, entryCount) => {
|
|
13385
|
-
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$
|
|
13476
|
+
if (!(entryCount > SINGLE_ENTRY && dependency.entries.length > START$24 && dependency.entries.length < entryCount)) return "";
|
|
13386
13477
|
return ` (imported only from ${Array$1.join(dependency.entries, ", ")})`;
|
|
13387
13478
|
};
|
|
13388
13479
|
const listed$1 = ({ largest, entryCount }) => pipe(largest, Array$1.map((dependency) => `${dependency.name} ${megabytes(dependency.size)}${usageHint(dependency, entryCount)}`), Array$1.join(", "));
|
|
@@ -13391,7 +13482,7 @@ const budgetProblem = Effect.fn("budgetProblem")(function* budgetProblem(overrun
|
|
|
13391
13482
|
const { workspace, total } = overrun;
|
|
13392
13483
|
const config = yield* files.readFile(workspace.configFile);
|
|
13393
13484
|
const source = Option.getOrElse(config, () => "");
|
|
13394
|
-
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$
|
|
13485
|
+
const index = Option.getOrElse(String$1.indexOf(BUDGET_KEY)(source), () => START$24);
|
|
13395
13486
|
return {
|
|
13396
13487
|
file: workspace.configFile,
|
|
13397
13488
|
...positionOf(source)(index),
|
|
@@ -13408,7 +13499,7 @@ const measure = Effect.fn("measure")(function* measure({ workspace, provided },
|
|
|
13408
13499
|
const everything = pipe(closures, Array$1.flatMap(([, packages]) => Array$1.fromIterable(packages)), HashSet.fromIterable);
|
|
13409
13500
|
const measured = yield* Effect.forEach(everything, (found) => installedSize(found).pipe(Effect.map((size) => [found, size])), { concurrency: SIZE_CONCURRENCY });
|
|
13410
13501
|
const sizes = HashMap.fromIterable(measured);
|
|
13411
|
-
const sizeOf = (packages) => packages.pipe(Array$1.fromIterable, Array$1.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$
|
|
13502
|
+
const sizeOf = (packages) => packages.pipe(Array$1.fromIterable, Array$1.map((found) => Option.getOrElse(HashMap.get(sizes, found), () => START$24)), Number$1.sumAll);
|
|
13412
13503
|
return {
|
|
13413
13504
|
closures,
|
|
13414
13505
|
sizeOf,
|
|
@@ -13441,11 +13532,11 @@ const sizeProblems = Effect.fn("sizeProblems")(function* sizeProblems(published,
|
|
|
13441
13532
|
})];
|
|
13442
13533
|
});
|
|
13443
13534
|
const stackProblems = (file, source, dependencies) => {
|
|
13444
|
-
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$
|
|
13535
|
+
const section = Option.getOrElse(String$1.indexOf(DEPENDENCIES_KEY$1)(source), () => START$24);
|
|
13445
13536
|
const rest = String$1.slice(section)(source);
|
|
13446
13537
|
return pipe(Record.toEntries(dependencies), Array$1.filter(([, specifier]) => specifier === STACK_CATALOG), Array$1.map(([name]) => ({
|
|
13447
13538
|
file,
|
|
13448
|
-
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
13539
|
+
...positionOf(source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$24)),
|
|
13449
13540
|
rule: STACK_DEPENDENCY,
|
|
13450
13541
|
message: `${name} comes from the stack catalog, so every project that installs this package already has it. Move it to peerDependencies and keep it in devDependencies, so the installing project shares one copy.`
|
|
13451
13542
|
})));
|
|
@@ -13484,11 +13575,11 @@ const checkPublishedPackages = Effect.fn("checkPublishedPackages")(function* che
|
|
|
13484
13575
|
return Array$1.flatten(found);
|
|
13485
13576
|
});
|
|
13486
13577
|
// src/features/check-migration-order/model/migration-order.ts
|
|
13487
|
-
const RULE$
|
|
13578
|
+
const RULE$48 = "migration-order";
|
|
13488
13579
|
const SNAPSHOT = "snapshot.json";
|
|
13489
13580
|
const MIGRATION = "migration.sql";
|
|
13490
13581
|
const SNAPSHOTS = [`*/${SNAPSHOT}`];
|
|
13491
|
-
const FIRST$
|
|
13582
|
+
const FIRST$11 = 1;
|
|
13492
13583
|
const READ_CONCURRENCY$12 = 16;
|
|
13493
13584
|
const isSnapshot = (basename) => (file) => basename(file) === SNAPSHOT;
|
|
13494
13585
|
const migrationAt = Effect.fn("migrationAt")(function* migrationAt(root, base, file) {
|
|
@@ -13516,9 +13607,9 @@ const latestOf = (migrations) => pipe(migrations, Array$1.filter(({ applied }) =
|
|
|
13516
13607
|
const isBefore = (later) => (migration) => !migration.applied && Order.isLessThan(String$1.Order)(migration.folder, later.folder);
|
|
13517
13608
|
const outOfOrder = (root, base, join) => (migrations) => pipe(latestOf(migrations), Option.map((latest) => pipe(migrations, Array$1.filter(isBefore(latest)), Array$1.map(({ file, folder }) => ({
|
|
13518
13609
|
file: join(root, file),
|
|
13519
|
-
line: FIRST$
|
|
13520
|
-
column: FIRST$
|
|
13521
|
-
rule: RULE$
|
|
13610
|
+
line: FIRST$11,
|
|
13611
|
+
column: FIRST$11,
|
|
13612
|
+
rule: RULE$48,
|
|
13522
13613
|
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}.`
|
|
13523
13614
|
})))), Option.getOrElse(() => []));
|
|
13524
13615
|
/** @internal */
|
|
@@ -13535,13 +13626,13 @@ const checkMigrationOrder = Effect.fn("checkMigrationOrder")(function* checkMigr
|
|
|
13535
13626
|
// src/shared/lib/bundle-error.ts
|
|
13536
13627
|
const ERROR_LINE = /\[[A-Z_]+\]/u;
|
|
13537
13628
|
const SHOWN_ERRORS = 3;
|
|
13538
|
-
const HEADER = "Build failed";
|
|
13629
|
+
const HEADER$1 = "Build failed";
|
|
13539
13630
|
const NO_DETAIL = "Run the bundle to see the error.";
|
|
13540
13631
|
const linesOf = (error) => pipe(Option.liftPredicate(error, Predicate.isError), Option.map(({ message }) => message), Option.getOrElse(() => String(error)), stripVTControlCharacters, String$1.split("\n"), Array$1.map(String$1.trim), Array$1.filter(String$1.isNonEmpty));
|
|
13541
13632
|
const bundleErrorDetail = (error) => {
|
|
13542
13633
|
const lines = linesOf(error);
|
|
13543
13634
|
return pipe(lines, Array$1.filter((line) => ERROR_LINE.test(line)), Array$1.take(SHOWN_ERRORS), Array$1.match({
|
|
13544
|
-
onEmpty: () => pipe(lines, Array$1.findFirst((line) => !String$1.startsWith(HEADER)(line)), Option.getOrElse(() => NO_DETAIL)),
|
|
13635
|
+
onEmpty: () => pipe(lines, Array$1.findFirst((line) => !String$1.startsWith(HEADER$1)(line)), Option.getOrElse(() => NO_DETAIL)),
|
|
13545
13636
|
onNonEmpty: Array$1.join(" ")
|
|
13546
13637
|
}));
|
|
13547
13638
|
};
|
|
@@ -13662,23 +13753,23 @@ const bundleScopeOf = ({ manifest, workspace }) => ({
|
|
|
13662
13753
|
});
|
|
13663
13754
|
const stackPackagesOf = ({ devDependencies }) => pipe(Option.fromUndefinedOr(devDependencies), Option.map(Record.filter((specifier) => specifier === STACK_CATALOG)), Option.map(Record.keys), Option.getOrElse(() => []));
|
|
13664
13755
|
// src/features/check-tree-shaking/model/optional-peers.ts
|
|
13665
|
-
const RULE$
|
|
13756
|
+
const RULE$47 = "optional-peer";
|
|
13666
13757
|
const REQUIRED_RULE = "required-peer";
|
|
13667
|
-
const START$
|
|
13668
|
-
const SINGLE = 1;
|
|
13758
|
+
const START$23 = 0;
|
|
13759
|
+
const SINGLE$1 = 1;
|
|
13669
13760
|
const DEPENDENCIES_KEY = "\"dependencies\"";
|
|
13670
13761
|
const PEER_META_KEY = "\"peerDependenciesMeta\"";
|
|
13671
13762
|
const importsPackage = (name) => ({ packages }) => Array$1.contains(packages, name);
|
|
13672
13763
|
const labelsOf = (importers) => pipe(importers, Array$1.map(({ entry }) => `\`${entry.label}\``), Array$1.dedupe, Array$1.join(", "));
|
|
13673
13764
|
const positionIn = (located, key, name) => {
|
|
13674
|
-
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$
|
|
13765
|
+
const section = Option.getOrElse(String$1.indexOf(key)(located.source), () => START$23);
|
|
13675
13766
|
const rest = String$1.slice(section)(located.source);
|
|
13676
|
-
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$
|
|
13767
|
+
return positionOf(located.source)(section + Option.getOrElse(String$1.indexOf(`"${name}"`)(rest), () => START$23));
|
|
13677
13768
|
};
|
|
13678
13769
|
const problemFor$3 = (located, name, importers) => ({
|
|
13679
13770
|
file: located.file,
|
|
13680
13771
|
...positionIn(located, DEPENDENCIES_KEY, name),
|
|
13681
|
-
rule: RULE$
|
|
13772
|
+
rule: RULE$47,
|
|
13682
13773
|
message: `${name} is imported only from ${labelsOf(importers)}, so installing the other entries must not require it. Move it to peerDependencies, mark it optional in peerDependenciesMeta and keep it in devDependencies.`
|
|
13683
13774
|
});
|
|
13684
13775
|
const requiredPeerAdvice = (fromStack) => {
|
|
@@ -13689,11 +13780,11 @@ const librariesIn = (used) => pipe(used, Array$1.filter(({ entry }) => !isBinEnt
|
|
|
13689
13780
|
const optionalPeerProblems = ({ located, manifest, used }) => {
|
|
13690
13781
|
const libraries = librariesIn(used);
|
|
13691
13782
|
const bins = pipe(used, Array$1.filter(({ entry }) => isBinEntry(entry)));
|
|
13692
|
-
if (libraries.length <= SINGLE) return [];
|
|
13783
|
+
if (libraries.length <= SINGLE$1) return [];
|
|
13693
13784
|
return pipe(Record.keys(manifest.dependencies ?? {}), Array$1.flatMap((name) => {
|
|
13694
13785
|
const importers = pipe(libraries, Array$1.filter(importsPackage(name)));
|
|
13695
13786
|
const neededByBin = pipe(bins, Array$1.some(importsPackage(name)));
|
|
13696
|
-
if (!(importers.length > START$
|
|
13787
|
+
if (!(importers.length > START$23 && importers.length < libraries.length) || neededByBin) return [];
|
|
13697
13788
|
return [problemFor$3(located, name, importers)];
|
|
13698
13789
|
}));
|
|
13699
13790
|
};
|
|
@@ -13714,10 +13805,10 @@ const requiredPeerProblems = ({ located, manifest, used }) => {
|
|
|
13714
13805
|
}));
|
|
13715
13806
|
};
|
|
13716
13807
|
// src/features/check-tree-shaking/model/side-effects.ts
|
|
13717
|
-
const RULE$
|
|
13808
|
+
const RULE$46 = "side-effects";
|
|
13718
13809
|
const BUNDLE_CONCURRENCY$2 = 4;
|
|
13719
|
-
const START$
|
|
13720
|
-
const FIRST$
|
|
13810
|
+
const START$22 = 0;
|
|
13811
|
+
const FIRST$10 = 1;
|
|
13721
13812
|
const LISTED_PACKAGES = 4;
|
|
13722
13813
|
const SIDE_EFFECTS_KEY = "\"sideEffects\"";
|
|
13723
13814
|
const EXPORTS_KEY = "\"exports\"";
|
|
@@ -13740,7 +13831,7 @@ const memberExcess = Effect.fn("memberExcess")(function* memberExcess({ scope, e
|
|
|
13740
13831
|
label: entry.label,
|
|
13741
13832
|
member,
|
|
13742
13833
|
...extra
|
|
13743
|
-
}, ({ modules }) => modules > START$
|
|
13834
|
+
}, ({ modules }) => modules > START$22);
|
|
13744
13835
|
});
|
|
13745
13836
|
const excessOf = Effect.fn("excessOf")(function* excessOf(subject) {
|
|
13746
13837
|
const names = yield* exportNamesOf(subject.scope, subject.entry.source);
|
|
@@ -13757,20 +13848,20 @@ const importsOf = (packages) => Array$1.match(packages, {
|
|
|
13757
13848
|
onNonEmpty: (names) => ` and imports ${listed(names)}`
|
|
13758
13849
|
});
|
|
13759
13850
|
const othersOf = (total) => {
|
|
13760
|
-
if (total <= FIRST$
|
|
13761
|
-
return ` The same happens for ${String(total - FIRST$
|
|
13851
|
+
if (total <= FIRST$10) return "";
|
|
13852
|
+
return ` The same happens for ${String(total - FIRST$10)} other exports.`;
|
|
13762
13853
|
};
|
|
13763
13854
|
const messageOf$4 = (worst, total) => `importing \`${worst.member}\` from \`${worst.label}\` also bundles ${String(worst.modules)} modules${importsOf(worst.packages)}, which it does not use.${othersOf(total)} Declare "sideEffects": false in package.json so that a bundler drops what nothing imports, and keep a module that must run for its effect out of the package.`;
|
|
13764
13855
|
const largest = Order.mapInput(Order.flip(Order.Number), (excess) => excess.modules);
|
|
13765
|
-
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$
|
|
13856
|
+
const keyIndex$1 = (source) => pipe(String$1.indexOf(SIDE_EFFECTS_KEY)(source), Option.orElse(() => String$1.indexOf(EXPORTS_KEY)(source)), Option.getOrElse(() => START$22));
|
|
13766
13857
|
const sideEffectProblems = ({ file, source, excesses }) => pipe(excesses, Array$1.sortBy(largest), Array$1.head, Option.map((worst) => ({
|
|
13767
13858
|
file,
|
|
13768
13859
|
...positionOf(source)(keyIndex$1(source)),
|
|
13769
|
-
rule: RULE$
|
|
13860
|
+
rule: RULE$46,
|
|
13770
13861
|
message: messageOf$4(worst, excesses.length)
|
|
13771
13862
|
})), Option.toArray);
|
|
13772
13863
|
// src/features/check-tree-shaking/model/top-level-effects.ts
|
|
13773
|
-
const RULE$
|
|
13864
|
+
const RULE$45 = "top-level-effect";
|
|
13774
13865
|
const CODE$1 = /\.[cm]?[jt]sx?$/u;
|
|
13775
13866
|
const READ_CONCURRENCY$11 = 16;
|
|
13776
13867
|
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.";
|
|
@@ -13783,10 +13874,10 @@ const messageOf$3 = (statement) => {
|
|
|
13783
13874
|
if (isImportDeclaration(statement)) return IMPORT_MESSAGE;
|
|
13784
13875
|
return STATEMENT_MESSAGE;
|
|
13785
13876
|
};
|
|
13786
|
-
const problemsIn$
|
|
13877
|
+
const problemsIn$15 = (api) => (file) => (source) => {
|
|
13787
13878
|
const retained = api.createSourceFile(file, source);
|
|
13788
13879
|
const problems = pipe(retained.sourceFile.statements, Array$1.fromIterable, Array$1.filter(isEffect), Array$1.map((statement) => problemAt$7({
|
|
13789
|
-
rule: RULE$
|
|
13880
|
+
rule: RULE$45,
|
|
13790
13881
|
message: messageOf$3(statement)
|
|
13791
13882
|
})(statement)));
|
|
13792
13883
|
retained.dispose();
|
|
@@ -13799,11 +13890,11 @@ const topLevelEffects = Effect.fn("topLevelEffects")(function* topLevelEffects(r
|
|
|
13799
13890
|
const names = yield* files.ownedFiles(root);
|
|
13800
13891
|
const owned = new Set(pipe(names, Array$1.map((name) => files.join(root, name))));
|
|
13801
13892
|
const sources = pipe(modules, Array$1.filter((file) => owned.has(file) && CODE$1.test(file)));
|
|
13802
|
-
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$
|
|
13893
|
+
const found = yield* Effect.forEach(sources, (file) => files.readFile(file).pipe(Effect.map((text) => pipe(text, Option.map(problemsIn$15(compiler.api)(file)), Option.getOrElse(() => [])))), { concurrency: READ_CONCURRENCY$11 });
|
|
13803
13894
|
return Array$1.flatten(found);
|
|
13804
13895
|
}, Effect.scoped);
|
|
13805
13896
|
const BUNDLED_RULE = "bundled-side-effects";
|
|
13806
|
-
const START$
|
|
13897
|
+
const START$21 = 0;
|
|
13807
13898
|
const NAME_KEY$2 = "\"name\"";
|
|
13808
13899
|
const packageDirectoryOf = (manifests, files) => (module) => {
|
|
13809
13900
|
const parent = files.dirname(module);
|
|
@@ -13820,7 +13911,7 @@ const undeclaredAt = Effect.fn("undeclaredAt")(function* undeclaredAt(directory)
|
|
|
13820
13911
|
})));
|
|
13821
13912
|
});
|
|
13822
13913
|
const undeclaredMessage = (files, root) => ({ directory, name }) => `bundles modules of \`${name}\`, whose package.json does not declare "sideEffects". A bundler reads that field from the package that owns each module, so it keeps every module that \`${name}\` re-exports, together with what those modules import, even when this package uses none of them. Declare "sideEffects": false in ${files.relative(root, files.join(directory, PACKAGE_JSON_FILE))}, and keep a module that must run for its effect out of that package.`;
|
|
13823
|
-
const nameIndex$1 = (source) => pipe(String$1.indexOf(NAME_KEY$2)(source), Option.getOrElse(() => START$
|
|
13914
|
+
const nameIndex$1 = (source) => pipe(String$1.indexOf(NAME_KEY$2)(source), Option.getOrElse(() => START$21));
|
|
13824
13915
|
/** @internal */
|
|
13825
13916
|
const bundledSideEffectProblems = Effect.fn("bundledSideEffectProblems")(function* bundledSideEffectProblems({ root, directory, located, used }) {
|
|
13826
13917
|
const files = yield* RepositoryFiles;
|
|
@@ -13954,12 +14045,12 @@ const checkTreeShaking = Effect.fn("checkTreeShaking")(function* checkTreeShakin
|
|
|
13954
14045
|
return Array$1.flatten(found);
|
|
13955
14046
|
});
|
|
13956
14047
|
// src/features/check-typescript-generation/model/typescript-generation.ts
|
|
13957
|
-
const RULE$
|
|
14048
|
+
const RULE$44 = "legacy-typescript";
|
|
13958
14049
|
const LOCKFILE = "pnpm-lock.yaml";
|
|
13959
14050
|
const COMPILER = "typescript";
|
|
13960
14051
|
const CURRENT_MAJOR = 7;
|
|
13961
14052
|
const LEGACY_COMPILER_PACKAGE = /^@typescript\/typescript\d+$/u;
|
|
13962
|
-
const FIRST$
|
|
14053
|
+
const FIRST$9 = 1;
|
|
13963
14054
|
const legacyOf = (id) => {
|
|
13964
14055
|
const { name, version } = parseDependencyPath(id);
|
|
13965
14056
|
const isOldCompiler = name === COMPILER && pipe(Option.fromNullishOr(version), Option.flatMap((found) => Option.fromNullishOr(semver.coerce(found))), Option.exists((found) => found.major < CURRENT_MAJOR));
|
|
@@ -13970,8 +14061,8 @@ const legacyOf = (id) => {
|
|
|
13970
14061
|
};
|
|
13971
14062
|
const dependentsOf = (nodes) => (id) => pipe(nodes, Array$1.filter(({ dependencies }) => Array$1.contains(dependencies, id)), Array$1.map((node) => `\`${node.id}\``));
|
|
13972
14063
|
const lineOf$2 = (source) => (id) => pipe(String$1.split(source, "\n"), Array$1.findFirstIndex((line) => String$1.replaceAll("'", "")(String$1.trim(line)) === `${id}:`), Option.match({
|
|
13973
|
-
onNone: () => FIRST$
|
|
13974
|
-
onSome: (index) => index + FIRST$
|
|
14064
|
+
onNone: () => FIRST$9,
|
|
14065
|
+
onSome: (index) => index + FIRST$9
|
|
13975
14066
|
}));
|
|
13976
14067
|
const messageOf$2 = (legacy, dependents) => `\`${legacy.id}\` is installed, pulled in by ${Array$1.join(dependents, ", ")}. Only TypeScript ${String(CURRENT_MAJOR)} or newer is used: remove the dependency that needs the old compiler, move it to the TypeScript ${String(CURRENT_MAJOR)} API, or bundle or port it. Do not install an old compiler beside TypeScript ${String(CURRENT_MAJOR)}.`;
|
|
13977
14068
|
/** @internal */
|
|
@@ -13984,13 +14075,13 @@ const checkTypescriptGeneration = Effect.fn("checkTypescriptGeneration")(functio
|
|
|
13984
14075
|
return pipe(Option.getOrElse(nodes, () => []), Array$1.flatMap(({ id }) => Option.toArray(legacyOf(id))), Array$1.map((legacy) => ({
|
|
13985
14076
|
file,
|
|
13986
14077
|
line: lineOf$2(source)(legacy.id),
|
|
13987
|
-
column: FIRST$
|
|
13988
|
-
rule: RULE$
|
|
14078
|
+
column: FIRST$9,
|
|
14079
|
+
rule: RULE$44,
|
|
13989
14080
|
message: messageOf$2(legacy, dependentsOf(Option.getOrElse(nodes, () => []))(legacy.id))
|
|
13990
14081
|
})));
|
|
13991
14082
|
});
|
|
13992
14083
|
// src/features/check-worker-bundles/model/worker-bundles.ts
|
|
13993
|
-
const RULE$
|
|
14084
|
+
const RULE$43 = "worker-bundle";
|
|
13994
14085
|
const BUNDLE_CONCURRENCY = 4;
|
|
13995
14086
|
const PLATFORM_MODULES = [/^cloudflare:/u, /^node:/u];
|
|
13996
14087
|
const CONDITIONS = [
|
|
@@ -14001,7 +14092,7 @@ const CONDITIONS = [
|
|
|
14001
14092
|
"module",
|
|
14002
14093
|
"default"
|
|
14003
14094
|
];
|
|
14004
|
-
const problemFor$2 = problemInFile(RULE$
|
|
14095
|
+
const problemFor$2 = problemInFile(RULE$43);
|
|
14005
14096
|
const problemOf$7 = (file, detail) => problemFor$2(file, `does not bundle as a Worker, so the deploy would fail. ${detail}`);
|
|
14006
14097
|
const bundleProblem = (file) => Effect.gen(function* bundle() {
|
|
14007
14098
|
const built = yield* Effect.tryPromise({
|
|
@@ -14122,10 +14213,10 @@ const fileFactsIn = (checker) => (sourceFiles, excluded) => pipe(sourceFiles, Ar
|
|
|
14122
14213
|
imports: importedFilesOf(checker)(sourceFile)
|
|
14123
14214
|
})), Array$1.filter((facts) => Array$1.isReadonlyArrayNonEmpty(facts.values) || Array$1.isReadonlyArrayNonEmpty(facts.imports)));
|
|
14124
14215
|
// src/features/check-value-owners/model/name-lists.ts
|
|
14125
|
-
const RULE$
|
|
14126
|
-
const TEST_FILE = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
14216
|
+
const RULE$42 = "hand-written-names";
|
|
14217
|
+
const TEST_FILE$1 = /\.test(?:\.[\w-]+)?\.[cm]?tsx?$/u;
|
|
14127
14218
|
const nameListOf = (site) => {
|
|
14128
|
-
if (TEST_FILE.test(site.file) || site.values.length < 2) return Option.none();
|
|
14219
|
+
if (TEST_FILE$1.test(site.file) || site.values.length < 2) return Option.none();
|
|
14129
14220
|
const names = pipe(site.values, Array$1.filter(Predicate.isString));
|
|
14130
14221
|
return Option.liftPredicate({
|
|
14131
14222
|
site,
|
|
@@ -14137,7 +14228,7 @@ const listedProblem = ({ file, line, column, names, reason }) => ({
|
|
|
14137
14228
|
file,
|
|
14138
14229
|
line,
|
|
14139
14230
|
column,
|
|
14140
|
-
rule: RULE$
|
|
14231
|
+
rule: RULE$42,
|
|
14141
14232
|
message: `The names ${formatValues(names)} are listed by hand, but ${reason}`
|
|
14142
14233
|
});
|
|
14143
14234
|
const problemOf$6 = ({ list, reason }) => listedProblem({
|
|
@@ -14174,12 +14265,12 @@ const problemIn$1 = (isOutsideType) => (list) => {
|
|
|
14174
14265
|
const outsideNameProblemsIn = (project) => {
|
|
14175
14266
|
const problemOfList = problemIn$1(outsideTypeIn(project));
|
|
14176
14267
|
return (sourceFile) => {
|
|
14177
|
-
if (TEST_FILE.test(sourceFile.fileName)) return [];
|
|
14268
|
+
if (TEST_FILE$1.test(sourceFile.fileName)) return [];
|
|
14178
14269
|
return pipe(descendantsOf(sourceFile), Array$1.filter(isArrayLiteralExpression), Array$1.map(problemOfList), Array$1.getSomes);
|
|
14179
14270
|
};
|
|
14180
14271
|
};
|
|
14181
14272
|
// src/features/check-value-owners/model/owners.ts
|
|
14182
|
-
const OWNER_TAG = TOOL_NAME;
|
|
14273
|
+
const OWNER_TAG = TOOL_NAME$1;
|
|
14183
14274
|
const FIRST_OWNER_COUNT = 1;
|
|
14184
14275
|
const ownerKeyOf = (declaration) => {
|
|
14185
14276
|
if (!isVariableDeclaration(declaration) || !isIdentifier(declaration.name)) return Option.none();
|
|
@@ -14552,7 +14643,7 @@ const analyzeProject = ({ owners, sourceChecks }) => (project) => {
|
|
|
14552
14643
|
// src/features/check-value-owners/model/cache.ts
|
|
14553
14644
|
const CACHE_DIRECTORY = [...MSCH_CACHE, "value-owners"];
|
|
14554
14645
|
const CACHE_SUFFIX = ".json";
|
|
14555
|
-
const EMPTY = "";
|
|
14646
|
+
const EMPTY$1 = "";
|
|
14556
14647
|
const FIELD_SEPARATOR = "\0";
|
|
14557
14648
|
const LINE_SEPARATOR = "\n";
|
|
14558
14649
|
const ValueSchema = Schema.Union([Schema.String, Schema.Finite]);
|
|
@@ -14590,7 +14681,7 @@ const fileDigest = (hash) => {
|
|
|
14590
14681
|
onSome: Effect.succeed,
|
|
14591
14682
|
onNone: () => Effect.gen(function* readDigest() {
|
|
14592
14683
|
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
14593
|
-
const found = yield* hash(Option.getOrElse(text, () => EMPTY));
|
|
14684
|
+
const found = yield* hash(Option.getOrElse(text, () => EMPTY$1));
|
|
14594
14685
|
digests.set(file, found);
|
|
14595
14686
|
return found;
|
|
14596
14687
|
})
|
|
@@ -14601,7 +14692,7 @@ const analysisCache = Effect.fn("analysisCache")(function* analysisCache(root, o
|
|
|
14601
14692
|
const files = yield* RepositoryFiles;
|
|
14602
14693
|
const hash = yield* hasher;
|
|
14603
14694
|
const fingerprint = yield* implementationFingerprint(import.meta.dirname);
|
|
14604
|
-
const salt = yield* hash(Array$1.join([fingerprint, String$1.replaceAll(root, EMPTY)(owners)], FIELD_SEPARATOR));
|
|
14695
|
+
const salt = yield* hash(Array$1.join([fingerprint, String$1.replaceAll(root, EMPTY$1)(owners)], FIELD_SEPARATOR));
|
|
14605
14696
|
return {
|
|
14606
14697
|
root,
|
|
14607
14698
|
directory: files.join(root, ...CACHE_DIRECTORY),
|
|
@@ -14616,7 +14707,7 @@ const keyOf = (cache) => (configPath, inputs) => Effect.gen(function* deriveKey(
|
|
|
14616
14707
|
const header = [
|
|
14617
14708
|
cache.salt,
|
|
14618
14709
|
files.relative(cache.root, configPath),
|
|
14619
|
-
String$1.replaceAll(cache.root, EMPTY)(inputs.options)
|
|
14710
|
+
String$1.replaceAll(cache.root, EMPTY$1)(inputs.options)
|
|
14620
14711
|
];
|
|
14621
14712
|
return yield* cache.hash(Array$1.join([
|
|
14622
14713
|
...header,
|
|
@@ -14715,7 +14806,7 @@ const definitionsOf = (entry) => pipe(entry.values, Array$1.map((value) => [valu
|
|
|
14715
14806
|
file: entry.file
|
|
14716
14807
|
}]));
|
|
14717
14808
|
const uniqueFiles = (pairs) => pipe(pairs, Array$1.map(([, defined]) => defined), Array$1.dedupeWith((left, right) => left.file === right.file));
|
|
14718
|
-
const definedIndexOf = (files) => pipe(files, Array$1.filter((entry) => !TEST_FILE.test(entry.file)), Array$1.flatMap(definitionsOf), Array$1.groupBy(([value]) => value), Record.map(uniqueFiles));
|
|
14809
|
+
const definedIndexOf = (files) => pipe(files, Array$1.filter((entry) => !TEST_FILE$1.test(entry.file)), Array$1.flatMap(definitionsOf), Array$1.groupBy(([value]) => value), Record.map(uniqueFiles));
|
|
14719
14810
|
const ownedOneByOne = (defined) => {
|
|
14720
14811
|
const hosted = pipe(defined, Array$1.flatMap(([, files]) => files), Array$1.groupBy((file) => file), Record.map((files) => files.length));
|
|
14721
14812
|
const hostsOne = (file) => Record.get(hosted, file).pipe(Option.exists((count) => count === SINGLE_NAME));
|
|
@@ -14743,7 +14834,7 @@ const declaredNameProblem = ({ literals, relative }) => {
|
|
|
14743
14834
|
const PATH_PREFIX = /^(?:!|\.\/)+/u;
|
|
14744
14835
|
const GLOB = /[*?{[]/u;
|
|
14745
14836
|
const EXTENSION$1 = /\.[^./]+$/u;
|
|
14746
|
-
const SEPARATOR$
|
|
14837
|
+
const SEPARATOR$7 = "/";
|
|
14747
14838
|
const ROOT$1 = ".";
|
|
14748
14839
|
const namedPath = (repository, file) => (name) => {
|
|
14749
14840
|
const bare = pipe(name, String$1.replace(PATH_PREFIX, ""));
|
|
@@ -14752,12 +14843,12 @@ const namedPath = (repository, file) => (name) => {
|
|
|
14752
14843
|
return pipe([fromFile, bare], Array$1.findFirst((path) => HashSet.has(repository.paths, path)));
|
|
14753
14844
|
};
|
|
14754
14845
|
const kindOf = (repository) => (path) => {
|
|
14755
|
-
if (HashSet.has(repository.directories, path)) return SEPARATOR$
|
|
14846
|
+
if (HashSet.has(repository.directories, path)) return SEPARATOR$7;
|
|
14756
14847
|
return pipe(path, String$1.match(EXTENSION$1), Option.flatMap(Array$1.head), Option.getOrElse(() => path));
|
|
14757
14848
|
};
|
|
14758
14849
|
const siblingsOf = (repository) => (path) => pipe(Record.get(repository.entries, repository.dirname(path)), Option.getOrElse(() => []), Array$1.filter((entry) => kindOf(repository)(entry) === kindOf(repository)(path)));
|
|
14759
14850
|
const coversDirectory = (repository) => (group) => pipe(Array$1.head(group), Option.exists((first) => group.length >= Math.max(2, siblingsOf(repository)(first).length - 1)));
|
|
14760
|
-
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array$1.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$
|
|
14851
|
+
const enumeratedDirectory = (repository) => (paths) => pipe(paths, Array$1.groupBy((path) => `${repository.dirname(path)}${SEPARATOR$7}${kindOf(repository)(path)}`), Record.values, Array$1.findFirst(coversDirectory(repository)), Option.flatMap(Array$1.head), Option.map(repository.dirname));
|
|
14761
14852
|
const directoryLabel = (directory) => {
|
|
14762
14853
|
if (directory === ROOT$1) return "the repository root";
|
|
14763
14854
|
return directory;
|
|
@@ -14809,11 +14900,11 @@ const handWrittenNameProblems = ({ repository, literals }) => (sites) => {
|
|
|
14809
14900
|
return pipe(lists, Array$1.map((list) => Array$1.findFirst(checks, (check) => check(list))), Array$1.getSomes);
|
|
14810
14901
|
};
|
|
14811
14902
|
// src/features/check-value-owners/model/repository-names.ts
|
|
14812
|
-
const SEPARATOR$
|
|
14903
|
+
const SEPARATOR$6 = "/";
|
|
14813
14904
|
const FIRST_SEGMENT = 1;
|
|
14814
14905
|
const prefixesOf = (file) => {
|
|
14815
|
-
const segments = pipe(file, String$1.split(SEPARATOR$
|
|
14816
|
-
return pipe(Array$1.range(FIRST_SEGMENT, segments.length), Array$1.map((count) => pipe(Array$1.take(segments, count), Array$1.join(SEPARATOR$
|
|
14906
|
+
const segments = pipe(file, String$1.split(SEPARATOR$6));
|
|
14907
|
+
return pipe(Array$1.range(FIRST_SEGMENT, segments.length), Array$1.map((count) => pipe(Array$1.take(segments, count), Array$1.join(SEPARATOR$6))));
|
|
14817
14908
|
};
|
|
14818
14909
|
const directoriesOf$1 = (file) => pipe(prefixesOf(file), Array$1.dropRight(FIRST_SEGMENT));
|
|
14819
14910
|
const nameOf = (text) => pipe(text, Option.flatMap(decodePackageJson), Option.flatMap((parsed) => Option.fromUndefinedOr(parsed.name)));
|
|
@@ -14928,7 +15019,7 @@ const checkRepository = Effect.fn("checkRepository")(function* checkRepository(r
|
|
|
14928
15019
|
return sortProblems([...ownerScan.problems, ...repositoryProblems(repository)(analyses)]);
|
|
14929
15020
|
}, Effect.scoped);
|
|
14930
15021
|
// src/features/source-code/find-namespace-destructuring/model/namespace-destructuring.ts
|
|
14931
|
-
const RULE$
|
|
15022
|
+
const RULE$41 = "namespace-destructuring";
|
|
14932
15023
|
const LOCAL = /^[.#/]/u;
|
|
14933
15024
|
const messageOf$1 = (name) => `Destructuring ${name}, which comes from a package, makes the bundler keep everything ${name} exports. Write ${name}.<member> where it is used.`;
|
|
14934
15025
|
const isPackage = (specifier) => isStringLiteral(specifier) && !LOCAL.test(specifier.text);
|
|
@@ -14944,7 +15035,7 @@ const destructuredName = (declaration) => {
|
|
|
14944
15035
|
return pipe(Option.fromUndefinedOr(declaration.initializer), Option.filter(isIdentifier), Option.map((initializer) => initializer.text));
|
|
14945
15036
|
};
|
|
14946
15037
|
const problemOf$5 = (names) => (declaration) => pipe(destructuredName(declaration), Option.filter((name) => names.includes(name)), Option.map((name) => problemAt$7({
|
|
14947
|
-
rule: RULE$
|
|
15038
|
+
rule: RULE$41,
|
|
14948
15039
|
message: messageOf$1(name)
|
|
14949
15040
|
})), Option.map((report) => report(declaration)));
|
|
14950
15041
|
const namespaceDestructuringIn = () => (sourceFile) => {
|
|
@@ -14952,7 +15043,7 @@ const namespaceDestructuringIn = () => (sourceFile) => {
|
|
|
14952
15043
|
return pipe(descendantsOf(sourceFile), Array$1.filter(isVariableDeclaration), Array$1.map(problemOf$5(names)), Array$1.getSomes);
|
|
14953
15044
|
};
|
|
14954
15045
|
// src/features/source-code/find-pass-through-wrappers/model/pass-through-wrappers.ts
|
|
14955
|
-
const RULE$
|
|
15046
|
+
const RULE$40 = "pass-through-wrapper";
|
|
14956
15047
|
const SINGLE_STATEMENT = 1;
|
|
14957
15048
|
const SINGLE_DECLARATION = 1;
|
|
14958
15049
|
const THIS_PARAMETER = "this";
|
|
@@ -15049,7 +15140,7 @@ const isPassThrough = (checker) => (candidate) => (forward) => {
|
|
|
15049
15140
|
const problemOf$4 = (checker) => (candidate) => {
|
|
15050
15141
|
if (changesTheCall(candidate.wrapper)) return Option.none();
|
|
15051
15142
|
return pipe(returnedExpression(candidate.wrapper), Option.flatMap(forwardOf), Option.filter(isPassThrough(checker)(candidate)), Option.map((forward) => problemAt$7({
|
|
15052
|
-
rule: RULE$
|
|
15143
|
+
rule: RULE$40,
|
|
15053
15144
|
message: messageOf(forward.callee.getText())
|
|
15054
15145
|
})(candidate.name)));
|
|
15055
15146
|
};
|
|
@@ -15058,7 +15149,7 @@ const passThroughWrappersIn = (checker) => (sourceFile) => pipe(descendantsOf(so
|
|
|
15058
15149
|
/** @internal */
|
|
15059
15150
|
const checkSources = (root) => checkRepository(root, [passThroughWrappersIn, namespaceDestructuringIn]);
|
|
15060
15151
|
// src/features/check-agent-settings/model/known-plugins.ts
|
|
15061
|
-
const RULE$
|
|
15152
|
+
const RULE$39 = "known-plugins";
|
|
15062
15153
|
const SETTINGS_FILE$2 = ".claude/settings.json";
|
|
15063
15154
|
const GITHUB$2 = "github";
|
|
15064
15155
|
const Source$1 = Schema.Struct({
|
|
@@ -15073,17 +15164,17 @@ const SettingsSchema$1 = Schema.Struct({
|
|
|
15073
15164
|
enabledPlugins: Schema.optionalKey(Plugins$1)
|
|
15074
15165
|
});
|
|
15075
15166
|
const decodeSettings$1 = Schema.decodeUnknownOption(Schema.fromJsonString(SettingsSchema$1));
|
|
15076
|
-
const problem$
|
|
15167
|
+
const problem$5 = problemInFile(RULE$39);
|
|
15077
15168
|
const fromGithub = (repository) => ({ source }) => source.source === GITHUB$2 && source.repo === repository;
|
|
15078
15169
|
const marketplaceKnown = (marketplace, settings) => pipe(Option.fromUndefinedOr(settings.extraKnownMarketplaces), Option.flatMap(Record.get(marketplace.name)), Option.exists(fromGithub(marketplace.repository)));
|
|
15079
15170
|
const pluginEnabled = (settings) => (plugin) => pipe(Option.fromUndefinedOr(settings.enabledPlugins), Option.flatMap(Record.get(plugin)), Option.getOrElse(() => false));
|
|
15080
15171
|
const marketplaceProblems = (marketplace, file, settings) => {
|
|
15081
15172
|
if (marketplaceKnown(marketplace, settings)) return [];
|
|
15082
|
-
return [problem$
|
|
15173
|
+
return [problem$5(file, `Agents miss the owner's own tools when the ${marketplace.name} marketplace is not known. Add "extraKnownMarketplaces": { "${marketplace.name}": { "source": { "source": "${GITHUB$2}", "repo": "${marketplace.repository}" } } }.`)];
|
|
15083
15174
|
};
|
|
15084
15175
|
const pluginProblems = (marketplace, file, settings) => {
|
|
15085
15176
|
const enabled = pluginEnabled(settings);
|
|
15086
|
-
return pipe(marketplace.plugins, Array$1.map((name) => `${name}@${marketplace.name}`), Array$1.filter((plugin) => !enabled(plugin)), Array$1.map((plugin) => problem$
|
|
15177
|
+
return pipe(marketplace.plugins, Array$1.map((name) => `${name}@${marketplace.name}`), Array$1.filter((plugin) => !enabled(plugin)), Array$1.map((plugin) => problem$5(file, `Enable "${plugin}" in "enabledPlugins" so every session gets it.`)));
|
|
15087
15178
|
};
|
|
15088
15179
|
/** @internal */
|
|
15089
15180
|
const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlugins(root) {
|
|
@@ -15095,20 +15186,20 @@ const checkKnownPlugins = Effect.fn("checkKnownPlugins")(function* checkKnownPlu
|
|
|
15095
15186
|
return [...marketplaceProblems(marketplace, file, settings), ...pluginProblems(marketplace, file, settings)];
|
|
15096
15187
|
});
|
|
15097
15188
|
// src/features/check-agent-settings/model/missing-hooks.ts
|
|
15098
|
-
const RULE$
|
|
15189
|
+
const RULE$38 = "missing-hook";
|
|
15099
15190
|
const SETTINGS_FILE$1 = /^\.claude\/settings\.json$/u;
|
|
15100
15191
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
15101
15192
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
15102
15193
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
15103
15194
|
const PLUGIN_ROOT = "..";
|
|
15104
15195
|
const READ_CONCURRENCY$10 = 16;
|
|
15105
|
-
const START$
|
|
15196
|
+
const START$20 = 0;
|
|
15106
15197
|
const referenceOf$1 = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
15107
15198
|
path,
|
|
15108
|
-
index: found.index ?? START$
|
|
15199
|
+
index: found.index ?? START$20
|
|
15109
15200
|
})), Option.toArray);
|
|
15110
15201
|
const referencesIn = (pattern, source) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.flatMap(referenceOf$1));
|
|
15111
|
-
const problemsIn$
|
|
15202
|
+
const problemsIn$14 = Effect.fn("problemsIn")(function* problemsIn({ root, file, base, pattern }) {
|
|
15112
15203
|
const files = yield* RepositoryFiles;
|
|
15113
15204
|
const text = yield* files.readFile(file);
|
|
15114
15205
|
if (Option.isNone(text)) return [];
|
|
@@ -15120,7 +15211,7 @@ const problemsIn$12 = Effect.fn("problemsIn")(function* problemsIn({ root, file,
|
|
|
15120
15211
|
return pipe(missing, Array$1.map(({ path, index }) => ({
|
|
15121
15212
|
file,
|
|
15122
15213
|
...positionOf(source)(index),
|
|
15123
|
-
rule: RULE$
|
|
15214
|
+
rule: RULE$38,
|
|
15124
15215
|
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.`
|
|
15125
15216
|
})));
|
|
15126
15217
|
});
|
|
@@ -15144,7 +15235,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
15144
15235
|
}];
|
|
15145
15236
|
return [];
|
|
15146
15237
|
}));
|
|
15147
|
-
const found = yield* Effect.forEach(hookFiles, problemsIn$
|
|
15238
|
+
const found = yield* Effect.forEach(hookFiles, problemsIn$14, { concurrency: READ_CONCURRENCY$10 });
|
|
15148
15239
|
return Array$1.flatten(found);
|
|
15149
15240
|
});
|
|
15150
15241
|
// src/features/check-documented-commands/model/task-graph.ts
|
|
@@ -15173,7 +15264,7 @@ const listedTasks = Effect.fn("listedTasks")(function* listedTasks(root) {
|
|
|
15173
15264
|
}, Effect.scoped, Effect.orElseSucceed(() => Option.none()));
|
|
15174
15265
|
const GivenTaskGraph = Context.Reference("msch/GivenTaskGraph", { defaultValue: () => Option.none() });
|
|
15175
15266
|
// src/features/check-documented-commands/model/commands.ts
|
|
15176
|
-
const RULE$
|
|
15267
|
+
const RULE$37 = "documented-commands";
|
|
15177
15268
|
const DOCUMENTS = ["*AGENTS.md", "*CLAUDE.md"];
|
|
15178
15269
|
const DOCUMENT_NAMES = /* @__PURE__ */ new Set(["AGENTS.md", "CLAUDE.md"]);
|
|
15179
15270
|
const COMMAND = /`vp run (?<args>[^`]+)`/gu;
|
|
@@ -15182,7 +15273,7 @@ const ARGS = "args";
|
|
|
15182
15273
|
const PLACEHOLDER = /[<>*{}$]/u;
|
|
15183
15274
|
const WHITESPACE = /\s+/u;
|
|
15184
15275
|
const ROOT = ".";
|
|
15185
|
-
const SEPARATOR$
|
|
15276
|
+
const SEPARATOR$5 = "/";
|
|
15186
15277
|
const END_OF_OPTIONS = "--";
|
|
15187
15278
|
const FLAG = "-";
|
|
15188
15279
|
const TASK_SEPARATOR$1 = "#";
|
|
@@ -15192,7 +15283,7 @@ const FILTER_ASSIGNMENT = "--filter=";
|
|
|
15192
15283
|
const RECURSIVE_FLAGS = /* @__PURE__ */ new Set(["-r", "--recursive"]);
|
|
15193
15284
|
const ROOT_FLAGS = /* @__PURE__ */ new Set(["-w", "--workspace-root"]);
|
|
15194
15285
|
const ONE$1 = 1;
|
|
15195
|
-
const START$
|
|
15286
|
+
const START$19 = 0;
|
|
15196
15287
|
const optionsOf = (args) => pipe(String$1.split(String$1.trim(args), WHITESPACE), Array$1.takeWhile((token) => token !== END_OF_OPTIONS));
|
|
15197
15288
|
const filterOf = (tokens) => pipe(tokens, Array$1.findFirstIndex((token) => FILTER_FLAGS.has(token)), Option.flatMap((index) => Array$1.get(tokens, index + ONE$1)), Option.orElse(() => pipe(tokens, Array$1.findFirst(String$1.startsWith(FILTER_ASSIGNMENT)), Option.map(String$1.slice(9)))));
|
|
15198
15289
|
const follows = (tokens) => (index) => pipe(Array$1.get(tokens, index - ONE$1), Option.exists((previous) => FILTER_FLAGS.has(previous)));
|
|
@@ -15229,8 +15320,8 @@ const parsed = (args) => {
|
|
|
15229
15320
|
return pipe(specifierOf(tokens), Option.filter(() => !pipe(tokens, Array$1.some((token) => PLACEHOLDER.test(token)))), Option.map(invocationOf(tokens)));
|
|
15230
15321
|
};
|
|
15231
15322
|
const ancestorsOf$1 = (file) => {
|
|
15232
|
-
const parts = pipe(String$1.split(file, SEPARATOR$
|
|
15233
|
-
return [...Array$1.makeBy(parts.length, (index) => pipe(parts, Array$1.take(parts.length - index), Array$1.join(SEPARATOR$
|
|
15323
|
+
const parts = pipe(String$1.split(file, SEPARATOR$5), Array$1.dropRight(ONE$1));
|
|
15324
|
+
return [...Array$1.makeBy(parts.length, (index) => pipe(parts, Array$1.take(parts.length - index), Array$1.join(SEPARATOR$5))), ROOT];
|
|
15234
15325
|
};
|
|
15235
15326
|
const named = (graph, name) => (directory) => directory === String$1.replace(LOCAL_PREFIX$1, "")(name) || pipe(Record.get(graph.packages, directory), Option.exists((found) => found.name === name));
|
|
15236
15327
|
const packagesOf = (graph, file) => (scope) => {
|
|
@@ -15248,13 +15339,13 @@ const whereOf = (scope, file) => {
|
|
|
15248
15339
|
return `the package that holds ${file}`;
|
|
15249
15340
|
};
|
|
15250
15341
|
const isMissing = (graph, file) => ({ task, scope }) => !pipe(packagesOf(graph, file)(scope), Array$1.some(hasTask(graph, task)));
|
|
15251
|
-
const problemsIn$
|
|
15342
|
+
const problemsIn$13 = (graph, absolute, { file, text }) => pipe(Array$1.fromIterable(String$1.matchAll(COMMAND)(text)), Array$1.flatMap((match) => pipe(Option.fromNullishOr(match.groups), Option.flatMap(Record.get(ARGS)), Option.flatMap(parsed), Option.filter(isMissing(graph, file)), Option.map(({ task, scope }) => ({
|
|
15252
15343
|
file: absolute(file),
|
|
15253
|
-
...positionOf(text)(match.index ?? START$
|
|
15254
|
-
rule: RULE$
|
|
15255
|
-
message: `${match[START$
|
|
15344
|
+
...positionOf(text)(match.index ?? START$19),
|
|
15345
|
+
rule: RULE$37,
|
|
15346
|
+
message: `${match[START$19]} runs task ${task}, but ${whereOf(scope, file)} has no such task. Fix the command or the task`
|
|
15256
15347
|
})), Option.toArray)));
|
|
15257
|
-
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$
|
|
15348
|
+
const isDocument = (file) => pipe(String$1.split(file, SEPARATOR$5), Array$1.last, Option.exists((name) => DOCUMENT_NAMES.has(name)));
|
|
15258
15349
|
/** @internal */
|
|
15259
15350
|
const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* checkDocumentedCommands(root) {
|
|
15260
15351
|
const files = yield* RepositoryFiles;
|
|
@@ -15276,14 +15367,14 @@ const checkDocumentedCommands = Effect.fn("checkDocumentedCommands")(function* c
|
|
|
15276
15367
|
file: absolute(Array$1.headNonEmpty(commanded).file),
|
|
15277
15368
|
line: ONE$1,
|
|
15278
15369
|
column: ONE$1,
|
|
15279
|
-
rule: RULE$
|
|
15370
|
+
rule: RULE$37,
|
|
15280
15371
|
message: "msch could not list the tasks with `vp run --json`"
|
|
15281
15372
|
}],
|
|
15282
|
-
onSome: (found) => pipe(commanded, Array$1.flatMap((document) => problemsIn$
|
|
15373
|
+
onSome: (found) => pipe(commanded, Array$1.flatMap((document) => problemsIn$13(found, absolute, document)))
|
|
15283
15374
|
});
|
|
15284
15375
|
});
|
|
15285
15376
|
// src/features/check-legacy-web/model/legacy-web.ts
|
|
15286
|
-
const RULE$
|
|
15377
|
+
const RULE$36 = "legacy-web";
|
|
15287
15378
|
const FIRST_COLUMN$3 = 1;
|
|
15288
15379
|
const SCANNER = fileURLToPath(new URL("./skills/modern-web-guidance/modern-web.mjs", import.meta.resolve("modern-web-guidance/package.json")));
|
|
15289
15380
|
const Finding = Schema.Struct({
|
|
@@ -15322,7 +15413,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
15322
15413
|
file: files.join(root, file),
|
|
15323
15414
|
line,
|
|
15324
15415
|
column: FIRST_COLUMN$3,
|
|
15325
|
-
rule: RULE$
|
|
15416
|
+
rule: RULE$36,
|
|
15326
15417
|
message: `${ruleId}: ${message} Read the guide with \`modern-web-guidance retrieve ${guideId}\` and apply it.`
|
|
15327
15418
|
});
|
|
15328
15419
|
return pipe(scan.guides, Array$1.flatMap(({ guideId, rules }) => pipe(rules, Array$1.flatMap(({ ruleId, findings }) => pipe(findings, Array$1.map(problemOf(guideId, ruleId)))))));
|
|
@@ -15331,7 +15422,7 @@ const checkLegacyWeb = Effect.fn("checkLegacyWeb")(function* checkLegacyWeb(root
|
|
|
15331
15422
|
const taggedError$4 = Schema.TaggedError;
|
|
15332
15423
|
var SectionConfigUnreadable = class extends taggedError$4()("SectionConfigUnreadable", { file: Schema.String }) {};
|
|
15333
15424
|
const CONFIG_FILE$3 = "vite.config.ts";
|
|
15334
|
-
const FIRST$
|
|
15425
|
+
const FIRST$8 = 1;
|
|
15335
15426
|
const ONE = 1;
|
|
15336
15427
|
const diagnostics = Metric.counter("lint.diagnostics", { description: "Diagnostics that each lint rule reported, before msch keeps only the errors" });
|
|
15337
15428
|
const countDiagnostics = (check, found) => Effect.forEach(found, (diagnostic) => Metric.update(Metric.withAttributes(diagnostics, {
|
|
@@ -15372,7 +15463,7 @@ const checkSection = (check) => (root) => Effect.gen(function* runSection() {
|
|
|
15372
15463
|
onSuccess: (found) => pipe(found, Array$1.filter(({ severity }) => severity === "error"), Array$1.map((diagnostic) => ({
|
|
15373
15464
|
file: files.join(root, diagnostic.path),
|
|
15374
15465
|
line: diagnostic.line,
|
|
15375
|
-
column: diagnostic.column ?? FIRST$
|
|
15466
|
+
column: diagnostic.column ?? FIRST$8,
|
|
15376
15467
|
rule: check.rule,
|
|
15377
15468
|
message: `${diagnostic.rule} ${diagnostic.message}${check.detail(diagnostic)}`
|
|
15378
15469
|
})))
|
|
@@ -15393,7 +15484,7 @@ const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|
|
|
|
15393
15484
|
const EXTENSION = /\.[^./]+$/u;
|
|
15394
15485
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
15395
15486
|
const READ_CONCURRENCY$9 = 64;
|
|
15396
|
-
const RULE$
|
|
15487
|
+
const RULE$35 = "shell-script";
|
|
15397
15488
|
const MESSAGE$13 = "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.";
|
|
15398
15489
|
const HookSchema = Schema.Struct({
|
|
15399
15490
|
command: Schema.optional(Schema.String),
|
|
@@ -15426,7 +15517,7 @@ const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScr
|
|
|
15426
15517
|
};
|
|
15427
15518
|
const candidates = pipe(names, Array$1.filter((name) => !isSessionStartHook(name)));
|
|
15428
15519
|
const shell = yield* Effect.filter(candidates, isShell, { concurrency: READ_CONCURRENCY$9 });
|
|
15429
|
-
return pipe(shell, Array$1.map((name) => problemInFile(RULE$
|
|
15520
|
+
return pipe(shell, Array$1.map((name) => problemInFile(RULE$35)(files.join(root, name), MESSAGE$13)));
|
|
15430
15521
|
});
|
|
15431
15522
|
// src/shared/lib/workflow-files.ts
|
|
15432
15523
|
const WORKFLOW_FILE = /^\.github\/workflows\/[^/]+\.ya?ml$/u;
|
|
@@ -15445,8 +15536,8 @@ const readWorkflows = Effect.fn("readWorkflows")(function* readWorkflows(root) {
|
|
|
15445
15536
|
});
|
|
15446
15537
|
// src/shared/lib/workflow-run.ts
|
|
15447
15538
|
const RUN_KEY = "run";
|
|
15448
|
-
const START$
|
|
15449
|
-
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$
|
|
15539
|
+
const START$18 = 0;
|
|
15540
|
+
const startOf = (range) => pipe(Option.fromNullishOr(range), Option.map(([start]) => start), Option.getOrElse(() => START$18));
|
|
15450
15541
|
const runScriptsOf = (source) => {
|
|
15451
15542
|
const found = [];
|
|
15452
15543
|
visit(parseDocument(source), { Pair: (_key, pair) => {
|
|
@@ -15461,7 +15552,7 @@ const runScriptsOf = (source) => {
|
|
|
15461
15552
|
const COMMAND_CHAIN = /&&|\|\||;|\|/u;
|
|
15462
15553
|
const QUOTED$1 = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
15463
15554
|
const COMMENT = "#";
|
|
15464
|
-
const RULE$
|
|
15555
|
+
const RULE$34 = "workflow-script";
|
|
15465
15556
|
const ONE_COMMAND = 1;
|
|
15466
15557
|
const MESSAGE$12 = "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.";
|
|
15467
15558
|
const isCommand = (line) => String$1.isNonEmpty(line) && !String$1.startsWith(COMMENT)(line);
|
|
@@ -15470,14 +15561,14 @@ const runsMoreThanOneCommand = ({ text }) => {
|
|
|
15470
15561
|
const lines = pipe(String$1.split("\n")(text), Array$1.map(String$1.trim), Array$1.filter(isCommand));
|
|
15471
15562
|
return lines.length > ONE_COMMAND || pipe(lines, Array$1.some(chainsCommands));
|
|
15472
15563
|
};
|
|
15473
|
-
const problemsIn$
|
|
15564
|
+
const problemsIn$12 = (file) => (source) => {
|
|
15474
15565
|
const at = positionOf(source);
|
|
15475
|
-
return pipe(runScriptsOf(source), Array$1.filter(runsMoreThanOneCommand), Array$1.map(({ start }) => problemAtPosition(RULE$
|
|
15566
|
+
return pipe(runScriptsOf(source), Array$1.filter(runsMoreThanOneCommand), Array$1.map(({ start }) => problemAtPosition(RULE$34)(file, at(start), MESSAGE$12)));
|
|
15476
15567
|
};
|
|
15477
15568
|
/** @internal */
|
|
15478
15569
|
const checkWorkflows = Effect.fn("checkWorkflows")(function* checkWorkflows(root) {
|
|
15479
15570
|
const workflows = yield* readWorkflows(root);
|
|
15480
|
-
return pipe(workflows, Array$1.flatMap(({ file, source }) => problemsIn$
|
|
15571
|
+
return pipe(workflows, Array$1.flatMap(({ file, source }) => problemsIn$12(file)(source)));
|
|
15481
15572
|
});
|
|
15482
15573
|
// src/features/check-scripts/model/script-checks.ts
|
|
15483
15574
|
/** @internal */
|
|
@@ -15497,12 +15588,12 @@ const checkStructure = checkSection({
|
|
|
15497
15588
|
// src/features/check-vite-plus/model/command-words.ts
|
|
15498
15589
|
const CONTINUATION = /\\\n/gu;
|
|
15499
15590
|
const QUOTED = /\$\{\{.*?\}\}|"(?:[^"\\]|\\.)*"|'[^']*'/gu;
|
|
15500
|
-
const SEPARATOR$
|
|
15591
|
+
const SEPARATOR$4 = /&&|\|\||[;|\n`]|\$\(/u;
|
|
15501
15592
|
const BLANK$1 = /\s+/u;
|
|
15502
15593
|
const ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/u;
|
|
15503
15594
|
const QUOTE = "\"\"";
|
|
15504
15595
|
const wordsOf = (segment) => pipe(String$1.split(String$1.trim(segment), BLANK$1), Array$1.filter(String$1.isNonEmpty), Array$1.dropWhile((word) => ASSIGNMENT.test(word)));
|
|
15505
|
-
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$
|
|
15596
|
+
const simpleCommands = (text) => pipe(text, String$1.replaceAll(CONTINUATION, " "), String$1.replaceAll(QUOTED, QUOTE), String$1.split(SEPARATOR$4), Array$1.map(wordsOf), Array$1.filter(Array$1.isReadonlyArrayNonEmpty));
|
|
15506
15597
|
// src/features/check-vite-plus/model/command-problems.ts
|
|
15507
15598
|
const PACKAGE_MANAGERS = [
|
|
15508
15599
|
"pnpm",
|
|
@@ -15558,7 +15649,7 @@ const problemsOf = (source) => pipe(simpleCommands(source.text), Array$1.flatMap
|
|
|
15558
15649
|
})))));
|
|
15559
15650
|
const commandProblems$1 = (sources) => pipe(sources, Array$1.flatMap(problemsOf));
|
|
15560
15651
|
// src/features/check-vite-plus/model/doc-sources.ts
|
|
15561
|
-
const FENCE$
|
|
15652
|
+
const FENCE$2 = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \t]*\n)(?<body>[\s\S]*?)^```[ \t]*$/gmu;
|
|
15562
15653
|
const INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\n]+)`(?!`)/gu;
|
|
15563
15654
|
const codeIn = (pattern) => (source) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.flatMap((match) => pipe(Option.all({
|
|
15564
15655
|
open: groupOf("open")(match),
|
|
@@ -15572,7 +15663,7 @@ const codeIn = (pattern) => (source) => pipe(Array$1.fromIterable(String$1.match
|
|
|
15572
15663
|
})), Option.toArray)));
|
|
15573
15664
|
const outside = (fences) => (span) => !pipe(fences, Array$1.some((fence) => span.start >= fence.start && span.start < fence.end));
|
|
15574
15665
|
const docSources = (file) => (source) => {
|
|
15575
|
-
const fences = codeIn(FENCE$
|
|
15666
|
+
const fences = codeIn(FENCE$2)(source);
|
|
15576
15667
|
const inline = pipe(codeIn(INLINE_CODE)(source), Array$1.filter(outside(fences)));
|
|
15577
15668
|
return pipe([...fences, ...inline], Array$1.map(({ text, start }) => ({
|
|
15578
15669
|
kind: "doc",
|
|
@@ -15603,15 +15694,15 @@ const AGENT_DOCS = [
|
|
|
15603
15694
|
...EXCLUDED$4
|
|
15604
15695
|
];
|
|
15605
15696
|
const READ_CONCURRENCY$7 = 16;
|
|
15606
|
-
const START$
|
|
15607
|
-
const FIRST$
|
|
15697
|
+
const START$17 = 0;
|
|
15698
|
+
const FIRST$7 = 1;
|
|
15608
15699
|
const LINE = "\n";
|
|
15609
15700
|
const CommandText = Schema.Union([Schema.String, Schema.Array(Schema.String)]);
|
|
15610
15701
|
const decodeCommandText = Schema.decodeUnknownOption(CommandText);
|
|
15611
15702
|
const decodeJson$1 = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
|
|
15612
15703
|
const decodeArguments = Schema.decodeUnknownOption(Schema.Array(Schema.String));
|
|
15613
15704
|
const NO_SOURCES = [];
|
|
15614
|
-
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
15705
|
+
const offsetOf$2 = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$17));
|
|
15615
15706
|
const scriptSources = (file) => (source) => pipe(decodePackageJson(source), Option.flatMap(({ scripts }) => Option.fromUndefinedOr(scripts)), Option.map(Record.toEntries), Option.getOrElse(() => []), Array$1.map(([name, text]) => {
|
|
15616
15707
|
const offset = offsetOf$2(source, `"${name}"`);
|
|
15617
15708
|
return {
|
|
@@ -15633,8 +15724,8 @@ const hookSources = (file, name) => (source) => pipe(String$1.split(source, LINE
|
|
|
15633
15724
|
kind: "hook",
|
|
15634
15725
|
file,
|
|
15635
15726
|
position: {
|
|
15636
|
-
line: index + FIRST$
|
|
15637
|
-
column: FIRST$
|
|
15727
|
+
line: index + FIRST$7,
|
|
15728
|
+
column: FIRST$7
|
|
15638
15729
|
},
|
|
15639
15730
|
name,
|
|
15640
15731
|
text
|
|
@@ -15707,7 +15798,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
|
|
|
15707
15798
|
return Array$1.flatten(found);
|
|
15708
15799
|
});
|
|
15709
15800
|
// src/features/check-vite-plus/model/package-scripts.ts
|
|
15710
|
-
const RULE$
|
|
15801
|
+
const RULE$33 = "package-script";
|
|
15711
15802
|
const LIFECYCLE = [
|
|
15712
15803
|
"preinstall",
|
|
15713
15804
|
"install",
|
|
@@ -15730,12 +15821,12 @@ const LIFECYCLE = [
|
|
|
15730
15821
|
const problemOf$3 = ({ file, position, name }) => ({
|
|
15731
15822
|
file,
|
|
15732
15823
|
...position,
|
|
15733
|
-
rule: RULE$
|
|
15824
|
+
rule: RULE$33,
|
|
15734
15825
|
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.`
|
|
15735
15826
|
});
|
|
15736
15827
|
const packageScriptProblems = (sources) => pipe(sources, Array$1.filter(({ kind, name }) => kind === "script" && !Array$1.contains(LIFECYCLE, name)), Array$1.map(problemOf$3));
|
|
15737
15828
|
// src/features/check-vite-plus/model/vite-plus-block.ts
|
|
15738
|
-
const RULE$
|
|
15829
|
+
const RULE$32 = "vite-plus-block";
|
|
15739
15830
|
const MARKER = Array$1.join([
|
|
15740
15831
|
"<!--",
|
|
15741
15832
|
"VITE PLUS START",
|
|
@@ -15748,7 +15839,7 @@ const problemIn = (file) => (source) => {
|
|
|
15748
15839
|
return Option.some({
|
|
15749
15840
|
file,
|
|
15750
15841
|
...positionOf(source)(index.value),
|
|
15751
|
-
rule: RULE$
|
|
15842
|
+
rule: RULE$32,
|
|
15752
15843
|
message: MESSAGE$11
|
|
15753
15844
|
});
|
|
15754
15845
|
};
|
|
@@ -15826,7 +15917,7 @@ const checkCiDrift = Effect.fn("checkCiDrift")(function* checkCiDrift(root) {
|
|
|
15826
15917
|
return pipe(drifts, Array$1.map(problemOf$2));
|
|
15827
15918
|
});
|
|
15828
15919
|
// src/features/check-workflows/model/publish-trigger.ts
|
|
15829
|
-
const RULE$
|
|
15920
|
+
const RULE$30 = "publish-trigger";
|
|
15830
15921
|
const PUBLISH = /\bmsch-publish\s+(?:plan|npm|release)\b/u;
|
|
15831
15922
|
const MANUAL = "workflow_dispatch";
|
|
15832
15923
|
const TRIGGER_KEY$1 = "on";
|
|
@@ -15840,18 +15931,18 @@ const publishTriggerOffsetsOf = (source) => {
|
|
|
15840
15931
|
};
|
|
15841
15932
|
/** @internal */
|
|
15842
15933
|
const checkPublishTrigger = workflowCheck({
|
|
15843
|
-
rule: RULE$
|
|
15934
|
+
rule: RULE$30,
|
|
15844
15935
|
message: MESSAGE$9,
|
|
15845
15936
|
offsetsOf: publishTriggerOffsetsOf
|
|
15846
15937
|
});
|
|
15847
15938
|
// src/features/check-workflows/model/release-please.ts
|
|
15848
|
-
const RULE$
|
|
15939
|
+
const RULE$29 = "release-please";
|
|
15849
15940
|
const RELEASE_PLEASE = /^googleapis\/release-please-action(?:@|$)/u;
|
|
15850
15941
|
const RELEASE_PLEASE_FILE = /(?:^|\/)(?:release-please-config|\.release-please-manifest)\.json$/u;
|
|
15851
|
-
const FIRST$
|
|
15942
|
+
const FIRST$6 = 1;
|
|
15852
15943
|
const MESSAGE$8 = "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.";
|
|
15853
15944
|
const checkReleasePleaseSteps = workflowCheck({
|
|
15854
|
-
rule: RULE$
|
|
15945
|
+
rule: RULE$29,
|
|
15855
15946
|
message: MESSAGE$8,
|
|
15856
15947
|
offsetsOf: scalarKeyOffsets({
|
|
15857
15948
|
name: "uses",
|
|
@@ -15863,9 +15954,9 @@ const checkReleasePleaseFiles = Effect.fn("checkReleasePleaseFiles")(function* c
|
|
|
15863
15954
|
const names = yield* files.listedFiles(root);
|
|
15864
15955
|
return pipe(names, Array$1.filter((name) => RELEASE_PLEASE_FILE.test(name)), Array$1.map((name) => ({
|
|
15865
15956
|
file: files.join(root, name),
|
|
15866
|
-
line: FIRST$
|
|
15867
|
-
column: FIRST$
|
|
15868
|
-
rule: RULE$
|
|
15957
|
+
line: FIRST$6,
|
|
15958
|
+
column: FIRST$6,
|
|
15959
|
+
rule: RULE$29,
|
|
15869
15960
|
message: MESSAGE$8
|
|
15870
15961
|
})));
|
|
15871
15962
|
});
|
|
@@ -15875,7 +15966,7 @@ const checkReleasePlease = Effect.fn("checkReleasePlease")(function* checkReleas
|
|
|
15875
15966
|
return Array$1.flatten(found);
|
|
15876
15967
|
});
|
|
15877
15968
|
// src/features/check-workflows/model/workflow-cancel.ts
|
|
15878
|
-
const RULE$
|
|
15969
|
+
const RULE$28 = "workflow-cancel";
|
|
15879
15970
|
const PUSH = "push";
|
|
15880
15971
|
const TRIGGER_KEY = "on";
|
|
15881
15972
|
const CONCURRENCY_KEY$1 = "concurrency";
|
|
@@ -15890,24 +15981,24 @@ const cancelOffsetsOf = (source) => {
|
|
|
15890
15981
|
};
|
|
15891
15982
|
/** @internal */
|
|
15892
15983
|
const checkWorkflowCancel = workflowCheck({
|
|
15893
|
-
rule: RULE$
|
|
15984
|
+
rule: RULE$28,
|
|
15894
15985
|
message: MESSAGE$7,
|
|
15895
15986
|
offsetsOf: cancelOffsetsOf
|
|
15896
15987
|
});
|
|
15897
15988
|
// src/features/check-workflows/model/workflow-queue.ts
|
|
15898
15989
|
const CONCURRENCY_KEY = "concurrency";
|
|
15899
15990
|
const QUEUE_KEY = "queue";
|
|
15900
|
-
const RULE$
|
|
15991
|
+
const RULE$27 = "workflow-queue";
|
|
15901
15992
|
const MESSAGE$6 = "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.";
|
|
15902
15993
|
const queueOffsetsOf = (source) => pipe(pairsNamed(CONCURRENCY_KEY)(source), Array$1.flatMap((pair) => Option.toArray(keyOffsetIn(QUEUE_KEY)(pair.value))));
|
|
15903
15994
|
/** @internal */
|
|
15904
15995
|
const checkWorkflowQueues = workflowCheck({
|
|
15905
|
-
rule: RULE$
|
|
15996
|
+
rule: RULE$27,
|
|
15906
15997
|
message: MESSAGE$6,
|
|
15907
15998
|
offsetsOf: queueOffsetsOf
|
|
15908
15999
|
});
|
|
15909
16000
|
// src/features/check-workflows/model/workflow-commits.ts
|
|
15910
|
-
const RULE$
|
|
16001
|
+
const RULE$26 = "workflow-commit";
|
|
15911
16002
|
const GIT_WRITE = /\bgit\s+(?:-{1,2}\S+\s+(?:\S+\s+)?)*(?:commit|push)\b/u;
|
|
15912
16003
|
const COMMIT_ACTION = /^[^@/]+\/[^@]*(?:commit|push)[^@]*(?:@|$)/iu;
|
|
15913
16004
|
const MESSAGE$5 = "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.";
|
|
@@ -15915,7 +16006,7 @@ const offsetsWhere = (name, pattern) => (source) => pipe(pairsNamed(name)(source
|
|
|
15915
16006
|
const commitOffsetsOf = (source) => [...offsetsWhere("run", GIT_WRITE)(source), ...offsetsWhere("uses", COMMIT_ACTION)(source)];
|
|
15916
16007
|
/** @internal */
|
|
15917
16008
|
const checkWorkflowCommits = workflowCheck({
|
|
15918
|
-
rule: RULE$
|
|
16009
|
+
rule: RULE$26,
|
|
15919
16010
|
message: MESSAGE$5,
|
|
15920
16011
|
offsetsOf: commitOffsetsOf
|
|
15921
16012
|
});
|
|
@@ -16028,9 +16119,9 @@ const COMMENT_NODES = [
|
|
|
16028
16119
|
"block_comment",
|
|
16029
16120
|
"multiline_comment"
|
|
16030
16121
|
];
|
|
16031
|
-
const START$
|
|
16122
|
+
const START$16 = 0;
|
|
16032
16123
|
const NEXT = 1;
|
|
16033
|
-
const NONE = [];
|
|
16124
|
+
const NONE$1 = [];
|
|
16034
16125
|
const loadGrammar = (grammar) => loadLanguage(grammar).pipe(Effect.mapBoth({
|
|
16035
16126
|
onFailure: ({ message }) => unreadable(grammar)(message),
|
|
16036
16127
|
onSuccess: (language) => [grammar, language]
|
|
@@ -16048,7 +16139,7 @@ const commentNodesIn = (language, source) => pipe(readTree({
|
|
|
16048
16139
|
index: node.startIndex,
|
|
16049
16140
|
text: node.text
|
|
16050
16141
|
})))
|
|
16051
|
-
}), Option.getOrElse(() => NONE));
|
|
16142
|
+
}), Option.getOrElse(() => NONE$1));
|
|
16052
16143
|
const syntaxComments = (grammars, grammar) => (source) => Option.match(grammars(grammar), {
|
|
16053
16144
|
onNone: () => Effect.fail(unreadable(grammar)("the grammar is not loaded")),
|
|
16054
16145
|
onSome: (language) => commentsFrom(grammar)((text) => commentNodesIn(language, text))(source)
|
|
@@ -16071,21 +16162,21 @@ const shifted = (offset) => ({ index, text }) => ({
|
|
|
16071
16162
|
text
|
|
16072
16163
|
});
|
|
16073
16164
|
const markupComment = (source) => (node) => {
|
|
16074
|
-
if (!isComment(node) || node.startIndex === null || node.endIndex === null) return NONE;
|
|
16165
|
+
if (!isComment(node) || node.startIndex === null || node.endIndex === null) return NONE$1;
|
|
16075
16166
|
return [{
|
|
16076
16167
|
index: node.startIndex,
|
|
16077
16168
|
text: String$1.slice(node.startIndex, node.endIndex + NEXT)(source)
|
|
16078
16169
|
}];
|
|
16079
16170
|
};
|
|
16080
16171
|
const textComments = (grammars, grammar) => (text) => {
|
|
16081
|
-
const shift = shifted(text.startIndex ?? START$
|
|
16172
|
+
const shift = shifted(text.startIndex ?? START$16);
|
|
16082
16173
|
return syntaxComments(grammars, grammar)(text.data).pipe(Effect.map(Array$1.map(shift)));
|
|
16083
16174
|
};
|
|
16084
16175
|
const embeddedComments = (grammars) => (node) => {
|
|
16085
|
-
if (!isTag(node)) return Effect.succeed(NONE);
|
|
16176
|
+
if (!isTag(node)) return Effect.succeed(NONE$1);
|
|
16086
16177
|
const texts = pipe(node.children, Array$1.filter(isText));
|
|
16087
16178
|
return Option.match(embeddedGrammar(node), {
|
|
16088
|
-
onNone: () => Effect.succeed(NONE),
|
|
16179
|
+
onNone: () => Effect.succeed(NONE$1),
|
|
16089
16180
|
onSome: (grammar) => pipe(texts, (items) => Effect.forEach(items, textComments(grammars, grammar), { concurrency: 1 }), Effect.map(Array$1.flatten))
|
|
16090
16181
|
});
|
|
16091
16182
|
};
|
|
@@ -16144,12 +16235,12 @@ const shebangReader = (source) => {
|
|
|
16144
16235
|
};
|
|
16145
16236
|
const readerOf = (name) => (source) => pipe(READERS$1, Array$1.findFirst(([pattern]) => pattern.test(name)), Option.orElse(() => shebangReader(source)), Option.map(([, reader]) => reader));
|
|
16146
16237
|
// src/features/ban-comments/model/comments.ts
|
|
16147
|
-
const RULE$
|
|
16238
|
+
const RULE$25 = "comment";
|
|
16148
16239
|
const UNUSED_RULE = "unused-comment-allowance";
|
|
16149
16240
|
const CONFIG_FILE$2 = "vite.config.ts";
|
|
16150
16241
|
const VENDORED_PATHSPEC = ":(attr:linguist-vendored)";
|
|
16151
16242
|
const READ_CONCURRENCY$6 = 64;
|
|
16152
|
-
const START$
|
|
16243
|
+
const START$15 = 0;
|
|
16153
16244
|
const SHEBANG = "#!";
|
|
16154
16245
|
const PIN = /@(?:[0-9a-f]{40}|sha256:[0-9a-f]{64})\s*$/u;
|
|
16155
16246
|
const VERSION = /^\s?v?\d[\w.+-]*$/u;
|
|
@@ -16171,11 +16262,11 @@ const taggedError$2 = Schema.TaggedError;
|
|
|
16171
16262
|
var CommentConfigUnreadable = class extends taggedError$2()("CommentConfigUnreadable", { file: Schema.String }) {};
|
|
16172
16263
|
const valueOf = (text) => String$1.replaceAll(DELIMITERS, "")(text);
|
|
16173
16264
|
const lineBefore = (source, index) => {
|
|
16174
|
-
const lines = pipe(source, String$1.slice(START$
|
|
16265
|
+
const lines = pipe(source, String$1.slice(START$15, index), String$1.split("\n"));
|
|
16175
16266
|
return Option.getOrElse(Array$1.last(lines), () => "");
|
|
16176
16267
|
};
|
|
16177
16268
|
const isPinVersion = (source, { index, text }) => PIN.test(lineBefore(source, index)) && VERSION.test(valueOf(text));
|
|
16178
|
-
const isShebang = ({ index, text }) => index === START$
|
|
16269
|
+
const isShebang = ({ index, text }) => index === START$15 && String$1.startsWith(SHEBANG)(text);
|
|
16179
16270
|
const isAllowed = (source, directives) => (comment) => isShebang(comment) || directives.test(valueOf(comment.text)) || isPinVersion(source, comment);
|
|
16180
16271
|
const NOTHING = {
|
|
16181
16272
|
problems: [],
|
|
@@ -16185,7 +16276,7 @@ const unusedMessage = (entry) => `allows the comment pattern \`${entry}\`, but n
|
|
|
16185
16276
|
const problemOf$1 = (file, source) => ({ index }) => ({
|
|
16186
16277
|
file,
|
|
16187
16278
|
...positionOf(source)(index),
|
|
16188
|
-
rule: RULE$
|
|
16279
|
+
rule: RULE$25,
|
|
16189
16280
|
message: MESSAGE$4
|
|
16190
16281
|
});
|
|
16191
16282
|
const settingsOf = ({ msch, lint }) => ({
|
|
@@ -16222,7 +16313,7 @@ const scannedFiles = Effect.fn("scannedFiles")(function* scannedFiles(root, sett
|
|
|
16222
16313
|
})), Array$1.filter(({ file }) => !HashSet.has(skipped, file)));
|
|
16223
16314
|
});
|
|
16224
16315
|
const usedAllowances = (allowances, found) => pipe(allowances, Array$1.map((pattern, index) => [pattern, index]), Array$1.filter(([pattern]) => pipe(found, Array$1.some((comment) => pattern.test(valueOf(comment.text))))), Array$1.map(([, index]) => index));
|
|
16225
|
-
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$
|
|
16316
|
+
const entryOffset = (source, entry) => pipe(String$1.indexOf(entry)(source), Option.getOrElse(() => START$15));
|
|
16226
16317
|
const unusedAllowances = Effect.fn("unusedAllowances")(function* unusedAllowances(root, settings, used) {
|
|
16227
16318
|
const files = yield* RepositoryFiles;
|
|
16228
16319
|
const file = files.join(root, CONFIG_FILE$2);
|
|
@@ -16244,7 +16335,7 @@ const scanFile = ({ directives, allowances, comments }) => ({ name, file }, sour
|
|
|
16244
16335
|
problems: pipe(found, Array$1.filter(kept), Array$1.map(toProblem)),
|
|
16245
16336
|
used: usedAllowances(allowances, found)
|
|
16246
16337
|
})), Effect.catchTag("CommentsUnreadable", ({ message }) => Effect.succeed({
|
|
16247
|
-
problems: [problemInFile(RULE$
|
|
16338
|
+
problems: [problemInFile(RULE$25)(file, `msch could not read the comments in this file: ${message}`)],
|
|
16248
16339
|
used: []
|
|
16249
16340
|
})))
|
|
16250
16341
|
});
|
|
@@ -16357,7 +16448,7 @@ const PYTHON = {
|
|
|
16357
16448
|
/** @internal */
|
|
16358
16449
|
const checkPython = (root) => checkBannedTool(root, PYTHON);
|
|
16359
16450
|
// src/features/check-catalog-entries/model/uncataloged-dependencies.ts
|
|
16360
|
-
const RULE$
|
|
16451
|
+
const RULE$24 = "uncataloged-dependency";
|
|
16361
16452
|
const OWNED_ELSEWHERE = [
|
|
16362
16453
|
"catalog:",
|
|
16363
16454
|
"workspace:",
|
|
@@ -16368,10 +16459,10 @@ const ROOT_DIRECTORY$2 = ".";
|
|
|
16368
16459
|
const PLUGIN_MANIFEST$1 = ".claude-plugin/plugin.json";
|
|
16369
16460
|
const MESSAGE$3 = "is a version written in this package.json. Add it to the catalog in pnpm-workspace.yaml and write `catalog:` here, so that one entry owns the version and every package that uses the dependency moves together.";
|
|
16370
16461
|
const isOwnedElsewhere = ({ specifier }) => pipe(OWNED_ELSEWHERE, Array$1.some((protocol) => String$1.startsWith(protocol)(specifier)));
|
|
16371
|
-
const problemsIn$
|
|
16462
|
+
const problemsIn$11 = (entry, source) => pipe(manifestSpecifiers(source), Array$1.filter((found) => !isOwnedElsewhere(found)), Array$1.map((found) => ({
|
|
16372
16463
|
file: entry.file,
|
|
16373
16464
|
...positionOf(source)(offsetIn$1(source)(manifestPattern(found))),
|
|
16374
|
-
rule: RULE$
|
|
16465
|
+
rule: RULE$24,
|
|
16375
16466
|
message: `\`${found.name}\` \`${found.specifier}\` ${MESSAGE$3}`
|
|
16376
16467
|
})));
|
|
16377
16468
|
/** @internal */
|
|
@@ -16386,13 +16477,13 @@ const uncatalogedDependencies = Effect.fn("uncatalogedDependencies")(function* u
|
|
|
16386
16477
|
file: files.join(root, name)
|
|
16387
16478
|
};
|
|
16388
16479
|
}));
|
|
16389
|
-
return yield* scanText(listed, problemsIn$
|
|
16480
|
+
return yield* scanText(listed, problemsIn$11);
|
|
16390
16481
|
});
|
|
16391
16482
|
// src/features/check-catalog-entries/model/catalog-entries.ts
|
|
16392
16483
|
const WORKSPACE_FILE$3 = "pnpm-workspace.yaml";
|
|
16393
16484
|
const FIRST_LINE$2 = 1;
|
|
16394
16485
|
const FIRST_COLUMN$1 = 1;
|
|
16395
|
-
const RULE$
|
|
16486
|
+
const RULE$23 = "prune-setting-off";
|
|
16396
16487
|
const PRUNE_SETTINGS = [["catalogPrune", "removes catalog entries no package refers to, so the catalog holds only versions in use."], ["minimumReleaseAgeExcludePrune", "removes `minimumReleaseAgeExclude` entries the lockfile no longer resolves, which only exempted that one version while it was new."]];
|
|
16397
16488
|
const decodeTrue = Schema.decodeUnknownOption(Schema.Literal(true));
|
|
16398
16489
|
const lineOf$1 = (source) => (setting) => pipe(String$1.split(source, "\n"), Array$1.findFirstIndex(String$1.startsWith(`${setting}:`)), Option.match({
|
|
@@ -16406,7 +16497,7 @@ const pruneProblems = Effect.fn("pruneProblems")(function* pruneProblems(file, s
|
|
|
16406
16497
|
file,
|
|
16407
16498
|
line: at(setting),
|
|
16408
16499
|
column: FIRST_COLUMN$1,
|
|
16409
|
-
rule: RULE$
|
|
16500
|
+
rule: RULE$23,
|
|
16410
16501
|
message: `Set \`${setting}: true\`. It ${effect}`
|
|
16411
16502
|
})));
|
|
16412
16503
|
});
|
|
@@ -16430,7 +16521,7 @@ const VISIBLE_RULE = "skill-source-visible";
|
|
|
16430
16521
|
const CONFIG_FILE$1 = "vite.config.ts";
|
|
16431
16522
|
const RENOVATE_FILE$1 = "renovate.json";
|
|
16432
16523
|
const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
|
|
16433
|
-
const START$
|
|
16524
|
+
const START$14 = 0;
|
|
16434
16525
|
const LOCAL_PREFIX = "./";
|
|
16435
16526
|
const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
|
|
16436
16527
|
const Source = Schema.Struct({
|
|
@@ -16443,7 +16534,7 @@ const taggedError$1 = Schema.TaggedError;
|
|
|
16443
16534
|
var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
|
|
16444
16535
|
const problemAt$3 = (rule, file, text) => (anchor, message) => ({
|
|
16445
16536
|
file,
|
|
16446
|
-
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$
|
|
16537
|
+
...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$14))),
|
|
16447
16538
|
rule,
|
|
16448
16539
|
message
|
|
16449
16540
|
});
|
|
@@ -16493,14 +16584,14 @@ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(r
|
|
|
16493
16584
|
];
|
|
16494
16585
|
});
|
|
16495
16586
|
// src/features/check-skills/model/published-skills.ts
|
|
16496
|
-
const RULE$
|
|
16587
|
+
const RULE$22 = "published-skills";
|
|
16497
16588
|
const KEYWORD = "tanstack-intent";
|
|
16498
16589
|
const SKILLS = "skills";
|
|
16499
|
-
const SKILL_FILE$
|
|
16590
|
+
const SKILL_FILE$2 = "SKILL.md";
|
|
16500
16591
|
const SUCCEEDED = 0;
|
|
16501
16592
|
const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
|
|
16502
|
-
const problemAt$2 = problemInFile(RULE$
|
|
16503
|
-
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array$1.filter((file) => files.basename(file) === SKILL_FILE$
|
|
16593
|
+
const problemAt$2 = problemInFile(RULE$22);
|
|
16594
|
+
const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array$1.filter((file) => files.basename(file) === SKILL_FILE$2), Array$1.map((file) => files.relative(directory, files.dirname(file))));
|
|
16504
16595
|
const isShipped = (listed) => (skill) => Array$1.contains(listed, SKILLS) || Array$1.contains(listed, skill);
|
|
16505
16596
|
const packagingMessages = ({ keywords, files }, skills) => {
|
|
16506
16597
|
const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array$1.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
|
|
@@ -16520,29 +16611,28 @@ const validationOf = Effect.fn("validationOf")(function* validationOf(directory)
|
|
|
16520
16611
|
const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
|
|
16521
16612
|
return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
|
|
16522
16613
|
}, Effect.scoped);
|
|
16523
|
-
const problemsIn$
|
|
16614
|
+
const problemsIn$10 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
|
|
16524
16615
|
const files = yield* RepositoryFiles;
|
|
16525
16616
|
const directory = files.join(root, project.directory);
|
|
16526
16617
|
const manifest = files.join(directory, PACKAGE_JSON_FILE);
|
|
16527
16618
|
const skills = skillDirectoriesIn(files, directory);
|
|
16528
|
-
if (!Array$1.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$
|
|
16619
|
+
if (!Array$1.isReadonlyArrayNonEmpty(skills)) return [problemAt$2(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$2}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
|
|
16529
16620
|
const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
|
|
16530
16621
|
return [...pipe(packagingMessages(project, skills), Array$1.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
|
|
16531
16622
|
});
|
|
16532
16623
|
/** @internal */
|
|
16533
16624
|
const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
|
|
16534
16625
|
const projects = yield* publishedProjects(root);
|
|
16535
|
-
const problems = yield* Effect.forEach(projects, (project) => problemsIn$
|
|
16626
|
+
const problems = yield* Effect.forEach(projects, (project) => problemsIn$10(root, project), { concurrency: 1 });
|
|
16536
16627
|
return Array$1.flatten(problems);
|
|
16537
16628
|
});
|
|
16538
16629
|
// src/features/check-skills/model/skill-files.ts
|
|
16539
|
-
const RULE$
|
|
16540
|
-
const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
|
|
16630
|
+
const RULE$21 = "skill-file";
|
|
16631
|
+
const SKILL_FILE$1 = /(?:^|\/)SKILL\.md$/u;
|
|
16541
16632
|
const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
|
|
16542
16633
|
const FIXTURE = /(?:^|\/)fixtures\//u;
|
|
16543
|
-
const MARKDOWN$
|
|
16634
|
+
const MARKDOWN$4 = ".md";
|
|
16544
16635
|
const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
|
|
16545
|
-
const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
|
|
16546
16636
|
const HEADING = /^# (?<title>.+)$/mu;
|
|
16547
16637
|
const NAME_KEY$1 = /^name:/mu;
|
|
16548
16638
|
const LICENSE_KEY = /^license:/mu;
|
|
@@ -16553,9 +16643,9 @@ const FRAGMENT = /#.*$/u;
|
|
|
16553
16643
|
const GITHUB = "https://github.com/";
|
|
16554
16644
|
const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
|
|
16555
16645
|
const BLANK = /\s+/u;
|
|
16556
|
-
const SEPARATOR$
|
|
16557
|
-
const START$
|
|
16558
|
-
const FIRST$
|
|
16646
|
+
const SEPARATOR$3 = "/";
|
|
16647
|
+
const START$13 = 0;
|
|
16648
|
+
const FIRST$5 = 1;
|
|
16559
16649
|
const READ_CONCURRENCY$5 = 16;
|
|
16560
16650
|
const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
|
|
16561
16651
|
const Frontmatter = Schema.Struct({
|
|
@@ -16564,9 +16654,9 @@ const Frontmatter = Schema.Struct({
|
|
|
16564
16654
|
metadata: Schema.optional(Metadata)
|
|
16565
16655
|
});
|
|
16566
16656
|
const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
|
|
16567
|
-
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$
|
|
16568
|
-
const frontmatterOf = (source) => pipe(
|
|
16569
|
-
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$
|
|
16657
|
+
const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$13));
|
|
16658
|
+
const frontmatterOf = (source) => pipe(splitFrontmatter(source), Option.flatMap(({ fields }) => decodeFrontmatter(fields)));
|
|
16659
|
+
const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$13].length), Option.getOrElse(() => START$13));
|
|
16570
16660
|
const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
|
|
16571
16661
|
const nameProblems = ({ source, directory }, name, folder) => {
|
|
16572
16662
|
const bodyStart = bodyStartOf(source);
|
|
@@ -16594,16 +16684,16 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
|
|
|
16594
16684
|
]), Option.getOrElse(() => []), Array$1.map(({ index, message }) => ({
|
|
16595
16685
|
file: skill.file,
|
|
16596
16686
|
...positionOf(skill.source)(index),
|
|
16597
|
-
rule: RULE$
|
|
16687
|
+
rule: RULE$21,
|
|
16598
16688
|
message
|
|
16599
16689
|
})));
|
|
16600
16690
|
const linkOf = (found) => pipe(groupOf("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
|
|
16601
16691
|
target,
|
|
16602
|
-
index: found.index ?? START$
|
|
16692
|
+
index: found.index ?? START$13
|
|
16603
16693
|
})), Option.toArray);
|
|
16604
16694
|
const rangeOf$1 = (found) => {
|
|
16605
|
-
const start = found.index ?? START$
|
|
16606
|
-
return [start, start + found[START$
|
|
16695
|
+
const start = found.index ?? START$13;
|
|
16696
|
+
return [start, start + found[START$13].length];
|
|
16607
16697
|
};
|
|
16608
16698
|
const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array$1.some(([start, end]) => index >= start && index < end));
|
|
16609
16699
|
const linksIn$1 = (source) => {
|
|
@@ -16621,23 +16711,23 @@ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
|
|
|
16621
16711
|
return pipe(missing, Array$1.map(({ target, index }) => ({
|
|
16622
16712
|
file,
|
|
16623
16713
|
...positionOf(source)(index),
|
|
16624
|
-
rule: RULE$
|
|
16714
|
+
rule: RULE$21,
|
|
16625
16715
|
message: `links to ${target}, which does not exist. Fix the path or remove the link.`
|
|
16626
16716
|
})));
|
|
16627
16717
|
});
|
|
16628
|
-
const problemsIn$
|
|
16718
|
+
const problemsIn$9 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
|
|
16629
16719
|
const files = yield* RepositoryFiles;
|
|
16630
16720
|
const file = files.join(root, name);
|
|
16631
16721
|
const directory = files.dirname(name);
|
|
16632
|
-
const inside = pipe(listed, Array$1.filter(String$1.startsWith(`${directory}${SEPARATOR$
|
|
16722
|
+
const inside = pipe(listed, Array$1.filter(String$1.startsWith(`${directory}${SEPARATOR$3}`)));
|
|
16633
16723
|
const text = yield* files.readFile(file);
|
|
16634
|
-
const documents = pipe(inside, Array$1.filter(String$1.endsWith(MARKDOWN$
|
|
16724
|
+
const documents = pipe(inside, Array$1.filter(String$1.endsWith(MARKDOWN$4)), Array$1.map((entry) => files.join(root, entry)));
|
|
16635
16725
|
const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
|
|
16636
16726
|
const licenses = pipe(inside, Array$1.filter((entry) => files.dirname(entry) === directory), Array$1.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array$1.map((entry) => ({
|
|
16637
16727
|
file: files.join(root, entry),
|
|
16638
|
-
line: FIRST$
|
|
16639
|
-
column: FIRST$
|
|
16640
|
-
rule: RULE$
|
|
16728
|
+
line: FIRST$5,
|
|
16729
|
+
column: FIRST$5,
|
|
16730
|
+
rule: RULE$21,
|
|
16641
16731
|
message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
|
|
16642
16732
|
})));
|
|
16643
16733
|
return [
|
|
@@ -16653,8 +16743,8 @@ const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed,
|
|
|
16653
16743
|
/** @internal */
|
|
16654
16744
|
const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
|
|
16655
16745
|
const listed = yield* (yield* RepositoryFiles).listedFiles(root);
|
|
16656
|
-
const skills = pipe(listed, Array$1.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
16657
|
-
const found = yield* Effect.forEach(skills, (name) => problemsIn$
|
|
16746
|
+
const skills = pipe(listed, Array$1.filter((name) => SKILL_FILE$1.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
|
|
16747
|
+
const found = yield* Effect.forEach(skills, (name) => problemsIn$9(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
|
|
16658
16748
|
return Array$1.flatten(found);
|
|
16659
16749
|
});
|
|
16660
16750
|
// src/features/check-version-downgrades/model/version-entries.ts
|
|
@@ -16715,7 +16805,7 @@ const cargoEntries = (text) => {
|
|
|
16715
16805
|
};
|
|
16716
16806
|
const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
|
|
16717
16807
|
// src/features/check-version-downgrades/model/version-downgrade.ts
|
|
16718
|
-
const RULE$
|
|
16808
|
+
const RULE$20 = "version-downgrade";
|
|
16719
16809
|
const READ_CONCURRENCY$4 = 16;
|
|
16720
16810
|
const READERS = [
|
|
16721
16811
|
[/(?:^|\/)package\.json$/u, manifestEntries],
|
|
@@ -16740,7 +16830,7 @@ const downgradesIn = ({ file, text, before, after }) => {
|
|
|
16740
16830
|
file,
|
|
16741
16831
|
line: lineOf(text, entry),
|
|
16742
16832
|
column: FIRST_LINE$1,
|
|
16743
|
-
rule: RULE$
|
|
16833
|
+
rule: RULE$20,
|
|
16744
16834
|
message: message(old, entry)
|
|
16745
16835
|
})), Option.toArray)));
|
|
16746
16836
|
};
|
|
@@ -16771,13 +16861,13 @@ const AUTOMERGE_RULE = "renovate-platform-automerge";
|
|
|
16771
16861
|
const CAP_RULE = "renovate-version-cap";
|
|
16772
16862
|
const PRESET_RULE = "renovate-msch-preset";
|
|
16773
16863
|
const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
|
|
16774
|
-
const START$
|
|
16864
|
+
const START$12 = 0;
|
|
16775
16865
|
const READ_CONCURRENCY$3 = 16;
|
|
16776
16866
|
const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
|
|
16777
16867
|
const CAP_MESSAGE = "caps a dependency below a version with `allowedVersions`. A cap holds the dependency on an old version, which is a downgrade that never ends: fix what breaks on the new version instead.";
|
|
16778
16868
|
const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
|
|
16779
16869
|
const offsetsOf = (pattern, source) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
|
|
16780
|
-
const problemsIn$
|
|
16870
|
+
const problemsIn$8 = (file, source) => {
|
|
16781
16871
|
const at = positionOf(source);
|
|
16782
16872
|
const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array$1.map((offset) => ({
|
|
16783
16873
|
file,
|
|
@@ -16790,7 +16880,7 @@ const problemsIn$6 = (file, source) => {
|
|
|
16790
16880
|
...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
|
|
16791
16881
|
...pipe([{
|
|
16792
16882
|
file,
|
|
16793
|
-
...at(START$
|
|
16883
|
+
...at(START$12),
|
|
16794
16884
|
rule: PRESET_RULE,
|
|
16795
16885
|
message: PRESET_MESSAGE
|
|
16796
16886
|
}], Array$1.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
|
|
@@ -16804,7 +16894,7 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
16804
16894
|
const file = files.join(root, name);
|
|
16805
16895
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
16806
16896
|
onNone: () => [],
|
|
16807
|
-
onSome: (source) => problemsIn$
|
|
16897
|
+
onSome: (source) => problemsIn$8(file, source)
|
|
16808
16898
|
})));
|
|
16809
16899
|
}, { concurrency: READ_CONCURRENCY$3 });
|
|
16810
16900
|
return Array$1.flatten(found);
|
|
@@ -16813,10 +16903,10 @@ const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* check
|
|
|
16813
16903
|
const MSCH = "@r_masseater/msch";
|
|
16814
16904
|
const SCOPE = Option.getOrElse(scopeOfName(MSCH), () => MSCH);
|
|
16815
16905
|
const PLUGIN_KEYWORDS = ["oxlint-plugin", "textlint-rule"];
|
|
16816
|
-
const RULE$
|
|
16906
|
+
const RULE$19 = "applied-package";
|
|
16817
16907
|
const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
|
|
16818
16908
|
const NOT_FOUND = -1;
|
|
16819
|
-
const SEPARATOR$
|
|
16909
|
+
const SEPARATOR$2 = "/";
|
|
16820
16910
|
/** @internal */
|
|
16821
16911
|
const isApplied = ({ bins, keywords }) => Array$1.isReadonlyArrayNonEmpty(bins) || pipe(keywords, Array$1.some((keyword) => Array$1.contains(PLUGIN_KEYWORDS, keyword)));
|
|
16822
16912
|
const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
|
|
@@ -16849,13 +16939,13 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
|
|
|
16849
16939
|
const problemAt$1 = (file, source) => (index, name) => ({
|
|
16850
16940
|
file,
|
|
16851
16941
|
...positionOf(source)(index),
|
|
16852
|
-
rule: RULE$
|
|
16942
|
+
rule: RULE$19,
|
|
16853
16943
|
message: `msch applies ${name}. Remove this use and let msch apply it.`
|
|
16854
16944
|
});
|
|
16855
16945
|
const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
|
|
16856
16946
|
const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
|
|
16857
16947
|
const usesIn = (applied) => ({ file }, source) => pipe(applied, Array$1.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array$1.map(binPattern))], Array$1.flatMap((pattern) => Array$1.fromIterable(String$1.matchAll(pattern)(source))), Array$1.map((found) => problemAt$1(file, source)(found.index ?? NOT_FOUND, entry.name)))));
|
|
16858
|
-
const ownerOf$1 = (directories) => (name) => pipe(directories, Array$1.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$
|
|
16948
|
+
const ownerOf$1 = (directories) => (name) => pipe(directories, Array$1.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$2}`)(name)), Array$1.match({
|
|
16859
16949
|
onEmpty: () => "",
|
|
16860
16950
|
onNonEmpty: Array$1.max(BY_LENGTH)
|
|
16861
16951
|
}));
|
|
@@ -16904,8 +16994,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
|
|
|
16904
16994
|
return yield* appliedPackageProblems(root, applied);
|
|
16905
16995
|
});
|
|
16906
16996
|
// src/features/find-unneeded-files/model/replaced-tools.ts
|
|
16907
|
-
const RULE$
|
|
16908
|
-
const FIRST$
|
|
16997
|
+
const RULE$18 = "replaced-tool";
|
|
16998
|
+
const FIRST$4 = 1;
|
|
16909
16999
|
const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
|
|
16910
17000
|
const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
|
|
16911
17001
|
const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
|
|
@@ -16983,9 +17073,9 @@ const REPLACED = [
|
|
|
16983
17073
|
];
|
|
16984
17074
|
const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array$1.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
|
|
16985
17075
|
file,
|
|
16986
|
-
line: FIRST$
|
|
16987
|
-
column: FIRST$
|
|
16988
|
-
rule: RULE$
|
|
17076
|
+
line: FIRST$4,
|
|
17077
|
+
column: FIRST$4,
|
|
17078
|
+
rule: RULE$18,
|
|
16989
17079
|
message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
|
|
16990
17080
|
})));
|
|
16991
17081
|
/** @internal */
|
|
@@ -17003,7 +17093,7 @@ const unneededLockfile = (present) => (entry) => FOREIGN_LOCKFILE.test(entry.nam
|
|
|
17003
17093
|
// src/features/find-unneeded-files/model/unneeded-files.ts
|
|
17004
17094
|
const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
|
|
17005
17095
|
const PNPM_DIRECTORY = ".pnpm/";
|
|
17006
|
-
const SEPARATOR = "/";
|
|
17096
|
+
const SEPARATOR$1 = "/";
|
|
17007
17097
|
const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
|
|
17008
17098
|
const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
|
|
17009
17099
|
const PNPM_OUTPUT = /(?:^|\/)\.pnpm\//u;
|
|
@@ -17019,7 +17109,7 @@ const SETUP_PATTERNS = [
|
|
|
17019
17109
|
];
|
|
17020
17110
|
const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
|
|
17021
17111
|
const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
|
|
17022
|
-
const START$
|
|
17112
|
+
const START$11 = 0;
|
|
17023
17113
|
const LAST_SEGMENT = 1;
|
|
17024
17114
|
const FIRST_LINE = 1;
|
|
17025
17115
|
const FIRST_COLUMN = 1;
|
|
@@ -17071,10 +17161,10 @@ const matches = (pattern) => ({ name }) => pattern.test(name);
|
|
|
17071
17161
|
const isCargoManifest = matches(CARGO_MANIFEST_FILE);
|
|
17072
17162
|
const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
|
|
17073
17163
|
const isPnpmOutput = matches(PNPM_OUTPUT);
|
|
17074
|
-
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array$1.dropRight(LAST_SEGMENT), Array$1.join(SEPARATOR));
|
|
17164
|
+
const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array$1.dropRight(LAST_SEGMENT), Array$1.join(SEPARATOR$1));
|
|
17075
17165
|
const ancestorsOf = (directory) => {
|
|
17076
|
-
const parts = String$1.split(directory, SEPARATOR);
|
|
17077
|
-
return pipe(Array$1.makeBy(parts.length, (depth) => Array$1.join(Array$1.take(parts, depth), SEPARATOR)), Array$1.filter((ancestor) => ancestor !== directory));
|
|
17166
|
+
const parts = String$1.split(directory, SEPARATOR$1);
|
|
17167
|
+
return pipe(Array$1.makeBy(parts.length, (depth) => Array$1.join(Array$1.take(parts, depth), SEPARATOR$1)), Array$1.filter((ancestor) => ancestor !== directory));
|
|
17078
17168
|
};
|
|
17079
17169
|
const readsCargoLock = (manifests, workspaces) => ({ name }) => {
|
|
17080
17170
|
const directory = directoryOf(name);
|
|
@@ -17088,7 +17178,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
|
|
|
17088
17178
|
const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
|
|
17089
17179
|
return directoriesOf(roots);
|
|
17090
17180
|
});
|
|
17091
|
-
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$
|
|
17181
|
+
const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$11), (end) => String$1.slice(START$11, end)(name));
|
|
17092
17182
|
const pnpmOutputs = (present) => pipe(present, Array$1.filter(isPnpmOutput), Array$1.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array$1.map(pnpmOutput));
|
|
17093
17183
|
const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
|
|
17094
17184
|
const cargoProblems = (present, enabled) => {
|
|
@@ -17124,12 +17214,12 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
|
|
|
17124
17214
|
return yield* unneededIn(root, cargoEnabled(workspace.value));
|
|
17125
17215
|
});
|
|
17126
17216
|
// src/features/check-markdown-directives/model/directives.ts
|
|
17127
|
-
const RULE$
|
|
17128
|
-
const START$
|
|
17217
|
+
const RULE$17 = "markdown-directive";
|
|
17218
|
+
const START$10 = 0;
|
|
17129
17219
|
const SECOND = 1;
|
|
17130
17220
|
const ODD = 1;
|
|
17131
17221
|
const PAIR = 2;
|
|
17132
|
-
const MARKDOWN = ".md";
|
|
17222
|
+
const MARKDOWN$3 = ".md";
|
|
17133
17223
|
const SKIPPED_DIRECTORIES = [
|
|
17134
17224
|
".agents/skills/",
|
|
17135
17225
|
"/fixtures/",
|
|
@@ -17137,25 +17227,25 @@ const SKIPPED_DIRECTORIES = [
|
|
|
17137
17227
|
];
|
|
17138
17228
|
const SKIPPED_FILES = ["CHANGELOG.md", "CLAUDE.md"];
|
|
17139
17229
|
const DISABLE = /<!--\s*(?:y8|markdownlint|textlint)-disable(?:-next-line|-line|-file)?(?<rest>(?:\s[\s\S]*?)?)-->/giu;
|
|
17140
|
-
const FENCE = /^\s{0,3}(?:`{3,}|~{3,})/u;
|
|
17230
|
+
const FENCE$1 = /^\s{0,3}(?:`{3,}|~{3,})/u;
|
|
17141
17231
|
const BACKTICK = /`/gu;
|
|
17142
17232
|
const DESCRIPTION = / -- .*/u;
|
|
17143
17233
|
const SEPARATORS = /[\s,]+/u;
|
|
17144
17234
|
const MESSAGE$2 = "Name the rules this comment disables, as in `<!-- y8-disable MD033 -->`. A comment with no rule name stops every rule, so it also hides violations that are added later.";
|
|
17145
|
-
const fenceStep = (inside, line) => Match.value(FENCE.test(line)).pipe(Match.when(true, () => [!inside, true]), Match.orElse(() => [inside, inside]));
|
|
17235
|
+
const fenceStep = (inside, line) => Match.value(FENCE$1.test(line)).pipe(Match.when(true, () => [!inside, true]), Match.orElse(() => [inside, inside]));
|
|
17146
17236
|
const insideCodeSpan = (before) => Array$1.fromIterable(String$1.matchAll(BACKTICK)(before)).length % PAIR === ODD;
|
|
17147
17237
|
const namedRules = (rest) => pipe(rest, String$1.replace(DESCRIPTION, ""), String$1.split(SEPARATORS), Array$1.filter(String$1.isNonEmpty));
|
|
17148
17238
|
const restOf = (found) => pipe(Option.fromNullishOr(found.groups), Option.flatMap(Record.get("rest")), Option.getOrElse(() => ""));
|
|
17149
|
-
const problemsIn$
|
|
17239
|
+
const problemsIn$7 = (file, source) => {
|
|
17150
17240
|
const lines = String$1.split("\n")(source);
|
|
17151
17241
|
const fenced = Array$1.mapAccum(lines, false, fenceStep)[SECOND];
|
|
17152
17242
|
const isCode = (index) => {
|
|
17153
17243
|
const { line, column } = positionOf(source)(index);
|
|
17154
|
-
return pipe(Array$1.get(fenced, line - SECOND), Option.getOrElse(() => false)) || pipe(Array$1.get(lines, line - SECOND), Option.map(String$1.slice(START$
|
|
17244
|
+
return pipe(Array$1.get(fenced, line - SECOND), Option.getOrElse(() => false)) || pipe(Array$1.get(lines, line - SECOND), Option.map(String$1.slice(START$10, column - SECOND)), Option.exists(insideCodeSpan));
|
|
17155
17245
|
};
|
|
17156
|
-
return pipe(Array$1.fromIterable(String$1.matchAll(DISABLE)(source)), Array$1.filter((match) => Array$1.isReadonlyArrayEmpty(namedRules(restOf(match)))), Array$1.filter((match) => !isCode(match.index ?? START$
|
|
17246
|
+
return pipe(Array$1.fromIterable(String$1.matchAll(DISABLE)(source)), Array$1.filter((match) => Array$1.isReadonlyArrayEmpty(namedRules(restOf(match)))), Array$1.filter((match) => !isCode(match.index ?? START$10)), Array$1.map((match) => problemAtIndex(RULE$17)(file, source)(match.index ?? START$10, MESSAGE$2)));
|
|
17157
17247
|
};
|
|
17158
|
-
const isChecked = (name) => String$1.endsWith(MARKDOWN)(name) && !pipe(SKIPPED_DIRECTORIES, Array$1.some((directory) => String$1.includes(directory)(`/${name}`))) && !pipe(SKIPPED_FILES, Array$1.some((skipped) => name === skipped || String$1.endsWith(`/${skipped}`)(name)));
|
|
17248
|
+
const isChecked = (name) => String$1.endsWith(MARKDOWN$3)(name) && !pipe(SKIPPED_DIRECTORIES, Array$1.some((directory) => String$1.includes(directory)(`/${name}`))) && !pipe(SKIPPED_FILES, Array$1.some((skipped) => name === skipped || String$1.endsWith(`/${skipped}`)(name)));
|
|
17159
17249
|
/** @internal */
|
|
17160
17250
|
const checkMarkdownDirectives = Effect.fn("checkMarkdownDirectives")(function* checkMarkdownDirectives(root) {
|
|
17161
17251
|
const files = yield* RepositoryFiles;
|
|
@@ -17163,27 +17253,27 @@ const checkMarkdownDirectives = Effect.fn("checkMarkdownDirectives")(function* c
|
|
|
17163
17253
|
return yield* scanText(pipe(names, Array$1.filter((name) => isChecked(name)), Array$1.map((name) => ({
|
|
17164
17254
|
name,
|
|
17165
17255
|
file: files.join(root, name)
|
|
17166
|
-
}))), ({ file }, source) => problemsIn$
|
|
17256
|
+
}))), ({ file }, source) => problemsIn$7(file, source));
|
|
17167
17257
|
});
|
|
17168
17258
|
// src/features/find-invisible-characters/model/hidden-unicode.ts
|
|
17169
17259
|
const HIDDEN = /[\u00AD\u180E\u200B\u200C\u200E\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF]|(?<![\p{Extended_Pictographic}\p{Emoji_Modifier}\uFE0F])\u200D|\u200D(?!\p{Extended_Pictographic})|[\u{E0000}-\u{E007F}]/gu;
|
|
17170
17260
|
const NUL = "\0";
|
|
17171
|
-
const START$
|
|
17261
|
+
const START$9 = 0;
|
|
17172
17262
|
const HEX = 16;
|
|
17173
17263
|
const CODE_POINT_WIDTH = 4;
|
|
17174
17264
|
const READ_CONCURRENCY$2 = 64;
|
|
17175
|
-
const RULE$
|
|
17176
|
-
const hexOf = (character) => pipe(String$1.codePointAt(START$
|
|
17265
|
+
const RULE$16 = "hidden-unicode";
|
|
17266
|
+
const hexOf = (character) => pipe(String$1.codePointAt(START$9)(character), Option.getOrElse(() => START$9), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
|
|
17177
17267
|
const problemOf = (file, source) => (found) => {
|
|
17178
|
-
const hex = hexOf(found[START$
|
|
17268
|
+
const hex = hexOf(found[START$9]);
|
|
17179
17269
|
return {
|
|
17180
17270
|
file,
|
|
17181
|
-
...positionOf(source)(found.index ?? START$
|
|
17182
|
-
rule: RULE$
|
|
17271
|
+
...positionOf(source)(found.index ?? START$9),
|
|
17272
|
+
rule: RULE$16,
|
|
17183
17273
|
message: `U+${hex} is invisible in editors and reviews and can change what the text means. Remove it, or write it as the escape \\u${hex}.`
|
|
17184
17274
|
};
|
|
17185
17275
|
};
|
|
17186
|
-
const problemsIn$
|
|
17276
|
+
const problemsIn$6 = (file, source) => {
|
|
17187
17277
|
if (String$1.includes(NUL)(source)) return [];
|
|
17188
17278
|
return pipe(Array$1.fromIterable(String$1.matchAll(HIDDEN)(source)), Array$1.map(problemOf(file, source)));
|
|
17189
17279
|
};
|
|
@@ -17195,7 +17285,7 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
|
|
|
17195
17285
|
const file = files.join(root, name);
|
|
17196
17286
|
return files.readFile(file).pipe(Effect.map(Option.match({
|
|
17197
17287
|
onNone: () => [],
|
|
17198
|
-
onSome: (source) => problemsIn$
|
|
17288
|
+
onSome: (source) => problemsIn$6(file, source)
|
|
17199
17289
|
})));
|
|
17200
17290
|
}, { concurrency: READ_CONCURRENCY$2 });
|
|
17201
17291
|
return Array$1.flatten(found);
|
|
@@ -17207,11 +17297,11 @@ const checkDocuments = Effect.fn("checkDocuments")(function* checkDocuments(root
|
|
|
17207
17297
|
return Array$1.flatten(found);
|
|
17208
17298
|
});
|
|
17209
17299
|
// src/features/check-effect-diagnostics/model/effect-diagnostics.ts
|
|
17210
|
-
const RULE$
|
|
17300
|
+
const RULE$15 = "effect-diagnostics-once";
|
|
17211
17301
|
const PLUGIN = "@effect/language-service";
|
|
17212
17302
|
const CONFIG_PATHSPEC = ":(glob)**/tsconfig*.json";
|
|
17213
17303
|
const EXCLUDED$3 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
17214
|
-
const START$
|
|
17304
|
+
const START$8 = 0;
|
|
17215
17305
|
const Plugin = Schema.Struct({
|
|
17216
17306
|
name: Schema.optional(Schema.String),
|
|
17217
17307
|
diagnostics: Schema.optional(Schema.Unknown)
|
|
@@ -17222,10 +17312,10 @@ const Config$1 = Schema.Struct({ compilerOptions: Schema.optional(CompilerOption
|
|
|
17222
17312
|
const decodeConfig = Schema.decodeUnknownOption(Schema.fromJsonString(Config$1));
|
|
17223
17313
|
const MESSAGE$1 = `The \`${PLUGIN}\` plugin reports the Effect diagnostics during the type check, and the \`effecttsgo\` lint rules that msch enables report the same ones again. Set \`"diagnostics": false\` on the plugin so that each finding is reported once, by the lint rules, with the severity msch sets.`;
|
|
17224
17314
|
const reportsDiagnostics = (plugin) => plugin.name === PLUGIN && plugin.diagnostics !== false;
|
|
17225
|
-
const problemsIn$
|
|
17315
|
+
const problemsIn$5 = (entry, source) => pipe(decodeConfig(source), Option.flatMap(({ compilerOptions }) => Option.fromUndefinedOr(compilerOptions)), Option.flatMap(({ plugins }) => Option.fromUndefinedOr(plugins)), Option.filter(Array$1.some(reportsDiagnostics)), Option.map(() => ({
|
|
17226
17316
|
file: entry.file,
|
|
17227
|
-
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$
|
|
17228
|
-
rule: RULE$
|
|
17317
|
+
...positionOf(source)(pipe(String$1.indexOf(`"${PLUGIN}"`)(source), Option.getOrElse(() => START$8))),
|
|
17318
|
+
rule: RULE$15,
|
|
17229
17319
|
message: MESSAGE$1
|
|
17230
17320
|
})), Option.toArray);
|
|
17231
17321
|
/** @internal */
|
|
@@ -17235,10 +17325,10 @@ const checkEffectDiagnostics = Effect.fn("checkEffectDiagnostics")(function* che
|
|
|
17235
17325
|
return yield* scanText(pipe(configs, Array$1.map((name) => ({
|
|
17236
17326
|
name,
|
|
17237
17327
|
file: files.join(root, name)
|
|
17238
|
-
}))), problemsIn$
|
|
17328
|
+
}))), problemsIn$5);
|
|
17239
17329
|
});
|
|
17240
17330
|
// src/features/check-exact-versions/model/exact-versions.ts
|
|
17241
|
-
const RULE$
|
|
17331
|
+
const RULE$14 = "version-range";
|
|
17242
17332
|
const WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
17243
17333
|
const ALIAS = /^npm:(?:@[^/@]+\/)?[^@]+@(?<version>.+)$/u;
|
|
17244
17334
|
const PROTOCOL = /^[a-z+]+:/u;
|
|
@@ -17254,7 +17344,7 @@ const isRange = (specifier) => {
|
|
|
17254
17344
|
const problemsFor = (file, source, pattern) => (found) => pipe(found, Array$1.filter(({ specifier }) => isRange(specifier)), Array$1.map((range) => ({
|
|
17255
17345
|
file,
|
|
17256
17346
|
...positionOf(source)(offsetIn$1(source)(pattern(range))),
|
|
17257
|
-
rule: RULE$
|
|
17347
|
+
rule: RULE$14,
|
|
17258
17348
|
message: `\`${range.name}\` \`${range.specifier}\` ${MESSAGE}`
|
|
17259
17349
|
})));
|
|
17260
17350
|
const catalogPattern = ({ name }) => new RegExp(`^\\s+["']?${quoted$1(name)}["']?:`, "mu");
|
|
@@ -17283,10 +17373,10 @@ const checkExactVersions = Effect.fn("checkExactVersions")(function* checkExactV
|
|
|
17283
17373
|
return [...fromManifests, ...fromCatalogs];
|
|
17284
17374
|
});
|
|
17285
17375
|
// src/features/check-pack-settings/model/pack-settings.ts
|
|
17286
|
-
const RULE$
|
|
17376
|
+
const RULE$13 = "pack-publint";
|
|
17287
17377
|
const CONFIG_FILE = "vite.config.ts";
|
|
17288
17378
|
const PACK_KEY = "pack:";
|
|
17289
|
-
const START$
|
|
17379
|
+
const START$7 = 0;
|
|
17290
17380
|
const READ_CONCURRENCY$1 = 16;
|
|
17291
17381
|
const EXCLUDED$1 = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
17292
17382
|
const StrictPack = Schema.Struct({ publint: Schema.Struct({ strict: Schema.Literal(true) }) });
|
|
@@ -17298,8 +17388,8 @@ var PackConfigUnreadable = class extends taggedError()("PackConfigUnreadable", {
|
|
|
17298
17388
|
const runsStrictPublint = (config) => pipe(decodePackConfig(config), Option.flatMap(({ pack }) => Option.fromUndefinedOr(pack)), Option.map((pack) => Array$1.ensure(pack)), Option.exists(Array$1.some(isStrict)));
|
|
17299
17389
|
const problemFor = (file, source) => ({
|
|
17300
17390
|
file,
|
|
17301
|
-
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$
|
|
17302
|
-
rule: RULE$
|
|
17391
|
+
...positionOf(source)(Option.getOrElse(String$1.indexOf(PACK_KEY)(source), () => START$7)),
|
|
17392
|
+
rule: RULE$13,
|
|
17303
17393
|
message: "This package is published, so its pack must run publint with `publint: { strict: true }`. Without it, publishConfig can point at files vp pack never writes, and the published package fails to import."
|
|
17304
17394
|
});
|
|
17305
17395
|
const strictPublintIn = Effect.fn("strictPublintIn")(function* strictPublintIn(configFile) {
|
|
@@ -17315,7 +17405,7 @@ const configProblems = Effect.fn("configProblems")(function* configProblems(conf
|
|
|
17315
17405
|
if (yield* strictPublintIn(configFile)) return [];
|
|
17316
17406
|
return [problemFor(configFile, source.value)];
|
|
17317
17407
|
});
|
|
17318
|
-
const problemsIn$
|
|
17408
|
+
const problemsIn$4 = Effect.fn("problemsIn")(function* problemsIn(root, manifestName) {
|
|
17319
17409
|
const files = yield* RepositoryFiles;
|
|
17320
17410
|
const source = yield* files.readFile(files.join(root, manifestName));
|
|
17321
17411
|
const manifest = publishedManifestOf(source);
|
|
@@ -17325,123 +17415,22 @@ const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, manifest
|
|
|
17325
17415
|
/** @internal */
|
|
17326
17416
|
const checkPackSettings = Effect.fn("checkPackSettings")(function* checkPackSettings(root) {
|
|
17327
17417
|
const manifests = yield* (yield* RepositoryFiles).matchingFiles(root, [`:(glob)**/${PACKAGE_JSON_FILE}`, ...EXCLUDED$1]);
|
|
17328
|
-
const found = yield* Effect.forEach(manifests, (name) => problemsIn$
|
|
17418
|
+
const found = yield* Effect.forEach(manifests, (name) => problemsIn$4(root, name), { concurrency: READ_CONCURRENCY$1 });
|
|
17329
17419
|
return Array$1.flatten(found);
|
|
17330
17420
|
});
|
|
17331
|
-
// src/features/check-
|
|
17332
|
-
const RULE$
|
|
17333
|
-
const
|
|
17334
|
-
const
|
|
17335
|
-
const
|
|
17336
|
-
const
|
|
17337
|
-
|
|
17338
|
-
|
|
17339
|
-
|
|
17340
|
-
|
|
17341
|
-
const
|
|
17342
|
-
|
|
17343
|
-
|
|
17344
|
-
description: Schema.optionalKey(Schema.String),
|
|
17345
|
-
author: Schema.optionalKey(Person)
|
|
17346
|
-
}));
|
|
17347
|
-
const PluginManifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));
|
|
17348
|
-
const NpmSource = Schema.Struct({
|
|
17349
|
-
source: Schema.Literal("npm"),
|
|
17350
|
-
package: Schema.String
|
|
17351
|
-
});
|
|
17352
|
-
const PluginSchema = Schema.Struct({
|
|
17353
|
-
name: Schema.String,
|
|
17354
|
-
source: Schema.Union([Schema.String, NpmSource]),
|
|
17355
|
-
description: Schema.String
|
|
17356
|
-
});
|
|
17357
|
-
const MetadataSchema = Schema.Struct({ description: Schema.String });
|
|
17358
|
-
const Marketplace = Schema.fromJsonString(Schema.Struct({
|
|
17359
|
-
name: Schema.String,
|
|
17360
|
-
owner: OwnerSchema,
|
|
17361
|
-
metadata: Schema.optionalKey(MetadataSchema),
|
|
17362
|
-
plugins: Schema.Array(PluginSchema)
|
|
17363
|
-
}), { space: INDENT });
|
|
17364
|
-
const decodeRoot = Schema.decodeUnknownOption(RootManifest);
|
|
17365
|
-
const decodePlugin = Schema.decodeUnknownOption(PluginManifest);
|
|
17366
|
-
const encodeMarketplace = Schema.encodeEffect(Marketplace);
|
|
17367
|
-
const marketplaceName = (packageName) => pipe(String$1.toLowerCase(packageName), String$1.replace(/^@/u, ""), String$1.replaceAll(/[^a-z0-9]+/gu, "-"), String$1.replaceAll(/^-+|-+$/gu, ""));
|
|
17368
|
-
const ownerOf = (author) => {
|
|
17369
|
-
if (Predicate.isString(author)) return { name: author };
|
|
17370
|
-
return author;
|
|
17371
|
-
};
|
|
17372
|
-
const sourceOf = (project) => pipe(project.packageName, Option.filter(() => project.published), Option.match({
|
|
17373
|
-
onNone: () => `./${project.directory}`,
|
|
17374
|
-
onSome: (name) => ({
|
|
17375
|
-
source: "npm",
|
|
17376
|
-
package: name
|
|
17377
|
-
})
|
|
17378
|
-
}));
|
|
17379
|
-
const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
17380
|
-
const files = yield* RepositoryFiles;
|
|
17381
|
-
const text = yield* files.readFile(files.join(root, project.directory, PLUGIN_FILE));
|
|
17382
|
-
return pipe(text, Option.flatMap(decodePlugin), Option.map(({ name }) => ({
|
|
17383
|
-
name,
|
|
17384
|
-
source: sourceOf(project),
|
|
17385
|
-
description: Option.getOrElse(project.description, () => "")
|
|
17386
|
-
})));
|
|
17387
|
-
});
|
|
17388
|
-
const problem = problemInFile(RULE$7);
|
|
17389
|
-
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
17390
|
-
const projects = yield* workspaceProjects(root);
|
|
17391
|
-
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
17392
|
-
return Array$1.getSomes(found);
|
|
17393
|
-
});
|
|
17394
|
-
const described = (description) => pipe(Option.fromUndefinedOr(description), Option.match({
|
|
17395
|
-
onNone: () => ({}),
|
|
17396
|
-
onSome: (text) => ({ metadata: { description: text } })
|
|
17397
|
-
}));
|
|
17398
|
-
const ownerIn = Effect.fn("ownerIn")(function* ownerIn(root) {
|
|
17399
|
-
const files = yield* RepositoryFiles;
|
|
17400
|
-
const text = yield* files.readFile(files.join(root, PACKAGE_JSON_FILE));
|
|
17401
|
-
return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, description, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
|
|
17402
|
-
name: marketplaceName(name),
|
|
17403
|
-
owner: ownerOf(found),
|
|
17404
|
-
...described(description)
|
|
17405
|
-
})))));
|
|
17406
|
-
});
|
|
17407
|
-
const rewrite = Effect.fn("rewrite")(function* rewrite(file, expected) {
|
|
17408
|
-
const files = yield* RepositoryFiles;
|
|
17409
|
-
const written = yield* files.readFile(file);
|
|
17410
|
-
if (Option.exists(written, (text) => text === expected)) return [];
|
|
17411
|
-
yield* files.writeFile(file, expected);
|
|
17412
|
-
return [problem(file, `${MARKETPLACE_FILE} is generated from the workspaces that have ${PLUGIN_FILE}. msch rewrote it; commit the result.`)];
|
|
17413
|
-
});
|
|
17414
|
-
const withoutPlugins = Effect.fn("withoutPlugins")(function* withoutPlugins(file) {
|
|
17415
|
-
if (!(yield* (yield* RepositoryFiles).exists(file))) return [];
|
|
17416
|
-
return [problem(file, `No workspace has ${PLUGIN_FILE}. Delete ${MARKETPLACE_FILE}.`)];
|
|
17417
|
-
});
|
|
17418
|
-
/** @internal */
|
|
17419
|
-
const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* checkPluginMarketplace(root) {
|
|
17420
|
-
const files = yield* RepositoryFiles;
|
|
17421
|
-
const file = files.join(root, MARKETPLACE_FILE);
|
|
17422
|
-
const plugins = yield* pluginsIn(root);
|
|
17423
|
-
if (!Array$1.isReadonlyArrayNonEmpty(plugins)) return yield* withoutPlugins(file);
|
|
17424
|
-
const header = yield* ownerIn(root);
|
|
17425
|
-
if (Option.isNone(header)) return [problem(files.join(root, PACKAGE_JSON_FILE), `Workspaces ship Claude Code plugins, so ${MARKETPLACE_FILE} lists them. Add "author" to the root ${PACKAGE_JSON_FILE}; it becomes the marketplace owner.`)];
|
|
17426
|
-
const text = yield* encodeMarketplace({
|
|
17427
|
-
...header.value,
|
|
17428
|
-
plugins
|
|
17429
|
-
});
|
|
17430
|
-
return yield* rewrite(file, `${text}\n`);
|
|
17431
|
-
});
|
|
17432
|
-
// src/features/check-published-manifest/model/package-homepage.ts
|
|
17433
|
-
const RULE$6 = "package-homepage";
|
|
17434
|
-
const BRANCH = "main";
|
|
17435
|
-
const ROOT_DIRECTORY$1 = ".";
|
|
17436
|
-
const START$5 = 0;
|
|
17437
|
-
const KEYS = [
|
|
17438
|
-
"\"homepage\"",
|
|
17439
|
-
"\"repository\"",
|
|
17440
|
-
"\"name\""
|
|
17441
|
-
];
|
|
17442
|
-
const RepositoryObject = Schema.Struct({
|
|
17443
|
-
url: Schema.String,
|
|
17444
|
-
directory: Schema.optional(Schema.String)
|
|
17421
|
+
// src/features/check-published-manifest/model/package-homepage.ts
|
|
17422
|
+
const RULE$12 = "package-homepage";
|
|
17423
|
+
const BRANCH = "main";
|
|
17424
|
+
const ROOT_DIRECTORY$1 = ".";
|
|
17425
|
+
const START$6 = 0;
|
|
17426
|
+
const KEYS = [
|
|
17427
|
+
"\"homepage\"",
|
|
17428
|
+
"\"repository\"",
|
|
17429
|
+
"\"name\""
|
|
17430
|
+
];
|
|
17431
|
+
const RepositoryObject = Schema.Struct({
|
|
17432
|
+
url: Schema.String,
|
|
17433
|
+
directory: Schema.optional(Schema.String)
|
|
17445
17434
|
});
|
|
17446
17435
|
const decodeRepository = Schema.decodeUnknownOption(RepositoryObject);
|
|
17447
17436
|
const repositoryMissing = (directory) => `Published packages declare \`repository\` as \`{ "type": "git", "url": "git+https://github.com/<owner>/<repository>.git", "directory": "${directory}" }\` so that npm and \`npm repo\` link to the source.`;
|
|
@@ -17459,29 +17448,29 @@ const messagesOf = (manifest, directory) => pipe(decodeRepository(manifest.repos
|
|
|
17459
17448
|
onNone: () => [repositoryMissing(directory)],
|
|
17460
17449
|
onSome: repositoryMessages(manifest, directory)
|
|
17461
17450
|
}));
|
|
17462
|
-
const firstKeyIndex = (source) => pipe(KEYS, Array$1.findFirst((key) => String$1.includes(key)(source)), Option.flatMap((key) => String$1.indexOf(key)(source)), Option.getOrElse(() => START$
|
|
17451
|
+
const firstKeyIndex = (source) => pipe(KEYS, Array$1.findFirst((key) => String$1.includes(key)(source)), Option.flatMap((key) => String$1.indexOf(key)(source)), Option.getOrElse(() => START$6));
|
|
17463
17452
|
/** @internal */
|
|
17464
|
-
const homepageProblems = (dirname) => ({ entry, source, manifest }) => pipe(Option.some(dirname(entry.name)), Option.filter((directory) => directory !== ROOT_DIRECTORY$1), Option.map((directory) => messagesOf(manifest, directory)), Option.getOrElse(() => []), Array$1.map((message) => problemAtIndex(RULE$
|
|
17453
|
+
const homepageProblems = (dirname) => ({ entry, source, manifest }) => pipe(Option.some(dirname(entry.name)), Option.filter((directory) => directory !== ROOT_DIRECTORY$1), Option.map((directory) => messagesOf(manifest, directory)), Option.getOrElse(() => []), Array$1.map((message) => problemAtIndex(RULE$12)(entry.file, source)(firstKeyIndex(source), message)));
|
|
17465
17454
|
// src/features/check-published-manifest/model/package-scope.ts
|
|
17466
|
-
const RULE$
|
|
17455
|
+
const RULE$11 = "package-scope";
|
|
17467
17456
|
const NAME_KEY = "\"name\"";
|
|
17468
|
-
const START$
|
|
17457
|
+
const START$5 = 0;
|
|
17469
17458
|
const unscopedName = (scope) => ({ manifest }) => pipe(Option.fromUndefinedOr(manifest.name), Option.filter((name) => !String$1.startsWith(scope)(name)));
|
|
17470
|
-
const nameIndex = (source) => pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$
|
|
17459
|
+
const nameIndex = (source) => pipe(String$1.indexOf(NAME_KEY)(source), Option.getOrElse(() => START$5));
|
|
17471
17460
|
const messageFor$1 = (scope, name) => `Packages are published only under the ${scope} scope. Rename "${name}" to "${scope}${String$1.replace(/^@[^/]+\//u, "")(name)}".`;
|
|
17472
17461
|
/** @internal */
|
|
17473
|
-
const scopeProblems = (scope) => (found) => pipe(unscopedName(scope)(found), Option.map((name) => problemAtIndex(RULE$
|
|
17462
|
+
const scopeProblems = (scope) => (found) => pipe(unscopedName(scope)(found), Option.map((name) => problemAtIndex(RULE$11)(found.entry.file, found.source)(nameIndex(found.source), messageFor$1(scope, name))), Option.toArray);
|
|
17474
17463
|
// src/features/check-published-manifest/model/private-dependency.ts
|
|
17475
|
-
const RULE$
|
|
17476
|
-
const START$
|
|
17464
|
+
const RULE$10 = "private-workspace-dependency";
|
|
17465
|
+
const START$4 = 0;
|
|
17477
17466
|
const listedIn = (manifest) => pipe(RUNTIME_SECTIONS, Array$1.flatMap((section) => pipe(Option.fromUndefinedOr(manifest[section]), Option.map(Record.keys), Option.getOrElse(() => []), Array$1.map((name) => ({
|
|
17478
17467
|
section,
|
|
17479
17468
|
name
|
|
17480
17469
|
})))));
|
|
17481
17470
|
const messageFor = ({ section, name }) => `lists the private workspace package "${name}" in ${section}. A private package is never on npm, so pnpm refuses to pack this package and an install could not resolve it. Move "${name}" to devDependencies so that vp pack bundles it.`;
|
|
17482
|
-
const indexOf = (source, name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.getOrElse(() => START$
|
|
17471
|
+
const indexOf = (source, name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.getOrElse(() => START$4));
|
|
17483
17472
|
/** @internal */
|
|
17484
|
-
const privateDependencyProblems = (privateNames) => (found) => pipe(listedIn(found.manifest), Array$1.filter(({ name }) => privateNames.has(name)), Array$1.map((listed) => problemAtIndex(RULE$
|
|
17473
|
+
const privateDependencyProblems = (privateNames) => (found) => pipe(listedIn(found.manifest), Array$1.filter(({ name }) => privateNames.has(name)), Array$1.map((listed) => problemAtIndex(RULE$10)(found.entry.file, found.source)(indexOf(found.source, listed.name), messageFor(listed))));
|
|
17485
17474
|
// src/features/check-published-manifest/model/published-manifests.ts
|
|
17486
17475
|
const privateNamesIn = Effect.fn("privateNamesIn")(function* privateNamesIn(root) {
|
|
17487
17476
|
const manifests = yield* manifestTexts(root);
|
|
@@ -17501,7 +17490,7 @@ const checkPublishedManifests = Effect.fn("checkPublishedManifests")(function* c
|
|
|
17501
17490
|
]);
|
|
17502
17491
|
});
|
|
17503
17492
|
// src/features/check-runtime-version/model/node-version.ts
|
|
17504
|
-
const RULE$
|
|
17493
|
+
const RULE$9 = "node-version";
|
|
17505
17494
|
const MINIMUM = 26;
|
|
17506
17495
|
const SUPPORTED = `Node.js ${String(MINIMUM)} or later is the only supported runtime.`;
|
|
17507
17496
|
const MANIFEST = /(?:^|\/)package\.json$/u;
|
|
@@ -17515,7 +17504,7 @@ const TOOL_VERSION = /^[ \t]*["']?(?:node|nodejs)["']?[ \t]*(?:=[ \t]*["']?|[ \t
|
|
|
17515
17504
|
const RANGE_FLOOR = /^(?:>=|\^|~|=)?[ \t]*v?(?<major>\d+)/u;
|
|
17516
17505
|
const ALTERNATIVE = "||";
|
|
17517
17506
|
const ENGINES_KEY = "\"engines\"";
|
|
17518
|
-
const START$
|
|
17507
|
+
const START$3 = 0;
|
|
17519
17508
|
const EXCLUDED = [":(exclude,attr:linguist-vendored)", ":(exclude,attr:linguist-generated)"];
|
|
17520
17509
|
const majorOf = (found) => pipe(groupOf("major")(found), Option.map(Number));
|
|
17521
17510
|
const isOld = (major) => major < MINIMUM;
|
|
@@ -17525,12 +17514,12 @@ const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
|
|
|
17525
17514
|
onSome: isOld
|
|
17526
17515
|
}));
|
|
17527
17516
|
const admitsOld = (range) => pipe(String$1.split(range, ALTERNATIVE), Array$1.some(floorIsOld));
|
|
17528
|
-
const problemAt = ({ entry, source, index }, message) => problemAtIndex(RULE$
|
|
17529
|
-
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$
|
|
17517
|
+
const problemAt = ({ entry, source, index }, message) => problemAtIndex(RULE$9)(entry.file, source)(index, message);
|
|
17518
|
+
const offsetOf = (source, text) => pipe(String$1.indexOf(text)(source), Option.getOrElse(() => START$3));
|
|
17530
17519
|
const unstatedProblem = (entry, source) => problemAt({
|
|
17531
17520
|
entry,
|
|
17532
17521
|
source,
|
|
17533
|
-
index: START$
|
|
17522
|
+
index: START$3
|
|
17534
17523
|
}, `${SUPPORTED} This package is published without engines.node, so its users cannot tell. Set engines.node to ">=${String(MINIMUM)}".`);
|
|
17535
17524
|
const rangeProblem = (entry, source) => (range) => problemAt({
|
|
17536
17525
|
entry,
|
|
@@ -17549,14 +17538,14 @@ const manifestProblems$1 = (entry, source) => {
|
|
|
17549
17538
|
const pinnedProblems = (pattern) => (entry, source) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(source)), Array$1.filter((found) => Option.exists(majorOf(found), isOld)), Array$1.map((found) => problemAt({
|
|
17550
17539
|
entry,
|
|
17551
17540
|
source,
|
|
17552
|
-
index: found.index ?? START$
|
|
17553
|
-
}, `${SUPPORTED} \`${String$1.trim(found[START$
|
|
17541
|
+
index: found.index ?? START$3
|
|
17542
|
+
}, `${SUPPORTED} \`${String$1.trim(found[START$3])}\` pins an older one. Raise it to ${String(MINIMUM)} or later.`)));
|
|
17554
17543
|
const versionFileProblems = (entry, source) => pipe(majorOf(PINNED_VERSION.exec(source)), Option.filter(isOld), Option.map((major) => problemAt({
|
|
17555
17544
|
entry,
|
|
17556
17545
|
source,
|
|
17557
|
-
index: START$
|
|
17546
|
+
index: START$3
|
|
17558
17547
|
}, `${SUPPORTED} This file pins ${String(major)}. Raise it to ${String(MINIMUM)} or later.`)), Option.toArray);
|
|
17559
|
-
const problemsIn$
|
|
17548
|
+
const problemsIn$3 = (entry, source) => {
|
|
17560
17549
|
if (MANIFEST.test(entry.name)) return manifestProblems$1(entry, source);
|
|
17561
17550
|
if (VERSION_FILE.test(entry.name)) return versionFileProblems(entry, source);
|
|
17562
17551
|
if (DOCKERFILE.test(entry.name)) return pinnedProblems(BASE_IMAGE)(entry, source);
|
|
@@ -17573,15 +17562,15 @@ const checkNodeVersion = Effect.fn("checkNodeVersion")(function* checkNodeVersio
|
|
|
17573
17562
|
name,
|
|
17574
17563
|
file: files.join(root, name)
|
|
17575
17564
|
})))];
|
|
17576
|
-
return yield* scanText(sources, problemsIn$
|
|
17565
|
+
return yield* scanText(sources, problemsIn$3);
|
|
17577
17566
|
});
|
|
17578
17567
|
// src/features/check-unused-workspaces/model/unused-workspaces.ts
|
|
17579
|
-
const RULE$
|
|
17568
|
+
const RULE$8 = "unused-workspace";
|
|
17580
17569
|
const CARGO_FILE = "Cargo.toml";
|
|
17581
17570
|
const ROOT_DIRECTORY = "";
|
|
17582
17571
|
const TASK_SEPARATOR = "#";
|
|
17583
|
-
const START$
|
|
17584
|
-
const FIRST$
|
|
17572
|
+
const START$2 = 0;
|
|
17573
|
+
const FIRST$3 = 1;
|
|
17585
17574
|
const READ_CONCURRENCY = 8;
|
|
17586
17575
|
const LIBRARY_KINDS = [
|
|
17587
17576
|
"lib",
|
|
@@ -17619,7 +17608,7 @@ const cargoFacts = Effect.fn("cargoFacts")(function* cargoFacts(root, directorie
|
|
|
17619
17608
|
links: pipe(crates, Array$1.flatMap(({ manifest, pathDependencies }) => linksOf(manifest, pathDependencies)))
|
|
17620
17609
|
};
|
|
17621
17610
|
});
|
|
17622
|
-
const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START$
|
|
17611
|
+
const workspaceOfTask = (text) => pipe(String$1.indexOf(TASK_SEPARATOR)(text), Option.map((at) => String$1.slice(START$2, at)(text)), Option.filter(String$1.isNonEmpty));
|
|
17623
17612
|
const taskTargets = Effect.fn("taskTargets")(function* taskTargets(root, directory) {
|
|
17624
17613
|
const config = yield* workspaceConfigOf(root, directory);
|
|
17625
17614
|
return pipe(config, Option.map(({ program }) => pipe(nestedValues(RUN_TASKS)(program), Array$1.flatMap(stringsIn), Array$1.flatMap(({ text }) => Option.toArray(workspaceOfTask(text))))), Option.getOrElse(() => []));
|
|
@@ -17671,27 +17660,499 @@ const checkUnusedWorkspaces = Effect.fn("checkUnusedWorkspaces")(function* check
|
|
|
17671
17660
|
];
|
|
17672
17661
|
return pipe(members, Array$1.filter(({ library, entry }) => library && !entry), Array$1.filter((member) => !isDependedOn(links)(member)), Array$1.map(({ directory }) => ({
|
|
17673
17662
|
file: files.join(root, directory, PACKAGE_JSON_FILE),
|
|
17674
|
-
line: FIRST$
|
|
17675
|
-
column: FIRST$
|
|
17676
|
-
rule: RULE$
|
|
17663
|
+
line: FIRST$3,
|
|
17664
|
+
column: FIRST$3,
|
|
17665
|
+
rule: RULE$8,
|
|
17677
17666
|
message: `${directory} is a private library, and no other workspace depends on it through package.json, a Cargo path dependency or a task. Delete it, or depend on it from the code that uses it.`
|
|
17678
17667
|
})));
|
|
17679
17668
|
});
|
|
17680
17669
|
// src/features/check-workspace-descriptions/model/workspace-descriptions.ts
|
|
17681
|
-
const RULE$
|
|
17682
|
-
const FIRST = 1;
|
|
17670
|
+
const RULE$7 = "workspace-description";
|
|
17671
|
+
const FIRST$2 = 1;
|
|
17683
17672
|
/** @internal */
|
|
17684
17673
|
const checkWorkspaceDescriptions = Effect.fn("checkWorkspaceDescriptions")(function* checkWorkspaceDescriptions(root) {
|
|
17685
17674
|
const files = yield* RepositoryFiles;
|
|
17686
17675
|
const projects = yield* workspaceProjects(root);
|
|
17687
17676
|
return pipe(projects, Array$1.filter(({ description }) => Option.isNone(description)), Array$1.map(({ directory }) => ({
|
|
17688
17677
|
file: files.join(root, directory, PACKAGE_JSON_FILE),
|
|
17689
|
-
line: FIRST,
|
|
17690
|
-
column: FIRST,
|
|
17691
|
-
rule: RULE$
|
|
17678
|
+
line: FIRST$2,
|
|
17679
|
+
column: FIRST$2,
|
|
17680
|
+
rule: RULE$7,
|
|
17692
17681
|
message: "Add a one-line \"description\" that says what this workspace is for. Agents find existing tools by these descriptions, so a workspace without one is invisible to them."
|
|
17693
17682
|
})));
|
|
17694
17683
|
});
|
|
17684
|
+
// src/features/check-plugin-layout/model/plugin-layout.ts
|
|
17685
|
+
const RULE$6 = "plugin-layout";
|
|
17686
|
+
const PLUGIN_FILE$1 = ".claude-plugin/plugin.json";
|
|
17687
|
+
const MARKETPLACE_FILE$1 = ".claude-plugin/marketplace.json";
|
|
17688
|
+
const SKILL_FILE = "SKILL.md";
|
|
17689
|
+
const BIN_PREFIX = "bin/";
|
|
17690
|
+
const SEPARATOR = "/";
|
|
17691
|
+
const MOST_FILES = 5e3;
|
|
17692
|
+
const LONGEST_PATH = 472;
|
|
17693
|
+
const MOST_DEPTH = 12;
|
|
17694
|
+
const LONGEST_PART = 255;
|
|
17695
|
+
const LONGEST_DESCRIPTION = 500;
|
|
17696
|
+
const CONCURRENCY$3 = 16;
|
|
17697
|
+
const PLUGIN_NAME = /^[\p{Ll}\p{Nd}-]{1,64}$/u;
|
|
17698
|
+
const ALLOWED_PATH = /^[A-Za-z0-9 _.\-/(),]+$/u;
|
|
17699
|
+
const XML_TAG = /<[A-Za-z][^>]*>/u;
|
|
17700
|
+
const ARCHIVE = ".zip";
|
|
17701
|
+
const SINGLE = 1;
|
|
17702
|
+
const SkillFields$1 = Schema.Struct({
|
|
17703
|
+
name: Schema.optionalKey(Schema.String),
|
|
17704
|
+
description: Schema.optionalKey(Schema.String)
|
|
17705
|
+
});
|
|
17706
|
+
const decodeSkillFields = Schema.decodeUnknownOption(SkillFields$1);
|
|
17707
|
+
const problem$4 = problemInFile(RULE$6);
|
|
17708
|
+
const violation = (path, message) => ({
|
|
17709
|
+
path,
|
|
17710
|
+
message
|
|
17711
|
+
});
|
|
17712
|
+
const when = (path, message, broken) => Option.liftPredicate(violation(path, message), () => broken);
|
|
17713
|
+
const VERSIONED = "sets version. Leave it out so that every commit reaches installed copies.";
|
|
17714
|
+
const WORDY = `has a description longer than ${String(LONGEST_DESCRIPTION)} characters.`;
|
|
17715
|
+
const manifestViolations = (plugin) => {
|
|
17716
|
+
const wordy = Option.exists(plugin.description, (text) => text.length > LONGEST_DESCRIPTION);
|
|
17717
|
+
const named = `names the plugin ${plugin.name}, which is not 1 to 64 lowercase letters, digits or hyphens.`;
|
|
17718
|
+
return pipe([
|
|
17719
|
+
when(PLUGIN_FILE$1, VERSIONED, plugin.versioned),
|
|
17720
|
+
when(PLUGIN_FILE$1, named, !PLUGIN_NAME.test(plugin.name)),
|
|
17721
|
+
when(PLUGIN_FILE$1, WORDY, wordy)
|
|
17722
|
+
], Array$1.getSomes);
|
|
17723
|
+
};
|
|
17724
|
+
const nestedManifests = (plugin) => pipe(plugin.files, Array$1.filter((file) => String$1.endsWith(PLUGIN_FILE$1)(file) && file !== PLUGIN_FILE$1), Array$1.map((file) => violation(file, `is a second manifest. A plugin has exactly one, at ${PLUGIN_FILE$1}.`)));
|
|
17725
|
+
const binViolations = (plugin) => pipe(plugin.files, Array$1.filter(String$1.startsWith(BIN_PREFIX)), Array$1.map((file) => violation(file, "is under a top-level bin/, which claude.ai sync rejects.")));
|
|
17726
|
+
const LONG_PATH = `has a path longer than ${String(LONGEST_PATH)} characters.`;
|
|
17727
|
+
const DEEP_PATH = `is nested deeper than ${String(MOST_DEPTH)} directories.`;
|
|
17728
|
+
const WIDE_PART = `has a path part longer than ${String(LONGEST_PART)} characters.`;
|
|
17729
|
+
const BAD_CHARACTERS = "has characters outside letters, digits, space and _ . - / ( ).";
|
|
17730
|
+
const ARCHIVE_MESSAGE = "is an archive, which claude.ai sync rejects.";
|
|
17731
|
+
const pathViolation = (file) => {
|
|
17732
|
+
const parts = String$1.split(SEPARATOR)(file);
|
|
17733
|
+
const wide = pipe(parts, Array$1.some((part) => part.length > LONGEST_PART));
|
|
17734
|
+
return pipe([
|
|
17735
|
+
[BAD_CHARACTERS, !ALLOWED_PATH.test(file)],
|
|
17736
|
+
[LONG_PATH, file.length > LONGEST_PATH],
|
|
17737
|
+
[DEEP_PATH, parts.length > MOST_DEPTH],
|
|
17738
|
+
[WIDE_PART, wide],
|
|
17739
|
+
[ARCHIVE_MESSAGE, String$1.endsWith(ARCHIVE)(file)]
|
|
17740
|
+
], Array$1.findFirst(([, broken]) => broken), Option.map(([message]) => message));
|
|
17741
|
+
};
|
|
17742
|
+
const pathViolations = (plugin) => pipe(plugin.files, Array$1.flatMap((file) => pipe(pathViolation(file), Option.map((message) => violation(file, message)), Option.toArray)));
|
|
17743
|
+
const TOO_MANY = `holds more than ${String(MOST_FILES)} files, which claude.ai sync rejects.`;
|
|
17744
|
+
const countViolations = (plugin) => pipe(when(PLUGIN_FILE$1, TOO_MANY, plugin.files.length > MOST_FILES), Option.toArray);
|
|
17745
|
+
const linkViolations = (plugin, links, prefix) => pipe(plugin.files, Array$1.filter((file) => links.has(`${prefix}${file}`)), Array$1.map((file) => violation(file, "is a symbolic link, which claude.ai sync rejects.")));
|
|
17746
|
+
const skillTextOf = Effect.fn("skillTextOf")(function* skillTextOf(plugin, file) {
|
|
17747
|
+
const files = yield* RepositoryFiles;
|
|
17748
|
+
const text = yield* files.readFile(files.join(plugin.directory, file));
|
|
17749
|
+
return pipe(text, Option.flatMap(splitFrontmatter), Option.flatMap(({ fields }) => decodeSkillFields(fields)), Option.map((fields) => ({
|
|
17750
|
+
file,
|
|
17751
|
+
name: fields.name ?? "",
|
|
17752
|
+
description: fields.description ?? ""
|
|
17753
|
+
})));
|
|
17754
|
+
});
|
|
17755
|
+
const skillViolations = (skills) => {
|
|
17756
|
+
const counts = Array$1.groupBy(skills, ({ name }) => name);
|
|
17757
|
+
return pipe(skills, Array$1.flatMap(({ file, name, description }) => pipe([
|
|
17758
|
+
Option.liftPredicate("has no name.", () => String$1.isEmpty(name)),
|
|
17759
|
+
Option.liftPredicate("has no description.", () => String$1.isEmpty(description)),
|
|
17760
|
+
Option.liftPredicate("has an XML tag in its name or description.", () => XML_TAG.test(`${name}\n${description}`)),
|
|
17761
|
+
Option.liftPredicate(`shares the name ${name} with another SKILL.md of the plugin.`, () => pipe(Record.get(counts, name), Option.exists((group) => group.length > SINGLE)))
|
|
17762
|
+
], Array$1.getSomes, Array$1.map((message) => violation(file, message)))));
|
|
17763
|
+
};
|
|
17764
|
+
const skillFilesOf = (plugin) => pipe(plugin.files, Array$1.filter((file) => file === SKILL_FILE || String$1.endsWith(`${SEPARATOR}${SKILL_FILE}`)(file)));
|
|
17765
|
+
const violationsOf = Effect.fn("violationsOf")(function* violationsOf(root, plugin, links) {
|
|
17766
|
+
const prefix = `${(yield* RepositoryFiles).relative(root, plugin.directory)}${SEPARATOR}`;
|
|
17767
|
+
const skills = yield* Effect.forEach(skillFilesOf(plugin), (file) => skillTextOf(plugin, file), { concurrency: CONCURRENCY$3 });
|
|
17768
|
+
return [
|
|
17769
|
+
...manifestViolations(plugin),
|
|
17770
|
+
...nestedManifests(plugin),
|
|
17771
|
+
...binViolations(plugin),
|
|
17772
|
+
...countViolations(plugin),
|
|
17773
|
+
...pathViolations(plugin),
|
|
17774
|
+
...linkViolations(plugin, links, prefix),
|
|
17775
|
+
...skillViolations(Array$1.getSomes(skills))
|
|
17776
|
+
];
|
|
17777
|
+
});
|
|
17778
|
+
const rootProblems = Effect.fn("rootProblems")(function* rootProblems(root) {
|
|
17779
|
+
const files = yield* RepositoryFiles;
|
|
17780
|
+
const marketplace = yield* files.exists(files.join(root, MARKETPLACE_FILE$1));
|
|
17781
|
+
const manifest = files.join(root, PLUGIN_FILE$1);
|
|
17782
|
+
const isPlugin = yield* files.exists(manifest);
|
|
17783
|
+
return pipe(Option.liftPredicate(problem$4(manifest, "makes the marketplace root a plugin. The marketplace is not itself a plugin."), () => marketplace && isPlugin), Option.toArray);
|
|
17784
|
+
});
|
|
17785
|
+
/** @internal */
|
|
17786
|
+
const checkPluginLayout = Effect.fn("checkPluginLayout")(function* checkPluginLayout(root) {
|
|
17787
|
+
const files = yield* RepositoryFiles;
|
|
17788
|
+
const plugins = yield* pluginsIn$1(root);
|
|
17789
|
+
const linked = yield* files.linkedFiles(root);
|
|
17790
|
+
const links = new Set(linked);
|
|
17791
|
+
const found = yield* Effect.forEach(plugins, (plugin) => violationsOf(root, plugin, links).pipe(Effect.map(Array$1.map(({ path, message }) => problem$4(files.join(plugin.directory, path), message)))), { concurrency: CONCURRENCY$3 });
|
|
17792
|
+
const marketplace = yield* rootProblems(root);
|
|
17793
|
+
return [...Array$1.flatten(found), ...marketplace];
|
|
17794
|
+
});
|
|
17795
|
+
// src/features/check-plugin-marketplace/model/plugin-marketplace.ts
|
|
17796
|
+
const RULE$5 = "plugin-marketplace";
|
|
17797
|
+
const PLUGIN_DIRECTORY = ".claude-plugin";
|
|
17798
|
+
const PLUGIN_FILE = `${PLUGIN_DIRECTORY}/plugin.json`;
|
|
17799
|
+
const MARKETPLACE_FILE = `${PLUGIN_DIRECTORY}/marketplace.json`;
|
|
17800
|
+
const INDENT = 2;
|
|
17801
|
+
const OwnerSchema = Schema.Struct({
|
|
17802
|
+
name: Schema.String,
|
|
17803
|
+
url: Schema.optionalKey(Schema.String)
|
|
17804
|
+
});
|
|
17805
|
+
const Person = Schema.Union([Schema.String, OwnerSchema]);
|
|
17806
|
+
const RootManifest = Schema.fromJsonString(Schema.Struct({
|
|
17807
|
+
name: Schema.String,
|
|
17808
|
+
description: Schema.optionalKey(Schema.String),
|
|
17809
|
+
author: Schema.optionalKey(Person)
|
|
17810
|
+
}));
|
|
17811
|
+
const PluginManifest = Schema.fromJsonString(Schema.Struct({ name: Schema.String }));
|
|
17812
|
+
const NpmSource = Schema.Struct({
|
|
17813
|
+
source: Schema.Literal("npm"),
|
|
17814
|
+
package: Schema.String
|
|
17815
|
+
});
|
|
17816
|
+
const PluginSchema = Schema.Struct({
|
|
17817
|
+
name: Schema.String,
|
|
17818
|
+
source: Schema.Union([Schema.String, NpmSource]),
|
|
17819
|
+
description: Schema.String
|
|
17820
|
+
});
|
|
17821
|
+
const MetadataSchema = Schema.Struct({ description: Schema.String });
|
|
17822
|
+
const Marketplace = Schema.fromJsonString(Schema.Struct({
|
|
17823
|
+
name: Schema.String,
|
|
17824
|
+
owner: OwnerSchema,
|
|
17825
|
+
metadata: Schema.optionalKey(MetadataSchema),
|
|
17826
|
+
plugins: Schema.Array(PluginSchema)
|
|
17827
|
+
}), { space: INDENT });
|
|
17828
|
+
const decodeRoot = Schema.decodeUnknownOption(RootManifest);
|
|
17829
|
+
const decodePlugin = Schema.decodeUnknownOption(PluginManifest);
|
|
17830
|
+
const encodeMarketplace = Schema.encodeEffect(Marketplace);
|
|
17831
|
+
const marketplaceName = (packageName) => pipe(String$1.toLowerCase(packageName), String$1.replace(/^@/u, ""), String$1.replaceAll(/[^a-z0-9]+/gu, "-"), String$1.replaceAll(/^-+|-+$/gu, ""));
|
|
17832
|
+
const ownerOf = (author) => {
|
|
17833
|
+
if (Predicate.isString(author)) return { name: author };
|
|
17834
|
+
return author;
|
|
17835
|
+
};
|
|
17836
|
+
const sourceOf = (project) => pipe(project.packageName, Option.filter(() => project.published), Option.match({
|
|
17837
|
+
onNone: () => `./${project.directory}`,
|
|
17838
|
+
onSome: (name) => ({
|
|
17839
|
+
source: "npm",
|
|
17840
|
+
package: name
|
|
17841
|
+
})
|
|
17842
|
+
}));
|
|
17843
|
+
const pluginIn = Effect.fn("pluginIn")(function* pluginIn(root, project) {
|
|
17844
|
+
const files = yield* RepositoryFiles;
|
|
17845
|
+
const text = yield* files.readFile(files.join(root, project.directory, PLUGIN_FILE));
|
|
17846
|
+
return pipe(text, Option.flatMap(decodePlugin), Option.map(({ name }) => ({
|
|
17847
|
+
name,
|
|
17848
|
+
source: sourceOf(project),
|
|
17849
|
+
description: Option.getOrElse(project.description, () => "")
|
|
17850
|
+
})));
|
|
17851
|
+
});
|
|
17852
|
+
const problem$3 = problemInFile(RULE$5);
|
|
17853
|
+
const pluginsIn = Effect.fn("pluginsIn")(function* pluginsIn(root) {
|
|
17854
|
+
const projects = yield* workspaceProjects(root);
|
|
17855
|
+
const found = yield* Effect.forEach(projects, (project) => pluginIn(root, project), { concurrency: "unbounded" });
|
|
17856
|
+
return Array$1.getSomes(found);
|
|
17857
|
+
});
|
|
17858
|
+
const described = (description) => pipe(Option.fromUndefinedOr(description), Option.match({
|
|
17859
|
+
onNone: () => ({}),
|
|
17860
|
+
onSome: (text) => ({ metadata: { description: text } })
|
|
17861
|
+
}));
|
|
17862
|
+
const ownerIn = Effect.fn("ownerIn")(function* ownerIn(root) {
|
|
17863
|
+
const files = yield* RepositoryFiles;
|
|
17864
|
+
const text = yield* files.readFile(files.join(root, PACKAGE_JSON_FILE));
|
|
17865
|
+
return pipe(text, Option.flatMap(decodeRoot), Option.flatMap(({ name, description, author }) => pipe(Option.fromUndefinedOr(author), Option.map((found) => ({
|
|
17866
|
+
name: marketplaceName(name),
|
|
17867
|
+
owner: ownerOf(found),
|
|
17868
|
+
...described(description)
|
|
17869
|
+
})))));
|
|
17870
|
+
});
|
|
17871
|
+
const rewrite = Effect.fn("rewrite")(function* rewrite(file, expected) {
|
|
17872
|
+
const files = yield* RepositoryFiles;
|
|
17873
|
+
const written = yield* files.readFile(file);
|
|
17874
|
+
if (Option.exists(written, (text) => text === expected)) return [];
|
|
17875
|
+
yield* files.writeFile(file, expected);
|
|
17876
|
+
return [problem$3(file, `${MARKETPLACE_FILE} is generated from the workspaces that have ${PLUGIN_FILE}. msch rewrote it; commit the result.`)];
|
|
17877
|
+
});
|
|
17878
|
+
const withoutPlugins = Effect.fn("withoutPlugins")(function* withoutPlugins(file) {
|
|
17879
|
+
if (!(yield* (yield* RepositoryFiles).exists(file))) return [];
|
|
17880
|
+
return [problem$3(file, `No workspace has ${PLUGIN_FILE}. Delete ${MARKETPLACE_FILE}.`)];
|
|
17881
|
+
});
|
|
17882
|
+
/** @internal */
|
|
17883
|
+
const checkPluginMarketplace = Effect.fn("checkPluginMarketplace")(function* checkPluginMarketplace(root) {
|
|
17884
|
+
const files = yield* RepositoryFiles;
|
|
17885
|
+
const file = files.join(root, MARKETPLACE_FILE);
|
|
17886
|
+
const plugins = yield* pluginsIn(root);
|
|
17887
|
+
if (!Array$1.isReadonlyArrayNonEmpty(plugins)) return yield* withoutPlugins(file);
|
|
17888
|
+
const header = yield* ownerIn(root);
|
|
17889
|
+
if (Option.isNone(header)) return [problem$3(files.join(root, PACKAGE_JSON_FILE), `Workspaces ship Claude Code plugins, so ${MARKETPLACE_FILE} lists them. Add "author" to the root ${PACKAGE_JSON_FILE}; it becomes the marketplace owner.`)];
|
|
17890
|
+
const text = yield* encodeMarketplace({
|
|
17891
|
+
...header.value,
|
|
17892
|
+
plugins
|
|
17893
|
+
});
|
|
17894
|
+
return yield* rewrite(file, `${text}\n`);
|
|
17895
|
+
});
|
|
17896
|
+
// src/features/check-readme-skills/model/readme-skills.ts
|
|
17897
|
+
const RULE$4 = "readme-skills";
|
|
17898
|
+
const README_FILE = "README.md";
|
|
17899
|
+
const FIRST_SENTENCE = /^[\s\S]*?(?:。|\.(?=\s|$))/u;
|
|
17900
|
+
const CALLED_SKILL$1 = /`(?<name>[a-z0-9-]+:[a-z0-9-]+)`/u;
|
|
17901
|
+
const EMPTY = "";
|
|
17902
|
+
const START$1 = 0;
|
|
17903
|
+
const HEADER = ["| 呼び出し | 使う場面 | 本体のスキル |", "| --- | --- | --- |"];
|
|
17904
|
+
const SkillFields = Schema.Struct({
|
|
17905
|
+
description: Schema.optionalKey(Schema.String),
|
|
17906
|
+
"argument-hint": Schema.optionalKey(Schema.String),
|
|
17907
|
+
"disable-model-invocation": Schema.optionalKey(Schema.Boolean)
|
|
17908
|
+
});
|
|
17909
|
+
const decodeFields = Schema.decodeUnknownOption(SkillFields);
|
|
17910
|
+
const problem$2 = problemInFile(RULE$4);
|
|
17911
|
+
const cell = (text) => pipe(text, String$1.replaceAll("|", String.raw`\|`), String$1.replaceAll("\n", " "));
|
|
17912
|
+
const sceneOf = (description) => pipe(Option.fromNullishOr(FIRST_SENTENCE.exec(description)), Option.flatMap(Array$1.head), Option.getOrElse(() => description));
|
|
17913
|
+
const targetOf = (fields, body) => pipe(Option.liftPredicate(body, () => fields["disable-model-invocation"] === true), Option.flatMap((text) => groupOf("name")(CALLED_SKILL$1.exec(text))), Option.map((name) => `\`${name}\``), Option.getOrElse(() => EMPTY));
|
|
17914
|
+
const rowOf = ({ plugin, name, frontmatter }) => pipe(decodeFields(frontmatter.fields), Option.map((fields) => {
|
|
17915
|
+
const hint = Option.fromUndefinedOr(fields["argument-hint"]);
|
|
17916
|
+
const call = pipe(hint, Option.filter(String$1.isNonEmpty), Option.match({
|
|
17917
|
+
onNone: () => `/${plugin}:${name}`,
|
|
17918
|
+
onSome: (text) => `/${plugin}:${name} ${text}`
|
|
17919
|
+
}));
|
|
17920
|
+
const scene = sceneOf(String$1.trim(fields.description ?? EMPTY));
|
|
17921
|
+
return `| ${cell(`\`${call}\``)} | ${cell(scene)} | ${targetOf(fields, frontmatter.body)} |`;
|
|
17922
|
+
}));
|
|
17923
|
+
const skillsTable = (skills) => pipe(skills, Array$1.map(rowOf), Array$1.getSomes, (rows) => [...HEADER, ...rows], Array$1.join("\n"));
|
|
17924
|
+
const withSkillsTable = (readme, table) => {
|
|
17925
|
+
const block = `${SKILLS_START}\n${table}\n${SKILLS_END}`;
|
|
17926
|
+
const start = String$1.indexOf(SKILLS_START)(readme);
|
|
17927
|
+
const end = String$1.indexOf(SKILLS_END)(readme);
|
|
17928
|
+
return pipe(Option.all([start, end]), Option.filter(([from, to]) => to > from), Option.match({
|
|
17929
|
+
onNone: () => `${String$1.trimEnd(readme)}\n\n## スキル\n\n${block}\n`,
|
|
17930
|
+
onSome: ([from, to]) => `${String$1.slice(START$1, from)(readme)}${block}${String$1.slice(to + 26)(readme)}`
|
|
17931
|
+
}));
|
|
17932
|
+
};
|
|
17933
|
+
const syncReadme = Effect.fn("syncReadme")(function* syncReadme({ directory, skills }) {
|
|
17934
|
+
const files = yield* RepositoryFiles;
|
|
17935
|
+
const file = files.join(directory, README_FILE);
|
|
17936
|
+
const text = yield* files.readFile(file);
|
|
17937
|
+
const current = Option.getOrElse(text, () => EMPTY);
|
|
17938
|
+
const expected = withSkillsTable(current, skillsTable(skills));
|
|
17939
|
+
if (expected === current) return [];
|
|
17940
|
+
yield* files.writeFile(file, expected);
|
|
17941
|
+
return [problem$2(file, `The skills table between ${SKILLS_START} and ${SKILLS_END} is generated from the SKILL.md frontmatter of the plugin. msch rewrote it; commit the result.`)];
|
|
17942
|
+
});
|
|
17943
|
+
/** @internal */
|
|
17944
|
+
const checkReadmeSkills = Effect.fn("checkReadmeSkills")(function* checkReadmeSkills(root) {
|
|
17945
|
+
const plugins = yield* pluginsIn$1(root);
|
|
17946
|
+
const withSkills = pipe(plugins, Array$1.filter(({ skills }) => Array$1.isReadonlyArrayNonEmpty(skills)));
|
|
17947
|
+
const found = yield* Effect.forEach(withSkills, syncReadme, { concurrency: "unbounded" });
|
|
17948
|
+
return Array$1.flatten(found);
|
|
17949
|
+
});
|
|
17950
|
+
// src/features/check-skill-enumerations/model/enumeration-signals.ts
|
|
17951
|
+
const MOST_NAMES_IN_A_LINE = 3;
|
|
17952
|
+
const MOST_VALUES_FOR_A_FLAG = 2;
|
|
17953
|
+
const FIRST$1 = 1;
|
|
17954
|
+
const NONE = 0;
|
|
17955
|
+
const FENCE = /^\s*```/u;
|
|
17956
|
+
const ROW_START = /^\s*(?:[-*]|\d+\.|\|)\s*`?\/?(?:[a-z0-9-]+:)?(?<name>[a-z0-9-]+)/u;
|
|
17957
|
+
const FLAG_WITH_VALUE = /(?<flag>--[a-z][a-z-]*)[ =](?<value>[^\s-]\S*)/gu;
|
|
17958
|
+
const ARRAY = /\[(?<elements>[^[\]{}]*)\]/gu;
|
|
17959
|
+
const ELEMENT_SEPARATOR = /,(?![^()]*\))/u;
|
|
17960
|
+
const MARKDOWN$2 = ".md";
|
|
17961
|
+
const lineNumberOf = (index) => index + FIRST$1;
|
|
17962
|
+
const toggled = (open, line) => pipe(Option.liftPredicate(line, (text) => FENCE.test(text)), Option.match({
|
|
17963
|
+
onNone: () => open,
|
|
17964
|
+
onSome: () => !open
|
|
17965
|
+
}));
|
|
17966
|
+
const insideFence = (lines) => pipe(Array$1.scan(lines, false, toggled), Array$1.drop(FIRST$1), Array$1.zipWith(lines, (open, line) => open || FENCE.test(line)));
|
|
17967
|
+
const insideGenerated = (lines) => pipe(Array$1.scan(lines, false, (open, line) => {
|
|
17968
|
+
return (open || String$1.includes("<!-- skills:generated -->")(line)) && !String$1.includes("<!-- /skills:generated -->")(line);
|
|
17969
|
+
}), Array$1.drop(FIRST$1), Array$1.zipWith(lines, (open, line) => open || String$1.includes("<!-- /skills:generated -->")(line)));
|
|
17970
|
+
const namesPerLine = (lines, entities) => pipe(lines, Array$1.flatMap((line, index) => {
|
|
17971
|
+
const named = pipe(entities, Array$1.filter((entity) => namesSkill(entity)(line)));
|
|
17972
|
+
return pipe(Option.liftPredicate(named, (found) => found.length > MOST_NAMES_IN_A_LINE), Option.map((found) => ({
|
|
17973
|
+
line: lineNumberOf(index),
|
|
17974
|
+
reason: `names ${String(found.length)} skills or plugins in one line (${Array$1.join(found, ", ")}); derive the set from the directories or the frontmatter instead`
|
|
17975
|
+
})), Option.toArray);
|
|
17976
|
+
}));
|
|
17977
|
+
const startsWithEntity = (line, entities) => pipe(groupOf("name")(ROW_START.exec(line)), Option.exists((name) => Array$1.contains(entities, name)));
|
|
17978
|
+
const rowRuns = (lines, entities) => {
|
|
17979
|
+
const runs = pipe(lines, Array$1.scan(NONE, (run, line) => pipe(Option.liftPredicate(run + FIRST$1, () => startsWithEntity(line, entities)), Option.getOrElse(() => NONE))), Array$1.drop(FIRST$1));
|
|
17980
|
+
return pipe(runs, Array$1.flatMap((run, index) => pipe(Option.liftPredicate(index, () => run === 5), Option.map((at) => ({
|
|
17981
|
+
line: lineNumberOf(at),
|
|
17982
|
+
reason: `${String(5)} or more rows in a row each start with a skill or plugin name; that table or list grows with every skill, so derive it`
|
|
17983
|
+
})), Option.toArray)));
|
|
17984
|
+
};
|
|
17985
|
+
const repeatedFlags = (lines) => pipe(lines, Array$1.flatMap((line, index) => {
|
|
17986
|
+
const pairs = pipe(Array$1.fromIterable(String$1.matchAll(FLAG_WITH_VALUE)(line)), Array$1.flatMap((found) => pipe(Option.all([groupOf("flag")(found), groupOf("value")(found)]), Option.toArray)));
|
|
17987
|
+
const byFlag = Array$1.groupBy(pairs, ([flag]) => flag);
|
|
17988
|
+
return pipe(Record.toEntries(byFlag), Array$1.map(([flag, found]) => [flag, Array$1.dedupe(pipe(found, Array$1.map(([, value]) => value)))]), Array$1.filter(([, values]) => values.length > MOST_VALUES_FOR_A_FLAG), Array$1.map(([flag, values]) => ({
|
|
17989
|
+
line: lineNumberOf(index),
|
|
17990
|
+
reason: `${flag} is given ${String(values.length)} different values by hand (${Array$1.join(values, ", ")}); take the values from where they are defined`
|
|
17991
|
+
})));
|
|
17992
|
+
}));
|
|
17993
|
+
const namesInArrays = (text, entities) => pipe(Array$1.fromIterable(String$1.matchAll(ARRAY)(text)), Array$1.flatMap((array) => {
|
|
17994
|
+
const elements = pipe(groupOf("elements")(array), Option.map(String$1.split(ELEMENT_SEPARATOR)), Option.getOrElse(() => []));
|
|
17995
|
+
const named = pipe(elements, Array$1.filter((element) => pipe(entities, Array$1.some((entity) => new RegExp(`["'\`]${entity}["'\`]`, "u").test(element)))));
|
|
17996
|
+
return pipe(Option.liftPredicate(named, (found) => found.length > MOST_NAMES_IN_A_LINE), Option.map((found) => ({
|
|
17997
|
+
line: lineNumberOf(String$1.split("\n")(String$1.slice(NONE, array.index)(text)).length - FIRST$1),
|
|
17998
|
+
reason: `an array lists ${String(found.length)} skills or plugins by name; read the directories instead`
|
|
17999
|
+
})), Option.toArray);
|
|
18000
|
+
}));
|
|
18001
|
+
const proseOf = (lines) => {
|
|
18002
|
+
const fenced = insideFence(lines);
|
|
18003
|
+
const generated = insideGenerated(lines);
|
|
18004
|
+
return pipe(lines, Array$1.map((line, index) => {
|
|
18005
|
+
const skipped = (fenced[index] ?? false) || (generated[index] ?? false);
|
|
18006
|
+
return pipe(Option.liftPredicate(line, () => !skipped), Option.getOrElse(() => ""));
|
|
18007
|
+
}));
|
|
18008
|
+
};
|
|
18009
|
+
/** @internal */
|
|
18010
|
+
const enumerationSignals = (entities) => (file, text) => {
|
|
18011
|
+
const lines = String$1.split("\n")(text);
|
|
18012
|
+
const prose = proseOf(lines);
|
|
18013
|
+
return pipe(Option.liftPredicate(file, String$1.endsWith(MARKDOWN$2)), Option.match({
|
|
18014
|
+
onNone: () => [...namesInArrays(text, entities), ...repeatedFlags(lines)],
|
|
18015
|
+
onSome: () => [
|
|
18016
|
+
...namesPerLine(prose, entities),
|
|
18017
|
+
...rowRuns(prose, entities),
|
|
18018
|
+
...repeatedFlags(lines)
|
|
18019
|
+
]
|
|
18020
|
+
}));
|
|
18021
|
+
};
|
|
18022
|
+
// src/features/check-skill-enumerations/model/skill-enumerations.ts
|
|
18023
|
+
const RULE$3 = "skill-enumeration";
|
|
18024
|
+
const FIRST = 1;
|
|
18025
|
+
const CONCURRENCY$2 = 16;
|
|
18026
|
+
const DOCUMENT_FILE = /\.(?:md|ts|tsx)$/u;
|
|
18027
|
+
const position = problemAtPosition(RULE$3);
|
|
18028
|
+
const problemsIn$2 = Effect.fn("problemsIn")(function* problemsIn(root, name, entities) {
|
|
18029
|
+
const files = yield* RepositoryFiles;
|
|
18030
|
+
const file = files.join(root, name);
|
|
18031
|
+
const text = yield* files.readFile(file);
|
|
18032
|
+
return pipe(text, Option.map((source) => enumerationSignals(entities)(name, source)), Option.getOrElse(() => []), Array$1.map(({ line, reason }) => position(file, {
|
|
18033
|
+
line,
|
|
18034
|
+
column: FIRST
|
|
18035
|
+
}, reason)));
|
|
18036
|
+
});
|
|
18037
|
+
/** @internal */
|
|
18038
|
+
const checkSkillEnumerations = Effect.fn("checkSkillEnumerations")(function* checkSkillEnumerations(root) {
|
|
18039
|
+
const files = yield* RepositoryFiles;
|
|
18040
|
+
const plugins = yield* pluginsIn$1(root);
|
|
18041
|
+
const entities = Array$1.dedupe(pipe(plugins, Array$1.flatMap(({ name, skills }) => [name, ...pipe(skills, Array$1.map((skill) => skill.name))])));
|
|
18042
|
+
if (!Array$1.isReadonlyArrayNonEmpty(entities)) return [];
|
|
18043
|
+
const listed = yield* files.listedFiles(root);
|
|
18044
|
+
const documents = pipe(listed, Array$1.filter((name) => DOCUMENT_FILE.test(name)));
|
|
18045
|
+
const found = yield* Effect.forEach(documents, (name) => problemsIn$2(root, name, entities), { concurrency: CONCURRENCY$2 });
|
|
18046
|
+
return Array$1.flatten(found);
|
|
18047
|
+
});
|
|
18048
|
+
// src/features/check-skill-references/model/skill-references.ts
|
|
18049
|
+
const RULE$2 = "skill-reference";
|
|
18050
|
+
const HUB = "masseater-style";
|
|
18051
|
+
const OWNER_PREFIX = "do-";
|
|
18052
|
+
const MARKDOWN$1 = ".md";
|
|
18053
|
+
const CONCURRENCY$1 = 16;
|
|
18054
|
+
const MOST_OWNER_LINES = 4;
|
|
18055
|
+
const NAMED_IN_BACKTICKS = /`(?<name>[a-z0-9]+(?:-[a-z0-9]+)*)`(?!\]\()/gu;
|
|
18056
|
+
const CALLED_SKILL = /`(?<name>[a-z0-9-]+:[a-z0-9-]+)`/gu;
|
|
18057
|
+
const LIST_ITEM = /^\s*(?:[-*]|\d+\.)\s/u;
|
|
18058
|
+
const TOOL_NAME = /ツール|\bgh\b|\bgit\b|\bcurl\b|\bclaude\b|\bvp\b|\bbun\b/u;
|
|
18059
|
+
const QUALIFIER = ":";
|
|
18060
|
+
const problem$1 = problemInFile(RULE$2);
|
|
18061
|
+
const groupsOf = (pattern, text) => pipe(Array$1.fromIterable(String$1.matchAll(pattern)(text)), Array$1.flatMap((found) => Option.toArray(groupOf("name")(found))));
|
|
18062
|
+
const isOwnerEntry = ({ name }) => String$1.startsWith(OWNER_PREFIX)(name);
|
|
18063
|
+
const isOwnerOnly = ({ frontmatter }) => frontmatter.fields["disable-model-invocation"] === true;
|
|
18064
|
+
const prefixMessage = (skill) => pipe(Option.liftPredicate(`starts with ${OWNER_PREFIX} but the model can still invoke it. Add disable-model-invocation: true.`, () => isOwnerEntry(skill) && !isOwnerOnly(skill)), Option.orElse(() => Option.liftPredicate(`is owner-only but its name does not start with ${OWNER_PREFIX}. Rename it.`, () => isOwnerOnly(skill) && !isOwnerEntry(skill))));
|
|
18065
|
+
const bodyLines = (skill) => pipe(String$1.split("\n")(skill.frontmatter.body), Array$1.filter((line) => String$1.isNonEmpty(String$1.trim(line)) && !String$1.startsWith("# ")(line)));
|
|
18066
|
+
const procedureMessage = (skill) => {
|
|
18067
|
+
const lines = bodyLines(skill);
|
|
18068
|
+
return Option.liftPredicate(`is a procedure, but an owner entry is a request the owner would type: at most ${MOST_OWNER_LINES} lines and no list.`, () => lines.length > MOST_OWNER_LINES || pipe(lines, Array$1.some((line) => LIST_ITEM.test(line))));
|
|
18069
|
+
};
|
|
18070
|
+
const toolMessage = (skill) => Option.liftPredicate("names a tool or command, but the means belong to the skill it calls.", () => TOOL_NAME.test(skill.source));
|
|
18071
|
+
const isOwnerTarget = (name) => pipe(String$1.split(QUALIFIER)(name), Array$1.last, Option.exists(String$1.startsWith(OWNER_PREFIX)));
|
|
18072
|
+
const calledMessage = (skill, qualified) => {
|
|
18073
|
+
const called = groupsOf(CALLED_SKILL, skill.source);
|
|
18074
|
+
const broken = pipe(called, Array$1.filter((name) => !qualified.has(name) || isOwnerTarget(name)));
|
|
18075
|
+
return Option.liftPredicate(`must name the skills it calls as plugin:skill, and each must exist and not be an owner entry (${Array$1.join(broken, ", ")}).`, () => !Array$1.isReadonlyArrayNonEmpty(called) || Array$1.isReadonlyArrayNonEmpty(broken));
|
|
18076
|
+
};
|
|
18077
|
+
const ownerOnlyMessages = (skill, qualified) => pipe(Option.liftPredicate(skill, isOwnerEntry), Option.toArray, Array$1.flatMap((owner) => [
|
|
18078
|
+
procedureMessage(owner),
|
|
18079
|
+
toolMessage(owner),
|
|
18080
|
+
calledMessage(owner, qualified)
|
|
18081
|
+
]));
|
|
18082
|
+
const ownerProblems = (skill, qualified) => pipe([prefixMessage(skill), ...ownerOnlyMessages(skill, qualified)], Array$1.getSomes, Array$1.map((message) => problem$1(skill.file, message)));
|
|
18083
|
+
const hubProblems = (hub, names) => pipe(groupsOf(NAMED_IN_BACKTICKS, hub.source), Array$1.filter((name) => !names.has(name)), Array$1.map((name) => problem$1(hub.file, `names ${name}, which is not a skill.`)));
|
|
18084
|
+
const documentProblems = Effect.fn("documentProblems")(function* documentProblems(file, skill, others) {
|
|
18085
|
+
const text = yield* (yield* RepositoryFiles).readFile(file);
|
|
18086
|
+
const body = String$1.replace(FRONTMATTER, "")(Option.getOrElse(text, () => ""));
|
|
18087
|
+
return pipe(others, Array$1.filter((other) => other.name !== skill.name && namesSkill(other.name)(body)), Array$1.map((other) => problem$1(file, `names ${other.name}. Only ${HUB} names other skills; point to it from the hub instead.`)));
|
|
18088
|
+
});
|
|
18089
|
+
const spokeProblems = Effect.fn("spokeProblems")(function* spokeProblems(skill, others) {
|
|
18090
|
+
const documents = pipe(skill.files, Array$1.filter(String$1.endsWith(MARKDOWN$1)));
|
|
18091
|
+
const found = yield* Effect.forEach(documents, (file) => documentProblems(file, skill, others), { concurrency: CONCURRENCY$1 });
|
|
18092
|
+
return Array$1.flatten(found);
|
|
18093
|
+
});
|
|
18094
|
+
const referencesFrom = Effect.fn("referencesFrom")(function* referencesFrom(hub, skills) {
|
|
18095
|
+
const others = pipe(skills, Array$1.filter((skill) => skill.name !== HUB && !isOwnerEntry(skill)));
|
|
18096
|
+
const spokes = yield* Effect.forEach(others, (skill) => spokeProblems(skill, others), { concurrency: CONCURRENCY$1 });
|
|
18097
|
+
const names = new Set(pipe(skills, Array$1.map(({ name }) => name)));
|
|
18098
|
+
return [...hubProblems(hub, names), ...Array$1.flatten(spokes)];
|
|
18099
|
+
});
|
|
18100
|
+
/** @internal */
|
|
18101
|
+
const checkSkillReferences = Effect.fn("checkSkillReferences")(function* checkSkillReferences(root) {
|
|
18102
|
+
const plugins = yield* pluginsIn$1(root);
|
|
18103
|
+
const skills = pipe(plugins, Array$1.flatMap(({ skills: own }) => own));
|
|
18104
|
+
const qualified = new Set(pipe(skills, Array$1.map(({ plugin, name }) => `${plugin}${QUALIFIER}${name}`)));
|
|
18105
|
+
const owners = pipe(skills, Array$1.flatMap((skill) => ownerProblems(skill, qualified)));
|
|
18106
|
+
const hub = Array$1.findFirst(skills, ({ name }) => name === HUB);
|
|
18107
|
+
const hubbed = yield* Option.match(hub, {
|
|
18108
|
+
onNone: () => Effect.succeed([]),
|
|
18109
|
+
onSome: (found) => referencesFrom(found, skills)
|
|
18110
|
+
});
|
|
18111
|
+
return [...owners, ...hubbed];
|
|
18112
|
+
});
|
|
18113
|
+
// src/features/check-skill-structure/model/skill-structure.ts
|
|
18114
|
+
const RULE$1 = "skill-maintainer-context";
|
|
18115
|
+
const CONCURRENCY = 16;
|
|
18116
|
+
const MARKDOWN = ".md";
|
|
18117
|
+
const PROJECT_FILE = /(?:^|\/)(?:package\.json|tsconfig[^/]*\.json|vite\.config\.[cm]?[jt]s|vitest\.config\.[cm]?[jt]s)$|\.[jt]sx$/u;
|
|
18118
|
+
const SCRIPT_FILE = /\.[cm]?[jt]s$/u;
|
|
18119
|
+
const TEST_FILE = /\.(?:test|spec)\.[cm]?[jt]sx?$/u;
|
|
18120
|
+
const BINARY_FILE = /\.(?:png|jpe?g|gif|webp|pdf|woff2?)$/u;
|
|
18121
|
+
const WRITE_CALL = /\b(?:writeFileSync|cpSync|renameSync|appendFileSync|copyFileSync)\(/u;
|
|
18122
|
+
const MAINTAINER_HEADING = /^#{1,6}\s.*(?:メンテナンス|保守|更新手順|再生成|撮り直|maintenance|maintainer|regenerat)/imu;
|
|
18123
|
+
const REASON = "A distributed skill holds only what the model needs while using it. Move this to maintenance/ (maintenance/<skill>.md, maintenance/bin/, maintenance/<skill>/) so loading the skill does not carry maintainer context.";
|
|
18124
|
+
const problem = problemInFile(RULE$1);
|
|
18125
|
+
const signalsOf = (file, text) => [
|
|
18126
|
+
...pipe(Option.liftPredicate("a build project file (package.json, tsconfig, vite config or a .tsx source)", () => PROJECT_FILE.test(file)), Option.toArray),
|
|
18127
|
+
...pipe(Option.liftPredicate("a script that writes files next to itself, which regenerates the skill's own files", () => SCRIPT_FILE.test(file) && !TEST_FILE.test(file) && String$1.includes("import.meta.dirname")(text) && WRITE_CALL.test(text)), Option.toArray),
|
|
18128
|
+
...pipe(Option.liftPredicate("a heading about maintaining, regenerating or updating the skill", () => String$1.endsWith(MARKDOWN)(file) && MAINTAINER_HEADING.test(text)), Option.toArray)
|
|
18129
|
+
];
|
|
18130
|
+
const problemsIn$1 = Effect.fn("problemsIn")(function* problemsIn(file) {
|
|
18131
|
+
const files = yield* RepositoryFiles;
|
|
18132
|
+
const text = yield* files.readFile(file);
|
|
18133
|
+
const source = pipe(text, Option.filter(() => !BINARY_FILE.test(file)));
|
|
18134
|
+
return pipe(signalsOf(files.basename(file), Option.getOrElse(source, () => "")), Array$1.map((signal) => problem(file, `is ${signal}. ${REASON}`)));
|
|
18135
|
+
});
|
|
18136
|
+
/** @internal */
|
|
18137
|
+
const checkSkillStructure = Effect.fn("checkSkillStructure")(function* checkSkillStructure(root) {
|
|
18138
|
+
const plugins = yield* pluginsIn$1(root);
|
|
18139
|
+
const inside = pipe(plugins, Array$1.flatMap(({ skills }) => skills), Array$1.flatMap(({ files }) => files));
|
|
18140
|
+
const found = yield* Effect.forEach(inside, problemsIn$1, { concurrency: CONCURRENCY });
|
|
18141
|
+
return Array$1.flatten(found);
|
|
18142
|
+
});
|
|
18143
|
+
// src/app/plugin-checks.ts
|
|
18144
|
+
/** @internal */
|
|
18145
|
+
const checkPlugins = Effect.fn("checkPlugins")(function* checkPlugins(root) {
|
|
18146
|
+
const found = yield* Effect.all([
|
|
18147
|
+
checkPluginMarketplace(root),
|
|
18148
|
+
checkPluginLayout(root),
|
|
18149
|
+
checkReadmeSkills(root),
|
|
18150
|
+
checkSkillStructure(root),
|
|
18151
|
+
checkSkillReferences(root),
|
|
18152
|
+
checkSkillEnumerations(root)
|
|
18153
|
+
], { concurrency: "unbounded" });
|
|
18154
|
+
return Array$1.flatten(found);
|
|
18155
|
+
});
|
|
17695
18156
|
// src/features/check-upstream-exits/model/scattered-deviations.ts
|
|
17696
18157
|
const RULE = "upstream-deviation-place";
|
|
17697
18158
|
const NESTED_WORKSPACE = "/pnpm-workspace.yaml";
|
|
@@ -17758,7 +18219,7 @@ const checkManifests = Effect.fn("checkManifests")(function* checkManifests(root
|
|
|
17758
18219
|
checkUpstream(root),
|
|
17759
18220
|
checkEffectDiagnostics(root),
|
|
17760
18221
|
checkWorkspaceDescriptions(root),
|
|
17761
|
-
|
|
18222
|
+
checkPlugins(root)
|
|
17762
18223
|
], { concurrency: "unbounded" });
|
|
17763
18224
|
return Array$1.flatten(found);
|
|
17764
18225
|
});
|