Nim's varargs doesn't consume the last positional argument when there's
a trailing parameter with a default value. This caused calls like
`runGit("fetch", "origin")` to be parsed as:
- args = ["fetch"]
- workDir = "origin"
Instead of the intended:
- args = ["fetch", "origin"]
- workDir = ""
Fixed by changing from varargs to openArray, which requires explicit
array syntax at call sites: `runGit(["fetch", "origin"])`.
Also includes P2 bug fixes:
- Start heartbeat before state transition (skills-qekj)
- Reject symlinks when reading context file (skills-16zf)
- Case-insensitive conflict detection (skills-n3qp)
Smoke tested: spawn, status, start, show, cancel all work.
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