@muggleai/works 5.27.0-staging.237 → 5.27.0-staging.239

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.
Files changed (34) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/README.md +1 -1
  3. package/dist/{chunk-GCWJMRYJ.js → chunk-EK5DJBSY.js} +120 -10
  4. package/dist/{chunk-WRYPWI33.js → chunk-FI6VHHZN.js} +102 -2
  5. package/dist/cli.js +2 -2
  6. package/dist/index.js +2 -2
  7. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  8. package/dist/plugin/.codex-mcp.json +1 -1
  9. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  10. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  11. package/dist/plugin/.mcp.json +1 -1
  12. package/dist/plugin/hooks/README.md +1 -1
  13. package/dist/plugin/scripts/guardrail-build-followthrough-gate.sh +3 -2
  14. package/dist/plugin/scripts/guardrail-build-router.sh +6 -3
  15. package/dist/plugin/scripts/guardrails.mjs +136 -63
  16. package/dist/plugin/skills/do/address-reviews.md +1 -1
  17. package/dist/plugin/skills/muggle-preferences/SKILL.md +1 -1
  18. package/dist/plugin/skills/muggle-preferences/ops/llm-source.md +2 -1
  19. package/dist/release-manifest.json +3 -3
  20. package/dist/src-33XQK7NM.js +1 -0
  21. package/package.json +1 -1
  22. package/plugin/.claude-plugin/plugin.json +1 -1
  23. package/plugin/.codex-mcp.json +1 -1
  24. package/plugin/.codex-plugin/plugin.json +1 -1
  25. package/plugin/.cursor-plugin/plugin.json +1 -1
  26. package/plugin/.mcp.json +1 -1
  27. package/plugin/hooks/README.md +1 -1
  28. package/plugin/scripts/guardrail-build-followthrough-gate.sh +3 -2
  29. package/plugin/scripts/guardrail-build-router.sh +6 -3
  30. package/plugin/scripts/guardrails.mjs +136 -63
  31. package/plugin/skills/do/address-reviews.md +1 -1
  32. package/plugin/skills/muggle-preferences/SKILL.md +1 -1
  33. package/plugin/skills/muggle-preferences/ops/llm-source.md +2 -1
  34. package/dist/src-EEKJ2ZOK.js +0 -1
@@ -1,5 +1,5 @@
1
1
  import { readFileSync, existsSync, readdirSync, mkdirSync, openSync, fstatSync, readSync, closeSync, statSync, writeFileSync, renameSync, writeSync, unlinkSync, rmSync } from 'fs';
2
- import { join, basename, isAbsolute, resolve, dirname } from 'path';
2
+ import { join, isAbsolute, resolve, basename, dirname } from 'path';
3
3
  import { homedir, hostname } from 'os';
4
4
  import { execFileSync, spawn } from 'child_process';
5
5
  import { fileURLToPath } from 'url';
@@ -38,6 +38,8 @@ var WATCH_HOLD_PHRASE_PREFIX = "HOLD WATCH #";
38
38
  var WATCH_HOLD_INSTRUCTION = /HOLD WATCH #(\d+)\b/g;
39
39
  var WATCH_HOLD_TRANSCRIPT_TAIL_BYTES = 4e6;
40
40
  var MAX_BUILD_BLOCKS = 3;
41
+ var MUGGLE_PLUGIN_NAMESPACE = "muggle";
42
+ var MUGGLE_DO_COMMAND_NAMES = ["muggle-do", "mdo"];
41
43
  var MAX_WALKTHROUGH_BLOCKS = 3;
42
44
  var GH_LOOKUP_TIMEOUT_MS = 1e4;
