Skip to content

Decide: keep the JVM CLI or reimplement ccas as a lightweight non-JVM client #80

Description

@Sootopolis

Decision needed

Should ccas (the CLI) stay a JVM binary, or be reimplemented as a lightweight non-JVM client? Settle this before further CLI-v0 investment (it reshapes #70, #43, #67).

Context

The CLI is a thin HTTP client to a local CcasServer: parse args → POST/GET → stream logs → print. It has zero domain logic. Yet every ccas <cmd> boots a JVM (~1s + startup noise — the noise is addressed in #79, the ~1s cold start is not). Booting a JVM to make a localhost HTTP call is the same category of cost we just removed from completion (JVM-per-<TAB> → pure-shell, #49/#78).

Crucially, the server's value is not "reuse the JVM for the CLI." It is:

  • one ChessComClient = one adaptive rate limiter (two ZIOAppDefault apps at once = two limiters hammering Chess.com — the original epic Epic: CLI v0 (Phase 1) #40 driver),
  • the background scheduler,
  • the Phase-2 foundation (OAuth bearer, hosted, multi-device).

JVM reuse helps the work (jobs run in the warm server). The CLI front-end being a cold JVM is pure overhead that none of the above needs.

Options

  1. Keep the JVM CLI (status quo).

    • Pros: shares the private[ccas] wire DTOs (type-safe), reuses zio-cli parsing/help (CLI subcommand tree via decline #46), one language/build.
    • Cons: ~1s cold start on every command; heavyweight for a localhost HTTP call; completion already had to go pure-shell to escape it.
  2. Lightweight non-JVM CLI (shell / Go / Rust).

    • Pros: instant commands; no JVM; consistent with "server is the one warm worker"; completion is already pure-shell; the standalone ZIOAppDefault apps stay for IntelliJ dev so the JVM dev path isn't lost.
    • Cons: reimplement arg parsing + help; hardcode the JSON DTO shapes (small/stable, but a drift risk — mitigable via a generated schema or a contract test); possibly a new toolchain in the repo (Go/Rust) — or pure-shell with curl/jq (no new toolchain, clunkier streaming/JSON).
  3. Native-image the JVM CLI (GraalVM).

    • Pros: near-instant start, keep Scala + DTOs.
    • Cons: zio-http/netty under native-image is painful (reflection/JNI config); high effort/risk for a thin client. Likely not worth it.

Why decide now

Recommendation

Lean toward Option 2 (lightweight client) as the end-state — it matches the server-as-warm-worker model and the pure-shell-completion precedent — but validate the DTO-drift and parsing/help trade-offs first. Don't pivot mid-epic; decide the target so the remaining CLI-v0 sub-issues build toward it rather than away from it.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cliCLI binary (subcommands, completions, config, packaging)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions