-
Notifications
You must be signed in to change notification settings - Fork 15
Description
Problem
When a model method iterates over many resources (e.g., 60 VMs), the CLI shows no output until the entire method completes. With sequential execution at ~6s per item, this means waiting several minutes with no feedback. Even with batched concurrency (PR #29), methods that touch dozens of resources still take 30-60s with zero visibility.
Proposed Solution
Add a progress indicator that surfaces method execution progress in real-time. Two complementary approaches:
-
Stream
context.loggeroutput during execution — model methods already log per-item progress (e.g., "checking VM 15/60"), but these logs are only shown after the method completes in--jsonmode. Streaming them to stderr in real-time would give immediate feedback. -
Built-in progress API — provide a
context.progress(current, total, message?)method that models can call to report progress. The CLI would render this as a progress bar or counter (e.g.,[15/60] Checking VMs...).
Alternatives Considered
- Models could write partial results incrementally, but
writeResourceis per-item and the CLI still waits for the method to return. - Users can watch
swamp data listin another terminal, but this is awkward.
Implementation Notes
- Streaming logs to stderr would be a quick win and backward-compatible
- The progress API would need a new method on the execution context
- Both should work in
--jsonmode (stderr for progress, stdout for final JSON)