Files
initiative/specs/014-inline-hp-delta/plan.md

3.3 KiB

Implementation Plan: Inline HP Delta Input

Branch: 014-inline-hp-delta | Date: 2026-03-05 | Spec: spec.md Input: Feature specification from /specs/014-inline-hp-delta/spec.md

Summary

Replace the existing QuickHpInput component (which uses a damage/heal mode toggle) with a simpler inline HP delta input. Users type a number and press Enter to apply damage by default, or click explicit damage/heal buttons. No domain changes needed -- the existing adjustHp pure function already accepts positive and negative deltas. This is a UI-only refactor of the quick HP input component.

Technical Context

Language/Version: TypeScript 5.8 (strict mode, verbatimModuleSyntax) Primary Dependencies: React 19, Vite 6, Tailwind CSS v4, shadcn/ui-style components, Lucide React (icons) Storage: N/A (no storage changes -- existing localStorage persistence unchanged) Testing: Vitest Target Platform: Web browser (local-first, single-user) Project Type: Web application (monorepo: domain + application + web adapter) Performance Goals: Instant feedback on HP adjustment (<100ms perceived) Constraints: Local-first, single-user MVP Scale/Scope: Single encounter screen, ~1-20 combatants

Constitution Check

GATE: Must pass before Phase 0 research. Re-check after Phase 1 design.

Principle Status Notes
I. Deterministic Domain Core PASS No domain changes. Existing adjustHp is a pure function.
II. Layered Architecture PASS Change is entirely in the adapter layer (web UI). Domain and application layers unchanged.
III. Agent Boundary N/A No agent features involved.
IV. Clarification-First PASS Spec is clear; no ambiguities remain.
V. Escalation Gates PASS Feature is within spec scope -- replacing existing UI with simplified version.
VI. MVP Baseline Language PASS Assumptions use "MVP baseline does not include" language.
VII. No Gameplay Rules PASS No gameplay mechanics in this feature.

Gate result: PASS -- all principles satisfied.

Project Structure

Documentation (this feature)

specs/014-inline-hp-delta/
├── plan.md              # This file
├── research.md          # Phase 0 output
├── data-model.md        # Phase 1 output
├── quickstart.md        # Phase 1 output
└── tasks.md             # Phase 2 output (/speckit.tasks command)

Source Code (repository root)

packages/domain/src/
├── adjust-hp.ts              # Existing — no changes needed
├── types.ts                  # Existing — no changes needed
└── __tests__/adjust-hp.test.ts  # Existing — no changes needed

packages/application/src/
└── adjust-hp-use-case.ts     # Existing — no changes needed

apps/web/src/
├── components/
│   ├── quick-hp-input.tsx    # MODIFY — replace mode toggle with damage/heal buttons
│   └── combatant-row.tsx     # Existing — integration point (no changes expected)
└── hooks/
    └── use-encounter.ts      # Existing — no changes needed

Structure Decision: Existing monorepo structure (domain → application → web adapter) is used. This feature only modifies the web adapter layer, specifically the quick-hp-input.tsx component. No new files or packages needed.