@r_masseater/msch 0.122.1 → 0.123.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 CHANGED
@@ -14,7 +14,7 @@ import { decodePackageJson, decodeVersionedPackageJson, readPackageJson, readRaw
14
14
  import { a as workspaceConfigs, c as publicEntriesOf, d as FRONTMATTER, f as splitFrontmatter, g as deployEntries, h as bundledEntries$1, i as publishedWorkspaces, l as modDirectories, m as workspaceLinks, o as entryNameOf, r as packedWorkspaces, s as isBinEntry, u as isIndexSkill, v as shadcnUiOf } from "./published-DkH6B-Gr.mjs";
15
15
  import { parse, resolveConfigFromFile } from "vite-plus";
16
16
  import { i as USAGE_SPOOL, n as DECISION_TIMEOUT_MS, r as JAPANESE, t as DECISION_MODEL } from "./config-B3SYjao5.mjs";
17
- import { _ as patternOf$1, a as CI_TASKS, c as MSCH_VERIFY_COMMANDS, f as existsAt, g as namedWorkspaces, m as isIgnored, n as builtTextRuleNames, r as secretsOf, s as MSCH_TASK_COMMANDS, t as TEXT_IGNORES, u as meteredCommand } from "./repository-text-UR3E4wjS.mjs";
17
+ import { _ as patternOf$1, a as CI_TASKS, c as MSCH_VERIFY_COMMANDS, f as existsAt, g as namedWorkspaces, m as isIgnored, n as builtTextRuleNames, r as secretsOf, s as MSCH_TASK_COMMANDS, t as TEXT_IGNORES, u as meteredCommand } from "./repository-text-DfTSvaqo.mjs";
18
18
  import { fileURLToPath } from "node:url";
19
19
  import treeSitter from "@vscode/tree-sitter-wasm";
20
20
  import { t as startedOnce } from "./started-once-BN_hLlmU.mjs";
@@ -23,7 +23,7 @@ import { rolldown } from "rolldown";
23
23
  import { stripVTControlCharacters } from "node:util";
24
24
  import { builtinModules, isBuiltin as isBuiltin$1 } from "node:module";
25
25
  import semver from "semver";
26
- import { g as decisionTestRules, n as MARKDOWN_RULES, p as lint$3, t as MARKDOWN_IGNORES, x as exempt } from "./define-lint-preset-eBFx8MIW.mjs";
26
+ import { g as decisionTestRules, n as MARKDOWN_RULES, p as lint$3, t as MARKDOWN_IGNORES, x as exempt } from "./define-lint-preset-D3jb88wH.mjs";
27
27
  import { NO_PATH, describeReference, diagnosticDetail, linksIn as linksIn$1, lint, markdownPathspecs, referenceOf as referenceOf$2, y8Section } from "@r_masseater/y8";
28
28
  import { lint as lint$1, wismPathspecs, wismSection } from "@r_masseater/wism";
29
29
  import { Parser, isPair, isScalar, parse as parse$1, parseDocument, visit as visit$1 } from "yaml";
@@ -47,7 +47,7 @@ import { Buffer } from "node:buffer";
47
47
  import { createZstdDecompress } from "node:zlib";
48
48
  // package.json
49
49
  var name = "@r_masseater/msch";
50
- var version = "0.122.1";
50
+ var version = "0.123.1";
51
51
  var homepage = "https://github.com/masseater/ecosystems/tree/main/libs/msch#readme";
52
52
  var repository = {
53
53
  "type": "git",
@@ -16031,7 +16031,7 @@ const SETTINGS_FILE$2 = /^\.claude\/settings\.json$/u;
16031
16031
  const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
16032
16032
  const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
16033
16033
  const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
16034
- const PLUGIN_ROOT = "..";
16034
+ const PLUGIN_ROOT$1 = "..";
16035
16035
  const READ_CONCURRENCY$18 = 16;
16036
16036
  const START$24 = 0;
16037
16037
  const referenceOf = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
@@ -16070,7 +16070,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
16070
16070
  if (PLUGIN_HOOKS_FILE.test(name)) return [{
16071
16071
  root,
16072
16072
  file,
16073
- base: files.join(files.dirname(file), PLUGIN_ROOT),
16073
+ base: files.join(files.dirname(file), PLUGIN_ROOT$1),
16074
16074
  pattern: PLUGIN_PATH
16075
16075
  }];
16076
16076
  return [];
@@ -16355,9 +16355,11 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
16355
16355
  const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
16356
16356
  const EXTENSION$1 = /\.[^./]+$/u;
16357
16357
  const SETTINGS_FILE = ".claude/settings.json";
16358
+ const PLUGIN_HOOKS = /(?:^|\/)hooks\/hooks\.json$/u;
16359
+ const PLUGIN_ROOT = /\$\{CLAUDE_PLUGIN_ROOT\}/gu;
16358
16360
  const READ_CONCURRENCY$17 = 64;
16359
16361
  const RULE$35 = "shell-script";
16360
- const MESSAGE$9 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only the SessionStart hook in .claude/settings.json, which installs the toolchain before TypeScript can run, stays a shell script.";
16362
+ const MESSAGE$9 = "is a shell script. Do the work in TypeScript as a Vite+ task in vite.config.ts, a test, or the tool's own hook, and delete this file. Only a SessionStart hook in .claude/settings.json or a plugin's hooks/hooks.json, which installs the toolchain or the plugin's dependencies before TypeScript can run, stays a shell script.";
16361
16363
  const HookSchema = Schema.Struct({
16362
16364
  command: Schema.optional(Schema.String),
16363
16365
  args: Schema.String.pipe(Schema.Array, Schema.optional)
@@ -16373,13 +16375,24 @@ const sessionStartCommands = (source) => {
16373
16375
  const matchers = pipe(decodeSettings(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)));
16374
16376
  return pipe(matchers, Option.map(Array$1.flatMap((matcher) => matcherText(matcher))), Option.getOrElse(() => NO_TEXT));
16375
16377
  };
16378
+ const pluginRootOf = (hooksFile) => String$1.replace(PLUGIN_HOOKS, "")(hooksFile);
16379
+ const pluginCommands = (hooksFile, source) => {
16380
+ const root = pluginRootOf(hooksFile);
16381
+ return pipe(sessionStartCommands(source), Array$1.map((text) => String$1.replaceAll(PLUGIN_ROOT, root)(text)), Array$1.map((text) => String$1.replace(/^\//u, "")(text)));
16382
+ };
16376
16383
  const hasExtension = (name) => EXTENSION$1.test(baseName$1(name));
16384
+ const pluginSessionStarts = Effect.fn("pluginSessionStarts")(function* pluginSessionStarts(root, names) {
16385
+ const files = yield* RepositoryFiles;
16386
+ const commands = yield* Effect.forEach(pipe(names, Array$1.filter((name) => PLUGIN_HOOKS.test(name))), (name) => files.readFile(files.join(root, name)).pipe(Effect.map((source) => pipe(source, Option.map((text) => pluginCommands(name, text)), Option.getOrElse(() => NO_TEXT)))), { concurrency: READ_CONCURRENCY$17 });
16387
+ return Array$1.flatten(commands);
16388
+ });
16377
16389
  /** @internal */
16378
16390
  const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
16379
16391
  const files = yield* RepositoryFiles;
16380
16392
  const names = yield* files.ownedFiles(root);
16381
16393
  const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));
16382
- const commands = pipe(settings, Option.map(sessionStartCommands), Option.getOrElse(() => NO_TEXT));
16394
+ const pluginHooks = yield* pluginSessionStarts(root, names);
16395
+ const commands = [...pipe(settings, Option.map(sessionStartCommands), Option.getOrElse(() => NO_TEXT)), ...pluginHooks];
16383
16396
  const isSessionStartHook = (name) => pipe(commands, Array$1.some(String$1.includes(name)));
16384
16397
  const isShell = (name) => {
16385
16398
  const file = files.join(root, name);