@r_masseater/msch 0.34.0 → 0.35.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
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { C as definesTask, F as literalOf, I as nestedValues, L as propertyValue, M as KeySchema, N as childrenOf$2, P as keyName, R as stringsIn, S as VERIFY_TASK, _ as workspaceProjects, a as publicEntriesOf, c as readManifest, d as deployEntries, f as namedWorkspaces, g as workspaceDirectories, i as EntryManifestJson, j as workspaceConfigOf, l as workspaceDependencies, o as MANIFEST_FILE$1, p as patternOf$1, r as publishedWorkspaces, s as dependencyEntries, u as lockedPackages, v as workspaceManifest, w as hasVerifyTask, x as RUN_TASKS, y as runTasksOf } from "./package-DU5r3bvx.mjs";
3
- import { a as groupOf$1, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-R0NW0NE9.mjs";
3
+ import { a as groupOf$2, i as nodeServicesLayer, n as RepositoryFiles, r as nodeRepositoryFiles, t as NODE_MODULES } from "./repository-files-R0NW0NE9.mjs";
4
4
  import { $ as isPropertyAccessExpression, A as getLeadingCommentRanges, B as isEnumDeclaration, C as uniqueByReference, D as SignatureKind, E as InternalSymbolName, F as isBinaryExpression, G as isImportDeclaration, H as isFunctionDeclaration, I as isBlock, J as isModuleDeclaration, K as isInterfaceDeclaration, L as isCallExpression, M as getTextOfJSDocComment, N as isArrayLiteralExpression, O as SyntaxKind, P as isArrowFunction, Q as isParenthesizedExpression, R as isClassDeclaration, S as symbolAt, T as IndexKind, U as isFunctionExpression, V as isExportDeclaration, W as isIdentifier, X as isNumericLiteral, Y as isNewExpression, Z as isObjectLiteralExpression, _ as lineOf$2, a as problemAt$9, at as isSpreadElement, b as referencedSymbols, c as columnOf, ct as isTypeLiteralNode, d as descendantsOf, dt as isVariableDeclaration, et as isPropertyAssignment, f as importedModulesOf, ft as isVariableDeclarationList, g as isTypeDeclaration, h as isInsideAny, i as formatProblem, it as isSourceFile, j as getNameOfDeclaration, k as getJSDocTags, l as contains, lt as isTypeReferenceNode, m as isGenericDeclaration, n as ProblemList, nt as isSatisfiesExpression, o as sortProblems, ot as isStringLiteral, p as isExternalDeclaration, pt as isVariableStatement, q as isModuleBlock, rt as isSignatureDeclaration, s as childrenOf$3, st as isTypeAliasDeclaration, tt as isReturnStatement, u as declarationsOf, ut as isUnionTypeNode, v as packageOf$1, w as API, x as resolvedSymbol, y as propertyNamesOf, z as isElementAccessExpression } from "./cli-contract-mzluqQvf.mjs";
5
5
  import { t as COMMENT_DIRECTIVES } from "./comment-directives-WcDqvLwJ.mjs";
6
6
  import { VpToolsError, runVpa } from "@r_masseater/vite-plus-adopt";
@@ -656,7 +656,7 @@ const CONFIG_FILE$5 = "vite.config.ts";
656
656
  const SEPARATOR$19 = "/";
657
657
  const FIRST$14 = 1;
658
658
  const READ_CONCURRENCY$20 = 64;
659
- const AGENT_DOCS = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
659
+ const AGENT_DOCS$1 = /^(?:AGENTS|CLAUDE)(?:\.[^/]+)?\.md$/iu;
660
660
  const WORKSPACE_AGENT_DOC = "AGENTS.md";
661
661
  const README = /^README(?:\.[^/]+)?$/iu;
662
662
  const RootConfig$1 = Schema.Struct({ msch: Schema.Struct({ workspaceAgentsMd: Schema.Literal(true) }) });
@@ -690,7 +690,7 @@ const problemIn$4 = Effect.fn("problemIn")(function* problemIn(root, allowed, na
690
690
  base: files.basename(name),
691
691
  directory: files.dirname(file)
692
692
  };
693
- if (AGENT_DOCS.test(doc.base)) return agentDocProblem(doc, allowed);
693
+ if (AGENT_DOCS$1.test(doc.base)) return agentDocProblem(doc, allowed);
694
694
  return readmeProblem(doc, allowed);
695
695
  });
696
696
  const allowsWorkspaceAgentDocs = Effect.fn("allowsWorkspaceAgentDocs")(function* allowsWorkspaceAgentDocs(root) {
@@ -10221,13 +10221,13 @@ const actionProblems = (workspaces, file, name) => pipe(named(workspaces, name),
10221
10221
  rule: PACKAGE,
10222
10222
  message: packageMessage(`The action ${name}`, directory)
10223
10223
  })), Option.toArray);
10224
- const groupOf = (pattern, name) => pipe(String$1.match(pattern)(name), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups["name"])));
10224
+ const groupOf$1 = (pattern, name) => pipe(String$1.match(pattern)(name), Option.flatMap((match) => Option.fromNullishOr(match.groups)), Option.flatMap((groups) => Option.fromNullishOr(groups["name"])));
10225
10225
  /** @internal */
10226
10226
  const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkflowScale(root) {
10227
10227
  const files = yield* RepositoryFiles;
10228
10228
  const listed = yield* files.listedFiles(root);
10229
10229
  const workspaces = yield* namedWorkspaces(root);
10230
- const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf(WORKFLOW, name), Option.map((stem) => ({
10230
+ const workflows = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(WORKFLOW, name), Option.map((stem) => ({
10231
10231
  name,
10232
10232
  stem
10233
10233
  })), Option.toArray)));
@@ -10240,7 +10240,7 @@ const checkWorkflowScale = Effect.fn("checkWorkflowScale")(function* checkWorkfl
10240
10240
  source: text
10241
10241
  })]), Option.getOrElse(() => []));
10242
10242
  }), { concurrency: READ_CONCURRENCY$10 });
10243
- const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
10243
+ const actions = pipe(listed, Array.flatMap((name) => pipe(groupOf$1(ACTION, name), Option.map((action) => actionProblems(workspaces, files.join(root, name), action)), Option.getOrElse(() => []))));
10244
10244
  return [...Array.flatten(found), ...actions];
10245
10245
  });
10246
10246
  // src/features/check-repository-layout/model/workspace-checks.ts
@@ -11926,7 +11926,7 @@ const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\
11926
11926
  const PLUGIN_ROOT = "..";
11927
11927
  const READ_CONCURRENCY$9 = 16;
11928
11928
  const START$10 = 0;
