Skip to content

Port Citrus JBang from Picocli to Aesh #1574

Description

@christophd

Description

Replace Picocli with Aesh as the CLI framework for the Citrus JBang tool (tools/jbang). This follows the same migration that JBang itself completed, as described in From Picocli to Aesh: How Porting JBang's CLI Made Everything Better.

Motivation

Picocli relies on runtime reflection for command and option discovery, which adds startup overhead — especially under GraalVM native image. Aesh uses compile-time annotation processing to generate command metadata as switch statements, eliminating reflection at startup and classpath scanning.

Key benefits observed in JBang's migration:

  • ~5x faster native startup (33ms -> 6ms) and ~2x faster on JDK (228ms -> 109ms)
  • Practical tab-completion — fast enough to run per-keypress without perceptible lag
  • GraalVM-friendly — no reflection configuration needed for native images
  • Zero external dependencies — Aesh relies solely on the JDK
  • Alignment with JBang — since Citrus JBang runs on JBang, aligning on the same CLI framework reduces friction

Scope

The tools/jbang module currently uses Picocli 4.7.7 with the following command classes that need porting:

  • CitrusJBangMain — root command
  • CitrusCommand — abstract base class (Callable<Integer>)
  • Init, Inspect, Run, ListTests, Complete — top-level commands
  • Agent, AgentStart, AgentRun, AgentStop — agent subcommand group

Migration involves:

  1. Replace info.picocli:picocli dependency with Aesh
  2. Port @Command / @CommandLine.Option / @CommandLine.Parameters annotations to Aesh equivalents (@CommandDefinition, @Option, @Argument)
  3. Replace Callable<Integer> pattern with Aesh's command execution model
  4. Port tab-completion support (Complete.java currently uses picocli.AutoComplete)
  5. Update CitrusJBang.java JBang script directives (//DEPS)

The connectors/citrus-jbang-connector module does not use Picocli directly and should not require changes.

References

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions