@muggleai/works 4.9.2 → 4.10.1

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 (190) hide show
  1. package/README.md +3 -3
  2. package/dist/{chunk-6N7OIBAS.js → chunk-Q7WNEMN4.js} +109 -43
  3. package/dist/{chunk-4KQZLF56.js → chunk-ZKRHFTIC.js} +996 -91
  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/.cursor-plugin/plugin.json +1 -1
  8. package/dist/plugin/README.md +4 -2
  9. package/dist/plugin/agents/acceptance-tester.md +24 -10
  10. package/dist/plugin/commands/m.md +7 -0
  11. package/dist/plugin/commands/mdo.md +7 -0
  12. package/dist/plugin/commands/mfeedback.md +7 -0
  13. package/dist/plugin/commands/mimport.md +7 -0
  14. package/dist/plugin/commands/mpr.md +7 -0
  15. package/dist/plugin/commands/mprefs.md +7 -0
  16. package/dist/plugin/commands/mregen.md +7 -0
  17. package/dist/plugin/commands/mrelease.md +7 -0
  18. package/dist/plugin/commands/mrepair.md +7 -0
  19. package/dist/plugin/commands/mstatus.md +7 -0
  20. package/dist/plugin/commands/mtest.md +7 -0
  21. package/dist/plugin/commands/mtestlocal.md +7 -0
  22. package/dist/plugin/commands/mtestprep.md +7 -0
  23. package/dist/plugin/commands/mupgrade.md +7 -0
  24. package/dist/plugin/scripts/ensure-electron-app.sh +56 -6
  25. package/dist/plugin/skills/_aliases.json +18 -0
  26. package/dist/plugin/skills/_shared/dev-server-readiness.md +231 -0
  27. package/dist/plugin/skills/_shared/failure-mode-handling.md +244 -0
  28. package/dist/plugin/skills/_shared/post-merge-cleanup.md +10 -0
  29. package/dist/plugin/skills/_shared/rebase-before-e2e.md +15 -0
  30. package/dist/plugin/skills/_shared/telemetry-emit.md +15 -0
  31. package/dist/plugin/skills/_shared/use-worktrees.md +53 -0
  32. package/dist/plugin/skills/do/e2e-acceptance.md +63 -18
  33. package/dist/plugin/skills/do/impact-analysis.md +45 -5
  34. package/dist/plugin/skills/do/open-prs.md +13 -4
  35. package/dist/plugin/skills/do/pr-followup.md +225 -0
  36. package/dist/plugin/skills/do/pre-flight.md +18 -11
  37. package/dist/plugin/skills/m/SKILL.md +8 -0
  38. package/dist/plugin/skills/mdo/SKILL.md +8 -0
  39. package/dist/plugin/skills/mfeedback/SKILL.md +8 -0
  40. package/dist/plugin/skills/mimport/SKILL.md +8 -0
  41. package/dist/plugin/skills/mpr/SKILL.md +8 -0
  42. package/dist/plugin/skills/mprefs/SKILL.md +8 -0
  43. package/dist/plugin/skills/mregen/SKILL.md +8 -0
  44. package/dist/plugin/skills/mrelease/SKILL.md +8 -0
  45. package/dist/plugin/skills/mrepair/SKILL.md +8 -0
  46. package/dist/plugin/skills/mstatus/SKILL.md +8 -0
  47. package/dist/plugin/skills/mtest/SKILL.md +8 -0
  48. package/dist/plugin/skills/mtestlocal/SKILL.md +8 -0
  49. package/dist/plugin/skills/mtestprep/SKILL.md +8 -0
  50. package/dist/plugin/skills/muggle/SKILL.md +11 -17
  51. package/dist/plugin/skills/muggle-do/SKILL.md +22 -4
  52. package/dist/plugin/skills/muggle-do-pr-followup/SKILL.md +37 -0
  53. package/dist/plugin/skills/muggle-do-task/SKILL.md +134 -0
  54. package/dist/plugin/skills/muggle-feedback/SKILL.md +38 -0
  55. package/dist/plugin/skills/muggle-feedback/ops/delete.md +49 -0
  56. package/dist/plugin/skills/muggle-feedback/ops/list.md +65 -0
  57. package/dist/plugin/skills/muggle-feedback/ops/submit.md +117 -0
  58. package/dist/plugin/skills/muggle-pr-visual-walkthrough/SKILL.md +73 -55
  59. package/dist/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +86 -0
  60. package/dist/plugin/skills/muggle-preferences/SKILL.md +17 -68
  61. package/dist/plugin/skills/muggle-preferences/ops/change-one.md +10 -0
  62. package/dist/plugin/skills/muggle-preferences/ops/configure.md +49 -0
  63. package/dist/plugin/skills/muggle-preferences/ops/list.md +9 -0
  64. package/dist/plugin/skills/muggle-preferences/ops/reset.md +6 -0
  65. package/dist/plugin/skills/muggle-preferences/ops/set.md +10 -0
  66. package/dist/plugin/skills/muggle-preferences/preference-gates/README.md +58 -0
  67. package/dist/plugin/skills/muggle-preferences/preference-gates/autoCleanup.md +11 -0
  68. package/dist/plugin/skills/muggle-preferences/preference-gates/autoCreatePR.md +13 -0
  69. package/dist/plugin/skills/muggle-preferences/preference-gates/autoDetectChanges.md +11 -0
  70. package/dist/plugin/skills/muggle-preferences/preference-gates/autoE2ETest.md +11 -0
  71. package/dist/plugin/skills/muggle-preferences/preference-gates/autoLogin.md +11 -0
  72. package/dist/plugin/skills/muggle-preferences/preference-gates/autoPublishLocalResults.md +11 -0
  73. package/dist/plugin/skills/muggle-preferences/preference-gates/autoRebase.md +11 -0
  74. package/dist/plugin/skills/muggle-preferences/preference-gates/autoSelectLocalHost.md +19 -0
  75. package/dist/plugin/skills/muggle-preferences/preference-gates/autoSelectProject.md +16 -0
  76. package/dist/plugin/skills/muggle-preferences/preference-gates/autoUseWorktree.md +11 -0
  77. package/dist/plugin/skills/muggle-preferences/preference-gates/checkForUpdates.md +11 -0
  78. package/dist/plugin/skills/muggle-preferences/preference-gates/defaultExecutionMode.md +15 -0
  79. package/dist/plugin/skills/muggle-preferences/preference-gates/openTestResultsAfterRun.md +11 -0
  80. package/dist/plugin/skills/muggle-preferences/preference-gates/postPRVisualWalkthrough.md +13 -0
  81. package/dist/plugin/skills/muggle-preferences/preference-gates/showElectronBrowser.md +11 -0
  82. package/dist/plugin/skills/muggle-preferences/preference-gates/suggestRelatedTestCases.md +11 -0
  83. package/dist/plugin/skills/muggle-preferences/preference-gates/suggestRelatedUseCases.md +11 -0
  84. package/dist/plugin/skills/muggle-preferences/preference-gates/verboseOutput.md +8 -0
  85. package/dist/plugin/skills/muggle-repair/SKILL.md +4 -2
  86. package/dist/plugin/skills/muggle-status/SKILL.md +14 -16
  87. package/dist/plugin/skills/muggle-test/SKILL.md +148 -123
  88. package/dist/plugin/skills/muggle-test-feature-local/SKILL.md +92 -86
  89. package/dist/plugin/skills/muggle-test-import/SKILL.md +74 -35
  90. package/dist/plugin/skills/muggle-test-prepare/SKILL.md +79 -18
  91. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +49 -35
  92. package/dist/plugin/skills/muggle-test-regenerate-missing/evals/evals.json +9 -9
  93. package/dist/plugin/skills/muggle-upgrade/SKILL.md +4 -2
  94. package/dist/plugin/skills/muggle-works-npm-release/SKILL.md +6 -4
  95. package/dist/plugin/skills/mupgrade/SKILL.md +8 -0
  96. package/dist/release-manifest.json +4 -4
  97. package/dist/src-2G7ENRGI.js +1 -0
  98. package/package.json +10 -8
  99. package/plugin/.claude-plugin/plugin.json +1 -1
  100. package/plugin/.cursor-plugin/plugin.json +1 -1
  101. package/plugin/README.md +4 -2
  102. package/plugin/agents/acceptance-tester.md +24 -10
  103. package/plugin/commands/m.md +7 -0
  104. package/plugin/commands/mdo.md +7 -0
  105. package/plugin/commands/mfeedback.md +7 -0
  106. package/plugin/commands/mimport.md +7 -0
  107. package/plugin/commands/mpr.md +7 -0
  108. package/plugin/commands/mprefs.md +7 -0
  109. package/plugin/commands/mregen.md +7 -0
  110. package/plugin/commands/mrelease.md +7 -0
  111. package/plugin/commands/mrepair.md +7 -0
  112. package/plugin/commands/mstatus.md +7 -0
  113. package/plugin/commands/mtest.md +7 -0
  114. package/plugin/commands/mtestlocal.md +7 -0
  115. package/plugin/commands/mtestprep.md +7 -0
  116. package/plugin/commands/mupgrade.md +7 -0
  117. package/plugin/scripts/ensure-electron-app.sh +56 -6
  118. package/plugin/skills/_aliases.json +18 -0
  119. package/plugin/skills/_shared/dev-server-readiness.md +231 -0
  120. package/plugin/skills/_shared/failure-mode-handling.md +244 -0
  121. package/plugin/skills/_shared/post-merge-cleanup.md +10 -0
  122. package/plugin/skills/_shared/rebase-before-e2e.md +15 -0
  123. package/plugin/skills/_shared/telemetry-emit.md +15 -0
  124. package/plugin/skills/_shared/use-worktrees.md +53 -0
  125. package/plugin/skills/do/e2e-acceptance.md +63 -18
  126. package/plugin/skills/do/impact-analysis.md +45 -5
  127. package/plugin/skills/do/open-prs.md +13 -4
  128. package/plugin/skills/do/pr-followup.md +225 -0
  129. package/plugin/skills/do/pre-flight.md +18 -11
  130. package/plugin/skills/m/SKILL.md +8 -0
  131. package/plugin/skills/mdo/SKILL.md +8 -0
  132. package/plugin/skills/mfeedback/SKILL.md +8 -0
  133. package/plugin/skills/mimport/SKILL.md +8 -0
  134. package/plugin/skills/mpr/SKILL.md +8 -0
  135. package/plugin/skills/mprefs/SKILL.md +8 -0
  136. package/plugin/skills/mregen/SKILL.md +8 -0
  137. package/plugin/skills/mrelease/SKILL.md +8 -0
  138. package/plugin/skills/mrepair/SKILL.md +8 -0
  139. package/plugin/skills/mstatus/SKILL.md +8 -0
  140. package/plugin/skills/mtest/SKILL.md +8 -0
  141. package/plugin/skills/mtestlocal/SKILL.md +8 -0
  142. package/plugin/skills/mtestprep/SKILL.md +8 -0
  143. package/plugin/skills/muggle/SKILL.md +11 -17
  144. package/plugin/skills/muggle-do/SKILL.md +22 -4
  145. package/plugin/skills/muggle-do-pr-followup/SKILL.md +37 -0
  146. package/plugin/skills/muggle-do-task/SKILL.md +134 -0
  147. package/plugin/skills/muggle-feedback/SKILL.md +38 -0
  148. package/plugin/skills/muggle-feedback/ops/delete.md +49 -0
  149. package/plugin/skills/muggle-feedback/ops/list.md +65 -0
  150. package/plugin/skills/muggle-feedback/ops/submit.md +117 -0
  151. package/plugin/skills/muggle-pr-visual-walkthrough/SKILL.md +73 -55
  152. package/plugin/skills/muggle-pr-visual-walkthrough/e2e-report-assembly.md +86 -0
  153. package/plugin/skills/muggle-preferences/SKILL.md +17 -68
  154. package/plugin/skills/muggle-preferences/ops/change-one.md +10 -0
  155. package/plugin/skills/muggle-preferences/ops/configure.md +49 -0
  156. package/plugin/skills/muggle-preferences/ops/list.md +9 -0
  157. package/plugin/skills/muggle-preferences/ops/reset.md +6 -0
  158. package/plugin/skills/muggle-preferences/ops/set.md +10 -0
  159. package/plugin/skills/muggle-preferences/preference-gates/README.md +58 -0
  160. package/plugin/skills/muggle-preferences/preference-gates/autoCleanup.md +11 -0
  161. package/plugin/skills/muggle-preferences/preference-gates/autoCreatePR.md +13 -0
  162. package/plugin/skills/muggle-preferences/preference-gates/autoDetectChanges.md +11 -0
  163. package/plugin/skills/muggle-preferences/preference-gates/autoE2ETest.md +11 -0
  164. package/plugin/skills/muggle-preferences/preference-gates/autoLogin.md +11 -0
  165. package/plugin/skills/muggle-preferences/preference-gates/autoPublishLocalResults.md +11 -0
  166. package/plugin/skills/muggle-preferences/preference-gates/autoRebase.md +11 -0
  167. package/plugin/skills/muggle-preferences/preference-gates/autoSelectLocalHost.md +19 -0
  168. package/plugin/skills/muggle-preferences/preference-gates/autoSelectProject.md +16 -0
  169. package/plugin/skills/muggle-preferences/preference-gates/autoUseWorktree.md +11 -0
  170. package/plugin/skills/muggle-preferences/preference-gates/checkForUpdates.md +11 -0
  171. package/plugin/skills/muggle-preferences/preference-gates/defaultExecutionMode.md +15 -0
  172. package/plugin/skills/muggle-preferences/preference-gates/openTestResultsAfterRun.md +11 -0
  173. package/plugin/skills/muggle-preferences/preference-gates/postPRVisualWalkthrough.md +13 -0
  174. package/plugin/skills/muggle-preferences/preference-gates/showElectronBrowser.md +11 -0
  175. package/plugin/skills/muggle-preferences/preference-gates/suggestRelatedTestCases.md +11 -0
  176. package/plugin/skills/muggle-preferences/preference-gates/suggestRelatedUseCases.md +11 -0
  177. package/plugin/skills/muggle-preferences/preference-gates/verboseOutput.md +8 -0
  178. package/plugin/skills/muggle-repair/SKILL.md +4 -2
  179. package/plugin/skills/muggle-status/SKILL.md +14 -16
  180. package/plugin/skills/muggle-test/SKILL.md +148 -123
  181. package/plugin/skills/muggle-test-feature-local/SKILL.md +92 -86
  182. package/plugin/skills/muggle-test-import/SKILL.md +74 -35
  183. package/plugin/skills/muggle-test-prepare/SKILL.md +79 -18
  184. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +49 -35
  185. package/plugin/skills/muggle-test-regenerate-missing/evals/evals.json +9 -9
  186. package/plugin/skills/muggle-upgrade/SKILL.md +4 -2
  187. package/plugin/skills/muggle-works-npm-release/SKILL.md +6 -4
  188. package/plugin/skills/mupgrade/SKILL.md +8 -0
  189. package/scripts/postinstall.mjs +11 -1
  190. package/dist/src-7GB7WIFT.js +0 -1
