craig-cli 0.14.1 → 0.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +38 -215
  2. package/dist/cli.js +107 -107
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -10,250 +10,73 @@
10
10
  ░ ░░ ░ ░ ▒ ▒ ░░ ░ ░
11
11
  ░ ░ ░ ░ ░ ░ ░
12
12
 
13
- crAIg is that you?
14
-
15
13
  </pre>
16
14
 
17
- **An agnostic agent orchestrator. For the people.**
15
+ **An agnostic orchestrator TUI, for the people.**
18
16
 
19
17
  [![npm](https://img.shields.io/npm/v/craig-cli)](https://www.npmjs.com/package/craig-cli)
20
- [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
18
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://github.com/hallsamuel90/craig/blob/main/LICENSE)
21
19
  [![Node 22+](https://img.shields.io/badge/node-22%2B-brightgreen)](https://nodejs.org)
22
20
 
23
- [craig-cli.com](https://craig-cli.com) · [Docs](https://craig-cli.com/docs/) · [Quickstart](https://craig-cli.com/docs/quickstart/)
21
+ [Website](https://craig-cli.com) · [Documentation](https://craig-cli.com/docs/) · [CLI reference](https://craig-cli.com/docs/cli/)
24
22
 
25
23
  </div>
26
24
 
27
- ---
28
-
29
- Craig is a full-screen TUI that lets you run multiple AI agents across multiple repos at the same time — each in its own isolated git worktree, each with a live PTY, all from one terminal. Spin up Claude, Codex, and Cursor simultaneously. Watch them cook. Inspect diffs and review state while the agent handles repo actions from its PTY.
30
-
31
- it's like a game, except the PRs are real.
32
-
33
- ## Install
34
-
35
- ```bash
36
- npm install -g craig-cli
37
- ```
25
+ <a href="https://craig-cli.com">
26
+ <img src="https://craig-cli.com/craig-agent.gif" alt="Craig running parallel coding agents in its terminal UI">
27
+ </a>
38
28
 
39
- Requires Node 22+, `git`, and `gh` (authenticated). Bring your own agent CLI — Claude Code, Codex, or Cursor.
29
+ Craig gives every task its own Git branch, isolated worktree, and live PTY, then keeps the agents, changes, pull requests, and checks together in one keyboard-driven workspace.
40
30
 
41
- ## Start
42
-
43
- ```bash
44
- cd path/to/your/workspace
45
- craig
46
- ```
31
+ Bring the agent CLIs you already use—Claude Code, Codex, or Cursor. Craig is not another coding agent; it is the heads-up display and controls around them.
47
32
 
48
- The TUI opens with a boot overlay, then a three-panel workspace: task navigation on the left, live agent PTY in the center, file/diff/review inspector on the right.
49
-
50
- Craig writes all local state under `.craig/` — worktrees, logs, task records, PR metadata. Don't commit it.
51
-
52
- ## Workflow
53
-
54
- 1. Press `n` to create a task — type a short task description, pick a runner, press `Enter`.
55
- 2. Craig creates the task record, branch, worktree, and agent tab automatically.
56
- 3. Press `Enter` on the task to attach its live PTY. `Ctrl+]` to return to control mode.
57
- 4. Give the runner its instructions in the agent PTY. The task description is Craig metadata; it is not pasted into the runner automatically.
58
- 5. Use the **Files**, **Changes**, and read-only **Review** inspector panels to check the diff, PR state, checks, and comments.
59
-
60
- ## Polyrepo support
61
-
62
- Point Craig at a directory containing multiple repos and it treats them as a single workspace. Create a task once — Craig provisions a worktree for each repo and runs the agent across all of them in one pass.
63
-
64
- ```bash
65
- cd path/to/your/projects # contains repo-a/, repo-b/, repo-c/
66
- craig
67
- ```
68
-
69
- ## TUI Keys
70
-
71
- ```
72
- Global
73
- ? help
74
- Esc pause
75
- Tab, ] next panel
76
- Shift+Tab, [ previous panel
77
- Up/Down, j/k move selection
78
- PgUp/PgDn, Wheel scroll focused inspection or terminal view
79
- z zoom center panel
80
- n new task
81
- q quit
33
+ _It's like a game, except the PRs are real._
82
34
 
83
- Navigation
84
- Left/Right, h/l switch tabs or inspector mode
35
+ ## Why Craig?
85
36
 
86
- Tasks
87
- Enter on + New Task open task prompt
88
- Enter on + New Workspace open workspace browser
89
- Enter on task attach selected task PTY
90
- r on + New Task cycle runner for next task
91
- X on task close selected task
92
- X on workspace remove selected workspace
37
+ - **Run agents in parallel.** Each task works in an isolated Git worktree, so one agent does not overwrite another.
38
+ - **Keep the native agent experience.** Every runner opens in a real PTY instead of a lowest-common-denominator chat wrapper.
39
+ - **Stay in flow.** Launch agents, move between tasks, inspect changes, and watch PR checks without leaving the keyboard.
40
+ - **Work across repositories.** Treat one repo or a directory of repos as a workspace while preserving real repository boundaries.
41
+ - **Let agents operate the workspace.** The same task model backs the TUI and CLI, so agents and scripts can inspect context and perform Craig actions directly.
42
+ - **Leave and come back.** A local daemon keeps agent sessions and PR synchronization alive when the foreground TUI closes.
93
43
 
94
- Center panel
95
- Enter attach PTY
96
- + create preferred tab kind
97
- a new agent tab
98
- t new terminal tab
99
- r cycle runner for next agent tab
100
- x close tab
101
-
102
- Review
103
- Enter refresh status or close task, depending on selected action
104
- R refresh read-only PR/check state
105
- o open tracked PR URL
106
- X close task record
107
-
108
- Task prompt
109
- Ctrl+R cycle runner
110
- Enter create task
111
- Esc cancel
112
-
113
- Workspace browser
114
- Up/Down, j/k move selection
115
- Right, l open directory
116
- Left, h parent directory
117
- Enter add selected path
118
- Esc cancel
119
-
120
- Terminal mode
121
- Ctrl+] return to control mode
122
- Wheel, PgUp/PgDn scroll terminal
123
- ```
124
-
125
- ## Command mode
44
+ ## Install
126
45
 
127
46
  ```bash
128
- craig repo add <path>
129
- craig repo list
130
- craig repo remove <repo-id>
131
-
132
- craig workspace add <path>
133
- craig workspace list
134
- craig workspace list --archived
135
- craig workspace archive <workspace-id>
136
- craig workspace restore <workspace-id>
137
- craig workspace remove <workspace-id>
138
-
139
- craig task new --repo <repo-id> [--runner codex|cursor|claude] "<task>"
140
- craig task new --workspace <workspace-id> [--runner codex|cursor|claude] "<task>"
141
- craig task list
142
- craig task list --repo <repo-id>
143
- craig task show <task-id>
144
- craig task open <task-id>
145
- craig task logs <task-id>
146
- craig task diff <task-id>
147
- craig task check <task-id>
148
- craig task commit <task-id>
149
- craig task create-child --parent <task-id> [--repo <repo-id> | --workspace <workspace-id>] [--runner codex|cursor|claude] \
150
- [--idempotency-key <key>] "<task>" --json
151
- craig task children [<task-id>] --json
152
- craig task cancel-tree [<task-id>] --json
153
-
154
- craig agent list [--task <task-id>] --json
155
- craig agent status [--task <task-id>] [--tab <tab-id>] --json
156
- craig agent send --task <task-id> [--tab <tab-id>] (--prompt <text> | --prompt-file <path> | --stdin) \
157
- [--delivery when-ready|immediate] [--timeout <duration>] [--idempotency-key <key>] --json
158
- craig task wait [<task-id>] --state <states> [--tab <tab-id>] [--timeout <duration>] --json
159
-
160
- craig events list [--task <task-id>] [--type <glob>] [--after <cursor>] --json
161
- craig events watch [--task <task-id>] [--type <glob>] [--after <cursor>] [--format jsonl]
162
-
163
- craig fury validate <file> --json
164
- craig fury plan <file> [--root-task <task-id>] [--input key=value] --json
165
- craig fury approve <plan-id> --json
166
- craig fury run <plan-id> --json
167
- craig fury status <run-id> --json
168
- craig fury watch <run-id> [--after <cursor>] [--format jsonl]
169
- craig fury cancel <run-id> --json
170
- craig fury resume <run-id> --json
171
- craig fury step complete --run <run-id> --step <step-id> [--output <json> | --output-file <path> | --stdin] --json
172
- craig fury step fail --run <run-id> --step <step-id> --reason <text> --json
173
- craig fury reviews list [--run <run-id>] [--state <state>] --json
174
- craig fury review show|approve|reject|request-changes|resubmit <review-id> --json
175
-
176
- craig command show <command-id> --json
177
- craig command list [--task <task-id>] --json
178
- craig command cancel <command-id> --json
179
- craig command wait <command-id> [--state <states>] [--timeout <duration>] --json
180
-
181
- craig link add <task-id> <repo-id>
182
- craig link list <task-id>
183
- ```
184
-
185
- ## Config
186
-
187
- Optional workspace-local config at `.craig/config.json`:
188
-
189
- ```json
190
- {
191
- "runners": {
192
- "codex": { "enabled": true },
193
- "cursor": { "enabled": true },
194
- "claude": { "enabled": false }
195
- },
196
- "checks": {
197
- "commands": ["pnpm test", "pnpm typecheck", "pnpm lint"]
198
- },
199
- "github": {
200
- "mergeMethod": "squash",
201
- "watchIntervalSeconds": 5
202
- },
203
- "previews": {
204
- "agentActivityIndicators": false,
205
- "agentOrchestration": false
206
- }
207
- }
47
+ npm install -g craig-cli
208
48
  ```
209
49
 
210
- Feature previews are experimental, workspace-local, and off by default. They can also be toggled from Options > Feature Previews in the TUI.
50
+ Craig requires Node.js 22+ and `git`. Install and authenticate at least one supported runner: Claude Code, Codex, or Cursor. Pull request discovery and review status also require an authenticated `gh` CLI.
211
51
 
212
- ### Cursor workspace trust
52
+ ## Quick start
213
53
 
214
- Cursor may ask separately whether to trust each Craig-managed worktree or project task bundle. To establish trust once at their common parent, open `~/.craig` in Cursor and approve its workspace trust prompt. Trust only that directory if you are comfortable allowing Cursor agents to work throughout Craig's local task state. Craig does not pass Cursor's `--trust` flag or otherwise weaken the runner's safety settings. For narrower project-only testing, opening `~/.craig/task_bundles` limits the trusted parent to project bundles but does not cover repo worktrees under `~/.craig/worktrees`.
54
+ Run `craig` in a full-screen terminal, then work through the TUI:
215
55
 
216
- An interactive Craig launched from inside an agent session will not implicitly attach to that agent's live workspace. Pass `--workspace-root <live-root>` to confirm that attachment, or create and pass a different directory for an isolated blank workspace. A client also refuses to replace a live PTY daemon that uses an incompatible protocol; exit the other Craig instance before restarting explicitly.
56
+ 1. Select **+ New Workspace** and choose a Git repository. You can also choose a parent directory to work across its direct-child repositories.
57
+ 2. Press `n`, name the task, and use `Ctrl+R` to choose Claude Code, Codex, or Cursor. Press `Enter` to create it.
58
+ 3. Craig creates an isolated branch and worktree, starts the runner there, and takes you directly into its live PTY. Tell the agent what you want it to do.
59
+ 4. Press `Ctrl+]` to return to Craig's control mode. Move between panels with `Tab`, navigate with the arrow keys or `hjkl`, and press `Enter` on a task to reattach to its agent.
60
+ 5. Press `n` again to start more tasks while the first agent keeps working. Each task remains isolated in its own worktree.
61
+ 6. Use **Files** to inspect the worktree and **Review** to follow diffs, pull requests, checks, and review state. Ask the agent to commit, push, create the PR, or merge from its PTY; Craig keeps the status in sync.
217
62
 
218
- Event commands, new prompt dispatch creation, child-task creation, and fury validation/planning require the `agentOrchestration` preview. Preview-enabled agent PTYs receive an opaque workspace-local capability token scoped to their own task, the stable delegation command families, an expiry, and bounded child/depth/concurrency/prompt limits; only a non-authorizing reference is stored on the task. Fury operations reuse that scoped token according to each command's preview and recovery policy without persisting preview-only command families into the base capability record, so stable Craig can still read the workspace after preview use. `task create-child` inherits the parent target when neither `--repo` nor `--workspace` is supplied: project parents create project children, while repo parents create children in the same repo. An explicit repo child of a project task stays owned by that project workspace, so it does not require a separate standalone repo workspace. `task children` and idempotent `task cancel-tree` remain available when the preview is disabled so existing lineage can be inspected and safely stopped. Craig may still maintain durable semantic events internally for stable daemon services such as pull request synchronization. Disabling the preview stops new dispatch and child creation but leaves command inspection, waiting, cancellation, and safe reconciliation available for existing durable work. Prompt delivery defaults to `when-ready`; `immediate` explicitly interrupts a busy target. Craig sends a dispatched prompt and its submit key as separate terminal input events so the submit key cannot be consumed as part of the bracketed paste. A delegated child starts in a daemon-owned agent session immediately and selecting that child in the TUI attaches to the same process.
63
+ See the [TUI reference](https://craig-cli.com/docs/tui/) for every panel and keyboard shortcut.
219
64
 
220
- Fury definitions are strict, versioned YAML DAGs stored under `.craig/fury/`. A `create_child` step can specify `repo`, specify `workspace`, or use an empty mapping (`create_child: {}`) to inherit its planning parent's target. `fury validate` checks the schema, limits, templates, references, dependencies, output schemas, and human-review checkpoints without mutating runtime state. `fury plan` resolves declared inputs, binds the graph to a planning task, persists an immutable content-hashed plan, and requests human sign-off.
65
+ ## Local by default
221
66
 
222
- Only a human can `fury approve` the exact plan hash. `fury run` accepts only an approved plan id, creates at most one run for that approval, and schedules every new task as a direct child of the planning task; graph dependencies never create visual grandchildren. Every agent step must explicitly call `fury step complete` or `fury step fail`; terminal silence is never success. Declared outputs are JSON-schema validated before dependents can run. Human-review steps remain blocked until an attributable human approval, while request-changes routes durable feedback to the declared task and requires an explicit resubmission. The sidebar shows one flat Fury attention row when plan or review approvals are waiting. The heartbeat reconciles interrupted dispatch, deadlines, missing agent sessions, and pending work. Retries, conditions, fan-out, and recursive Fury runs remain deferred.
67
+ Craig stores workspace state, task records, worktrees, and runtime metadata under `.craig/` at the workspace root. Do not commit this directory; ignore `.craig/` when the workspace root is itself a Git repository. Craig does not require an account or hosted control plane. Your agent CLIs still use their own authentication and network services.
223
68
 
224
- ```yaml
225
- version: 1
226
- name: inspect-and-review
227
- limits: { max_concurrency: 2, max_tasks: 4, timeout: 2h }
228
- inputs:
229
- task_id: { type: string, required: true }
230
- steps:
231
- inspect:
232
- task: "${{ inputs.task_id }}"
233
- prompt: Inspect the task and submit structured findings.
234
- output:
235
- schema: { type: object, required: [findings] }
236
- review:
237
- needs: [inspect]
238
- human_review:
239
- title: Review findings
240
- summary: Review the submitted findings before execution continues.
241
- feedback_target: { task: "${{ steps.inspect.task_id }}" }
242
- timeout: 1h
243
- ```
69
+ ## Go deeper
244
70
 
245
- The TUI sidebar groups descendants beneath their root task while enforcing a single visual child level. Grandchildren and deeper descendants use the same indentation as direct children, and every task row continues to show only that task's agent-tab activity roll-up.
246
-
247
- `github.watchIntervalSeconds` is the minimum GitHub polling interval. Craig polls selected PRs with pending checks
248
- most frequently, backs stable PRs and PR discovery off automatically, and pauses after rate-limit responses. The
249
- workspace daemon keeps PR discovery and check synchronization running while the TUI is detached or closed, and
250
- reacts to task and agent completion events for faster refreshes.
71
+ - [TUI reference](https://craig-cli.com/docs/tui/) — layout, controls, and task navigation
72
+ - [Runners](https://craig-cli.com/docs/runners/) — Claude Code, Codex, and Cursor setup
73
+ - [CLI reference](https://craig-cli.com/docs/cli/) — commands for humans, scripts, and agents
74
+ - [Configuration](https://craig-cli.com/docs/config/) — runners, checks, GitHub polling, and previews
75
+ - [Agent orchestration](https://craig-cli.com/docs/orchestration/) — delegation, durable prompts, events, and Fury workflows
251
76
 
252
77
  ## Contributing
253
78
 
254
- Craig is open source under MIT, but not a community-maintained project. Bug reports and focused questions are welcome. PRs should be discussed with the maintainer first — unsolicited PRs may be closed without review.
255
-
256
- See [CONTRIBUTING.md](CONTRIBUTING.md) and [SECURITY.md](SECURITY.md).
79
+ Craig is open source under the [MIT License](https://github.com/hallsamuel90/craig/blob/main/LICENSE), but it is not a community-maintained project. Bug reports and focused questions are welcome. Please read the [contribution guide](https://github.com/hallsamuel90/craig/blob/main/CONTRIBUTING.md) before proposing a change and report security issues through the [security policy](https://github.com/hallsamuel90/craig/blob/main/SECURITY.md).
257
80
 
258
81
  ## Development
259
82
 
@@ -268,4 +91,4 @@ pnpm package:audit
268
91
  pnpm package:smoke
269
92
  ```
270
93
 
271
- The npm package is published as `craig-cli` from `packages/cli`.
94
+ The npm package is published as [`craig-cli`](https://www.npmjs.com/package/craig-cli) from `packages/cli`.