chq 0.1.0
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.
- package/README.md +271 -0
- package/dist/commands/clean.d.ts +2 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/dispatch.d.ts +3 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/plan.d.ts +2 -0
- package/dist/commands/review.d.ts +2 -0
- package/dist/commands/setup.d.ts +2 -0
- package/dist/commands/status.d.ts +3 -0
- package/dist/commands/watch.d.ts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +931 -0
- package/dist/project.d.ts +11 -0
- package/dist/prompts.d.ts +7 -0
- package/dist/topo-sort.d.ts +2 -0
- package/dist/types.d.ts +46 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# chq
|
|
2
|
+
|
|
3
|
+
Orchestrate multi-repo tasks with [Claude Code](https://docs.anthropic.com/en/docs/claude-code) in parallel.
|
|
4
|
+
|
|
5
|
+
`chq` breaks down a large cross-repository objective into isolated tasks, creates git worktrees for each, and dispatches parallel Claude Code sessions via [WezTerm](https://wezfurlong.org/wezterm/) panes — automatically respecting dependency order.
|
|
6
|
+
|
|
7
|
+
## How It Works
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
chq init my-project # Create a project
|
|
11
|
+
chq plan "Migrate to EKS" # Plan tasks with Claude Code
|
|
12
|
+
chq setup # Create worktrees & CLAUDE.md
|
|
13
|
+
chq dispatch # Launch Claude Code per task
|
|
14
|
+
chq watch # Auto-dispatch as deps complete
|
|
15
|
+
chq status # Check progress
|
|
16
|
+
chq review # Review cross-repo consistency
|
|
17
|
+
chq clean # Remove worktrees
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Workflow
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
plan ──► setup ──► dispatch ──► watch ──► review ──► clean
|
|
24
|
+
│ │
|
|
25
|
+
▼ ▼
|
|
26
|
+
Claude Code Auto-dispatch
|
|
27
|
+
(per task) (on completion)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
1. **Plan** — Claude Code decomposes a goal into repo-scoped, PR-sized tasks with dependency edges
|
|
31
|
+
2. **Setup** — Creates a git worktree per task (topologically sorted), stacking branches for same-repo dependencies
|
|
32
|
+
3. **Dispatch** — Opens a WezTerm pane per ready task, each running Claude Code with a solve prompt
|
|
33
|
+
4. **Watch** — Polls for PR creation, marks tasks done, and dispatches newly unblocked tasks
|
|
34
|
+
5. **Review** — Claude Code reviews all worktrees for cross-repo consistency
|
|
35
|
+
|
|
36
|
+
## Prerequisites
|
|
37
|
+
|
|
38
|
+
| Tool | Purpose |
|
|
39
|
+
|------|---------|
|
|
40
|
+
| [Bun](https://bun.sh/) | Runtime & build |
|
|
41
|
+
| [git](https://git-scm.com/) | Worktree operations |
|
|
42
|
+
| [ghq](https://github.com/x-motemen/ghq) | Local repo path resolution |
|
|
43
|
+
| [gh](https://cli.github.com/) | PR status checks |
|
|
44
|
+
| [WezTerm](https://wezfurlong.org/wezterm/) | Pane splitting for parallel sessions |
|
|
45
|
+
| [Claude Code](https://docs.anthropic.com/en/docs/claude-code) | AI coding agent |
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/shoppingjaws/chq.git
|
|
51
|
+
cd chq
|
|
52
|
+
bun install
|
|
53
|
+
bun run build
|
|
54
|
+
bun link
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# 1. Initialize global config (optional)
|
|
61
|
+
chq config init
|
|
62
|
+
|
|
63
|
+
# 2. Create a project
|
|
64
|
+
chq init my-migration
|
|
65
|
+
|
|
66
|
+
# 3. Plan tasks interactively with Claude Code
|
|
67
|
+
cd ~/chq/my-migration
|
|
68
|
+
chq plan "Migrate authentication from session-based to JWT"
|
|
69
|
+
|
|
70
|
+
# 4. Create worktrees
|
|
71
|
+
chq setup
|
|
72
|
+
|
|
73
|
+
# 5. Launch all ready tasks
|
|
74
|
+
chq dispatch
|
|
75
|
+
|
|
76
|
+
# 6. Or auto-dispatch on completion
|
|
77
|
+
chq watch
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Commands
|
|
81
|
+
|
|
82
|
+
### `chq init <project-name>`
|
|
83
|
+
|
|
84
|
+
Creates `~/chq/<project-name>/` with an empty `chq.json`.
|
|
85
|
+
|
|
86
|
+
### `chq plan <goal>`
|
|
87
|
+
|
|
88
|
+
Launches an interactive Claude Code session that decomposes the goal into tasks and writes them to `chq.json`.
|
|
89
|
+
|
|
90
|
+
### `chq setup`
|
|
91
|
+
|
|
92
|
+
For each task in `chq.json`:
|
|
93
|
+
- Resolves the local repo path via `ghq`
|
|
94
|
+
- Creates a git worktree at `~/chq/<project>/sub-<task-id>`
|
|
95
|
+
- Stacks branches for same-repo dependencies (e.g., `main <- chq/proj/t1 <- chq/proj/t3`)
|
|
96
|
+
- Generates a `CLAUDE.md` with the task overview
|
|
97
|
+
|
|
98
|
+
### `chq status`
|
|
99
|
+
|
|
100
|
+
Displays a table with status icons:
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Project: my-migration
|
|
104
|
+
|
|
105
|
+
ID Title Repo Blocked By Status PR
|
|
106
|
+
t1 Add JWT middleware org/api-server - done Merged
|
|
107
|
+
t2 Update auth client org/web-app - running Open
|
|
108
|
+
t3 Migration script org/api-server t1 ready -
|
|
109
|
+
t4 Update docs org/docs t1,t2 pending -
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
| Icon | Meaning |
|
|
113
|
+
|------|---------|
|
|
114
|
+
| `pending` | Blocked by unfinished dependencies |
|
|
115
|
+
| `ready` | All dependencies done, waiting to dispatch |
|
|
116
|
+
| `running` | Claude Code session active |
|
|
117
|
+
| `done` | PR created |
|
|
118
|
+
| `failed` | Dispatch failed |
|
|
119
|
+
|
|
120
|
+
### `chq dispatch`
|
|
121
|
+
|
|
122
|
+
Finds tasks that are `pending` with all `blockedBy` tasks `done`, updates them to `running`, and opens a WezTerm pane for each with Claude Code.
|
|
123
|
+
|
|
124
|
+
### `chq watch`
|
|
125
|
+
|
|
126
|
+
Polling loop that:
|
|
127
|
+
1. Checks running tasks for PR creation (marks them `done`)
|
|
128
|
+
2. Dispatches newly unblocked tasks
|
|
129
|
+
3. Prints status
|
|
130
|
+
4. Exits when all tasks are done
|
|
131
|
+
|
|
132
|
+
Poll interval: `CHQ_POLL_INTERVAL` env var or `pollInterval` in global config (default: 30s).
|
|
133
|
+
|
|
134
|
+
### `chq review`
|
|
135
|
+
|
|
136
|
+
Launches Claude Code to review all worktrees for cross-repo consistency, API compatibility, and merge-order safety.
|
|
137
|
+
|
|
138
|
+
### `chq clean [--force] [--all]`
|
|
139
|
+
|
|
140
|
+
Removes worktrees. `--force` skips confirmation, `--all` deletes the project directory entirely.
|
|
141
|
+
|
|
142
|
+
### `chq list`
|
|
143
|
+
|
|
144
|
+
Lists all projects under `~/chq/` with done/total counts.
|
|
145
|
+
|
|
146
|
+
### `chq config`
|
|
147
|
+
|
|
148
|
+
Manage global configuration at `~/.config/chq/`.
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
chq config init # Scaffold config.json + prompt templates
|
|
152
|
+
chq config init --force # Overwrite existing files
|
|
153
|
+
chq config show # Display current settings
|
|
154
|
+
chq config path # Print config directory path
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
### Global Config (`~/.config/chq/config.json`)
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"chqHome": "~/chq",
|
|
164
|
+
"pollInterval": 30
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
| Key | Default | Description |
|
|
169
|
+
|-----|---------|-------------|
|
|
170
|
+
| `chqHome` | `~/chq` | Root directory for projects |
|
|
171
|
+
| `pollInterval` | `30` | Watch polling interval in seconds |
|
|
172
|
+
|
|
173
|
+
### Custom Prompts (`~/.config/chq/prompts/`)
|
|
174
|
+
|
|
175
|
+
Override the built-in prompts by placing Markdown files with `{{variable}}` placeholders:
|
|
176
|
+
|
|
177
|
+
| File | Used by | Available variables |
|
|
178
|
+
|------|---------|-------------------|
|
|
179
|
+
| `solve.md` | `chq dispatch` | `{{projectName}}`, `{{projectDescription}}`, `{{taskId}}`, `{{taskTitle}}`, `{{taskDescription}}`, `{{taskRepo}}`, `{{blockedBy}}`, `{{baseBranch}}`, `{{branchName}}`, `{{draftFlag}}` |
|
|
180
|
+
| `plan.md` | `chq plan` | `{{projectName}}`, `{{goal}}` |
|
|
181
|
+
| `review.md` | `chq review` | (none) |
|
|
182
|
+
|
|
183
|
+
Run `chq config init` to scaffold the default templates, then edit them.
|
|
184
|
+
|
|
185
|
+
### Project Config (`~/chq/<project>/chq.json`)
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{
|
|
189
|
+
"name": "my-migration",
|
|
190
|
+
"description": "Migrate auth from session to JWT",
|
|
191
|
+
"createdAt": "2025-01-15T10:00:00.000Z",
|
|
192
|
+
"tasks": [
|
|
193
|
+
{
|
|
194
|
+
"id": "t1",
|
|
195
|
+
"title": "Add JWT middleware",
|
|
196
|
+
"description": "Implement JWT validation middleware in the API server...",
|
|
197
|
+
"repo": "org/api-server",
|
|
198
|
+
"blockedBy": [],
|
|
199
|
+
"status": "pending"
|
|
200
|
+
}
|
|
201
|
+
]
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Branch Strategy
|
|
206
|
+
|
|
207
|
+
`chq` uses stacked branches for same-repo dependency chains:
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
main
|
|
211
|
+
└── chq/my-project/t1 (PR base: main)
|
|
212
|
+
└── chq/my-project/t3 (PR base: t1's branch)
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
When `t1`'s PR is merged, GitHub automatically rebases `t3`'s PR onto `main`.
|
|
216
|
+
|
|
217
|
+
Cross-repo dependencies create Draft PRs to signal they depend on external changes.
|
|
218
|
+
|
|
219
|
+
## FAQ
|
|
220
|
+
|
|
221
|
+
### Do I need WezTerm?
|
|
222
|
+
|
|
223
|
+
Yes. `chq dispatch` and `chq watch` use `wezterm cli split-pane` to open parallel Claude Code sessions. Support for other terminal multiplexers (tmux, Zellij) is not yet implemented.
|
|
224
|
+
|
|
225
|
+
### Can I use this without `ghq`?
|
|
226
|
+
|
|
227
|
+
Not currently. `chq setup` resolves local repository paths using `ghq list --full-path`. If the repo is not found, it suggests running `ghq get <repo>`.
|
|
228
|
+
|
|
229
|
+
### What happens if Claude Code fails mid-task?
|
|
230
|
+
|
|
231
|
+
The task stays in `running` status. You can:
|
|
232
|
+
1. Manually fix the issue in the worktree (`~/chq/<project>/sub-<task-id>/`)
|
|
233
|
+
2. Create the PR yourself, and `chq watch` will detect it and mark the task `done`
|
|
234
|
+
3. Edit `chq.json` directly to reset the task to `pending` and re-dispatch
|
|
235
|
+
|
|
236
|
+
### Can I edit `chq.json` manually?
|
|
237
|
+
|
|
238
|
+
Yes. `chq.json` is the single source of truth. You can add/remove/reorder tasks, change dependencies, or reset statuses manually. Just ensure the JSON is valid.
|
|
239
|
+
|
|
240
|
+
### How does task completion detection work?
|
|
241
|
+
|
|
242
|
+
Two mechanisms:
|
|
243
|
+
1. **Primary**: The Claude Code solve prompt instructs Claude to update `chq.json` status to `"done"` after creating a PR
|
|
244
|
+
2. **Fallback**: `chq watch` checks for PR existence via `gh pr list --head <branch>`
|
|
245
|
+
|
|
246
|
+
### Can I run `chq dispatch` multiple times?
|
|
247
|
+
|
|
248
|
+
Yes. It only dispatches tasks that are `pending` with all dependencies `done`. Already `running` or `done` tasks are skipped.
|
|
249
|
+
|
|
250
|
+
### How do I customize what Claude Code does for each task?
|
|
251
|
+
|
|
252
|
+
Run `chq config init` to export the default prompt templates to `~/.config/chq/prompts/`. Edit `solve.md` to change the implementation instructions, PR format, or completion behavior.
|
|
253
|
+
|
|
254
|
+
### What if I have a circular dependency?
|
|
255
|
+
|
|
256
|
+
`chq setup` runs a topological sort and will error with a clear message:
|
|
257
|
+
```
|
|
258
|
+
Error: Circular dependency detected: t1 -> t3 -> t5 -> t1
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Can two tasks modify the same repository?
|
|
262
|
+
|
|
263
|
+
Yes. Each task gets its own git worktree with a unique branch (`chq/<project>/<task-id>`). If one task depends on another in the same repo, the branch is stacked on top of the dependency's branch.
|
|
264
|
+
|
|
265
|
+
### How do I resume after closing my terminal?
|
|
266
|
+
|
|
267
|
+
Run `chq status` to see where things stand, then `chq dispatch` to launch any pending-and-ready tasks, or `chq watch` to resume the full automation loop.
|
|
268
|
+
|
|
269
|
+
## License
|
|
270
|
+
|
|
271
|
+
MIT
|
package/dist/index.d.ts
ADDED