@muggleai/works 5.25.0-staging.185 → 5.25.0-staging.187

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 (38) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-53MCWNVE.js → chunk-TDDPUID3.js} +2 -2
  3. package/dist/{chunk-C6OEDLIP.js → chunk-V5KNPQ7B.js} +846 -800
  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/.codex-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/scripts/pr-watch-arm.sh +20 -1
  12. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-cycle.md +18 -15
  13. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-escalation.md +9 -7
  14. package/dist/plugin/skills/_shared/telemetry-events/muggle-do-resolve-reminder.md +11 -9
  15. package/dist/plugin/skills/_shared/telemetry-events/pr-followup-bootstrap.md +10 -8
  16. package/dist/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +17 -15
  17. package/dist/plugin/skills/_shared/telemetry-events.md +1 -1
  18. package/dist/plugin/skills/do/next-step.md +38 -5
  19. package/dist/plugin/skills/muggle-pr-followup/blocked-tick.md +1 -1
  20. package/dist/plugin/skills/muggle-pr-followup/state-schemas.md +1 -1
  21. package/dist/release-manifest.json +3 -3
  22. package/dist/{src-V7DVV6KO.js → src-XKTB74LV.js} +1 -1
  23. package/package.json +1 -1
  24. package/plugin/.claude-plugin/plugin.json +1 -1
  25. package/plugin/.codex-mcp.json +1 -1
  26. package/plugin/.codex-plugin/plugin.json +1 -1
  27. package/plugin/.cursor-plugin/plugin.json +1 -1
  28. package/plugin/.mcp.json +1 -1
  29. package/plugin/scripts/pr-watch-arm.sh +20 -1
  30. package/plugin/skills/_shared/telemetry-events/muggle-do-cycle.md +18 -15
  31. package/plugin/skills/_shared/telemetry-events/muggle-do-escalation.md +9 -7
  32. package/plugin/skills/_shared/telemetry-events/muggle-do-resolve-reminder.md +11 -9
  33. package/plugin/skills/_shared/telemetry-events/pr-followup-bootstrap.md +10 -8
  34. package/plugin/skills/_shared/telemetry-events/pr-followup-tick.md +17 -15
  35. package/plugin/skills/_shared/telemetry-events.md +1 -1
  36. package/plugin/skills/do/next-step.md +38 -5
  37. package/plugin/skills/muggle-pr-followup/blocked-tick.md +1 -1
  38. package/plugin/skills/muggle-pr-followup/state-schemas.md +1 -1
@@ -4,14 +4,16 @@ One per successful bootstrap, after state seeding and before the first watcher d
4
4
 
5
5
  ```json
6
6
  {
7
- "skill": "muggle-pr-followup",
8
- "event": "bootstrap",
9
- "caller": "<caller-name>",
10
- "session_slug": "<slug>",
11
- "repo": "<owner>/<repo>",
12
- "pr_number": <int>,
13
- "cursor_review_id": <int>,
14
- "resume": true | false
7
+ "eventType": "muggle-pr-followup:bootstrap",
8
+ "skillName": "muggle-pr-followup",
9
+ "metadata": {
10
+ "caller": "<caller-name>",
11
+ "session_slug": "<slug>",
12
+ "repo": "<owner>/<repo>",
13
+ "pr_number": <int>,
14
+ "cursor_review_id": <int>,
15
+ "resume": true | false
16
+ }
15
17
  }
16
18
  ```
17
19
 
@@ -4,21 +4,23 @@ One per watcher iteration (idle or not).
4
4
 
