Files
ruvnet--RuView/v2/crates/wifi-densepose-cli
Dragan Spiridonov 6d3fb88677 fix(cli): resolve scope from the token on read, and add whoami --refresh
Two gaps that only appear with a credential file written by an earlier build —
i.e. exactly the case a fresh-login test never exercises.

1. `whoami` printed "Scope: (not reported)" for an existing file. The previous
   commit resolved scope from the token claim at WRITE time only, so files
   written before it stayed blank forever. `effective_scope()` now falls back at
   READ time, which fixes existing files and any client that stored only what
   the token response carried. The token is authoritative either way; the stored
   field is a convenience copy.

2. `whoami` said the token "will refresh on next use" — a promise nothing kept,
   because no command called `ensure_fresh`. The refresh path was implemented
   and unit-tested but never actually run. `--refresh` exercises it, and goes
   through `Session::ensure_fresh` rather than reimplementing a second, subtly
   different refresh, so it inherits the single-flight guarantee and the
   persist-before-return ordering.

   It is a flag, not silent behaviour: refreshing rotates the stored refresh
   token — identity spends the old one — so it is a state change, not a read.

VERIFIED AGAINST PRODUCTION, end to end:
  whoami on a pre-existing file        -> Scope: sensing:read (was "not reported")
  whoami --refresh                     -> both tokens rotated
                                          refresh sha256[:12] 50cfa06b -> 2d37617a
                                          access  sha256[:12] 61eebe8d -> 14d8e8de
                                          status: expired -> valid
  refreshed token GET  /api/v1/models      -> 200
  refreshed token POST /api/v1/train/start -> 401 (still read-scoped)

That exercises the rotating-refresh path against identity's real reuse
detection — the one place a bug costs the user their session rather than a
retry — and confirms the scope gate survives a refresh.

Tests: 82 with --features login, 44 default, 501 sensing-server.

Co-Authored-By: Ruflo & AQE
2026-07-22 18:21:49 +02:00
..

wifi-densepose-cli

Crates.io Documentation License

Command-line interface for WiFi-DensePose, including the Mass Casualty Assessment Tool (MAT) for disaster response operations.

Overview

wifi-densepose-cli ships the wifi-densepose binary -- a single entry point for operating the WiFi-DensePose system from the terminal. The primary command group is mat, which drives the disaster survivor detection and triage workflow powered by the wifi-densepose-mat crate.

Built with clap for argument parsing, tabled + colored for rich terminal output, and indicatif for progress bars during scans.

Features

  • Survivor scanning -- Start continuous or one-shot scans across disaster zones with configurable sensitivity, depth, and disaster type.
  • Triage management -- List detected survivors sorted by triage priority (Immediate / Delayed / Minor / Deceased / Unknown) with filtering and output format options.
  • Alert handling -- View, acknowledge, resolve, and escalate alerts generated by the detection pipeline.
  • Zone management -- Add, remove, pause, and resume rectangular or circular scan zones.
  • Data export -- Export scan results to JSON or CSV for integration with external USAR systems.
  • Simulation mode -- Run demo scans with synthetic detections (--simulate) for testing and training without hardware.
  • Multiple output formats -- Table, JSON, and compact single-line output for scripting.

Feature flags

Flag Default Description
mat yes Enable MAT disaster detection commands

Quick Start

# Install
cargo install wifi-densepose-cli

# Run a simulated disaster scan
wifi-densepose mat scan --disaster-type earthquake --sensitivity 0.8 --simulate

# Check system status
wifi-densepose mat status

# List detected survivors (sorted by triage priority)
wifi-densepose mat survivors --sort-by triage

# View pending alerts
wifi-densepose mat alerts --pending

# Manage scan zones
wifi-densepose mat zones add --name "Building A" --bounds 0,0,100,80
wifi-densepose mat zones list --active

# Export results to JSON
wifi-densepose mat export --output results.json --format json

# Show version
wifi-densepose version

Command Reference

wifi-densepose
  mat
    scan        Start scanning for survivors
    status      Show current scan status
    zones       Manage scan zones (list, add, remove, pause, resume)
    survivors   List detected survivors with triage status
    alerts      View and manage alerts (list, ack, resolve, escalate)
    export      Export scan data to JSON or CSV
  version       Display version information
Crate Role
wifi-densepose-mat MAT disaster detection engine
wifi-densepose-core Shared types and traits
wifi-densepose-signal CSI signal processing
wifi-densepose-hardware ESP32 hardware interfaces
wifi-densepose-wasm Browser-based MAT dashboard

License

MIT OR Apache-2.0