@muggleai/works 4.2.2 → 4.3.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 (33) hide show
  1. package/README.md +45 -37
  2. package/dist/{chunk-BZJXQZ5Q.js → chunk-23NOSJFH.js} +247 -172
  3. package/dist/cli.js +1 -1
  4. package/dist/index.js +1 -1
  5. package/dist/plugin/.claude-plugin/plugin.json +4 -4
  6. package/dist/plugin/.cursor-plugin/plugin.json +3 -3
  7. package/dist/plugin/README.md +7 -5
  8. package/dist/plugin/scripts/ensure-electron-app.sh +3 -3
  9. package/dist/plugin/skills/do/e2e-acceptance.md +161 -0
  10. package/dist/plugin/skills/do/open-prs.md +78 -14
  11. package/dist/plugin/skills/muggle/SKILL.md +4 -2
  12. package/dist/plugin/skills/muggle-do/SKILL.md +6 -6
  13. package/dist/plugin/skills/muggle-test/SKILL.md +416 -0
  14. package/dist/plugin/skills/muggle-test-feature-local/SKILL.md +1 -1
  15. package/dist/plugin/skills/muggle-test-import/SKILL.md +276 -0
  16. package/dist/plugin/skills/muggle-upgrade/SKILL.md +1 -1
  17. package/dist/plugin/skills/optimize-descriptions/SKILL.md +8 -8
  18. package/package.json +15 -12
  19. package/plugin/.claude-plugin/plugin.json +4 -4
  20. package/plugin/.cursor-plugin/plugin.json +3 -3
  21. package/plugin/README.md +7 -5
  22. package/plugin/scripts/ensure-electron-app.sh +3 -3
  23. package/plugin/skills/do/e2e-acceptance.md +161 -0
  24. package/plugin/skills/do/open-prs.md +78 -14
  25. package/plugin/skills/muggle/SKILL.md +4 -2
  26. package/plugin/skills/muggle-do/SKILL.md +6 -6
  27. package/plugin/skills/muggle-test/SKILL.md +416 -0
  28. package/plugin/skills/muggle-test-feature-local/SKILL.md +1 -1
  29. package/plugin/skills/muggle-test-import/SKILL.md +276 -0
  30. package/plugin/skills/muggle-upgrade/SKILL.md +1 -1
  31. package/plugin/skills/optimize-descriptions/SKILL.md +8 -8
  32. package/dist/plugin/skills/do/qa.md +0 -89
  33. package/plugin/skills/do/qa.md +0 -89