5
5
  ```json
6
6
  {
7
- "skill": "muggle-pr-followup",
8
- "event": "tick",
9
- "session_slug": "<slug>",
10
- "repo": "<owner>/<repo>",
11
- "pr_number": <int>,
12
- "actionable_threads": <int>,
13
- "dispatched_review_ids": [<int>, ...],
14
- "rebase_needed": true | false,
15
- "dispatched_rebase": true | false,
16
- "checks_red": <int>,
17
- "dispatched_ci_fix": true | false,
18
- "terminal": true | false,
19
- "idle": true | false,
20
- "blocked": true | false,
21
- "tick_duration_ms": <int>
7
+ "eventType": "muggle-pr-followup:tick",
8
+ "skillName": "muggle-pr-followup",
9
+ "metadata": {
10
+ "session_slug": "<slug>",
11
+ "repo": "<owner>/<repo>",
12
+ "pr_number": <int>,
13
+ "actionable_threads": <int>,
14
+ "dispatched_review_ids": [<int>, ...],
15
+ "rebase_needed": true | false,
16
+ "dispatched_rebase": true | false,
17
+ "checks_red": <int>,
18
+ "dispatched_ci_fix": true | false,
19
+ "terminal": true | false,
20
+ "idle": true | false,
21
+ "blocked": true | false,
22
+ "tick_duration_ms": <int>
23
+ }
22
24
  }
23
25
  ```
24
26
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Canonical shapes for `muggle-local-telemetry-event-emit` events. Emission mechanics: [`telemetry-emit.md`](telemetry-emit.md).
4
4
 
5
- All events share two top-level fields: `skill` and `event`. The rest is event-specific — read only the file for the event you're emitting.
5
+ Each event is one call: `eventType` is its name from the index below, `skillName` the emitting skill, and `metadata` the event-specific payload — read only the file for the event you're emitting. The tool records them to `~/.muggle-ai/telemetry/workflow-events.jsonl`.
6
6
 
7
7
  ## Index
8
8
 
@@ -1,18 +1,51 @@
1
1
  # Next-Step Suggestion
2
2
 
3
- Closing step of a terminal `/muggle-do` turn (post-merge or post-close). Advances silently when the session still has a plan, stops and asks when it doesn't.
3
+ Closing step of a terminal `/muggle-do` turn (post-merge or post-close). Advances silently when the session still has a plan; otherwise reports where this chat's work stands, then asks what to do next.
4
4
 
5
5
  ## Input
6
6
 
7
7
  - `slug` — the session.
8
8
  - `teardownRan` — whether [`cleanup.md`](cleanup.md) already ran teardown (true on `merged` + `autoCleanup: always`; false on `closed` or a skipped gate).
9
9
 
