[ 
https://issues.apache.org/jira/browse/CAMEL-23226?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Guillaume Nodet reassigned CAMEL-23226:
---------------------------------------

    Assignee: Guillaume Nodet

> Improve Camel JBang CLI user experience
> ---------------------------------------
>
>                 Key: CAMEL-23226
>                 URL: https://issues.apache.org/jira/browse/CAMEL-23226
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-jbang
>            Reporter: Guillaume Nodet
>            Assignee: Guillaume Nodet
>            Priority: Major
>
> This is an umbrella issue to track improvements to the Camel JBang CLI user 
> experience.
> After an in-depth investigation of the camel-jbang module, several areas for 
> improvement were identified:
> h3. 1. Fix exit codes for validation errors (High Impact)
> Many commands return 0 (success) when validation fails instead of returning a 
> non-zero exit code. This breaks scripting and CI/CD usage. Examples include 
> CamelSendAction (invalid header format returns 0), process lookup failures 
> returning 0, and RuntimeExceptions thrown instead of proper error codes.
> h3. 2. Standardize error output to printErr() (Medium Impact)
> Three different error reporting patterns are used inconsistently:
> - {{printer().printErr()}} (correct, formatted, stderr)
> - {{printer().println("ERROR: ...")}} (wrong stream, manual prefix)
> - {{throw new RuntimeException(e)}} (stack trace dumped, poor UX)
> All user-facing errors should use the {{Printer.printErr()}} abstraction.
> h3. 3. Migrate Shell to JLine 4 Shell API (High Impact)
> Camel JBang already depends on JLine 4.0.7 but the Shell command still uses 
> the old JLine 3 pattern (picocli-shell-jline3 bridge, manual REPL loop, ~90 
> lines of boilerplate). JLine 4 provides a new {{Shell.builder()}} API with 
> {{PicocliCommandRegistry}} that reduces this to ~15 lines and adds:
> - Pipeline support (pipe command output)
> - Alias management
> - Job control (background jobs with &, fg, bg, jobs)
> - Script support (source command)
> - Variable support (set, unset, export)
> - Built-in history, help, and command highlighting
> h3. 4. Additional improvements to consider
> - *NO_COLOR and CI environment detection*: Detect CI and NO_COLOR env vars to 
> auto-disable colors and interactive prompts
> - *Option grouping*: Use picocli @ArgGroup to organize the 60+ run command 
> options into logical groups
> - *Progress indicators*: Add feedback for long-running operations (export, 
> dependency resolution)
> - *Consistent output format*: Support json/output across all commands 
> producing tabular output
> - *Tab completion expansion*: Add completion candidates for component names, 
> running process names, etc.
> - *camel init list*: Make templates discoverable
> - *camel export dry-run*: Preview export without writing files
> - *Confirmation for destructive operations*: clean-dir should prompt for 
> confirmation



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to