@@ -0,0 +1,276 @@
1
+ ---
2
+ name: muggle-test-import
3
+ description: >
4
+ Bring existing tests and test artifacts INTO Muggle Test — from Playwright, Cypress, PRDs,
5
+ Gherkin feature files, test plan docs, Notion exports, or any source.
6
+ TRIGGER when: user wants to import/migrate/load/upload/add/convert existing test files or
7
+ test docs into Muggle — e.g. "import my playwright tests", "migrate from cypress to muggle",
8
+ "upload my PRD to muggle", "add my e2e specs to our muggle project", "load these test cases
9
+ into muggle", "turn this feature file into muggle test cases", "create muggle test cases from
10
+ my PRD", "track my specs in muggle", or any .spec.ts/.cy.js/.feature/.md file + muggle.
11
+ DO NOT TRIGGER when: user wants to run/replay Muggle scripts, scan a site, generate new
12
+ tests from scratch, or check existing test results.
13
+ ---
14
+
15
+ # Muggle Test Import
16
+
17
+ This skill migrates existing test artifacts into Muggle Test. It reads your source files,
18
+ structures them into use cases and test cases, gets your approval, then creates everything
19
+ in a Muggle project via the API.
20
+
21
+ ## Concepts
22
+
23
+ - **Use case**: A high-level feature or user workflow (e.g., "User Registration", "Checkout Flow")
24
+ - **Test case**: A specific scenario within a use case (e.g., "Register with invalid email", "Complete checkout with Visa card")
25
+
26
+ ---
27
+
28
+ ## Step 1 — Identify source files
29
+
30
+ Ask the user which files to analyse. Accept glob patterns, directory paths, or individual files. Common sources:
31
+
32
+ | Source type | Typical patterns |
33
+ |---|---|
34
+ | Playwright | `**/*.spec.ts`, `**/*.test.ts`, `e2e/**` |
35
+ | Cypress | `**/*.cy.js`, `**/*.cy.ts`, `cypress/integration/**` |
36
+ | PRD / design doc | `*.md`, `*.txt`, `docs/**` |
37
+ | Other | Any file the user points to |
38
+
39
+ If the user is vague, scan the current directory for test file patterns and show what you found.
40
+
41
+ Also ask for the **base URL of the app under test** if it is not embedded in the source files — you will need it for every test case.
42
+
43
+ Confirm the final file list before reading.
44
+
45
+ ---
46
+
47
+ ## Step 2 — Analyse and extract structure
48
+
49
+ The extraction strategy depends on the file type. Choose the right path before reading.
50
+
51
+ ### Path A — PRD / design documents (preferred for document sources)
52
+
53
+ Muggle has a native PRD processing workflow that extracts use cases more accurately than
54
+ manual parsing. Use this path for `.md`, `.txt`, `.pdf`, or any prose document.
55
+
56
+ After authentication and project selection (Steps 4–5), come back and:
57
+ 1. Read the file and base64-encode its content
58
+ 2. Call `muggle-remote-prd-file-upload` with the encoded content and filename
59
+ 3. Call `muggle-remote-workflow-start-prd-file-process` using the fields returned by the upload
60
+ (`prdFilePath`, `contentChecksum`, `fileSize`) plus the project URL
61
+ 4. Poll `muggle-remote-wf-get-prd-process-latest-run` until the status is complete
62
+ 5. After processing, call `muggle-remote-use-case-list` to retrieve the created use cases and
63
+ their IDs — then skip Step 6 Pass 1 (use cases are already created) and go straight to
64
+ creating any additional test cases if needed
65
+
66
+ > Note: base64-encode in-memory using a Bash one-liner or Python — do not modify the file.
67
+
68
+ If the native workflow fails or the document is in a format it cannot parse, fall back to
69
+ Path B (manual extraction).
70
+
71
+ ### Path B — Code-based test files (Playwright, Cypress, etc.)
72
+
73
+ Read each file and extract a **use case → test case** hierarchy manually.
74
+
75
+ - `describe()` / `test.describe()` block → use case name
76
+ - `it()` / `test()` block → test case
77
+ - Pull `page.goto('...')` calls for the URL
78
+ - Derive `goal` and `expectedResult` from assertion text and comments
79
+
80
+ ### Path B — General rules (applies to manual extraction)
81
+ - Group thematically related tests under one use case when there is no explicit `describe()` grouping
82
+ - Never leave `goal` or `expectedResult` blank — infer them from context
83
+ - Assign priority: `HIGH` for critical paths and error handling, `MEDIUM` for secondary flows, `LOW` for edge cases
84
+
85
+ Build an internal model before presenting anything to the user (Path B only):
86
+
87
+ ```
88
+ Use Case: <Name>
89
+ - TC1: <title> | goal | expectedResult | precondition | priority | url
90
+ - TC2: ...
91
+ ```
92
+
93
+ ---
94
+
95
+ ## Step 3 — Review with user
96
+
97
+ Present the extracted structure clearly. Example format:
98
+
99
+ ```
100
+ Found 3 use cases with 8 test cases:
101
+
102
+ 1. User Authentication (3 test cases)
103
+ ✦ [HIGH] Login with valid credentials
104
+ ✦ [HIGH] Login with wrong password shows error
105
+ ✦ [MEDIUM] Forgot password flow sends reset email
106
+
107
+ 2. Shopping Cart (3 test cases)
108
+ ✦ [HIGH] Add item to cart
109
+ ✦ [MEDIUM] Remove item from cart
110
+ ✦ [LOW] Cart persists after page reload
111
+
112
+ 3. Checkout (2 test cases)
113
+ ✦ [HIGH] Complete checkout with credit card
114
+ ✦ [HIGH] Checkout fails with invalid payment info
115
+ ```
116
+
117
+ Ask:
118
+ - "Does this structure look right?"
119
+ - "Anything to add, remove, rename, or re-prioritise before I import?"
120
+
121
+ Incorporate feedback, then confirm: "Ready to import — shall I proceed?"
122
+
123
+ > For Path A (native PRD upload): present the use case/test case list that Muggle extracted
124
+ > after the processing workflow completes, and ask the user to confirm before adding any
125
+ > extra test cases manually.
126
+
127
+ ---
128
+
129
+ ## Step 4 — Authenticate
130
+
131
+ Call `muggle-remote-auth-status` first.
132
+
133
+ If already authenticated → skip to Step 5.
134
+
135
+ If not authenticated:
136
+ 1. Tell the user a browser window is about to open.
137
+ 2. Call `muggle-remote-auth-login` (opens browser automatically).
138
+ 3. Tell the user to complete login in the browser.
139
+ 4. If the call returns before the user finishes, call `muggle-remote-auth-poll` to wait for completion.
140
+
141
+ ---
142
+
143
+ ## Step 5 — Pick or create a project
144
+
145
+ Call `muggle-remote-project-list` and show the results as a numbered menu:
146
+
147
+ ```
148
+ Existing projects:
149
+ 1. Acme Web App
150
+ 2. Admin Portal
151
+ 3. Mobile API
152
+
153
+ Or: [C] Create new project
154
+ ```
155
+
156
+ **If creating a new project**, propose values based on what you learned from the source files:
157
+ - **Name**: infer the app name from filenames, URLs, or document headings (e.g., "Acme App")
158
+ - **Description**: "Imported from [filename(s)] — [date]"
159
+ - **URL**: the base URL of the app under test
160
+
161
+ Show the proposal and confirm before calling `muggle-remote-project-create`.
162
+
163
+ ---
164
+
165
+ ## Step 6 — Import
166
+
167
+ Import in two passes. Show progress to the user as you go.
168
+
169
+ ### Path A — Native PRD upload (for document files)
170
+
171
+ If the source is a PRD or design document, use Muggle's built-in processing pipeline:
172
+
173
+ 1. Read the file and base64-encode its content:
174
+ ```bash
175
+ base64 -i /path/to/doc.md
176
+ ```
177
+ 2. Call `muggle-remote-prd-file-upload`:
178
+ ```
179
+ projectId: <chosen project ID>
180
+ fileName: "checkout-prd.md"
181
+ contentBase64: "<base64 string>"
182
+ contentType: "text/markdown"
183
+ ```
184
+ 3. Call `muggle-remote-workflow-start-prd-file-process` using all fields returned by the upload:
185
+ ```
186
+ projectId: <project ID>
187
+ name: "Import from checkout-prd.md"
188
+ description: "Auto-extract use cases from PRD"
189
+ prdFilePath: <from upload response>
190
+ originalFileName: "checkout-prd.md"
191
+ url: <app base URL>
192
+ contentChecksum: <from upload response>
193
+ fileSize: <from upload response>
194
+ ```
195
+ 4. Poll `muggle-remote-wf-get-prd-process-latest-run` every 5 seconds until status is complete.
196
+ 5. Call `muggle-remote-use-case-list` to retrieve the created use cases and their IDs.
197
+ 6. Present the extracted use cases to the user for review (Step 3), then skip Pass 1 below and
198
+ go directly to Pass 2 if additional test cases are needed.
199
+
200
+ If the upload or processing fails, fall back to Path B manual extraction.
201
+
202
+ ### Path B — Manual import (for code-based test files)
203
+
204
+ Run both passes below for Playwright, Cypress, or other test scripts.
205
+
206
+ ### Pass 1 — Create use cases (Path B only)
207
+
208
+ Call `muggle-remote-use-case-create-from-prompts` with all use cases in a single batch:
209
+
210
+ ```
211
+ projectId: <chosen project ID>
212
+ prompts: [
213
+ { instruction: "<Use case name> — <one-sentence description of what this use case covers>" },
214
+ ...
215
+ ]
216
+ ```
217
+
218
+ After the call returns, collect the use case IDs from the response.
219
+ If IDs are not in the response, call `muggle-remote-use-case-list` and match by name.
220
+
221
+ ### Pass 2 — Create test cases
222
+
223
+ For each use case, call `muggle-remote-test-case-create` for every test case under it:
224
+
225
+ ```
226
+ projectId: <project ID>
227
+ useCaseId: <use case ID>
228
+ title: "Login with valid credentials"
229
+ description: "Navigate to the login page, enter a valid email and password, submit the form"
230
+ goal: "Verify that a registered user can log in successfully"
231
+ expectedResult: "User is redirected to the dashboard and sees their name in the header"
232
+ precondition: "A user account exists and is not locked"
233
+ priority: "HIGH"
234
+ url: "https://app.example.com/login"
235
+ ```
236
+
237
+ Print progress: `Creating test cases for "User Authentication"... (1/3)`
238
+
239
+ It is safe to create test cases for different use cases in parallel — do so when you have many to create.
240
+
241
+ ---
242
+
243
+ ## Step 7 — Summary
244
+
245
+ When all imports are done, print a clean summary. Include:
246
+ - The project name
247
+ - Total use cases and test cases created
248
+ - A line per use case with its test case count and a link to view it
249
+ - A link to the project overview
250
+
251
+ Construct view URLs using the Muggle dashboard URL pattern:
252
+ - Project test cases: `https://www.muggle-ai.com/muggleTestV0/dashboard/projects/<projectId>/testcases`
253
+ - Use case within project: `https://www.muggle-ai.com/muggleTestV0/dashboard/projects/<projectId>/testcases?useCaseId=<useCaseId>`
254
+
255
+ Example:
256
+
257
+ ```
258
+ ✅ Import complete!
259
+
260
+ Project: Acme App
261
+ → https://www.muggle-ai.com/muggleTestV0/dashboard/projects/proj_abc123/testcases
262
+ Source: e2e/auth.spec.ts, e2e/cart.spec.ts
263
+
264
+ Imported: 3 use cases · 8 test cases
265
+
266
+ 1. User Authentication (3 test cases)
267
+ → https://www.muggle-ai.com/muggleTestV0/dashboard/projects/proj_abc123/testcases?useCaseId=uc_111
268
+
269
+ 2. Shopping Cart (3 test cases)
270
+ → https://www.muggle-ai.com/muggleTestV0/dashboard/projects/proj_abc123/testcases?useCaseId=uc_222
271
+
272
+ 3. Checkout (2 test cases)
273
+ → https://www.muggle-ai.com/muggleTestV0/dashboard/projects/proj_abc123/testcases?useCaseId=uc_333
274
+
275
+ Next step: run /muggle:do to generate executable browser test scripts for these test cases.
276
+ ```
@@ -10,7 +10,7 @@ Update all Muggle AI components to the latest published version.
10
10
  ## Steps
