Skip to content

feat(akroasis): radio CLI — read, program, export, import, detect#21

Merged
forkwright merged 1 commit intomainfrom
p1-07/cli-integration
Mar 16, 2026
Merged

feat(akroasis): radio CLI — read, program, export, import, detect#21
forkwright merged 1 commit intomainfrom
p1-07/cli-integration

Conversation

@forkwright
Copy link
Owner

Summary

Wire the full syntonia stack into user-facing akroasis radio subcommands, completing the CLI integration layer for P1-07.

Changes

  • cli.rs (new) — Cli struct + Command enum + RadioArgs wrapper for nested clap subcommands
  • radio/mod.rs (new) — RadioCommand enum, ExportFormat, RadioVariant model, DetectedRadio, Hardware/Session traits, StubHardware, resolve_target() helper, dispatch()/dispatch_with()
  • radio/errors.rs (new) — 15-variant RadioError enum with user-friendly messages and actionable fix suggestions (snafu)
  • radio/detect.rs (new) — detect subcommand, prints discovered radios with variant/port/firmware/warnings
  • radio/read.rs (new) — read subcommand, downloads EEPROM image with progress bar, decodes channels, prints comfy-table
  • radio/program.rs (new) — program subcommand, loads TOML/JSON plan, validates against radio constraints, confirms with user, uploads + verifies
  • radio/export.rs (new) — export to TOML/JSON/CSV/CHIRP-CSV with proper tone/duplex mapping (20-column CHIRP format)
  • radio/import.rs (new) — import from TOML/JSON/CHIRP-CSV/binary image with format auto-detection
  • radio/progress.rs (new) — indicatif progress bar helpers for download/upload
  • main.rs — refactored to use cli::Cli + radio::dispatch(), added RadioError integration

Design decisions

  • Trait-based hardware abstraction: Hardware + Session traits allow full testing without serial hardware. StubHardware returns HardwareNotAvailable until P1-02..P1-06 protocol layers land.
  • CHIRP interop: 20-column CSV export/import matches CHIRP's format exactly, enabling round-trip with existing radio programming tools.
  • Safety-first programming: dialoguer confirmation before writing, post-upload verification by re-reading image, forbidden calibration address protection.

Test plan

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets -- -D warnings passes
  • cargo test --workspace passes (207 tests, 27 in akroasis)
  • 6 CLI parsing tests (all subcommands + missing required args)
  • 3 error message tests (no radio, permission denied, forbidden address)
  • 2 detect tests (no radios, multiple radios)
  • 2 read tests (channel table display, tone formatting)
  • 3 export tests (CHIRP 20-column, native CSV header, CTCSS tone column)
  • 8 import tests (5 format detection, CSV parsing, roundtrip, TOML import)
  • 3 program tests (plan loading, unsupported format, validation)

🤖 Generated with Claude Code

@github-actions
Copy link
Contributor

⚠️ Large PR detected — 23 files, 3218 lines changed.

Consider splitting into smaller PRs for easier review. Not a blocker, just a signal.

Wire the syntonia stack into akroasis radio subcommands with full CLI
integration: detect connected radios, read/display channels, program
from frequency plans, export to TOML/JSON/CSV/CHIRP-CSV, and import
from all supported formats.

- Add clap-derived RadioCommand enum with detect/read/program/export/import
- Trait-based hardware abstraction (Hardware + Session) for testability
- StubHardware returns errors until protocol layers (P1-02..P1-06) land
- User-friendly snafu error types with actionable fix suggestions
- comfy-table channel display, indicatif progress bars, dialoguer confirm
- CHIRP-compatible 20-column CSV export/import with tone/duplex mapping
- 27 tests covering CLI parsing, error messages, detect, read, export,
  import (format detection, CSV parsing, roundtrip), and program

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@forkwright forkwright force-pushed the p1-07/cli-integration branch from e70c49c to e0c7356 Compare March 16, 2026 14:53
@forkwright forkwright merged commit 4f853fc into main Mar 16, 2026
@forkwright forkwright deleted the p1-07/cli-integration branch March 16, 2026 14:53
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.

1 participant