Skip to content

feat: read/write command classification + TUI mode toggle#108

Merged
rlaope merged 4 commits intomasterfrom
feat/command-read-write-classification
Apr 9, 2026
Merged

feat: read/write command classification + TUI mode toggle#108
rlaope merged 4 commits intomasterfrom
feat/command-read-write-classification

Conversation

@rlaope
Copy link
Copy Markdown
Owner

@rlaope rlaope commented Apr 9, 2026

Summary

  • Command.CommandMode enum (READ/WRITE) added to Command interface
  • 12 commands classified as WRITE: heapdump, heapanalyze, profile, flame, gcrun, vmset, vmlog, jmx, jfr, threaddump, slowlog, ci
  • TUI shows READ commands by default, press w to toggle WRITE commands
  • WRITE mode displays yellow warning banner about JVM state modification
  • Header shows ● READ / ⚠ WRITE indicator

UX Flow

  1. User enters TUI CMD phase β†’ sees only safe read-only commands
  2. Footer shows: w write cmds (heapdump,profile...) ↑↓ nav ⏎ exec
  3. Press w β†’ switches to WRITE commands with warning banner
  4. Press w again β†’ back to READ commands

Closes #107

Test plan

  • Compiles successfully
  • All 133 tests pass
  • Manual TUI test: verify read/write toggle works
  • Verify all 12 WRITE commands appear in write mode only

rlaope added 4 commits April 9, 2026 10:44
Add CommandMode enum (READ/WRITE) to Command interface.
12 commands classified as WRITE: heapdump, heapanalyze, profile,
flame, gcrun, vmset, vmlog, jmx, jfr, threaddump, slowlog, ci.
All other commands default to READ.

TUI changes:
- CMD phase shows only READ commands by default
- Press 'w' to toggle WRITE commands view
- WRITE mode shows yellow warning banner about JVM state modification
- Header shows current mode (● READ / ⚠ WRITE)
- Footer hints guide user to toggle modes

Closes #107

Signed-off-by: rlaope <piyrw9754@gmail.com>
TUI rendering:
- Scroll region lock (\033[1;Hr) prevents terminal scroll overflow
- Autowrap disabled (\033[?7l) prevents line wrapping artifacts
- \033[K at end of each row clears ghost characters
- \033[J instead of \033[2J reduces full-screen flicker
- Proper terminal state restore on exit (scroll region, autowrap)

Write command popup:
- 'w' shows info-only popup listing write commands with descriptions
- Commands NOT executable from popup, just informational guide
- "Run: argus <command> <pid>" hint at bottom

Additional TUI exclusions:
- jfranalyze, gclog, compare, heapanalyze marked supportsTui()=false
  (require file path input, not suitable for TUI)

Signed-off-by: rlaope <piyrw9754@gmail.com>
- Remove \033[J clear, use \033[H + \033[K overwrite (zero flicker)
- Raw OutputStream single-write instead of PrintWriter (faster)
- Scroll region lock \033[1;Hr prevents scroll overflow
- Remove mouse tracking \033[?1000h (caused random text input + blocked copy)
- Fix command row padding (W-1 β†’ W alignment)
- Disable autowrap \033[?7l, restore on exit
- 50ms key poll for better responsiveness
- Last row no trailing \n (prevents H+1 scroll)

Signed-off-by: rlaope <piyrw9754@gmail.com>
Signed-off-by: rlaope <piyrw9754@gmail.com>
@rlaope rlaope merged commit 51521d5 into master Apr 9, 2026
7 checks passed
@rlaope rlaope deleted the feat/command-read-write-classification branch April 9, 2026 02:34
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.

feat: read/write command classification + TUI safety guide

1 participant