@autoclawd/autocode 0.4.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/Dockerfile ADDED
@@ -0,0 +1,57 @@
1
+ # autocode base image — all common runtimes for Claude Code
2
+ # Use this as docker.image in your config for zero-setup multi-language support
3
+ #
4
+ # Build: docker build -t autocode-base .
5
+ # Config: docker: { image: autocode-base }
6
+ #
7
+ # Includes: Node.js 20, Python 3, Go, Rust, Ruby, Git, common build tools
8
+ # Size: ~1.5 GB (trades disk for zero-config developer experience)
9
+
10
+ FROM node:20-bookworm
11
+
12
+ # Avoid interactive prompts during package installation
13
+ ENV DEBIAN_FRONTEND=noninteractive
14
+
15
+ # Common build tools + git (already in node:20 but be explicit)
16
+ RUN apt-get update && apt-get install -y --no-install-recommends \
17
+ build-essential \
18
+ git \
19
+ curl \
20
+ wget \
21
+ ca-certificates \
22
+ openssh-client \
23
+ jq \
24
+ unzip \
25
+ # Python
26
+ python3 \
27
+ python3-pip \
28
+ python3-venv \
29
+ python3-dev \
30
+ # Ruby
31
+ ruby \
32
+ ruby-dev \
33
+ # Go (via official tarball for latest stable)
34
+ && rm -rf /var/lib/apt/lists/*
35
+
36
+ # Install Go (bookworm packages are often outdated)
37
+ ARG GO_VERSION=1.22.2
38
+ RUN curl -fsSL "https://go.dev/dl/go${GO_VERSION}.linux-$(dpkg --print-architecture).tar.gz" \
39
+ | tar -xz -C /usr/local
40
+ ENV PATH="/usr/local/go/bin:${PATH}"
41
+
42
+ # Rust is omitted by default (~1.5GB). For Rust repos, use docker.setup:
43
+ # docker:
44
+ # setup:
45
+ # - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
46
+
47
+ # Pre-install Claude Code globally
48
+ RUN npm install -g @anthropic-ai/claude-code@latest
49
+
50
+ # Verify installations
51
+ RUN node --version && python3 --version && go version && ruby --version && git --version
52
+
53
+ # Workspace directory
54
+ WORKDIR /workspace
55
+
56
+ LABEL org.opencontainers.image.title="autocode-base"
57
+ LABEL org.opencontainers.image.description="Multi-runtime base image for autocode (Linear → Claude Code → PRs)"
package/README.md ADDED
@@ -0,0 +1,169 @@
1
+ # autocode
2
+
3
+ Linear tickets in, pull requests out. autocode watches your Linear board, spins up Docker containers, runs [Claude Code](https://docs.anthropic.com/en/docs/claude-code), and opens PRs.
4
+
5
+ ## How it works
6
+
7
+ ```
8
+ Linear webhook → autocode → Docker container → Claude Code → git push → PR
9
+ ```
10
+
11
+ 1. A ticket moves to "Todo" in Linear
12
+ 2. autocode claims it, clones the repo, creates a branch
13
+ 3. Claude Code works on it inside a Docker container (multiple iterations)
14
+ 4. autocode pushes the changes and opens a PR
15
+ 5. Linear ticket moves to "Done" with a link to the PR
16
+
17
+ ## Quick start
18
+
19
+ ```bash
20
+ # Install
21
+ npm install -g autocode
22
+
23
+ # Prerequisites: Docker running, Claude Code logged in
24
+ # (run `claude` once to create ~/.claude/.credentials.json)
25
+
26
+ # Interactive setup — validates everything
27
+ autocode init
28
+
29
+ # Start the webhook server (auto-creates tunnel + Linear webhook)
30
+ autocode serve
31
+ ```
32
+
33
+ ## Commands
34
+
35
+ | Command | Description |
36
+ |---------|-------------|
37
+ | `autocode init` | Interactive setup with preflight checks |
38
+ | `autocode serve` | Start webhook server with auto-tunnel |
39
+ | `autocode run T-123` | Run a single ticket |
40
+ | `autocode run T-123 --dry-run` | Preview without executing |
41
+ | `autocode validate` | Check config syntax |
42
+ | `autocode cleanup` | Remove orphaned Docker containers |
43
+
44
+ ## Configuration
45
+
46
+ ### Host config (`~/.autocode/config.yaml`)
47
+
48
+ Created by `autocode init`. Contains tokens and global defaults.
49
+
50
+ ```yaml
51
+ linear:
52
+ apiKey: "lin_api_..." # or env:LINEAR_API_KEY
53
+ teamId: TEAM
54
+ statuses: [Todo] # which statuses trigger execution
55
+ assignToMe: false # only process tickets assigned to you
56
+ inProgressStatus: In Progress
57
+ doneStatus: Done
58
+
59
+ github:
60
+ token: "ghp_..." # or env:GITHUB_TOKEN
61
+
62
+ webhook:
63
+ port: 3000
64
+
65
+ docker:
66
+ image: node:20 # or autocode-base for multi-language
67
+ memory: 4g
68
+ # setup: # optional commands to run before Claude
69
+ # - pip install -r requirements.txt
70
+
71
+ agent:
72
+ model: claude-sonnet-4-6
73
+ maxIterations: 10
74
+ # timeout: 1800 # per-iteration timeout in seconds
75
+
76
+ maxConcurrent: 1
77
+ ```
78
+
79
+ ### Per-repo config (`.autocode.yaml` or `.autocode.yml`)
80
+
81
+ Optional. Place in the repo root to customize behavior for that repo.
82
+
83
+ ```yaml
84
+ prompt: "You are working on a Django REST API. Follow PEP 8."
85
+ base: develop # default branch (instead of main)
86
+
87
+ agent:
88
+ model: claude-opus-4-6
89
+ maxIterations: 20
90
+
91
+ docker:
92
+ image: python:3.12
93
+ setup:
94
+ - pip install -e ".[dev]"
95
+ ```
96
+
97
+ ## Repo routing
98
+
99
+ Tickets need a `repo:owner/name` label in Linear to tell autocode which repository to work on.
100
+
101
+ Examples:
102
+ - `repo:acme/backend`
103
+ - `repo:acme/frontend`
104
+ - `repo:https://github.com/acme/monorepo`
105
+
106
+ ## Stacked diffs
107
+
108
+ When autocode completes a ticket, it automatically adds a `base:autocode/T-123-...` label to the ticket. To stack Ticket B on Ticket A's unmerged PR:
109
+
110
+ 1. Ticket A is processed normally (branches from main)
111
+ 2. Copy the `base:autocode/A-123-...` label from Ticket A to Ticket B
112
+ 3. Ticket B will branch from A's PR branch instead of main
113
+
114
+ ## Docker images
115
+
116
+ | Image | Languages | Size | Use when |
117
+ |-------|-----------|------|----------|
118
+ | `node:20` (default) | Node.js | ~300MB | Node/TS repos |
119
+ | `autocode-base` | Node, Python, Go, Rust, Ruby | ~1.5GB | Multi-language repos |
120
+ | Custom | Whatever you need | Varies | Special requirements |
121
+
122
+ Build the multi-runtime image:
123
+ ```bash
124
+ docker build -t autocode-base .
125
+ ```
126
+
127
+ For repos with uncommon dependencies, use `docker.setup` in `.autocode.yaml`:
128
+ ```yaml
129
+ docker:
130
+ setup:
131
+ - apt-get update && apt-get install -y libpq-dev
132
+ - pip install -r requirements.txt
133
+ ```
134
+
135
+ autocode also auto-detects common stacks (Python, Go, Ruby) from repo files and installs missing runtimes.
136
+
137
+ ## Environment variables
138
+
139
+ Any config value can reference environment variables with the `env:` prefix:
140
+
141
+ ```yaml
142
+ linear:
143
+ apiKey: env:LINEAR_API_KEY
144
+ github:
145
+ token: env:GITHUB_TOKEN
146
+ ```
147
+
148
+ ## Monitoring
149
+
150
+ The webhook server exposes health endpoints:
151
+
152
+ ```bash
153
+ curl http://localhost:3000/health
154
+ # {"status":"ok","active":1,"queued":0,"capacity":2}
155
+ ```
156
+
157
+ Logs are written to `~/.autocode/logs/autocode-YYYY-MM-DD.log`.
158
+
159
+ ## Security
160
+
161
+ - Config file is written with `0600` permissions (owner-only read/write)
162
+ - Git credentials use `GIT_ASKPASS` / credential helpers (never in URLs or process list)
163
+ - Webhook signature verification (HMAC-SHA256) when signing secret is configured
164
+ - Request body size limit (1 MB)
165
+ - Token redaction in error messages
166
+
167
+ ## License
168
+
169
+ MIT
@@ -0,0 +1,2 @@
1
+
2
+ export { }