a73x

specs/005-tui-issue-creation/plan.md

Ref:   Size: 1.8 KiB

# Implementation Plan: TUI Issue Creation

**Branch**: `005-tui-issue-creation` | **Date**: 2026-03-21 | **Spec**: [spec.md](spec.md)

## Summary

Add inline issue creation to the TUI dashboard. User presses `n` to enter a two-step form (title → body) rendered in the footer area. Submitting calls `issue::open()` and auto-refreshes the list. All changes in `src/tui.rs`.

## Technical Context

**Language/Version**: Rust 2021 edition
**Primary Dependencies**: ratatui 0.30, crossterm 0.29, git2 0.19
**Testing**: cargo test
**Project Type**: CLI tool with TUI dashboard

## Design Decisions

### 1. Creation Form State Machine

Add an `InputMode` enum to `App`:
- `Normal` — existing behavior
- `Search` — existing search mode (currently `search_active: bool`)
- `CreateTitle` — typing issue title
- `CreateBody` — typing issue body

This replaces the `search_active: bool` with a proper enum since we now have 4 modes. The search_query field is reused as a general input buffer, and a new `create_title` field stores the title while the user enters the body.

### 2. Input Handling

All form modes intercept keys before the normal match block (same pattern as search). Escape always cancels/exits the form. Enter submits the current field. Backspace deletes. Printable chars append.

### 3. Issue Creation

On final submit (Enter in body mode, or Escape to skip body), call `crate::issue::open(repo, &title, &body)`. On success, reload the issue list and show confirmation in status_msg. On error, show error in status_msg.

### 4. Tab Switching

If user presses `n` while on Patches tab, switch to Issues tab first (since we're creating an issue).

## Source Code

```text
src/
├── tui.rs    # PRIMARY: Add InputMode enum, form handling, issue creation
├── issue.rs  # READ ONLY: issue::open() called for creation
```