Skip to content

feat: propose TUI integration change#282

Closed
avoidwork wants to merge 6 commits into
mainfrom
refactor-tui-integration
Closed

feat: propose TUI integration change#282
avoidwork wants to merge 6 commits into
mainfrom
refactor-tui-integration

Conversation

@avoidwork

Copy link
Copy Markdown
Owner

Description

Propose a comprehensive OpenSpec change for the TUI integration based on the blueprint in docs/TUI.md. Creates 7 capability specs, a design document, and a 99-task implementation checklist.

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Documentation update

Testing

OpenSpec artifacts validated via openspec status — all 4/4 artifacts complete. Specs audited against docs/TUI.md blueprint with 4 gaps identified and resolved.

Coverage

  • 100% line coverage maintained

Checklist

  • npm run lint passes
  • Tests pass with 100% line coverage
  • No forbidden patterns used
  • Conventional Commit style applied

Generate full OpenSpec proposal from docs/TUI.md blueprint:
- proposal.md: motivation, capabilities, impact analysis
- design.md: technical decisions, risks, migration plan
- 6 spec files: state-management, streaming-hook, file-structure,
  panel-removal, command-registry, runtime-toggles
- tasks.md: 38 implementation tasks across 11 phases
@avoidwork avoidwork self-assigned this Jun 16, 2026
@avoidwork avoidwork force-pushed the refactor-tui-integration branch 2 times, most recently from d227459 to 2623311 Compare June 16, 2026 12:45
…nd reducer

- Create src/tui/state/types.js with TUIState interface, TUIAction union,
  Message interface, ToggleConfig type, and initialState
- Create src/tui/state/selectors.js with getStatusMessage, formatContextSize,
  and derived state selectors (getLastMessage, hasMessages, etc.)
- Create src/tui/state/reducer.js with tuiReducer handling all 21 action types:
  messages (ADD/UPDATE/CLEAR), input (SET_TEXT/SUBMIT/FOCUSED),
  history (ADD/INDEX), status (SET_STATUS/CONTEXT_SIZE/COMPACTING),
  streaming (SET_STREAMING/AUTO_CONTINUING/INCREMENT/RESET),
  scroll (SET_OFFSET/VIEWPORT_HEIGHT), config (TOGGLE/SET),
  banner/onboarding (SET_SHOW_BANNER/ONBOARDING/RESPONSE)
- Export action type constants and helper functions for tests
- Create src/tui/hooks/useStreaming.js with useStreaming() hook
- Manage AbortController lifecycle: create on start, abort on interrupt
- Transform stream events: text, reasoning, tool_start, tool_end,
  tool_error, compaction_start, compaction_end, todo_status
- Implement auto-continue circuit breaker with configurable limit
- Expose streamingState object and abort() method
- Memoized public API to avoid unnecessary re-renders
- Create src/tui/hooks/useScroll.js: manages ScrollView ref, terminal
  resize handling, scroll-to-bottom on content changes, page up/down
- Create src/tui/hooks/useInput.js: keyboard routing between scroll,
  history navigation, and input fields based on focus state
- Wire useInput to handle arrow keys, PageUp/PageDown, Tab, Escape, Enter
- Rewrite src/tui/utils/commandParser.js as CommandRegistry class
- Event-driven registration with validate/execute/help properties
- Command interface: name, description, usage, validate, execute
- CommandHelpers interface with dispatchProvider, sessionState, config, etc.
- Register all built-in commands: quit, new, clear, provider, config,
  schedule, gc, help — with grouped display
- Validation before execution for safer command processing
- Grouped /help output organized by category (Session, Provider, Config,
  Schedule, System, General)
- Create src/tui/utils/format.js with toggle logic and format specifiers
- TOGGLE_KEYS mapping: autoScroll, timestamps, commandEcho, cursorBreathe, debugOutput
- getToggleStatusString() for status bar display (e.g., [ts:1 scroll:1])
- parseToggleKey() for short/full name resolution
- Format helpers: formatNumber, formatSize
- Toggle checkers: shouldShowTimestamps, shouldEchoCommands, shouldShowDebug,
  shouldBreatheCursor, shouldAutoScroll (all with sensible defaults)
@avoidwork avoidwork closed this Jun 16, 2026
@avoidwork avoidwork deleted the refactor-tui-integration branch June 16, 2026 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant