Files
kebab/tasks/p9/p9-fb-12-tui-mode-machine.md
altair823 5428412688 docs(p9): decompose dogfooding feedback into 20 task specs + reset plan
P9-1~P9-4 머지 후 사용자가 직접 도그푸딩 하며 수집한 16 항목 UX
피드백을 20 개 single-PR 사이즈 task spec 으로 분해. 각 spec 은
frontmatter (depends_on / unblocks / source_feedback), Goal,
Allowed deps, Public surface, Behavior contract, Test plan, DoD,
Out of scope 절 포함.

추가:
- p9-fb-01 ~ 20-*.md: 분해된 task spec 20 개
- p9-dogfooding-feedback.md: master index + 우선순위 + 권장 실행 순서
  + spec PR vs impl PR 절
- INDEX.md: p9-fb-01 ~ 20 link 추가
- docs/superpowers/plans/2026-05-02-p9-fb-06-reset-command.md:
  첫 후속 작업 (kebab reset 명령) 의 6-task 구현 plan
- .gitignore: .worktrees/ 추가 (superpowers worktree skill 용)

피드백 항목 → task spec 매핑은 p9-dogfooding-feedback.md 의 표 참조.
실행 시작 task: p9-fb-06 (reset 명령) — 도그푸딩 막힘 강도 1위.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-02 17:54:15 +00:00

79 lines
2.1 KiB
Markdown

---
phase: P9
component: kebab-tui
task_id: p9-fb-12
title: "TUI mode state machine (NORMAL / INSERT)"
status: planned
depends_on: []
unblocks: [p9-fb-10, p9-fb-13]
contract_source: ../../docs/superpowers/specs/2026-04-27-kebab-final-form-design.md
contract_sections: [§10 UX]
source_feedback: p9-dogfooding-feedback.md item 10
---
# p9-fb-12 — Mode machine
## Goal
TUI 전체에 vim 식 NORMAL / INSERT 모드 도입. 입력 모호성 (e/j/k 가 typing vs command) 제거.
## Allowed dependencies
- 기존 kebab-tui deps.
## Public surface
```rust
pub enum Mode { Normal, Insert }
pub(crate) struct App {
mode: Mode,
// ... 기존
}
```
key dispatch 가 mode 따라 분기.
## Behavior contract
기본 진입 모드: NORMAL (Library 가 starting pane). Search / Ask 는 query 칠 일이 잦으므로 pane 전환 시 자동 INSERT 진입 (configurable, 우선 자동).
NORMAL 모드 키 (전역):
- `i` → INSERT
- `:` → command line (`:q` quit, `:cite`, `:new` 등)
- `j/k`, `g/G`, `Ctrl-d/u`, `PageDown/Up` → scroll
- `Tab/Shift-Tab` → pane 이동
- `?` → cheatsheet popup (p9-fb-13)
- pane 별 키 (e=explain, c=cite toggle, r=refresh, …)
INSERT 모드 키:
- 모든 `Char` → input buffer push
- `Esc` → NORMAL
- `Enter` → submit (search / ask trigger)
- `Backspace`, 화살표 키 → buffer 편집 + cursor 이동
- 기타 navigation 키 (j/k 등) 는 typing 으로만
status bar 표시: `-- INSERT --` / `-- NORMAL --` (color: INSERT=green, NORMAL=blue).
focus 표시: 활성 pane 의 테두리 색 강조.
기존 P9-3 ask 의 e/j/k input-empty heuristic 제거 — mode 로 명확히.
## Test plan
| kind | description |
|------|-------------|
| unit | NORMAL 에서 `j` → scroll, INSERT 에서 `j` → buffer 'j' |
| unit | `i` → INSERT, `Esc` → NORMAL |
| unit | Search pane 전환 시 자동 INSERT |
| integration | mode 전환 + key sequence snapshot |
## DoD
- [ ] `cargo test -p kebab-tui` 통과
- [ ] 기존 input-empty heuristic 제거 (HOTFIXES P9-3 e/j/k 갱신)
- [ ] README + cheatsheet (p9-fb-13) 갱신
## Out of scope
- VISUAL 모드 (P+)
- mode 별 cursor shape (`Block` vs `Bar`) — 터미널마다 다름, 우선 skip