feat: add --watch flag for real-time auto-refresh#25
Open
Haut wants to merge 1 commit intoPolymarket:mainfrom
Open
feat: add --watch flag for real-time auto-refresh#25Haut wants to merge 1 commit intoPolymarket:mainfrom
Haut wants to merge 1 commit intoPolymarket:mainfrom
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.
Additional Locations (1)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


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.