Skip to content

feat(cli): bounded owned command schema facade #215

Closed

Description

@zackees

Context

FastLED's migration branch now routes reusable filesystem, HTTP, archive, terminal, TOML, C++ analysis, JSON, and tool-output parsing through kernal-api. Its only direct Rust dependencies are clap and anyhow.

The remaining CLI declaration is in crates/fastled-cli/src/cli.rs: it has two subcommand trees, about 30 flags, value enums, optional values, repeated options, conflict/requires rules, defaults, grouped help, and hidden internal flags. The current kernal-api manifest has no command-schema capability and no clap dependency. Replacing this with a product-local parser would retain generic parsing mechanics in the app and make cross-repository reuse harder.

Proposal

Add an opt-in command-schema capability that privately adapts one exact parser backend while exposing only facade-owned schema, parsed values, diagnostics, and rendering. It must support declarative commands/subcommands; positionals; long options; string, bool, finite floating-point, and bounded unsigned values; enums; optional values with defaults; repeated values; conflicts/requires; hidden flags; and deterministic help/version output.

Do not re-export Clap types, derives, traits, or errors. Applications retain their command names, field mapping, business validation, filesystem/network effects, and compatibility tests. Default kernal-api users must not resolve the parser backend.

Acceptance criteria

  • RED: a focused kernel test demonstrates that the missing facade cannot express FastLED's command shape; then implementation turns it GREEN.
  • The public API uses facade-owned values/errors and exposes no parser-backend type, trait, macro, or derive contract.
  • Explicit source byte, argument count, option value byte, and repeated-value limits are applied before unbounded allocation; diagnostics do not echo unrestricted input.
  • Contract tests cover FastLED-equivalent nested subcommands, --option=value, separate option values, defaults, optional option values, repeated strings, enum rejection, non-finite float rejection, unsigned-range rejection, conflicts/requires, hidden flags, unknown options, and -- handling.
  • Help/version rendering is stable under documented rules; no promise of byte identity with Clap unless tests establish it.
  • The backend is feature-gated and absent from the default dependency graph; strict Clippy and supported-target checks pass.
  • FastLED adopts the facade through an application-owned mapping, removes direct clap, retains CLI behavior tests and real WASM compile validation, and consumes a verified exact published kernal-api release before removing its migration patch.

Decisions

  • Priority P2: it is the final reusable direct dependency but CLI behavior is a large compatibility surface.
  • Scope is a bounded declarative command schema, not a universal argument DSL, shell parser, process launcher, or configuration framework.
  • Keep anyhow separate: it is application error composition, while this issue owns only generic CLI mechanics.
  • Use the existing parser behavior as the initial compatibility oracle; applications should not receive the backend as their public API.
  • Related FastLED migration work is tracked by Rebase FastLED infrastructure onto kernal-api FastLED/cli#242.

Open questions

  • Whether the facade needs a builder-only API or a supported macro layer should be settled by the smallest implementation that preserves backend isolation and FastLED's testable schema.

Activity

  1. zackees commented on Sep 16, 2026

    @zackees
    CollaboratorAuthor

    Complete and adopted on both sides; closing with the evidence rather than leaving it open.

    kernal-api — gated behind command-schema, implemented in src/command.rs. with tests/command_schema_contract.rs as its contract tests. It landed with #220's application-foundations rebase.

    FastLED — adopted through the pinned release tag: crates/fastled-cli/src/cli.rs: use kernal_api::command::{Command as SchemaCommand, OptionSpec, ValueKind};

    🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions