@r_masseater/msch 0.122.1 → 0.124.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 +21 -55
- package/dist/cli.mjs.map +1 -1
- package/dist/config.mjs +2 -2
- package/dist/decision-rules.mjs +1 -1
- package/dist/{define-lint-preset-eBFx8MIW.mjs → define-lint-preset-D3jb88wH.mjs} +15 -5
- package/dist/define-lint-preset-D3jb88wH.mjs.map +1 -0
- package/dist/lint.mjs +1 -1
- package/dist/{repository-text-UR3E4wjS.mjs → repository-text-DfTSvaqo.mjs} +16 -18
- package/dist/{repository-text-UR3E4wjS.mjs.map → repository-text-DfTSvaqo.mjs.map} +1 -1
- package/package.json +5 -4
- package/dist/define-lint-preset-eBFx8MIW.mjs.map +0 -1
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-
|
|
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-
|
|
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";
|
|
@@ -37,6 +37,7 @@ import { findPackageJson } from "@r_masseater/masseater-utils/kestrion/node";
|
|
|
37
37
|
import { findSkillFiles } from "@tanstack/intent";
|
|
38
38
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http";
|
|
39
39
|
import { runMainWith } from "@r_masseater/masseater-utils/node-main";
|
|
40
|
+
import { sdkAgentQuery } from "@r_masseater/masseater-utils/agent-query";
|
|
40
41
|
import { dual } from "effect/Function";
|
|
41
42
|
import { judgeText } from "@r_masseater/oxlint-plugin-decision";
|
|
42
43
|
import { finished, mustSucceed, outputOf, succeeds, writeOutputs } from "@r_masseater/masseater-utils/github-workflow";
|
|
@@ -47,7 +48,7 @@ import { Buffer } from "node:buffer";
|
|
|
47
48
|
import { createZstdDecompress } from "node:zlib";
|
|
48
49
|
// package.json
|
|
49
50
|
var name = "@r_masseater/msch";
|
|
50
|
-
var version = "0.
|
|
51
|
+
var version = "0.124.0";
|
|
51
52
|
var homepage = "https://github.com/masseater/ecosystems/tree/main/libs/msch#readme";
|
|
52
53
|
var repository = {
|
|
53
54
|
"type": "git",
|
|
@@ -16031,7 +16032,7 @@ const SETTINGS_FILE$2 = /^\.claude\/settings\.json$/u;
|
|
|
16031
16032
|
const PLUGIN_HOOKS_FILE = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
16032
16033
|
const PROJECT_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PROJECT_DIR\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
16033
16034
|
const PLUGIN_PATH = /(?<optional>--env-file-if-exists=)?\$\{?CLAUDE_PLUGIN_ROOT\}?(?:\\")?\/(?<path>[\w.@/-]+)/gu;
|
|
16034
|
-
const PLUGIN_ROOT = "..";
|
|
16035
|
+
const PLUGIN_ROOT$1 = "..";
|
|
16035
16036
|
const READ_CONCURRENCY$18 = 16;
|
|
16036
16037
|
const START$24 = 0;
|
|
16037
16038
|
const referenceOf = (found) => pipe(groupOf("path")(found), Option.filter(() => Option.isNone(groupOf("optional")(found))), Option.map((path) => ({
|
|
@@ -16070,7 +16071,7 @@ const checkMissingHooks = Effect.fn("checkMissingHooks")(function* checkMissingH
|
|
|
16070
16071
|
if (PLUGIN_HOOKS_FILE.test(name)) return [{
|
|
16071
16072
|
root,
|
|
16072
16073
|
file,
|
|
16073
|
-
base: files.join(files.dirname(file), PLUGIN_ROOT),
|
|
16074
|
+
base: files.join(files.dirname(file), PLUGIN_ROOT$1),
|
|
16074
16075
|
pattern: PLUGIN_PATH
|
|
16075
16076
|
}];
|
|
16076
16077
|
return [];
|
|
@@ -16355,9 +16356,11 @@ const SHELL_FILE = /\.(?:sh|bash|zsh|ksh|fish|command)$/u;
|
|
|
16355
16356
|
const SHELL_SHEBANG = /^#!\S*(?:\/|\s)(?:env\s+)?(?:-\S+\s+)*(?:ba|z|k|da)?sh\b|^#!\S*fish\b/u;
|
|
16356
16357
|
const EXTENSION$1 = /\.[^./]+$/u;
|
|
16357
16358
|
const SETTINGS_FILE = ".claude/settings.json";
|
|
16359
|
+
const PLUGIN_HOOKS = /(?:^|\/)hooks\/hooks\.json$/u;
|
|
16360
|
+
const PLUGIN_ROOT = /\$\{CLAUDE_PLUGIN_ROOT\}/gu;
|
|
16358
16361
|
const READ_CONCURRENCY$17 = 64;
|
|
16359
16362
|
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
|
|
16363
|
+
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
16364
|
const HookSchema = Schema.Struct({
|
|
16362
16365
|
command: Schema.optional(Schema.String),
|
|
16363
16366
|
args: Schema.String.pipe(Schema.Array, Schema.optional)
|
|
@@ -16373,13 +16376,24 @@ const sessionStartCommands = (source) => {
|
|
|
16373
16376
|
const matchers = pipe(decodeSettings(source), Option.flatMap(({ hooks }) => Option.fromUndefinedOr(hooks)), Option.flatMap(({ SessionStart }) => Option.fromUndefinedOr(SessionStart)));
|
|
16374
16377
|
return pipe(matchers, Option.map(Array$1.flatMap((matcher) => matcherText(matcher))), Option.getOrElse(() => NO_TEXT));
|
|
16375
16378
|
};
|
|
16379
|
+
const pluginRootOf = (hooksFile) => String$1.replace(PLUGIN_HOOKS, "")(hooksFile);
|
|
16380
|
+
const pluginCommands = (hooksFile, source) => {
|
|
16381
|
+
const root = pluginRootOf(hooksFile);
|
|
16382
|
+
return pipe(sessionStartCommands(source), Array$1.map((text) => String$1.replaceAll(PLUGIN_ROOT, root)(text)), Array$1.map((text) => String$1.replace(/^\//u, "")(text)));
|
|
16383
|
+
};
|
|
16376
16384
|
const hasExtension = (name) => EXTENSION$1.test(baseName$1(name));
|
|
16385
|
+
const pluginSessionStarts = Effect.fn("pluginSessionStarts")(function* pluginSessionStarts(root, names) {
|
|
16386
|
+
const files = yield* RepositoryFiles;
|
|
16387
|
+
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 });
|
|
16388
|
+
return Array$1.flatten(commands);
|
|
16389
|
+
});
|
|
16377
16390
|
/** @internal */
|
|
16378
16391
|
const checkShellScripts = Effect.fn("checkShellScripts")(function* checkShellScripts(root) {
|
|
16379
16392
|
const files = yield* RepositoryFiles;
|
|
16380
16393
|
const names = yield* files.ownedFiles(root);
|
|
16381
16394
|
const settings = yield* files.readFile(files.join(root, SETTINGS_FILE));
|
|
16382
|
-
const
|
|
16395
|
+
const pluginHooks = yield* pluginSessionStarts(root, names);
|
|
16396
|
+
const commands = [...pipe(settings, Option.map(sessionStartCommands), Option.getOrElse(() => NO_TEXT)), ...pluginHooks];
|
|
16383
16397
|
const isSessionStartHook = (name) => pipe(commands, Array$1.some(String$1.includes(name)));
|
|
16384
16398
|
const isShell = (name) => {
|
|
16385
16399
|
const file = files.join(root, name);
|
|
@@ -20486,54 +20500,6 @@ const checkWithAgents = Effect.fn("checkWithAgents")(function* checkWithAgents(r
|
|
|
20486
20500
|
const found = yield* Effect.forEach(checks, runAgentCheck(setup), { concurrency: SEQUENTIAL$1 });
|
|
20487
20501
|
return pipe(found, Array$1.flatten);
|
|
20488
20502
|
});
|
|
20489
|
-
// src/shared/lib/agent-query.ts
|
|
20490
|
-
const SDK = "@anthropic-ai/claude-agent-sdk";
|
|
20491
|
-
const ResultMessage = Schema.Struct({
|
|
20492
|
-
type: Schema.Literal("result"),
|
|
20493
|
-
subtype: Schema.String,
|
|
20494
|
-
is_error: Schema.Boolean,
|
|
20495
|
-
structured_output: Schema.optional(Schema.Unknown)
|
|
20496
|
-
});
|
|
20497
|
-
const isResult = Schema.is(ResultMessage);
|
|
20498
|
-
const reasonOf$2 = (failure) => {
|
|
20499
|
-
if (failure instanceof Error) return failure.message;
|
|
20500
|
-
return String(failure);
|
|
20501
|
-
};
|
|
20502
|
-
const loadSdk = Effect.tryPromise({
|
|
20503
|
-
try: () => import("@anthropic-ai/claude-agent-sdk"),
|
|
20504
|
-
catch: () => `${SDK} is not installed. Add it to the devDependencies of the repository root to run agents.`
|
|
20505
|
-
});
|
|
20506
|
-
const answerOf = (message) => {
|
|
20507
|
-
if (message.is_error || message.subtype !== "success") return Effect.fail(`the agent ended with ${message.subtype}`);
|
|
20508
|
-
return Effect.fromOption(Option.fromUndefinedOr(message.structured_output)).pipe(Effect.mapError(() => "the agent returned no structured output"));
|
|
20509
|
-
};
|
|
20510
|
-
const lastResult = (messages) => pipe(Stream.fromAsyncIterable(messages, reasonOf$2), Stream.filter(isResult), Stream.runLast);
|
|
20511
|
-
/** @internal */
|
|
20512
|
-
const sdkAgentQuery = Effect.fn("sdkAgentQuery")(function* querying(request) {
|
|
20513
|
-
const messages = (yield* loadSdk).query({
|
|
20514
|
-
prompt: request.prompt,
|
|
20515
|
-
options: {
|
|
20516
|
-
cwd: request.directory,
|
|
20517
|
-
model: request.model,
|
|
20518
|
-
effort: request.effort,
|
|
20519
|
-
tools: [...request.tools],
|
|
20520
|
-
allowedTools: [...request.allowed],
|
|
20521
|
-
permissionMode: "dontAsk",
|
|
20522
|
-
settingSources: [],
|
|
20523
|
-
mcpServers: {},
|
|
20524
|
-
strictMcpConfig: true,
|
|
20525
|
-
persistSession: false,
|
|
20526
|
-
maxTurns: request.maxTurns,
|
|
20527
|
-
outputFormat: {
|
|
20528
|
-
type: "json_schema",
|
|
20529
|
-
schema: { ...request.schema }
|
|
20530
|
-
}
|
|
20531
|
-
}
|
|
20532
|
-
});
|
|
20533
|
-
const result = yield* lastResult(messages);
|
|
20534
|
-
const message = yield* Effect.fromOption(result).pipe(Effect.mapError(() => "the agent ended without a result"));
|
|
20535
|
-
return yield* answerOf(message);
|
|
20536
|
-
});
|
|
20537
20503
|
// src/app/agents-command.ts
|
|
20538
20504
|
const agents = Effect.fn("agents")(function* investigating(input) {
|
|
20539
20505
|
const root = (yield* RepositoryFiles).resolve(".");
|