feat(ui): yield button + /yield slash command#165
Merged
slabgorb merged 3 commits intofeat/dual-track-momentum-phase-2from Apr 25, 2026
Merged
feat(ui): yield button + /yield slash command#165slabgorb merged 3 commits intofeat/dual-track-momentum-phase-2from
slabgorb merged 3 commits intofeat/dual-track-momentum-phase-2from
Conversation
…nds (#164) Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Add YieldButton component, wire it into the confrontation overlay, add /yield slash command that sends a YIELD wire message, and thread the onYield callback from App.tsx through GameBoard → ConfrontationWidget → ConfrontationOverlay. MessageType.YIELD added to protocol.ts to mirror the server-side type added in Task 23. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
handleSend was appending slash-command-produced messages (e.g. /yield → YIELD) to local state but never calling send(), so the server's _handle_yield never fired. Add send(msg) for-loop inside the slashResult.messages.length > 0 block; intentionally omit setCanType / setThinking — slash commands do not start a narration turn. Add wiring test (slash-command-send-wiring.test.ts) asserting the for-loop and send(msg) are present inside the slashResult.handled branch and that setCanType/setThinking are absent from that branch. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
cdef71b to
8a18d94
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 3 of the dual-track momentum implementation — UI side. Adds the player-facing yield action: a button in the active confrontation overlay and a
/yieldslash command. The server-side YIELD message dispatch lands in sidequest-server PR #56.Note on stacking: This PR is stacked on PR #164 (Phase 2). After #164 merges, the base of this PR can be retargeted to
develop.Spec: orchestrator
docs/superpowers/specs/2026-04-25-dual-track-momentum-design.md.Plan: orchestrator
docs/superpowers/plans/2026-04-25-dual-track-momentum.mdTask 26.Commits
feat(ui): yield button + /yield command(4ee781c) — addsYieldButton.tsx, registers/yieldinuseSlashCommands, threadsonYieldcallback fromApp.tsx→GameBoard→ConfrontationWidget→ConfrontationOverlay.MessageType.YIELDmirrored tosrc/types/protocol.ts.fix(ui): forward slash-command messages to server send pipeline(cdef71b) — fixes a bug found in code review:handleSendwas appending slash-command-produced messages to localmessagesstate but never callingsend(), so/yield(and any future server-bound slash command) silently dropped. Adds thefor (const msg of slashResult.messages) { send(msg); }loop and a wiring test that asserts the call path is intact.Plan deviations (acknowledged)
src/lib/socket.ts,src/screens/EncounterPanel.tsx, andsrc/lib/slash.ts— none of those files exist. Used the actual codebase locations:useGameSocket,ConfrontationOverlay,useSlashCommands.disabled={false}is hardcoded on theYieldButtoninsideConfrontationOverlay. The overlay's encounter model is legacy single-metricshape (Phase 1/2 cleanup gap, not Phase 3 scope) and doesn't expose enough state to compute the right disabled value here. The button is only rendered while the overlay is mounted (which only happens during an active encounter), so the practical impact is small — but it's a real limitation worth noting for a future overlay refactor.Test plan
npx vitest run src/__tests__/YieldButton.test.tsx— 2 component testsnpx vitest run src/hooks/__tests__/useSlashCommands.test.ts—/yieldproduces YIELD messagenpx vitest run src/__tests__/slash-command-send-wiring.test.ts— slash messages reachsend()npx vitest run— full suite, no new regressions🤖 Generated with Claude Code