feat: add back navigation, review step, and error retry to TUI

Implements three UX improvements (TODO #1–#3):

- Back navigation: Esc returns to the previous input step. The Model keeps
  a history stack of input steps (advance/goBack helpers); action/wait
  steps are excluded via isInputStep so back never re-enters a
  side-effecting step. Form values are preserved.
- Review step (StepReview): shows all collected config for confirmation
  before any file is written; Enter installs, Esc edits.
- Retry vs. fix: transient failures (image pull, container run) offer
  "r: tentar novamente" instead of quitting; validation failures route
  back to the relevant form to correct the value.

Adds nav_test.go for the history/navigation logic and updates
README/CLAUDE/docs (incl. docs/TODO.md tracking the remaining ideas).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jb
2026-06-19 12:19:49 -03:00
co-authored by Claude Opus 4.8
parent 3edfaa4ab2
commit 255b4cc299
9 changed files with 433 additions and 56 deletions
+16 -3
View File
@@ -72,9 +72,22 @@ Makefile Multi-arch build + S3 publish.
(writes `envs`) → `StepDownloadWireguard` → `StepRunWireguard`.
4. Config forms: `StepAppConfig` → `StepServerConfig` → `StepDatabaseConfig` →
`StepCertConfig`.
5. `StepGenerateFile` — writes `config.toml` (validates numeric fields first).
6. `StepRunDocker` — runs `app-dono-cliente` container.
7. `StepDone`.
5. `StepReview` — shows all collected config; Enter confirms.
6. `StepGenerateFile` — writes `config.toml` (validates numeric fields first).
7. `StepRunDocker` — runs `app-dono-cliente` container.
8. `StepDone`.
### Navigation & error handling
- **Back navigation:** `Esc` returns to the previous *input* step. The Model keeps a
`history []step` stack; `advance(next)` pushes the current input step, `goBack()`
pops. `isInputStep` ([steps.go](internal/tui/steps.go)) gates which steps participate
— action/wait steps (downloads, file gen, container runs) are excluded so back never
re-enters a side-effecting step. `Esc` is handled globally in `Update`; forms don't
consume it. Form values survive going back because the `FormStep`s live on the Model.
- **Retry vs. fix:** transient failures (image pull, container run) offer `r` to re-run
just that command (`q`/other quits). Validation failures (file generation) route back
to the relevant form to correct the value instead of quitting.
## Key constants