43
45
  function mcpToolNamePattern(hyphenatedSource) {
@@ -51,6 +53,18 @@ var MAX_STAGE_BLOCKS = 3;
51
53
  var MAX_DEBUG_BLOCKS = 3;
52
54
  var ANY_TEST_CASE = "*";
53
55
  var MUGGLE_EXECUTION_TOOL = mcpToolNamePattern("muggle-local-(execute-test-generation|execute-replay)");
56
+ var MUGGLE_E2E_RUN_TOOL = mcpToolNamePattern(
57
+ "muggle-(local-execute-(test-generation|replay)|remote-workflow-start-test-script-replay)"
58
+ );
59
+ var SHELL_ASSIGNMENT = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/s;
60
+ var TEST_RUNNER_PROGRAMS = ["jest", "vitest", "pytest"];
61
+ var TEST_SUBCOMMAND_PROGRAMS = ["go", "cargo"];
62
+ var PACKAGE_MANAGER_PROGRAMS = ["pnpm", "npm", "yarn"];
63
+ var PACKAGE_EXEC_SUBCOMMANDS = ["exec", "dlx"];
64
+ var PACKAGE_RUNNER_PROGRAMS = ["npx", "pnpx", "bunx"];
65
+ var PYTHON_PROGRAMS = ["python", "python3", "py"];
66
+ var SCRIPT_SHELL_PROGRAMS = ["bash", "sh", "zsh", "pwsh", "powershell"];
67
+ var SCRIPT_SHELL_FLAGS = ["-c", "-lc", "-command"];
54
68
  var MUGGLE_EVENT_EMIT_TOOL = mcpToolNamePattern("muggle-local-telemetry-event-emit");
55
69
  var MUGGLE_FEEDBACK_CREATE_TOOL = mcpToolNamePattern("muggle-remote-user-feedback-create");
56
70
  var PRE_EXECUTION_CLASSIFICATION_EVENT = "pre-execution-classification";
@@ -1116,9 +1130,10 @@ var defaultPrWalkthroughLookup = {
1116
1130
  const url = runGh(["pr", "view", "--json", "url", "-q", ".url"])?.trim();
1117
1131
  return url && url.startsWith("http") ? url : null;
1118
1132
  },
1119
- // Scans the description as well as the comments: muggle-do embeds the
1120
- // walkthrough in the body at PR-creation time, and a comments-only check
1121
- // would report that PR as owing one it already carries.
1133
+ // Scans the description as well as the comments: a PR opened through the
1134
+ // walkthrough's render-for-new-PR mode, or by a muggle-do release that
1135
+ // embedded it in the body, carries the walkthrough there, and a
1136
+ // comments-only check would report that PR as owing one it already carries.
1122
1137
  prCarriesWalkthrough: (prUrl, acceptsSkip) => {
1123
1138
  const rendered = runGh(["pr", "view", prUrl, "--json", "body,comments"]);
1124
1139
  if (rendered === null) return true;
@@ -1384,6 +1399,61 @@ function debugGateDecision(state, maxBlocks = MAX_DEBUG_BLOCKS, now = Date.now()
1384
1399
  function resolvePluginRoot(env = process.env) {
1385
1400
  return env.CLAUDE_PLUGIN_ROOT || env.CURSOR_PLUGIN_ROOT || dirname(dirname(fileURLToPath(import.meta.url)));
1386
1401
  }
1402
+ var SHELL_COMMAND_SEPARATOR = /[;&|\n]/;
1403
+ var SHELL_ESCAPABLE_UNQUOTED = /* @__PURE__ */ new Set([" ", " ", "'", '"', "\\", "$", ";", "&", "|", "\n"]);
1404
+ var SHELL_ESCAPABLE_DOUBLE_QUOTED = /* @__PURE__ */ new Set(['"', "\\", "$", "`"]);
1405
+ function splitShellCommands(command) {
1406
+ const commands = [];
1407
+ let words = [];
1408
+ let word = "";
1409
+ let wordStarted = false;
1410
+ let quote = null;
1411
+ const endWord = () => {
1412
+ if (wordStarted) words.push(word);
1413
+ word = "";
1414
+ wordStarted = false;
1415
+ };
1416
+ const endCommand = () => {
1417
+ endWord();
1418
+ if (words.length > 0) commands.push(words);
1419
+ words = [];
1420
+ };
1421
+ for (let index = 0; index < command.length; index += 1) {
1422
+ const character = command[index];
1423
+ const nextCharacter = command[index + 1];
1424
+ if (quote !== null) {
1425
+ if (character === quote) {
1426
+ quote = null;
1427
+ } else if (character === "\\" && quote === '"' && SHELL_ESCAPABLE_DOUBLE_QUOTED.has(nextCharacter)) {
1428
+ word += nextCharacter;
1429
+ index += 1;
1430
+ } else {
1431
+ word += character;
1432
+ }
1433
+ continue;
1434
+ }
1435
+ if (character === "'" || character === '"') {
1436
+ quote = character;
1437
+ wordStarted = true;
1438
+ } else if (character === "\\" && SHELL_ESCAPABLE_UNQUOTED.has(nextCharacter)) {
1439
+ word += nextCharacter;
1440
+ wordStarted = true;
1441
+ index += 1;
1442
+ } else if (SHELL_COMMAND_SEPARATOR.test(character)) {
1443
+ endCommand();
1444
+ } else if (/\s/.test(character)) {
1445
+ endWord();
1446
+ } else {
1447
+ word += character;
1448
+ wordStarted = true;
1449
+ }
1450
+ }
1451
+ endCommand();
1452
+ return commands;
1453
+ }
1454
+ function normalizeProgramName(programWord) {
1455
+ return basename(programWord.replaceAll("\\", "/")).toLowerCase().replace(/\.exe$/, "");
1456
+ }
1387
1457
 
1388
1458
  // src/guardrails/mandatoryStages.ts
1389
1459
  var FRONTMATTER = /^---\r?\n([\s\S]*?)\r?\n---/;
@@ -1393,8 +1463,6 @@ var STAGE_SKIP_MARKER = /^\s*echo\s+["']?MUGGLE_STAGE_SKIP\b/;
1393
1463
  var SKILLS_DIR_NAME = "skills";
1394
1464
  var SKILLS_PATH_SEGMENT = `/${SKILLS_DIR_NAME}/`;
1395
1465
  var SINGLE_PATH_SEGMENT = /^[A-Za-z0-9._-]+$/;
1396
- var SHELL_COMMAND_SEPARATOR = /[;&|\n]/;
1397
- var SHELL_ASSIGNMENT = /^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/s;
1398
1466
  var SHELL_VARIABLE_REFERENCE = /\$\{([A-Za-z_][A-Za-z0-9_]*)\}|\$([A-Za-z_][A-Za-z0-9_]*)/g;
1399
1467
  var WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]/;
1400
1468
  var MARKDOWN_FILE = /\.md$/i;
@@ -1477,57 +1545,6 @@ function applyStageRead(state, filePath) {
1477
1545
  if ((state.stagesRead ?? []).includes(stagePath)) return state;
1478
1546
  return { ...state, stagesRead: [...state.stagesRead ?? [], stagePath] };
1479
1547
  }
1480
- var SHELL_ESCAPABLE_UNQUOTED = /* @__PURE__ */ new Set([" ", " ", "'", '"', "\\", "$", ";", "&", "|", "\n"]);
1481
- var SHELL_ESCAPABLE_DOUBLE_QUOTED = /* @__PURE__ */ new Set(['"', "\\", "$", "`"]);
1482
- function splitShellCommands(command) {
1483
- const commands = [];
1484
- let words = [];
1485
- let word = "";
1486
- let wordStarted = false;
1487
- let quote = null;
1488
- const endWord = () => {
1489
- if (wordStarted) words.push(word);
1490
- word = "";
1491
- wordStarted = false;
1492
- };
1493
- const endCommand = () => {
1494
- endWord();
1495
- if (words.length > 0) commands.push(words);
1496
- words = [];
1497
- };
1498
- for (let index = 0; index < command.length; index += 1) {
1499
- const character = command[index];
1500
- const nextCharacter = command[index + 1];
1501
- if (quote !== null) {
1502
- if (character === quote) {
1503
- quote = null;
1504
- } else if (character === "\\" && quote === '"' && SHELL_ESCAPABLE_DOUBLE_QUOTED.has(nextCharacter)) {
1505
- word += nextCharacter;
1506
- index += 1;
1507
- } else {
1508
- word += character;
1509
- }
1510
- continue;
1511
- }
1512
- if (character === "'" || character === '"') {
1513
- quote = character;
1514
- wordStarted = true;
1515
- } else if (character === "\\" && SHELL_ESCAPABLE_UNQUOTED.has(nextCharacter)) {
1516
- word += nextCharacter;
1517
- wordStarted = true;
1518
- index += 1;
1519
- } else if (SHELL_COMMAND_SEPARATOR.test(character)) {
1520
- endCommand();
1521
- } else if (/\s/.test(character)) {
1522
- endWord();
1523
- } else {
1524
- word += character;
1525
- wordStarted = true;
1526
- }
1527
- }
1528
- endCommand();
1529
- return commands;
1530
- }
1531
1548
  function expandShellWord(word, variables) {
1532
1549
  const withHome = word === "~" || word.startsWith("~/") ? `${homedir()}${word.slice(1)}` : word;
1533
1550
  return withHome.replace(
@@ -1559,7 +1576,7 @@ function detectShellStageReads(command, cwd, env = process.env) {
1559
1576
  for (const [name, value] of assignments) variables[name] = value;
1560
1577
  continue;
1561
1578
  }
1562
- const program = basename(programWord.replaceAll("\\", "/")).toLowerCase().replace(/\.exe$/, "");
1579
+ const program = normalizeProgramName(programWord);
1563
1580
  const argumentWords = words.slice(programIndex + 1).map((word) => expandShellWord(word, variables));
1564
1581
  if (program === "cd") {
1565
1582
  const target = argumentWords.find((word) => !word.startsWith("-"));
@@ -1804,11 +1821,46 @@ function classificationGateDecision(state, input2) {
1804
1821
  }
1805
1822
 
1806
1823
  // src/guardrails/testsGreen.ts
1807
- var TEST_CMD = /\b(pnpm|npm|yarn)\s+(run\s+)?test\b|\b(jest|vitest|pytest)\b|\bgo\s+test\b|\bcargo\s+test\b/;
1808
1824
  var FAIL = /\b\d+\s+failed\b|\bFAIL\b|✗/;
1809
- var E2E_TOOL = /muggle.*(execute|test-generation|replay)/i;
1825
+ var TEST_SCRIPT = /^test(:|$)/;
1826
+ var GROUPING_BRACKETS = /^[({]+|[)}]+$/g;
1810
1827
  function isTestCommand(cmd) {
1811
- return TEST_CMD.test(cmd);
1828
+ return splitShellCommands(cmd).some(runsTestSuite);
1829
+ }
1830
+ function runsTestSuite(commandWords) {
1831
+ const words = commandWords.map((word) => word.replace(GROUPING_BRACKETS, "")).filter((word) => word.length > 0);
1832
+ const programIndex = words.findIndex((word) => !SHELL_ASSIGNMENT.test(word));
1833
+ if (programIndex < 0) return false;
1834
+ const program = normalizeProgramName(words[programIndex]);
1835
+ const argumentWords = words.slice(programIndex + 1);
1836
+ const operandIndex = argumentWords.findIndex((word) => !word.startsWith("-"));
1837
+ const operand = operandIndex < 0 ? void 0 : argumentWords[operandIndex];
1838
+ const afterOperand = operandIndex < 0 ? [] : argumentWords.slice(operandIndex + 1);
1839
+ if (TEST_RUNNER_PROGRAMS.includes(program)) return true;
1840
+ if (TEST_SUBCOMMAND_PROGRAMS.includes(program)) return operand === "test";
1841
+ if (PACKAGE_MANAGER_PROGRAMS.includes(program)) return runsPackageTestScript(operand, afterOperand);
1842
+ if (PACKAGE_RUNNER_PROGRAMS.includes(program)) return operand !== void 0 && runsTestSuite([operand, ...afterOperand]);
1843
+ if (program === "env") return runsTestSuite(argumentWords);
1844
+ if (program === "timeout") return runsTestSuite(afterOperand);
1845
+ if (program === "node") {
1846
+ const separatorIndex = argumentWords.indexOf("--");
1847
+ return separatorIndex >= 0 && runsTestSuite(argumentWords.slice(separatorIndex + 1));
1848
+ }
1849
+ if (PYTHON_PROGRAMS.includes(program)) {
1850
+ return argumentWords[0] === "-m" && TEST_RUNNER_PROGRAMS.includes(argumentWords[1] ?? "");
1851
+ }
1852
+ if (SCRIPT_SHELL_PROGRAMS.includes(program)) {
1853
+ const flagIndex = argumentWords.findIndex((word) => SCRIPT_SHELL_FLAGS.includes(word.toLowerCase()));
1854
+ const script = flagIndex < 0 ? void 0 : argumentWords[flagIndex + 1];
1855
+ return script !== void 0 && isTestCommand(script);
1856
+ }
1857
+ return false;
1858
+ }
1859
+ function runsPackageTestScript(subcommand, rest) {
1860
+ if (subcommand === void 0) return false;
1861
+ if (subcommand === "run") return TEST_SCRIPT.test(rest[0] ?? "");
1862
+ if (PACKAGE_EXEC_SUBCOMMANDS.includes(subcommand)) return runsTestSuite(rest.filter((word) => !word.startsWith("-")));
1863
+ return TEST_SCRIPT.test(subcommand) || TEST_RUNNER_PROGRAMS.includes(subcommand);
1812
1864
  }
1813
1865
  function testsPassed(input2) {
1814
1866
  const response = input2.tool_response;
@@ -1819,7 +1871,7 @@ ${response?.output ?? ""}`;
1819
1871
  return !FAIL.test(out);
1820
1872
  }
1821
1873
  function isE2ERun(input2) {
1822
- if (E2E_TOOL.test(input2.tool_name ?? "")) return true;
1874
+ if (MUGGLE_E2E_RUN_TOOL.test(input2.tool_name ?? "")) return true;
1823
1875
  return MUGGLE_SKILL_EMIT_TOOL.test(input2.tool_name ?? "") && input2.tool_input?.skillName === MUGGLE_TEST_SKILL_NAME;
1824
1876
  }
1825
1877
  function parseMaxCatchUpRebases(configuredValue) {
@@ -2422,12 +2474,30 @@ function deferredCommentIds(ledger, command) {
2422
2474
  var BUILD = /\b(implement|build|add|create|write|fix|refactor|wire up|hook up|make (a|the|it)|change the)\b/i;
2423
2475
  var DEVCYCLE = /\bresolve\b[^.?!]{0,40}\bconflicts?\b|\bget\b[^.?!]{0,40}\bpr\b[^.?!]{0,40}\b(green|merged?|passing)\b/i;
2424
2476
  var QUESTION = /^\s*(why|what|how|when|where|who|is|are|does|do|can you (explain|tell)|explain)\b/i;
2477
+ var SKILL_COMMAND = /^[/$](?:([\w-]+):)?([\w-]+)(?:\s+([\s\S]*))?$/;
2478
+ var MENU_ARGUMENTS = /^(help|menu|\?)?$/i;
2479
+ var CHANGE_URL = /https?:\/\/\S+\/(pull\/\d+|-\/merge_requests\/\d+)/i;
2480
+ var CHANGE_DIRECTIVE = /\b(address[\s-]reviews|fix[\s-]ci|rebase|resolve[\s-]conflicts)\b/i;
2481
+ var CLEANUP_DIRECTIVE = /\bcleanup\b/i;
2482
+ var SESSION_SLOT_ARGUMENT = /(^|\s)slug=\S/;
2425
2483
  function detectBuildIntent(prompt) {
2426
2484
  const p = (prompt ?? "").trim();
2427
2485
  if (!p || p.startsWith("/")) return false;
2428
2486
  if (QUESTION.test(p)) return false;
2429
2487
  return BUILD.test(p) || DEVCYCLE.test(p);
2430
2488
  }
2489
+ function isMuggleDoForwardInvocation(prompt) {
2490
+ const command = SKILL_COMMAND.exec((prompt ?? "").trim());
2491
+ if (!command) return false;
2492
+ const [, namespace, commandName, rawArguments] = command;
2493
+ if (namespace !== void 0 && namespace.toLowerCase() !== MUGGLE_PLUGIN_NAMESPACE) return false;
2494
+ if (!MUGGLE_DO_COMMAND_NAMES.includes(commandName.toLowerCase())) return false;
2495
+ const commandArguments = (rawArguments ?? "").trim();
2496
+ if (MENU_ARGUMENTS.test(commandArguments)) return false;
2497
+ const isChangeDirective = CHANGE_URL.test(commandArguments) && CHANGE_DIRECTIVE.test(commandArguments);
2498
+ const isCleanupDirective = CLEANUP_DIRECTIVE.test(commandArguments) && SESSION_SLOT_ARGUMENT.test(commandArguments);
2499
+ return !isChangeDirective && !isCleanupDirective;
2500
+ }
2431
2501
 
2432
2502
  // src/guardrails/reportGate.ts
2433
2503
  function looksLikeE2EReport(text) {
@@ -2948,11 +3018,14 @@ function resolveGate() {
2948
3018
  return denyTool(resolveVerdict.reason, host);
2949
3019
  }
2950
3020
  function buildRouter() {
2951
- if (!detectBuildIntent(input.prompt ?? "")) return "{}";
3021
+ const prompt = input.prompt ?? "";
3022
+ const isMuggleDoInvoked = isMuggleDoForwardInvocation(prompt);
3023
+ if (!isMuggleDoInvoked && !detectBuildIntent(prompt)) return "{}";
2952
3024
  const state = readState(sessionId);
2953
3025
  if (state.buildIntentRouted) return "{}";
2954
3026
  state.buildIntentRouted = true;
2955
3027
  writeState(state);
3028
+ if (isMuggleDoInvoked) return "{}";
2956
3029
  const ctx = `This looks like a build/implement/fix request. Per the autoRouteBuildToMuggleDo preference, route it through ${muggleSkill("/muggle-do")} \u2014 which runs requirements \u2192 build (delegated to superpowers' design\u2192plan\u2192review) \u2192 impact \u2192 unit tests \u2192 E2E \u2192 PR \u2192 watcher. If autoRouteBuildToMuggleDo=always, enter that flow; if =ask, offer it; if =never, proceed normally.`;
2957
3030
  return envelope("UserPromptSubmit", ctx, host);
2958
3031
  }
@@ -29,7 +29,7 @@ Read from `~/.muggle-ai/muggle-do/sessions/<slug>/`:
29
29
 
30
30
  ### Step 0 — Track the default branch
31
31
 
32
- Before assembling work, rebase onto the latest default branch so the cycle addresses reviews against current master, not a stale base. Run [`../_shared/sync-branch-with-base.md`](../_shared/sync-branch-with-base.md) — gated by [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), fires only when `behind > 0`. Conflict handling follows [`autoResolveConflicts`](../muggle-preferences/preference-gates/autoResolveConflicts.md): the default `never` aborts and escalates (`kind: "rebase-conflict"`); `always` resolves behind the verify-or-rollback gate. If the rebase escalates, stop the cycle — do not push, do not address reviews — but **skip to Step 6 to respawn the watcher**. Escalating the rebase does not end the PR; the poller must keep running (it will remind on the `conflict_escalated` block), so skipping respawn here is exactly the silent-stop bug [`respawn-watcher.md`](respawn-watcher.md) exists to prevent.
32
+ Before assembling work, rebase onto the latest default branch so the cycle addresses reviews against current master, not a stale base. Run [`../_shared/sync-branch-with-base.md`](../_shared/sync-branch-with-base.md) — gated by [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), fires only when `behind > 0`. Conflict handling follows [`autoResolveConflicts`](../muggle-preferences/preference-gates/autoResolveConflicts.md), resolved from the configured preference rather than an assumed default: `always` resolves behind the verify-or-rollback gate; `never` aborts and escalates (`kind: "rebase-conflict"`). If the rebase escalates, stop the cycle — do not push, do not address reviews — but **skip to Step 6 to respawn the watcher**. Escalating the rebase does not end the PR; the poller must keep running (it will remind on the `conflict_escalated` block), so skipping respawn here is exactly the silent-stop bug [`respawn-watcher.md`](respawn-watcher.md) exists to prevent.
33
33
 
34
34
  ### Step 1 — Assemble the work set
35
35
 
@@ -19,7 +19,7 @@ Pick the operation, then read its op file for the procedure.
19
19
  | "show preferences" / no args | `ops/list.md` |
20
20
  | "configure muggle" / "muggle setup" / change without naming a key | `ops/configure.md` |
21
21
  | "reset preferences" | `ops/reset.md` |
22
- | "LLM source" / use my own Anthropic key or a local model / who pays for local runs | `ops/llm-source.md` |
22
+ | "LLM source" / use my own Anthropic key, a local model, or my Claude Code / who pays for local runs | `ops/llm-source.md` |
23
23
  | Session context says first-run setup has not been run | `ops/onboard.md` |
24
24
 
25
25
  ## Shared context (all ops)
@@ -1,6 +1,6 @@
1
1
  # LLM source
2
2
 
3
- Who supplies the model for tests Studio runs on this computer: Muggle AI credit (default), the user's own Anthropic API key, or a local / self-hosted model. Cloud runs always use Muggle AI credit.
3
+ Who supplies the model for tests Studio runs on this computer: Muggle AI credit (default), the user's own Anthropic API key, a local / self-hosted model, or the user's own installed Claude Code. Cloud runs always use Muggle AI credit.
4
4
 
5
5
  The CLI owns the options, labels, and storage. Render what `muggle llm-source --json` returns — never hardcode labels, and never write `preferences.json` or the credentials file directly.
6
6
 
@@ -22,6 +22,7 @@ One `AskUserQuestion`: `header` = `header`, question text = `prompt` followed by
22
22
  | `muggle-credit` | `muggle llm-source --use muggle-credit` |
23
23
  | `local-model` | Ask in chat for the endpoint URL and the vision-capable model name (neither is secret), then `muggle llm-source --use local-model --base-url <url> --model <name>`. If the endpoint needs its own key, tell the user to run `muggle llm-source` in a terminal instead. |
24
24
  | `anthropic-api-key` | Do not run anything. Tell the user to run `muggle llm-source` in their own terminal and paste the key at the hidden prompt. |
25
+ | `claude-code` | `muggle llm-source --use claude-code`. The CLI asks Claude Code whether it is installed and signed in, and refuses the choice when it is not. On a refusal, relay the CLI's message: the user installs Claude Code from Anthropic or signs in by running `claude` in their own terminal, then picks this source again. Never start a Claude sign-in or read Claude Code's stored credentials. |
25
26
 
26
27
  ## Step 4 — confirm
27
28
 
@@ -1 +0,0 @@
1
- export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CheckoutFreshnessVerdict, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, HTML_VIEW_OFFER_LINE, LLM_CREDENTIALS_FILE_MODE, LLM_CREDENTIALS_FILE_NAME, LLM_SOURCE_HEADER, LLM_SOURCE_OPTIONS, LLM_SOURCE_OWNED_ENV_NAMES, LLM_SOURCE_PROMPT, LLM_SOURCE_SCOPE_NOTE, LlmSource, MASKED_API_KEY_PREFIX, MASKED_API_KEY_VISIBLE_CHARS, MAX_LISTED_INHERITED_COMMITS, ONBOARDING_BLANKET_OPTIONS, ONBOARDING_CHOICE_GROUPS, ONBOARDING_MAX_OFFERS, ONBOARDING_PRIMER_BULLETS, ONBOARDING_PRIMER_HEADLINE, ONBOARDING_TOGGLE_GROUPS, ONBOARDING_TOGGLE_PROMPT, ONBOARDING_UNSELECTED_TOGGLE_VALUE, OnboardingBlanketChoice, OnboardingGroupKind, PREFERENCES_FILE_NAME, PREFERENCES_PROJECT_DIR_NAME, PREFERENCES_SCHEMA, PREFERENCES_VERSION, PREFERENCE_ALLOWED_VALUES, PreferenceKey, PreferenceValue, ProjectPreferencesReconcileOutcome, RUN_SESSIONS_DIR_NAME, RUN_VIEW_DASHBOARD_LINK_LABEL, RunViewError, RuntimeTarget, SCREENSHOT_DIR_RELATIVE_PATH, SCREENSHOT_FILE_EXTENSION, StackCheckVerdict, StackClaimVerdict, StackMismatchKind, StackPortAction, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, applyLlmSourceSelection, applyOnboardingAnswers, assertDeviceCodeClientProvisioned, buildElectronAppChecksumsUrl, buildElectronAppDirName, buildElectronAppReleaseAssetUrl, buildElectronAppReleaseTag, buildLlmSourcePlan, buildOnboardingPlan, buildToolInputJsonSchema, calculateFileChecksum, checkServiceStack, claimServiceStack, completeOnboarding, createApiKeyWithToken, createChildLogger, decideStackClaim, decideStackReap, decideStackRelease, decideStackRunEnd, decideStackRunStart, deleteApiKeyData, deleteCredentials, describeLlmSourceStatus, describeStackMismatch, e2e_exports as e2e, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir2 as getDataDir, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports as localQa, markOnboardingCompleted, maskLlmApiKey, mcp_exports as mcp, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, e2e_exports as qa, readPreferencesMetadata, readRunView, readServiceStackStatus, reapServiceStack, reconcileProjectPreferences, recordOnboardingSkip, releaseServiceStack, renderRunViewHtml, renderRunViewText, resetConfig, resetLogger, resetPreference, resolveActiveProfile, resolveActiveReleaseStream, resolveActiveReleaseTagPrefix, resolveBlanketPreferences, resolveElectronAppExecutablePath, resolveElectronAppPathOrNull, resolveLlmSourceStatus, resolveOnboardingAnswers, resolvePreferences, resolveRunSessionPath, resolveRuntimeTarget, resolveTogglePreferences, runGitCommand, saveApiKey, saveApiKeyData, saveCredentials, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml } from './chunk-WRYPWI33.js';