Test infrastructure: - Add comprehensive test-worker.sh with 59 tests - Cover spawn, start, done, approve, reject, cancel, fail, heartbeat - Test status filtering, context files, review-gate integration - Test invalid state transitions and error cases Bug fixes: - Fix agent commands failing when run from worktrees (skills-y3f2) - Add getMainRepoBusDbPath() to find DB in main repo - Update start, done, fail, heartbeat to use correct path - Fix review.nim crash when review-gate not installed (OSError) - Gracefully return exitCode=-1 instead of crashing Closes skills-y3f2 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| libs | ||
| worker | ||
| .gitignore | ||
| config.nims | ||
| README.md | ||
| worker.nim | ||
| worker.nimble | ||
Worker CLI
Multi-agent worker coordination CLI written in Nim.
Prerequisites
# Install Nim (>= 2.0.0)
# On NixOS: nix-shell -p nim
# Install dependencies
nimble install tiny_sqlite cligen
Static SQLite (Optional)
For a single static binary, download the SQLite amalgamation:
curl -LO https://sqlite.org/2024/sqlite-amalgamation-3450000.zip
unzip sqlite-amalgamation-3450000.zip
cp sqlite-amalgamation-3450000/sqlite3.c libs/
Build
# Development build
nim c src/worker.nim
# Release build (optimized)
nim c -d:release src/worker.nim
# The binary will be at src/worker
Usage
# Orchestrator commands (human)
worker spawn <task-id> # Create workspace
worker status [--watch] # Dashboard
worker approve <task-id> # Approve work
worker request-changes <task-id> # Request changes
worker merge <task-id> # Merge to integration
worker cancel <task-id> # Abort worker
# Agent commands (from worktree)
worker start # Begin work
worker done [--skip-rebase] # Complete work
worker fail <reason> # Signal failure
worker heartbeat # Manual heartbeat
worker show <task-id> # Detailed view
Project Structure
src/
├── worker.nim # CLI entry point (cligen)
├── worker.nimble # Package definition
├── config.nims # Build configuration
├── libs/
│ └── sqlite3.c # SQLite amalgamation (optional)
└── worker/
├── types.nim # Shared types and constants
├── db.nim # SQLite operations
├── state.nim # State machine
├── heartbeat.nim # Background thread
├── git.nim # Git/worktree operations
└── context.nim # Worker context handling
Design Docs
See docs/design/:
mvp-scope.md- MVP scope and implementation ordermessage-passing-layer.md- SQLite message busworker-cli-primitives.md- CLI commandsworker-state-machine.md- State transitions