@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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "muggle",
|
|
3
3
|
"displayName": "Muggle AI",
|
|
4
4
|
"description": "Acceptance test agent for coding agents: real-browser tests, with screenshots on the PR.",
|
|
5
|
-
"version": "5.
|
|
5
|
+
"version": "5.39.0-staging.360",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "Muggle AI",
|
|
8
8
|
"email": "support@muggle-ai.com"
|
package/dist/plugin/.mcp.json
CHANGED
|
@@ -17,7 +17,7 @@ Implement the code change for this dev cycle. Read the frozen requirements from
|
|
|
17
17
|
|
|
18
18
|
For each affected repo:
|
|
19
19
|
|
|
20
|
-
0. **Check the design gate.** `state.md` must carry a `Design: finalized` line from [Stage 2.5](design.md). Without it, edit nothing: go back and run Stage 2.5. Every re-entry below inherits the line already recorded.
|
|
20
|
+
0. **Check the design gate.** `state.md` must carry a `Design: finalized` line from [Stage 2.5](design.md). Without it, edit nothing: go back and run Stage 2.5. Every re-entry below inherits the line already recorded. A design slot — `state.md` carries `Design PR for: <slug>` — is the one exception: its review cycles edit only the file its `Design doc:` line names, and nothing else.
|
|
21
21
|
1. **Re-read `requirements.md`.** Treat goal + AC as frozen. If something is unclear at this stage, that's a pre-flight bug — escalate, do not improvise.
|
|
22
22
|
1.5. **Prove a bug fix first.** When `requirements.md` says `Change type: bug fix`, write a unit test for its regression criterion before touching the fix and run it: it must fail, for the bug's reason. Apply the fix, then run it again: it must pass. This stage's marker records the criterion, the test's file path, and `failed before, passed after`. A bug no unit test can reach is waived in `state.md` with the reason. The re-entries below owe no new regression test: they carry review comments and defects the change itself introduced.
|
|
23
23
|
2. **Apply the change** in the repo's worktree. Edit existing files first; create new files only when the requirements demand it. Match the surrounding code's style, naming, and file layout.
|
|
@@ -33,6 +33,13 @@ The facts [`next-step.md`](next-step.md) reports a finished PR from. Teardown de
|
|
|
33
33
|
5. **Teardown (`merged` only).** When the PR is `merged`, run [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) with `{worktreePath}` and `{branch}`. That file owns the teardown sequence **and its safety rules** — including skipping worktree-remove and local branch deletion when no worktree was used. This stage adds no teardown logic of its own. On `closed`, skip teardown — the branch and any worktree stay intact.
|
|
34
34
|
6. **Record the PR in the [chat ledger](#chat-ledger).** Complete the terminal record with `teardown` and `finishedAt`, then write it to the ledger. The ledger is outside the slot, so this holds whether or not teardown cleared it.
|
|
35
35
|
7. **Log while the slot exists.** When teardown's report marks `Session slot cleared` ✅, write nothing: the slot and its `followup.log` are gone, an append there fails or recreates the directory as a stray slot, and the retirement and teardown reports printed this turn are the record. Otherwise append a cleanup line to the session's `followup.log`, recording the case ids retired and whether teardown ran.
|
|
36
|
-
8. Suggest the next step per [`next-step.md`](next-step.md), passing whether teardown ran and the terminal record. This is the stage's last action.
|
|
36
|
+
8. Suggest the next step per [`next-step.md`](next-step.md), passing whether teardown ran and the terminal record. This is the stage's last action — except on a merged [design slot](#design-slot), whose resume replaces it.
|
|
37
37
|
|
|
38
38
|
**Teardown never returns a question, and neither does retirement.** Each finishes with its report — every item done, skipped, or blocked-with-a-reason — so steps 6, 7 and 8 always run. A teardown that appears to be waiting on the user has stalled mid-sequence; the stage is not complete until the report and the next-step suggestion are both printed.
|
|
39
|
+
|
|
40
|
+
## Design slot
|
|
41
|
+
|
|
42
|
+
A slot whose `state.md` carries `Design PR for: <build-slug>` holds a design PR ([`design.md`](design.md#design-pr)), and its terminal state is the design decision. After step 7, replace the `Design: pending` line in `~/.muggle-ai/muggle-do/sessions/<build-slug>/state.md`:
|
|
43
|
+
|
|
44
|
+
- `merged` → `Design: finalized — design PR <url> merged <ISO-8601 timestamp>`. The merge is the approval: dispatch `/muggle-do resume slug=<build-slug>` through the Skill tool as the stage's last action, in place of step 8.
|
|
45
|
+
- `closed` → `Design: rejected — design PR <url> closed unmerged <ISO-8601 timestamp>`, then step 8.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Design Agent (Stage 2.5)
|
|
2
2
|
|
|
3
|
-
Finalize the change's design before any code. Stage 3 never edits a file until `state.md` carries a `Design: finalized` line, and
|
|
3
|
+
Finalize the change's design before any code. Stage 3 never edits a file until `state.md` carries a `Design: finalized` line. This stage writes it for the paths that need no approval; for the rest the approval is the merge of a design PR, and [`cleanup.md`](cleanup.md) writes it when that PR merges.
|
|
4
4
|
|
|
5
5
|
## Turn preamble
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
**Stage 2.5 — Design** — writing the spec and holding the build until
|
|
8
|
+
**Stage 2.5 — Design** — writing the spec and holding the build until its design PR merges.
|
|
9
9
|
```
|
|
10
10
|
|
|
11
11
|
## Inputs
|
|
@@ -15,21 +15,38 @@ Finalize the change's design before any code. Stage 3 never edits a file until `
|
|
|
15
15
|
|
|
16
16
|
## Which path
|
|
17
17
|
|
|
18
|
-
0. **Already
|
|
18
|
+
0. **Already decided.** `state.md` already carries a `Design:` line — a resumed session, or a re-entry from address-reviews, fix-ci or E2E repair.
|
|
19
|
+
- `Design: finalized` → the stage is closed: reopen nothing, write no `design.md`, ask nothing, and go on to Stage 3. The line is the record of the decision; a missing `design.md` or an approval not shown in this conversation does not make it doubtful.
|
|
20
|
+
- `Design: pending` → the design PR it names is still open. Open no second PR, ask nothing, and end the turn per [Waiting for the merge](#waiting-for-the-merge).
|
|
21
|
+
- `Design: rejected` → the design PR closed unmerged. Build nothing; report the closed PR and end the cycle.
|
|
19
22
|
1. **Spec supplied.** The task itself is a design or spec the user wrote — a linked or pasted doc that already decides the approach. It is final as given: record `Design: finalized — user-supplied spec <path or link>`, write no `design.md`, and ask nothing.
|
|
20
23
|
2. **Trivial change.** One file, or a few lines across files, with no design surface: no new module, interface, data shape, or behavior a reasonable reader could build two ways. `requirements.md` is the whole spec: record `Design: finalized — trivial, requirements.md is the spec (<one-line reason>)` and ask nothing. When unsure, it is not trivial.
|
|
21
|
-
3. **
|
|
24
|
+
3. **Approved in pre-flight.** A pre-flight answer that already approved a stated approach: record `Design: finalized — approved in pre-flight (<the answer>)` and ask nothing.
|
|
25
|
+
4. **Everything else** goes through the design PR below.
|
|
22
26
|
|
|
23
|
-
##
|
|
27
|
+
## Design PR
|
|
28
|
+
|
|
29
|
+
The design is approved by merging a PR that carries it, never by a prompt. This stage calls no `AskUserQuestion`.
|
|
24
30
|
|
|
25
31
|
1. **Write the spec** to `~/.muggle-ai/muggle-do/sessions/<slug>/design.md`, using superpowers' design step to reach it. Sections: approach, what changes where (components and files), decisions with the alternative each one rejected, what is out of scope. Every decision is made and stated — no open options handed back.
|
|
26
|
-
2. **
|
|
27
|
-
3. **
|
|
28
|
-
4. **
|
|
29
|
-
5. **
|
|
32
|
+
2. **Place it.** The doc's home is the location the project's agent instructions (`CLAUDE.md`, `AGENTS.md`) name for design docs — which may be another repo — else `docs/designs/<slug>.md` in the change's repo. Create a worktree of the home repo from `origin/<default branch>` per [`../_shared/use-worktrees.md`](../_shared/use-worktrees.md), on branch `<Branch from state.md>-design`, copy the spec to the home path, and commit it as `docs(design): <goal>`.
|
|
33
|
+
3. **Open the PR.** Push per [`../_shared/vcs/common/push-to-branch.md`](../_shared/vcs/common/push-to-branch.md), then create it with the provider recipe of [`open-prs/forward.md`](open-prs/forward.md) Stage 5.5 Step 5 — ready for review, never a draft. Title `[DESIGN] <goal>`. Body, signed per [`../_shared/vcs/post-signature.md`](../_shared/vcs/post-signature.md): `## Goal`, `## Decisions` (one line per decision), and the line `Merging this PR approves the design and starts the build. Closing it unmerged rejects the design.`
|
|
34
|
+
4. **Settle its walkthrough.** A design doc has no app surface. From the design worktree: `echo "MUGGLE_E2E_SKIP: NOT_APPLICABLE: design document only — merging it approves the design"`.
|
|
35
|
+
5. **Seed the design slot** `~/.muggle-ai/muggle-do/sessions/<slug>-design/`: `state.md` with the build slot's `## Pre-flight answers` block, `Validation` replaced by `skip — design document only`, `Branch` by the design branch, plus `Design PR for: <slug>` and `Design doc: <home path>`; then `prs.json` and `last_seen.json` as [`open-prs/forward.md`](open-prs/forward.md) Stage 5.5 Step 6 seeds them, **without** `forward_stages_in_flight` — no run is in flight, so nothing holds. Arm its watch per [`../muggle-pr-followup/arm-watcher.md`](../muggle-pr-followup/arm-watcher.md).
|
|
36
|
+
6. **Record** `Design: pending — design PR <url>` in the build slot's `state.md`, and notify the user with a push notification where the host has one: `Design PR open for <slug> — merge it to start the build`.
|
|
37
|
+
|
|
38
|
+
## While the PR is open
|
|
39
|
+
|
|
40
|
+
- **Review comments** reach the design slot's watcher like any PR's and dispatch address-reviews on it. [`build.md`](build.md) edits only the design doc there, and the docs-only diff sizes as a minor cycle ([`cycle-size.md`](cycle-size.md)).
|
|
41
|
+
- **Merged** → the watcher dispatches post-merge cleanup for `<slug>-design`. [`cleanup.md`](cleanup.md) records `Design: finalized — design PR <url> merged <ISO-8601 timestamp>` in the build slot and resumes the build at Stage 3.
|
|
42
|
+
- **Closed unmerged** → cleanup records `Design: rejected — design PR <url> closed unmerged <ISO-8601 timestamp>`; no build runs.
|
|
43
|
+
|
|
44
|
+
Merging is a decision only the user may make: `frontloadQuestions=always` never defaults it, and a run told to go unattended still stops here.
|
|
45
|
+
|
|
46
|
+
## Waiting for the merge
|
|
30
47
|
|
|
31
|
-
|
|
48
|
+
After step 6 the forward cycle ends its turn with `echo "MUGGLE_STAGE_SKIP: design PR awaiting merge"`. Stages 3–8 run on the resume the merge dispatches, from a branch cut after the design landed.
|
|
32
49
|
|
|
33
50
|
## Output
|
|
34
51
|
|
|
35
|
-
`state.md` carries
|
|
52
|
+
The build slot's `state.md` carries a `Design: finalized` or `Design: pending` line, then this stage's marker in `iterations/<NNN>.md`: `Stage 2.5 done — <path taken> — <design PR url, spec link, pre-flight answer, or trivial reason>`.
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
# Input routing
|
|
2
|
-
|
|
3
|
-
How `/muggle-do` resolves `$ARGUMENTS` to a mode. Modes 1–4 are programmatic — dispatched by the watcher — so never ask on those. A change-URL in modes 1–3 is either a GitHub PR (`github.com/.../pull/<n>`) or a GitLab MR (`<host>/.../-/merge_requests/<iid>`); provider is resolved via [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md). Inspect in order:
|
|
4
|
-
|
|
5
|
-
1. **Address-reviews** — a PR/MR URL **and** an address-reviews directive carrying review/discussion ids, conversation comment ids after the keyword `conversation`, or both → [`address-reviews.md`](address-reviews.md). On GitHub these ids are integers ≥ 100000000; that magnitude is GitHub-specific lore, **not** a portable test. Under GitLab, tell this apart from other directives by the directive keyword plus the presence of discussion ids, never by id size.
|
|
6
|
-
2. **Fix-CI** — a PR/MR URL **and** a `fix ci` / `fix-ci` directive with failing check names (no review/discussion ids) → [`fix-ci.md`](fix-ci.md).
|
|
7
|
-
3. **Rebase** — a PR/MR URL **and** a `rebase` directive (or legacy `resolve conflicts` / `resolve-conflicts`; no review/discussion ids, no check names) → [`resolve-conflicts.md`](resolve-conflicts.md). Rebases the branch onto its base whether it's merely behind or actually conflicting.
|
|
8
|
-
4. **Post-merge cleanup** — a `cleanup` token and `slug=<slug>` (no PR URL, no review ids), optionally `state=<merged|closed>` (default `merged`) → [`cleanup.md`](cleanup.md).
|
|
9
|
-
5. **
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
# Input routing
|
|
2
|
+
|
|
3
|
+
How `/muggle-do` resolves `$ARGUMENTS` to a mode. Modes 1–4.5 are programmatic — dispatched by the watcher, or by cleanup on a merged design PR — so never ask on those. A change-URL in modes 1–3 is either a GitHub PR (`github.com/.../pull/<n>`) or a GitLab MR (`<host>/.../-/merge_requests/<iid>`); provider is resolved via [`../_shared/vcs/detect-vcs.md`](../_shared/vcs/detect-vcs.md). Inspect in order:
|
|
4
|
+
|
|
5
|
+
1. **Address-reviews** — a PR/MR URL **and** an address-reviews directive carrying review/discussion ids, conversation comment ids after the keyword `conversation`, or both → [`address-reviews.md`](address-reviews.md). On GitHub these ids are integers ≥ 100000000; that magnitude is GitHub-specific lore, **not** a portable test. Under GitLab, tell this apart from other directives by the directive keyword plus the presence of discussion ids, never by id size.
|
|
6
|
+
2. **Fix-CI** — a PR/MR URL **and** a `fix ci` / `fix-ci` directive with failing check names (no review/discussion ids) → [`fix-ci.md`](fix-ci.md).
|
|
7
|
+
3. **Rebase** — a PR/MR URL **and** a `rebase` directive (or legacy `resolve conflicts` / `resolve-conflicts`; no review/discussion ids, no check names) → [`resolve-conflicts.md`](resolve-conflicts.md). Rebases the branch onto its base whether it's merely behind or actually conflicting.
|
|
8
|
+
4. **Post-merge cleanup** — a `cleanup` token and `slug=<slug>` (no PR URL, no review ids), optionally `state=<merged|closed>` (default `merged`) → [`cleanup.md`](cleanup.md).
|
|
9
|
+
4.5. **Resume** — a `resume` token and `slug=<slug>` (no PR URL), dispatched by [`cleanup.md`](cleanup.md) when a design PR merges → the forward pipeline on that slug's existing slot, at its first stage with no `done` marker in `iterations/<NNN>.md`. Stages 1 and 2 already ran; Stage 2.5 closes on its `Design: finalized` line. Before Stage 3 edits, sync the build worktree onto the latest base per [`../_shared/sync-branch-with-base.md`](../_shared/sync-branch-with-base.md), so the build carries the merged design.
|
|
10
|
+
5. **Empty / `help` / `menu` / `?`** → menu + session selector, answered from this file alone: open no stage file. The menu offers describing a task to start the forward pipeline, plus `/muggle-status`, `/muggle-repair`, `/muggle-upgrade`, and `/muggle-register`. The session selector lists each directory under `~/.muggle-ai/muggle-do/sessions/` with the PRs and states in its `prs.json`; picking one resumes that session.
|
|
11
|
+
6. **Task automation** (perform an action on a website) → `muggle:muggle-browser-task`.
|
|
12
|
+
7. **Otherwise** → forward pipeline at Stage 1.
|
|
13
|
+
|
|
14
|
+
When in doubt between #6 and #7, ask one question.
|
|
@@ -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.
|