@muggleai/works 5.20.0-staging.143 → 5.21.0-staging.145

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.
@@ -357,9 +357,11 @@ function parentIsAlive(pid) {
357
357
  // src/cli/pr-section/constants.ts
358
358
  var DASHBOARD_URL_BASE = "https://www.muggle-ai.com/muggleTestV0/dashboard/projects";
359
359
  var DETAIL_IMAGE_WIDTH = 720;
360
- var STEP_LIST_ELISION_THRESHOLD = 10;
361
- var STEP_LIST_HEAD_COUNT = 6;
362
- var STEP_LIST_TAIL_COUNT = 3;
360
+ var STEP_IMAGE_WIDTH = 640;
361
+ var STEP_LIST_ELISION_THRESHOLD = 20;
362
+ var STEP_LIST_HEAD_COUNT = 12;
363
+ var STEP_LIST_TAIL_COUNT = 8;
364
+ var STEP_ELEMENT_ID_SUFFIX = /\s*with element id (?:\[\d+\]|#\d+)/g;
363
365
 
364
366
  // src/cli/pr-section/render.ts
365
367
  function resolveLatestRuns(tests) {
@@ -459,10 +461,20 @@ function endingFrame(test) {
459
461
  };
460
462
  }
461
463
  function fullSizeImage(url, alt) {
462
- return `<a href="${url}"><img src="${url}" width="${DETAIL_IMAGE_WIDTH}" alt="${alt}"></a>`;
464
+ return `<a href="${url}"><img src="${url}" width="${DETAIL_IMAGE_WIDTH}" alt="${escapeHtml(alt).replace(/"/g, "&quot;")}"></a>`;
463
465
  }
464
- function safeInlineCode(s) {
465
- return s.replace(/`/g, "\u2018");
466
+ function escapeHtml(s) {
467
+ return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
468
+ }
469
+ function tableCell(s) {
470
+ return s.replace(/\s*\n\s*/g, " ").replace(/\|/g, "\\|");
471
+ }
472
+ function stepText(step) {
473
+ return escapeHtml((step.description ?? step.action).replace(STEP_ELEMENT_ID_SUFFIX, ""));
474
+ }
475
+ function dashboardLink(test, projectId, dashboardBaseUrl) {
476
+ const url = `${dashboardBaseUrl}/${projectId}/scripts?modal=script-details&testCaseId=${encodeURIComponent(test.testCaseId)}`;
477
+ return `<a href="${url}" target="_blank" rel="noopener noreferrer">Open the full run on Muggle AI \u2192</a>`;
466
478
  }
467
479
  function renderOverview(report) {
468
480
  const latestRuns = resolveLatestRuns(report.tests);
@@ -532,25 +544,18 @@ function buildGroupedLayout(latestRuns) {
532
544
  }
533
545
  function renderTestDetails(entry, projectId, testNumber, dashboardBaseUrl = DASHBOARD_URL_BASE) {
534
546
  const { test } = entry;
535
- const body = ["", "<br>", ""];
536
- body.push(...renderResultSummary(entry, projectId, dashboardBaseUrl));
537
- const stepList = renderStepList(test.steps);
538
- if (stepList) {
539
- body.push("", ...stepList);
540
- }
541
- const frameBlock = renderEndingFrame(test);
542
- if (frameBlock) {
543
- body.push("", ...frameBlock);
544
- }
545
- return `<details>
546
- <summary>${renderSummaryLine(test, testNumber)}</summary>
547
- ${body.join("\n")}
548
-
549
- </details>`;
550
- }
551
- function renderSummaryLine(test, testNumber) {
552
- const base = `${statusEmoji(test)} <b>${testNumber}. ${test.name}</b>`;
553
- return test.description ? `${base} \u2014 ${test.description}` : base;
547
+ const lines = [`#### ${statusEmoji(test)} ${testNumber}. ${test.name}`, ""];
548
+ if (test.description) {
549
+ lines.push(`_${test.description.replace(/\s*\n\s*/g, " ")}_`, "");
550
+ }
551
+ lines.push(...renderResultTable(entry, projectId, dashboardBaseUrl));
552
+ const steps = renderSteps(test, projectId, dashboardBaseUrl) ?? [];
553
+ const frame = renderEndingFrame(test) ?? [];
554
+ const evidence = [...steps, ...steps.length > 0 && frame.length > 0 ? [""] : [], ...frame];
555
+ if (evidence.length > 0) {
556
+ lines.push("", "<details><summary><b>Steps and screenshots</b></summary>", "", ...evidence, "", "</details>");
557
+ }
558
+ return lines.join("\n");
554
559
  }
555
560
  function renderEndingFrame(test) {
556
561
  const frame = endingFrame(test);
@@ -558,43 +563,54 @@ function renderEndingFrame(test) {
558
563
  return null;
559
564
  }
560
565
  return [
561
- `**\u{1F4F8} Ending screen \u2014 ${frame.caption}**`,
566
+ `**Ending screen** \u2014 ${frame.caption}`,
562
567
  "",
563
568
  fullSizeImage(frame.url, test.name)
564
569
  ];
565
570
  }
566
- function renderStepList(steps) {
571
+ function renderSteps(test, projectId, dashboardBaseUrl) {
572
+ const { steps } = test;
567
573
  if (steps.length === 0) {
568
574
  return null;
569
575
  }
570
- const entry = (step, position) => `${position}. ${safeInlineCode(step.action)}`;
576
+ const collapsible = (step, position) => `<details><summary>${position} \xB7 ${stepText(step)}</summary>
577
+
578
+ <img src="${step.screenshotUrl}" width="${STEP_IMAGE_WIDTH}" alt="Step ${position}">
579
+
580
+ </details>`;
581
+ const heading = ["**Steps** \u2014 click a step to see its screenshot", ""];
571
582
  if (steps.length <= STEP_LIST_ELISION_THRESHOLD) {
572
- return steps.map((step, i) => entry(step, i + 1));
583
+ return [...heading, ...steps.map((step, i) => collapsible(step, i + 1))];
573
584
  }
574
- const head = steps.slice(0, STEP_LIST_HEAD_COUNT).map((step, i) => entry(step, i + 1));
575
585
  const tailStart = steps.length - STEP_LIST_TAIL_COUNT;
576
- const tail = steps.slice(tailStart).map((step, i) => entry(step, tailStart + i + 1));
577
586
  const hidden = tailStart - STEP_LIST_HEAD_COUNT;
578
- return [...head, "", `_\u2026 ${hidden} more steps \u2026_`, "", ...tail];
587
+ return [
588
+ ...heading,
589
+ ...steps.slice(0, STEP_LIST_HEAD_COUNT).map((step, i) => collapsible(step, i + 1)),
590
+ "",
591
+ `_\u2026 ${hidden} more ${hidden === 1 ? "step" : "steps"} \u2014 ${dashboardLink(test, projectId, dashboardBaseUrl)}_`,
592
+ "",
593
+ ...steps.slice(tailStart).map((step, i) => collapsible(step, tailStart + i + 1))
594
+ ];
579
595
  }
580
- function renderResultSummary(entry, projectId, dashboardBaseUrl) {
596
+ function renderResultTable(entry, projectId, dashboardBaseUrl) {
581
597
  const { test } = entry;
582
- const dashboardUrl = `${dashboardBaseUrl}/${projectId}/scripts?modal=script-details&testCaseId=${encodeURIComponent(test.testCaseId)}`;
583
- const lines = [];
598
+ const rows = ["| | |", "|:--|:--|"];
584
599
  if (test.status === "passed") {
585
- lines.push(`**Result:** \u2705 PASSED`);
600
+ rows.push("| **Result** | \u2705 Passed |");
586
601
  } else if (test.status === "failed") {
587
- lines.push(`**Result:** \u274C FAILED at step ${failureOrdinal(test, test.failureStepIndex)}`);
588
- lines.push(`**Error:** \`${safeInlineCode(test.error)}\``);
602
+ rows.push(`| **Result** | \u274C Failed at step ${failureOrdinal(test, test.failureStepIndex)} |`);
603
+ rows.push(`| **Why** | ${tableCell(escapeHtml(test.error))} |`);
589
604
  } else {
590
- lines.push(`**Result:** \u26A0\uFE0F INCONCLUSIVE`);
591
- lines.push(`**Reason:** \`${safeInlineCode(test.reason)}\``);
605
+ rows.push("| **Result** | \u26A0\uFE0F Inconclusive |");
606
+ rows.push(`| **Why** | ${tableCell(escapeHtml(test.reason))} |`);
592
607
  }
593
608
  if (entry.attempts > 1) {
594
- lines.push(`**Runs:** ${entry.attempts} \u2014 showing the latest`);
609
+ rows.push(`| **Attempts** | ${entry.attempts} \u2014 showing the latest |`);
595
610
  }
596
- lines.push(`**Steps:** ${test.steps.length} \xB7 <a href="${dashboardUrl}" target="_blank" rel="noopener noreferrer">View steps on Muggle AI \u2192</a>`);
597
- return lines;
611
+ const count = test.steps.length;
612
+ rows.push(`| **Run** | ${count} browser ${count === 1 ? "step" : "steps"} \xB7 ${dashboardLink(test, projectId, dashboardBaseUrl)} |`);
613
+ return rows;
598
614
  }
599
615
  function renderDetailBlocks(report, dashboardBaseUrl) {
600
616
  return resolveLatestRuns(report.tests).map((entry, i) => renderTestDetails(entry, report.projectId, i + 1, dashboardBaseUrl ?? DASHBOARD_URL_BASE)).join("\n\n");
@@ -658,6 +674,7 @@ function splitWithOverflow(report, opts) {
658
674
  var StepSchema = z.object({
659
675
  stepIndex: z.number().int().nonnegative(),
660
676
  action: z.string().min(1),
677
+ description: z.string().min(1).optional(),
661
678
  screenshotUrl: z.string().url()
662
679
  });
663
680
  var PassedTestSchema = z.object({
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-OS2WXIPB.js';
2
+ import { runCli } from './chunk-IBMUOHDM.js';
3
3
  import './chunk-ZA5KHVX5.js';
4
4
 
5
5
  // src/cli/main.ts
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-OS2WXIPB.js';
1
+ export { src_exports as commands, createUnifiedMcpServer, server_exports as server } from './chunk-IBMUOHDM.js';
2
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-ZA5KHVX5.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Run real-browser end-to-end (E2E) acceptance tests on your web app from any AI coding agent. Generate test scripts from plain English, replay them on localhost, capture screenshots, and validate user flows like signup, checkout, and dashboards. Works across Claude Code, Cursor, Codex, and Windsurf.",
4
- "version": "5.20.0-staging.143",
4
+ "version": "5.21.0-staging.145",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Ship quality products with AI-powered end-to-end (E2E) acceptance testing that validates your web app like a real user — from Claude Code and Cursor to PR.",
5
- "version": "5.20.0-staging.143",
5
+ "version": "5.21.0-staging.145",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -6,4 +6,4 @@ The studio publishes every completed run — pass or fail — to the cloud durin
6
6
 
7
7
  ## Screenshots
8
8
 
9
- Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl` and `operation.action`. Retain `{ stepIndex, action, screenshotUrl }`. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
9
+ Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl`, `operation.action` and `briefExplanation`. Retain `{ stepIndex, action, description, screenshotUrl }`, with `description` taken from `briefExplanation` — `action` is only the operation verb, and the description is what the walkthrough shows a reviewer. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
@@ -23,7 +23,7 @@ Fetch step screenshots in parallel — pick the right tool per run result:
23
23
 
24
24
  For each result:
25
25
 
26
- 1. Build `steps[]`: `[{ stepIndex: <index>, action: steps[i].operation.action, screenshotUrl: steps[i].operation.screenshotUrl }, ...]`. Empty array is fine — zero-step runs still render the failure summary header in the walkthrough.
26
+ 1. Build `steps[]`: `[{ stepIndex: <index>, action: steps[i].operation.action, description: steps[i].briefExplanation, screenshotUrl: steps[i].operation.screenshotUrl }, ...]`. `action` is only the operation verb (`navigate`, `click`); `description` is the agent's readable account of the step and is what the walkthrough shows — omit it only when the step has no `briefExplanation`. Empty array is fine — zero-step runs still render the failure summary header in the walkthrough.
27
27
  2. `viewUrl` — from the run result (deep-links to the specific run).
28
28
  3. `status` — from `muggle-local-run-result-get`.
29
29
  4. If failed: also capture `failureStepIndex`, `error`, `artifactsDir` from the run result.
@@ -56,7 +56,7 @@ If called from `muggle-do`: `e2e-acceptance.md` already produces this shape —
56
56
  "runId": "<runId from muggle-local-execute-test-generation>",
57
57
  "viewUrl": "<viewUrl from run result>",
58
58
  "status": "passed",
59
- "steps": [{ "stepIndex": 0, "action": "...", "screenshotUrl": "..." }]
59
+ "steps": [{ "stepIndex": 0, "action": "click", "description": "Click 'Accept all' to dismiss the cookie consent dialog.", "screenshotUrl": "..." }]
60
60
  },
61
61
  {
62
62
  "name": "<failed test case title>",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "release": "5.18.0",
3
- "buildId": "run-143-1",
4
- "commitSha": "f1b437ed8e376b09b87815aa34b40299f63027f2",
5
- "buildTime": "2026-10-05T21:51:22Z",
3
+ "buildId": "run-145-1",
4
+ "commitSha": "c9bfc9df22f7e254aab0840192bc249f2e965989",
5
+ "buildTime": "2026-10-13T21:47:21Z",
6
6
  "serviceName": "muggle-ai-works-mcp"
7
7
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@muggleai/works",
3
3
  "mcpName": "io.github.multiplex-ai/muggle",
4
- "version": "5.20.0-staging.143",
4
+ "version": "5.21.0-staging.145",
5
5
  "description": "Ship quality products with AI-powered E2E acceptance testing that validates your web app like a real user — from Claude Code and Cursor to PR.",
6
6
  "type": "module",
7
7
  "main": "dist/index.js",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "muggle",
3
3
  "description": "Run real-browser end-to-end (E2E) acceptance tests on your web app from any AI coding agent. Generate test scripts from plain English, replay them on localhost, capture screenshots, and validate user flows like signup, checkout, and dashboards. Works across Claude Code, Cursor, Codex, and Windsurf.",
4
- "version": "5.20.0-staging.143",
4
+ "version": "5.21.0-staging.145",
5
5
  "author": {
6
6
  "name": "Muggle AI",
7
7
  "email": "support@muggle-ai.com"
@@ -2,7 +2,7 @@
2
2
  "name": "muggle",
3
3
  "displayName": "Muggle AI",
4
4
  "description": "Ship quality products with AI-powered end-to-end (E2E) acceptance testing that validates your web app like a real user — from Claude Code and Cursor to PR.",
5
- "version": "5.20.0-staging.143",
5
+ "version": "5.21.0-staging.145",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -6,4 +6,4 @@ The studio publishes every completed run — pass or fail — to the cloud durin
6
6
 
7
7
  ## Screenshots
8
8
 
9
- Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl` and `operation.action`. Retain `{ stepIndex, action, screenshotUrl }`. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
9
+ Per run, `muggle-remote-test-script-get` with the `cloudTestScriptId` from the run result → per step `operation.screenshotUrl`, `operation.action` and `briefExplanation`. Retain `{ stepIndex, action, description, screenshotUrl }`, with `description` taken from `briefExplanation` — `action` is only the operation verb, and the description is what the walkthrough shows a reviewer. Batch in parallel. These feed the `E2eReport` consumed by [`../../muggle-pr-visual-walkthrough/SKILL.md`](../../muggle-pr-visual-walkthrough/SKILL.md) — the dev loop does not post to the PR.
@@ -23,7 +23,7 @@ Fetch step screenshots in parallel — pick the right tool per run result:
23
23
 
24
24
  For each result:
25
25
 
26
- 1. Build `steps[]`: `[{ stepIndex: <index>, action: steps[i].operation.action, screenshotUrl: steps[i].operation.screenshotUrl }, ...]`. Empty array is fine — zero-step runs still render the failure summary header in the walkthrough.
26
+ 1. Build `steps[]`: `[{ stepIndex: <index>, action: steps[i].operation.action, description: steps[i].briefExplanation, screenshotUrl: steps[i].operation.screenshotUrl }, ...]`. `action` is only the operation verb (`navigate`, `click`); `description` is the agent's readable account of the step and is what the walkthrough shows — omit it only when the step has no `briefExplanation`. Empty array is fine — zero-step runs still render the failure summary header in the walkthrough.
27
27
  2. `viewUrl` — from the run result (deep-links to the specific run).
28
28
  3. `status` — from `muggle-local-run-result-get`.
29
29
  4. If failed: also capture `failureStepIndex`, `error`, `artifactsDir` from the run result.
@@ -56,7 +56,7 @@ If called from `muggle-do`: `e2e-acceptance.md` already produces this shape —
56
56
  "runId": "<runId from muggle-local-execute-test-generation>",
57
57
  "viewUrl": "<viewUrl from run result>",
58
58
  "status": "passed",
59
- "steps": [{ "stepIndex": 0, "action": "...", "screenshotUrl": "..." }]
59
+ "steps": [{ "stepIndex": 0, "action": "click", "description": "Click 'Accept all' to dismiss the cookie consent dialog.", "screenshotUrl": "..." }]
60
60
  },
61
61
  {
62
62
  "name": "<failed test case title>",