Repository navigation
Conversation
Introduce Architecture Decision Records to document design choices for upcoming CLI contributions. Includes ADR template with Mermaid diagram sections and ADR-0001 establishing the process conventions.
Decompose monolithic main.rs into separate modules per ADR-0002. Replace sync ureq with async reqwest, add token caching and structured error types. Existing init/config/export commands preserved with identical behavior.
Implement CLI management for all API resources per ADR-0003: proxy, domain, gwnode, gateway, user, cert, and sync commands with list/get/create/delete operations. Adds --format flag (table/json/yaml) and --yes for non-interactive delete.
Implement real-time monitoring per ADR-0004 via `gwrs monitor`. Connects to the SSE statistics stream and renders a ratatui-based dashboard with gateway/proxy stats, traffic sparklines, and status code distribution. Supports tab/1/2 panel switching, auto-reconnect on disconnect, and 120-point history buffer.
The actix-web-lab SSE implementation uses \r\n\r\n message boundaries. Update the parser to handle both \r\n\r\n and \n\n, and skip comment lines (pings).
crossterm on Windows fires both Press and Release key events. Without filtering, tab switches twice (flickering back). Only process KeyEventKind::Press to match expected behavior.
Redesign the monitor TUI with responsive layout that adapts to terminal size. Show per-second rates (req/s, bytes/s) instead of raw totals. Add min/max/avg stats, bar chart for status codes, and collapse sparklines on small terminals. Stack panels vertically when terminal is narrow (<100 cols).
Add overview panel with aggregate totals, error/success rate badges, and interval counts. Add request sparkline alongside traffic sparklines. Add help overlay (?/Esc), uptime display, and three-tier responsive layout (tall/mid/small). All computed metrics from the API data are now displayed.
Read bytes min/max/avg directly from TargetStats reference instead of copying into the Rates struct. Removes the intermediate fields that the compiler could not track as used.
Express server mimicking router-api endpoints: login, CRUD for proxies/gwnodes/gateways/domains/users, sync, certificates, and SSE statistics stream with random data. Broadcasts every 5s with 30 pre-loaded history points for TUI testing.
Document the full CLI surface: CRUD operations for proxy, domain, gwnode, gateway, user, cert, sync, and the monitor TUI dashboard. Include authentication options, output formats, keybindings, and mock server testing instructions.
25 unit tests covering app state (ring buffer, aggregates, error rates, formatting, rates computation), auth (credential resolution, token cache serialization), and output (table formatting). 11 integration tests using wiremock: login success/failure, proxy CRUD, gateway node list, user list, sync, 401 re-authentication, and 404 error handling.
Move the hardcoded YAML config template from init.rs to templates/router-config.yaml. Embedded at compile time via include_str!, making the template easier to maintain and review independently from the code.
Break ui.rs (482 lines) into tui/widgets/ with one file per concern: header, overview, stats, sparklines, status_codes, footer, help. Remove section comments. ui.rs is now a thin layout orchestrator.
…d arg Remove section dividers, obvious comments, and redundant doc comments across all source files. Remove --gwnode-id from domain create since the API does not accept it on that endpoint.
Colocate CLI definitions, models, and handlers per resource domain. Each resource (proxy, domain, gwnode, gateway, user, cert, sync) gets its own folder with mod.rs and models.rs. Shared types move to common.rs. cli.rs shrinks to top-level Commands enum only. Adding a new resource now means creating one folder with no changes to existing files.
|
buat issue dulu ya, boleh baca Contribution guide sebelum nge PR. https://github.com/aula-id/mini-gateway-rs?tab=contributing-ov-file Missing disclosure:
@MeGaNeKoS |
|
Untuk feature CLI control panel dan live monitoringnya ku pisah aja ya? dan untuk link proposal milestonenya nggak bisa di buka mas. | Propose Milestone Work -- Want to tackle a larger piece of the roadmap? Open a Milestone Implementation proposal. Untuk AI pakai ai buat auto completion code sama documentasi biar rapi. Nanti ku pecah lagi deh jadi beberapa branch. |
|
@MeGaNeKoS itu cli nya breaking changes bgt cuy, sama reqwest gabisa dipake standalone makannya pake ureq, ini udah di riset dulu belum atau asal approve ai aja? |
|
milestone buka yang di aula lewat issue |
Aku request buat ganti, concern aku itu, karna kita ingin bikin seperti nginx, dimana itu I/O bound, dan, di nginx, dia itu menggunakan semacam async, tapi implementasi manual di C. Aku dokumentasikan semua decision ku di ADR. munkin untuk PR 1 ku ganti ke propose ADR dulu aja kali ya. Biar nanti orang lain gampang juga pahami kenapa kita milih approach tsb |
|
Opps, my initial though/reason was invalid. ku lupa CLI-nya nggak ngurusin proxy gateway. cuman ya, buat ui sih juga masih perlu async. karna butuh responsive. Nanti ku bikin lagi deh ADR yang benernya |
Summary
Completes two roadmap items for the CLI crate:
Development was guided by Architecture Decision Records (ADRs) documenting each design choice with Mermaid diagrams. See
docs/adr/for the full set:Changes
gwrs proxy list,gwrs user create,gwrs cert generate, etc.) with--format table|json|yamloutput and--yesfor non-interactive deletesgwrs monitorlaunches a ratatui TUI showing per-second rates, traffic sparklines, status code bar charts, error rate badges, and a help overlay. Responsive layout adapts to terminal size.AI Disclosure
AI tools (Claude) were used for code generation assistance. All code was reviewed, tested, and documented.
Test plan
cargo clippy -p router-cli --testspasses with zero warningscargo fmt -p router-cli --checkpasses cleancargo test -p router-clipasses all 36 testscd test-app && node mock-api.js)