feat(kebab-tui): p9-fb-12 partial — Mode enum + global i/Esc + auto switch + status label
도그푸딩 item 10 — vim 비익숙 사용자도 \"지금 키가 입력 vs 명령\" 명확히
구분 가능. 절반 ship: 사용자 가시 signal (mode label + auto flip + i/Esc
global) 만 land, 키 dispatch 의 input-empty heuristic 제거는 follow-up.
## 핵심 변경
- **`kebab_tui::Mode { Normal, Insert }`** enum + `Default = Normal`.
- `Mode::label()` → `"-- NORMAL --"` / `"-- INSERT --"` (status bar
문자열, 테스트로 핀).
- `Mode::auto_for(pane)` → Library/Inspect/Jobs = Normal,
Search/Ask = Insert. pane 전환 시 자동 적용.
- **`App.mode: Mode`** field. `App::new` 가 starting pane 의 auto
mode 로 init.
- **run loop `mode_intercept(app, key)`** — pane dispatch 전에 호출:
- Insert + `Esc` → Normal (어디서나, modifier 없음)
- Normal + `i` (Library/Inspect/Jobs 만) → Insert
- Search/Ask 의 `i` 는 fall-through (이미 Insert 라 typed char)
- 그 외 fall-through
- **pane 전환 시** `app.mode = Mode::auto_for(p)` 자동 flip — 사용자가
Tab 으로 Search 가면 자동으로 Insert.
- **status bar (header)** 에 mode label colored — Insert = Role::
Success (green), Normal = Role::Heading (cyan + bold). a11y: 색은
reinforcement, 글자가 authoritative signal.
## Deferred (HOTFIXES entry 추가)
spec p9-fb-12 의 \"기존 P9-3 ask 의 e/j/k input-empty heuristic 제거 —
mode 로 명확히\" 는 별 PR 로. 현재 dispatch 는 여전히:
- search.rs 의 `is_typing_mod` (SHIFT 만 typing 으로, CTRL/ALT 는 chord)
- ask.rs 의 input.is_empty() 가 e/j/k 를 navigation 으로 분기
테스트가 heuristic 에 의존해 있어, 회귀 surface 좁게 유지하려고 splitting.
spec status `in_progress` 유지 (not `completed`) — follow-up PR 가
heuristic 제거 + 완전 mode-authoritative 후 `completed` flip.
## 테스트
- 신규 3 unit (`Mode::auto_for` 모든 pane, label literals 핀,
default = Normal)
- 기존 98 TUI 테스트 모두 통과 (heuristic 그대로라 회귀 0)
- workspace 전체 `cargo test --workspace --no-fail-fast -j 1` exit 0
- `cargo clippy --workspace --all-targets -- -D warnings` clean
## 문서
- README `kebab tui` 행: vim-style mode + auto NORMAL/INSERT + i/Esc
안내
- HANDOFF entry (partial-ship 명시)
- HOTFIXES entry (heuristic 제거 deferral 사유)
- spec status planned → in_progress (NOT completed)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,31 @@ historical contract that was implemented; this file accumulates the
|
||||
deltas so phase 5+ readers can find the live behavior without diffing
|
||||
git history.
|
||||
|
||||
## 2026-05-03 — p9-fb-12 partial: mode machine without dispatch removal
|
||||
|
||||
**Spec amended**: `tasks/p9/p9-fb-12-tui-mode-machine.md` (status stays
|
||||
`in_progress`, NOT `completed`). Original contract: introduce vim
|
||||
NORMAL/INSERT modes globally AND remove `is_typing_mod` (search) +
|
||||
input-empty heuristic (ask) so the per-pane key dispatch becomes
|
||||
mode-authoritative.
|
||||
|
||||
**What shipped**: Mode enum + `App.mode` field + global `i`/`Esc`
|
||||
interception in run loop + auto mode flip on pane switch
|
||||
(`Mode::auto_for(pane)`) + status-bar mode label (color-graded via
|
||||
`Role::Success` for Insert, `Role::Heading` for Normal). Status bar
|
||||
literals (`-- NORMAL --` / `-- INSERT --`) pinned.
|
||||
|
||||
**Deferred to follow-up PR**: removal of the existing input-empty
|
||||
heuristics in `search::handle_key_search` and `ask::handle_key_ask`.
|
||||
These continue to gate j/k vs typing based on input buffer state.
|
||||
Tests rely on those heuristics, so the removal warrants its own
|
||||
focused PR (separate review, separate test sweep).
|
||||
|
||||
**Why partial-ship**: the user-visible signal (mode label + auto
|
||||
flip + i/Esc) is the most load-bearing part of the spec; the
|
||||
heuristic removal is cleanup that doesn't change behavior anyone
|
||||
currently observes. Splitting keeps the PR review surface small.
|
||||
|
||||
## 2026-05-03 — p9-fb-17 migration number V004 → V005
|
||||
|
||||
**Spec amended**: `tasks/p9/p9-fb-17-chat-session-storage.md` (frozen —
|
||||
|
||||
@@ -3,7 +3,7 @@ phase: P9
|
||||
component: kebab-tui
|
||||
task_id: p9-fb-12
|
||||
title: "TUI mode state machine (NORMAL / INSERT)"
|
||||
status: planned
|
||||
status: in_progress
|
||||
depends_on: []
|
||||
unblocks: [p9-fb-10, p9-fb-13]
|
||||
contract_source: ../../docs/superpowers/specs/2026-04-27-kebab-final-form-design.md
|
||||
|
||||
Reference in New Issue
Block a user