DocsProjects & ArchitectureNYRA — Portable Rust Ops Toolkit

NYRA — Portable Rust Operations Diagnostic Toolkit

Rust · Clap CLI · Ratatui TUI · Tokio · Serde/TOML · v0.1.0

Links: GitHub Repository


Summary: NYRA is a portable, offline-first System Administrator diagnostic toolkit compiled to a single Rust binary. It combines an interactive Ratatui terminal UI, a script-friendly CLI with deterministic exit codes and JSON output, a typed TOML workflow runner, and an offline command knowledge base — requiring no external backend or AI account.

Development Transparency: Designed from real on-site infrastructure troubleshooting requirements (portable USB / jump-host usage) and built using an AI-assisted development workflow with strict Rust compiler, Clippy, and automated test gates.

1. Three Operational Modes

  1. Interactive TUI (nyra): Browse and fuzzy-search diagnostics by intent, edit validated inputs, run asynchronous checks without blocking the UI, and switch between 4 built-in themes (plus custom TOML theme import/export).
  2. Direct CLI (nyra net tcp <host> <port> --output json): Deterministic stdout JSON (schema_version: 1) and predictable exit codes for shell scripts and automation.
  3. Workflow Runner (nyra workflow run web-unreachable --target https://example.com): Chains DNS, TCP, TLS, and HTTP checks sequentially through a shared executor, or validates and runs custom TOML workflow files (nyra workflow validate / run-file).

2. Modular Monolith Architecture

All three interfaces execute through a single Tool Registry & Executor so validation, timeouts, cancellation, and redaction behave identically across TUI, CLI, and workflows:

┌───────────────┐   ┌───────────────┐   ┌────────────────────┐
│  Ratatui TUI  │   │   Clap CLI    │   │ TOML Workflow CLI  │
└───────┬───────┘   └───────┬───────┘   └─────────┬──────────┘
        └───────────────────┼─────────────────────┘
                            ▼
            Core Tool Registry & Shared Executor
         (typed input validation, bounded timeouts,
            cancellation tokens, privacy redaction)
                            │
        ┌───────────────────┼───────────────────┐
        ▼                   ▼                   ▼
 12 Built-in Tools   Offline Knowledge   Sanitized Reports
 (net/web/tls/sys/   (read-only command  (JSON / HTML / CSV
  file diagnostics)   reference cards)    redacted, ≤64 KiB)

Deterministic Exit Code Contract

Exit CodeMeaning
0Completed with a positive diagnostic finding (e.g., open TCP port, healthy HTTP 2xx)
1Completed with a negative finding (e.g., connection refused, no DNS answer, non-2xx)
2Invalid command or input validation error
3Execution or environment error (missing OS dependency, permission failure)
4Run timeout/budget expired before a finding could be reported
130Cancelled by operator

3. Portability & Security Design

  • Read-only by default: Built-in diagnostics and offline knowledge cards never mutate target hosts or auto-execute shell snippets.
  • No plaintext secrets: Portable workspace mode (portable.flag beside the binary) stores only non-sensitive config/themes and degrades cleanly on read-only USB media.
  • Sanitized reporting & logs: Opt-in --report-json / --report-html / --report-csv files redact full targets and observer identity (capped at 64 KiB, never overwriting existing files); structured stderr logs (--log-level) use an explicit allowlist so stdout JSON stays parseable.

4. Verification Status

  • Quality Gates: cargo fmt --all -- --check, cargo clippy --all-targets --locked -- -D warnings, and cargo test --all-targets --locked pass (131 unit + 37 CLI + 1 workflow example = 169 tests passing, 0 failed).
  • Cross-Platform CI: GitHub Actions verifies both ubuntu-latest and windows-latest (MSVC).