@@ -5,7 +5,9 @@ description: Run a real-browser end-to-end (E2E) acceptance test against localho
5
5
 
6
6
  # Muggle Test Feature Local
7
7
 
8
- **Goal:** Run or generate an end-to-end test against a **local URL** using Muggle's Electron browser.
8
+ > Telemetry first step: see [`_shared/telemetry-emit.md`](../_shared/telemetry-emit.md). Use `skillName: "muggle-test-feature-local"`.
9
+
10
+ **Goal:** Run or generate an end-to-end test against a **local URL** using Muggle Test's Electron browser.
9
11
 
10
12
  | Scope | MCP tools |
11
13
  | :---- | :-------- |
@@ -15,55 +17,69 @@ description: Run a real-browser end-to-end (E2E) acceptance test against localho
15
17
 
16
18
  The local URL only changes where the browser opens; it does not change the remote project or test definitions.
17
19
 
18
- ## UX Guidelines — Minimize Typing
20
+ ## Branch hygiene
19
21
 
20
- **Every selection-based question MUST use the `AskQuestion` tool** (or the platform's equivalent structured selection tool). Never ask the user to "reply with a number" in a plain text message — always present clickable options.
22
+ Three gates apply, each per the standard procedure in [`preference-gates/README.md`](../muggle-preferences/preference-gates/README.md):
21
23
 
22
- - **Selections** (project, use case, test case, script): Use `AskQuestion` with labeled options the user can click.
23
- - **Free-text inputs** (URLs, descriptions): Only use plain text prompts when there is no finite set of options. Even then, offer a detected/default value when possible.
24
+ - `autoUseWorktree` at pre-flight (see [`_shared/use-worktrees.md`](../_shared/use-worktrees.md)).
25
+ - `autoRebase` before Step 7 (Execute) when `behind > 0` (see [`_shared/rebase-before-e2e.md`](../_shared/rebase-before-e2e.md)).
26
+ - `autoCleanup` after the PR is merged (see [`_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md)).
24
27
 
25
- ## Preferences
28
+ ## Local environment prerequisites
26
29
 
27
- User preferences are available in the session context (injected at session start). Look for the line starting with `Muggle Preferences` — it contains key=value pairs like `autoLogin=ask showElectronBrowser=always ...`.
30
+ Before any workflow step, invoke [`muggle-test-prepare`](../muggle-test-prepare/SKILL.md). Halt on what it surfaces.
28
31
 
29
- If no preferences line is present, treat all preferences as `"ask"`.
32
+ ## UX Guidelines — Minimize Typing
30
33
 
31
- When you reach a decision gated by a preference:
32
- - **`always`** → proceed without asking the user
33
- - **`never`** → skip without asking the user
34
- - **`ask`** → ask the user, then offer: "Want me to remember this choice for future sessions?" If yes, call `muggle-local-preferences-set` with the key, their chosen value, and scope `global`.
34
+ **Every selection-based question MUST use the `AskUserQuestion` tool** (or the platform's equivalent structured selection tool). Never ask the user to "reply with a number" in a plain text message — always present clickable options.
35
35
 
36
- This skill uses these preferences:
36
+ - **Selections** (project, use case, test case, script): Use `AskUserQuestion` with labeled options the user can click.
37
+ - **Free-text inputs** (URLs, descriptions): Only use plain text prompts when there is no finite set of options. Even then, offer a detected/default value when possible.
37
38
 
38
- | Preference | Decision it gates |
39
- |------------|------------------|
40
- | `autoLogin` | Reuse saved credentials when auth is required |
41
- | `autoSelectProject` | Reuse last-used Muggle project for this repo |
42
- | `showElectronBrowser` | Show Electron browser window during local E2E tests |
43
- | `openTestResultsAfterRun` | Open results page on Muggle dashboard after run |
39
+ ## Preferences
40
+
41
+ Gates run per `preference-gates/README.md`.
42
+
43
+ | Preference | Step | Decision it gates |
44
+ |------------|------|-------------------|
45
+ | `autoLogin` | 1 | Reuse saved credentials when auth is required |
46
+ | `autoSelectProject` | 2 | Reuse last-used Muggle Test project for this repo |
47
+ | `autoSelectLocalHost` | 4 | Reuse last-used local dev server URL for this repo |
48
+ | `autoUseWorktree` | 0 (pre-flight) | Isolate dev work in a worktree (see [`_shared/use-worktrees.md`](../_shared/use-worktrees.md)) |
49
+ | `autoRebase` | 0 (pre-flight) | Rebase onto `origin/<default>` before Step 7 (Execute) (see [`_shared/rebase-before-e2e.md`](../_shared/rebase-before-e2e.md)) |
50
+ | `showElectronBrowser` | 7 | Show Electron browser window during local E2E tests |
51
+ | `openTestResultsAfterRun` | 8 | Open results page on Muggle Test dashboard after run |
52
+ | `postPRVisualWalkthrough` | 10 | Post visual walkthrough to PR after results |
53
+ | `autoCreatePR` | 10 (if no PR) | Auto-create the PR when posting the walkthrough has no PR to target |
54
+ | `autoCleanup` | post-merge | Run cleanup after the PR for this work is merged (see [`_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md)) |
44
55
 
45
56
  ## Workflow
46
57
 
47
- ### 1. Auth
58
+ ### 1. Auth (gated by `autoLogin`)
48
59
 
49
60
  - `muggle-remote-auth-status`
50
- - If **authenticated**: print the logged-in email and ask via `AskQuestion`:
51
- > "You're logged in as **{email}**. Continue with this account?"
52
- - Option 1: "Yes, continue"
53
- - Option 2: "No, switch account"
54
- If the user picks "switch account", call `muggle-remote-auth-login` with `forceNewSession: true` then `muggle-remote-auth-poll`.
55
- - If **not signed in or expired**: call `muggle-remote-auth-login` then `muggle-remote-auth-poll`.
56
- Do not skip or assume auth.
61
+ - If **authenticated**: gate `autoLogin` (per `preference-gates/README.md`):
62
+ - `always` → proceed with saved session.
63
+ - `never` → `muggle-remote-auth-login` with `forceNewSession: true`, then `muggle-remote-auth-poll`.
64
+ - `ask` → run Picker 1 from `preference-gates/autoLogin.md` via `AskUserQuestion`; map the answer back to one of the actions above.
65
+ - If **not signed in or expired**: call `muggle-remote-auth-login` then `muggle-remote-auth-poll`. Do not skip or assume auth.
57
66
 
58
67
  ### 2. Targets (user must confirm)
59
68
 
69
+ The per-repo project cache lives at `<cwd>/.muggle-ai/last-project.json` (via the `muggle-local-last-project-get` / `muggle-local-last-project-set` MCP tools). Look for `Muggle Test Last Project: id=… url=… name="…"` in session context.
70
+
71
+ Gate `autoSelectProject` (per `preference-gates/README.md`). Cache: `Muggle Test Last Project` session line.
72
+ - `always` + cache → use cached `projectId`, skip to use case selection. No cache → fall through to `ask`.
73
+ - `never` → full project list; skip Picker 2.
74
+ - `ask` → project list picker (see gate file for spec + Picker 2 override). Skip Picker 2 if "Create new project".
75
+
60
76
  Ask the user to pick **project**, **use case**, and **test case** (do not infer).
61
77
 
62
78
  - `muggle-remote-project-list`
63
79
  - `muggle-remote-use-case-list` (with `projectId`)
64
80
  - `muggle-remote-test-case-list-by-use-case` (with `useCaseId`)
65
81
 
66
- **Selection UI (mandatory):** Every selection MUST use `AskQuestion` with clickable options. Never ask the user to "reply with the number" in plain text.
82
+ **Selection UI (mandatory):** Every selection MUST use `AskUserQuestion` with clickable options. Never ask the user to "reply with the number" in plain text.
67
83
 
68
84
  **Project selection context:** A **project** groups all your test results, use cases, and test scripts on the Muggle AI dashboard. Include the project URL in each option label so the user can identify the right one.
69
85
 
@@ -73,18 +89,18 @@ Prompt for projects: "Pick the project to group this test into:"
73
89
 
74
90
  - Do **not** dump the full list by default.
75
91
  - Rank items by semantic relevance to the user's stated goal (title first, then description / user story / acceptance criteria).
76
- - Show only the **top 3-5** most relevant options via `AskQuestion`, plus these fixed tail options:
77
- - **"Show full list"** — present the complete list in a new `AskQuestion` call. **Skip this option** if the API returned zero rows.
92
+ - Show only the **top 3-5** most relevant options via `AskUserQuestion`, plus these fixed tail options:
93
+ - **"Show full list"** — present the complete list in a new `AskUserQuestion` call. **Skip this option** if the API returned zero rows.
78
94
  - **"Create new ..."** — never omitted. Label per step: "Create new project", "Create new use case", or "Create new test case".
79
95
 
80
96
  **Create new — tools and flow (use these MCP tools; preview before persist):**
81
97
 
82
98
  - **Project — Create new project:** Collect `projectName`, `description`, and `url` (may be the local app URL, e.g. `http://localhost:3999`). Call `muggle-remote-project-create`. Use the returned `projectId` and continue.
83
99
  - **Use case — Create new use case:** User provides a natural-language instruction (or you reuse their testing goal).
84
- 1. `muggle-remote-use-case-prompt-preview` with `projectId`, `instruction` — show preview; get confirmation via `AskQuestion`.
100
+ 1. `muggle-remote-use-case-prompt-preview` with `projectId`, `instruction` — show preview; get confirmation via `AskUserQuestion`.
85
101
  2. `muggle-remote-use-case-create-from-prompts` with `projectId` and `instructions: ["<the user's natural-language instruction>"]` — persist. Use the created use case id and continue to test-case selection.
86
102
  - **Test case — Create new test case** (requires a chosen `useCaseId`): User provides an instruction describing what to test.
87
- 1. `muggle-remote-test-case-generate-from-prompt` with `projectId`, `useCaseId`, `instruction` — **preview only** (server test-case prompt preview); show the returned draft(s); get confirmation via `AskQuestion`.
103
+ 1. `muggle-remote-test-case-generate-from-prompt` with `projectId`, `useCaseId`, `instruction` — **preview only** (server test-case prompt preview); show the returned draft(s); get confirmation via `AskUserQuestion`.
88
104
  2. Persist the accepted draft with `muggle-remote-test-case-create`, mapping preview fields into the required properties (`title`, `description`, `goal`, `expectedResult`, `url`, etc.). Then continue from **section 5** with that `testCaseId`.
89
105
 
90
106
  ### 3. Ensure Local Services Are Ready
@@ -98,13 +114,16 @@ Before detecting the local URL, verify that the services the user needs are actu
98
114
 
99
115
  This step is especially important when the user's app depends on sibling services (a backend API, an auth service, etc.) that may not be running yet. The prepare skill handles discovery, startup, and cleanup so this skill doesn't have to.
100
116
 
101
- ### 4. Local URL
117
+ **Compile-gate (do not skip)** — after `muggle-test-prepare` reports ready, run the two-stage readiness probe per [`_shared/dev-server-readiness.md`](../_shared/dev-server-readiness.md) before dispatching any test. Halt on any failure it surfaces; do not dispatch against a broken bundle.
118
+
119
+ ### 4. Local URL (gated by `autoSelectLocalHost`)
102
120
 
103
- Try to auto-detect the dev server URL by checking running terminals or common ports (e.g., `lsof -iTCP -sTCP:LISTEN -nP | grep -E ':(3000|3001|4200|5173|8080)'`). If a likely URL is found, present it as a clickable default via `AskQuestion`:
104
- - Option 1: "http://localhost:3000" (or whatever was detected)
105
- - Option 2: "Other — let me type a URL"
121
+ Skill responsibilities (the rest is in `preference-gates/autoSelectLocalHost.md`):
122
+ - **Read the cache**: `Muggle Test Last Host: <url>` session-context line, or `muggle-local-last-host-get`. Pass as `{lastHost}` substitution.
123
+ - **Auto-detect a suggested URL**: `lsof -iTCP -sTCP:LISTEN -nP | grep -E ':(3000|3001|4200|5173|8080)'`. Pass as `{suggestedHost}`.
124
+ - **Save the cache**: call `muggle-local-last-host-set` after the user picks (the gate file requires this on every pick).
106
125
 
107
- If nothing detected, ask as free text: "Your local app should be running. What's the URL? (e.g., http://localhost:3000)"
126
+ Gate `autoSelectLocalHost` per `preference-gates/README.md` + `preference-gates/autoSelectLocalHost.md`.
108
127
 
109
128
  Remind them: local URL is only the execution target, not tied to cloud project config.
110
129
 
@@ -112,7 +131,7 @@ Remind them: local URL is only the execution target, not tied to cloud project c
112
131
 
113
132
  `muggle-remote-test-script-list` with `testCaseId`.
114
133
 
115
- - **If any replayable/succeeded scripts exist:** use `AskQuestion` to present them as clickable options. Show: name, created/updated, step count per option. Include **"Generate new script"** as the last option.
134
+ - **If any replayable/succeeded scripts exist:** use `AskUserQuestion` to present them as clickable options. Show: name, created/updated, step count per option. Include **"Generate new script"** as the last option.
116
135
  - **If none:** go straight to generation (no need to ask replay vs generate).
117
136
 
118
137
  ### 6. Load data for the chosen path
@@ -153,71 +172,58 @@ The MCP client often uses a **default wait of 300000 ms (5 minutes)** for `muggl
153
172
  - **`Electron execution timed out after 300000ms`:** Orchestration wait too short — see **`timeoutMs`** above.
154
173
  - **Exit code 26** (and messages like **LLM failed to generate / replay action script**): Often corresponds to a completed exploration whose **outcome was goal not achievable** (`goal_not_achievable`, summary with `halt`) — e.g. verifying "view script after a successful run" when **no run or script exists yet** in the UI. Use `muggle-local-run-result-get` and read the **summary / structured summary**; do not assume an Electron crash. **Fix:** choose a **project that already has** completed runs and scripts, or **change the test case** so preconditions match what localhost can satisfy (e.g. include steps to create and run a test first, or assert only empty-state UI when no runs exist).
155
174
 
156
- ### 7. Execute (no approval prompt)
175
+ ### 7. Execute (no approval prompt; `showUi` gated by `showElectronBrowser`)
157
176
 
158
- Call `muggle-local-execute-test-generation` or `muggle-local-execute-replay` directly. **Do not** ask the user to re-approve the Electron launch — the user choosing this skill in the first place is the approval. The browser defaults to visible; only pass `showUi: false` if the user explicitly asked for headless.
177
+ Call `muggle-local-execute-test-generation` or `muggle-local-execute-replay` directly. **Do not** ask the user to re-approve the Electron launch — the user choosing this skill in the first place is the approval.
159
178
 
160
- ### 8. After successful generation only
179
+ Gate `showElectronBrowser` (per `preference-gates/README.md`). Reuse choice within a session.
180
+ - `always` → omit `showUi`.
181
+ - `never` → pass `showUi: false`.
182
+ - `ask` → run Picker 1 from `preference-gates/showElectronBrowser.md` via `AskUserQuestion`; map the answer back to one of the actions above.
183
+
184
+ ### 8. Upload run to cloud (every completed run; open `viewUrl` gated by `openTestResultsAfterRun`)
185
+
186
+ Upload pass-or-fail. Failed runs still need cloud-hosted screenshots and per-step actions for the PR walkthrough — without them reviewers see only a generic "failed" link. The `status` field in the upload payload tells the backend whether to promote the run's action script as the test case's canonical replay script (passed → promote; failed → record only).
161
187
 
162
188
  - `muggle-local-publish-test-script`
163
- - Open returned `viewUrl` for the user (`open "<viewUrl>"` on macOS or OS equivalent).
189
+ - Gate `openTestResultsAfterRun` (per `preference-gates/README.md`):
190
+ - `always` → open `viewUrl` automatically (`open "<viewUrl>"` on macOS or OS equivalent).
191
+ - `never` → print the URL only.
192
+ - `ask` → run Picker 1 from `preference-gates/openTestResultsAfterRun.md` via `AskUserQuestion`; map the answer back to one of the actions above.
193
+
194
+ If publish rejects with `has no generated actionScript steps to publish` (true zero-step runs — Electron never produced an action), fall back to `muggle-remote-local-run-upload` directly with whatever data exists (`summaryStep`, `errorMessage`, empty `actionScript`). This still gets the failure summary and any goal-not-achievable verdict onto the dashboard so reviewers can see why the run failed. Capture the returned `actionScriptId` and `viewUrl` from this fallback path the same way you would from publish.
164
195
 
165
196
  ### 9. Report
166
197
 
167
198
  - `muggle-local-run-result-get` with the run id from execute.
168
199
  - Include: status, duration, pass/fail summary, per-step summary, artifact/screenshot paths, errors if failed, and script view URL when publishing ran.
169
200
 
170
- ### 10. Offer to post a visual walkthrough to the PR
171
-
172
- After reporting results, gather the required input and hand off to the shared **`muggle:muggle-pr-visual-walkthrough`** skill, which renders the walkthrough via `muggle build-pr-section` and posts it to the current branch's open PR.
173
-
174
- #### 10a: Gather per-step screenshots
201
+ ### 9a. Route failures through the failure-mode handler
175
202
 
176
- The shared skill takes an **`E2eReport` JSON** that includes per-step screenshot URLs. After step 8 has called `muggle-local-publish-test-script` and you have the `testScriptId`:
203
+ If the run's status is `failed` or any non-passing terminal state, follow [`_shared/failure-mode-handling.md`](../_shared/failure-mode-handling.md):
177
204
 
178
- 1. Call `muggle-remote-test-script-get` with the `testScriptId`.
179
- 2. Extract per step: `steps[].operation.action` and `steps[].operation.screenshotUrl`.
180
- 3. Build the `steps` array: `[{ stepIndex: 0, action: "...", screenshotUrl: "..." }, ...]`.
181
- 4. If the run failed, capture `failureStepIndex`, `error`, and the local `artifactsDir` from the run result in step 9.
182
- 5. Populate `description` (test case title/description) and `useCaseName` (parent use case title) on the report entry — optional but strongly recommended; they drive the grouped overview and the per-test collapsible headers. Prefer values already in your conversation context from earlier steps (e.g. the test case you just created or selected, or the use case you confirmed); only call `muggle-remote-test-case-get` / `muggle-remote-use-case-get` for anything you don't already have.
205
+ - **Replay-mode run failed** (the user picked an existing script in Step 5) → section B (buckets: `infra` / `stale-script` / `product-defect`).
206
+ - **Regen-mode run failed** (the user picked "Generate new script" or no script existed) → section C (buckets: `transient` / `infra` / `agent-course` / `product-uxux`).
183
207
 
184
- Assemble the `E2eReport`:
208
+ Steps:
209
+ 1. Read the run via `muggle-local-run-result-get` and extract signals per the heuristics in the shared doc.
210
+ 2. Emit `replay-failure-classified` or `regen-failure-classified` via `muggle-local-telemetry-event-emit` **before** asking the user.
211
+ 3. Present the recommended action via `AskUserQuestion` with the alternatives the shared doc lists for that bucket.
212
+ 4. After the user picks, emit the matching `*-resolved` event with `userAction`.
185
213
 
186
- ```json
187
- {
188
- "projectId": "<projectId from step 2 (Targets)>",
189
- "tests": [
190
- {
191
- "name": "<test case title>",
192
- "description": "<one-line description of what this test verifies (optional but recommended)>",
193
- "useCaseName": "<parent use case title (optional but recommended)>",
194
- "testCaseId": "<id>",
195
- "testScriptId": "<id from publish>",
196
- "runId": "<runId from execute>",
197
- "viewUrl": "<viewUrl from publish>",
198
- "status": "passed",
199
- "steps": [{ "stepIndex": 0, "action": "...", "screenshotUrl": "..." }]
200
- }
201
- ]
202
- }
203
- ```
214
+ If the user picks `muggle-feedback` from any bucket's options, invoke the `muggle-feedback` skill via the `Skill` tool, passing the just-finished `runId` so the submit flow opens with this run preloaded.
204
215
 
205
- See the `muggle:muggle-pr-visual-walkthrough` skill for the full schema including the failed-test shape.
216
+ Skip silently when the run passed cleanly — failure-mode events are by definition about failures.
206
217
 
207
- #### 10b: Ask the user
208
-
209
- Use `AskQuestion`:
210
-
211
- > "Post a visual walkthrough of this run to the PR? Reviewers can click the test case to see step-by-step screenshots on the Muggle AI dashboard."
212
-
213
- - Option 1: "Yes, post to PR"
214
- - Option 2: "Skip"
215
-
216
- #### 10c: Invoke the shared skill in Mode A
218
+ ### 10. Offer to post a visual walkthrough to the PR
217
219
 
218
- If the user chooses "Yes, post to PR", invoke the `muggle:muggle-pr-visual-walkthrough` skill via the `Skill` tool. With the `E2eReport` in context, the skill renders the markdown block via the CLI, finds the PR via `gh pr view`, posts `body` as a comment, posts the overflow `comment` only if the CLI emitted one, and confirms the PR URL to the user.
220
+ After reporting results:
219
221
 
220
- Always use **Mode A** (post to existing PR) from this skill. Never hand-write the walkthrough markdown or call `gh pr comment` directly — delegate to `muggle:muggle-pr-visual-walkthrough`.
222
+ 1. Fire [`postPRVisualWalkthrough`](../muggle-preferences/preference-gates/postPRVisualWalkthrough.md). On skip → end.
223
+ 2. `gh pr view --json number,title,url 2>/dev/null` — find the PR.
224
+ 3. If no PR: fire [`autoCreatePR`](../muggle-preferences/preference-gates/autoCreatePR.md). On skip → end.
225
+ 4. Assemble the `E2eReport` — see [`../muggle-pr-visual-walkthrough/e2e-report-assembly.md`](../muggle-pr-visual-walkthrough/e2e-report-assembly.md).
226
+ 5. Invoke [`../muggle-pr-visual-walkthrough/SKILL.md`](../muggle-pr-visual-walkthrough/SKILL.md) Mode A with the `E2eReport`.
221
227
 
222
228
  ## Non-negotiables
223
229
 
@@ -226,6 +232,6 @@ Always use **Mode A** (post to existing PR) from this skill. Never hand-write th
226
232
  - If replayable scripts exist, do not default to generation without user choice.
227
233
  - No hiding failures: surface errors and artifact paths.
228
234
  - Replay: never hand-built or simplified `actionScript` — only from `muggle-remote-action-script-get`.
229
- - Use `AskQuestion` for every selection — project, use case, test case, script. Never ask the user to type a number.
235
+ - Use `AskUserQuestion` for every selection — project, use case, test case, script. Never ask the user to type a number.
230
236
  - Project, use case, and test case selection lists must always include "Create new ...". Include "Show full list" whenever the API returned at least one row for that step; omit "Show full list" when the list is empty (offer "Create new ..." only). For creates, use preview tools (`muggle-remote-use-case-prompt-preview`, `muggle-remote-test-case-generate-from-prompt`) before persisting.
231
237
  - PR posting is always optional and always delegated to the `muggle:muggle-pr-visual-walkthrough` skill — never inline the walkthrough markdown or call `gh pr comment` directly from this skill.
@@ -4,39 +4,32 @@ description: >
4
4
  Bring existing tests and test artifacts INTO Muggle Test — from Playwright, Cypress, PRDs,
5
5
  Gherkin feature files, test plan docs, Notion exports, or any source.
6
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",
7
+ test docs into Muggle Test — e.g. "import my playwright tests", "migrate from cypress to muggle",
8
8
  "upload my PRD to muggle", "add my e2e specs to our muggle project", "load these test cases
9
9
  into muggle", "turn this feature file into muggle test cases", "create muggle test cases from
10
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
11
+ DO NOT TRIGGER when: user wants to run/replay Muggle Test scripts, scan a site, generate new
12
12
  tests from scratch, or check existing test results.
13
13
  ---
14
14
 
15
15
  # Muggle Test Import
16
16
 
17
+ > Telemetry first step: see [`_shared/telemetry-emit.md`](../_shared/telemetry-emit.md). Use `skillName: "muggle-test-import"`.
18
+
17
19
  This skill migrates existing test artifacts into Muggle Test. It reads your source files,
18
20
  structures them into use cases and test cases, gets your approval, then creates everything
19
- in a Muggle project via the API.
21
+ in a Muggle Test project via the API.
20
22
 
21
23
  ## Preferences
22
24
 
23
- User preferences are available in the session context (injected at session start). Look for the line starting with `Muggle Preferences` — it contains key=value pairs like `autoLogin=ask showElectronBrowser=always ...`.
24
-
25
- If no preferences line is present, treat all preferences as `"ask"`.
26
-
27
- When you reach a decision gated by a preference:
28
- - **`always`** → proceed without asking the user
29
- - **`never`** → skip without asking the user
30
- - **`ask`** → ask the user, then offer: "Want me to remember this choice for future sessions?" If yes, call `muggle-local-preferences-set` with the key, their chosen value, and scope `global`.
25
+ Gates run per `preference-gates/README.md`.
31
26
 
32
- This skill uses these preferences:
33
-
34
- | Preference | Decision it gates |
35
- |------------|------------------|
36
- | `autoLogin` | Reuse saved credentials when auth is required |
37
- | `autoSelectProject` | Reuse last-used Muggle project for this repo |
38
- | `suggestRelatedUseCases` | Suggest related use cases after import |
39
- | `suggestRelatedTestCases` | Suggest related test cases after import |
27
+ | Preference | Step | Decision it gates |
28
+ |------------|------|-------------------|
29
+ | `autoLogin` | 4 | Reuse saved credentials when auth is required |
30
+ | `autoSelectProject` | 5 | Reuse last-used Muggle Test project for this repo |
31
+ | `suggestRelatedUseCases` | 8a | Suggest related use cases after import |
32
+ | `suggestRelatedTestCases` | 8b | Suggest related test cases after import |
40
33
 
41
34
  ## Concepts
42
35
 
@@ -70,7 +63,7 @@ The extraction strategy depends on the file type. Choose the right path before r
70
63
 
71
64
  ### Path A — PRD / design documents (preferred for document sources)
72
65
 
73
- Muggle has a native PRD processing workflow that extracts use cases more accurately than
66
+ Muggle Test has a native PRD processing workflow that extracts use cases more accurately than
74
67
  manual parsing. Use this path for `.md`, `.txt`, `.pdf`, or any prose document.
75
68
 
76
69
  After authentication and project selection (Steps 4–5), come back and:
@@ -134,26 +127,26 @@ Found 3 use cases with 8 test cases:
134
127
  ✦ [HIGH] Checkout fails with invalid payment info
135
128
  ```
136
129
 
137
- Use `AskQuestion` to confirm:
130
+ Use `AskUserQuestion` to confirm:
138
131
  - "Looks good — proceed with import"
139
132
  - "I want to make changes first"
140
133
 
141
134
  If the user wants changes, incorporate feedback, then ask again. Only proceed after explicit approval.
142
135
 
143
- > For Path A (native PRD upload): present the use case/test case list that Muggle extracted
136
+ > For Path A (native PRD upload): present the use case/test case list that Muggle Test extracted
144
137
  > after the processing workflow completes, and ask the user to confirm before adding any
145
138
  > extra test cases manually.
146
139
 
147
140
  ---
148
141
 
149
- ## Step 4 — Authenticate
142
+ ## Step 4 — Authenticate (gated by `autoLogin`)
150
143
 
151
144
  Call `muggle-remote-auth-status` first.
152
145
 
153
- If **already authenticated** → print the logged-in email and ask via `AskQuestion`:
154
- > "You're logged in as **{email}**. Continue with this account?"
155
- - Option 1: "Yes, continue" → skip to Step 5.
156
- - Option 2: "No, switch account" → call `muggle-remote-auth-login` with `forceNewSession: true`, then `muggle-remote-auth-poll`.
146
+ If **already authenticated** → gate `autoLogin` (per `preference-gates/README.md`):
147
+ - `always` → skip to Step 5.
148
+ - `never` → `muggle-remote-auth-login` with `forceNewSession: true`, then `muggle-remote-auth-poll`.
149
+ - `ask` → run Picker 1 from `preference-gates/autoLogin.md` via `AskUserQuestion`; map the answer back to one of the actions above.
157
150
 
158
151
  If **not authenticated**:
159
152
  1. Tell the user a browser window is about to open.
@@ -163,14 +156,23 @@ If **not authenticated**:
163
156
 
164
157
  ---
165
158
 
166
- ## Step 5 — Pick or create a project
159
+ ## Step 5 — Pick or create a project (gated by `autoSelectProject`)
167
160
 
168
161
  A **project** is where all your imported use cases, test cases, and future test results are grouped on the Muggle AI dashboard.
169
162
 
170
- 1. Call `muggle-remote-project-list`
171
- 2. Use `AskQuestion` to present all projects as clickable options. Include the project URL in each label. Always include a "Create new project" option at the end.
163
+ The per-repo project cache lives at `<cwd>/.muggle-ai/last-project.json` (via the `muggle-local-last-project-get` / `muggle-local-last-project-set` MCP tools). Look for `Muggle Test Last Project: id=… url=… name="…"` in session context.
164
+
165
+ Gate `autoSelectProject` (per `preference-gates/README.md`). Cache: `Muggle Test Last Project` session line.
166
+ - `always` + cache → use cached `projectId`, skip to Step 6. No cache → fall through to `ask`.
167
+ - `never` → full project list; skip Picker 2.
168
+ - `ask` → project list picker (see gate file for spec + Picker 2 override). Skip Picker 2 if "Create new project".
172
169
 
173
- Prompt: "Pick the project to import into:"
170
+ ### Logic
171
+
172
+ 1. Call `muggle-remote-project-list` (only when not satisfied by the `always` cache).
173
+ 2. Use `AskUserQuestion` to present all projects as clickable options. Include the project URL in each label. Always include a "Create new project" option at the end.
174
+
175
+ Prompt: `"Pick the project to import into:"`
174
176
 
175
177
  3. **If creating a new project**, propose values based on what you learned from the source files:
176
178
  - **Name**: infer the app name from filenames, URLs, or document headings (e.g., "Acme App")
@@ -185,12 +187,12 @@ A **project** is where all your imported use cases, test cases, and future test
185
187
 
186
188
  Import in two passes using bulk-preview. Show progress to the user as you go.
187
189
 
188
- Both passes use Muggle's async bulk-preview MCP tools, which route prompts through OpenAI's
190
+ Both passes use Muggle Test's async bulk-preview MCP tools, which route prompts through OpenAI's
189
191
  Batch API for roughly ~50% of normal LLM cost. The flow is always: **submit → poll → persist**.
190
192
 
191
193
  ### Path A — Native PRD upload (for document files)
192
194
 
193
- If the source is a PRD or design document, use Muggle's built-in processing pipeline:
195
+ If the source is a PRD or design document, use Muggle Test's built-in processing pipeline:
194
196
 
195
197
  1. Read the file and base64-encode its content:
196
198
  ```bash
@@ -274,7 +276,7 @@ Failed items:
274
276
 
275
277
  Proceed with the <N> successful items, or cancel to review?
276
278
  ```
277
- Use `AskQuestion` with options "Proceed with successful items" / "Cancel import". Only continue
279
+ Use `AskUserQuestion` with options "Proceed with successful items" / "Cancel import". Only continue
278
280
  if the user chooses to proceed.
279
281
 
280
282
  If you need to abort an in-flight job, call `muggle-remote-bulk-preview-job-cancel` — the
@@ -366,7 +368,7 @@ When all imports are done, print a clean summary. Include:
366
368
  - A link to the project overview
367
369
  - If any items failed during preview (partial status), list them so the user can retry
368
370
 
369
- Construct view URLs using the Muggle dashboard URL pattern:
371
+ Construct view URLs using the Muggle Test dashboard URL pattern:
370
372
  - Project test cases: `https://www.muggle-ai.com/muggleTestV0/dashboard/projects/<projectId>/testcases`
371
373
  - Use case within project: `https://www.muggle-ai.com/muggleTestV0/dashboard/projects/<projectId>/testcases?useCaseId=<useCaseId>`
372
374
 
@@ -392,3 +394,40 @@ Imported: 3 use cases · 8 test cases
392
394
 
393
395
  Next step: run /muggle:do to generate executable browser test scripts for these test cases.
394
396
  ```
397
+
398
+ ### Step 8 — Optional follow-up suggestions
399
+
400
+ Two preferences gate optional follow-ups: `suggestRelatedUseCases` and `suggestRelatedTestCases`. Both are independent — handle each in turn.
401
+
402
+ #### 8a — Related use cases (gated by `suggestRelatedUseCases`)
403
+
404
+ The query is: "from the use cases already in this project, which ones are *not* in the import set but look related to it?" — surface them so the user can decide whether their import missed something the project already tracks.
405
+
406
+ Gate `suggestRelatedUseCases` (per `preference-gates/README.md`):
407
+ - `always` → run the query below.
408
+ - `never` → skip.
409
+ - `ask` → run Picker 1 from `preference-gates/suggestRelatedUseCases.md` via `AskUserQuestion`; map the answer back to one of the actions above.
410
+
411
+ When running the query:
412
+ 1. Call `muggle-remote-use-case-list` for the project.
413
+ 2. Filter out any use case whose `useCaseId` is in the set you just imported in Step 6 (Pass 1).
414
+ 3. Rank the remainder by semantic relevance to the imported titles/descriptions (substring overlap, shared keywords — best-effort, no LLM call needed).
415
+ 4. Present the top 3-5 via `AskUserQuestion` with `allow_multiple: true`. Label each with `<title> — <one-line description>`.
416
+ 5. For any the user selects, prompt to add follow-up test cases (treat each as a Pass 2 invocation: `muggle-remote-test-case-bulk-preview-submit` → poll → persist via `muggle-remote-test-case-create`).
417
+ 6. If the filtered list is empty (the import covers everything in the project), say so and skip.
418
+
419
+ #### 8b — Related test cases (gated by `suggestRelatedTestCases`)
420
+
421
+ For each use case the user just created, surface other test cases already attached that the import didn't add — same idea, scoped to a single use case.
422
+
423
+ Gate `suggestRelatedTestCases` (per `preference-gates/README.md`):
424
+ - `always` → run the query below.
425
+ - `never` → skip.
426
+ - `ask` → run Picker 1 from `preference-gates/suggestRelatedTestCases.md` via `AskUserQuestion`; map the answer back to one of the actions above.
427
+
428
+ When running the query, for each use case in the import:
429
+ 1. Call `muggle-remote-test-case-list-by-use-case` with that `useCaseId`.
430
+ 2. Filter out any test case you just created in Pass 2 of Step 6.
431
+ 3. Present the remainder via `AskUserQuestion` with `allow_multiple: true`, labeled `[<priority>] <title> — <goal>`.
432
+ 4. For any the user selects: nothing to create (they already exist) — just confirm to the user that those tests are now part of their Muggle Test project alongside the imported ones.
433
+ 5. If a use case has no extra test cases, skip it silently.