How jdx/usage works
Usage is a portable CLI-definition system: a KDL spec or Rust declaration describes a command interface, which can be parsed at runtime and used to produce help, completions, documentation, and typed clients. The graph also preserves configuration and dynamic-plugin capabilities. The README documents the CLI outputs and integrations; sampled source confirms the derive-to-parser design and dynamic catalog behavior, but does not expose all CLI dispatch wiring, so uncertain internal calls are omitted.
Main entry points: src/lib.rs Rust facade · mod.rs Spec model · src/lib.rs CLI derive · src/lib.rs CLI command runner
Components 20
CLI definition
- KDL spec
- Rust declarations
- KDL parser
lib/src/kdl/mod.rs - Spec model
lib/src/spec/mod.rs - CLI derive
derive/src/lib.rs
Parsing runtime
- Rust facade
usage-rs/src/lib.rs - Argument parser
argv/src/lib.rs - Settings resolution
config/src/lib.rs - Value validation
validation/src/lib.rs - Go parser
go/argv/parser.go
Standalone CLI
- Usage executable
cli/src/main.rs - CLI command runner
cli/src/lib.rs - Spec linting
cli/src/cli/lint.rs
Extensions
- Plugin catalog
usage-dynamic/src/lib.rs - Cobra importer
integrations/cobra/spec.go
Client outputs
- Output generation
cli/src/cli/generate/mod.rs - Shell completions
lib/src/complete/mod.rs - Typed SDKs
lib/src/sdk/mod.rs
Other components
- CLI author
- CLI operator
Connections 22
- CLI author → KDL spec: writes spec
- CLI author → Rust declarations: declares CLI
- KDL spec → KDL parser: parses
- KDL parser → Spec model: builds spec
- Rust declarations → CLI derive: derives from
- CLI derive → Argument parser: emits parse tables
- CLI derive → Spec model: emits metadata
- Rust facade → Argument parser: re-exports
- CLI operator → Usage executable: invokes
- Usage executable → CLI command runner: runs
- CLI operator → KDL spec: supplies
- CLI command runner → Spec linting: dispatches lint
- CLI command runner → Output generation: dispatches generation
- Output generation → Shell completions: produces completion scripts
- Output generation → Typed SDKs: produces clients
- CLI operator → Rust facade: uses Rust framework
- Rust facade → Settings resolution: exposes settings
- Rust facade → Value validation: exposes validation
- Rust facade → Shell completions: offers completions
- Spec model → Plugin catalog: supplies host spec
- Spec model → Cobra importer: accepts imported spec
- Spec model → Go parser: defines Go parser input