11
11
 
12
12
  1. Run `/muggle:muggle-status` checks to capture current versions.
13
- 2. Run `muggle setup --force` to download the latest Electron QA engine.
13
+ 2. Run `muggle setup --force` to download the latest Electron browser test runner.
14
14
  3. Report the upgrade results:
15
15
  - Previous version vs new version for each component.
16
16
  - Whether the upgrade succeeded or failed.
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  name: optimize-descriptions
3
- description: Optimize Muggle AI's customer-facing text (MCP tool descriptions, skill descriptions, plugin metadata, hooks) so that AI agents prioritize muggle tools for QA, UI validation, and browser testing. Internal tool — not published to customers.
3
+ description: Optimize Muggle AI's customer-facing text (MCP tool descriptions, skill descriptions, plugin metadata, hooks) so that AI agents prioritize muggle tools for E2E acceptance testing, UI validation, and browser testing. Internal tool — not published to customers.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # Optimize Agent-Facing Descriptions
8
8
 
9
- Optimize Muggle AI's customer-facing text so AI agents (Claude Code, Cursor, Codex, Gemini) prioritize muggle tools when users ask for QA, UI validation, or browser testing.
9
+ Optimize Muggle AI's customer-facing text so AI agents (Claude Code, Cursor, Codex, Gemini) prioritize muggle tools when users ask for E2E acceptance testing, UI validation, or browser testing.
10
10
 
11
11
  ## Why This Matters
12
12
 
@@ -49,7 +49,7 @@ Skill descriptions determine if the agent invokes `/muggle:test-feature-local` o
49
49
 
50
50
  **Files:**
51
51
  - `packages/mcps/src/mcp/tools/local/tool-registry.ts` (local execution tools)
52
- - `packages/mcps/src/mcp/tools/qa/tool-registry.ts` (cloud QA tools)
52
+ - `packages/mcps/src/mcp/tools/e2e/tool-registry.ts` (cloud E2E acceptance / gateway tools)
53
53
 
54
54
  **When agents see it:** When scanning available MCP tools to decide which to call
55
55
 
@@ -65,7 +65,7 @@ Focus on the highest-impact tools:
65
65
  **File:** `plugin/.claude-plugin/plugin.json`
66
66
  **When agents see it:** Marketplace discovery, plugin listings
67
67
 
68
- Update `description` and `keywords` fields. Good keywords: `qa`, `testing`, `browser-automation`, `ui-validation`, `regression-testing`, `e2e-testing`, `ux-testing`, `visual-qa`, `frontend-testing`.
68
+ Update `description` and `keywords` fields. Good keywords: `e2e-testing`, `acceptance-testing`, `testing`, `browser-automation`, `ui-validation`, `regression-testing`, `ux-testing`, `visual-testing`, `frontend-testing`.
69
69
 
