Skip to content

Implement rustez-cli beyond placeholder binary#21

Merged
fastrevmd-lab merged 13 commits into
mainfrom
feat/rustez-cli
Jun 20, 2026
Merged

Implement rustez-cli beyond placeholder binary#21
fastrevmd-lab merged 13 commits into
mainfrom
feat/rustez-cli

Conversation

@fastrevmd-lab

Copy link
Copy Markdown
Owner

Summary

Closes #20. Replaces the Hello, world! placeholder in rustez-cli with a full command-line interface that works as both a human CLI and a stable machine-readable interface for bridge/integration use.

  • Commands: facts, rpc <cmd> [--format text|xml], and config apply|diff|commit-check|commit|confirm|rollback, all sharing a flattened set of connection options.
  • Stable JSON envelope (--json): identical {ok, command, host, data, error} shape across every command. Success → stdout, failure → stderr.
  • Exit-code taxonomy by error kind: usage=1, connect=2, auth=3, rpc=4, load=5, commit=6, rollback=7, internal=8 — driven by a classify(RustEzError, Phase) classifier (no library changes).
  • Secure credentials: precedence -p flag (with stderr warning) > $RUSTEZ_PASSWORD > key-file > interactive TTY prompt > usage error on non-TTY.
  • Fail-closed host-key handling: --host-key-fingerprint / --known-hosts / --accept-any-host-key are mutually exclusive; none set → library default RejectAll.
  • --comment and --confirm-minutes are mutually exclusive so an audit comment can't be silently dropped on a confirmed commit.

No changes to the rustez core library — the CLI is built entirely on existing primitives.

Test Plan

  • cargo test -p rustez-cli — 26 unit tests pass (arg parsing, error classifier/exit codes, JSON+text rendering, credential precedence, host-key mapping)
  • cargo check (workspace) and cargo clippy -p rustez-cli clean
  • Manual: --help lists all commands; missing required args → exit 1; config apply with unreadable file → exit 1 with correct text and JSON kind:usage failure envelope
  • Integration (ignored, requires vSRX): RUSTEZ_VSRX_HOST=<IP> RUSTEZ_VSRX_USER=<USER> RUSTEZ_VSRX_PASS=<PASS> cargo test -p rustez-cli -- --ignored

🤖 Generated with Claude Code

fastrevmd-lab and others added 13 commits June 19, 2026 16:23
Approved brainstorming design for implementing the rustez-cli binary
beyond its placeholder: command grammar, JSON envelope, exit-code
taxonomy, credential and host-key handling, and test plan.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Task-by-task TDD plan implementing the approved CLI design: clap grammar,
JSON envelope, exit-code taxonomy/classifier, credential + host-key handling,
command handlers, and an ignored vSRX integration test.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Make --comment and --confirm-minutes mutually exclusive in clap so an
audit comment can't be silently dropped on a confirmed commit. Add a
clarifying comment on the bare confirming-commit flow.
@fastrevmd-lab fastrevmd-lab merged commit 73988d8 into main Jun 20, 2026
1 check failed
@fastrevmd-lab fastrevmd-lab deleted the feat/rustez-cli branch June 20, 2026 01:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement rustez-cli beyond placeholder binary

1 participant