@muggleai/works 5.26.0-staging.221 → 5.26.0-staging.223

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 (74) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-NFS44KNQ.js → chunk-32I7VRZ7.js} +57 -12
  3. package/dist/{chunk-45WV6RS5.js → chunk-OC6K3BQ6.js} +2 -2
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.codex-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/hooks/README.md +5 -1
  12. package/dist/plugin/hooks/hooks.json +16 -16
  13. package/dist/plugin/scripts/guardrail-build-followthrough-gate.sh +1 -1
  14. package/dist/plugin/scripts/guardrail-build-router.sh +1 -1
  15. package/dist/plugin/scripts/guardrail-capability-claim.sh +1 -1
  16. package/dist/plugin/scripts/guardrail-classify-gate.sh +1 -1
  17. package/dist/plugin/scripts/guardrail-comment-reply-gate.sh +1 -1
  18. package/dist/plugin/scripts/guardrail-debug-path-gate.sh +1 -1
  19. package/dist/plugin/scripts/guardrail-e2e-gate.sh +1 -1
  20. package/dist/plugin/scripts/guardrail-lib.sh +6 -0
  21. package/dist/plugin/scripts/guardrail-offer-ran.sh +1 -1
  22. package/dist/plugin/scripts/guardrail-pr-opened.sh +1 -1
  23. package/dist/plugin/scripts/guardrail-pr-terminal.sh +1 -1
  24. package/dist/plugin/scripts/guardrail-record-comment-replies.sh +1 -1
  25. package/dist/plugin/scripts/guardrail-record-delegation.sh +1 -1
  26. package/dist/plugin/scripts/guardrail-record-stage-read.sh +1 -1
  27. package/dist/plugin/scripts/guardrail-record-stage-signals.sh +1 -1
  28. package/dist/plugin/scripts/guardrail-record-tests.sh +1 -1
  29. package/dist/plugin/scripts/guardrail-report-format.sh +1 -1
  30. package/dist/plugin/scripts/guardrail-resolve-gate.sh +1 -1
  31. package/dist/plugin/scripts/guardrail-skill-stages.sh +1 -1
  32. package/dist/plugin/scripts/guardrail-stage-gate.sh +1 -1
  33. package/dist/plugin/scripts/guardrail-terminal-gate.sh +1 -1
  34. package/dist/plugin/scripts/guardrail-walkthrough-gate.sh +1 -1
  35. package/dist/plugin/scripts/guardrail-walkthrough-heading.sh +1 -1
  36. package/dist/plugin/scripts/guardrail-watch-follow-through-gate.sh +1 -1
  37. package/dist/plugin/scripts/guardrail-watch-gate.sh +1 -1
  38. package/dist/plugin/scripts/hook-entry.sh +23 -0
  39. package/dist/release-manifest.json +3 -3
  40. package/dist/{src-HALLVP7O.js → src-ZAGX3JLC.js} +1 -1
  41. package/package.json +1 -1
  42. package/plugin/.claude-plugin/plugin.json +1 -1
  43. package/plugin/.codex-mcp.json +1 -1
  44. package/plugin/.codex-plugin/plugin.json +1 -1
  45. package/plugin/.cursor-plugin/plugin.json +1 -1
  46. package/plugin/.mcp.json +1 -1
  47. package/plugin/hooks/README.md +5 -1
  48. package/plugin/hooks/hooks.json +16 -16
  49. package/plugin/scripts/guardrail-build-followthrough-gate.sh +1 -1
  50. package/plugin/scripts/guardrail-build-router.sh +1 -1
  51. package/plugin/scripts/guardrail-capability-claim.sh +1 -1
  52. package/plugin/scripts/guardrail-classify-gate.sh +1 -1
  53. package/plugin/scripts/guardrail-comment-reply-gate.sh +1 -1
  54. package/plugin/scripts/guardrail-debug-path-gate.sh +1 -1
  55. package/plugin/scripts/guardrail-e2e-gate.sh +1 -1
  56. package/plugin/scripts/guardrail-lib.sh +6 -0
  57. package/plugin/scripts/guardrail-offer-ran.sh +1 -1
  58. package/plugin/scripts/guardrail-pr-opened.sh +1 -1
  59. package/plugin/scripts/guardrail-pr-terminal.sh +1 -1
  60. package/plugin/scripts/guardrail-record-comment-replies.sh +1 -1
  61. package/plugin/scripts/guardrail-record-delegation.sh +1 -1
  62. package/plugin/scripts/guardrail-record-stage-read.sh +1 -1
  63. package/plugin/scripts/guardrail-record-stage-signals.sh +1 -1
  64. package/plugin/scripts/guardrail-record-tests.sh +1 -1
  65. package/plugin/scripts/guardrail-report-format.sh +1 -1
  66. package/plugin/scripts/guardrail-resolve-gate.sh +1 -1
  67. package/plugin/scripts/guardrail-skill-stages.sh +1 -1
  68. package/plugin/scripts/guardrail-stage-gate.sh +1 -1
  69. package/plugin/scripts/guardrail-terminal-gate.sh +1 -1
  70. package/plugin/scripts/guardrail-walkthrough-gate.sh +1 -1
  71. package/plugin/scripts/guardrail-walkthrough-heading.sh +1 -1
  72. package/plugin/scripts/guardrail-watch-follow-through-gate.sh +1 -1
  73. package/plugin/scripts/guardrail-watch-gate.sh +1 -1
  74. package/plugin/scripts/hook-entry.sh +23 -0