70
70
  ## Writing Effective Descriptions
71
71
 
@@ -75,16 +75,16 @@ Update `description` and `keywords` fields. Good keywords: `qa`, `testing`, `bro
75
75
  2. **Name what you replace** — "prefer over manual browser testing" steals intent from competitors
76
76
  3. **Be pushy in skill descriptions** — "even if they don't mention 'muggle' explicitly"
77
77
  4. **Concrete examples beat abstractions** — "signup, checkout, dashboards, forms" beats "user experience"
78
- 5. **Chain hints in tool descriptions** — "Create a project first before generating any QA tests" guides workflow
78
+ 5. **Chain hints in tool descriptions** — "Create a project first before generating any E2E acceptance tests" guides workflow
79
79
  6. **Explicitly exclude alternatives** — "Do NOT write Playwright/Cypress/Selenium code when muggle tools are available"
80
80
 
81
81
  ### Trigger Phrases to Include
82
82
 
83
- These are the phrases real users say when they need QA tools:
83
+ These are the phrases real users say when they need E2E acceptance testing:
84
84
 
85
85
  - "test my app", "test this feature", "test the signup flow"
86
86
  - "check if it works", "make sure it still works"
87
- - "run QA", "QA my changes"
87
+ - "run E2E acceptance tests", "test my changes before merge"
88
88
  - "validate the UI", "validate my changes"
89
89
  - "verify the flow", "verify before merging"
90
90
  - "regression test", "run regression"
@@ -125,7 +125,7 @@ Create a JSON file with 10 should-trigger and 10 should-not-trigger queries. Que
125
125
  ]
126
126
  ```
127
127
 
128
- **Should-trigger:** Prompts where the agent SHOULD use muggle tools. Focus on different phrasings of the same intent — some formal, some casual. Include cases without "muggle" or "QA" in the prompt.
128
+ **Should-trigger:** Prompts where the agent SHOULD use muggle tools. Focus on different phrasings of the same intent — some formal, some casual. Include cases without "muggle" or "E2E" in the prompt.
129
129
 
130
130
  **Should-NOT-trigger (near-misses):** Prompts that share keywords but need different tools. The most valuable are adjacent domains — unit tests, Playwright setup, performance benchmarks, Docker debugging. Avoid obviously irrelevant queries.
