@muggleai/works 5.38.0 → 5.39.0-staging.360
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.
- package/.claude-plugin/marketplace.json +1 -1
- package/README.md +604 -604
- package/dist/plugin/.claude-plugin/plugin.json +1 -1
- package/dist/plugin/.codex-mcp.json +1 -1
- package/dist/plugin/.codex-plugin/plugin.json +1 -1
- package/dist/plugin/.cursor-plugin/plugin.json +1 -1
- package/dist/plugin/.mcp.json +1 -1
- package/dist/plugin/skills/do/build.md +1 -1
- package/dist/plugin/skills/do/cleanup.md +8 -1
- package/dist/plugin/skills/do/design.md +28 -11
- package/dist/plugin/skills/do/input-routing.md +14 -13
- package/dist/plugin/skills/do/pre-flight.md +132 -132
- package/dist/plugin/skills/muggle-do/SKILL.md +119 -117
- package/dist/plugin/skills/muggle-preferences/preference-gates/frontloadQuestions.md +27 -27
- package/dist/release-manifest.json +3 -3
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/.codex-mcp.json +1 -1
- package/plugin/.codex-plugin/plugin.json +1 -1
- package/plugin/.cursor-plugin/plugin.json +1 -1
- package/plugin/.mcp.json +1 -1
- package/plugin/skills/do/build.md +1 -1
- package/plugin/skills/do/cleanup.md +8 -1
- package/plugin/skills/do/design.md +28 -11
- package/plugin/skills/do/input-routing.md +14 -13
- package/plugin/skills/do/pre-flight.md +132 -132
- package/plugin/skills/muggle-do/SKILL.md +119 -117
- package/plugin/skills/muggle-preferences/preference-gates/frontloadQuestions.md +27 -27
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
---
|
|
2
|
-
mandatoryStages:
|
|
3
|
-
- requirements.md
|
|
4
|
-
- design.md
|
|
5
|
-
- build.md
|
|
6
|
-
- impact-analysis.md
|
|
7
|
-
- unit-tests.md
|
|
8
|
-
- e2e-acceptance.md
|
|
9
|
-
- open-prs/forward.md
|
|
10
|
-
- e2e-repair.md
|
|
11
|
-
- audit-trail.md
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
# Pre-flight Agent (Stage 1)
|
|
15
|
-
|
|
16
|
-
You are running the muggle-do dev cycle's **one questioning turn** — the only other
|
|
17
|
-
|
|
18
|
-
**Never ask what has a sensible default.** Branch name, PR target, a detected local URL, the top-matching project, the worktree, and syncing onto the base are taken silently from their defaults and preference gates, then listed in the handoff line, where the user overrides by replying. A question earns its place only when no default exists or a wrong guess costs more than the round trip.
|
|
19
|
-
|
|
20
|
-
**Non-negotiable:** Never split pre-flight across multiple turns. Detect what you can silently, then ask every remaining question at once. If you find yourself asking a follow-up, you failed — fold the follow-up back into this file so the next run covers it.
|
|
21
|
-
|
|
22
|
-
## Turn preamble
|
|
23
|
-
|
|
24
|
-
Start the turn with:
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
**Stage 1 — Pre-flight** — consolidating everything the cycle needs before going silent.
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Input
|
|
31
|
-
|
|
32
|
-
You receive:
|
|
33
|
-
|
|
34
|
-
- The user's task description (from `$ARGUMENTS`).
|
|
35
|
-
- The list of configured repos (names + paths) from the Muggle Test config.
|
|
36
|
-
- Any session directory that already exists (resumption case).
|
|
37
|
-
|
|
38
|
-
## Silent detection (do this first — no user prompts)
|
|
39
|
-
|
|
40
|
-
Before asking anything, gather every fact you can resolve without the user:
|
|
41
|
-
|
|
42
|
-
1. **Candidate repo(s).** Match keywords in the task description against configured repo names. If one repo is an obvious match, propose it as the default; if two or three are plausible, list them.
|
|
43
|
-
2. **Current branch and default branch** for each candidate repo. Run `git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short` and `git -C <repo> branch --show-current`. If the current branch is the default, the pre-flight must collect a new branch name.
|
|
44
|
-
3. **Local environment readiness.** Invoke [`muggle-test-prepare`](../muggle-test-prepare/SKILL.md) — the owner of dev-server/backend detection and service start (idempotent; it probes via `dev-server-readiness.md` internally). Use what it reports as the dev-server/URL pre-flight signal, then release its lease at once: `muggle stack release --cwd "<checkout>"`. The cycle's first run is far off — after the questionnaire and the coding — and E2E acceptance invokes prepare again right before it; a lease held meanwhile blocks every other session's E2E.
|
|
45
|
-
4. **Backend health.** Covered by the same `muggle-test-prepare` invocation above (it probes backend health); note up/down.
|
|
46
|
-
5. **Muggle Test MCP auth.** Call `muggle-remote-auth-status`. If expired, you will ask to re-auth in the questionnaire.
|
|
47
|
-
6. **Candidate Muggle Test projects.** Call `muggle-remote-project-list` and rank by semantic match against the task description and the repo's dev URL.
|
|
48
|
-
7. **Existing test-user secrets.** For each candidate Muggle Test project, call `muggle-remote-secret-list` and note whether `managed_profile_email` / `managed_profile_password` exist.
|
|
49
|
-
8. **Auth0 tenant in use for local dev.** Grep the repo's env file for `*AUTH0_DOMAIN*`; record the tenant. This tells the user whether the staging-tenant test user will work or not.
|
|
50
|
-
9. **Branch hygiene signals** for the `autoUseWorktree` and `autoRebase` gates (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md), [`../_shared/sync-branch-with-base.md`](../_shared/sync-branch-with-base.md)):
|
|
51
|
-
- Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
|
|
52
|
-
- Is the current checkout on the latest base? `muggle checkout-freshness --cwd <repo> --json` fetches and reports the verdict and `behindBy`. However stale or foreign the current checkout, a new worktree starts from `origin/<base>`, never from it.
|
|
53
|
-
10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
|
|
54
|
-
11. **Wave or stream?** Group the task's PRs per [`wave-or-stream.md`](wave-or-stream.md). Parts of one change across repos form a **wave** ([`wave-e2e.md`](wave-e2e.md)): record each member's worktree path for the `Wave members` block, or `Wave: off — <reason>` when one fails a wave condition. Unrelated fixes — "fix these three bugs" — form a **stream**: one change per fix, each with its own slug, session directory, branch, worktree, PR and E2E run ([`background-e2e.md`](background-e2e.md)). When unsure, a stream. The questionnaire's answers apply to every change unless a fix names another repo; state the grouping in Q1's options so the user sees how many PRs ship and which share a run.
|
|
55
|
-
12. **CI check present?** For each GitHub repo, whether `.github/workflows/muggle-walkthrough.yml` exists on its default branch. Missing and [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) resolves to `ask` → surface in Q14.
|
|
56
|
-
|
|
57
|
-
## The consolidated questionnaire
|
|
58
|
-
|
|
59
|
-
Present **one `AskUserQuestion`** (or the platform's structured-selection equivalent) that collects every remaining decision. Use detected values as defaults whenever possible. Questions to include, in this order:
|
|
60
|
-
|
|
61
|
-
1. **Task scope clarification** — only if the task description is genuinely ambiguous. Offer 2–3 interpretations as options plus "Other — type a clarification." If the task is unambiguous, omit.
|
|
62
|
-
2. **Repo(s) to modify** — only when no single repo is the obvious match; an obvious match is taken silently. "Use <best match>" / "Change repo" / "Multi-repo (list them)". When multi-repo, state in the option whether the PRs ship as a wave — one change, tested together in one E2E run — or a stream of independent changes, each tested on its own, per step 11 and [`wave-or-stream.md`](wave-or-stream.md) — no separate question.
|
|
63
|
-
3. **Branch name** — never asked: `users/<user>/<slug>` derived from the task.
|
|
64
|
-
4. **Validation strategy** — the single most important decision, asked only when the change does not settle it: a UI change with a detected dev server takes Local E2E silently, a change with no app surface (docs, skill text, config) takes Unit tests only silently. Options:
|
|
65
|
-
- **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
|
|
66
|
-
- **Staging replay** — for changes already deployed to a preview URL.
|
|
67
|
-
- **Unit tests only** — skip browser E2E, acceptable for pure refactors or backend-only changes. Deliverable checks on video, image, audio, data, research, or email artifacts still run.
|
|
68
|
-
- **Skip validation** — explicit opt-out; the PR title gets `[UNVERIFIED]`.
|
|
69
|
-
5. **Local URL** — only if validation is Local E2E and no dev server was detected; a detected one is taken silently. "Type the URL".
|
|
70
|
-
6. **Backend reachable?** — only if validation is Local E2E and a backend URL is declared. If the health probe failed, ask "Start the backend now and I'll re-probe" / "Proceed anyway" / "Skip to unit tests only".
|
|
71
|
-
7. **Muggle Test project** — only if validation needs one and no project clearly matches; a clear top match is taken silently. "Use <top match>" / "Use a different existing project (list)" / "Create new".
|
|
72
|
-
8. **Test-user credentials** — only if validation is Local E2E AND the Auth0 tenant in the repo differs from the tenant the managed secrets were created under. Options: "Reuse existing secrets (may fail if tenant mismatch — will surface failure)" / "Create new secrets for this tenant (provide email + password)" / "Switch to staging replay".
|
|
73
|
-
9. **PR target branch** — never asked: the repo's default branch.
|
|
74
|
-
10. **Re-auth Muggle Test MCP?** — only if auth was missing/expired. "Log in now" / "Abort".
|
|
75
|
-
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
76
|
-
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
77
|
-
13. **Run E2E at the end of every cycle?** — gate: [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md), only if step 10's silent detection resolved to `ask`. Options: always run stage 6, or ask each cycle.
|
|
78
|
-
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 12 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
79
|
-
|
|
80
|
-
If fewer than two of the above need the user, still gather them in a single turn — never open a second round. If none do, ask nothing: write `state.md` and go straight to the handoff. Never add a "confirm these defaults?" question.
|
|
81
|
-
|
|
82
|
-
## Output
|
|
83
|
-
|
|
84
|
-
After the user answers, write **`state.md`** with every resolved value, verbatim, in this format:
|
|
85
|
-
|
|
86
|
-
```markdown
|
|
87
|
-
# Session state
|
|
88
|
-
|
|
89
|
-
**Slug:** <slug>
|
|
90
|
-
**Current stage:** 1/7 (pre-flight complete)
|
|
91
|
-
**Last update:** <ISO-8601 timestamp>
|
|
92
|
-
|
|
93
|
-
## Pre-flight answers
|
|
94
|
-
|
|
95
|
-
- Task: <one-line goal>
|
|
96
|
-
- Repos: <repo1>, <repo2>
|
|
97
|
-
- Wave: <on | off — reason | N/A (single repo)>
|
|
98
|
-
- Wave members: <one line per repo when on — `<owner/repo> → <worktree path> (branch <branch>)`; see wave-e2e.md>
|
|
99
|
-
- Sibling changes: <slugs of this session's other changes, or none; see background-e2e.md>
|
|
100
|
-
- Branch: <branch-name>
|
|
101
|
-
- Validation: <strategy>
|
|
102
|
-
- Local URL: <url or N/A>
|
|
103
|
-
- Backend status: <up | down | N/A>
|
|
104
|
-
- Muggle Test project: <name> (<uuid>)
|
|
105
|
-
- Test credentials: <existing | new | skip>
|
|
106
|
-
- PR target: <branch>
|
|
107
|
-
- Auth status: <ok | re-authed | N/A>
|
|
108
|
-
|
|
109
|
-
## Blockers
|
|
110
|
-
<none | bulleted list>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
Also initialize `iterations/001.md` with a header:
|
|
114
|
-
|
|
115
|
-
```markdown
|
|
116
|
-
# Iteration 001 — <ISO-8601 timestamp>
|
|
117
|
-
|
|
118
|
-
### Stage 1 — Pre-flight (<timestamp>)
|
|
119
|
-
|
|
120
|
-
<verbatim copy of pre-flight answers>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Handoff
|
|
124
|
-
|
|
125
|
-
Return control to the muggle-do driver with a one-line summary naming the defaults taken: `pre-flight complete — <repo>, branch <branch> → <PR target>, <validation>; reply to override. Proceeding to requirements and design.` Print nothing else of the answers — they are in `state.md` and the iteration log.
|
|
126
|
-
|
|
127
|
-
## Non-negotiables
|
|
128
|
-
|
|
129
|
-
- Exactly **one** user turn. Zero follow-up questions inside this stage.
|
|
130
|
-
- Silent detection **must** run before the questionnaire — never ask for a value you can detect.
|
|
131
|
-
- Every detected value is a default, not a lock — the user overrides it by replying to the handoff line.
|
|
132
|
-
- Missing `state.md` or `iterations/001.md` at the end of this stage is a stage failure. Several changes → one session directory each, all written before Stage 2 starts on the first.
|
|
1
|
+
---
|
|
2
|
+
mandatoryStages:
|
|
3
|
+
- requirements.md
|
|
4
|
+
- design.md
|
|
5
|
+
- build.md
|
|
6
|
+
- impact-analysis.md
|
|
7
|
+
- unit-tests.md
|
|
8
|
+
- e2e-acceptance.md
|
|
9
|
+
- open-prs/forward.md
|
|
10
|
+
- e2e-repair.md
|
|
11
|
+
- audit-trail.md
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# Pre-flight Agent (Stage 1)
|
|
15
|
+
|
|
16
|
+
You are running the muggle-do dev cycle's **one questioning turn** — the only other approval is the merge of Stage 2.5's design PR ([`design.md`](design.md)), which asks nothing. Your job is to consolidate every real decision — task scope, repos, validation strategy, environment, credentials — into a **single turn** so the rest of the cycle can run unattended.
|
|
17
|
+
|
|
18
|
+
**Never ask what has a sensible default.** Branch name, PR target, a detected local URL, the top-matching project, the worktree, and syncing onto the base are taken silently from their defaults and preference gates, then listed in the handoff line, where the user overrides by replying. A question earns its place only when no default exists or a wrong guess costs more than the round trip.
|
|
19
|
+
|
|
20
|
+
**Non-negotiable:** Never split pre-flight across multiple turns. Detect what you can silently, then ask every remaining question at once. If you find yourself asking a follow-up, you failed — fold the follow-up back into this file so the next run covers it.
|
|
21
|
+
|
|
22
|
+
## Turn preamble
|
|
23
|
+
|
|
24
|
+
Start the turn with:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
**Stage 1 — Pre-flight** — consolidating everything the cycle needs before going silent.
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Input
|
|
31
|
+
|
|
32
|
+
You receive:
|
|
33
|
+
|
|
34
|
+
- The user's task description (from `$ARGUMENTS`).
|
|
35
|
+
- The list of configured repos (names + paths) from the Muggle Test config.
|
|
36
|
+
- Any session directory that already exists (resumption case).
|
|
37
|
+
|
|
38
|
+
## Silent detection (do this first — no user prompts)
|
|
39
|
+
|
|
40
|
+
Before asking anything, gather every fact you can resolve without the user:
|
|
41
|
+
|
|
42
|
+
1. **Candidate repo(s).** Match keywords in the task description against configured repo names. If one repo is an obvious match, propose it as the default; if two or three are plausible, list them.
|
|
43
|
+
2. **Current branch and default branch** for each candidate repo. Run `git -C <repo> symbolic-ref refs/remotes/origin/HEAD --short` and `git -C <repo> branch --show-current`. If the current branch is the default, the pre-flight must collect a new branch name.
|
|
44
|
+
3. **Local environment readiness.** Invoke [`muggle-test-prepare`](../muggle-test-prepare/SKILL.md) — the owner of dev-server/backend detection and service start (idempotent; it probes via `dev-server-readiness.md` internally). Use what it reports as the dev-server/URL pre-flight signal, then release its lease at once: `muggle stack release --cwd "<checkout>"`. The cycle's first run is far off — after the questionnaire and the coding — and E2E acceptance invokes prepare again right before it; a lease held meanwhile blocks every other session's E2E.
|
|
45
|
+
4. **Backend health.** Covered by the same `muggle-test-prepare` invocation above (it probes backend health); note up/down.
|
|
46
|
+
5. **Muggle Test MCP auth.** Call `muggle-remote-auth-status`. If expired, you will ask to re-auth in the questionnaire.
|
|
47
|
+
6. **Candidate Muggle Test projects.** Call `muggle-remote-project-list` and rank by semantic match against the task description and the repo's dev URL.
|
|
48
|
+
7. **Existing test-user secrets.** For each candidate Muggle Test project, call `muggle-remote-secret-list` and note whether `managed_profile_email` / `managed_profile_password` exist.
|
|
49
|
+
8. **Auth0 tenant in use for local dev.** Grep the repo's env file for `*AUTH0_DOMAIN*`; record the tenant. This tells the user whether the staging-tenant test user will work or not.
|
|
50
|
+
9. **Branch hygiene signals** for the `autoUseWorktree` and `autoRebase` gates (see [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md), [`../_shared/sync-branch-with-base.md`](../_shared/sync-branch-with-base.md)):
|
|
51
|
+
- Is the current checkout already a worktree? `git -C <repo> rev-parse --is-inside-work-tree` plus `git -C <repo> worktree list`.
|
|
52
|
+
- Is the current checkout on the latest base? `muggle checkout-freshness --cwd <repo> --json` fetches and reports the verdict and `behindBy`. However stale or foreign the current checkout, a new worktree starts from `origin/<base>`, never from it.
|
|
53
|
+
10. **`autoE2ETest` preference.** Read the session-context preferences line. Unset → treat as `always` (this gate's default — opposite of the system-wide `ask` default). `ask` → surface in Q13. `always` → no question; stage 6 runs.
|
|
54
|
+
11. **Wave or stream?** Group the task's PRs per [`wave-or-stream.md`](wave-or-stream.md). Parts of one change across repos form a **wave** ([`wave-e2e.md`](wave-e2e.md)): record each member's worktree path for the `Wave members` block, or `Wave: off — <reason>` when one fails a wave condition. Unrelated fixes — "fix these three bugs" — form a **stream**: one change per fix, each with its own slug, session directory, branch, worktree, PR and E2E run ([`background-e2e.md`](background-e2e.md)). When unsure, a stream. The questionnaire's answers apply to every change unless a fix names another repo; state the grouping in Q1's options so the user sees how many PRs ship and which share a run.
|
|
55
|
+
12. **CI check present?** For each GitHub repo, whether `.github/workflows/muggle-walkthrough.yml` exists on its default branch. Missing and [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md) resolves to `ask` → surface in Q14.
|
|
56
|
+
|
|
57
|
+
## The consolidated questionnaire
|
|
58
|
+
|
|
59
|
+
Present **one `AskUserQuestion`** (or the platform's structured-selection equivalent) that collects every remaining decision. Use detected values as defaults whenever possible. Questions to include, in this order:
|
|
60
|
+
|
|
61
|
+
1. **Task scope clarification** — only if the task description is genuinely ambiguous. Offer 2–3 interpretations as options plus "Other — type a clarification." If the task is unambiguous, omit.
|
|
62
|
+
2. **Repo(s) to modify** — only when no single repo is the obvious match; an obvious match is taken silently. "Use <best match>" / "Change repo" / "Multi-repo (list them)". When multi-repo, state in the option whether the PRs ship as a wave — one change, tested together in one E2E run — or a stream of independent changes, each tested on its own, per step 11 and [`wave-or-stream.md`](wave-or-stream.md) — no separate question.
|
|
63
|
+
3. **Branch name** — never asked: `users/<user>/<slug>` derived from the task.
|
|
64
|
+
4. **Validation strategy** — the single most important decision, asked only when the change does not settle it: a UI change with a detected dev server takes Local E2E silently, a change with no app surface (docs, skill text, config) takes Unit tests only silently. Options:
|
|
65
|
+
- **Local E2E** (Muggle Test Electron against a running localhost) — default if a dev server was detected.
|
|
66
|
+
- **Staging replay** — for changes already deployed to a preview URL.
|
|
67
|
+
- **Unit tests only** — skip browser E2E, acceptable for pure refactors or backend-only changes. Deliverable checks on video, image, audio, data, research, or email artifacts still run.
|
|
68
|
+
- **Skip validation** — explicit opt-out; the PR title gets `[UNVERIFIED]`.
|
|
69
|
+
5. **Local URL** — only if validation is Local E2E and no dev server was detected; a detected one is taken silently. "Type the URL".
|
|
70
|
+
6. **Backend reachable?** — only if validation is Local E2E and a backend URL is declared. If the health probe failed, ask "Start the backend now and I'll re-probe" / "Proceed anyway" / "Skip to unit tests only".
|
|
71
|
+
7. **Muggle Test project** — only if validation needs one and no project clearly matches; a clear top match is taken silently. "Use <top match>" / "Use a different existing project (list)" / "Create new".
|
|
72
|
+
8. **Test-user credentials** — only if validation is Local E2E AND the Auth0 tenant in the repo differs from the tenant the managed secrets were created under. Options: "Reuse existing secrets (may fail if tenant mismatch — will surface failure)" / "Create new secrets for this tenant (provide email + password)" / "Switch to staging replay".
|
|
73
|
+
9. **PR target branch** — never asked: the repo's default branch.
|
|
74
|
+
10. **Re-auth Muggle Test MCP?** — only if auth was missing/expired. "Log in now" / "Abort".
|
|
75
|
+
11. **Worktree for this change?** — gate: [`autoUseWorktree`](../muggle-preferences/preference-gates/autoUseWorktree.md). Options: create a dedicated worktree (per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md)), or work in the current checkout.
|
|
76
|
+
12. **Sync onto the base branch first?** — gate: [`autoRebase`](../muggle-preferences/preference-gates/autoRebase.md), only if `behind > 0`. The answer governs every sync this cycle, not just one: before the dev server / E2E, and again immediately before stage 7 pushes. Options: sync with the base, or run as-is.
|
|
77
|
+
13. **Run E2E at the end of every cycle?** — gate: [`autoE2ETest`](../muggle-preferences/preference-gates/autoE2ETest.md), only if step 10's silent detection resolved to `ask`. Options: always run stage 6, or ask each cycle.
|
|
78
|
+
14. **Add the Muggle E2E check to this repo's CI?** — gate: [`autoInstallCiWorkflow`](../muggle-preferences/preference-gates/autoInstallCiWorkflow.md), only if step 12 found the workflow missing and the gate resolved to `ask`. Record the answer in `state.md` as `CI check: add | skip`; stage 7 acts on it.
|
|
79
|
+
|
|
80
|
+
If fewer than two of the above need the user, still gather them in a single turn — never open a second round. If none do, ask nothing: write `state.md` and go straight to the handoff. Never add a "confirm these defaults?" question.
|
|
81
|
+
|
|
82
|
+
## Output
|
|
83
|
+
|
|
84
|
+
After the user answers, write **`state.md`** with every resolved value, verbatim, in this format:
|
|
85
|
+
|
|
86
|
+
```markdown
|
|
87
|
+
# Session state
|
|
88
|
+
|
|
89
|
+
**Slug:** <slug>
|
|
90
|
+
**Current stage:** 1/7 (pre-flight complete)
|
|
91
|
+
**Last update:** <ISO-8601 timestamp>
|
|
92
|
+
|
|
93
|
+
## Pre-flight answers
|
|
94
|
+
|
|
95
|
+
- Task: <one-line goal>
|
|
96
|
+
- Repos: <repo1>, <repo2>
|
|
97
|
+
- Wave: <on | off — reason | N/A (single repo)>
|
|
98
|
+
- Wave members: <one line per repo when on — `<owner/repo> → <worktree path> (branch <branch>)`; see wave-e2e.md>
|
|
99
|
+
- Sibling changes: <slugs of this session's other changes, or none; see background-e2e.md>
|
|
100
|
+
- Branch: <branch-name>
|
|
101
|
+
- Validation: <strategy>
|
|
102
|
+
- Local URL: <url or N/A>
|
|
103
|
+
- Backend status: <up | down | N/A>
|
|
104
|
+
- Muggle Test project: <name> (<uuid>)
|
|
105
|
+
- Test credentials: <existing | new | skip>
|
|
106
|
+
- PR target: <branch>
|
|
107
|
+
- Auth status: <ok | re-authed | N/A>
|
|
108
|
+
|
|
109
|
+
## Blockers
|
|
110
|
+
<none | bulleted list>
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Also initialize `iterations/001.md` with a header:
|
|
114
|
+
|
|
115
|
+
```markdown
|
|
116
|
+
# Iteration 001 — <ISO-8601 timestamp>
|
|
117
|
+
|
|
118
|
+
### Stage 1 — Pre-flight (<timestamp>)
|
|
119
|
+
|
|
120
|
+
<verbatim copy of pre-flight answers>
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Handoff
|
|
124
|
+
|
|
125
|
+
Return control to the muggle-do driver with a one-line summary naming the defaults taken: `pre-flight complete — <repo>, branch <branch> → <PR target>, <validation>; reply to override. Proceeding to requirements and design.` Print nothing else of the answers — they are in `state.md` and the iteration log.
|
|
126
|
+
|
|
127
|
+
## Non-negotiables
|
|
128
|
+
|
|
129
|
+
- Exactly **one** user turn. Zero follow-up questions inside this stage.
|
|
130
|
+
- Silent detection **must** run before the questionnaire — never ask for a value you can detect.
|
|
131
|
+
- Every detected value is a default, not a lock — the user overrides it by replying to the handoff line.
|
|
132
|
+
- Missing `state.md` or `iterations/001.md` at the end of this stage is a stage failure. Several changes → one session directory each, all written before Stage 2 starts on the first.
|
|
@@ -1,117 +1,119 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: muggle-do
|
|
3
|
-
description: Take a feature request, spec, design, bug, or ticket and carry it autonomously to an opened pull request — write the code, test it, raise the PR. The PR carries real-browser proof: email-gated flows run through live test inboxes, logins through encrypted secrets, and prerequisite flows in test-graph order, with screenshots attached. Use whenever the user wants something built, implemented, added, or fixed with a PR opened, raised, or put up at the end — "implement rate limiting and raise a PR", "build the CSV export and put up a PR", "take this Jira ticket and run with it, ping me when the PR is up", "fix this bug and open a pr", or "muggle do …". Also handles the internal `address-reviews` directive the muggle-pr-followup watcher dispatches when new reviews land. Not for testing or validating existing changes (use muggle-test), nor watching a PR's incoming reviews (use muggle-pr-followup).
|
|
4
|
-
mandatoryStages:
|
|
5
|
-
- ../do/input-routing.md
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Muggle Test Do
|
|
9
|
-
|
|
10
|
-
> Telemetry first step: see [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md). Use `skillName: "muggle-do"`.
|
|
11
|
-
|
|
12
|
-
> Running outside Claude Code (in Codex, for one)? Read [`../_shared/host-tool-equivalents.md`](../_shared/host-tool-equivalents.md) first — it maps the tools and paths this skill names to your host's.
|
|
13
|
-
|
|
14
|
-
Runs an autonomous dev cycle from requirements to PR. **Fire and review:** user answers one pre-flight questionnaire, then walks away. The [muggle-pr-followup](../muggle-pr-followup/SKILL.md) watcher invokes `/muggle-do` again with the *address-reviews* directive when new reviews land.
|
|
15
|
-
|
|
16
|
-
## Forward pipeline (fresh feature)
|
|
17
|
-
|
|
18
|
-
| # | Stage | File |
|
|
19
|
-
| :- | :---- | :--- |
|
|
20
|
-
| 1 | Pre-flight (one questioning turn) | [`../do/pre-flight.md`](../do/pre-flight.md) |
|
|
21
|
-
| 2 | Requirements | [`../do/requirements.md`](../do/requirements.md) |
|
|
22
|
-
| 2.5 | Design —
|
|
23
|
-
| 3 | Build | [`../do/build.md`](../do/build.md) |
|
|
24
|
-
| 4 | Impact analysis | [`../do/impact-analysis.md`](../do/impact-analysis.md) |
|
|
25
|
-
| 5 | Unit tests | [`../do/unit-tests.md`](../do/unit-tests.md) |
|
|
26
|
-
| 5.5 | Open PR | [`../do/open-prs.md`](../do/open-prs.md) |
|
|
27
|
-
| 6 | E2E acceptance | [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md) |
|
|
28
|
-
| 7 | Report on the PR | [`../do/open-prs.md`](../do/open-prs.md) |
|
|
29
|
-
| 7.5 | E2E repair loop | [`../do/e2e-repair.md`](../do/e2e-repair.md) |
|
|
30
|
-
| 8 | Hand off to watcher | [`../muggle-pr-followup/SKILL.md`](../muggle-pr-followup/SKILL.md) |
|
|
31
|
-
|
|
32
|
-
**The PR opens before E2E.** Stage 5.5 opens it as soon as unit tests pass; Stage 6 then runs against the PR's head, its progress showing on the PR, and Stage 7 settles the walkthrough with the result. The walkthrough check stays red until then.
|
|
33
|
-
|
|
34
|
-
**Waves and streams.** A session's PRs are either a **wave** — one change split across repos — or a **stream** of independent changes, or both; [`../do/wave-or-stream.md`](../do/wave-or-stream.md) defines which is which, and pre-flight decides it once.
|
|
35
|
-
|
|
36
|
-
**
|
|
37
|
-
|
|
38
|
-
**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
**
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
|
91
|
-
|
|
|
92
|
-
| `
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
|
105
|
-
|
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
-
|
|
116
|
-
-
|
|
117
|
-
-
|
|
1
|
+
---
|
|
2
|
+
name: muggle-do
|
|
3
|
+
description: Take a feature request, spec, design, bug, or ticket and carry it autonomously to an opened pull request — write the code, test it, raise the PR. The PR carries real-browser proof: email-gated flows run through live test inboxes, logins through encrypted secrets, and prerequisite flows in test-graph order, with screenshots attached. Use whenever the user wants something built, implemented, added, or fixed with a PR opened, raised, or put up at the end — "implement rate limiting and raise a PR", "build the CSV export and put up a PR", "take this Jira ticket and run with it, ping me when the PR is up", "fix this bug and open a pr", or "muggle do …". Also handles the internal `address-reviews` directive the muggle-pr-followup watcher dispatches when new reviews land. Not for testing or validating existing changes (use muggle-test), nor watching a PR's incoming reviews (use muggle-pr-followup).
|
|
4
|
+
mandatoryStages:
|
|
5
|
+
- ../do/input-routing.md
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Muggle Test Do
|
|
9
|
+
|
|
10
|
+
> Telemetry first step: see [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md). Use `skillName: "muggle-do"`.
|
|
11
|
+
|
|
12
|
+
> Running outside Claude Code (in Codex, for one)? Read [`../_shared/host-tool-equivalents.md`](../_shared/host-tool-equivalents.md) first — it maps the tools and paths this skill names to your host's.
|
|
13
|
+
|
|
14
|
+
Runs an autonomous dev cycle from requirements to PR. **Fire and review:** user answers one pre-flight questionnaire, then walks away. The [muggle-pr-followup](../muggle-pr-followup/SKILL.md) watcher invokes `/muggle-do` again with the *address-reviews* directive when new reviews land.
|
|
15
|
+
|
|
16
|
+
## Forward pipeline (fresh feature)
|
|
17
|
+
|
|
18
|
+
| # | Stage | File |
|
|
19
|
+
| :- | :---- | :--- |
|
|
20
|
+
| 1 | Pre-flight (one questioning turn) | [`../do/pre-flight.md`](../do/pre-flight.md) |
|
|
21
|
+
| 2 | Requirements | [`../do/requirements.md`](../do/requirements.md) |
|
|
22
|
+
| 2.5 | Design — a design PR; merging it approves the design and starts the build | [`../do/design.md`](../do/design.md) |
|
|
23
|
+
| 3 | Build | [`../do/build.md`](../do/build.md) |
|
|
24
|
+
| 4 | Impact analysis | [`../do/impact-analysis.md`](../do/impact-analysis.md) |
|
|
25
|
+
| 5 | Unit tests | [`../do/unit-tests.md`](../do/unit-tests.md) |
|
|
26
|
+
| 5.5 | Open PR | [`../do/open-prs.md`](../do/open-prs.md) |
|
|
27
|
+
| 6 | E2E acceptance | [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md) |
|
|
28
|
+
| 7 | Report on the PR | [`../do/open-prs.md`](../do/open-prs.md) |
|
|
29
|
+
| 7.5 | E2E repair loop | [`../do/e2e-repair.md`](../do/e2e-repair.md) |
|
|
30
|
+
| 8 | Hand off to watcher | [`../muggle-pr-followup/SKILL.md`](../muggle-pr-followup/SKILL.md) |
|
|
31
|
+
|
|
32
|
+
**The PR opens before E2E.** Stage 5.5 opens it as soon as unit tests pass; Stage 6 then runs against the PR's head, its progress showing on the PR, and Stage 7 settles the walkthrough with the result. The walkthrough check stays red until then.
|
|
33
|
+
|
|
34
|
+
**Waves and streams.** A session's PRs are either a **wave** — one change split across repos — or a **stream** of independent changes, or both; [`../do/wave-or-stream.md`](../do/wave-or-stream.md) defines which is which, and pre-flight decides it once.
|
|
35
|
+
|
|
36
|
+
**Design PRs.** A change that needs a design stops after Stage 2.5 with a `[DESIGN]` PR carrying the spec. Merging it is the approval: the merge's cleanup resumes the cycle at Stage 3; closing it unmerged rejects the design. See [`../do/design.md`](../do/design.md).
|
|
37
|
+
|
|
38
|
+
**Multi-repo waves.** When a task's PRs need each other to work — one PR per repo — they form a wave: every repo's service starts from its branch, Stage 6 runs **one** E2E pass against the combined stack, and that same result is posted to every PR in the wave. See [`../do/wave-e2e.md`](../do/wave-e2e.md); pre-flight decides whether a cycle is a wave.
|
|
39
|
+
|
|
40
|
+
**Streams — several changes in one session.** Unrelated fixes — several bugs in one request, or a second task while the first is still in flight — are separate changes, each with its own session directory, worktree, PR, and E2E run; a wave is one change among them. When a change reaches Stage 6 while other work is in front of the session, its run goes to a background `acceptance-tester` and the session moves on; the report comes back to the main session, which carries that change through Stages 7–8. One local run at a time, and a PR's walkthrough only ever carries its own change's run. See [`../do/background-e2e.md`](../do/background-e2e.md).
|
|
41
|
+
|
|
42
|
+
Stage 7 dispatches one watcher per opened PR as its last action, gated on Stage 7.5's clearance — a cycle with unrepaired E2E failures never reaches a watcher.
|
|
43
|
+
|
|
44
|
+
## Execution protocol (non-negotiable)
|
|
45
|
+
|
|
46
|
+
The pipeline table lists **pointers, not summaries**. Open each stage's file and execute from it — running a stage off its one-line row here is how tests, E2E, and session state get silently skipped. If you have not read a stage's file this run, you have not run that stage.
|
|
47
|
+
|
|
48
|
+
**Bootstrap before any code, in order:**
|
|
49
|
+
1. Emit telemetry — [`../_shared/telemetry-emit.md`](../_shared/telemetry-emit.md), `skillName: "muggle-do"`.
|
|
50
|
+
2. Create `~/.muggle-ai/muggle-do/sessions/<slug>/` with `state.md` + `iterations/001.md` (pre-flight owns this; do it even when running unattended).
|
|
51
|
+
3. `TodoWrite` one item per stage 1–8, Stages 2.5, 5.5 and 7.5 included — these stages are the checklist; never swap in your own decomposition. Several changes → one set of stage items per change.
|
|
52
|
+
|
|
53
|
+
**Per stage:** read the file → execute it → append one marker line to `iterations/<NNN>.md`, always in the form `Stage <N> done — <evidence>`, citing the evidence that file requires (jest exit code, E2E verdict + `runId`, screenshot path). The marker is the stage's last line, written after its notes, and carries the evidence itself: nothing between `done` and `—`, never a pointer such as `Stage 4 done (see below) —`. A stage is done only when its evidence is written, never on recollection.
|
|
54
|
+
|
|
55
|
+
### "Autonomous" / "without my intervention" collapses exactly one thing
|
|
56
|
+
Best-effort the Stage-1 questionnaire and don't ask. It does **not** license skipping telemetry, session artifacts, requirements, the Stage-2.5 design PR, unit tests, E2E (`autoE2ETest` defaults to `always`), browser verification, the gate below, the Stage-7.5 repair loop, or the watcher hand-off. Stage 7.5 investigates and repairs unattended too; only its user decision is deferred — left open for the user and carried by the watcher, never waived on their behalf. Run the whole pipeline silently — never a shortcut.
|
|
57
|
+
|
|
58
|
+
### Definition of Done — gates before Stages 5.5 and 7
|
|
59
|
+
Each line holds, or is waived by a one-line reason written into `state.md` (silence is not a waiver).
|
|
60
|
+
|
|
61
|
+
Before Stage 5.5 opens the PR:
|
|
62
|
+
- `requirements.md` written (forward runs)
|
|
63
|
+
- `Design: finalized` recorded in `state.md` before Stage 3 edited a file (forward runs)
|
|
64
|
+
- Build clean — typecheck + lint on changed files
|
|
65
|
+
- New/changed logic carries unit tests (authored in Stage 3; Stage 5 only runs the suite)
|
|
66
|
+
- Unit suite run, PASS recorded
|
|
67
|
+
- Stage 4's `e2eScope` recorded, mapping every acceptance criterion to a test case, a deliverable check, or `unobservable` — or `not-scoped` with the condition that failed
|
|
68
|
+
|
|
69
|
+
Before Stage 7 settles the PR's walkthrough:
|
|
70
|
+
- A verdict recorded for every deliverable check in that scope
|
|
71
|
+
- E2E verdict recorded with `runId` for every case in that scope, per `autoE2ETest` — or `[E2E FAILING]`, or `SKIPPED` citing a verified skip code from [`../do/e2e-acceptance.md`](../do/e2e-acceptance.md), where each code's verification rule lives. Free-text reasons are rejected by the gate
|
|
72
|
+
- UI changes verified in a real browser with evidence (screenshot path or muggle `runId`); `curl` + `grep` is not verification
|
|
73
|
+
|
|
74
|
+
Opening a PR, or settling its walkthrough, with an unchecked, unwaived line of its gate is a cycle failure. A Stage 6 readiness halt ([`../do/e2e-acceptance.md`](../do/e2e-acceptance.md) Step 0.5) leaves the E2E line open: no skip code, waiver, or explicit request to open the PR closes it.
|
|
75
|
+
|
|
76
|
+
### Audit trail
|
|
77
|
+
|
|
78
|
+
Every cycle's closing message opens with the fenced block [`../do/audit-trail.md`](../do/audit-trail.md) defines: the unit tests involved, the E2E tests with results, links to the evidence, and what is missing. A prose recap does not replace it. It reports and gates nothing, and it comes after the last action: the watcher arms first.
|
|
79
|
+
|
|
80
|
+
## Address-reviews flow
|
|
81
|
+
|
|
82
|
+
When invoked with the directive (PR URL + slug + review ids), routes to [`../do/address-reviews.md`](../do/address-reviews.md). Shares stages 3–5 with the forward pipeline, then sizes the cycle from its diff per [`../do/cycle-size.md`](../do/cycle-size.md): a full cycle adds stage 6 and a fresh walkthrough, a minor one skips E2E under a verified `NO_APP_LOGIC_CHANGE`. Skips pre-flight, requirements, and PR creation. See the orchestrator for the cycle's exact step order, classification rules, and respawn logic.
|
|
83
|
+
|
|
84
|
+
## Input routing
|
|
85
|
+
|
|
86
|
+
`/muggle-do` serves one interactive mode (the forward pipeline, from a fresh task) and four programmatic modes the watcher dispatches (address-reviews, fix-ci, rebase, post-merge cleanup). Resolve `$ARGUMENTS` to a mode per [`../do/input-routing.md`](../do/input-routing.md) before doing anything else.
|
|
87
|
+
|
|
88
|
+
## Preferences
|
|
89
|
+
|
|
90
|
+
| Preference | Gate |
|
|
91
|
+
| :--------- | :--- |
|
|
92
|
+
| `frontloadQuestions` | Every stage — `always` keeps Stage 1 the only questioning turn, with Stage 2.5's design approval taken as a design-PR merge and Stage 7.5's decision open rather than asked; `never` lets a later stage ask when a question arises ([rule](../muggle-preferences/preference-gates/frontloadQuestions.md)) |
|
|
93
|
+
| `autoE2ETest` | Stage 6 — run E2E every cycle (default `always`), or fold into pre-flight |
|
|
94
|
+
| `autoResolveConflicts` | On rebase conflict — `always` resolves autonomously behind a verify-or-rollback gate, `never` aborts + escalates; resolve from the configured preference (don't assume a default) |
|
|
95
|
+
| `autoRouteBuildToMuggleDo` | Front-door guardrail — route build/implement/fix requests through this pipeline (build delegated to superpowers); fired by the UserPromptSubmit guardrail, default `ask` |
|
|
96
|
+
| `autoInstallCiWorkflow` | Stage 7 — add the `muggle-walkthrough` CI check to a GitHub repo that lacks it, shipped in the PR; `ask` folds into pre-flight, default `ask`. An unedited copy from an earlier release is refreshed unless `never` |
|
|
97
|
+
|
|
98
|
+
`autoUseWorktree`, `autoRebase`, `autoResolveConflicts`, `autoCreatePR`, `autoCleanup`, `postPRVisualWalkthrough` fire from per-stage files.
|
|
99
|
+
|
|
100
|
+
## Session model
|
|
101
|
+
|
|
102
|
+
`~/.muggle-ai/muggle-do/sessions/<slug>/`. Schemas: [`../muggle-pr-followup/state-schemas.md`](../muggle-pr-followup/state-schemas.md).
|
|
103
|
+
|
|
104
|
+
| File | Owner |
|
|
105
|
+
| :--- | :---- |
|
|
106
|
+
| `state.md` | Stage 1 or bootstrap |
|
|
107
|
+
| `iterations/<NNN>.md` | Every stage |
|
|
108
|
+
| `requirements.md` | Stage 2 (forward only) |
|
|
109
|
+
| `prs.json`, `last_seen.json`, `followup.log` | Stage 7 / watcher / `/muggle-do` |
|
|
110
|
+
| `result.md` | Stage 5.5 (seeded), terminal tick (finalized) |
|
|
111
|
+
|
|
112
|
+
## Guardrails
|
|
113
|
+
|
|
114
|
+
- Stage 1 and Stage 7.5's user decision are the only user-facing forward stages; Stage 2.5 asks nothing — the user approves a design by merging its design PR, which resumes the cycle at Stage 3 (`/muggle-do resume slug=<slug>`). Stages 2 and 3–7 don't ask mid-cycle; blocker → pre-flight bug.
|
|
115
|
+
- No code before a finalized design: Stage 3 starts only after Stage 2.5 records `Design: finalized` in `state.md`.
|
|
116
|
+
- Same stage failing 3× → escalate.
|
|
117
|
+
- Each route's entry file declares the stage files every run of that route opens, and a Stop gate holds the turn until they are read. A turn that ends before its route's last stage — a readiness halt, an escalation, a pause for a background run — records why with `echo "MUGGLE_STAGE_SKIP: <reason>"`.
|
|
118
|
+
- 3 repair iterations reach E2E with failures → put the surviving failures to the user (an open decision when unattended), ship with `[E2E FAILING]`, and hand to the watcher.
|
|
119
|
+
- Address-reviews escalation (ambiguous or design-adjustment) does not block the watcher; user resolves on GitHub.
|