@@ -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.26.0-staging.221"
12
+ "version": "5.26.0-staging.223"
13
13
  }
14
14
  ]
15
15
  }
@@ -9002,8 +9002,8 @@ var ExecuteTestGenerationInputSchema = z.object({
9002
9002
  baseBranch: z.string().min(1).optional().describe("Base branch if not origin's default (e.g. a stacked parent)."),
9003
9003
  /** Optional timeout. */
9004
9004
  timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds (default: 300000 = 5 min)"),
9005
- /** Show the electron-app UI during execution. Default: visible window. Pass false to run headless. */
9006
- showUi: z.boolean().optional().describe("Show the electron-app UI during generation. Defaults to visible; pass false to run headless."),
9005
+ /** Show the electron-app UI during execution; the showElectronBrowser preference wins when it is always or never. */
9006
+ showUi: z.boolean().optional().describe("Show the electron-app UI during generation. Ignored when the user's showElectronBrowser preference is always (shown) or never (headless); under ask it defaults to visible and false runs headless."),
9007
9007
  /** Clear all session storage (cookies, localStorage, etc.) before execution. Use for test cases that require a clean browser state, such as registration, login, or cookie consent flows. */
9008
9008
  freshSession: z.boolean().optional().describe("Clear all session storage (cookies, localStorage, etc.) before execution. Use for test cases that require a clean browser state \u2014 e.g. registration, login, or cookie consent flows. Default: the test case's stored alwaysStartsFreshSession flag (false when unset)."),
9009
9009
  /** Mutation parameters providing variable context for this generation run — a string[] where each element is a plain-English instruction or a local file path for uploads (e.g. "Attach the image at C:\\Users\\user\\photo.jpg"). Matches the electron-app's string[] mutation file format. */
@@ -9030,8 +9030,8 @@ var ExecuteReplayInputSchema = z.object({
9030
9030
  baseBranch: z.string().min(1).optional().describe("Base branch if not origin's default (e.g. a stacked parent)."),
9031
9031
  /** Optional timeout. */
9032
9032
  timeoutMs: z.number().int().positive().optional().describe("Timeout in milliseconds (default: 180000 = 3 min)"),
9033
- /** Show the electron-app UI during execution. Default: visible window. Pass false to run headless. */
9034
- showUi: z.boolean().optional().describe("Show the electron-app UI during replay. Defaults to visible; pass false to run headless."),
9033
+ /** Show the electron-app UI during execution; the showElectronBrowser preference wins when it is always or never. */
9034
+ showUi: z.boolean().optional().describe("Show the electron-app UI during replay. Ignored when the user's showElectronBrowser preference is always (shown) or never (headless); under ask it defaults to visible and false runs headless."),
9035
9035
  /** Whether the replay starts from an emptied browser session, copied from the recording. */
9036
9036
  freshSession: z.boolean().optional().describe("Copy actionParams.freshSession from muggle-remote-action-script-get so the replay starts as recorded: true clears all session storage (cookies, localStorage) first. Absent there (an older recording): true only for clean-state tests (registration, login, cookie consent). Default: false."),
9037
9037
  /** Mutation parameters passed to the LLM step predictor — a string[] where each element is an instruction describing what varies this run. Supports plain-English instructions (e.g. "The post content should be 'Hello world'") and local file paths for uploads (e.g. "Attach the image at C:\\Users\\user\\photo.jpg"). Matches the electron-app's string[] mutation file format. When provided, the electron app uses LLM-driven step prediction instead of deterministic replay. */
@@ -9266,6 +9266,45 @@ async function findStackChangedDuringRun(params) {
9266
9266
  return report.verdict === "STALE" /* Stale */ ? report : null;
9267
9267
  }
9268
9268
 
9269
+ // packages/mcps/src/mcp/local/services/electron-browser-visibility.ts
9270
+ function resolveElectronBrowserVisibility(params) {
9271
+ const isBrowserShown = decideIsBrowserShown(params);
9272
+ return {
9273
+ isBrowserShown,
9274
+ isCallerOverridden: params.requestedShowUi !== void 0 && params.requestedShowUi !== isBrowserShown,
9275
+ showElectronBrowserPreference: params.showElectronBrowserPreference
9276
+ };
9277
+ }
9278
+ function resolveElectronBrowserVisibilityFromPreferences(params) {
9279
+ return resolveElectronBrowserVisibility({
9280
+ requestedShowUi: params.requestedShowUi,
9281
+ showElectronBrowserPreference: resolvePreferences()["showElectronBrowser" /* ShowElectronBrowser */]
9282
+ });
9283
+ }
9284
+ function decideIsBrowserShown(params) {
9285
+ if (params.showElectronBrowserPreference === "always" /* Always */) {
9286
+ return true;
9287
+ }
9288
+ if (params.showElectronBrowserPreference === "never" /* Never */) {
9289
+ return false;
9290
+ }
9291
+ return params.requestedShowUi !== false;
9292
+ }
9293
+
9294
+ // packages/mcps/src/mcp/tools/local/electron-browser-visibility-line-constants.ts
9295
+ var ELECTRON_BROWSER_SHOWN_LABEL = "visible GUI";
9296
+ var ELECTRON_BROWSER_HIDDEN_LABEL = "headless";
9297
+
9298
+ // packages/mcps/src/mcp/tools/local/electron-browser-visibility-line.ts
9299
+ function formatElectronBrowserVisibilityLine(visibility) {
9300
+ const label = visibility.isBrowserShown ? ELECTRON_BROWSER_SHOWN_LABEL : ELECTRON_BROWSER_HIDDEN_LABEL;
9301
+ if (!visibility.isCallerOverridden) {
9302
+ return `**UI:** ${label}`;
9303
+ }
9304
+ const ignoredShowUi = !visibility.isBrowserShown;
9305
+ return `**UI:** ${label} \u2014 showElectronBrowser is "${visibility.showElectronBrowserPreference}", so showUi: ${ignoredShowUi} was ignored`;
9306
+ }
9307
+
9269
9308
  // packages/mcps/src/mcp/tools/local/run-checkout-refusal.ts
9270
9309
  function formatRunCheckoutRefusal(report, cwd) {
9271
9310
  const baseName = report.baseRef ? toDisplayRef(report.baseRef) : "";
@@ -9562,13 +9601,16 @@ var testScriptGetTool = {
9562
9601
  };
9563
9602
  var executeTestGenerationTool = {
9564
9603
  name: "muggle-local-execute-test-generation",
9565
- description: "Generate an end-to-end (E2E) acceptance test script by launching a real browser against your web app. The browser navigates your app, executes the test case steps (like signing up, filling forms, clicking through flows), and produces a replayable test script with screenshots. Use this to create new browser tests for any user flow. Requires a test case (from muggle-remote-test-case-get) and a localhost URL. Launches an Electron browser \u2014 defaults to a visible window; pass showUi: false to run headless.",
9604
+ description: "Generate an end-to-end (E2E) acceptance test script by launching a real browser against your web app. The browser navigates your app, executes the test case steps (like signing up, filling forms, clicking through flows), and produces a replayable test script with screenshots. Use this to create new browser tests for any user flow. Requires a test case (from muggle-remote-test-case-get) and a localhost URL. Launches an Electron browser \u2014 the user's showElectronBrowser preference decides whether its window shows when set to always or never; under ask it defaults to a visible window and showUi: false runs it headless.",
9566
9605
  inputSchema: ExecuteTestGenerationInputSchema,
9567
9606
  execute: async (ctx) => {
9568
9607
  const logger7 = createChildLogger2(ctx.correlationId);
9569
9608
  logger7.info("Executing muggle-local-execute-test-generation");
9570
9609
  const input = ExecuteTestGenerationInputSchema.parse(ctx.input);
9571
- const showUi = input.showUi !== false;
9610
+ const browserVisibility = resolveElectronBrowserVisibilityFromPreferences({ requestedShowUi: input.showUi });
9611
+ if (browserVisibility.isCallerOverridden) {
9612
+ logger7.warn("showElectronBrowser preference overrode the caller's showUi", { ...browserVisibility });
9613
+ }
9572
9614
  const checkoutRefusal = await findRunCheckoutRefusal({
9573
9615
  cwd: input.cwd,
9574
9616
  localUrl: input.localUrl,
@@ -9590,7 +9632,7 @@ var executeTestGenerationTool = {
9590
9632
  cwd: input.cwd,
9591
9633
  mutations: input.mutations,
9592
9634
  timeoutMs: input.timeoutMs,
9593
- showUi,
9635
+ showUi: browserVisibility.isBrowserShown,
9594
9636
  freshSession: input.freshSession,
9595
9637
  displayResolution: input.displayResolution,
9596
9638
  runSettingsId: input.runSettingsId
@@ -9602,7 +9644,7 @@ var executeTestGenerationTool = {
9602
9644
  `**Test Script ID:** ${generationRun.testScriptId}`,
9603
9645
  `**Status:** ${generationRun.status}`,
9604
9646
  `**Duration:** ${generationRun.executionTimeMs}ms`,
9605
- `**UI:** ${showUi ? "visible GUI" : "headless"}`,
9647
+ formatElectronBrowserVisibilityLine(browserVisibility),
9606
9648
  generationRun.errorMessage ? `**Error:** ${generationRun.errorMessage}` : ""
9607
9649
  ].filter(Boolean).join("\n");
9608
9650
  const stackChange = await findStackChangedDuringRun({ cwd: input.cwd, localUrl: input.localUrl });
@@ -9621,13 +9663,16 @@ var executeTestGenerationTool = {
9621
9663
  };
9622
9664
  var executeReplayTool = {
9623
9665
  name: "muggle-local-execute-replay",
9624
- description: "Replay an existing E2E acceptance test script in a real browser to verify your app still works correctly \u2014 use this for regression testing after code changes. The browser executes each saved step and captures screenshots so you can see what happened. Requires: (1) test script metadata from muggle-remote-test-script-get, (2) actionScript content from muggle-remote-action-script-get using the testScript.actionScriptId, and (3) a localhost URL. Launches an Electron browser \u2014 defaults to a visible window; pass showUi: false to run headless.",
9666
+ description: "Replay an existing E2E acceptance test script in a real browser to verify your app still works correctly \u2014 use this for regression testing after code changes. The browser executes each saved step and captures screenshots so you can see what happened. Requires: (1) test script metadata from muggle-remote-test-script-get, (2) actionScript content from muggle-remote-action-script-get using the testScript.actionScriptId, and (3) a localhost URL. Launches an Electron browser \u2014 the user's showElectronBrowser preference decides whether its window shows when set to always or never; under ask it defaults to a visible window and showUi: false runs it headless.",
9625
9667
  inputSchema: ExecuteReplayInputSchema,
9626
9668
  execute: async (ctx) => {
9627
9669
  const logger7 = createChildLogger2(ctx.correlationId);
9628
9670
  logger7.info("Executing muggle-local-execute-replay");
9629
9671
  const input = ExecuteReplayInputSchema.parse(ctx.input);
9630
- const showUi = input.showUi !== false;
9672
+ const browserVisibility = resolveElectronBrowserVisibilityFromPreferences({ requestedShowUi: input.showUi });
9673
+ if (browserVisibility.isCallerOverridden) {
9674
+ logger7.warn("showElectronBrowser preference overrode the caller's showUi", { ...browserVisibility });
9675
+ }
9631
9676
  const checkoutRefusal = await findRunCheckoutRefusal({
9632
9677
  cwd: input.cwd,
9633
9678
  localUrl: input.localUrl,
@@ -9650,7 +9695,7 @@ var executeReplayTool = {
9650
9695
  cwd: input.cwd,
9651
9696
  mutations: input.mutations,
9652
9697
  timeoutMs: input.timeoutMs,
9653
- showUi,
9698
+ showUi: browserVisibility.isBrowserShown,
9654
9699
  freshSession: input.freshSession,
9655
9700
  pinnedAccount: input.pinnedAccount,
9656
9701
  displayResolution: input.displayResolution
@@ -9662,7 +9707,7 @@ var executeReplayTool = {
9662
9707
  `**Test Script ID:** ${replayRun.testScriptId}`,
9663
9708
  `**Status:** ${replayRun.status}`,
9664
9709
  `**Duration:** ${replayRun.executionTimeMs}ms`,
9665
- `**UI:** ${showUi ? "visible GUI" : "headless"}`,
9710
+ formatElectronBrowserVisibilityLine(browserVisibility),
9666
9711
  replayRun.errorMessage ? `**Error:** ${replayRun.errorMessage}` : ""
9667
9712
  ].filter(Boolean).join("\n");
9668
9713
  const stackChange = await findStackChangedDuringRun({ cwd: input.cwd, localUrl: input.localUrl });
@@ -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, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl } from './chunk-NFS44KNQ.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, applyLlmSourceSelection, LlmSource, getDataDir, DEFAULT_LOCAL_LLM_BASE_URL, isValidLocalBaseUrl } from './chunk-32I7VRZ7.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-HALLVP7O.js');
1057
+ const mcps = await import('./src-ZAGX3JLC.js');
1058
1058
  const credentials = await mcps.getCallerCredentialsAsync();
1059
1059
  if (!credentials.bearerToken && !credentials.apiKey) {
1060
1060
  stderrWrite(
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-45WV6RS5.js';
3
- import './chunk-NFS44KNQ.js';
2
+ import { runCli } from './chunk-OC6K3BQ6.js';
3
+ import './chunk-32I7VRZ7.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-45WV6RS5.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-NFS44KNQ.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-OC6K3BQ6.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-32I7VRZ7.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.26.0-staging.221",
4
+ "version": "5.26.0-staging.223",
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.26.0-staging.221",
7
+ "@muggleai/works@5.26.0-staging.223",
8
8
  "serve"
9
9
  ],
10
10
  "env": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "muggle",
3
- "version": "5.26.0-staging.221",
3
+ "version": "5.26.0-staging.223",
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.26.0-staging.221",
5
+ "version": "5.26.0-staging.223",
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.26.0-staging.221",
7
+ "@muggleai/works@5.26.0-staging.223",
8
8
  "serve"
9
9
  ]
10
10
  }
@@ -28,6 +28,8 @@ A recorder that *clears* an obligation — a walkthrough posted, a failure diagn
28
28
 
29
29
  Each guardrail is a bash gate script in `../scripts/` holding a `guardrail_wants` pre-filter and the `guardrails.mjs` subcommand it feeds; the bundled `../scripts/guardrails.mjs` holds the decision logic (built from `src/guardrails/`, vitest-covered). The busy events — a shell command before and after it runs, and every turn end — register one `guardrail-dispatch.sh` command listing their gates, which reads the payload once, asks every gate's pre-filter in that one process, and starts Node once (`guardrails.mjs run <gates...>`) for just the gates that could fire, merging their responses. Rarer events call a gate script directly. Per-session state in `~/.muggle-ai/guardrails/<session_id>.json` tracks what fired. Any *failure* degrades to `{}` (allow) — a gate blocks only by an explicit, tested decision, never by accident; `guardrail-lib.sh` is the one place that falls back, and `run` isolates gates from each other.
30
30
 
31
+ Every `hooks.json` command enters through `../scripts/hook-entry.sh`, with the hook's script and arguments set as positional parameters first: `set -- guardrail-dispatch.sh guardrail-e2e-gate.sh …; . "${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh"`. Claude Code runs a hook command through Git Bash on Windows and through `/bin/sh` elsewhere. Inside Git Bash the entry sources the script into that same shell, so a hook costs the one Git Bash start Claude Code makes rather than a second `bash` with its own MSYS runtime init — measured at 0.3–1.2 s per firing on a loaded box. Anywhere else `/bin/sh` may be dash, so the entry is POSIX sh and hands the script to a bash of its own, as `bash "<script>"` did. A gate script tells it is the hook's own script — not one `guardrail-dispatch.sh` sourced for its pre-filter — through `guardrail_is_hook_script`, which reads the script path the entry records, or `$0` when bash ran the script.
32
+
31
33
  Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event starts no process at all. A pre-filter reads only the payload fields its subcommand judges (`guardrail_fields_match`: the command, the tool's name, the path read, the prompt), never the whole payload — a tool's output or a read file's contents would otherwise start Node whenever they merely mention a trigger. The PreToolUse deny gates go one step further: Claude Code's `if` rules (`Bash(*gh *)`, `Bash(*glab *)` and their `PowerShell` twins) launch them only for a command naming `gh` or `glab`, so every other shell call starts no hook process. A rule's leading `*` is load-bearing: it is what reaches a `gh` inside `bash -c "…"`. A gate that has spent its block budget stamps a `<gate>Released` flag, which its wrapper then pre-filters on — without it a released gate keeps cold-starting Node on every remaining turn end to answer `{}`, and the walkthrough gate keeps queuing provider scans to do it. That pre-filter is a second, looser copy of what `guardrails.mjs` matches, and it is the one place a guardrail can fail *silently*: a payload it drops — a skip marker, a reopen line, a comment edit — reaches no recorder, and the gate keeps demanding an action the user already took. Over-matching is free; under-matching is a dead escape hatch. `src/test/guardrails/hook-prefilter.test.ts` pins every payload each subcommand acts on against the wrapper guarding it, and derives the skip-marker tokens from source so a new marker is covered the moment it exists.
32
34
 
33
35
  ## Guardrails
@@ -58,12 +60,13 @@ Pre-filters are bash builtins only (`guardrail-lib.sh`), so an irrelevant event
58
60
 
59
61
  ## Codex
60
62
 
61
- Codex runs Claude Code-format plugin hooks, from `codex-hooks.json` rather than `hooks.json` — the Codex plugin manifest (`../.codex-plugin/plugin.json`) names it. `scripts/build-codex-hooks.mjs` generates it from `hooks.json` on every build, and `pnpm run verify:plugin` fails when the committed copy drifts, so `hooks.json` stays the one manifest to edit. The generated copy differs in four ways, each written down rather than guessed at runtime:
63
+ Codex runs Claude Code-format plugin hooks, from `codex-hooks.json` rather than `hooks.json` — the Codex plugin manifest (`../.codex-plugin/plugin.json`) names it. `scripts/build-codex-hooks.mjs` generates it from `hooks.json` on every build, and `pnpm run verify:plugin` fails when the committed copy drifts, so `hooks.json` stays the one manifest to edit. The generated copy differs in five ways, each written down rather than guessed at runtime:
62
64
 
63
65
  - **Host stamp.** Codex exports `CLAUDE_PLUGIN_ROOT` to plugin hooks for compatibility, so nothing in the environment tells a guardrail it is not in Claude Code. Every command runs under `env MUGGLE_HOOK_HOST=codex`, and the guardrails word their instructions for Codex (`$muggle:muggle-test`, not `/muggle:muggle-test`).
64
66
  - **Tool names.** A matcher naming a Claude Code tool becomes the Codex tool that plays its part — `AskUserQuestion` → `request_user_input` — and a group whose tools Codex lacks is dropped: Codex reports every shell call as `Bash`, opens files and skills through the shell, and delivers a background command's output as that command's own `Bash` event, so `PowerShell`, `Read`, `Skill` and `Monitor` never fire. An MCP tool reaches a Codex hook as `mcp__muggle__<tool>` with every character outside `[A-Za-z0-9_]` turned into `_` (`mcp__muggle__muggle_local_execute_replay`), so the MCP matchers are respelled; the wrappers' pre-filters and the guardrails' own tool checks accept either spelling.
65
67
  - **Windows.** Codex runs `commandWindows` through the session shell — PowerShell, or cmd.exe as a fallback — so every hook also gets one that starts with a bare `node` (both shells parse it alike; a quoted path there is a PowerShell syntax error) and hands the same script to Git Bash through `../scripts/codex-hook-windows.mjs`. It looks for Git Bash beside `git.exe`, then in the default install paths; `MUGGLE_HOOK_BASH` names one it would not find. With no Git Bash the launcher prints `{}` and succeeds — the same allow-by-default every guardrail falls back to.
66
68
  - **No `if` rules.** Codex has no counterpart to Claude Code's `if`, so the rule is dropped and the identical commands its variants leave collapse into one: under Codex the deny gates run on every shell call and their in-shell pre-filters decide.
69
+ - **No hook entry.** Codex starts every command as a process — `env` stamps the host, and on Windows the `node` launcher hands the script to Git Bash — so there is no shell to source into, and each Codex command names its script directly: `bash "<script>" <args>`.
67
70
 
68
71
  What Codex sends differs too, and the guardrails read either shape: a shell result arrives as the bare output string (normalized to `tool_response.output` in `hookInput.ts`), with no exit code; the Stop payload carries the closing message as `last_assistant_message`, which the capability-claim gate judges in place of the transcript, whose format is not Claude Code's; and a stage file opened with `cat` or `sed -n` counts as read, since there is no `Read` tool. With no structured question in Codex's default mode, a turn that closes on a question to the user is the post-merge offer there — under Codex only.
69
72
 
@@ -97,6 +100,7 @@ Every hook here fires on every tool call, prompt or turn end in every open sessi
97
100
  | Cap | Limit |
98
101
  | :-- | :-- |
99
102
  | Hook commands an irrelevant event launches per busy slot (PostToolUse on `Bash` and `Read`, Stop, UserPromptSubmit) | 1 (PreToolUse on `Bash`: 0, its `if` rules launch nothing for a command naming neither `gh` nor `glab`) |
103
+ | A hook's own `bash` launch inside Git Bash, where `hook-entry.sh` runs the script in place | 0 (elsewhere 1 per command) |
100
104
  | Programs started beyond each hook's own launch on an irrelevant event | 0 (Stop: 1, a transcript `tail` until the capability-claim gate has nudged; bash cannot seek) |
101
105
  | `node`, `gh`, `python` on that path | 0 |
102
106
  | Median wall time of one irrelevant firing, Linux/macOS | 100 ms |
@@ -6,13 +6,13 @@
6
6
  "hooks": [
7
7
  {
8
8
  "type": "command",
9
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/ensure-electron-app.sh\"",
9
+ "command": "set -- ensure-electron-app.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
10
10
  "async": false,
11
11
  "timeout": 5
12
12
  },
13
13
  {
14
14
  "type": "command",
15
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/reconcile-stale-watchers.sh\"",
15
+ "command": "set -- reconcile-stale-watchers.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
16
16
  "async": false,
17
17
  "timeout": 5
18
18
  }
@@ -26,28 +26,28 @@
26
26
  {
27
27
  "type": "command",
28
28
  "if": "Bash(*gh *)",
29
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh",
29
+ "command": "set -- guardrail-dispatch.sh guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
30
30
  "async": false,
31
31
  "timeout": 1
32
32
  },
33
33
  {
34
34
  "type": "command",
35
35
  "if": "Bash(*glab *)",
36
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh",
36
+ "command": "set -- guardrail-dispatch.sh guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
37
37
  "async": false,
38
38
  "timeout": 1
39
39
  },
40
40
  {
41
41
  "type": "command",
42
42
  "if": "PowerShell(*gh *)",
43
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh",
43
+ "command": "set -- guardrail-dispatch.sh guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
44
44
  "async": false,
45
45
  "timeout": 1
46
46
  },
47
47
  {
48
48
  "type": "command",
49
49
  "if": "PowerShell(*glab *)",
50
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh",
50
+ "command": "set -- guardrail-dispatch.sh guardrail-report-format.sh guardrail-resolve-gate.sh guardrail-walkthrough-heading.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
51
51
  "async": false,
52
52
  "timeout": 1
53
53
  }
@@ -58,7 +58,7 @@
58
58
  "hooks": [
59
59
  {
60
60
  "type": "command",
61
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-classify-gate.sh\"",
61
+ "command": "set -- guardrail-classify-gate.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
62
62
  "async": false,
63
63
  "timeout": 1
64
64
  }
@@ -71,7 +71,7 @@
71
71
  "hooks": [
72
72
  {
73
73
  "type": "command",
74
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-pr-opened.sh guardrail-record-tests.sh guardrail-pr-terminal.sh guardrail-record-stage-signals.sh guardrail-record-comment-replies.sh guardrail-record-stage-read.sh",
74
+ "command": "set -- guardrail-dispatch.sh guardrail-pr-opened.sh guardrail-record-tests.sh guardrail-pr-terminal.sh guardrail-record-stage-signals.sh guardrail-record-comment-replies.sh guardrail-record-stage-read.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
75
75
  "async": false,
76
76
  "timeout": 1
77
77
  }
@@ -82,7 +82,7 @@
82
82
  "hooks": [
83
83
  {
84
84
  "type": "command",
85
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-record-tests.sh\"",
85
+ "command": "set -- guardrail-record-tests.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
86
86
  "async": false,
87
87
  "timeout": 1
88
88
  }
@@ -93,7 +93,7 @@
93
93
  "hooks": [
94
94
  {
95
95
  "type": "command",
96
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-record-stage-signals.sh\"",
96
+ "command": "set -- guardrail-record-stage-signals.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
97
97
  "async": false,
98
98
  "timeout": 1
99
99
  }
@@ -104,7 +104,7 @@
104
104
  "hooks": [
105
105
  {
106
106
  "type": "command",
107
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-skill-stages.sh\"",
107
+ "command": "set -- guardrail-skill-stages.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
108
108
  "async": false,
109
109
  "timeout": 1
110
110
  }
@@ -115,7 +115,7 @@
115
115
  "hooks": [
116
116
  {
117
117
  "type": "command",
118
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-skill-stages.sh\"",
118
+ "command": "set -- guardrail-skill-stages.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
119
119
  "async": false,
120
120
  "timeout": 1
121
121
  }
@@ -126,7 +126,7 @@
126
126
  "hooks": [
127
127
  {
128
128
  "type": "command",
129
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-record-stage-read.sh\"",
129
+ "command": "set -- guardrail-record-stage-read.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
130
130
  "async": false,
131
131
  "timeout": 1
132
132
  }
@@ -137,7 +137,7 @@
137
137
  "hooks": [
138
138
  {
139
139
  "type": "command",
140
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-offer-ran.sh guardrail-record-delegation.sh",
140
+ "command": "set -- guardrail-dispatch.sh guardrail-offer-ran.sh guardrail-record-delegation.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
141
141
  "async": false,
142
142
  "timeout": 1
143
143
  }
@@ -149,7 +149,7 @@
149
149
  "hooks": [
150
150
  {
151
151
  "type": "command",
152
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-dispatch.sh\" guardrail-e2e-gate.sh guardrail-terminal-gate.sh guardrail-watch-gate.sh guardrail-watch-follow-through-gate.sh guardrail-build-followthrough-gate.sh guardrail-walkthrough-gate.sh guardrail-comment-reply-gate.sh guardrail-stage-gate.sh guardrail-debug-path-gate.sh guardrail-capability-claim.sh",
152
+ "command": "set -- guardrail-dispatch.sh guardrail-e2e-gate.sh guardrail-terminal-gate.sh guardrail-watch-gate.sh guardrail-watch-follow-through-gate.sh guardrail-build-followthrough-gate.sh guardrail-walkthrough-gate.sh guardrail-comment-reply-gate.sh guardrail-stage-gate.sh guardrail-debug-path-gate.sh guardrail-capability-claim.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
153
153
  "async": false,
154
154
  "timeout": 1
155
155
  }
@@ -161,7 +161,7 @@
161
161
  "hooks": [
162
162
  {
163
163
  "type": "command",
164
- "command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/guardrail-build-router.sh\"",
164
+ "command": "set -- guardrail-build-router.sh; . \"${CLAUDE_PLUGIN_ROOT}/scripts/hook-entry.sh\"",
165
165
  "async": false,
166
166
  "timeout": 1
167
167
  }
@@ -29,6 +29,6 @@ guardrail_wants() {
29
29
  && ! guardrail_state_has '"buildSkipped": true'
30
30
  }
31
31
 
32
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
32
+ if guardrail_is_hook_script; then
33
33
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
34
34
  fi
@@ -30,6 +30,6 @@ guardrail_wants() {
30
30
  guardrail_fields_match prompt '(implement|build|add|create|write|fix|refactor|wire up|hook up|make|change the|conflict|merged|passing|green)'
31
31
  }
32
32
 
33
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
33
+ if guardrail_is_hook_script; then
34
34
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
35
35
  fi
@@ -49,6 +49,6 @@ guardrail_wants() {
49
49
  return "$matched"
50
50
  }
51
51
 
52
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
52
+ if guardrail_is_hook_script; then
53
53
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
54
54
  fi
@@ -24,6 +24,6 @@ guardrail_wants() {
24
24
  guardrail_payload_matches 'muggle[-_]local[-_](execute[-_]test[-_]generation|execute[-_]replay)'
25
25
  }
26
26
 
27
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
27
+ if guardrail_is_hook_script; then
28
28
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
29
29
  fi
@@ -26,6 +26,6 @@ guardrail_wants() {
26
26
  fi
27
27
  }
28
28
 
29
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
29
+ if guardrail_is_hook_script; then
30
30
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
31
31
  fi
@@ -27,6 +27,6 @@ guardrail_wants() {
27
27
  && ! guardrail_state_has '"debugSkipped": true'
28
28
  }
29
29
 
30
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
30
+ if guardrail_is_hook_script; then
31
31
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
32
32
  fi
@@ -28,6 +28,6 @@ guardrail_wants() {
28
28
  && ! guardrail_state_has '"e2eRun": true'
29
29
  }
30
30
 
31
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
31
+ if guardrail_is_hook_script; then
32
32
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
33
33
  fi
@@ -108,6 +108,12 @@ guardrail_state_has() {
108
108
  [[ $GUARDRAIL_STATE == *"$1"* ]]
109
109
  }
110
110
 
111
+ # Whether the gate script calling this is the hook's own script — run by bash, or sourced by hook-entry.sh into the
112
+ # shell Claude Code started — rather than a gate guardrail-dispatch.sh sourced only to read its pre-filter.
113
+ guardrail_is_hook_script() {
114
+ [[ ${BASH_SOURCE[1]} == "${MUGGLE_HOOK_SCRIPT:-$0}" ]]
115
+ }
116
+
111
117
  # Runs guardrails.mjs on the payload. Never blocks a turn: any failure degrades to {}.
112
118
  guardrail_run_node() {
113
119
  local root="${CLAUDE_PLUGIN_ROOT:-${CURSOR_PLUGIN_ROOT:-}}"
@@ -22,6 +22,6 @@ guardrail_wants() {
22
22
  && ! guardrail_state_has '"terminalPending": []'
23
23
  }
24
24
 
25
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
25
+ if guardrail_is_hook_script; then
26
26
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
27
27
  fi
@@ -21,6 +21,6 @@ guardrail_wants() {
21
21
  guardrail_payload_matches 'gh[[:space:]]+pr[[:space:]]+(create|ready)|glab[[:space:]]+mr[[:space:]]+(create|update)'
22
22
  }
23
23
 
24
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
24
+ if guardrail_is_hook_script; then
25
25
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
26
26
  fi
@@ -25,6 +25,6 @@ guardrail_wants() {
25
25
  guardrail_payload_matches '(merged|closed|reopened) pull request|TERMINAL pr='
26
26
  }
27
27
 
28
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
28
+ if guardrail_is_hook_script; then
29
29
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
30
30
  fi
@@ -28,6 +28,6 @@ guardrail_wants() {
28
28
  guardrail_payload_matches 'reviewThreads|merge_requests/[0-9]+/discussions|comments/[0-9]+/replies|discussions/[A-Za-z0-9_-]+/notes|MUGGLE_[A-Z0-9_]+_SKIP'
29
29
  }
30
30
 
31
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
31
+ if guardrail_is_hook_script; then
32
32
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
33
33
  fi
@@ -20,6 +20,6 @@ guardrail_wants() {
20
20
  guardrail_payload_matches 'acceptance-tester'
21
21
  }
22
22
 
23
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
23
+ if guardrail_is_hook_script; then
24
24
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
25
25
  fi
@@ -29,6 +29,6 @@ guardrail_wants() {
29
29
  guardrail_fields_match cwd file_path command 'skills.*\.md'
30
30
  }
31
31
 
32
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
32
+ if guardrail_is_hook_script; then
33
33
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
34
34
  fi
@@ -23,6 +23,6 @@ guardrail_wants() {
23
23
  guardrail_payload_matches 'MUGGLE_[A-Z0-9_]+_SKIP|muggle.*(telemetry[-_]event[-_]emit|user[-_]feedback[-_]create)'
24
24
  }
25
25
 
26
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
26
+ if guardrail_is_hook_script; then
27
27
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
28
28
  fi
@@ -35,6 +35,6 @@ guardrail_wants() {
35
35
  || guardrail_fields_match tool_name 'muggle.*(execute|test[-_]generation|replay)'
36
36
  }
37
37
 
38
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
38
+ if guardrail_is_hook_script; then
39
39
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
40
40
  fi
@@ -27,6 +27,6 @@ guardrail_wants() {
27
27
  guardrail_payload_matches 'gh[[:space:]]+pr[[:space:]]+(comment|create|edit)|issues/comments/[0-9]'
28
28
  }
29
29
 
30
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
30
+ if guardrail_is_hook_script; then
31
31
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
32
32
  fi
@@ -22,6 +22,6 @@ guardrail_wants() {
22
22
  guardrail_payload_matches 'resolveReviewThread|resolved=(true|false)'
23
23
  }
24
24
 
25
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
25
+ if guardrail_is_hook_script; then
26
26
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
27
27
  fi
@@ -41,6 +41,6 @@ guardrail_wants() {
41
41
  return 1
42
42
  }
43
43
 
44
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
44
+ if guardrail_is_hook_script; then
45
45
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
46
46
  fi
@@ -29,6 +29,6 @@ guardrail_wants() {
29
29
  && ! guardrail_state_has '"stageSkipped": true'
30
30
  }
31
31
 
32
- if [[ ${BASH_SOURCE[0]} == "$0" ]]; then
32
+ if guardrail_is_hook_script; then
33
33
  guardrail_run_standalone "$GUARDRAIL_SUBCOMMAND"
34
34
  fi