Skip to content

CAMEL-21975: Add route-diagram command to display Camel route diagrams in terminal#22227

Draft
gnodet wants to merge 2 commits intofix-jbang-metadata-mojofrom
peppered-rock
Draft

CAMEL-21975: Add route-diagram command to display Camel route diagrams in terminal#22227
gnodet wants to merge 2 commits intofix-jbang-metadata-mojofrom
peppered-rock

Conversation

@gnodet
Copy link
Contributor

@gnodet gnodet commented Mar 24, 2026

Warning

Draft / POC — not ready for review. This is an early proof-of-concept exploring terminal-native route diagram rendering. The layout algorithm, text fallback, and terminal graphics integration still need work.

Summary

Add a lightweight camel cmd route-diagram command that renders Camel route diagrams directly in the terminal using JLine 4's graphics protocol support (Kitty/Sixel/iTerm2 inline images). This is a lighter-weight alternative to the Playwright/Hawtio approach in #21534.

Features

  • Terminal inline rendering via JLine 4's TerminalGraphicsManager (auto-detects Kitty/iTerm2/Sixel)
  • Hawtio-style layout: branching EIPs (choice, multicast, doTry, loadBalance, recipientList) lay children horizontally; sequential nodes stack vertically
  • Merge lines showing branch convergence with a center dot
  • Color-coded nodes by type: from (green), to (blue), EIP (purple), choice (orange), default (gray)
  • Customizable colors via --theme/--colors option or DIAGRAM_COLORS env var, following JLine's LS_COLORS/GREP_COLORS convention
  • Built-in presets: dark, light, transparent
  • PNG export via --output diagram.png
  • Text fallback for terminals without graphics support

Usage

camel cmd route-diagram                              # inline terminal display
camel cmd route-diagram --theme light                # light theme
camel cmd route-diagram --output diagram.png         # save to PNG
camel cmd route-diagram --colors "bg=:from=#ff5722"  # custom colors

Depends on

Preview

(see comment below for rendered diagram screenshots)

Test plan

  • Builds successfully
  • Preview images rendered with complex routes (triple nested choice, split+choice, doTry/doCatch/doFinally, multicast inside choice)
  • Manual test with running Camel integration
  • CI passes

gnodet and others added 2 commits March 24, 2026 16:06
…s in terminal

Add a lightweight `camel cmd route-diagram` command that renders Camel route
diagrams directly in the terminal using JLine 4's graphics protocol support
(Kitty/Sixel/iTerm2 inline images).

Features:
- Tree-based layout with horizontal branching for EIPs (choice, multicast, doTry, etc.)
- Merge lines showing branch convergence
- Color-coded nodes by type (from, to, EIP, choice, default)
- Customizable color themes via --theme/--colors option or DIAGRAM_COLORS env var
- Built-in presets: dark, light, transparent
- PNG file export via --output option
- Fallback to text-based diagram for terminals without graphics support

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Preview images for the route-diagram command showing dark and light themes.
These images should be removed before merging.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gnodet
Copy link
Contributor Author

gnodet commented Mar 24, 2026

Preview — Dark Theme

Dark theme

Preview — Light Theme

Light theme


Routes rendered (top to bottom):

  1. Triple nested choice — 3 levels of choice/when/otherwise
  2. Split with nested choice — split body → choice with 3 branches → continuation
  3. doTry/doCatch/doFinally — try/catch/finally with multiple endpoints per branch
  4. Choice with multicast inside — multicast nested inside a when branch
  5. doTry with split — exception handling wrapping a split
  6. Choice with throwException — simple error routing
  7. Choice with merge — classic CBR with continuation after merge

Claude Code on behalf of Guillaume Nodet

@gnodet gnodet force-pushed the fix-jbang-metadata-mojo branch from c599fd5 to c0f74cd Compare March 24, 2026 15:42
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.

1 participant