@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
@@ -9,7 +9,7 @@
9
9
  "name": "muggleai",
10
10
  "source": "./plugin",
11
11
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
12
- "version": "5.27.0-staging.237"
12
+ "version": "5.27.0-staging.239"
13
13
  }
14
14
  ]
15
15
  }
package/README.md CHANGED
@@ -345,7 +345,7 @@ muggle serve --local # Local tools only (muggle-local-*)
345
345
 
346
346
  # Setup and diagnostics
347
347
  muggle init # Guided setup; saves preferences, offers the CI check
348
- muggle llm-source [--show] # Who supplies the model for local runs: Muggle AI credit, your Anthropic key, or a local model
348
+ muggle llm-source [--show] # Who supplies the model for local runs: Muggle AI credit, your Anthropic key, a local model, or your Claude Code
349
349
  muggle setup [--force] # Download or update the browser runner
350
350
  muggle upgrade [--check] # Install the latest runner version
351
351
  muggle versions # List installed runner versions
@@ -1,4 +1,4 @@
1
- import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, applyLlmSourceSelection, LlmSource, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl } from './chunk-WRYPWI33.js';
1
+ import { __export, getLogger, getConfig, createChildLogger, buildElectronAppReleaseAssetUrl, getActiveRuntimeTarget, getAuthService, hasApiKey, getElectronAppVersion, getElectronAppDir, getPlatformKey, reconcileProjectPreferences, getDataDir2, PREFERENCES_FILE_NAME, isFirstRun, writePreferences, DEFAULT_PREFERENCES, isElectronAppInstalled, getElectronAppChecksums, getChecksumForPlatform, getElectronAppSignedFromVersion, getReleaseSignerIdentityUri, verifyFileChecksum, resolveElectronAppExecutablePath, calculateFileChecksum, initTelemetry, Surface, ServiceName, track, EventName, getQaTools, getLocalQaTools, performLogout, assertDeviceCodeClientProvisioned, performLogin, getActiveElectronAppReleaseStream, buildToolInputJsonSchema, toolRequiresAuth, getCallerCredentials, parseElectronAppDirName, getElectronAppReleaseTagPrefix, hasShownDisclosure, markDisclosureShown, getBundledElectronAppVersion, getElectronAppVersionSource, getCredentialsFilePath, ElectronAppReleaseStream, buildElectronAppChecksumsUrl, __require, getDisclosureCopy, buildOnboardingPlan, applyOnboardingAnswers, needsOnboarding, buildLlmSourcePlan, describeLlmSourceStatus, resolveLlmSourceStatus, readRunView, RunViewError, renderRunViewText, writeRunViewHtml, openBrowserUrl, evaluateCheckoutFreshness, runGitCommand, BLOCKING_FRESHNESS_VERDICTS, claimServiceStack, BUSY_EXIT_CODE, checkServiceStack, releaseServiceStack, readServiceStackStatus, resolvePreferences, OnboardingBlanketChoice, PreferenceKey, LlmSource, applyLlmSourceSelection, describeStackMismatch, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl } from './chunk-FI6VHHZN.js';
2
2
  import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { ListToolsRequestSchema, CallToolRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema } from '@modelcontextprotocol/sdk/types.js';
4
4
  import { v4 } from 'uuid';