11929
- const referenceOf$1 = (found) => pipe(groupOf$1("path")(found), Option.filter(() => Option.isNone(groupOf$1("optional")(found))), Option.map((path) => ({
11929
+ const referenceOf$1 = (found) => pipe(groupOf$2("path")(found), Option.filter(() => Option.isNone(groupOf$2("optional")(found))), Option.map((path) => ({
11930
11930
  path,
11931
11931
  index: found.index ?? START$10
11932
11932
  })), Option.toArray);
@@ -12111,12 +12111,13 @@ const BYPASS_RULESET = "--admin";
12111
12111
  const FILTER = /^(?:--filter(?:=.*)?|-F)$/u;
12112
12112
  const TASK_KINDS = ["script", "task"];
12113
12113
  const SECOND = 1;
12114
+ const DOC_KIND = "doc";
12114
12115
  const programOf = (words) => Array.headNonEmpty(words);
12115
12116
  const subcommandOf = (words) => Array.get(words, SECOND);
12116
12117
  const RULES = [
12117
12118
  {
12118
12119
  rule: "package-manager-command",
12119
- applies: (_source, words) => Array.contains(PACKAGE_MANAGERS, programOf(words)),
12120
+ applies: (source, words) => Array.contains(PACKAGE_MANAGERS, programOf(words)) && (source.kind !== DOC_KIND || words.length > SECOND),
12120
12121
  message: (command) => `\`${command}\` calls the package manager directly. Run it through vp (vp install, vp add, vp exec, vp dlx, vp run), so that hooks, CI and sessions all use the toolchain Vite+ pins.`
12121
12122
  },
12122
12123
  {
@@ -12137,6 +12138,35 @@ const problemsOf = (source) => pipe(simpleCommands(source.text), Array.flatMap((
12137
12138
  message: message(String$1.trim(Array.join(words, " ")))
12138
12139
  })))));
12139
12140
  const commandProblems$1 = (sources) => pipe(sources, Array.flatMap(problemsOf));
12141
+ // src/features/check-vite-plus/model/doc-sources.ts
12142
+ const FENCE = /^(?<open>```(?:sh|bash|shell|console|zsh)?[ \t]*\n)(?<body>[\s\S]*?)^```[ \t]*$/gmu;
12143
+ const INLINE_CODE = /(?<open>(?<!`)`)(?<body>[^`\n]+)`(?!`)/gu;
12144
+ const groupOf = (match) => (name) => pipe(Option.fromUndefinedOr(match.groups), Option.flatMap(Record.get(name)));
12145
+ const codeIn = (pattern) => (source) => pipe(Array.fromIterable(String$1.matchAll(pattern)(source)), Array.flatMap((match) => {
12146
+ const group = groupOf(match);
12147
+ return pipe(Option.all({
12148
+ open: group("open"),
12149
+ text: group("body"),
12150
+ whole: Array.head(match),
12151
+ index: Option.fromUndefinedOr(match.index)
12152
+ }), Option.map(({ open, text, whole, index }) => ({
12153
+ text,
12154
+ start: index + open.length,
12155
+ end: index + whole.length
12156
+ })), Option.toArray);
12157
+ }));
12158
+ const outside = (fences) => (span) => !pipe(fences, Array.some((fence) => span.start >= fence.start && span.start < fence.end));
12159
+ const docSources = (file) => (source) => {
12160
+ const fences = codeIn(FENCE)(source);
12161
+ const inline = pipe(codeIn(INLINE_CODE)(source), Array.filter(outside(fences)));
12162
+ return pipe([...fences, ...inline], Array.map(({ text, start }) => ({
12163
+ kind: "doc",
12164
+ file,
12165
+ position: positionOf(source)(start),
12166
+ name: "code",
12167
+ text
12168
+ })));
12169
+ };
12140
12170
  // src/features/check-vite-plus/model/command-sources.ts
12141
12171
  const ROOT_DIRECTORY = ".";
12142
12172
  const COMMAND_KEY = "command";
@@ -12152,6 +12182,11 @@ const STEP_FILES = [
12152
12182
  ];
12153
12183
  const HOOK_FILES = [":(glob).vite-hooks/*"];
12154
12184
  const AGENT_FILES = [".claude/settings.json", ".mcp.json"];
12185
+ const AGENT_DOCS = [
12186
+ ":(glob)**/AGENTS.md",
12187
+ ":(glob)**/CLAUDE.md",
12188
+ ...EXCLUDED$1
12189
+ ];
12155
12190
  const READ_CONCURRENCY$6 = 16;
12156
12191
  const START$8 = 0;
12157
12192
  const FIRST$3 = 1;
@@ -12241,10 +12276,11 @@ const readSources = Effect.fn("readSources")(function* readSources(root, names,
12241
12276
  /** @internal */
12242
12277
  const commandSources = Effect.fn("commandSources")(function* commandSources(root) {
12243
12278
  const files = yield* RepositoryFiles;
12244
- const [manifests, steps, hooks, workspaces] = yield* Effect.all([
12279
+ const [manifests, steps, hooks, docs, workspaces] = yield* Effect.all([
12245
12280
  files.matchingFiles(root, MANIFESTS),
12246
12281
  files.matchingFiles(root, STEP_FILES),
12247
12282
  files.matchingFiles(root, HOOK_FILES),
12283
+ files.matchingFiles(root, AGENT_DOCS),
12248
12284
  workspaceDirectories(root)
12249
12285
  ], { concurrency: "unbounded" });
12250
12286
  const found = yield* Effect.all([
@@ -12252,6 +12288,7 @@ const commandSources = Effect.fn("commandSources")(function* commandSources(root
12252
12288
  readSources(root, steps, stepSources),
12253
12289
  readSources(root, hooks, hookSources),
12254
12290
  readSources(root, AGENT_FILES, agentSources),
12291
+ readSources(root, docs, docSources),
12255
12292
  workspaceTasks(root, Array.dedupe([ROOT_DIRECTORY, ...workspaces]))
12256
12293
  ], { concurrency: "unbounded" });
12257
12294
  return Array.flatten(found);
@@ -12901,7 +12938,7 @@ const Manifest = Schema.Struct({
12901
12938
  engines: Schema.optional(Engines)
12902
12939
  });
12903
12940
  const decodeManifest = Schema.decodeUnknownOption(Schema.fromJsonString(Manifest));
12904
- const majorOf = (found) => pipe(groupOf$1("major")(found), Option.map(Number));
12941
+ const majorOf = (found) => pipe(groupOf$2("major")(found), Option.map(Number));
12905
12942
  const isOld = (major) => major < MINIMUM;
12906
12943
  const floorOf = (alternative) => majorOf(RANGE_FLOOR.exec(String$1.trim(alternative)));
12907
12944
  const floorIsOld = (alternative) => pipe(floorOf(alternative), Option.match({
@@ -13111,13 +13148,13 @@ const Frontmatter = Schema.Struct({
13111
13148
  });
13112
13149
  const decodeFrontmatter = Schema.decodeUnknownOption(Frontmatter);
13113
13150
  const offsetOf = (source, pattern) => pipe(String$1.search(pattern)(source), Option.getOrElse(() => START$3));
13114
- const frontmatterOf = (source) => pipe(groupOf$1("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$1(yaml))));
13151
+ const frontmatterOf = (source) => pipe(groupOf$2("yaml")(FRONTMATTER.exec(source)), Option.flatMap((yaml) => decodeFrontmatter(parse$1(yaml))));
13115
13152
  const bodyStartOf = (source) => pipe(Option.fromNullishOr(FRONTMATTER.exec(source)), Option.map((found) => found[START$3].length), Option.getOrElse(() => START$3));
13116
13153
  const headingText = (heading) => pipe(heading, Option.map((title) => `"# ${title}"`), Option.getOrElse(() => "missing"));
13117
13154
  const nameProblems = ({ source, directory }, name, folder) => {
13118
13155
  const bodyStart = bodyStartOf(source);
13119
13156
  const body = String$1.slice(bodyStart)(source);
13120
- const heading = groupOf$1("title")(HEADING.exec(body));
13157
+ const heading = groupOf$2("title")(HEADING.exec(body));
13121
13158
  return [...pipe(Option.liftPredicate(name, (found) => found !== folder), Option.map((found) => ({
13122
13159
  index: offsetOf(source, NAME_KEY),
13123
13160
  message: `The frontmatter name "${found}" differs from the directory ${directory}. Give the skill the name of its directory.`
@@ -13143,7 +13180,7 @@ const frontmatterProblems = (skill, folder) => pipe(frontmatterOf(skill.source),
13143
13180
  rule: RULE$5,
13144
13181
  message
13145
13182
  })));
13146
- const linkOf = (found) => pipe(groupOf$1("target")(found), Option.filter((target) => !EXTERNAL.test(target)), Option.map((target) => String$1.replace(FRAGMENT, "")(target)), Option.filter(String$1.isNonEmpty), Option.map((target) => ({
13183
+ 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) => ({
13147
13184
  target,
13148
13185
  index: found.index ?? START$3
13149
13186
  })), Option.toArray);