CAMEL-23635: camel-jbang - Add shell panel to TUI#23605
Conversation
Embed a real JLine shell inside the TUI using JLine's virtual terminal infrastructure (LineDisciplineTerminal + ScreenTerminal): - ShellPanel: new overlay panel with embedded camel shell - Uses ScreenTerminal as VT100 emulator with readable screen buffer - LineDisciplineTerminal provides master/slave pipes - Shell runs in background thread via ShellBuilder - Screen buffer dumped and converted to TamboUI widgets each frame - Full resize handling (half/full toggle, terminal resize) - Key events forwarded as ANSI escape sequences - ActionsPopup: add "Shell" action to F2 menu (always visible) - CamelMonitor: integrate shell panel - Event routing: shell panel intercepts keys when open - Split-screen rendering: 50/50 with monitoring tabs - Full-screen mode: shell takes entire content area - Footer hints: Esc to close/shrink, F11 to toggle Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
Oh can the toggle be 25%/50%/100% or does that not work to well ? |
Replace the binary half/full toggle with three sizes: - F11 grows: 25% → 50% → 100% - Escape shrinks: 100% → 50% → 25% → close Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Updated — the toggle now cycles through three sizes:
The split uses Claude Code on behalf of Guillaume Nodet |
|
There is a merge conflict, thanks |
…-tab # Conflicts: # dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/ActionsPopup.java
|
Merge conflict resolved — rebased on latest main which added the Claude Code on behalf of Guillaume Nodet |
- Use Text.from(lines) wrapper for Paragraph.builder() - Use MonitorContext.hint() instead of TuiHelper.hint() - Replace ScreenTerminalOutputStream.DelegateOutputStream with local DelegateOutputStream (the JLine class has package-private field) - Adapt action IDs for new ACTION_RUN_INFRA from main Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
🧪 CI tested the following changed modules:
All tested modules (2 modules)
|
- Add Shell item to renderActionsMenu() (was in labels but not rendered) - Add F3 as direct shortcut to toggle shell panel - Fix attribute bit extraction (shifts were 8/12 instead of 24/28) - Wrap shell panel in Block with rounded border and size title - Account for border in virtual terminal sizing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- F3 simple toggle (open/close, no size cycling) - Enable mouse capture to prevent scroll artifacts - Set active terminal for subcommands (ask, etc.) - Separator line instead of Block border - Overflow.CLIP for proper line rendering - Shell item in F2 actions menu render list Still WIP: display rendering issues with shell output positioning. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
davsclaus
left a comment
There was a problem hiding this comment.
Nice feature — the JLine ScreenTerminal + LineDisciplineTerminal wiring is solid, and the convertAttrToStyle() bit extraction correctly matches JLine's own generateSpanTag(). A couple of minor observations below.
This review does not replace specialized AI review tools (CodeRabbit, Sourcery) or static analysis (SonarCloud).
This review was generated by an AI agent and may contain inaccuracies. Please verify all suggestions before applying.
| } | ||
| virtualTerminal = null; | ||
| } | ||
| screenTerminal = null; |
There was a problem hiding this comment.
FQCN: org.jline.shell.Shell should be imported rather than used inline (per project convention in CLAUDE.md). The OpenRewrite build plugin will auto-fix this on mvn clean install, so just make sure to rebuild before pushing.
| screenTerminal = null; | |
| try (Shell shell = Shell.builder() |
(with import org.jline.shell.Shell; added to the imports block)
| startShell(innerWidth, innerHeight); | ||
| } | ||
|
|
||
| // Handle resize |
There was a problem hiding this comment.
Minor: close() calls stopShell() which destroys the virtual terminal and shell thread. The PR test plan mentions "Reopen shell → verify previous session state", but reopening creates a fresh shell with no prior state. Consider updating the test plan description, or alternatively only setting visible = false without destroying the shell (and deferring stopShell() to TUI exit).
CAMEL-23635
Summary
Embeds a real JLine shell inside the TUI using JLine's virtual terminal infrastructure:
ShellPanel: new overlay panel accessible from F2 → Shell
LineDisciplineTerminal+ScreenTerminal(VT100 emulator) +ScreenTerminalOutputStream— the same wiring pattern as JLine's ownWebTerminalShellBuilderwithPicocliCommandRegistry— full tab completion, history, aliases, fish-style autosuggestionsSpan/Linewidgets with proper color/attribute mappingsetSize()→ SIGWINCHLayout: three sizes — 25%, 50%, or 100% of the content area
Test plan
camel top→ F2 → Shell → verify shell prompt appearscatalog component --filter=kafka→ verify output with colorsClaude Code on behalf of Guillaume Nodet