feat(M3): Async CLI Integration

This commit is contained in:
2026-05-19 22:22:54 -05:00
parent a2c2b8bf6d
commit 591829369c
5 changed files with 440 additions and 271 deletions
+6 -5
View File
@@ -28,12 +28,13 @@ npm install
```bash
scripts/ai-cli-dispatch list --json
scripts/ai-cli-dispatch exec --client codex --prompt "refactor this function"
scripts/ai-cli-dispatch exec --client claude --prompt "add tests for auth middleware"
scripts/ai-cli-dispatch exec --client opencode --prompt "migrate to ESM"
scripts/ai-cli-dispatch run --client codex --prompt "refactor this function"
scripts/ai-cli-dispatch run --client claude --prompt "add tests for auth middleware"
scripts/ai-cli-dispatch run --client opencode --prompt "migrate to ESM"
scripts/ai-cli-dispatch dispatch "use codex to write tests"
```
Use `--json` for machine-readable command output.
Use `--json` for machine-readable command output. Use `--sync` with `run` or `dispatch` to block until the client returns; the default is async (starts a background job and returns the job ID immediately).
## Client Discovery
@@ -47,7 +48,7 @@ Run `list` to see which clients are installed and their resolved versions.
## Background Jobs
For long-running or fire-and-forget tasks, use the programmatic job API instead of `exec`:
For long-running or fire-and-forget tasks, use the programmatic job API or invoke `run` / `dispatch` without `--sync`:
```typescript
import { startJob, getJob, cancelJob, listJobs, cleanupJobs } from "./src/jobs.js";