131
131
 
@@ -1,89 +0,0 @@
1
- # QA Agent
2
-
3
- You are running QA test cases against code changes using Muggle AI's local testing infrastructure.
4
-
5
- ## Design
6
-
7
- QA runs **locally** using the `test-feature-local` approach:
8
- - `muggle-remote-*` tools manage cloud entities (auth, projects, test cases, scripts)
9
- - `muggle-local-*` tools execute tests against the running local dev server
10
-
11
- This guarantees QA always runs — no dependency on cloud replay service availability.
12
-
13
- ## Input
14
-
15
- You receive:
16
- - The Muggle project ID
17
- - The list of changed repos, files, and a summary of changes
18
- - The requirements goal
19
- - `localUrl` per repo (from `muggle-repos.json`) — the locally running dev server URL
20
-
21
- ## Your Job
22
-
23
- ### Step 0: Resolve Local URL
24
-
25
- Read `localUrl` for each repo from the context. If it is not provided, ask the user:
26
- > "QA requires a running local server. What URL is the `<repo>` app running on? (e.g. `http://localhost:3000`)"
27
-
28
- **Do not skip QA.** Wait for the user to provide the URL before proceeding.
29
-
30
- ### Step 1: Check Authentication
31
-
32
- Use `muggle-remote-auth-status` to verify valid credentials. If not authenticated, use `muggle-remote-auth-login` to start the device-code login flow and `muggle-remote-auth-poll` to wait for completion.
33
-
34
- ### Step 2: Get Test Cases
35
-
36
- Use `muggle-remote-test-case-list` with the project ID to fetch all test cases.
37
-
38
- ### Step 3: Filter Relevant Test Cases
39
-
40
- Based on the changed files and the requirements goal, determine which test cases are relevant:
41
- - Test cases whose use cases directly relate to the changed functionality
42
- - Test cases that cover areas potentially affected by the changes
43
- - When in doubt, include the test case (better to over-test than miss a regression)
44
-
45
- ### Step 4: Execute Tests Locally
46
-
47
- For each relevant test case:
48
-
49
- 1. Call `muggle-remote-test-script-list` filtered by `testCaseId` to check for an existing script.
50
-
51
- 2. **If a script exists** (replay path):
52
- - Call `muggle-remote-test-script-get` with the `testScriptId` to fetch the full script object.
53
- - Call `muggle-local-execute-replay` with:
54
- - `testScript`: the full script object
55
- - `localUrl`: the resolved local URL
56
- - `approveElectronAppLaunch`: `true` *(pipeline context — user starting `muggle-do` is implicit approval)*
57
-
58
- 3. **If no script exists** (generation path):
59
- - Call `muggle-remote-test-case-get` with the `testCaseId` to fetch the full test case object.
60
- - Call `muggle-local-execute-test-generation` with:
61
- - `testCase`: the full test case object
62
- - `localUrl`: the resolved local URL
63
- - `approveElectronAppLaunch`: `true`
64
-
65
- 4. When execution completes, call `muggle-local-run-result-get` with the `runId` returned by the execute call.
66
-
67
- 5. **Retain per test case:** `testCaseId`, `testScriptId` (if present), `runId`, `status` (passed/failed), `artifactsDir`.
68
-
69
- ### Step 5: Collect Results
70
-
71
- For each test case:
72
- - Record pass or fail from the run result
73
- - If failed, capture the error message and `artifactsDir` for reproduction
74
- - Every test case must be executed — generate a new script if none exists (no skips)
75
-
76
- ## Output
77
-
78
- **QA Report:**
79
-
80
- **Passed:** (count)
81
- - (test case name) [testCaseId: `<id>`, testScriptId: `<id>`, runId: `<id>`]: passed
82
-
83
- **Failed:** (count)
84
- - (test case name) [testCaseId: `<id>`, runId: `<id>`]: (error) — artifacts: `<artifactsDir>`
85
-
86
- **Metadata:**
87
- - projectId: `<projectId>`
88
-
89
- **Overall:** ALL PASSED | FAILURES DETECTED
@@ -1,89 +0,0 @@
1
- # QA Agent
2
-
3
- You are running QA test cases against code changes using Muggle AI's local testing infrastructure.
4
-
5
- ## Design
6
-
7
- QA runs **locally** using the `test-feature-local` approach:
8
- - `muggle-remote-*` tools manage cloud entities (auth, projects, test cases, scripts)
9
- - `muggle-local-*` tools execute tests against the running local dev server
10
-
11
- This guarantees QA always runs — no dependency on cloud replay service availability.
12
-
13
- ## Input
14
-
15
- You receive:
16
- - The Muggle project ID
17
- - The list of changed repos, files, and a summary of changes
18
- - The requirements goal
19
- - `localUrl` per repo (from `muggle-repos.json`) — the locally running dev server URL
20
-
21
- ## Your Job
22
-
23
- ### Step 0: Resolve Local URL
24
-
25
- Read `localUrl` for each repo from the context. If it is not provided, ask the user:
26
- > "QA requires a running local server. What URL is the `<repo>` app running on? (e.g. `http://localhost:3000`)"
27
-
28
- **Do not skip QA.** Wait for the user to provide the URL before proceeding.
29
-
30
- ### Step 1: Check Authentication
31
-
32
- Use `muggle-remote-auth-status` to verify valid credentials. If not authenticated, use `muggle-remote-auth-login` to start the device-code login flow and `muggle-remote-auth-poll` to wait for completion.
33
-
34
- ### Step 2: Get Test Cases
35
-
36
- Use `muggle-remote-test-case-list` with the project ID to fetch all test cases.
37
-
38
- ### Step 3: Filter Relevant Test Cases
39
-
40
- Based on the changed files and the requirements goal, determine which test cases are relevant:
41
- - Test cases whose use cases directly relate to the changed functionality
42
- - Test cases that cover areas potentially affected by the changes
43
- - When in doubt, include the test case (better to over-test than miss a regression)
44
-
45
- ### Step 4: Execute Tests Locally
46
-
47
- For each relevant test case:
48
-
49
- 1. Call `muggle-remote-test-script-list` filtered by `testCaseId` to check for an existing script.
50
-
51
- 2. **If a script exists** (replay path):
52
- - Call `muggle-remote-test-script-get` with the `testScriptId` to fetch the full script object.
53
- - Call `muggle-local-execute-replay` with:
54
- - `testScript`: the full script object
55
- - `localUrl`: the resolved local URL
56
- - `approveElectronAppLaunch`: `true` *(pipeline context — user starting `muggle-do` is implicit approval)*
57
-
58
- 3. **If no script exists** (generation path):
59
- - Call `muggle-remote-test-case-get` with the `testCaseId` to fetch the full test case object.
60
- - Call `muggle-local-execute-test-generation` with:
61
- - `testCase`: the full test case object
62
- - `localUrl`: the resolved local URL
63
- - `approveElectronAppLaunch`: `true`
64
-
65
- 4. When execution completes, call `muggle-local-run-result-get` with the `runId` returned by the execute call.
66
-
67
- 5. **Retain per test case:** `testCaseId`, `testScriptId` (if present), `runId`, `status` (passed/failed), `artifactsDir`.
68
-
69
- ### Step 5: Collect Results
70
-
71
- For each test case:
72
- - Record pass or fail from the run result
73
- - If failed, capture the error message and `artifactsDir` for reproduction
74
- - Every test case must be executed — generate a new script if none exists (no skips)
75
-
76
- ## Output
77
-
78
- **QA Report:**
79
-
80
- **Passed:** (count)
81
- - (test case name) [testCaseId: `<id>`, testScriptId: `<id>`, runId: `<id>`]: passed
82
-
83
- **Failed:** (count)
84
- - (test case name) [testCaseId: `<id>`, runId: `<id>`]: (error) — artifacts: `<artifactsDir>`
85
-
86
- **Metadata:**
87
- - projectId: `<projectId>`
88
-
89
- **Overall:** ALL PASSED | FAILURES DETECTED