@muggleai/works 4.4.0 → 4.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +31 -13
  2. package/dist/{chunk-PMI2DI3V.js → chunk-TP4T4T2Z.js} +348 -105
  3. package/dist/cli.js +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  6. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  7. package/dist/plugin/README.md +1 -0
  8. package/dist/plugin/skills/do/e2e-acceptance.md +6 -3
  9. package/dist/plugin/skills/do/open-prs.md +35 -74
  10. package/dist/plugin/skills/muggle-pr-visual-walkthrough/SKILL.md +181 -0
  11. package/dist/plugin/skills/muggle-test/SKILL.md +146 -121
  12. package/dist/plugin/skills/muggle-test-feature-local/SKILL.md +66 -16
  13. package/dist/plugin/skills/muggle-test-import/SKILL.md +127 -25
  14. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +201 -0
  15. package/dist/plugin/skills/muggle-test-regenerate-missing/evals/evals.json +58 -0
  16. package/dist/plugin/skills/muggle-test-regenerate-missing/evals/trigger-eval.json +22 -0
  17. package/dist/release-manifest.json +7 -0
  18. package/package.json +7 -7
  19. package/plugin/.claude-plugin/plugin.json +1 -1
  20. package/plugin/.cursor-plugin/plugin.json +1 -1
  21. package/plugin/README.md +1 -0
  22. package/plugin/skills/do/e2e-acceptance.md +6 -3
  23. package/plugin/skills/do/open-prs.md +35 -74
  24. package/plugin/skills/muggle-pr-visual-walkthrough/SKILL.md +181 -0
  25. package/plugin/skills/muggle-test/SKILL.md +146 -121
  26. package/plugin/skills/muggle-test-feature-local/SKILL.md +66 -16
  27. package/plugin/skills/muggle-test-import/SKILL.md +127 -25
  28. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +201 -0
  29. package/plugin/skills/muggle-test-regenerate-missing/evals/evals.json +58 -0
  30. package/plugin/skills/muggle-test-regenerate-missing/evals/trigger-eval.json +22 -0
package/dist/cli.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { runCli } from './chunk-PMI2DI3V.js';
2
+ import { runCli } from './chunk-TP4T4T2Z.js';
3
3
 
4
4
  // src/cli/main.ts
