Smart, resilient CLI for developer network tasks
NetQueue is a developer-focused command runner that understands network instability.
It queues, retries, resumes, and orchestrates shell commands intelligently β even when the Internet is unreliable, filtered, or temporarily unavailable.
Modern developer workflows break easily when the network is unstable:
- Automatically queue & retry commands when offline or errors occur
- Resume large downloads without restarting from zero
- Handle proxies & VPNs seamlessly
- Orchestrate dependent tasks & flows like a mini CI system
- Get smart explanations & auto-fix suggestions for failures
NetQueue solves this.
- β Offline-aware persistent command queue
- π Automatic retry with exponential backoff
- π Multi-layer connectivity detection (DNS / TCP / HTTP)
- π§ Smart executors (Git-aware, shell-aware)
- π₯ Resumable downloads (pause / resume)
- π§© Dependency graph (DAG) & YAML flows
- πͺ Lifecycle hooks (pre / post / retry / success)
- π§Ύ Structured logs (JSON & text)
- π¦ Export / Import queued tasks
- π Proxy & VPN support (manual + auto-switch)
- π§ͺ Dry-run & Explain mode
- Go 1.21+
git clone https://github.com/mousav1/netqueue
cd netqueue
go build -o netqueue ./cmd/netqueue
./netqueue --helpOn Windows, the binary will be netqueue.exe.
netqueue run "curl https://example.com"Behavior:
- β Online β runs immediately
- β Offline β queued automatically when Internet is not usable
β οΈ Network error β queued & retried according to profile retry policy
You can also force smart detection and profiles:
netqueue run --smart "git push origin main"
netqueue run --profile git "git push origin main"NetQueue automatically detects Git commands and applies a specialized execution policy.
netqueue run --smart "git push -u origin main"
# or
netqueue smart "git push -u origin main"Smart behavior:
- Detects common Git network failures (exit 128, SSL, timeout, DNS)
- Queues on failure instead of losing progress
- Retries automatically when connectivity is restored (via daemon)
Preview what NetQueue would do β without side effects.
netqueue run --dry-run "git push origin main"
netqueue explain "git push origin main"
netqueue run --dry-run --explain "git push origin main"Explain output includes:
- Selected profile and whether it was auto-detected (smart) or explicit
- Connectivity requirements and level (DNS/TCP/HTTP)
- Retry and backoff policy
- Error classification rules
- Hooks that would trigger
- Final decision:
run_now | queue | blocked
Download large files safely across disconnects.
netqueue download https://example.com/file.zip \
--output ~/Downloads/file.zipHow it works
- Saves byte offset + metadata in SQLite
- Pauses automatically on disconnect
- Resumes from last byte on reconnect
netqueue queue list
netqueue queue list --long
netqueue queue remove <id>
netqueue queue show <id> --format json
netqueue queue run <id> [<id>...]netqueue queue add "git push origin main"
netqueue queue add "npm publish" --delay 60
netqueue queue add "npm publish" --after pushFlags:
--atRFC3339 timestamp to schedule exact time--delayseconds from now--idcustom task id--afterdependency task ids (all must succeed)
netqueue queue add-download https://example.com/file.zip \
--output ~/file.zip
netqueue queue add-download https://example.com/file.zip --output ~/Downloads/file.zip --at 2026-01-02T12:00:00Z
netqueue queue add-download https://example.com/file.zip --output ~/Downloads/file.zip --id dl1 --after pushFlags:
--outputrequired output file path--atRFC3339 schedule time--delayseconds from now--idcustom task id--afterdependency task ids
Safely manage queued task history and recover from failures.
netqueue queue clean --status succeeded
netqueue queue clean --status failed --older-than 7d
netqueue queue clean --all --confirmSafety:
- running tasks are never deleted unless --force is passed
- --all requires --confirm
- Defaults refuse dangerous actions without filters
netqueue queue reset --status failed
netqueue queue reset --id <task_id>Effect:
- status β pending
- attempt β 0
- next_run β now
- last_error β NULL
netqueue queue retry-reset --status failedEffect:
- attempt β 0
- status unchanged
netqueue queue cancel --status pending
netqueue queue cancel --flow releaseEffect:
- status β failed
- reason β cancelled_by_user
- exit_code β 130 (emitted in logs)
Export matched tasks (with dependencies) to a JSON file, then remove them safely.
netqueue queue archive --status succeeded --older-than 7d --output ~/Downloads/netqueue-archive.json
netqueue queue archive --status succeeded --older-than 7d --dry-runNotes:
- Writes one JSON object per line (task fields + dependency ids)
- Refuses archiving running tasks unless
--force --outputoptional; defaults to~/.netqueue/archive-YYYYMMDDTHHMMSS.json- Archive + deletion happens in a single SQL transaction
All commands support:
--status <pending|running|succeeded|failed|queued|blocked>
--id <task_id>
--flow <flow_id>
--older-than <duration> # e.g. 24h, 7d
--dry-run
--explain
--force
--confirm
--output <file> # only for 'archive'
--older-than accepts Go-style durations (e.g., 24h) and day suffix (e.g., 7d).
No database changes. Prints affected count and filters:
Dry-run:
matched_tasks=4
action=delete
filters=status=succeeded
Explains decision logic in SQL-like terms:
Action: reset
Reason:
status=failed
next_run=now
attempt=0
- Refuses to delete running tasks unless --force
- Refuses --all without --confirm
- Returns clear errors on invalid state combinations
- Idempotent operations for safe repeated usage
netqueue statusExample output:
Connectivity: usable
Queue: pending=<n> running=<n> succeeded=<n> failed=<n>
Recovered running tasks: <n> # printed on first run after recovery
Daemon: running|stopped
Run tasks automatically when conditions are met.
netqueue daemon start
netqueue daemon stopDaemon responsibilities
- Executes tasks when Internet is usable
- Respects dependencies (DAG)
- Applies retry & backoff
- Graceful shutdown on signals
- Auto-resumes interrupted running tasks (see below)
NetQueue automatically recovers tasks stuck in running after crashes, restarts, or power loss.
- On daemon startup (and when you run
netqueue status), any stale running task is reset topendingwithattemptincremented andnext_run=now - A task is stale if
last_heartbeatis older thanmax(2*heartbeat_interval, 15s); heartbeat is updated every 5s while a task executes - Safety:
- Tasks with a fresh heartbeat are not recovered
- Recovery is idempotent and transactional
- Running tasks record
worker_id; recovered tasks clear bothworker_idandlast_heartbeat
- Visibility:
netqueue statusprintsRecovered running tasks: Non the first run after recoverynetqueue logsshows structured events of typetask_recovered
Profiles define execution policy, not the command itself.
- Network requirements
- Retry strategy
- Error classification
- Hooks
- Timeouts
π Location:
By default, NetQueue looks for user profiles in:
~/.netqueue/profiles/*.yml
These are merged with builtin profiles embedded in the binary.
name: git
match:
command_prefix: [git, sudo git]
network:
required: true
min_level: http
retry:
strategy: exponential
max_attempts: 5
errors:
retry_on:
- regex:connection timed out
- regex:could not resolve host
fail_fast_on:
- authentication failedHooks are shell commands triggered on task lifecycle events.
pre_runpost_runon_successon_failon_retryon_queue
hooks:
pre_run:
- echo "Starting $NETQUEUE_COMMAND"
on_success:
- notify-send "Task succeeded"Hooks run:
- In isolated processes
- With timeouts
- Without affecting task success
Define complex workflows using YAML.
flow: release
tasks:
- id: git_push
run: git push origin main
profile: git
- id: npm_publish
run: npm publish
after: [git_push]Add flow:
netqueue flow add release.ymlNetQueue produces machine-readable logs.
netqueue logs
netqueue logs --format json
netqueue logs --task <id>
netqueue logs --flow <flow_id>
netqueue logs --status succeeded
netqueue logs --followJSON fields:
- timestamp
- task_id
- flow_id
- profile
- command
- status
- attempt
- exit_code
- reason
- action
- type
- affected
- filters
Backup, migrate, or share your queue.
netqueue export --format json --output tasks.json
netqueue import tasks.json --mergeSupports:
- JSON / YAML
- Merge / Overwrite
- Dry-run validation
netqueue run --proxy myproxy "curl ifconfig.me"
netqueue run --vpn workvpn "ssh internal-server"If multiple proxies are configured, NetQueue can rotate them automatically on failure.
Configuration priority:
Environment Variables
> .env
> config.yaml
> Defaults
netqueue config init
netqueue env initSupports:
- Portable installs
- Dev / Prod separation
- Temporary overrides
go test ./...
go test -cover ./...MIT