@@ -1054,7 +1054,7 @@ async function resolveGsScreenshotUrls(report, opts) {
1054
1054
  if (gsUrls.length === 0) {
1055
1055
  return report;
1056
1056
  }
1057
- const mcps = await import('./src-EEKJ2ZOK.js');
1057
+ const mcps = await import('./src-33XQK7NM.js');
1058
1058
  const credentials = await mcps.getCallerCredentialsAsync();
1059
1059
  if (!credentials.bearerToken && !credentials.apiKey) {
1060
1060
  stderrWrite(
@@ -2302,6 +2302,9 @@ var WATCH_LOCK_WAIT_MS = 6e4;
2302
2302
  var PR_WATCH_SLOTS_RELATIVE_PATH = ["muggle-do", "sessions"];
2303
2303
  var PR_POLLING_DISABLED_FILE = "polling.disabled";
2304
2304
  var WATCH_REGISTRATION_FILE = "watch-registration.json";
2305
+ var FOLLOWUP_LOG_FILE = "followup.log";
2306
+ var FOLLOWUP_LOG_ESCALATED_WORD = "escalated";
2307
+ var OWNER_ESCALATION_NOTE_MAX_CHARS = 200;
2305
2308
  var WATCH_REGISTRATION_SOURCE_CLI = "muggle-watch-cli";
2306
2309
  var MAX_ANCESTOR_HOPS = 8;
2307
2310
  var WATCH_NOTIFICATION_TITLE = "Muggle Watch";
@@ -2310,6 +2313,7 @@ var WATCH_FINDING_SEVERITY = {
2310
2313
  ["WATCHER_DEAD" /* WatcherDead */]: "alert" /* Alert */,
2311
2314
  ["WATCHER_DEAF" /* WatcherDeaf */]: "alert" /* Alert */,
2312
2315
  ["CI_FAILING" /* CiFailing */]: "alert" /* Alert */,
2316
+ ["AWAITING_OWNER" /* AwaitingOwner */]: "alert" /* Alert */,
2313
2317
  ["BASE_CONFLICT" /* BaseConflict */]: "alert" /* Alert */,
2314
2318
  ["BEHIND_BASE" /* BehindBase */]: "warning" /* Warning */,
2315
2319
  ["REVIEW_THREADS_UNRESOLVED" /* ReviewThreadsUnresolved */]: "warning" /* Warning */,
@@ -2776,7 +2780,7 @@ async function askLlmSourceSelection(prompter, plan, print = (line) => console.l
2776
2780
  return void 0;
2777
2781
  }
2778
2782
  const source = plan.options[pickedIndex].source;
2779
- if (source === "muggle-credit" /* MuggleCredit */) {
2783
+ if (source === "muggle-credit" /* MuggleCredit */ || source === "claude-code" /* ClaudeCode */) {
2780
2784
  return { source };
2781
2785
  }
2782
2786
  if (source === "anthropic-api-key" /* AnthropicApiKey */) {
@@ -2784,6 +2788,14 @@ async function askLlmSourceSelection(prompter, plan, print = (line) => console.l
2784
2788
  }
2785
2789
  return askLocalModelSelection(prompter, plan.current, print);
2786
2790
  }
2791
+ function applyLlmSourceSelectionOrKeep(selection) {
2792
+ try {
2793
+ console.log(`Saved. ${describeLlmSourceStatus(applyLlmSourceSelection(selection))}`);
2794
+ } catch (error) {
2795
+ console.log(error instanceof Error ? error.message : String(error));
2796
+ console.log(`Kept. ${describeLlmSourceStatus(resolveLlmSourceStatus())}`);
2797
+ }
2798
+ }
2787
2799
  async function runLlmSourceStep() {
2788
2800
  const prompter = createTerminalPrompter();
2789
2801
  try {
@@ -2792,7 +2804,7 @@ async function runLlmSourceStep() {
2792
2804
  console.log(`Kept. ${describeLlmSourceStatus(resolveLlmSourceStatus())}`);
2793
2805
  return;
2794
2806
  }
2795
- console.log(`Saved. ${describeLlmSourceStatus(applyLlmSourceSelection(selection))}`);
2807
+ applyLlmSourceSelectionOrKeep(selection);
2796
2808
  } finally {
2797
2809
  prompter.close();
2798
2810
  }
@@ -3071,7 +3083,7 @@ async function llmSourceCommand(options) {
3071
3083
  }
3072
3084
  if (!process.stdin.isTTY) {
3073
3085
  console.error(
3074
- "`muggle llm-source` needs an interactive terminal. Use `--show` to see the current source, or `--use muggle-credit` / `--use local-model --base-url <url> --model <name>` to set one."
3086
+ "`muggle llm-source` needs an interactive terminal. Use `--show` to see the current source, or `--use muggle-credit` / `--use claude-code` / `--use local-model --base-url <url> --model <name>` to set one."
3075
3087
  );
3076
3088
  process.exitCode = 1;
3077
3089
  return;
@@ -4701,6 +4713,9 @@ function mcpToolNamePattern(hyphenatedSource) {
4701
4713
  }
4702
4714
  mcpToolNamePattern("muggle-local-telemetry-skill-emit");
4703
4715
  mcpToolNamePattern("muggle-local-(execute-test-generation|execute-replay)");
4716
+ mcpToolNamePattern(
4717
+ "muggle-(local-execute-(test-generation|replay)|remote-workflow-start-test-script-replay)"
4718
+ );
4704
4719
  mcpToolNamePattern("muggle-local-telemetry-event-emit");
4705
4720
  mcpToolNamePattern("muggle-remote-user-feedback-create");
4706
4721
  var LOCK_POLL_INTERVAL_MS = 10;
@@ -4714,6 +4729,81 @@ var ProviderPrState = /* @__PURE__ */ ((ProviderPrState2) => {
4714
4729
  return ProviderPrState2;
4715
4730
  })(ProviderPrState || {});
4716
4731
 
4732
+ // src/pr-watch/constants.ts
4733
+ var REBASE_KEY_SEPARATOR = "..";
4734
+ var LAST_SEEN_FILE_NAME = "last_seen.json";
4735
+
4736
+ // src/pr-watch/attempts.ts
4737
+ function recordedCount(counts, key) {
4738
+ const recorded = counts?.[key];
4739
+ return typeof recorded === "number" && Number.isFinite(recorded) ? recorded : 0;
4740
+ }
4741
+ function rebaseAttemptsFor(lastSeenEntry, rebaseKey) {
4742
+ return recordedCount(lastSeenEntry.conflict_resolve_attempts, rebaseKey);
4743
+ }
4744
+ function ciFixAttemptsFor(lastSeenEntry, headSha) {
4745
+ return recordedCount(lastSeenEntry.ci_fix_attempts, headSha);
4746
+ }
4747
+ function isRebaseKeyAttempted(lastSeenEntry, rebaseKey) {
4748
+ return rebaseAttemptsFor(lastSeenEntry, rebaseKey) >= 1;
4749
+ }
4750
+ function isCiHeadAttempted(lastSeenEntry, headSha) {
4751
+ return ciFixAttemptsFor(lastSeenEntry, headSha) >= 1;
4752
+ }
4753
+ function isRebaseKeyEscalated(lastSeenEntry, rebaseKey) {
4754
+ return rebaseKey.includes(REBASE_KEY_SEPARATOR) && (lastSeenEntry.conflict_escalated_keys ?? []).includes(rebaseKey) && isRebaseKeyAttempted(lastSeenEntry, rebaseKey);
4755
+ }
4756
+ function isCiHeadEscalated(lastSeenEntry, headSha) {
4757
+ return (lastSeenEntry.ci_escalated_shas ?? []).includes(headSha) && isCiHeadAttempted(lastSeenEntry, headSha);
4758
+ }
4759
+ function readSlotText(filePath) {
4760
+ try {
4761
+ return readFileSync(filePath, "utf-8");
4762
+ } catch {
4763
+ return "";
4764
+ }
4765
+ }
4766
+ function asRecord(candidate) {
4767
+ return candidate !== null && typeof candidate === "object" && !Array.isArray(candidate) ? candidate : {};
4768
+ }
4769
+ function lastSeenEntryFor(lastSeenJson, prKey) {
4770
+ try {
4771
+ return asRecord(asRecord(JSON.parse(lastSeenJson))[prKey]);
4772
+ } catch {
4773
+ return {};
4774
+ }
4775
+ }
4776
+
4777
+ // src/watch/owner-escalation.ts
4778
+ function latestEscalationNote(followupLogLines, prNumber) {
4779
+ const prToken = new RegExp(`\\bpr=${prNumber}\\b`);
4780
+ for (let lineIndex = followupLogLines.length - 1; lineIndex >= 0; lineIndex--) {
4781
+ const logLine = followupLogLines[lineIndex];
4782
+ if (!prToken.test(logLine) || !logLine.includes(FOLLOWUP_LOG_ESCALATED_WORD)) continue;
4783
+ const note = logLine.replace(/^\S+\s+/, "").trim();
4784
+ return note.length > OWNER_ESCALATION_NOTE_MAX_CHARS ? `${note.slice(0, OWNER_ESCALATION_NOTE_MAX_CHARS - 1)}\u2026` : note;
4785
+ }
4786
+ return void 0;
4787
+ }
4788
+ function resolveOwnerEscalation(lastSeenJson, followupLogLines, pr, headSha) {
4789
+ const lastSeenEntry = lastSeenEntryFor(lastSeenJson, `${pr.repo}#${pr.number}`);
4790
+ const kinds = [];
4791
+ if (headSha !== void 0) {
4792
+ if (isCiHeadEscalated(lastSeenEntry, headSha)) kinds.push("ci" /* Ci */);
4793
+ const escalatedKeys = Array.isArray(lastSeenEntry.conflict_escalated_keys) ? lastSeenEntry.conflict_escalated_keys : [];
4794
+ const isConflictEscalated = escalatedKeys.some(
4795
+ (rebaseKey) => typeof rebaseKey === "string" && rebaseKey.startsWith(`${headSha}${REBASE_KEY_SEPARATOR}`) && isRebaseKeyEscalated(lastSeenEntry, rebaseKey)
4796
+ );
4797
+ if (isConflictEscalated) kinds.push("conflict" /* Conflict */);
4798
+ }
4799
+ if (Array.isArray(lastSeenEntry.escalated_review_ids) && lastSeenEntry.escalated_review_ids.length > 0) {
4800
+ kinds.push("reviews" /* Reviews */);
4801
+ }
4802
+ if (kinds.length === 0) return void 0;
4803
+ const note = latestEscalationNote(followupLogLines, pr.number);
4804
+ return note === void 0 ? { kinds } : { kinds, note };
4805
+ }
4806
+
4717
4807
  // src/watch/pr-status.ts
4718
4808
  function isTerminalPrState(state) {
4719
4809
  return state === "MERGED" /* Merged */ || state === "CLOSED" /* Closed */;
@@ -4798,6 +4888,7 @@ function assessWatchSlots(slots, processes, activeSessionIds, liveStatusesByUrl,
4798
4888
  const isOwnerSessionActive = slot.ownerSessionId === void 0 || activeSessionIds === null ? void 0 : activeSessionIds.has(slot.ownerSessionId);
4799
4889
  const watcher = resolveWatcherLiveness(loop, heartbeatAgeMs, isOwnerSessionActive, processes !== null);
4800
4890
  for (const pr of slot.openPrs) {
4891
+ const live = liveStatusesByUrl.get(pr.url);
4801
4892
  assessments.push({
4802
4893
  slug: slot.slug,
4803
4894
  slotDir: slot.slotDir,
@@ -4809,7 +4900,8 @@ function assessWatchSlots(slots, processes, activeSessionIds, liveStatusesByUrl,
4809
4900
  heartbeatAgeMs,
4810
4901
  ownerSessionId: slot.ownerSessionId,
4811
4902
  isOwnerSessionActive,
4812
- live: liveStatusesByUrl.get(pr.url)
4903
+ live,
4904
+ ownerEscalation: resolveOwnerEscalation(slot.lastSeenJson, slot.followupLogLines, pr, live?.headSha)
4813
4905
  });
4814
4906
  }
4815
4907
  }
@@ -4858,9 +4950,23 @@ function watcherFinding(assessment, subject) {
4858
4950
  }
4859
4951
  return void 0;
4860
4952
  }
4953
+ function awaitingOwnerMessage(assessment, escalation, head) {
4954
+ const owner = assessment.ownerSessionId === void 0 ? "no owner session" : `owner session ${shortSessionId(assessment.ownerSessionId)}`;
4955
+ const handedOver = `watcher escalated ${escalation.kinds.join(", ")} on ${head} to ${owner}; a decision waits on you`;
4956
+ return escalation.note ? `${handedOver} \u2014 ${escalation.note}` : handedOver;
4957
+ }
4861
4958
  function prStateFindings(assessment, live, subject) {
4862
4959
  const prFindings = [];
4863
4960
  const head = shortSha3(live.headSha);
4961
+ const escalation = assessment.ownerEscalation;
4962
+ if (escalation) {
4963
+ prFindings.push(finding(
4964
+ "AWAITING_OWNER" /* AwaitingOwner */,
4965
+ [assessment.pr.url, live.headSha, escalation.kinds.join("+")],
4966
+ subject,
4967
+ awaitingOwnerMessage(assessment, escalation, head)
4968
+ ));
4969
+ }
4864
4970
  if (live.ciRollup === "FAILURE" /* Failure */ || live.ciRollup === "ERROR" /* Error */) {
4865
4971
  prFindings.push(finding(
4866
4972
  "CI_FAILING" /* CiFailing */,
@@ -5606,7 +5712,9 @@ function readOpenWatchSlots(slotsDir) {
5606
5712
  ownerSessionId: optionalString(owner?.session_id),
5607
5713
  heartbeatMtimeMs: heartbeatMtimeMsOf(slotDir),
5608
5714
  isRegistered: existsSync(join(slotDir, WATCH_REGISTRATION_FILE)),
5609
- openPrs
5715
+ openPrs,
5716
+ lastSeenJson: readSlotText(join(slotDir, LAST_SEEN_FILE_NAME)),
5717
+ followupLogLines: readSlotText(join(slotDir, FOLLOWUP_LOG_FILE)).split(/\r?\n/)
5610
5718
  });
5611
5719
  }
5612
5720
  return slots;
@@ -5629,7 +5737,7 @@ function listOrNone(values) {
5629
5737
  return Array.isArray(values) && values.length > 0 ? values.join(", ") : "none";
5630
5738
  }
5631
5739
  function composeClosedOutResult(slotDir, pr, terminalState, at) {
5632
- const lastSeen = readJsonFile(join(slotDir, "last_seen.json"));
5740
+ const lastSeen = readJsonFile(join(slotDir, LAST_SEEN_FILE_NAME));
5633
5741
  const history = lastSeen?.[`${pr.repo}#${pr.number}`];
5634
5742
  return [
5635
5743
  `# Result \u2014 ${basename(slotDir)}`,
@@ -5657,7 +5765,7 @@ function closeOutWatchSlot(slotDir, pr, terminalState, now) {
5657
5765
  writeFileSync(prsPath, `${JSON.stringify(Array.isArray(prsJson) ? entries : entries[0], null, 2)}
5658
5766
  `);
5659
5767
  const at = now.toISOString().replace(/\.\d+Z$/, "Z");
5660
- appendFileSync(join(slotDir, "followup.log"), `${at} tick pr=${pr.number} terminal=${terminalState} closed-out-by=${SLOT_CLOSED_OUT_BY}
5768
+ appendFileSync(join(slotDir, FOLLOWUP_LOG_FILE), `${at} tick pr=${pr.number} terminal=${terminalState} closed-out-by=${SLOT_CLOSED_OUT_BY}
5661
5769
  `);
5662
5770
  const isSlotTerminal = entries.every(
5663
5771
  (entry) => typeof entry.state === "string" && TERMINAL_SLOT_PR_STATES.includes(entry.state.toLowerCase())
@@ -6004,7 +6112,9 @@ function createProgram() {
6004
6112
  program.name("muggle").description("Unified MCP server for Muggle AI \u2014 cloud E2E and local E2E testing").version(packageVersion);
6005
6113
  program.command("serve").description("Start the MCP server").option("--e2e", "Only enable cloud E2E tools (remote URLs; muggle-remote-* prefix)").option("--local", "Only enable local E2E tools (localhost; muggle-local-* prefix)").option("--stdio", "Use stdio transport (default)").action(serveCommand);
6006
6114
  program.command("init").description("Set up Muggle Test \u2014 explains how it works and saves your preferences").option("--json", "Emit the walkthrough as JSON instead of prompting").option("--apply <file>", "Apply answers from a JSON file").action(initCommand);
6007
- program.command("llm-source").description("Choose who supplies the model for local runs: Muggle AI credit, your Anthropic key, or a local model").option("--show", "Print the source in effect").option("--json", "Emit the question as JSON instead of prompting").option("--use <source>", "Set a source without prompting: muggle-credit, anthropic-api-key, local-model").option("--base-url <url>", "Endpoint URL, with --use local-model").option("--model <name>", "Model served at the endpoint, with --use local-model").action(llmSourceCommand);
6115
+ program.command("llm-source").description(
6116
+ "Choose who supplies the model for local runs: Muggle AI credit, your Anthropic key, a local model, or your Claude Code"
6117
+ ).option("--show", "Print the source in effect").option("--json", "Emit the question as JSON instead of prompting").option("--use <source>", "Set a source without prompting: muggle-credit, anthropic-api-key, local-model, claude-code").option("--base-url <url>", "Endpoint URL, with --use local-model").option("--model <name>", "Model served at the endpoint, with --use local-model").action(llmSourceCommand);
6008
6118
  program.command("setup").description("Download/update the Electron app for local testing").option("--force", "Force re-download even if already installed").action(setupCommand);
6009
6119
  program.command("upgrade").description("Check for and install the latest electron-app version").option("--force", "Force re-download even if already on latest").option("--check", "Check for updates only, don't download").option("--version <version>", "Download a specific version (e.g., 1.0.2)").action(upgradeCommand);
6010
6120
  program.command("versions").description("List installed electron-app versions").action(versionsCommand);
@@ -8,7 +8,7 @@ import { randomUUID } from 'crypto';
8
8
  import * as os4 from 'os';
9
9
  import { platform } from 'os';
10
10
  import winston from 'winston';
11
- import { execFile, exec, spawn } from 'child_process';
11
+ import { execFile, exec, spawn, spawnSync } from 'child_process';
12
12
  import axios, { AxiosError } from 'axios';
13
13
  import * as fs14 from 'fs/promises';
14
14
  import { z } from 'zod';
@@ -34,7 +34,14 @@ __export(src_exports, {
34
34
  BLOCKING_FRESHNESS_VERDICTS: () => BLOCKING_FRESHNESS_VERDICTS,
35
35
  BRANCH_CREATION_REFLOG_PREFIX: () => BRANCH_CREATION_REFLOG_PREFIX,
36
36
  BUSY_EXIT_CODE: () => BUSY_EXIT_CODE,
37
+ CLAUDE_CODE_AUTH_STATUS_ARGS: () => CLAUDE_CODE_AUTH_STATUS_ARGS,
38
+ CLAUDE_CODE_CHECK_TIMEOUT_MS: () => CLAUDE_CODE_CHECK_TIMEOUT_MS,
39
+ CLAUDE_CODE_EXECUTABLE: () => CLAUDE_CODE_EXECUTABLE,
40
+ CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE: () => CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE,
41
+ CLAUDE_CODE_SESSION_LINK_ENV_VARS: () => CLAUDE_CODE_SESSION_LINK_ENV_VARS,
42
+ CLAUDE_CODE_VERSION_ARGS: () => CLAUDE_CODE_VERSION_ARGS,
37
43
  CheckoutFreshnessVerdict: () => CheckoutFreshnessVerdict,
44
+ ClaudeCodeReadiness: () => ClaudeCodeReadiness,
38
45
  DEFAULT_LOCAL_LLM_BASE_URL: () => DEFAULT_LOCAL_LLM_BASE_URL,
39
46
  DEFAULT_PREFERENCES: () => DEFAULT_PREFERENCES,
40
47
  ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS: () => ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS,
@@ -2540,8 +2547,15 @@ var LlmSource = /* @__PURE__ */ ((LlmSource2) => {
2540
2547
  LlmSource2["MuggleCredit"] = "muggle-credit";
2541
2548
  LlmSource2["AnthropicApiKey"] = "anthropic-api-key";
2542
2549
  LlmSource2["LocalModel"] = "local-model";
2550
+ LlmSource2["ClaudeCode"] = "claude-code";
2543
2551
  return LlmSource2;
2544
2552
  })(LlmSource || {});
2553
+ var ClaudeCodeReadiness = /* @__PURE__ */ ((ClaudeCodeReadiness2) => {
2554
+ ClaudeCodeReadiness2["Ready"] = "ready";
2555
+ ClaudeCodeReadiness2["NotInstalled"] = "not-installed";
2556
+ ClaudeCodeReadiness2["SignedOut"] = "signed-out";
2557
+ return ClaudeCodeReadiness2;
2558
+ })(ClaudeCodeReadiness || {});
2545
2559
 
2546
2560
  // packages/mcps/src/shared/llm-source/llm-source-constants.ts
2547
2561
  var LLM_SOURCE_OWNED_ENV_NAMES = [
@@ -2570,8 +2584,31 @@ var LLM_SOURCE_OPTIONS = [
2570
2584
  source: "local-model" /* LocalModel */,
2571
2585
  label: "A local or self-hosted model",
2572
2586
  description: "Any OpenAI-compatible endpoint serving a vision model (Ollama, LM Studio, vLLM). No Muggle AI credit is used."
2587
+ },
2588
+ {
2589
+ source: "claude-code" /* ClaudeCode */,
2590
+ label: "Your Claude Code",
2591
+ description: "Muggle's designated models through your installed, signed-in Claude Code. Your Claude plan's limits apply; no Muggle AI credit is used."
2573
2592
  }
2574
2593
  ];
2594
+ var CLAUDE_CODE_EXECUTABLE = "claude";
2595
+ var CLAUDE_CODE_VERSION_ARGS = ["--version"];
2596
+ var CLAUDE_CODE_AUTH_STATUS_ARGS = ["auth", "status"];
2597
+ var CLAUDE_CODE_CHECK_TIMEOUT_MS = 3e4;
2598
+ var CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE = "ENOENT";
2599
+ var CLAUDE_CODE_SESSION_LINK_ENV_VARS = [
2600
+ "CLAUDECODE",
2601
+ "CLAUDE_CODE_ENTRYPOINT",
2602
+ "CLAUDE_CODE_CHILD_SESSION",
2603
+ "CLAUDE_CODE_SESSION_ID",
2604
+ "CLAUDE_CODE_BRIDGE_SESSION_ID",
2605
+ "CLAUDE_CODE_MESSAGING_SOCKET",
2606
+ "CLAUDE_CODE_MESSAGING_TOKEN",
2607
+ "CLAUDE_CODE_SESSION_ATTENDED",
2608
+ "CLAUDE_CODE_AGENT",
2609
+ "CLAUDE_CODE_SSE_PORT",
2610
+ "CLAUDE_PID"
2611
+ ];
2575
2612
  var DEFAULT_LOCAL_LLM_BASE_URL = "http://localhost:11434/v1";
2576
2613
  var MASKED_API_KEY_VISIBLE_CHARS = 4;
2577
2614
  var MASKED_API_KEY_PREFIX = "\u2026";
@@ -10838,6 +10875,45 @@ function applyOnboardingAnswers(answers, dataDirOverride2, now = /* @__PURE__ */
10838
10875
  completeOnboarding(prefs, dataDirOverride2, now);
10839
10876
  return { isCompleted: true, preferences: prefs };
10840
10877
  }
10878
+ function buildClaudeCodeEnv(parentEnv) {
10879
+ const childEnv = { ...parentEnv };
10880
+ for (const sessionLinkVar of CLAUDE_CODE_SESSION_LINK_ENV_VARS) {
10881
+ delete childEnv[sessionLinkVar];
10882
+ }
10883
+ return childEnv;
10884
+ }
10885
+ function runClaudeCodeCommand(args) {
10886
+ const completed = spawnSync(CLAUDE_CODE_EXECUTABLE, [...args], {
10887
+ encoding: "utf-8",
10888
+ env: buildClaudeCodeEnv(process.env),
10889
+ timeout: CLAUDE_CODE_CHECK_TIMEOUT_MS,
10890
+ windowsHide: true
10891
+ });
10892
+ return {
10893
+ exitCode: completed.status,
10894
+ stdout: completed.stdout ?? "",
10895
+ spawnErrorCode: completed.error?.code
10896
+ };
10897
+ }
10898
+ function isSignedIn(authStatusOutput) {
10899
+ try {
10900
+ return JSON.parse(authStatusOutput).loggedIn === true;
10901
+ } catch {
10902
+ return false;
10903
+ }
10904
+ }
10905
+ function checkClaudeCodeReadiness(runClaudeCode = runClaudeCodeCommand) {
10906
+ const versionResult = runClaudeCode(CLAUDE_CODE_VERSION_ARGS);
10907
+ if (versionResult.spawnErrorCode === CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE || versionResult.exitCode !== 0) {
10908
+ return { readiness: "not-installed" /* NotInstalled */ };
10909
+ }
10910
+ const installedVersion = versionResult.stdout.trim();
10911
+ const authStatusResult = runClaudeCode(CLAUDE_CODE_AUTH_STATUS_ARGS);
10912
+ return {
10913
+ readiness: isSignedIn(authStatusResult.stdout) ? "ready" /* Ready */ : "signed-out" /* SignedOut */,
10914
+ installedVersion
10915
+ };
10916
+ }
10841
10917
 
10842
10918
  // packages/mcps/src/shared/llm-source/llm-source-service.ts
10843
10919
  function readLlmEnvBlock(dataDirOverride2) {
@@ -10868,6 +10944,9 @@ function resolveLlmSourceStatus(dataDirOverride2) {
10868
10944
  if (llmEnv["MUGGLE_LLM_PROVIDER" /* Provider */] === "anthropic" /* Anthropic */ && maskedApiKey) {
10869
10945
  return { source: "anthropic-api-key" /* AnthropicApiKey */, maskedApiKey };
10870
10946
  }
10947
+ if (llmEnv["MUGGLE_LLM_PROVIDER" /* Provider */] === "claude-code" /* ClaudeCode */) {
10948
+ return { source: "claude-code" /* ClaudeCode */ };
10949
+ }
10871
10950
  if (llmEnv["MUGGLE_LLM_PROVIDER" /* Provider */] === "local" /* Local */) {
10872
10951
  return {
10873
10952
  source: "local-model" /* LocalModel */,
@@ -10900,6 +10979,19 @@ function describeLlmSourceStatus(status) {
10900
10979
  }
10901
10980
  return `LLM source: ${label}`;
10902
10981
  }
10982
+ function assertClaudeCodeReady() {
10983
+ const readinessReport = checkClaudeCodeReadiness();
10984
+ if (readinessReport.readiness === "not-installed" /* NotInstalled */) {
10985
+ throw new Error(
10986
+ "Claude Code is not installed: no working `claude` executable is on the PATH. Install Claude Code from Anthropic, sign in by running `claude`, then choose this source again."
10987
+ );
10988
+ }
10989
+ if (readinessReport.readiness === "signed-out" /* SignedOut */) {
10990
+ throw new Error(
10991
+ `Claude Code ${readinessReport.installedVersion} is not signed in. Sign in by running \`claude\` and following its sign-in, then choose this source again.`
10992
+ );
10993
+ }
10994
+ }
10903
10995
  function assertValidSelection(selection) {
10904
10996
  if (selection.source === "anthropic-api-key" /* AnthropicApiKey */ && !selection.apiKey?.trim()) {
10905
10997
  throw new Error("An Anthropic API key is required for this source.");
@@ -10912,6 +11004,9 @@ function assertValidSelection(selection) {
10912
11004
  throw new Error("A local model needs the model name the endpoint serves.");
10913
11005
  }
10914
11006
  }
11007
+ if (selection.source === "claude-code" /* ClaudeCode */) {
11008
+ assertClaudeCodeReady();
11009
+ }
10915
11010
  }
10916
11011
  function applyLlmSourceSelection(selection, dataDirOverride2) {
10917
11012
  assertValidSelection(selection);
@@ -10925,6 +11020,11 @@ function applyLlmSourceSelection(selection, dataDirOverride2) {
10925
11020
  writeLlmEnvBlock({ ["MUGGLE_LLM_PROVIDER" /* Provider */]: "anthropic" /* Anthropic */ }, dataDirOverride2);
10926
11021
  return resolveLlmSourceStatus(dataDirOverride2);
10927
11022
  }
11023
+ if (selection.source === "claude-code" /* ClaudeCode */) {
11024
+ writeLlmEnvBlock({ ["MUGGLE_LLM_PROVIDER" /* Provider */]: "claude-code" /* ClaudeCode */ }, dataDirOverride2);
11025
+ deleteStoredLlmApiKey(dataDirOverride2);
11026
+ return resolveLlmSourceStatus(dataDirOverride2);
11027
+ }
10928
11028
  const userTuning = Object.fromEntries(
10929
11029
  Object.entries(readLlmEnvBlock(dataDirOverride2)).filter(([name]) => !LLM_SOURCE_OWNED_ENV_NAMES.includes(name))
10930
11030
  );
@@ -10946,4 +11046,4 @@ function applyLlmSourceSelection(selection, dataDirOverride2) {
10946
11046
  return resolveLlmSourceStatus(dataDirOverride2);
10947
11047
  }
10948
11048
 
10949
- 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, EventName, 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, ServiceName, StackCheckVerdict, StackClaimVerdict, StackMismatchKind, StackPortAction, Surface, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, __export, __require, 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_exports2 as e2e_exports, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir, getDataDir2, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, markOnboardingCompleted, maskLlmApiKey, mcp_exports, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, 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, src_exports, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml };
11049
+ export { ACTION_SCRIPT_FILE_NAME, BASE_REMOTE_NAME, BLOCKING_FRESHNESS_VERDICTS, BRANCH_CREATION_REFLOG_PREFIX, BUSY_EXIT_CODE, CLAUDE_CODE_AUTH_STATUS_ARGS, CLAUDE_CODE_CHECK_TIMEOUT_MS, CLAUDE_CODE_EXECUTABLE, CLAUDE_CODE_EXECUTABLE_NOT_FOUND_CODE, CLAUDE_CODE_SESSION_LINK_ENV_VARS, CLAUDE_CODE_VERSION_ARGS, CheckoutFreshnessVerdict, ClaudeCodeReadiness, DEFAULT_LOCAL_LLM_BASE_URL, DEFAULT_PREFERENCES, ELECTRON_APP_EXECUTABLE_PATH_SEGMENTS, ElectronAppPlatform, ElectronAppReleaseStream, EventName, 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, ServiceName, StackCheckVerdict, StackClaimVerdict, StackMismatchKind, StackPortAction, Surface, WATCHER_LIFETIME_SECONDS, WATCHER_LIFETIME_UNBOUNDED_SECONDS, __export, __require, 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_exports2 as e2e_exports, evaluateCheckoutFreshness, findVacatedNeeds, finishStackRun, formatPreferencesOneLiner, getActiveElectronAppReleaseStream, getActiveRuntimeTarget, getApiKey, getApiKeyFilePath, getAuthService, getBundledElectronAppVersion, getCallerCredentials, getCallerCredentialsAsync, getChecksumForPlatform, getConfig, getCredentialsFilePath, getDashboardBaseUrl, getDataDir, getDataDir2, getDisclosureCopy, getDownloadBaseUrl, getElectronAppChecksums, getElectronAppDir, getElectronAppReleaseTagPrefix, getElectronAppSignedFromVersion, getElectronAppVersion, getElectronAppVersionSource, getLlmSourceOption, getLocalQaTools, getLogger, getOnboardingToggleKeys, getPlatformKey, getQaTools, getReleaseSignerIdentityUri, getRunSessionsDir, getValidApiKeyData, getValidCredentials, hasApiKey, hasShownDisclosure, initTelemetry, isElectronAppInstalled, isElectronAppPlatform, isFirstRun, isValidLocalBaseUrl, loadApiKeyData, loadCredentials, local_exports2 as local_exports, markDisclosureShown, markOnboardingCompleted, maskLlmApiKey, mcp_exports, needsConflict, needsOnboarding, openBrowserUrl, parseElectronAppDirName, performLogin, performLogout, pollDeviceCode, portOfUrl, 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, src_exports, startDeviceCodeFlow, startStackRun, stopVacatedServices, toDisplayRef, toolRequiresAuth, track, validatePreference, verifyFileChecksum, writeLlmEnvBlock, writePreferences, writePreferencesWithMetadata, writeRunViewHtml };
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-GCWJMRYJ.js';
3
- import './chunk-WRYPWI33.js';
2
+ import { runCli } from './chunk-EK5DJBSY.js';
3
+ import './chunk-FI6VHHZN.js';
4
4
 
5
5
  // src/cli/main.ts
6
6
  runCli().catch((error) => {
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-GCWJMRYJ.js';
2
- export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-WRYPWI33.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-EK5DJBSY.js';
2
+ export { createChildLogger, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, src_exports as shared } from './chunk-FI6VHHZN.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
4
- "version": "5.27.0-staging.237",
4
+ "version": "5.27.0-staging.239",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.27.0-staging.237",
7
+ "@muggleai/works@5.27.0-staging.239",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.27.0-staging.237",
3
+ "version": "5.27.0-staging.239",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
5
  "author": {
6
6
  "name": "Muggle AI",
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Real-browser E2E acceptance for your coding agent: test the flows you changed and open the PR with screenshots. Built for flows other tools can't reach: managed test identities with live inboxes (magic links, email OTP and 2FA, verification mail, password resets), an encrypted secret store for login and test credentials, and a test graph that runs prerequisite flows first. Plain-English tests become replayable scripts on localhost or preview URLs.",
5
- "version": "5.27.0-staging.237",
5
+ "version": "5.27.0-staging.239",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -4,7 +4,7 @@
4
4
  "command": "npx",
5
5
  "args": [
6
6
  "-y",
7
- "@muggleai/works@5.27.0-staging.237",
7
+ "@muggleai/works@5.27.0-staging.239",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -57,7 +57,7 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
57
57
  | `Stop` | `guardrail-debug-path-gate.sh` | **enforce** | a local execution returned a non-passing run this session and nothing routed it through `_shared/debug-failed-run.md` | — | **block** the turn until the run is diagnosed (its `*-failure-classified` emit or feedback naming it) or a `MUGGLE_DEBUG_SKIP: <runId> <reason>` marker clears that run (releases after 3 blocks). Quiet while a background acceptance-tester is in flight — its failed runs land in this session's state and it debugs them itself |
58
58
  | `Stop` | `guardrail-comment-reply-gate.sh` | **enforce** | this session claimed a review thread and left one of its comments uncovered | — | **block** the turn until each comment gets its threaded reply per `do/per-comment-replies.md` or a `MUGGLE_REPLY_SKIP: <comment-id> <reason>` marker defers it (releases after 3 blocks). The claim is the signal, not a push, so a round that answers a question with no code change is caught too; a thread another session claimed never blocks this one |
59
59
  | `Stop` | `guardrail-capability-claim.sh` | **enforce** | the closing turn tells the user a login- or code-gated flow can't be tested, reached, or verified | — | **block** once, citing `_shared/identity-and-inbox.md`: the managed profile's live inbox, provisioned number, stored TOTP secret, credentials, and CAPTCHA solver clear exactly that blocker. Reads the claim out of the transcript, since a Stop payload carries no message text. Per-sentence matching, and a sentence naming a voice call, an OAuth-only provider, or a deployment with no number provisioned never fires — those limits are real. Nudges once per session, then stays quiet, so a misread costs one turn |
60
- | `UserPromptSubmit` | `guardrail-build-router.sh` | advise | a build/implement/fix request (first one this session) | `autoRouteBuildToMuggleDo` | route the work through `muggle-do` (build delegated to superpowers) |
60
+ | `UserPromptSubmit` | `guardrail-build-router.sh` | advise | a build/implement/fix request (first one this session), or a direct `/muggle-do` / `/mdo` forward invocation | `autoRouteBuildToMuggleDo` | route the work through `muggle-do` (build delegated to superpowers); a direct invocation gets no advice. Either arms the build follow-through Stop gate |
61
61
 
62
62
  ## Codex
63
63
 
@@ -2,8 +2,9 @@
2
2
  set -uo pipefail
3
3
 
4
4
  # build-followthrough gate (Stop). When the front-door router took a
5
- # build/implement/fix prompt this session but no PR was ever opened, block the
6
- # turn end and point at /muggle-do (or the MUGGLE_BUILD_SKIP escape hatch). The
5
+ # build/implement/fix prompt or a direct /muggle-do invocation this session but
6
+ # no PR was ever opened, block the turn end and point at /muggle-do (or the
7
+ # MUGGLE_BUILD_SKIP escape hatch). The
7
8
  # router's offer is advisory and a session that finds the root cause can still
8
9
  # end without shipping it — the fix then lives only in a transcript that dies
9
10
  # with the session, and no other gate catches it: the watcher gate only fires on
@@ -3,13 +3,16 @@ set -uo pipefail
3
3
 
4
4
  # Front-door router (UserPromptSubmit). On the first build/implement/fix prompt
5
5
  # of a session, offers to route the work through /muggle-do (build delegated to
6
- # superpowers), gated by autoRouteBuildToMuggleDo. Fires once per session.
6
+ # superpowers), gated by autoRouteBuildToMuggleDo. A direct /muggle-do or /mdo
7
+ # invocation gets no offer but arms the build follow-through gate the same way.
8
+ # Fires once per session.
7
9
  #
8
10
  # Node cold-start (spawn + module load) stalls the turn on a loaded box, and this
9
11
  # hook runs on EVERY prompt. A cheap in-shell keyword pre-filter mirrors the build
10
12
  # verbs guardrails.mjs looks for, so the vast majority of prompts (questions,
11
13
  # status checks, chit-chat) never spawn Node. Node runs only on a keyword hit,
12
- # then applies the real detectBuildIntent logic (question/slash exclusions,
14
+ # then applies the real detectBuildIntent and isMuggleDoForwardInvocation logic
15
+ # (question/slash exclusions, muggle-do's menu and watcher directives,
13
16
  # once-per-session dedupe). Over-matching here only costs an occasional needless
14
17
  # spawn; it can never emit a spurious offer. Degrades to {} so it never blocks.
15
18
  #
@@ -27,7 +30,7 @@ guardrail_wants() {
27
30
  if guardrail_load_state && guardrail_state_has '"buildIntentRouted": true'; then
28
31
  return 1
29
32
  fi
30
- guardrail_fields_match prompt '(implement|build|add|create|write|fix|refactor|wire up|hook up|make|change the|conflict|merged|passing|green)'
33
+ guardrail_fields_match prompt '(implement|build|add|create|write|fix|refactor|wire up|hook up|make|change the|conflict|merged|passing|green|[/$](muggle:)?(muggle-do|mdo))'
31
34
  }
32
35
 
33
36
  if guardrail_is_hook_script; then