10
+ ## This chat's work
11
+
12
+ "This chat" is the Claude Code session running the turn, `$CLAUDE_CODE_SESSION_ID`. Its work is `<slug>` plus every slot under `~/.muggle-ai/muggle-do/sessions/` whose [`owner.json`](../muggle-pr-followup/state-schemas.md#ownerjson) records that id — the owned side of reconcile's split ([`reconcile.md`](../muggle-pr-followup/reconcile.md#step-1--enumerate-and-partition-slots)), finalized slots included. Every other slot holding a `prs.json` is another chat's work. With the id unset, this chat's work is `<slug>` alone.
13
+
14
+ The sessions directory holds every chat's slots, so a selector drawn from the whole directory offers work this chat never touched. Report and follow-ups cover this chat only; other chats sit behind one explicit option.
15
+
10
16
  ## Procedure
11
17
 
12
18
  1. Read the session plan — the current session's TodoWrite list.
13
19
  2. **Pending items remain** → do not prompt. Append `next-step: plan has <N> pending — advancing` to `followup.log` and continue to the next pending item. The user set a course; honor it.
14
- 3. **No pending items** → stop and ask for directions with one `AskUserQuestion` selector:
15
- - **Clean up now** — offer only when `teardownRan` is false (a `closed` PR, or `merged` with `autoCleanup` not `always`). Runs the shared teardown [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) for this slug, under its own safety rules.
16
- - **Move on / next task** — start a fresh `/muggle-do` forward run, or pick another open session.
17
- - **Done — stop here** — exit with no further action.
20
+ 3. **No pending items** → print the [status block](#status-block), then ask with one `AskUserQuestion` [selector](#selector). The status block always comes first: a selector without it asks the user to decide blind.
18
21
  4. Append the chosen outcome to `followup.log`.
22
+
23
+ ## Status block
24
+
25
+ One line per slot of this chat's work, `<slug>` first, the rest newest first, then the `Left over` line:
26
+
27
+ ```
28
+ This chat's work:
29
+ merged acme/widget#142 — Add CSV export · cleaned up
30
+ open acme/widget#145 — Rate-limit login · CI green · 2 threads open · watcher live
31
+ blocked acme/widget#147 — Retry webhooks · awaiting you: resolve the rebase conflict
32
+ closed acme/widget#139 — Old approach · unmerged, branch kept
33
+ Left over: #145 shipped [E2E FAILING]; review 2210 on #142 escalated
34
+ ```
35
+
36
+ - **Terminal slots** (`merged`, `closed`) read `prs.json` and `result.md`; the teardown note comes from the cleanup line in `followup.log`.
37
+ - **Open slots** refresh live. Resolve the provider per [`detect-vcs.md`](../_shared/vcs/detect-vcs.md) and use its PR-metadata and unresolved-thread recipes ([`github.md`](../_shared/vcs/github.md), [`gitlab.md`](../_shared/vcs/gitlab.md)); CI per [`ci-rollup.md`](../_shared/vcs/common/ci-rollup.md). The watcher reads `live` when [`watch-heartbeat`](../muggle-pr-followup/state-schemas.md#watch-heartbeat) is fresh, `stopped` otherwise.
38
+ - **Blocked** replaces `open` when `last_seen.json` carries `blocked`; the line names the pending act per [`blocked-reminder.md`](../muggle-pr-followup/output-templates/blocked-reminder.md).
39
+ - **`Left over`** lists what this chat's slots recorded as unfinished: a waiver or Blocker in `state.md`, an `[E2E FAILING]` ship, escalated review ids in `result.md`. `nothing` when empty.
40
+
41
+ No other chat's slot appears in the block.
42
+
43
+ ## Selector
44
+
45
+ At most four options, in this order:
46
+
47
+ 1. **This chat's follow-ups** — up to two, each naming the status-block line it acts on. Candidates, highest first: unblock a `blocked` PR; **Clean up now** for `<slug>` when `teardownRan` is false, running [`../_shared/post-merge-cleanup.md`](../_shared/post-merge-cleanup.md) for this slug under its own safety rules; re-arm a `stopped` watcher on an open PR; address a `Left over` item. Anything the status block does not show is never offered — no generic suggestion, no other chat's PR. Candidates past the first two stay reachable through the free-text answer.
48
+ 2. **Other chats' work** — always present; the gear shift. Lists every unfinalized slot of another chat (no `result.md`, name not ending in `.stopped`) as `<slug> → <owner>/<repo>#<n> — <title> (<state>)`, newest first, from each slot's `prs.json` and `last_seen.json`, or `No other chat has open work.` Then one selector: up to three of those slots to adopt per [`adopt.md`](../muggle-pr-followup/adopt.md), plus **Done**. Listing adopts nothing; a slot changes hands only when the user picks it.
49
+ 3. **Done — stop here** — exit with no further action.
50
+
51
+ A new task goes through the selector's free-text answer, which starts a fresh `/muggle-do` forward run.
@@ -10,7 +10,7 @@ The external state a block is waiting on. Recompute from live state each blocked
10
10
 
11
11
  - `head_sha` — from the tick's [`contract.md`](contract.md) Step 1 refresh.
12
12
  - `latest_review_id` — `max(id)` over submitted reviews per [`../_shared/vcs/github/submitted-reviews.md`](../_shared/vcs/github/submitted-reviews.md) (`0` if none).
13
- - `ci_digest` — the CI rollup digest for `head_sha` per [`../_shared/vcs/github/pr-checks.md`](../_shared/vcs/github/pr-checks.md): the bucket plus each check's name and conclusion, sorted into one stable string.
13
+ - `ci_digest` — the CI rollup digest for `head_sha`: each check's `name:state` from [`../_shared/vcs/github/pr-checks.md`](../_shared/vcs/github/pr-checks.md), sorted by name and joined with `,`. This is the signature the watch loop computes (the last field of [`../../scripts/pr-watch-state.jq`](../../scripts/pr-watch-state.jq)), so the loop's live digest equals the fingerprint until CI actually moves; any other shape wakes the loop on every arm.
14
14
 
15
15
  Any component moving means the block may have cleared — a new push (`head_sha`, which also clears the per-SHA escalation sets), a new review (`latest_review_id`), or a CI/deploy state change (`ci_digest`, which is how an external staging deploy is caught).
16
16
 
@@ -202,7 +202,7 @@ The watch loop's comparison floor — plain `KEY=VALUE` lines, one file per slot
202
202
  - `REBASED` — the `rebase_key` (`<head_sha>..<base_tip_sha>`) whose behind/conflicting state the drain already handled; empty when the branch is current with its base or unseen. Keyed on the pair, not a monotonic id, because staleness depends on both sides — the loop fires once per newly-due pair and re-arms when the head or the base moves. Same key [`contract.md`](contract.md) Step 5 dedups rebase dispatch on; the monitor only signals a due rebase, the tick applies the `conflict_resolve_attempts` budget.
203
203
  - `BLOCKED_CIDIGEST` — the head's `ci_digest` at the moment a block was flagged (the same signature `blocked.fingerprint.ci_digest` carries); empty whenever the watch is not blocked. Non-empty arms the loop's blocked-resume probe: while set, the loop wakes on any move of the live digest away from this value, so a block resumes on a green pass, a rerun, or an external deploy check — not only on red. Written by [`blocked-tick.md`](blocked-tick.md) when a block is flagged and cleared to empty when it resumes.
204
204
 
205
- Written whole-file by the orchestrating session — the review/comment/CI/rebase floors seeded at arm time (`REV`/`COM` to the **drain's own observed max**, `CIRED`/`REBASED` to what the drain handled) and advanced after every cycle to the **handled wave's snapshot** (the max review-id and comment-id the cycle read at the start of handling, captured before replies were posted); `BLOCKED_CIDIGEST` is maintained by the blocked-tick flag/resume path rather than the arm/cycle path. **Never** derived from a fresh fetch taken after the drain or after replies land: a later fetch includes ids that arrived in the handling window and were never read, and marking them seen swallows them ([`arm-watcher.md`](arm-watcher.md)). The advance also never moves any floor past an unresolved thread the cycle left unaddressed. Read by the watch loop each iteration; the loop never writes it. A stale watermark makes the next reported event the loop's own reply.
205
+ Written whole-file by the orchestrating session — the review/comment/CI/rebase floors seeded at arm time (`REV`/`COM` to the **drain's own observed max**, `CIRED`/`REBASED` to what the drain handled) and advanced after every cycle to the **handled wave's snapshot** (the max review-id and comment-id the cycle read at the start of handling, captured before replies were posted); `BLOCKED_CIDIGEST` is set and cleared by the blocked-tick flag/resume path, and every arm re-seeds it from `last_seen.blocked.fingerprint.ci_digest` so a rollover or respawn keeps the resume probe live. **Never** derived from a fresh fetch taken after the drain or after replies land: a later fetch includes ids that arrived in the handling window and were never read, and marking them seen swallows them ([`arm-watcher.md`](arm-watcher.md)). The advance also never moves any floor past an unresolved thread the cycle left unaddressed. Read by the watch loop each iteration; the loop never writes it. A stale watermark makes the next reported event the loop's own reply.
206
206
 
207
207
  **Never `source` this file, and quote or extract values.** `THREADS` holds bare semicolons: sourced unquoted, the shell splits the line at the first `;` and silently drops every id after it — the loop then re-reports known threads as new. The watch loop must extract values verbatim (e.g. `grep '^THREADS=' | cut -d= -f2- | tr -d '"\r'`), tolerating quotes and CRLF; writers should quote the value anyway.
208
208