@autoclawd/autoclawd 1.0.5 → 1.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 +136 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,88 +1,119 @@
|
|
|
1
|
-
#
|
|
1
|
+
# autoclawd
|
|
2
2
|
|
|
3
|
-
Linear tickets in, pull requests out.
|
|
3
|
+
Linear tickets in, pull requests out. autoclawd watches your Linear board, spins up Docker containers, runs [Claude Code](https://docs.anthropic.com/en/docs/claude-code), and opens PRs — with auto-merge and stacked diffs.
|
|
4
4
|
|
|
5
5
|
## How it works
|
|
6
6
|
|
|
7
7
|
```
|
|
8
|
-
Linear
|
|
8
|
+
Linear ticket (Todo) → autoclawd → Docker + Claude Code → git push → PR (auto-merge)
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
1. A ticket moves to "Todo" in Linear
|
|
12
|
-
2.
|
|
11
|
+
1. A ticket moves to "Todo" in Linear (manually or via Claude app with Linear connector)
|
|
12
|
+
2. autoclawd claims it, clones the repo, creates a branch
|
|
13
13
|
3. Claude Code works on it inside a Docker container (multiple iterations)
|
|
14
|
-
4.
|
|
15
|
-
5.
|
|
14
|
+
4. Validation hooks run (tests, lint, build) — failures are fed back to Claude for fixing
|
|
15
|
+
5. autoclawd pushes, opens a PR, and enables auto-merge
|
|
16
|
+
6. Linear ticket moves to "Done" with a link to the PR
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
For dependent tasks, autoclawd handles **stacked diffs** — child PRs branch from parent PRs and auto-rebase when parents merge.
|
|
19
|
+
|
|
20
|
+
## Install
|
|
18
21
|
|
|
19
22
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
23
|
+
npm install -g @autoclawd/autoclawd
|
|
24
|
+
```
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
# (run `claude` once to create ~/.claude/.credentials.json)
|
|
26
|
+
Prerequisites: Docker running, Claude Code logged in (`claude` once to create credentials).
|
|
25
27
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
Docker is auto-started if installed but not running. On macOS, autoclawd opens Docker Desktop automatically.
|
|
29
|
+
|
|
30
|
+
## Quick start
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
32
|
+
```bash
|
|
33
|
+
# Interactive setup — validates tokens, Docker, Claude credentials
|
|
34
|
+
autoclawd init
|
|
35
|
+
|
|
36
|
+
# Start watching Linear for tickets (runs in background)
|
|
37
|
+
autoclawd watch
|
|
38
|
+
|
|
39
|
+
# Or run a single ticket
|
|
40
|
+
autoclawd run RAH-123
|
|
31
41
|
```
|
|
32
42
|
|
|
33
43
|
## Commands
|
|
34
44
|
|
|
35
45
|
| Command | Description |
|
|
36
46
|
|---------|-------------|
|
|
37
|
-
| `
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
41
|
-
| `
|
|
42
|
-
| `
|
|
47
|
+
| `autoclawd init` | Interactive setup with preflight checks |
|
|
48
|
+
| `autoclawd watch` | Poll Linear for tickets (background by default) |
|
|
49
|
+
| `autoclawd watch --foreground` | Poll in foreground (see logs in terminal) |
|
|
50
|
+
| `autoclawd stop` | Stop the background watcher |
|
|
51
|
+
| `autoclawd serve` | Start webhook server with tunnel |
|
|
52
|
+
| `autoclawd run T-123` | Run a single ticket |
|
|
53
|
+
| `autoclawd run T-123 --dry-run` | Preview without executing |
|
|
54
|
+
| `autoclawd fix <PR-URL>` | Fix failed CI checks on a PR |
|
|
55
|
+
| `autoclawd retry T-123` | Retry a failed ticket |
|
|
56
|
+
| `autoclawd retry --all-failed` | Retry all unresolved failures |
|
|
57
|
+
| `autoclawd rebase [owner/repo]` | Rebase stacked PRs whose base was merged |
|
|
58
|
+
| `autoclawd history` | Show run history |
|
|
59
|
+
| `autoclawd cleanup` | Remove orphaned Docker containers |
|
|
60
|
+
| `autoclawd validate` | Check config syntax |
|
|
43
61
|
|
|
44
62
|
## Configuration
|
|
45
63
|
|
|
46
|
-
### Host config (`~/.
|
|
64
|
+
### Host config (`~/.autoclawd/config.yaml`)
|
|
47
65
|
|
|
48
|
-
Created by `
|
|
66
|
+
Created by `autoclawd init`. Contains tokens and global defaults.
|
|
49
67
|
|
|
50
68
|
```yaml
|
|
51
69
|
linear:
|
|
52
|
-
apiKey: "lin_api_..."
|
|
70
|
+
apiKey: "lin_api_..." # or env:LINEAR_API_KEY
|
|
53
71
|
teamId: TEAM
|
|
54
|
-
statuses: [Todo]
|
|
55
|
-
assignToMe: false
|
|
72
|
+
statuses: [Todo] # which statuses trigger execution
|
|
73
|
+
assignToMe: false # only process tickets assigned to you
|
|
56
74
|
inProgressStatus: In Progress
|
|
57
75
|
doneStatus: Done
|
|
58
76
|
|
|
59
77
|
github:
|
|
60
|
-
token: "ghp_..."
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
port: 3000
|
|
78
|
+
token: "ghp_..." # or env:GITHUB_TOKEN
|
|
79
|
+
autoMerge: true # enable auto-merge on PRs (default: false)
|
|
80
|
+
mergeMethod: squash # merge | squash | rebase (default: squash)
|
|
64
81
|
|
|
65
82
|
docker:
|
|
66
|
-
image: node:20
|
|
83
|
+
image: node:20
|
|
67
84
|
memory: 4g
|
|
68
|
-
# setup:
|
|
85
|
+
# setup: # commands to run before Claude Code
|
|
69
86
|
# - pip install -r requirements.txt
|
|
87
|
+
# volumes: # extra bind mounts
|
|
88
|
+
# - "~/.ssh:/home/autoclawd/.ssh:ro"
|
|
89
|
+
# network: bridge # bridge | host | none
|
|
70
90
|
|
|
71
91
|
agent:
|
|
72
92
|
model: claude-sonnet-4-6
|
|
73
93
|
maxIterations: 10
|
|
74
|
-
# timeout: 1800
|
|
94
|
+
# timeout: 1800 # per-iteration timeout in seconds
|
|
95
|
+
|
|
96
|
+
safety:
|
|
97
|
+
# allowedRepos: # restrict which repos can be targeted
|
|
98
|
+
# - owner/repo-a
|
|
99
|
+
# - owner/repo-b
|
|
100
|
+
branchPrefix: "autoclawd/" # all branches must start with this
|
|
101
|
+
# maxFileChanges: 100 # fail if too many files changed
|
|
102
|
+
|
|
103
|
+
# validate: # global validation commands
|
|
104
|
+
# - npm test
|
|
105
|
+
# - npm run lint
|
|
75
106
|
|
|
76
107
|
maxConcurrent: 1
|
|
77
108
|
```
|
|
78
109
|
|
|
79
|
-
### Per-repo config (`.
|
|
110
|
+
### Per-repo config (`.autoclawd.yaml` or `.autoclawd.yml`)
|
|
80
111
|
|
|
81
|
-
Optional. Place in the repo root to customize behavior
|
|
112
|
+
Optional. Place in the repo root to customize behavior per repo.
|
|
82
113
|
|
|
83
114
|
```yaml
|
|
84
115
|
prompt: "You are working on a Django REST API. Follow PEP 8."
|
|
85
|
-
base: develop
|
|
116
|
+
base: develop # default branch (instead of main)
|
|
86
117
|
|
|
87
118
|
agent:
|
|
88
119
|
model: claude-opus-4-6
|
|
@@ -92,39 +123,79 @@ docker:
|
|
|
92
123
|
image: python:3.12
|
|
93
124
|
setup:
|
|
94
125
|
- pip install -e ".[dev]"
|
|
126
|
+
|
|
127
|
+
validate:
|
|
128
|
+
- pytest
|
|
129
|
+
- ruff check .
|
|
95
130
|
```
|
|
96
131
|
|
|
97
132
|
## Repo routing
|
|
98
133
|
|
|
99
|
-
Tickets need a `repo:owner/name` label in Linear to
|
|
134
|
+
Tickets need a `repo:owner/name` label in Linear to route to the correct GitHub repo.
|
|
100
135
|
|
|
101
136
|
Examples:
|
|
102
137
|
- `repo:acme/backend`
|
|
103
138
|
- `repo:acme/frontend`
|
|
104
139
|
- `repo:https://github.com/acme/monorepo`
|
|
105
140
|
|
|
141
|
+
If the repo doesn't exist, autoclawd creates it automatically and pushes an initial scaffold.
|
|
142
|
+
|
|
106
143
|
## Stacked diffs
|
|
107
144
|
|
|
108
|
-
|
|
145
|
+
For dependent tasks where ticket B needs code from ticket A:
|
|
109
146
|
|
|
110
|
-
1. Ticket A is processed normally (branches from main)
|
|
111
|
-
2.
|
|
112
|
-
3. Ticket B
|
|
147
|
+
1. **Ticket A** is processed normally (branches from main)
|
|
148
|
+
2. After A completes, autoclawd adds a `base:autoclawd/RAH-100-...` label to it
|
|
149
|
+
3. **Ticket B** gets that label → it branches from A's PR branch instead of main
|
|
150
|
+
4. When A's PR merges, autoclawd auto-rebases B onto main and retargets the PR
|
|
113
151
|
|
|
114
|
-
|
|
152
|
+
The rebase happens automatically during the watch poll cycle, or manually via:
|
|
153
|
+
```bash
|
|
154
|
+
autoclawd rebase owner/repo
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Setting up stacked diffs from the Claude app
|
|
158
|
+
|
|
159
|
+
When using the Claude app with a Linear connector to create tickets, tell Claude:
|
|
160
|
+
- "Task B depends on task A" → Claude adds the `base:autoclawd/RAH-{A}-...` label to B
|
|
115
161
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
162
|
+
## Validation hooks
|
|
163
|
+
|
|
164
|
+
Configure test/lint/build commands that run after Claude Code finishes. Failures are fed back to Claude for fixing.
|
|
165
|
+
|
|
166
|
+
```yaml
|
|
167
|
+
# In .autoclawd.yaml or host config
|
|
168
|
+
validate:
|
|
169
|
+
- npm test
|
|
170
|
+
- npm run lint
|
|
171
|
+
- npm run build
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
- PRs start as **draft** while validation runs
|
|
175
|
+
- If all pass → PR marked **ready** (+ auto-merge if enabled)
|
|
176
|
+
- If still failing after max iterations → PR stays draft with failure details in the body
|
|
177
|
+
|
|
178
|
+
## CI fix mode
|
|
179
|
+
|
|
180
|
+
Fix failing CI checks on an existing PR without a Linear ticket:
|
|
121
181
|
|
|
122
|
-
Build the multi-runtime image:
|
|
123
182
|
```bash
|
|
124
|
-
|
|
183
|
+
autoclawd fix https://github.com/owner/repo/pull/123
|
|
125
184
|
```
|
|
126
185
|
|
|
127
|
-
|
|
186
|
+
autoclawd fetches the failed check logs, spins up Claude Code on the PR branch, and pushes fixes.
|
|
187
|
+
|
|
188
|
+
## Docker images
|
|
189
|
+
|
|
190
|
+
| Image | Use when |
|
|
191
|
+
|-------|----------|
|
|
192
|
+
| `node:20` (default) | Node.js / TypeScript repos |
|
|
193
|
+
| `python:3.12` | Python repos |
|
|
194
|
+
| `ubuntu:24.04` | General purpose |
|
|
195
|
+
| Any image | autoclawd auto-installs git + Claude Code if missing |
|
|
196
|
+
|
|
197
|
+
autoclawd auto-detects common stacks (Python, Go, Ruby) from repo files and installs missing runtimes. Use `docker.setup` for anything custom:
|
|
198
|
+
|
|
128
199
|
```yaml
|
|
129
200
|
docker:
|
|
130
201
|
setup:
|
|
@@ -132,8 +203,6 @@ docker:
|
|
|
132
203
|
- pip install -r requirements.txt
|
|
133
204
|
```
|
|
134
205
|
|
|
135
|
-
autocode also auto-detects common stacks (Python, Go, Ruby) from repo files and installs missing runtimes.
|
|
136
|
-
|
|
137
206
|
## Environment variables
|
|
138
207
|
|
|
139
208
|
Any config value can reference environment variables with the `env:` prefix:
|
|
@@ -147,22 +216,30 @@ github:
|
|
|
147
216
|
|
|
148
217
|
## Monitoring
|
|
149
218
|
|
|
150
|
-
|
|
151
|
-
|
|
219
|
+
Health endpoint (webhook/serve mode):
|
|
152
220
|
```bash
|
|
153
221
|
curl http://localhost:3000/health
|
|
154
222
|
# {"status":"ok","active":1,"queued":0,"capacity":2}
|
|
155
223
|
```
|
|
156
224
|
|
|
157
|
-
Logs
|
|
225
|
+
Logs: `~/.autoclawd/logs/autoclawd-YYYY-MM-DD.log`
|
|
226
|
+
|
|
227
|
+
Run history:
|
|
228
|
+
```bash
|
|
229
|
+
autoclawd history
|
|
230
|
+
autoclawd history --failed
|
|
231
|
+
autoclawd history --json
|
|
232
|
+
```
|
|
158
233
|
|
|
159
234
|
## Security
|
|
160
235
|
|
|
161
|
-
- Config file
|
|
162
|
-
- Git credentials
|
|
163
|
-
- Webhook signature verification (HMAC-SHA256) when signing secret
|
|
236
|
+
- Config file written with `0600` permissions (owner-only)
|
|
237
|
+
- Git credentials via `GIT_ASKPASS` / credential helper (never in URLs or process list)
|
|
238
|
+
- Webhook signature verification (HMAC-SHA256) when signing secret configured
|
|
164
239
|
- Request body size limit (1 MB)
|
|
165
240
|
- Token redaction in error messages
|
|
241
|
+
- Branch prefix enforcement prevents writes outside `autoclawd/` namespace
|
|
242
|
+
- Optional repo allowlist (`safety.allowedRepos`)
|
|
166
243
|
|
|
167
244
|
## License
|
|
168
245
|
|