Commands
watch
Continuously poll for spec changes and regenerate automatically.
The watch command runs a continuous loop that polls your OpenAPI endpoint and regenerates types whenever the spec changes.
Usage
chowbea-axios watch [flags]What It Does
- Polls your API endpoint at regular intervals
- Compares spec hash with cached version
- Regenerates types and operations when changes detected
- Preserves cache on graceful shutdown (Ctrl+C)
Flags
| Flag | Short | Description | Default |
|---|---|---|---|
--config | -c | Path to api.config.toml | Auto-detected |
--interval | -i | Polling interval in milliseconds | From config (10000) |
--debug | -d | Show verbose cycle-by-cycle logs | false |
--quiet | -q | Suppress non-error output | false |
Examples
Start Watch Mode
chowbea-axios watchCustom Polling Interval
# Poll every 5 seconds
chowbea-axios watch --interval 5000Debug Mode
# See every check cycle
chowbea-axios watch --debugOutput
Normal mode shows only changes:
╭────────────────────────────────────────
│ chowbea-axios watch
├────────────────────────────────────────
│
│ ✓ Starting watch mode - press Ctrl+C to stop (endpoint=http://localhost:3000/docs/swagger/json, intervalMs=10000)
│
│ ✓ New spec detected, regenerating... (cycleId=3, bytes=45231)
│ ✓ Generation completed (cycleId=3, operations=42, duration=1.2s)Debug mode shows every cycle:
╭────────────────────────────────────────
│ Cycle 1
├────────────────────────────────────────
│ Checking for API changes... (cycleId=1, endpoint=http://localhost:3000/docs/swagger/json)
│ No changes detected, skipping generation (cycleId=1, durationMs=150ms)Graceful Shutdown
Press Ctrl+C to stop watch mode:
│ ⚠ Shutting down watch mode... (signal=SIGINT)
│ ✓ Cache preserved for next runThe cache is preserved, so your next fetch or watch will continue from where you left off.
Network Failure Handling
If the endpoint becomes unreachable during watch:
- Retries 3 times with exponential backoff
- Falls back to cached spec if available
- Continues watching and tries again next cycle
- Reports the failure but doesn't exit
│ ⚠ Cycle failed, will retry next interval (cycleId=5, error=ECONNREFUSED)Setting Up Concurrent Watch
Run watch mode alongside your dev server with the concurrent script set up by init:
{
"scripts": {
"dev:all": "concurrently --names 'api,dev' \"npm run api:watch\" \"npm run dev\""
}
}Then:
npm run dev:allThis shows both outputs with labels:
[api] │ ✓ Starting watch mode...
[dev] Starting development server...
[dev] Server running at http://localhost:5173
[api] │ ✓ New spec detected, regenerating...Configuration
You can configure watch behavior in api.config.toml:
# Polling interval (overridden by --interval flag)
poll_interval_ms = 10000
[watch]
# Enable debug logging by default
debug = falseBest Practices
- Use reasonable intervals - 5-10 seconds is usually enough
- Enable debug only when troubleshooting
- Set up concurrent script for seamless development
- Don't run in production - use
fetchin CI/CD instead