feat: add --watch flag for real-time auto-refresh#25
Conversation
Adds a global --watch <SECONDS> flag that re-runs any command at a configurable interval with screen clearing, enabling live monitoring of prices, orderbooks, positions, and other data.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| alloy = { version = "1.6.3", default-features = false, features = ["providers", "sol-types", "contract", "reqwest", "reqwest-rustls-tls", "signer-local", "signers"] } | ||
| clap = { version = "4", features = ["derive"] } | ||
| tokio = { version = "1", features = ["rt-multi-thread", "macros"] } | ||
| tokio = { version = "1", features = ["rt-multi-thread", "macros", "signal"] } |
There was a problem hiding this comment.
Missing explicit time feature for tokio dependency
Medium Severity
The watch_loop function calls tokio::time::sleep, which requires the "time" feature flag on the tokio dependency. The Cargo.toml change only adds "signal" but not "time" to tokio's features. This compiles today solely because a transitive dependency (reqwest via alloy) happens to enable tokio/time. If that transitive chain ever changes (e.g., a dependency upgrade removes or alters the reqwest dependency), the build will break.


Summary
--watch <SECONDS>flag that re-runs any command at a configurable interval with screen clearing--watchwith JSON output mode and zero-second intervals with clear error messagestokio::signalUsage
Implementation
src/main.rsonly — zero changes to command or output modules"signal"feature to existingtokio)--outputpattern via clapglobal = trueTest plan
cargo buildcompiles without errorscargo test— all 146 tests pass (94 unit + 52 integration), including 3 new tests--watchappears in--helpoutput--watchwith-o jsonis rejected with error--watch 0is rejected with errorcargo run -- --watch 3 statusrefreshes every 3s, Ctrl+C exits cleanlyNote
Low Risk
Low risk: adds an opt-in CLI loop around existing command execution plus a
tokiofeature flag, with no changes to business logic or data/auth flows.Overview
Adds a global
--watch <seconds>flag to re-run the selected CLI command on an interval, clearing the screen and showing a timestamped header each refresh.--watchis explicitly rejected for JSON output and for a0interval, and usestokio::signal::ctrl_c()to exit cleanly. Integration tests cover help output and the validation errors, andtokiois built with thesignalfeature (updatingCargo.lockaccordingly).Written by Cursor Bugbot for commit 994a15b. This will update automatically on new commits. Configure here.