@r_masseater/msch 0.64.0 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -3,12 +3,13 @@ import { B as stringsIn, C as VERIFY_TASK, F as childrenOf$1, I as keyName, L as
3
3
  import { a as publishedProjects, c as workspaceManifest, o as workspaceDirectories, r as readManifest, s as workspaceProjects, t as MANIFEST_FILE$3 } from "./dependencies-B6p7x90y.mjs";
4
4
  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-CFIrQmB5.mjs";
5
5
  import { a as groupOf$2, n as RepositoryFiles, t as NODE_MODULES } from "./repository-files-B5sRbxlz.mjs";
6
- import { a as workspaceDeviations, c as tomlSourceComments, 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-DitN-yYH.mjs";
6
+ import { o as positionOf } from "./lookup-DmifnzVb.mjs";
7
7
  import { a as join, n as baseName, o as parent, r as isInside, t as matcher } from "./app-BwjhFdKD.mjs";
8
8
  import { a as problemAtPosition, i as problemAt$8, o as problemInFile, r as formatProblem, s as sortProblems, t as ProblemList } from "./problem-D2HKNIVq.mjs";
9
9
  import { t as JAPANESE } from "./config-CvPuqi4L.mjs";
10
- import { t as startedOnce } from "./started-once-muJbvD_I.mjs";
10
+ import { o as loadLanguage, s as readTree, t as checkReferenceLinks } from "./reference-links-B9NZUUF8.mjs";
11
11
  import { $ as isPropertyAccessExpression, A as getNameOfDeclaration, B as isExportDeclaration, D as SyntaxKind, E as SymbolFlags, F as isBlock, G as isImportDeclaration, H as isFunctionDeclaration, I as isCallExpression, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isClassDeclaration, M as isArrayLiteralExpression, N as isArrowFunction, O as getJSDocTags, P as isBinaryExpression, Q as isParenthesizedExpression, R as isElementAccessExpression, T as SignatureKind, U as isFunctionExpression, V as isExpressionStatement, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as referencedSymbols, a as declarationsOf, at as isSpreadElement, b as symbolAtLocation, c as importedModulesOf, ct as isTypeLiteralNode, d as isInsideAny, dt as isVariableDeclaration, et as isPropertyAssignment, f as isOutsideDeclaration, ft as isVariableDeclarationList, g as propertyNamesOf, h as packageOf$1, i as contains, it as isSourceFile, j as getTextOfJSDocComment, l as isExternalDeclaration, lt as isTypeReferenceNode, m as lineOf$3, n as childrenOf$2, nt as isSatisfiesExpression, o as declaresAType, ot as isStringLiteral, p as isTypeDeclaration, pt as isVariableStatement, q as isModuleBlock, r as columnOf, rt as isSignatureDeclaration, s as descendantsOf, st as isTypeAliasDeclaration, t as carriesTag, tt as isReturnStatement, u as isGenericDeclaration, ut as isUnionTypeNode, x as uniqueByReference, y as symbolAt, z as isEnumDeclaration } from "./syntax-C0ddqOHc.mjs";
12
+ import { a as workspaceDeviations, c as tomlSourceComments, i as cargoDeviations, l as yamlSourceComments, o as collectNodes, r as WORKSPACE_SECTIONS, s as isRecord, t as checkUpstreamExits } from "./upstream-exits-Dp0EeI5D.mjs";
12
13
  import { n as ProblemsFound, r as writeStdout, t as runCli } from "./runtime-A2p57njU.mjs";
13
14
  import "./cli-contract-D7btWrEu.mjs";
14
15
  import { builtinModules } from "node:module";
@@ -19,7 +20,6 @@ import { ChildProcess } from "effect/process";
19
20
  import { parse, resolveConfigFromFile } from "vite-plus";
20
21
  import { parse as parse$1 } from "@pnpm/deps.path";
21
22
  import { fileURLToPath } from "node:url";
22
- import treeSitter from "@vscode/tree-sitter-wasm";
23
23
  import { isMap, isPair, isScalar, isSeq, parse as parse$2, parseDocument, visit } from "yaml";
24
24
  import { rolldown } from "vite/rolldown";
25
25
  import { stripVTControlCharacters } from "node:util";
@@ -371,8 +371,8 @@ const RESOLUTION_FILES = [
371
371
  ];
372
372
  const RESOLUTION_CONCURRENCY = 2;
373
373
  const SUCCEEDED$1 = 0;
374
- const taggedError$8 = Schema.TaggedError;
375
- var OverrideResolutionFailed = class extends taggedError$8()("OverrideResolutionFailed", {
374
+ const taggedError$7 = Schema.TaggedError;
375
+ var OverrideResolutionFailed = class extends taggedError$7()("OverrideResolutionFailed", {
376
376
  override: Schema.String,
377
377
  output: Schema.String
378
378
  }) {};
@@ -1057,8 +1057,8 @@ const README = /^README(?:\.[^/]+)?$/iu;
1057
1057
  const MANIFEST$5 = "package.json";
1058
1058
  const MISSING_RULE = "workspace-agents-md";
1059
1059
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
1060
- const taggedError$7 = Schema.TaggedError;
1061
- var RootConfigUnreadable = class extends taggedError$7()("RootConfigUnreadable", { file: Schema.String }) {};
1060
+ const taggedError$6 = Schema.TaggedError;
1061
+ var RootConfigUnreadable = class extends taggedError$6()("RootConfigUnreadable", { file: Schema.String }) {};
1062
1062
  const isNested = (name) => String$1.includes(SEPARATOR$17)(name);
1063
1063
  const problemFor$7 = problemInFile(RULE$53);
1064
1064
  const AGENT_DOCS_MESSAGE = "belongs only at the repository root. Move what agents need into the root AGENTS.md and delete this file.";
@@ -1378,40 +1378,6 @@ const checkPublicEntries = Effect.fn("checkPublicEntries")(function* checkPublic
1378
1378
  const entries = yield* Effect.forEach(workspaces, (workspace) => entryProblems$2(root, workspace), { concurrency: 1 });
1379
1379
  return Array.flatten(entries);
1380
1380
  });
1381
- // src/shared/lib/tree-sitter.ts
1382
- const taggedError$6 = Schema.TaggedError;
1383
- var GrammarUnreadable = class extends taggedError$6()("GrammarUnreadable", {
1384
- grammar: Schema.String,
1385
- message: Schema.String
1386
- }) {};
1387
- const PARSER_KEY = "parser";
1388
- const initParser = startedOnce();
1389
- const loadOnce = startedOnce();
1390
- const grammarFile = (grammar) => fileURLToPath(import.meta.resolve(`@vscode/tree-sitter-wasm/wasm/tree-sitter-${grammar}.wasm`));
1391
- const loadLanguage = (grammar) => {
1392
- const unreadable = (cause) => GrammarUnreadable.make({
1393
- grammar,
1394
- message: String(cause)
1395
- });
1396
- return Effect.tryPromise({
1397
- try: () => initParser(PARSER_KEY, () => treeSitter.Parser.init()),
1398
- catch: unreadable
1399
- }).pipe(Effect.andThen(Effect.tryPromise({
1400
- try: () => loadOnce(grammar, () => treeSitter.Language.load(grammarFile(grammar))),
1401
- catch: unreadable
1402
- })));
1403
- };
1404
- const readTree = ({ language, source, read }) => {
1405
- const parser = new treeSitter.Parser();
1406
- parser.setLanguage(language);
1407
- const tree = parser.parse(source);
1408
- parser.delete();
1409
- return Option.map(Option.fromNullishOr(tree), (parsed) => {
1410
- const result = read(parsed.rootNode);
1411
- parsed.delete();
1412
- return result;
1413
- });
1414
- };
1415
1381
  // src/features/check-placement/model/rust-layout.ts
1416
1382
  const LAYERS = [
1417
1383
  "app",
@@ -13594,10 +13560,12 @@ const checkToolUse = Effect.fn("checkToolUse")(function* checkToolUse(root) {
13594
13560
  });
13595
13561
  // src/shared/lib/comment-directives.ts
13596
13562
  const COMMENT_DIRECTIVES = [
13563
+ "oxlint-disable",
13597
13564
  "textlint-disable",
13598
13565
  "textlint-enable",
13599
13566
  String.raw`\* @internal \*?$`,
13600
13567
  String.raw`\* @msch \S+ \*?$`,
13568
+ String.raw`\* @stability (?:experimental|unstable) \*?$`,
13601
13569
  String.raw`shellcheck \w`,
13602
13570
  String.raw`zizmor: ignore\[`,
13603
13571
  String.raw`exit: \S`,
@@ -14114,238 +14082,6 @@ const checkCatalogEntries = Effect.fn("checkCatalogEntries")(function* checkCata
14114
14082
  });
14115
14083
  return [...catalogs, ...uncataloged];
14116
14084
  });
14117
- // src/features/check-skills/model/skill-entry.ts
14118
- const ENTRY_RULE = "unlocked-skill";
14119
- const VISIBLE_RULE = "skill-source-visible";
14120
- const CONFIG_FILE$1 = "vite.config.ts";
14121
- const RENOVATE_FILE$1 = "renovate.json";
14122
- const SOURCE = "masseater/skills";
14123
- const PRESET$1 = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
14124
- const START$10 = 0;
14125
- const LOCAL_PREFIX = "./";
14126
- const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
14127
- const Source = Schema.Struct({
14128
- commit: Schema.optional(Schema.String),
14129
- skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
14130
- });
14131
- const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
14132
- const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
14133
- const taggedError$1 = Schema.TaggedError;
14134
- var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
14135
- const problemAt$4 = (rule, file, text) => (anchor, message) => ({
14136
- file,
14137
- ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$10))),
14138
- rule,
14139
- message
14140
- });
14141
- const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
14142
- const files = yield* RepositoryFiles;
14143
- const file = files.join(root, CONFIG_FILE$1);
14144
- const text = yield* files.readFile(file);
14145
- if (Option.isNone(text)) return Option.none();
14146
- const config = yield* Effect.tryPromise({
14147
- try: () => resolveConfigFromFile(file),
14148
- catch: () => SkillsConfigUnreadable.make({ file })
14149
- }).pipe(Effect.option);
14150
- return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
14151
- file,
14152
- text: text.value,
14153
- sources: skills
14154
- })));
14155
- });
14156
- const entryProblems = ({ file, text, sources }) => {
14157
- const at = problemAt$4(ENTRY_RULE, file, text);
14158
- return pipe(Record.get(sources, SOURCE), Option.match({
14159
- onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
14160
- onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
14161
- }));
14162
- };
14163
- const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
14164
- const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$4(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
14165
- const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
14166
- const files = yield* RepositoryFiles;
14167
- const file = files.join(root, RENOVATE_FILE$1);
14168
- const text = yield* files.readFile(file);
14169
- if (pipe(text, Option.exists(String$1.includes(`"${PRESET$1}"`)))) return [];
14170
- return [problemAt$4(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET$1}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
14171
- });
14172
- /** @internal */
14173
- const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
14174
- const declared = yield* declaredSkills(root);
14175
- if (Option.isNone(declared)) return [];
14176
- const preset = yield* presetProblems(root);
14177
- return [
14178
- ...entryProblems(declared.value),
14179
- ...visibleProblems(declared.value),
14180
- ...preset
14181
- ];
14182
- });
14183
- // src/features/check-skills/model/published-skills.ts
14184
- const RULE$14 = "published-skills";
14185
- const KEYWORD = "tanstack-intent";
14186
- const SKILLS = "skills";
14187
- const MANIFEST_FILE = "package.json";
14188
- const SKILL_FILE$1 = "SKILL.md";
14189
- const SUCCEEDED = 0;
14190
- const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
14191
- const problemAt$3 = problemInFile(RULE$14);
14192
- const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
14193
- const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
14194
- const packagingMessages = ({ keywords, files }, skills) => {
14195
- const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
14196
- const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
14197
- return Array.getSomes([keyword, unshipped]);
14198
- };
14199
- const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
14200
- const handle = yield* ChildProcess.make("node", [
14201
- INTENT_CLI,
14202
- "validate",
14203
- SKILLS
14204
- ], {
14205
- cwd: directory,
14206
- extendEnv: true,
14207
- stdin: "ignore"
14208
- });
14209
- const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
14210
- return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
14211
- }, Effect.scoped);
14212
- const problemsIn$8 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14213
- const files = yield* RepositoryFiles;
14214
- const directory = files.join(root, project.directory);
14215
- const manifest = files.join(directory, MANIFEST_FILE);
14216
- const skills = skillDirectoriesIn(files, directory);
14217
- if (!Array.isReadonlyArrayNonEmpty(skills)) return [problemAt$3(manifest, `is published without agent skills. Write the tasks an agent needs for this package as ${SKILLS}/<task>/${SKILL_FILE$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
14218
- const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
14219
- return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$3(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$3(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
14220
- });
14221
- /** @internal */
14222
- const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
14223
- const projects = yield* publishedProjects(root);
14224
- const problems = yield* Effect.forEach(projects, (project) => problemsIn$8(root, project), { concurrency: 1 });
14225
- return Array.flatten(problems);
14226
- });
14227
- // src/features/check-skills/model/skill-files.ts
14228
- const RULE$13 = "skill-file";
14229
- const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
14230
- const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
14231
- const FIXTURE = /(?:^|\/)fixtures\//u;
14232
- const MARKDOWN = ".md";
14233
- const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
14234
- const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
14235
- const HEADING = /^# (?<title>.+)$/mu;
14236
- const NAME_KEY$1 = /^name:/mu;
14237
- const LICENSE_KEY = /^license:/mu;
14238
- const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
14239
- const LINK = /\]\((?<target>[^)\s]+)\)/gu;
14240
- const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
14241
- const FRAGMENT = /#.*$/u;
14242
- const GITHUB = "https://github.com/";
14243
- const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
14244
- const BLANK = /\s+/u;
14245
- const SEPARATOR$2 = "/";
14246
- const START$9 = 0;
14247
- const FIRST$3 = 1;
14248
- const READ_CONCURRENCY$5 = 16;
14249
- const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
14250
- const Frontmatter = Schema.Struct({
14251
- name: Schema.optional(Schema.String),
14252
- license: Schema.optional(Schema.Unknown),
14253
- metadata: Schema.optional(Metadata)
14254
- });
14255
- const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
14256
- const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$9));
14257
- const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
14258
- const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$9].length), Option.getOrElse(() => START$9));
14259
- const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
14260
- const nameProblems = ({ source, directory }, name, folder) => {
14261
- const bodyStart = bodyStartOf(source);
14262
- const body = String$1.slice(bodyStart)(source);
14263
- const heading = groupOf$2("title")(HEADING.exec(body));
14264
- return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
14265
- index: offsetOf$1(source, NAME_KEY$1),
14266
- message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
14267
- })), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
14268
- index: bodyStart + offsetOf$1(body, HEADING),
14269
- message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
14270
- })), Option.toArray)];
14271
- };
14272
- const derivedProblems = (source, derived) => pipe(String$1.split(String$1.trim(derived), BLANK), Array.filter((url) => String$1.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)), Array.map((url) => ({
14273
- index: offsetOf$1(source, url),
14274
- message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`
14275
- })));
14276
- const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
14277
- ...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
14278
- ...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
14279
- index: offsetOf$1(skill.source, LICENSE_KEY),
14280
- message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
14281
- })), Option.toArray),
14282
- ...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
14283
- ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
14284
- file: skill.file,
14285
- ...positionOf(skill.source)(index),
14286
- rule: RULE$13,
14287
- message
14288
- })));
14289
- const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
14290
- target,
14291
- index: found.index ?? START$9
14292
- })), Option.toArray);
14293
- const rangeOf$1 = (found) => {
14294
- const start = found.index ?? START$9;
14295
- return [start, start + found[START$9].length];
14296
- };
14297
- const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
14298
- const linksIn = (source) => {
14299
- const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
14300
- return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
14301
- };
14302
- const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
14303
- const files = yield* RepositoryFiles;
14304
- const text = yield* files.readFile(file);
14305
- if (Option.isNone(text)) return [];
14306
- const source = text.value;
14307
- const directory = files.dirname(file);
14308
- const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
14309
- const missing = yield* Effect.filter(linksIn(source), isMissing);
14310
- return pipe(missing, Array.map(({ target, index }) => ({
14311
- file,
14312
- ...positionOf(source)(index),
14313
- rule: RULE$13,
14314
- message: `links to ${target}, which does not exist. Fix the path or remove the link.`
14315
- })));
14316
- });
14317
- const problemsIn$7 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
14318
- const files = yield* RepositoryFiles;
14319
- const file = files.join(root, name);
14320
- const directory = files.dirname(name);
14321
- const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR$2}`)));
14322
- const text = yield* files.readFile(file);
14323
- const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
14324
- const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$5 });
14325
- const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
14326
- file: files.join(root, entry),
14327
- line: FIRST$3,
14328
- column: FIRST$3,
14329
- rule: RULE$13,
14330
- message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
14331
- })));
14332
- return [
14333
- ...pipe(text, Option.map((source) => frontmatterProblems({
14334
- file,
14335
- directory,
14336
- source
14337
- }, files.basename(directory))), Option.getOrElse(() => [])),
14338
- ...licenses,
14339
- ...Array.flatten(links)
14340
- ];
14341
- });
14342
- /** @internal */
14343
- const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
14344
- const listed = yield* (yield* RepositoryFiles).listedFiles(root);
14345
- const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
14346
- const found = yield* Effect.forEach(skills, (name) => problemsIn$7(root, listed, name), { concurrency: READ_CONCURRENCY$5 });
14347
- return Array.flatten(found);
14348
- });
14349
14085
  // src/features/check-version-downgrades/model/version-entries.ts
14350
14086
  const MANIFEST_SECTIONS = [
14351
14087
  "dependencies",
@@ -14404,9 +14140,9 @@ const cargoEntries = (text) => {
14404
14140
  };
14405
14141
  const toolchainEntries = (text) => singleEntry("channel", fieldOf("channel")(parseToml(text)["toolchain"]));
14406
14142
  // src/features/check-version-downgrades/model/version-downgrade.ts
14407
- const RULE$12 = "version-downgrade";
14143
+ const RULE$14 = "version-downgrade";
14408
14144
  const DEFAULT_BASE = "origin/main";
14409
- const READ_CONCURRENCY$4 = 16;
14145
+ const READ_CONCURRENCY$5 = 16;
14410
14146
  const READERS = [
14411
14147
  [/(?:^|\/)package\.json$/u, manifestEntries],
14412
14148
  [/^pnpm-workspace\.yaml$/u, workspaceEntries],
@@ -14430,7 +14166,7 @@ const downgradesIn = ({ file, text, before, after }) => {
14430
14166
  file,
14431
14167
  line: lineOf(text, entry),
14432
14168
  column: FIRST_LINE$1,
14433
- rule: RULE$12,
14169
+ rule: RULE$14,
14434
14170
  message: message(old, entry)
14435
14171
  })), Option.toArray)));
14436
14172
  };
@@ -14456,24 +14192,24 @@ const checkDowngrades = Effect.fn("checkDowngrades")(function* checkDowngrades(r
14456
14192
  before: read(before),
14457
14193
  after: read(after)
14458
14194
  })), Option.getOrElse(() => []));
14459
- }), { concurrency: READ_CONCURRENCY$4 });
14195
+ }), { concurrency: READ_CONCURRENCY$5 });
14460
14196
  return Array.flatten(found);
14461
14197
  });
14462
14198
  // src/features/check-version-downgrades/model/renovate-settings.ts
14463
- const RENOVATE_FILE = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
14199
+ const RENOVATE_FILE$1 = /^(?:\.github\/|\.gitlab\/)?(?:renovate\.json5?|\.renovaterc(?:\.json5?)?)$/u;
14464
14200
  const AUTOMERGE_OFF = /["']?platformAutomerge["']?\s*:\s*false/gu;
14465
14201
  const VERSION_CAP = /["']?allowedVersions["']?\s*:\s*["'](?<range>[^"']*<[^"']*)["']/gu;
14466
14202
  const AUTOMERGE_RULE = "renovate-platform-automerge";
14467
14203
  const CAP_RULE = "renovate-version-cap";
14468
14204
  const PRESET_RULE = "renovate-msch-preset";
14469
- const PRESET = "github>masseater/ecosystems//libs/msch/renovate";
14470
- const START$8 = 0;
14471
- const READ_CONCURRENCY$3 = 16;
14205
+ const PRESET$1 = "github>masseater/ecosystems//libs/msch/renovate";
14206
+ const START$10 = 0;
14207
+ const READ_CONCURRENCY$4 = 16;
14472
14208
  const AUTOMERGE_MESSAGE = "sets `platformAutomerge: false`. Keep the platform's automerge on so passing updates merge without waiting for the next Renovate run.";
14473
14209
  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.";
14474
- const PRESET_MESSAGE = `does not extend \`${PRESET}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
14210
+ const PRESET_MESSAGE = `does not extend \`${PRESET$1}\`, so Renovate writes ranges that the \`version-range\` check rejects. Add it to \`extends\`.`;
14475
14211
  const offsetsOf = (pattern, source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => Option.toArray(Option.fromUndefinedOr(match.index))));