5
5
  runCli().catch((error) => {
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- export { src_exports2 as commands, createChildLogger, createUnifiedMcpServer, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, server_exports as server, src_exports as shared } from './chunk-PMI2DI3V.js';
1
+ export { src_exports2 as commands, createChildLogger, createUnifiedMcpServer, e2e_exports as e2e, getConfig, getLocalQaTools, getLogger, getQaTools, local_exports as localQa, mcp_exports as mcp, e2e_exports as qa, server_exports as server, src_exports as shared } from './chunk-TP4T4T2Z.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": "4.4.0",
4
+ "version": "4.6.0",
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": "4.4.0",
5
+ "version": "4.6.0",
6
6
  "author": {
7
7
  "name": "Muggle AI",
8
8
  "email": "support@muggle-ai.com"
@@ -28,6 +28,7 @@ Type `muggle` to discover the full command family.
28
28
  | `/muggle:muggle-test` | Change-driven E2E acceptance router: detects code changes, maps to use cases, runs test generation locally or remotely, publishes to dashboard, opens in browser, posts E2E acceptance results to PR. |
29
29
  | `/muggle:muggle-test-feature-local` | Test a feature on localhost with AI-driven browser automation. Offers publish to cloud after each run. |
30
30
  | `/muggle:muggle-test-import` | Import existing tests into Muggle Test — from Playwright/Cypress specs, PRDs, Gherkin feature files, test plan docs, or any test artifact. |
31
+ | `/muggle:muggle-test-regenerate-missing` | Bulk-regenerate test scripts for every test case in a project that doesn't currently have an active script. Scans DRAFT + GENERATION_PENDING, confirms the list with the user, and dispatches remote generation workflows for each. |
31
32
  | `/muggle:muggle-status` | Health check for Electron browser test runner, MCP server, and authentication. |
32
33
  | `/muggle:muggle-repair` | Diagnose and fix broken installation automatically. |
33
34
  | `/muggle:muggle-upgrade` | Update Electron browser test runner and MCP server to latest version. |
@@ -33,7 +33,12 @@ Read `localUrl` for each repo from the context. If it is not provided, ask the u
33
33
  ### Step 1: Check Authentication
34
34
 
35
35
  - `muggle-remote-auth-status`
36
- - If not signed in: `muggle-remote-auth-login` then `muggle-remote-auth-poll`
36
+ - If **authenticated**: print the logged-in email and ask via `AskQuestion`:
37
+ > "You're logged in as **{email}**. Continue with this account?"
38
+ - Option 1: "Yes, continue"
39
+ - Option 2: "No, switch account"
40
+ If the user picks "switch account", call `muggle-remote-auth-login` with `forceNewSession: true` then `muggle-remote-auth-poll`.
41
+ - If **not signed in or expired**: `muggle-remote-auth-login` then `muggle-remote-auth-poll`
37
42
 
38
43
  Do not skip or assume auth.
39
44
 
@@ -62,7 +67,6 @@ For each relevant test case:
62
67
  - `testScript`: the full script object
63
68
  - `actionScript`: the full action script object (from `muggle-remote-action-script-get`)
64
69
  - `localUrl`: the resolved local URL
65
- - `approveElectronAppLaunch`: `true` *(pipeline context — user starting `muggle-do` is implicit approval)*
66
70
  - `timeoutMs`: `600000` (10 min) or `900000` (15 min) for complex flows
67
71
 
68
72
  3. **If no script exists** (generation path):
@@ -70,7 +74,6 @@ For each relevant test case:
70
74
  - `muggle-local-execute-test-generation` with:
71
75
  - `testCase`: the full test case object
72
76
  - `localUrl`: the resolved local URL
73
- - `approveElectronAppLaunch`: `true`
74
77
  - `timeoutMs`: `600000` (10 min) or `900000` (15 min) for complex flows
75
78
 
76
79
  4. When execution completes, call `muggle-local-run-result-get` with the `runId` returned by the execute call.
@@ -23,80 +23,15 @@ For each repo with changes:
23
23
  - If E2E acceptance tests have failures: `[E2E FAILING] <goal>`
24
24
  - Otherwise: `<goal>`
25
25
  - Keep under 70 characters
26
- 3. **Build the PR body** with these sections:
26
+ 3. **Render the E2E acceptance block** by invoking the shared `muggle-pr-visual-walkthrough` skill in **Mode B** (render-only for embedding). See "Rendering the E2E acceptance block via the shared skill" below. You receive `{body, comment}` where `body` is the E2E markdown block and `comment` is a non-null overflow comment only when the content exceeds the CLI's byte budget.
27
+ 4. **Build the PR body** by concatenating, in order:
27
28
  - `## Goal` — the requirements goal
28
29
  - `## Acceptance Criteria` — bulleted list (omit section if empty)
29
30
  - `## Changes` — summary of what changed in this repo
30
- - E2E acceptance evidence block from `muggle build-pr-section` (see "Rendering the E2E acceptance results block" below)
31
- 4. **Create the PR** using `gh pr create --title "..." --body "..." --head <branch>` in the repo directory.
32
- 5. **Capture the PR URL** and extract the PR number.
33
- 6. **Post the overflow comment only if `muggle build-pr-section` emitted one** (see "Rendering the E2E acceptance results block" below). In the common case, no comment is posted.
34
-
35
- ## Rendering the E2E acceptance results block
36
-
37
- Do **not** hand-write the `## E2E Acceptance Results` markdown. Use the `muggle build-pr-section` CLI, which renders a deterministic block and decides whether the evidence fits in the PR description or needs to spill into an overflow comment.
38
-
39
- ### Step A: Build the report JSON
40
-
41
- Assemble the e2e-acceptance report you collected in `e2e-acceptance.md` into a JSON object with this shape:
42
-
43
- ```json
44
- {
45
- "projectId": "<project UUID>",
46
- "tests": [
47
- {
48
- "name": "<test case name>",
49
- "testCaseId": "<UUID>",
50
- "testScriptId": "<UUID or omitted>",
51
- "runId": "<UUID>",
52
- "viewUrl": "<muggle-ai.com run URL>",
53
- "status": "passed",
54
- "steps": [
55
- { "stepIndex": 0, "action": "<action>", "screenshotUrl": "<URL>" }
56
- ]
57
- },
58
- {
59
- "name": "<test case name>",
60
- "testCaseId": "<UUID>",
61
- "runId": "<UUID>",
62
- "viewUrl": "<muggle-ai.com run URL>",
63
- "status": "failed",
64
- "failureStepIndex": 2,
65
- "error": "<error message>",
66
- "artifactsDir": "<path, optional>",
67
- "steps": [
68
- { "stepIndex": 0, "action": "<action>", "screenshotUrl": "<URL>" }
69
- ]
70
- }
71
- ]
72
- }
73
- ```
74
-
75
- ### Step B: Render the evidence block
76
-
77
- Pipe the JSON into `muggle build-pr-section`. It writes `{ "body": "...", "comment": "..." | null }` to stdout:
78
-
79
- ```bash
80
- echo "$REPORT_JSON" | muggle build-pr-section > /tmp/muggle-pr-section.json
81
- ```
82
-
83
- The command exits nonzero on malformed input and writes a descriptive error to stderr — do not swallow that error, surface it to the user.
84
-
85
- ### Step C: Build the PR body
86
-
87
- Build the PR body by concatenating, in order:
88
-
89
- - `## Goal` — the requirements goal
90
- - `## Acceptance Criteria` — bulleted list (omit section if empty)
91
- - `## Changes` — summary of what changed in this repo
92
- - The `body` field from the CLI output (already contains its own `## E2E Acceptance Results` header)
93
-
94
- ### Step D: Create the PR, then post the overflow comment only if present
95
-
96
- 1. Create the PR with `gh pr create --title "..." --body "..." --head <branch>`.
97
- 2. Capture the PR URL and extract the PR number.
98
- 3. If the CLI output's `comment` field is `null`, **do not post a comment** — everything is already in the PR description.
99
- 4. If the CLI output's `comment` field is a non-null string, post it as a follow-up comment:
31
+ - The `body` field from the skill output (already contains its own `## E2E Acceptance Results` header — do not add another)
32
+ 5. **Create the PR** using `gh pr create --title "..." --body "..." --head <branch>` in the repo directory.
33
+ 6. **Capture the PR URL** and extract the PR number.
34
+ 7. **Post the overflow `comment` only if it is non-null.** In the common case, `comment` is `null` and nothing is posted. Never post speculatively.
100
35
 
101
36
  ```bash
102
37
  gh pr comment <PR#> --body "$(cat <<'EOF'
@@ -105,11 +40,37 @@ Build the PR body by concatenating, in order:
105
40
  )"
106
41
  ```
107
42
 
43
+ ## Rendering the E2E acceptance block via the shared skill
44
+
45
+ **Do not hand-write the `## E2E Acceptance Results` markdown, and do not call `muggle build-pr-section` directly from this stage.** The rendering workflow is owned by the shared **`muggle-pr-visual-walkthrough`** skill (see `plugin/skills/muggle-pr-visual-walkthrough/SKILL.md`), which wraps the CLI and enforces the `E2eReport` input contract with a Zod schema.
46
+
47
+ ### Input — the `E2eReport` JSON
48
+
49
+ The `e2e-acceptance.md` stage already produces an `E2eReport` with the exact shape the skill expects (`projectId` + `tests[]` with per-test `name`, `testCaseId`, `testScriptId`, `runId`, `viewUrl`, `status`, and `steps[]` of `{stepIndex, action, screenshotUrl}`; failed tests additionally have `failureStepIndex`, `error`, and optionally `artifactsDir`). Pass it through unchanged — do not reshape it. The full schema is documented in the shared skill.
50
+
51
+ ### Invocation — Mode B (render-only)
52
+
53
+ Invoke `muggle-pr-visual-walkthrough` via the `Skill` tool with the `E2eReport` already in context. The skill will:
54
+
55
+ 1. Validate the `E2eReport` and call `muggle build-pr-section` (piping the JSON to stdin).
56
+ 2. Parse the CLI's `{body, comment}` stdout.
57
+ 3. **Return `{body, comment}` to this stage's conversation** without posting anything — because Mode B is render-only. `body` is the E2E markdown block; `comment` is a non-null overflow follow-up comment only when content exceeds the byte budget, otherwise `null`.
58
+
59
+ Mode A (where the skill itself finds an existing PR and posts a `gh pr comment`) is **not used by `muggle-do`** — it's for interactive callers like `muggle-test` that are mid-development with a PR already open. `muggle-do` always creates new PRs, so it always uses Mode B.
60
+
61
+ ### After rendering
62
+
63
+ Back in this stage:
64
+
65
+ - Embed `body` in the `gh pr create --body` body (see step 4 above).
66
+ - Post the overflow `comment` as a follow-up **only when it is non-null** (see step 7 above).
67
+ - If the CLI exited non-zero, the skill surfaces the stderr error — do not swallow it, surface it to the user.
68
+
108
69
  ### Notes on fit vs. overflow
109
70
 
110
- - **The common case is fit**: the full evidence (summary, per-test rows, collapsible failure details) lives in the PR description, no comment is posted.
111
- - **The overflow case** is triggered automatically when the full inline body would exceed the CLI's budget. In that case the PR description contains the summary, the per-test rows, and a pointer line; the full step-by-step failure details live in the follow-up comment.
112
- - You do not make the fit-vs-overflow decision — the CLI does. Never post the comment speculatively.
71
+ - **Common case (fit):** the full evidence (summary, per-test rows, collapsible failure details) lives in the PR description, `comment` is `null`, no follow-up comment is posted.
72
+ - **Overflow case:** the CLI detects the full body would exceed its byte budget; `body` contains the summary, per-test rows, and a pointer line; `comment` contains the overflow details. Post both.
73
+ - You do not make the fit-vs-overflow decision — the CLI does. Never post the comment when it is `null`.
113
74
 
114
75
  ## Output
115
76
 
@@ -0,0 +1,181 @@
1
+ ---
2
+ name: muggle-pr-visual-walkthrough
3
+ description: Renders and posts a visual walkthrough of Muggle AI E2E acceptance test results to a PR — per-test-case dashboard links, step-by-step screenshots, and pass/fail summary — using the `muggle build-pr-section` CLI for deterministic formatting with automatic fit-vs-overflow. Use at the end of any Muggle test run (local or remote) to give PR reviewers clickable visual evidence that user flows work. Triggers on 'post results to PR', 'attach walkthrough to PR', 'share E2E screenshots on the PR', 'add visual walkthrough to PR'.
4
+ ---
5
+
6
+ # Muggle PR Visual Walkthrough
7
+
8
+ Renders a visual walkthrough of Muggle AI E2E acceptance test results and posts it to a PR. Each test case is linked to its detail page on the Muggle AI dashboard, so PR reviewers can click through to see step-by-step screenshots and action scripts — not just a pass/fail flag.
9
+
10
+ This is the **canonical PR-walkthrough workflow** shared across every Muggle entry point:
11
+
12
+ | Caller | Mode | When to invoke |
13
+ | :--- | :--- | :--- |
14
+ | `muggle-test` | **Mode A** (post to existing PR) | After publishing results, user opts in via `AskQuestion` |
15
+ | `muggle-test-feature-local` | **Mode A** (post to existing PR) | After publishing the run, user opts in via `AskQuestion` |
16
+ | `muggle-do` / `open-prs.md` | **Mode B** (render-only for embedding) | During PR creation — caller embeds `body` in `gh pr create` and posts `comment` as follow-up |
17
+
18
+ Rendering is always done by `muggle build-pr-section`, a battle-tested CLI that handles deterministic markdown layout, per-step screenshots, and automatic fit-vs-overflow (oversized content spills into a follow-up comment). Never hand-write the walkthrough markdown.
19
+
20
+ ## Input contract: the `E2eReport` JSON
21
+
22
+ Every caller must build an `E2eReport` JSON object and have it in conversation context before invoking this skill. The schema is defined in `src/cli/pr-section/types.ts` (`E2eReportSchema`) and enforced by the CLI with Zod — malformed input exits non-zero with a descriptive stderr message.
23
+
24
+ ```json
25
+ {
26
+ "projectId": "<UUID>",
27
+ "tests": [
28
+ {
29
+ "name": "<test case name>",
30
+ "testCaseId": "<UUID>",
31
+ "testScriptId": "<UUID>",
32
+ "runId": "<UUID>",
33
+ "viewUrl": "https://www.muggle-ai.com/...",
34
+ "status": "passed",
35
+ "steps": [
36
+ { "stepIndex": 0, "action": "Click login button", "screenshotUrl": "https://..." },
37
+ { "stepIndex": 1, "action": "Type email", "screenshotUrl": "https://..." }
38
+ ]
39
+ },
40
+ {
41
+ "name": "Checkout flow",
42
+ "testCaseId": "<UUID>",
43
+ "testScriptId": "<UUID>",
44
+ "runId": "<UUID>",
45
+ "viewUrl": "https://www.muggle-ai.com/...",
46
+ "status": "failed",
47
+ "steps": [
48
+ { "stepIndex": 0, "action": "Open cart", "screenshotUrl": "https://..." }
49
+ ],
50
+ "failureStepIndex": 2,
51
+ "error": "Element not found: Click checkout button",
52
+ "artifactsDir": "/Users/.../~/.muggle-ai/sessions/<runId>"
53
+ }
54
+ ]
55
+ }
56
+ ```
57
+
58
+ Required fields per test: `name`, `testCaseId`, `runId`, `viewUrl`, `status`, `steps[]` with `{stepIndex, action, screenshotUrl}`. Failed tests additionally require `failureStepIndex` and `error`. `testScriptId` and `artifactsDir` are optional.
59
+
60
+ If any required field is missing, stop and tell the caller exactly what's missing. Never fabricate data.
61
+
62
+ ## Step 1: Gather the `E2eReport`
63
+
64
+ How to assemble the JSON depends on which caller you are:
65
+
66
+ ### From `muggle-test` / `muggle-test-feature-local` (local mode)
67
+
68
+ After `muggle-local-publish-test-script` returns `{testScriptId, viewUrl, ...}` for each run:
69
+
70
+ 1. Call `muggle-remote-test-script-get` with `testScriptId` to fetch the published script.
71
+ 2. Extract `steps[]` — for each step, build `{stepIndex: <index>, action: operation.action, screenshotUrl: operation.screenshotUrl}`.
72
+ 3. Determine `status` from the local run result (`muggle-local-run-result-get`).
73
+ 4. For failures, read `failureStepIndex`, `error`, and `artifactsDir` from the run result.
74
+ 5. Assemble the `E2eReport` with `projectId` from the test run.
75
+
76
+ ### From `muggle-do` (`open-prs.md`)
77
+
78
+ The `e2e-acceptance.md` stage already produces an `E2eReport` with the exact shape above — that is the report's native output format. Pass it through unchanged.
79
+
80
+ ### Direct invocation (user asked to post existing results)
81
+
82
+ The caller must have already executed tests and published them. If the `E2eReport` is not in context, stop and tell the user to run `muggle-test` or `muggle-test-feature-local` first.
83
+
84
+ ## Step 2: Render via `muggle build-pr-section`
85
+
86
+ Pipe the `E2eReport` JSON to the CLI. It writes `{"body": "...", "comment": "..." | null}` to stdout — the `body` is the E2E markdown block, and `comment` is a non-null overflow comment only when the full body exceeds the byte budget (default 60 KB).
87
+
88
+ ```bash
89
+ echo "$REPORT_JSON" | muggle build-pr-section > /tmp/muggle-pr-section.json
90
+ ```
91
+
92
+ - Exit **non-zero** → the CLI wrote a descriptive error to stderr. Surface it to the user; do not swallow it.
93
+ - `comment` is **`null`** (fit case) → everything is inline in `body`. Post `body` only.
94
+ - `comment` is a **non-null string** (overflow case) → `body` contains the summary + a pointer; `comment` contains the full per-step details. Post both, in order.
95
+
96
+ Never hand-write the walkthrough markdown. Never modify the CLI's output before posting. The CLI owns the format.
97
+
98
+ ## Step 3 — Mode A: Post to an existing PR
99
+
100
+ Used by `muggle-test` and `muggle-test-feature-local`, where the user is mid-development and a PR already exists on the current branch.
101
+
102
+ ### 3A.1: Find the PR
103
+
104
+ ```bash
105
+ gh pr view --json number,url,title 2>/dev/null
106
+ ```
107
+
108
+ - **PR exists** → continue to 3A.2
109
+ - **No PR exists** → use `AskQuestion`:
110
+ - "Create a new PR with the visual walkthrough in the body"
111
+ - "Skip posting"
112
+ - If the user chooses to create a new PR, switch to Mode B and return the rendered `body`/`comment` to the caller for embedding in `gh pr create`. Do not create the PR directly from this skill unless the caller has no better way to do it.
113
+ - **`gh` not installed or not authenticated** → tell the user, suggest `gh auth login`, stop.
114
+
115
+ ### 3A.2: Post the body as a PR comment
116
+
117
+ ```bash
118
+ gh pr comment <pr-number> --body "$(cat <<'EOF'
119
+ <contents of body field from CLI output>
120
+ EOF
121
+ )"
122
+ ```
123
+
124
+ ### 3A.3: Post the overflow comment only if the CLI emitted one
125
+
126
+ ```bash
127
+ gh pr comment <pr-number> --body "$(cat <<'EOF'
128
+ <contents of comment field from CLI output>
129
+ EOF
130
+ )"
131
+ ```
132
+
133
+ **Skip this step entirely if `comment` is `null`** — do not post a placeholder. The CLI decides fit-vs-overflow; never post the overflow comment speculatively.
134
+
135
+ ### 3A.4: Confirm to the user
136
+
137
+ > "Visual walkthrough posted to PR #<number>. Reviewers can click any test case link to see the step-by-step screenshots on the Muggle AI dashboard."
138
+
139
+ Include the PR URL in the confirmation.
140
+
141
+ ## Step 3 — Mode B: Return rendered block for embedding in a new PR
142
+
143
+ Used by `muggle-do`'s `open-prs.md`, where the PR does not exist yet and the caller is assembling the PR body from multiple sections (`## Goal`, `## Acceptance Criteria`, `## Changes`, plus this walkthrough).
144
+
145
+ Instead of posting, **return** the CLI output to the caller's context so they can:
146
+
147
+ 1. **Embed `body`** in their PR body, concatenated after `## Changes`. `body` already includes its own `## E2E Acceptance Results` header — do not add another.
148
+ 2. **Create the PR** with `gh pr create --title "..." --body "..."` using the concatenated body.
149
+ 3. **Post `comment` as a follow-up only if the CLI emitted one:**
150
+
151
+ ```bash
152
+ gh pr comment <new-pr-number> --body "$(cat <<'EOF'
153
+ <contents of comment field>
154
+ EOF
155
+ )"
156
+ ```
157
+
158
+ Skip if `comment` is `null`.
159
+
160
+ In Mode B, this skill does not call `gh pr comment` or `gh pr create` itself — the caller owns PR creation because it also owns branch pushing, title building (including `[E2E FAILING]` prefix on failures), and multi-repo orchestration.
161
+
162
+ ## Tool Reference
163
+
164
+ | Phase | Tool |
165
+ |:------|:-----|
166
+ | Gather per-step data (muggle-test, muggle-test-feature-local) | `muggle-remote-test-script-get` |
167
+ | Render the walkthrough markdown | `muggle build-pr-section` (shell) |
168
+ | Find existing PR (Mode A) | `gh pr view` |
169
+ | Post comment(s) (Mode A) | `gh pr comment` |
170
+ | Create new PR (Mode B, caller handles) | `gh pr create` |
171
+ | User confirmation (Mode A no-PR branch) | `AskQuestion` |
172
+
173
+ ## Guardrails
174
+
175
+ - **Never hand-write the walkthrough markdown** — always call `muggle build-pr-section`. The CLI is the single source of truth for formatting.
176
+ - **Never modify the CLI's output** — post `body` and (if present) `comment` verbatim. Any reformatting defeats the fit-vs-overflow budget math.
177
+ - **Never invent report fields** — if `projectId`, a per-test `viewUrl`, or per-step `screenshotUrl` is missing, stop and report what's missing. Do not fabricate URLs or fill in placeholders.
178
+ - **Never post the overflow comment when `comment` is `null`** — the CLI decides fit-vs-overflow.
179
+ - **Never create a PR without confirmation in Mode A** — if no PR exists, ask the user or switch to Mode B and hand back to the caller.
180
+ - **Don't run tests** — this skill only renders and posts existing results. If the `E2eReport` is not in context, redirect the caller to `muggle-test`, `muggle-test-feature-local`, or `muggle-do`.
181
+ - **Mode A vs Mode B is chosen by the caller, not the user** — `muggle-test` always uses Mode A; `muggle-do` always uses Mode B. Don't ask the user which mode to use.