TUI UX Guidelines
Three rules decide most cases: a terraform mutation is a letter key in the actions bar and everything else goes in the hint bar (§13); the user sees every state the app enters (§5); and the app does no work the user did not ask for (§9). §16 maps every key.
1. Layout Structure
Project: ../my-infra ╔╦╗╔═╗╦ ╦╦
Chdir: modules/sa-east-1 ║ ╠╣ ║ ║║
Workspace: default ╩ ╚ ╚═╝╩
┌────────────────────────────────────────────────────────────────────────────┐
│ :context │
└────────────────────────────────────────────────────────────────────────────┘
┌──────────────── State Browser (30/412) [3/30] ─────────────────────────────┐
│ module.networking.aws_vpc.main ▲ │
│ module.networking.aws_security_group.web ┃ │
│ module.compute.aws_launch_template.app ┃ │
│ module.compute.aws_iam_role.app │ │
│ module.storage.aws_s3_bucket.logs ▼ │
│ │
│ d delete e edit t taint T untaint │
└────────────────────────────────────────────────────────────────────────────┘
Enter inspect / filter Space pin ^t tree ^r refresh q quit terraform
- Header (3 lines): left=Project/Chdir/Workspace, right=ASCII logo. Always visible.
- Command bar: bordered
:input, visible only when active. - Content: bordered box, view title + count embedded in top border.
- Hint bar: single hint line (left), binary name right-aligned faint. Shows only UI/navigation keys.
- Actions bar: inside the bordered frame, pinned to bottom. Shows terraform mutation keys as button chips.
- Scroll indicators: scroll gutter (right edge) +
[cursor/navigable]counter in title bar. - No separators — borders handle visual separation.
1b. Standalone Mode Layout
When invoked as tfui <command> (e.g., tfui plan, tfui state), the TUI runs in standalone mode with minimal chrome:
my-infra › modules/sa-east-1 › production tfui
plugin content fills the screen
...
...
d delete e edit t taint T untaint
Enter inspect / filter Space pin ^t tree ^r refresh q quit terraform
Differences from full TUI
| Aspect | Full TUI | Standalone |
|---|---|---|
| Header | 3-line (project/chdir/workspace + ASCII logo) | 1-line (project/chdir/workspace left, tfui right) |
| Border | Content border with title | No border |
| Navigation | : command mode, home screen, plugin switching |
Disabled |
q key |
Go home (or quit from home) | Quit app |
esc key |
Pop frame / deactivate | Pop frame / quit when at root |
| NavPush | Works (plan→apply, state→taint) | Works identically |
| Output | None | stdout on exit (via StdoutEmitter interface) |
Standalone rendering
- TUI renders on stderr (via
tea.WithOutput(os.Stderr)) - stdout stays clean for pipe output
- On quit: the plugin’s
Stdout()(StdoutEmitter) is written to stdout - Alt-screen on stderr: terminal restores on exit
Standalone navigation rules
:command mode: disabled (no inter-plugin navigation)C(context switch): disabledq: clears sub-frames first, then quitsDeactivateMsgwith empty navStack: quits the appNavigateMsgto non-NavPush plugins: rejected- NavPush sub-navigation works normally (plan can push apply, state can push taint)
ctrl+rworks as in the full TUI: it reloads or retries the current screen in place and never navigates to another plugin, so a screen with nothing to reload shows no^r- A screen shows only keys that work in standalone: the Done screen of
tfui taint,tfui untaintandtfui importoffers nop plan, since Plan is not there to open
2. Information Architecture
| Location | Content |
|---|---|
| Header left | Project (+ pinned count), Chdir, Workspace |
| Header right | ASCII logo (brand identity) |
| Content border title | View name + (filtered/total) count + [cursor/navigable] position |
| Actions bar (inside frame) | Terraform mutation keys as button chips (purple, §13) |
| Scroll gutter (inside frame) | Scroll position (§4) |
| Hint bar | UI/navigation keys only (from frame’s Hints()) |
| Command bar | : input with autocomplete matches |
3. Keybinding Conventions
Global keys (work everywhere)
| Key | Action |
|—–|——–|
| q | Back to home / quit |
| : | Command mode (:q quit — guarded during ops, :q! force quit) |
| / | Filter mode |
| C | Context dashboard (plugin switch) |
| Esc | Exit sub-state (filter, detail, overlay) |
| ctrl+c | Force quit; a running terraform is interrupted and tfui waits for it to stop (ctrl+c again forces) |
| ctrl+s | Screen capture to debug log (hidden) |
Every other key, and the layer it belongs to: §16.
4. Visual Patterns
Borders
- Content:
lipgloss.RoundedBorder()with primary purple foreground - Title embedded in top border line (manual construction):
View Name (filtered/total) [cursor/navigable] - Overlays: rounded border, centered via
lipgloss.Place()
Tree connectors (2-char width)
├─ (branch, has siblings after)
└─ (last child)
│ (ancestor continuation)
Scroll Indicators
| Symbol | Meaning |
|——–|———|
| ▲ | Gutter top cap (more content above) |
| ┃ | Gutter thumb (viewport position) |
| │ | Gutter track (scrollable area) |
| ▼ | Gutter bottom cap (more content below) |
Gutter rules:
- Only appears when content overflows the viewport
- Spans content rows only (not the blank separator or actions bar)
- The thumb stays within the track between the caps: at the top its first cell is just below
▲, at the bottom its last cell is just above▼ - Lines are padded to a consistent width before appending gutter characters (prevents misalignment with styled rows)
[cursor/navigable]counter always visible in the title bar (even when content fits)- Counter reflects navigable items (respects tree collapse state and filter)
Other Indicators
| Symbol | Meaning |
|——–|———|
| * (green) | Pinned |
| ▶ | Collapsed branch |
| ▼ | Expanded branch |
| █ | Cursor in input field |
Text styles
Colors are the §11 palette.
| Style | Usage |
|---|---|
| Bold + Primary | Titles, active keys |
| Faint | Secondary info (types, counts, hints) |
| Italic + Faint | Placeholder text, loading messages |
| Error | Error messages |
| Success | Pin indicators, confirmations |
| Background | Selected row highlight, header and hint bar background |
5. State Transitions & Loading
Core Principle: Honest Feedback
The user must always know what the app is doing. Every state the app enters must be visible, explicit, and traceable to a user action. No invisible work, no silent failures, no background magic.
The rule: if the app is doing something, the user sees it. If the user didn’t ask for it, the app doesn’t do it.
Loading States
When the user triggers an async operation (opens a plugin, selects a field that requires I/O, runs a command), the app transitions through:
User Action → Loading → Done (or Error)
The user sees every step.
Visual Treatment
| Operation | What the user sees |
|---|---|
| Streaming terraform command | StreamFrame — real-time log output with auto-scroll, scroll gutter |
| Non-streaming async (workspace list, etc.) | Faint italic text with elapsed time: "Loading workspaces... 4s" |
Terminal size
"Loading..." is the pre-first-frame placeholder only: it covers the gap before
the terminal reports its size. A terminal that reports an unusable size — a PTY
allocated without a winsize sends 0x0 — renders at a conventional 80x24 instead,
because the work behind the view is already done by then and honest feedback
means showing it.
StreamFrame (pkg/sdk/frames/) is the standard treatment for plan, apply, and init. It:
- Auto-scrolls to the bottom as lines arrive; pauses if the user scrolls up manually
Gjumps back to the bottom and resumes auto-scroll- Stays on screen after the command finishes (success or error)
- On success: the plugin auto-navigates to its result view (plan tree, apply done state, init deactivates); the log remains accessible via
l - On error: plugin shows its error view; the log remains accessible via
l
Non-streaming operations (e.g., workspace list fetch) continue using sdk.StyleFaintItalic with elapsed time.
Cancellation in StreamFrame
^c(first press): sends SIGINT (terraform graceful shutdown); hint changes to^c force cancel^c(second press): opensConfirmFrameoverlay — “Force cancel? Infrastructure may be left in a partial state. (y/n)”y→ sends SIGINT again (brutal shutdown)n→ dismisses overlay, returns to log
Hint Bar & Actions Bar During Streaming
- Hint bar:
^c cancelwhile running;^c force cancelafter first SIGINT;Esc backwhen done - Actions bar: not rendered (no content to act on during execution)
Never show content-dependent hints during loading — there’s nothing to navigate or act on. Showing unavailable keys is lying to the user.
State Lifecycle
Every plugin that does async work follows this lifecycle:
StatusIdle → user hasn't activated yet
StatusLoading → async operation in flight (user sees loading text)
StatusDone → data available (user sees content)
StatusError → operation failed (user sees error)
Transitions are always user-initiated:
Idle → Loading: user activates the plugin or triggers a commandLoading → Done: async response arrivesLoading → Error: async response is an errorError → Loading: user pressesctrl+rto retryDone → Loading: user pressesctrl+rto refresh
The app NEVER transitions out of Idle on its own. The app NEVER refreshes without the user asking.
Error States
- Floating modal overlay with error detail (not inline text that might be missed)
- Hints:
^r retry+Esc back(+u force-unlockif applicable) - Error message is the raw terraform output — don’t sanitize or summarize
Other Transitions
- Context required: modal overlay prompting selection
- Destructive ops: confirmation modal with summary of what will change
- Stale data: prompt before destructive operations on data older than threshold
6. Filtering
| Aspect | Flat mode | Tree mode |
|---|---|---|
| Algorithm | fzf FuzzyMatchV2 | fzf with score threshold (len*17) |
| Sorting | By score (best first) | Preserves hierarchy order |
| Input chars | Alphanumeric + _ - . + ~ / |
Same |
| Space key | Pin selected item | Pin selected item |
| Results | Flat list | Auto-expanded tree showing matches |
| Toggle | ctrl+t switches to tree |
ctrl+t switches to flat |
Filter rules
- Only accept:
a-z A-Z 0-9 _ - . + ~ / - Brackets and other special chars pass through to action handlers
- Pasted text, or several characters that arrive as one key event, is filtered to the same set and applied to the query once; its characters never trigger shortcuts, even when they spell one (
enter,left) Escexits filter modeEnterinspects (leaf) or expands (branch)- Backspace on empty: stays in filter mode (doesn’t exit)
- Filter bar renders at the top of the list (above items, below any header)
7. Tree Navigation
- Default view: flat (fzf ranked list)
ctrl+t: toggle to tree (hierarchical with expand/collapse)- Tree builds from
SplitTerraform()which splits onmodule.Xboundaries - Pinned items/groups float to top within their sibling level
Spaceon a module row pins every resource beneath it, collapsed or not — a module path is never itself a pin target. The row shows[*]when all are pinned,[-]when some are; pressingSpaceon a[-]row completes the group rather than clearing it- Filter in tree mode auto-expands all branches to reveal matches
8. Modal/Overlay Pattern
- Render: centered box with
lipgloss.RoundedBorder()vialipgloss.Place() - Full screen replacement while active (content not visible behind)
- Captures ALL input — nothing passes through to plugins
Escor completion action dismisses- Hint bar shows overlay-specific hints
- Used for: chdir picker, error display, confirmations
9. Picker Frame Pattern
A picker is an inline selection frame pushed onto a plugin’s own stack. It replaces navigating away to a separate plugin — the user stays in context, esc pops back, and selection auto-pops to the parent frame.
Core Principle: No Magic Behavior
Every action the app takes must be a direct, visible result of something the user did. The app never fetches data speculatively, never pre-loads behind the user’s back, never does work the user didn’t ask for.
Magic behavior = the app doing something without the user triggering it. Examples:
- Fetching workspace list on
Activate()before the user selects the workspace field - Pre-loading data “in case” the user might need it
- Background refreshes that silently update cached state
- Invisible network calls that consume resources and may fail silently
Explicit behavior = every side effect traces back to a user action. Examples:
- User selects “Workspace” → app fetches workspace list → shows loading → shows picker
- User presses
ctrl+r→ app refreshes data - User opens a plugin → app loads that plugin’s data (because they asked for it)
This means a picker with async items shows a loading state — that is honest UX. The user triggered the action, they see the consequence. A brief “Loading…” is better than hidden background magic that may silently fail, waste resources, or produce stale data the user never asked for.
Two Picker Flavors
| Flavor | Items source | On select | User sees |
|---|---|---|---|
| Sync | Already in memory (config, static list) | Push picker frame immediately | Instant list |
| Async | Requires I/O (terraform CLI call) | Kick fetch → loading text → push picker on response | "Loading..." → list |
Both share the same picker frame once items are available. The difference is only in when the fetch happens — always as a direct result of the user’s action, never speculatively.
For async pickers, the loading state follows §5 exactly:
- Form field value changes to faint italic loading text (e.g.,
"Loading workspaces...") - Hint bar reduces to
Esc backonly - Picker frame pushes when data arrives
- On error: field shows error,
^rretries
Behavior Contract
| Input | Action |
|---|---|
↑↓ / j/k |
Move cursor |
g / G |
Jump to start/end |
Enter |
Confirm selection → emit event → auto-pop frame |
esc |
Cancel → pop frame (no event emitted) |
q |
Same as esc |
Visual Design
▸ modules/vpc ← cursor (StyleSelected)
modules/ecs
modules/rds
▸prefix on cursor item, rendered withStyleSelected- Two-space indent on non-cursor items
- Viewport windowed via
Cursor.VisibleWindow(height) - No title inside the frame (the content border shows the parent plugin name)
Hints
[]sdk.KeyHint{
{Key: "↑↓", Description: "navigate"},
{Key: "Enter", Description: "select"},
{Key: "esc", Description: "back"},
}
Implementation
// Sync picker — items already available:
func (p *Plugin) openChdirPicker() tea.Cmd {
frame := newPickerFrame(p.members, p.current, func(selected string) tea.Cmd {
// emit event, update state
})
p.stack.Push(frame)
return nil
}
// Async picker — items require I/O:
func (p *Plugin) openWorkspacePicker() tea.Cmd {
svc := p.svc
return func() tea.Msg {
// User triggered this — fetch is a direct consequence
items, err := svc.WorkspaceList(context.Background())
return workspaceListMsg{items: items, err: err}
}
}
func (p *Plugin) Update(msg tea.Msg) (sdk.Plugin, tea.Cmd) {
switch msg := msg.(type) {
case workspaceListMsg:
if msg.err != nil { /* show error */ }
frame := newPickerFrame(msg.items, p.current, p.onSelect)
p.stack.Push(frame)
}
return p, nil
}
Anti-patterns
- Background pre-loading — fetching data the user didn’t ask for. Magic behavior: invisible side effects, wasted resources, stale data. Load when the user acts, not before.
- Navigate away to a different plugin — breaks back navigation, loses parent context
- Block in OnSelect callback — the callback returns a
tea.Cmd, never blocks the UI thread - Speculative caching — caching “in case” the user opens a picker. Only cache if the user has already seen the data and it’s still valid.
10. Home Screen
- Shows after chdir selection (or when no plugin active)
- Plugin list: Context, State Browser, Plan, Workspace, Console, Outputs, Validate, Init, then the analysis plugins that read a plan without changing it (Risk Analysis, Phantom Changes, Blast Radius). Apply is not listed;
aactivates it - Current chdir visible in header
- Direct key activation (press letter) or j/k + Enter
- Context plugin in the list (accessed via
Cor:context) — manages Project + Chdir + Workspace
11. Color Palette (Dracula)
| Name | Value | Usage |
|---|---|---|
| Primary | #bd93f9 (purple) |
Borders, keys, active elements |
| Text | #f8f8f2 (foreground) |
Main content |
| Faint | #6272a4 (comment) |
Secondary info |
| Background | #44475a (selection) |
Header and hint bar background, selected rows |
| Success | #50fa7b (green) |
Pins, confirmations |
| Error | #ff5555 (red) |
Error text |
| Warning | #f1fa8c (yellow) |
Risk indicators |
| Create | #50fa7b (green) |
Plan: resources to add |
| Update | #f1fa8c (yellow) |
Plan: resources to change |
| Delete | #ff5555 (red) |
Plan: resources to destroy |
| Replace | #ff79c6 (pink) |
Plan: resources to replace |
12. Plugin View Contract
Every plugin’s View(width, height) must:
- NOT include its own title (title goes in the content border)
- NOT add padding (the bordered box handles spacing)
- Return pure content that fills the available space
- Handle empty state gracefully (show informative placeholder)
- MAY render an actions bar at the bottom (see §13) using the SDK
ActionsBarprimitive - MAY include plugin-specific contextual hints (see §13)
Scrollable content: split by axis
A view that scrolls splits its rendering by axis: the plugin decides which rows exist and where the cursor is, and
ui.ContentPanel (pkg/sdk/ui/content_panel.go) formats them. Vertical navigation needs domain semantics that differ
per plugin; horizontal formatting is the same everywhere. A list can also let the panel pick its visible window,
because with wrap on only the panel knows how tall a row is (ADR-0015).
┌──────────────────── Border (app) ─────────────────────┐
│ ┌──── ContentPanel (horizontal) ──────────────────┐ │
│ │ Row content (truncated/wrapped/scrolled) │ G │ │
│ │ Row content │ u │ │
│ │ Row content [cursor highlighted] │ t │ │
│ │ Row content │ t │ │
│ │ Row content │ e │ │
│ │ │ r │ │
│ └─────────────────────────────────────────────────┘ │
│ Actions bar (sibling — not owned by the panel) │
└───────────────────────────────────────────────────────┘
Hint bar (footer — outside border)
Layers stack vertically, and each keeps to its own rows: a component never draws into a sibling’s or a parent’s space.
When it applies. Every component that renders scrollable content: a tree, a flat list, a detail or inspect view, a log tail. A static view, such as a status message or a 3-line summary, has no axis to split. A new vertical paradigm (virtual scroll, pagination, an auto-scrolling log) puts its logic in the plugin and passes the panel pre-windowed rows.
The panel promises:
- ANSI-safe truncation, horizontal scrolling (pan left/right) and wrapping, never breaking an escape sequence
- the pan offset is shared by every row but clamped per row to
max(0, min(offset, rowWidth - viewWidth)), so a row shorter than the offset shows its tail, or its whole text when it fits, and the cursor row is never blank - wrapping and panning cut by display cells on grapheme boundaries, so a wide character, flag, ZWJ sequence or base with its combining marks is kept whole or dropped whole
- the scroll gutter when content overflows the viewport
- cursor row highlighting with the caller’s style
- with
RenderWindow, the cursor row’s first line is drawn whenever the cursor is within the rows, untilScrollBlockmoves the window down a cursor block taller than the view, with wrap on or off - content width = total width minus the gutter budget
The panel has two input paths, both taking ui.RenderParams:
Rendertakes pre-windowed rows and draws no cursor: the visible rows, the total item count for the gutter thumb’s proportion, and the window’s offset in the full list for the gutter’s position. With wrap on it wraps within the slice and counts rows for the gutter, as a view that scrolls by rows needs. The Plan and State detail views, the inspect view and the stream view use it.RenderWindowtakes every row: the rows, the cursor andCursorEnd, one past the cursor’s block (such as a row and its detail rows), the size, and the offset it returned last frame. It picks the window, clips it and places the gutter thumb, in rows with wrap off and in wrapped lines with wrap on. The offset it returns is the window’s top row in both modes, so a wrap toggle or a resize never reads it in the wrong unit. With wrap off its output equals windowing in the plugin and callingRender. Every list uses it: Plan, State, Workspace, Risk, Blast Radius, Phantom, Validate and Output (#159).
A cursor block taller than the window scrolls inside itself. ScrollBlock(delta) moves the next RenderWindow by
delta lines, rows with wrap off and wrapped lines with wrap on, inside the cursor’s block as measured last frame. It
returns false and moves nothing when the block fits or the move would pass its first or last line, so the plugin binds
j/k to ScrollBlock(±1) and moves the cursor only when it returns false. A new cursor shows its block from the
top, and ResetScroll clears the scroll; a block that fits renders as before. ScrollBlockTo(line) sets the scroll
for the next frame even when the cursor moves: g passes 0 and G passes math.MaxInt, so G ends on the last
item’s last line. A caller that uses either method windows with RenderWindow, never Render. Validate and Output use it
(#170).
The plugin owns:
- domain-aware traversal: collapse state, pin filtering, fuzzy scoring
- viewport windowing for
Render: which items show, given the cursor and the data; withRenderWindow, keeping the returned offset and passing it back - the cursor: position, bounds, collapse-aware movement
- the height budget: the space left after its sibling elements
Rules for the panel, each keeping it composable:
- No lifecycle. It has no Init/Update/View cycle; it renders when called and handles keys only when delegated, so a caller can place its output beside any sibling.
- Rows in, lines out. It never reorders, filters or collapses rows;
RenderWindowonly picks which lines of the given rows show. - State only where every caller agrees. It holds the horizontal offset, the wrap toggle and the scroll inside an
oversized cursor block, which mean the same for every caller; the block scroll is measured in wrapped lines only the
panel knows. Other vertical state stays with the plugin because its meaning varies (tree offset, flat cursor, detail
scroll), and the offset
RenderWindowreturns is the plugin’s to store.
Anti-patterns:
- byte-level width math on styled content (
len(line)instead of visual width) - one viewport or component owning both scroll axes, which leaves plugins fighting its lifecycle for domain-specific vertical behavior
- making callers replicate horizontal state and pan or wrap toggling
- domain-specific rendering, such as tree connectors, inside the panel
- a component reaching into a sibling’s rendering space
13. Hint Placement Rules
Three layers
| Layer | Location | Content | Source |
|---|---|---|---|
| Actions bar | Inside bordered frame (bottom, pinned) | Terraform mutation keys as button chips | Plugin’s View() using SDK ActionsBar primitive |
| Hint bar | Bottom line, outside the border | UI/navigation keys only | Frame.Hints() (Stackable) or Plugin.Hints() (Hintable) |
| Inline hints | Inside plugin view | Plugin-specific contextual keys not in standard vocabulary | Hardcoded in View() near relevant content |
The split rule
A letter key is a terraform action and goes in the actions bar; every other key (ctrl+key, punctuation, Space, Enter, Esc) goes in the hint bar. q is the one letter in the hint bar.
The modifier (^) is the visual signal. Users don’t need to memorize categories — they just look at whether there’s a ^ prefix or not.
| Actions bar (terraform mutations) | Hint bar (UI/navigation) |
|---|---|
d delete |
Enter inspect |
e edit |
/ filter |
t taint |
Space pin |
T untaint |
^t tree/flat |
a apply |
^r refresh |
A auto-apply |
^w wrap |
m move |
^p pinned filter |
n import |
^u clear pins |
u force-unlock |
: command |
! batch |
q quit |
Esc cancel |
Actions bar rules
- SDK rendering primitive — plugins own placement and visibility
- Pinned to bottom of the available frame space
- Blank line separator between scrollable content and actions bar
- Styled as two-tone button chips: bold white key on purple (
#bd93f9), label on muted purple (#644e84), single space between buttons - Left-aligned (matches content indent)
- Static per frame — content does NOT change based on cursor position
- Not rendered when plugin has no terraform actions (output, validate, version, etc.)
!batch appears only when pins > 0- In inspect/detail frame: shows single-item actions for the inspected resource
Hint bar rules
- Shows only UI/navigation keys from
HintSetvocabulary - Does NOT show
↑↓ navigate(scroll indicators teach this implicitly) - MUST be state-aware: return different hints per plugin status
- Loading state: only
Esc back - Error state:
^r retry+Esc back(+ contextual unlock hint) - Done state: full UI navigation set for that plugin
- Never show keys that don’t work in the current state
Inline hint rules
- ONLY for plugin-specific keys with no
HintSetequivalent - NEVER duplicate the hint bar or actions bar
- Format: terse
key actionseparated by double-space, styled withsdk.StyleFaintItalic - Position: near the UI element they act on (proximity = comprehension)
View content (NOT hints)
- State messages: “Loading terraform state…”, “Running terraform plan…”
- Error detail: “Error: connection refused”
- Guidance: “Run plan first to analyze risk…”
- NEVER mix keybinding text with content (“Press r to retry” is wrong)
Interface implementation
- Stackable plugins: hints come from
Frame.Hints()on the active frame - Non-stackable plugins: implement
Hintableinterface withHints() []KeyHint - Both must return state-appropriate hints (check plugin status in the method)
- Actions bar rendered by plugin
View()using the SDKActionsBarcomponent
14. Performance
- Virtual scrolling: the panel draws only the visible window, but a list builds every row’s text each frame, since
with wrap on only the panel knows which rows fit. A row’s cost must not depend on the rows around it: the tree
stores each row’s connector columns when it flattens, so rendering does not search for a row’s ancestors. The cost
of building every row grows linearly with the row count, in one expanded module and in a balanced expanded tree:
BenchmarkRenderRows_OneModuleWithManyLeavesandBenchmarkRenderRows_Balancedinpkg/sdk/ui/treebuild every row at 1,000, 5,000 and 20,000 rows, and reproduce withgo test -run x -bench RenderRows ./pkg/sdk/ui/tree/ - Tree flatten: O(visible nodes), not O(all nodes)
- Filter: runs on every keystroke, with no debounce
- State load: show elapsed time indicator after 2s
- Context discovery: cache results, don’t re-discover on every overlay open
15. Plugin UX Models
Plugins fall into two archetypes based on what the user is trying to accomplish. The archetype determines the flow, the “home state,” and how results are presented.
Data plugins (browse & act)
Intent: The user wants to explore data and optionally act on items.
Home state: A list/tree of items (always present after loading).
Examples: state, plan, output, validate, risk, phantom, blast-radius
Flow:
Activate → Loading → List/Tree (home state)
├── ↑↓ navigate, / filter, Enter inspect, Space pin
├── Action key (d, t, m, n) → confirmation → execute → refresh list
└── ctrl+r → reload data
Characteristics:
- The user lingers here — this is a workspace
- Results (the list) ARE the home state
- Actions are targeted (cursor item or pinned set via
!) - After an action completes, stay on the list (updated)
Action plugins (configure & execute)
Intent: The user wants to perform a one-shot operation.
Home state: A configuration form (the thing the user tweaks before executing).
Examples: init, apply (when entered from plan)
Flow:
Activate → Form (home state)
├── Configure fields
└── Submit → Loading → Result (transient)
├── Success → auto-return to origin (one-shot is done)
└── Error → Enter acknowledges → back to form (pre-filled for retry)
Characteristics:
- The user doesn’t linger — they configure, execute, and leave
- Results are transient feedback, not a destination
- Success means the user’s intent is satisfied — don’t force them to dismiss a “done” screen
- Error means the user needs to fix something — return them to the form with context preserved
Enteron error = “I’ve seen this, let me fix it” (acknowledge semantics, consistent with confirm)
Choosing the archetype
| Question | Data plugin | Action plugin |
|---|---|---|
| Does the user return here to browse? | Yes | No |
| Is the result the content itself? | Yes | No (result is feedback) |
| Does the user act repeatedly? | Yes (on different items) | No (one-shot, then leave) |
| After success, should user stay? | Yes (more items to explore) | No (intent satisfied) |
UX anti-patterns for action plugins
- Lingering on a “success” screen (user must dismiss manually)
- “Re-run” as a concept (if they want to re-run, they’ll re-enter the plugin)
- Showing content-navigation hints (↑↓, /, Enter inspect) on a result message
- Using
ctrl+r refreshwhen there’s nothing to refresh (init has no data to reload)
16. Keybinding Reference Map
Design layers
| Layer | Keys | Scope | Shown in | Examples |
|---|---|---|---|---|
| Terraform verbs | bare letter (lowercase, or uppercase for the inverse/auto variant) | cursor resource | Actions bar | d delete, t taint, T untaint, e edit, m move, n import, u force-unlock, a apply, A auto-apply |
| Batch | ! |
pinned set | Actions bar | ! batch palette |
| Plugin switches (home) | bare lowercase | home screen only | — (home menu) | s state, p plan, a apply, w workspace, o output, v validate, ~ console, i init |
| Plugin switches (global) | bare uppercase | anywhere | — | C context, R risk, P phantom, B blast radius |
| Interface controls | ctrl+key | view modes, reload | Hint bar | ctrl+t tree, ctrl+w wrap, ctrl+r refresh, ctrl+p pinned, ctrl+u unpin all |
| Navigation & modes | non-alpha / punctuation | navigation, mode triggers | Hint bar | / filter, [ collapse, ] expand, : command, Space pin, Enter inspect |
| Leave | q / Esc |
universal | Hint bar | q home, Esc pop sub-state |
Bare lowercase (a-z)
| Key | Assignment | Category | Context |
|---|---|---|---|
a |
apply | terraform verb / plugin switch | plan view: apply; home: activate apply |
b |
— | free | |
c |
— | free | |
d |
delete | terraform verb | state, workspace |
e |
edit | terraform verb | state, plan (opens $EDITOR) |
f |
— | free | |
g |
jump to start | navigation | lists, trees |
h |
— | free | |
i |
init | terraform verb / plugin switch | home: activate init |
j |
move down | navigation (vim alias) | ↓ is primary |
k |
move up | navigation (vim alias) | ↑ is primary |
l |
log | navigation | plan, apply: reopen the run’s streamed log |
m |
move (rename) | terraform verb | state |
n |
new / import | terraform verb | state: import (navigates to import plugin); workspace: new |
o |
output | plugin switch | home |
p |
plan | plugin switch | home |
q |
back / home | navigation | global |
r |
— | free | note: ctrl+r is refresh |
s |
state | plugin switch | home |
t |
taint | terraform verb | state/plan: navigates to taint plugin |
u |
force-unlock | terraform verb | plan, state (only when locked) |
v |
validate | plugin switch | home |
w |
workspace | plugin switch | home |
x |
— | free | |
y |
confirm (yes) | confirmation | confirmation frames only |
z |
— | free |
Bare uppercase (A-Z)
| Key | Assignment | Category | Context |
|---|---|---|---|
B |
blast radius | plugin switch (global) | analysis plugin |
C |
context | plugin switch (global) | always available |
G |
jump to end | navigation | lists, trees |
P |
phantom | plugin switch (global) | analysis plugin |
R |
risk | plugin switch (global) | analysis plugin |
A |
auto-apply | terraform verb | plan: apply without confirmation |
T |
untaint | terraform verb | state/plan: navigates to untaint plugin |
Y |
confirm (yes) | confirmation | confirmation frames only |
| All others | — | free |
ctrl+key
| Key | Assignment | Category |
|---|---|---|
ctrl+c |
force quit | emergency exit |
ctrl+h |
backspace | input (emacs convention) |
ctrl+p |
pinned filter toggle | view mode |
ctrl+r |
refresh / retry | reload data |
ctrl+s |
screen capture | debug (hidden) |
ctrl+t |
tree/flat toggle | view mode |
ctrl+u |
unpin all | pin management |
ctrl+w |
line wrap toggle | view mode |
Punctuation & special
| Key | Assignment | Category |
|---|---|---|
: |
command mode | mode switch |
/ |
filter mode | mode switch |
! |
batch actions | mode switch (only when pins > 0) |
[ |
collapse all | tree action |
] |
expand all | tree action |
Space |
pin / unpin | pin toggle |
Enter |
inspect / confirm | navigation |
Esc |
exit / cancel / pop | navigation |
← → |
horizontal pan | scroll (when wrap off) |
Aliases (redundant bindings for accessibility)
| Primary | Alias | Rationale |
|---|---|---|
↓ |
j |
vim convention |
↑ |
k |
vim convention |
Enter |
y/Y |
explicit “yes” in confirmations |
Rules
Enterconfirms: it inspects/selects, and answers yes in y/n confirmations. All confirmations share one key set — confirm =y/Y/Enter, cancel =n/N/Esc— honored uniformly byConfirmFrame,InputConfirm, and the apply prompt.Spacealways means pin — never overloaded- Aliases are never shown in hints (only primary is shown)
- Free keys should not be claimed without updating this map