14476
- const problemsIn$6 = (file, source) => {
14212
+ const problemsIn$8 = (file, source) => {
14477
14213
  const at = positionOf(source);
14478
14214
  const found = (pattern, rule, message) => pipe(offsetsOf(pattern, source), Array.map((offset) => ({
14479
14215
  file,
@@ -14486,44 +14222,44 @@ const problemsIn$6 = (file, source) => {
14486
14222
  ...found(VERSION_CAP, CAP_RULE, CAP_MESSAGE),
14487
14223
  ...pipe([{
14488
14224
  file,
14489
- ...at(START$8),
14225
+ ...at(START$10),
14490
14226
  rule: PRESET_RULE,
14491
14227
  message: PRESET_MESSAGE
14492
- }], Array.filter(() => !String$1.includes(`"${PRESET}"`)(source)))
14228
+ }], Array.filter(() => !String$1.includes(`"${PRESET$1}"`)(source)))
14493
14229
  ];
14494
14230
  };
14495
14231
  /** @internal */
14496
14232
  const checkRenovateSettings = Effect.fn("checkRenovateSettings")(function* checkRenovateSettings(root) {
14497
14233
  const files = yield* RepositoryFiles;
14498
14234
  const listed = yield* files.listedFiles(root);
14499
- const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE.test(name))), (name) => {
14235
+ const found = yield* Effect.forEach(pipe(listed, Array.filter((name) => RENOVATE_FILE$1.test(name))), (name) => {
14500
14236
  const file = files.join(root, name);
14501
14237
  return files.readFile(file).pipe(Effect.map(Option.match({
14502
14238
  onNone: () => [],
14503
- onSome: (source) => problemsIn$6(file, source)
14239
+ onSome: (source) => problemsIn$8(file, source)
14504
14240
  })));
14505
- }, { concurrency: READ_CONCURRENCY$3 });
14241
+ }, { concurrency: READ_CONCURRENCY$4 });
14506
14242
  return Array.flatten(found);
14507
14243
  });
14508
14244
  // src/features/find-invisible-characters/model/hidden-unicode.ts
14509
14245
  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;
14510
14246
  const NUL = "\0";
14511
- const START$7 = 0;
14247
+ const START$9 = 0;
14512
14248
  const HEX = 16;
14513
14249
  const CODE_POINT_WIDTH = 4;
14514
- const READ_CONCURRENCY$2 = 64;
14515
- const RULE$11 = "hidden-unicode";
14516
- const hexOf = (character) => pipe(String$1.codePointAt(START$7)(character), Option.getOrElse(() => START$7), (code) => code.toString(HEX), String$1.toUpperCase, String$1.padStart(CODE_POINT_WIDTH, "0"));
14250
+ const READ_CONCURRENCY$3 = 64;
14251
+ const RULE$13 = "hidden-unicode";
14252
+ 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"));
14517
14253
  const problemOf = (file, source) => (found) => {
14518
- const hex = hexOf(found[START$7]);
14254
+ const hex = hexOf(found[START$9]);
14519
14255
  return {
14520
14256
  file,
14521
- ...positionOf(source)(found.index ?? START$7),
14522
- rule: RULE$11,
14257
+ ...positionOf(source)(found.index ?? START$9),
14258
+ rule: RULE$13,
14523
14259
  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}.`
14524
14260
  };
14525
14261
  };
14526
- const problemsIn$5 = (file, source) => {
14262
+ const problemsIn$7 = (file, source) => {
14527
14263
  if (String$1.includes(NUL)(source)) return [];
14528
14264
  return pipe(Array.fromIterable(String$1.matchAll(HIDDEN)(source)), Array.map(problemOf(file, source)));
14529
14265
  };
@@ -14535,18 +14271,18 @@ const checkHiddenUnicode = Effect.fn("checkHiddenUnicode")(function* checkHidden
14535
14271
  const file = files.join(root, name);
14536
14272
  return files.readFile(file).pipe(Effect.map(Option.match({
14537
14273
  onNone: () => [],
14538
- onSome: (source) => problemsIn$5(file, source)
14274
+ onSome: (source) => problemsIn$7(file, source)
14539
14275
  })));
14540
- }, { concurrency: READ_CONCURRENCY$2 });
14276
+ }, { concurrency: READ_CONCURRENCY$3 });
14541
14277
  return Array.flatten(found);
14542
14278
  });
14543
14279
  // src/features/find-unneeded-files/model/applied-packages.ts
14544
14280
  const MSCH = "@r_masseater/msch";
14545
14281
  const SCOPE$1 = "@r_masseater/";
14546
- const RULE$10 = "applied-package";
14282
+ const RULE$12 = "applied-package";
14547
14283
  const WORKSPACE_FILE$2 = "pnpm-workspace.yaml";
14548
14284
  const NOT_FOUND = -1;
14549
- const SEPARATOR$1 = "/";
14285
+ const SEPARATOR$2 = "/";
14550
14286
  const BY_LENGTH = Order.mapInput(Order.Number, (text) => text.length);
14551
14287
  const BinMap = Schema.Record(Schema.String, Schema.String);
14552
14288
  const BinField = Schema.Struct({ bin: Schema.optional(Schema.Union([Schema.String, BinMap])) });
@@ -14560,7 +14296,7 @@ const declaredNames = (manifest) => pipe([
14560
14296
  const binsIn = (name, text) => pipe(decodeBinField(text), Option.flatMap(({ bin }) => Option.fromUndefinedOr(bin)), Option.match({
14561
14297
  onNone: () => [],
14562
14298
  onSome: (bin) => {
14563
- if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$1), Array.lastNonEmpty)];
14299
+ if (Predicate.isString(bin)) return [pipe(name, String$1.split(SEPARATOR$2), Array.lastNonEmpty)];
14564
14300
  return Record.keys(bin);
14565
14301
  }
14566
14302
  }));
@@ -14585,16 +14321,16 @@ const appliedByMsch = Effect.fn("appliedByMsch")(function* appliedByMsch() {
14585
14321
  const names = pipe(manifest, Option.flatMap(({ dependencies }) => Option.fromUndefinedOr(dependencies)), Option.map(Record.keys), Option.getOrElse(() => []), Array.filter(String$1.startsWith(SCOPE$1)));
14586
14322
  return yield* Effect.forEach(names, installedPackage, { concurrency: 1 });
14587
14323
  });
14588
- const problemAt$2 = (file, source) => (index, name) => ({
14324
+ const problemAt$4 = (file, source) => (index, name) => ({
14589
14325
  file,
14590
14326
  ...positionOf(source)(index),
14591
- rule: RULE$10,
14327
+ rule: RULE$12,
14592
14328
  message: `msch applies ${name}. Remove this use and let msch apply it.`
14593
14329
  });
14594
14330
  const specifierPattern = ({ name }) => new RegExp(`["'\`]${escaped(name)}(?=["'\`/])`, "gu");
14595
14331
  const binPattern = (bin) => new RegExp(`(?<![\\w./@:-])${escaped(bin)}(?=[ \\t"'\`]|$)`, "gmu");
14596
- const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$2(file, source)(found.index ?? NOT_FOUND, entry.name)))));
14597
- const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$1}`)(name)), Array.match({
14332
+ const usesIn = (applied) => ({ file }, source) => pipe(applied, Array.flatMap((entry) => pipe([specifierPattern(entry), ...pipe(entry.bins, Array.map(binPattern))], Array.flatMap((pattern) => Array.fromIterable(String$1.matchAll(pattern)(source))), Array.map((found) => problemAt$4(file, source)(found.index ?? NOT_FOUND, entry.name)))));
14333
+ const ownerOf$1 = (directories) => (name) => pipe(directories, Array.filter((directory) => directory === "" || String$1.startsWith(`${directory}${SEPARATOR$2}`)(name)), Array.match({
14598
14334
  onEmpty: () => "",
14599
14335
  onNonEmpty: Array.max(BY_LENGTH)
14600
14336
  }));
@@ -14613,7 +14349,7 @@ const manifestUses = Effect.fn("manifestUses")(function* manifestUses(root, appl
14613
14349
  declared: manifest
14614
14350
  }), Option.match({
14615
14351
  onNone: () => [],
14616
- onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$2(file, source)(index, name)), Option.toArray)))
14352
+ onSome: ({ source, declared }) => pipe(declaredNames(declared), Array.filter((name) => Array.contains(appliedNames, name)), Array.flatMap((name) => pipe(String$1.indexOf(`"${name}"`)(source), Option.map((index) => problemAt$4(file, source)(index, name)), Option.toArray)))
14617
14353
  }));
14618
14354
  });
14619
14355
  const sourceUses = Effect.fn("sourceUses")(function* sourceUses({ root, applied, directories, consumers }) {
@@ -14643,8 +14379,8 @@ const checkAppliedPackages = Effect.fn("checkAppliedPackages")(function* checkAp
14643
14379
  return yield* appliedPackageProblems(root, applied);
14644
14380
  });
14645
14381
  // src/features/find-unneeded-files/model/replaced-tools.ts
14646
- const RULE$9 = "replaced-tool";
14647
- const FIRST$2 = 1;
14382
+ const RULE$11 = "replaced-tool";
14383
+ const FIRST$3 = 1;
14648
14384
  const TASKS = "Vite+ tasks in run.tasks of vite.config.ts, run with `vp run`";
14649
14385
  const HOOKS = "the hooks in .vite-hooks/ that `vp config` installs";
14650
14386
  const ALCHEMY = "the Alchemy stack in alchemy.run.ts";
@@ -14722,9 +14458,9 @@ const REPLACED = [
14722
14458
  ];
14723
14459
  const problemFor$1 = ({ name, file }) => pipe(REPLACED, Array.findFirst(({ pattern }) => pattern.test(name)), Option.map(({ tool, replacement }) => ({
14724
14460
  file,
14725
- line: FIRST$2,
14726
- column: FIRST$2,
14727
- rule: RULE$9,
14461
+ line: FIRST$3,
14462
+ column: FIRST$3,
14463
+ rule: RULE$11,
14728
14464
  message: `belongs to ${tool}, which this repository replaced with ${replacement}. Move what is still needed there and delete this file.`
14729
14465
  })));
14730
14466
  /** @internal */
@@ -14742,7 +14478,7 @@ const unneededLockfile = (present) => (entry) => FOREIGN_LOCKFILE.test(entry.nam
14742
14478
  // src/features/find-unneeded-files/model/unneeded-files.ts
14743
14479
  const WORKSPACE_FILE$1 = "pnpm-workspace.yaml";
14744
14480
  const PNPM_DIRECTORY = ".pnpm/";
14745
- const SEPARATOR = "/";
14481
+ const SEPARATOR$1 = "/";
14746
14482
  const CARGO_MANIFEST_FILE = /(?:^|\/)Cargo\.toml$/u;
14747
14483
  const CARGO_LOCK_FILE = /(?:^|\/)Cargo\.lock$/u;
14748
14484
  const PNPM_OUTPUT = /(?:^|\/)\.pnpm\//u;
@@ -14758,7 +14494,7 @@ const SETUP_PATTERNS = [
14758
14494
  ];
14759
14495
  const INSTALL_PATTERNS = [/(?<![\w./@-])cargo[ \t]+b?install\b/gu];
14760
14496
  const TOOL_PATTERNS = [/^[ \t]*["']?(?:rust|rustup)["']?[ \t]*(?:=|[ \t]+\S)/gmu];
14761
- const START$6 = 0;
14497
+ const START$8 = 0;
14762
14498
  const LAST_SEGMENT = 1;
14763
14499
  const FIRST_LINE = 1;
14764
14500
  const FIRST_COLUMN = 1;
@@ -14810,10 +14546,10 @@ const matches = (pattern) => ({ name }) => pattern.test(name);
14810
14546
  const isCargoManifest = matches(CARGO_MANIFEST_FILE);
14811
14547
  const isLegacyCargoConfig = matches(LEGACY_CARGO_CONFIG);
14812
14548
  const isPnpmOutput = matches(PNPM_OUTPUT);
14813
- const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR));
14549
+ const directoryOf = (name) => pipe(String$1.split(name, SEPARATOR$1), Array.dropRight(LAST_SEGMENT), Array.join(SEPARATOR$1));
14814
14550
  const ancestorsOf = (directory) => {
14815
- const parts = String$1.split(directory, SEPARATOR);
14816
- return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR)), Array.filter((ancestor) => ancestor !== directory));
14551
+ const parts = String$1.split(directory, SEPARATOR$1);
14552
+ return pipe(Array.makeBy(parts.length, (depth) => Array.join(Array.take(parts, depth), SEPARATOR$1)), Array.filter((ancestor) => ancestor !== directory));
14817
14553
  };
14818
14554
  const readsCargoLock = (manifests, workspaces) => ({ name }) => {
14819
14555
  const directory = directoryOf(name);
@@ -14827,7 +14563,7 @@ const cargoWorkspaces = Effect.fn("cargoWorkspaces")(function* cargoWorkspaces(m
14827
14563
  const roots = yield* pipe(manifests, Effect.filter(({ file }) => files.readFile(file).pipe(Effect.map(isWorkspaceManifest))));
14828
14564
  return directoriesOf(roots);
14829
14565
  });
14830
- const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$6), (end) => String$1.slice(START$6, end)(name));
14566
+ const pnpmDirectoryOf = ({ name }) => pipe(name, String$1.indexOf(PNPM_DIRECTORY), Option.getOrElse(() => START$8), (end) => String$1.slice(START$8, end)(name));
14831
14567
  const pnpmOutputs = (present) => pipe(present, Array.filter(isPnpmOutput), Array.dedupeWith((left, right) => pnpmDirectoryOf(left) === pnpmDirectoryOf(right)), Array.map(pnpmOutput));
14832
14568
  const byDepth = Order.mapInput(Order.Number, ({ name }) => String$1.split(name, "/").length);
14833
14569
  const cargoProblems = (present, enabled) => {
@@ -14862,6 +14598,249 @@ const checkUnneededFiles = Effect.fn("checkUnneededFiles")(function* checkUnneed
14862
14598
  if (Option.isNone(workspace)) return [];
14863
14599
  return yield* unneededIn(root, cargoEnabled(workspace.value));
14864
14600
  });
14601
+ // src/features/check-skills/model/skill-entry.ts
14602
+ const ENTRY_RULE = "unlocked-skill";
14603
+ const VISIBLE_RULE = "skill-source-visible";
14604
+ const CONFIG_FILE$1 = "vite.config.ts";
14605
+ const RENOVATE_FILE = "renovate.json";
14606
+ const SOURCE = "masseater/skills";
14607
+ const PRESET = "github>masseater/ecosystems//libs/vite-plus-adopt/renovate";
14608
+ const START$7 = 0;
14609
+ const LOCAL_PREFIX = "./";
14610
+ const REGEX_SPECIAL = /[.*+?^${}()|[\]\\/]/gu;
14611
+ const Source = Schema.Struct({
14612
+ commit: Schema.optional(Schema.String),
14613
+ skills: Schema.Union([Schema.Literal("all"), Schema.Array(Schema.String)])
14614
+ });
14615
+ const SkillsConfig = Schema.Struct({ skills: Schema.Record(Schema.String, Source) });
14616
+ const decodeSkills = Schema.decodeUnknownOption(SkillsConfig);
14617
+ const taggedError$1 = Schema.TaggedError;
14618
+ var SkillsConfigUnreadable = class extends taggedError$1()("SkillsConfigUnreadable", { file: Schema.String }) {};
14619
+ const problemAt$3 = (rule, file, text) => (anchor, message) => ({
14620
+ file,
14621
+ ...positionOf(text)(pipe(String$1.indexOf(anchor)(text), Option.getOrElse(() => START$7))),
14622
+ rule,
14623
+ message
14624
+ });
14625
+ const declaredSkills = Effect.fn("declaredSkills")(function* declaredSkills(root) {
14626
+ const files = yield* RepositoryFiles;
14627
+ const file = files.join(root, CONFIG_FILE$1);
14628
+ const text = yield* files.readFile(file);
14629
+ if (Option.isNone(text)) return Option.none();
14630
+ const config = yield* Effect.tryPromise({
14631
+ try: () => resolveConfigFromFile(file),
14632
+ catch: () => SkillsConfigUnreadable.make({ file })
14633
+ }).pipe(Effect.option);
14634
+ return pipe(config, Option.flatMap(decodeSkills), Option.map(({ skills }) => ({
14635
+ file,
14636
+ text: text.value,
14637
+ sources: skills
14638
+ })));
14639
+ });
14640
+ const entryProblems = ({ file, text, sources }) => {
14641
+ const at = problemAt$3(ENTRY_RULE, file, text);
14642
+ return pipe(Record.get(sources, SOURCE), Option.match({
14643
+ onNone: () => [at("skills", `does not install ${SOURCE}. Add "${SOURCE}": { commit, root: "plugins/masseater-skills/skills", skills: "all" } to skills.`)],
14644
+ onSome: (source) => pipe(Option.liftPredicate(source, ({ skills }) => skills !== "all"), Option.map(() => at(`"${SOURCE}"`, `picks skills from ${SOURCE} by name. Write skills: "all", so every repository gets each new skill with the next digest update.`)), Option.toArray)
14645
+ }));
14646
+ };
14647
+ const literalPattern = (repository, commit) => new RegExp(`"${String$1.replaceAll(REGEX_SPECIAL, String.raw`\$&`)(repository)}": \\{\\s*commit: "${commit}"`, "u");
14648
+ const visibleProblems = ({ file, text, sources }) => pipe(Record.toEntries(sources), Array.filter(([repository]) => !String$1.startsWith(LOCAL_PREFIX)(repository)), Array.filter(([repository, { commit }]) => !literalPattern(repository, commit ?? "").test(text)), Array.map(([repository]) => problemAt$3(VISIBLE_RULE, file, text)(repository, `declares ${repository} in a form the Renovate preset cannot read. Write "${repository}": { commit: "<sha>", ... } with commit first and as a string literal.`)));
14649
+ const presetProblems = Effect.fn("presetProblems")(function* presetProblems(root) {
14650
+ const files = yield* RepositoryFiles;
14651
+ const file = files.join(root, RENOVATE_FILE);
14652
+ const text = yield* files.readFile(file);
14653
+ if (pipe(text, Option.exists(String$1.includes(`"${PRESET}"`)))) return [];
14654
+ return [problemAt$3(VISIBLE_RULE, file, Option.getOrElse(text, () => ""))("extends", `does not extend ${PRESET}, so Renovate never updates the commits in the skills section of ${CONFIG_FILE$1}.`)];
14655
+ });
14656
+ /** @internal */
14657
+ const checkSkillEntry = Effect.fn("checkSkillEntry")(function* checkSkillEntry(root) {
14658
+ const declared = yield* declaredSkills(root);
14659
+ if (Option.isNone(declared)) return [];
14660
+ const preset = yield* presetProblems(root);
14661
+ return [
14662
+ ...entryProblems(declared.value),
14663
+ ...visibleProblems(declared.value),
14664
+ ...preset
14665
+ ];
14666
+ });
14667
+ // src/features/check-skills/model/published-skills.ts
14668
+ const RULE$10 = "published-skills";
14669
+ const KEYWORD = "tanstack-intent";
14670
+ const SKILLS = "skills";
14671
+ const MANIFEST_FILE = "package.json";
14672
+ const SKILL_FILE$1 = "SKILL.md";
14673
+ const SUCCEEDED = 0;
14674
+ const INTENT_CLI = fileURLToPath(new URL("./cli.mjs", import.meta.resolve("@tanstack/intent")));
14675
+ const problemAt$2 = problemInFile(RULE$10);
14676
+ const skillDirectoriesIn = (files, directory) => pipe(findSkillFiles(files.join(directory, SKILLS)), Array.filter((file) => files.basename(file) === SKILL_FILE$1), Array.map((file) => files.relative(directory, files.dirname(file))));
14677
+ const isShipped = (listed) => (skill) => Array.contains(listed, SKILLS) || Array.contains(listed, skill);
14678
+ const packagingMessages = ({ keywords, files }, skills) => {
14679
+ const keyword = pipe(Option.liftPredicate(keywords, (own) => !Array.contains(own, KEYWORD)), Option.map(() => `is published with skills but lacks the ${KEYWORD} keyword, so Intent does not find them. Add it to keywords.`));
14680
+ const unshipped = pipe(files, Option.map((listed) => pipe(skills, Array.filter((skill) => !isShipped(listed)(skill)))), Option.filter((left) => Array.isReadonlyArrayNonEmpty(left)), Option.map((left) => `leaves ${Array.join(left, ", ")} out of files, so the published package does not ship them. List them in files.`));
14681
+ return Array.getSomes([keyword, unshipped]);
14682
+ };
14683
+ const validationOf = Effect.fn("validationOf")(function* validationOf(directory) {
14684
+ const handle = yield* ChildProcess.make("node", [
14685
+ INTENT_CLI,
14686
+ "validate",
14687
+ SKILLS
14688
+ ], {
14689
+ cwd: directory,
14690
+ extendEnv: true,
14691
+ stdin: "ignore"
14692
+ });
14693
+ const [output, status] = yield* Effect.all([handle.all.pipe(Stream.decodeText(), Stream.mkString), handle.exitCode], { concurrency: "unbounded" });
14694
+ return Option.liftPredicate(String$1.trim(output), () => Number(status) !== SUCCEEDED);
14695
+ }, Effect.scoped);
14696
+ const problemsIn$6 = Effect.fn("problemsIn")(function* problemsIn(root, project) {
14697
+ const files = yield* RepositoryFiles;
14698
+ const directory = files.join(root, project.directory);
14699
+ const manifest = files.join(directory, MANIFEST_FILE);
14700
+ const skills = skillDirectoriesIn(files, directory);
14701
+ if (!Array.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$1}, so that repositories which approve them in the permissions of pnpm-workspace.yaml give their agents guidance for the installed version.`)];
14702
+ const validation = yield* validationOf(directory).pipe(Effect.orElseSucceed(() => Option.none()));
14703
+ return [...pipe(packagingMessages(project, skills), Array.map((message) => problemAt$2(manifest, message))), ...pipe(validation, Option.map((output) => problemAt$2(files.join(directory, SKILLS), `fails intent validate:\n${output}`)), Option.toArray)];
14704
+ });
14705
+ /** @internal */
14706
+ const checkPublishedSkills = Effect.fn("checkPublishedSkills")(function* checkPublishedSkills(root) {
14707
+ const projects = yield* publishedProjects(root);
14708
+ const problems = yield* Effect.forEach(projects, (project) => problemsIn$6(root, project), { concurrency: 1 });
14709
+ return Array.flatten(problems);
14710
+ });
14711
+ // src/features/check-skills/model/skill-files.ts
14712
+ const RULE$9 = "skill-file";
14713
+ const SKILL_FILE = /(?:^|\/)SKILL\.md$/u;
14714
+ const INSTALLED = /(?:^|\/)\.(?:agents|claude|codex)\/skills\//u;
14715
+ const FIXTURE = /(?:^|\/)fixtures\//u;
14716
+ const MARKDOWN = ".md";
14717
+ const LICENSE_FILE = /^LICEN[CS]E(?:\.[^/]+)?$/iu;
14718
+ const FRONTMATTER = /^---\n(?<yaml>[\s\S]*?)\n---\n/u;
14719
+ const HEADING = /^# (?<title>.+)$/mu;
14720
+ const NAME_KEY$1 = /^name:/mu;
14721
+ const LICENSE_KEY = /^license:/mu;
14722
+ const CODE = /```[\s\S]*?```|`[^`\n]*`/gu;
14723
+ const LINK = /\]\((?<target>[^)\s]+)\)/gu;
14724
+ const EXTERNAL = /^(?:[a-z][a-z0-9+.-]*:|#|\/)|[<>{}]/iu;
14725
+ const FRAGMENT = /#.*$/u;
14726
+ const GITHUB = "https://github.com/";
14727
+ const COMMIT_LINK = /\/(?:blob|tree)\/[0-9a-f]{40}(?:\/|$)/u;
14728
+ const BLANK = /\s+/u;
14729
+ const SEPARATOR = "/";
14730
+ const START$6 = 0;
14731
+ const FIRST$2 = 1;
14732
+ const READ_CONCURRENCY$2 = 16;
14733
+ const Metadata = Schema.Struct({ "derived-from": Schema.optional(Schema.String) });
14734
+ const Frontmatter = Schema.Struct({
14735
+ name: Schema.optional(Schema.String),
14736
+ license: Schema.optional(Schema.Unknown),
14737
+ metadata: Schema.optional(Metadata)
14738
+ });
14739
+ const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
14740
+ const offsetOf$1 = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$6));
14741
+ const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap(Option.liftThrowable((yaml) => parse$2(yaml))), Option.flatMap(decodeFrontmatter));
14742
+ const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$6].length), Option.getOrElse(() => START$6));
14743
+ const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
14744
+ const nameProblems = ({ source, directory }, name, folder) => {
14745
+ const bodyStart = bodyStartOf(source);
14746
+ const body = String$1.slice(bodyStart)(source);
14747
+ const heading = groupOf$2("title")(HEADING.exec(body));
14748
+ return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
14749
+ index: offsetOf$1(source, NAME_KEY$1),
14750
+ message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
14751
+ })), Option.toArray), ...pipe(Option.liftPredicate(heading, (found) => !Option.contains(found, name)), Option.map((found) => ({
14752
+ index: bodyStart + offsetOf$1(body, HEADING),
14753
+ message: `The first heading is ${headingText(found)}. Start the body with "# ${name}", the frontmatter name.`
14754
+ })), Option.toArray)];
14755
+ };
14756
+ const derivedProblems = (source, derived) => pipe(String$1.split(String$1.trim(derived), BLANK), Array.filter((url) => String$1.startsWith(GITHUB)(url) && !COMMIT_LINK.test(url)), Array.map((url) => ({
14757
+ index: offsetOf$1(source, url),
14758
+ message: `metadata.derived-from holds ${url}, which does not name a commit, so what it shows changes. Write a permalink: ${GITHUB}<owner>/<repo>/blob/<commit>/<path>.`
14759
+ })));
14760
+ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source), Option.map((frontmatter) => [
14761
+ ...pipe(Option.fromUndefinedOr(frontmatter.name), Option.map((name) => nameProblems(skill, name, folder)), Option.getOrElse(() => [])),
14762
+ ...pipe(Option.fromUndefinedOr(frontmatter.license), Option.map(() => ({
14763
+ index: offsetOf$1(skill.source, LICENSE_KEY),
14764
+ message: "The frontmatter has license. Skills here carry neither a license field nor a LICENSE file. Remove it."
14765
+ })), Option.toArray),
14766
+ ...pipe(Option.fromUndefinedOr(frontmatter.metadata), Option.flatMap((metadata) => Option.fromUndefinedOr(metadata["derived-from"])), Option.map((derived) => derivedProblems(skill.source, derived)), Option.getOrElse(() => []))
14767
+ ]), Option.getOrElse(() => []), Array.map(({ index, message }) => ({
14768
+ file: skill.file,
14769
+ ...positionOf(skill.source)(index),
14770
+ rule: RULE$9,
14771
+ message
14772
+ })));
14773
+ const linkOf = (found) => pipe(groupOf$2("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
14774
+ target,
14775
+ index: found.index ?? START$6
14776
+ })), Option.toArray);
14777
+ const rangeOf$1 = (found) => {
14778
+ const start = found.index ?? START$6;
14779
+ return [start, start + found[START$6].length];
14780
+ };
14781
+ const isOutside = (ranges) => ({ index }) => !pipe(ranges, Array.some(([start, end]) => index >= start && index < end));
14782
+ const linksIn = (source) => {
14783
+ const code = pipe(Array.fromIterable(String$1.matchAll(CODE)(source)), Array.map(rangeOf$1));
14784
+ return pipe(Array.fromIterable(String$1.matchAll(LINK)(source)), Array.flatMap(linkOf), Array.filter(isOutside(code)));
14785
+ };
14786
+ const linkProblems = Effect.fn("linkProblems")(function* linkProblems(file) {
14787
+ const files = yield* RepositoryFiles;
14788
+ const text = yield* files.readFile(file);
14789
+ if (Option.isNone(text)) return [];
14790
+ const source = text.value;
14791
+ const directory = files.dirname(file);
14792
+ const isMissing = ({ target }) => files.exists(files.join(directory, target)).pipe(Effect.map((exists) => !exists));
14793
+ const missing = yield* Effect.filter(linksIn(source), isMissing);
14794
+ return pipe(missing, Array.map(({ target, index }) => ({
14795
+ file,
14796
+ ...positionOf(source)(index),
14797
+ rule: RULE$9,
14798
+ message: `links to ${target}, which does not exist. Fix the path or remove the link.`
14799
+ })));
14800
+ });
14801
+ const problemsIn$5 = Effect.fn("problemsIn")(function* problemsIn(root, listed, name) {
14802
+ const files = yield* RepositoryFiles;
14803
+ const file = files.join(root, name);
14804
+ const directory = files.dirname(name);
14805
+ const inside = pipe(listed, Array.filter(String$1.startsWith(`${directory}${SEPARATOR}`)));
14806
+ const text = yield* files.readFile(file);
14807
+ const documents = pipe(inside, Array.filter(String$1.endsWith(MARKDOWN)), Array.map((entry) => files.join(root, entry)));
14808
+ const links = yield* Effect.forEach(documents, linkProblems, { concurrency: READ_CONCURRENCY$2 });
14809
+ const licenses = pipe(inside, Array.filter((entry) => files.dirname(entry) === directory), Array.filter((entry) => LICENSE_FILE.test(files.basename(entry))), Array.map((entry) => ({
14810
+ file: files.join(root, entry),
14811
+ line: FIRST$2,
14812
+ column: FIRST$2,
14813
+ rule: RULE$9,
14814
+ message: "is a license file inside a skill. Skills here carry neither a license field nor a LICENSE file. Delete it."
14815
+ })));
14816
+ return [
14817
+ ...pipe(text, Option.map((source) => frontmatterProblems({
14818
+ file,
14819
+ directory,
14820
+ source
14821
+ }, files.basename(directory))), Option.getOrElse(() => [])),
14822
+ ...licenses,
14823
+ ...Array.flatten(links)
14824
+ ];
14825
+ });
14826
+ /** @internal */
14827
+ const checkSkillFiles = Effect.fn("checkSkillFiles")(function* checkSkillFiles(root) {
14828
+ const listed = yield* (yield* RepositoryFiles).listedFiles(root);
14829
+ const skills = pipe(listed, Array.filter((name) => SKILL_FILE.test(name) && !INSTALLED.test(name) && !FIXTURE.test(name)));
14830
+ const found = yield* Effect.forEach(skills, (name) => problemsIn$5(root, listed, name), { concurrency: READ_CONCURRENCY$2 });
14831
+ return Array.flatten(found);
14832
+ });
14833
+ // src/app/document-checks.ts
14834
+ /** @internal */
14835
+ const checkDocuments = Effect.fn("checkDocuments")(function* checkDocuments(root) {
14836
+ const found = yield* Effect.all([
14837
+ checkSkillFiles(root),
14838
+ checkSkillEntry(root),
14839
+ checkPublishedSkills(root),
14840
+ checkReferenceLinks(root)
14841
+ ], { concurrency: "unbounded" });
14842
+ return Array.flatten(found);
14843
+ });
14865
14844
  // src/features/check-effect-diagnostics/model/effect-diagnostics.ts
14866
14845
  const RULE$8 = "effect-diagnostics-once";
14867
14846
  const PLUGIN = "@effect/language-service";
@@ -15412,9 +15391,7 @@ const checkTrackedText = Effect.fn("checkTrackedText")(function* checkTrackedTex
15412
15391
  checkUnneededFiles(root),
15413
15392
  checkReplacedTools(root),
15414
15393
  checkManifests(root),
15415
- checkSkillFiles(root),
15416
- checkSkillEntry(root),
15417
- checkPublishedSkills(root),
15394
+ checkDocuments(root),
15418
15395
  checkComments(root),
15419
15396
  checkAppliedPackages(root),
15420
15397
  checkGitSubpath(root),