@code-partner/codepipe 0.1.128-dev.8.g53fc760 → 0.1.128

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 +223 -74
  2. package/dist/index.js +104 -98
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,17 +1,79 @@
1
1
  # @code-partner/codepipe
2
2
 
3
- Local client for **CodePipe** the multi-project service that drives
4
- development through AI agents under human control. One package, one `codepipe`
5
- bin, two roles:
6
-
7
- - **CLI** the only component that holds production write access (YouTrack,
8
- Bitbucket, GitHub) and the only one that touches your local project
9
- checkouts;
10
- - **worker** (`codepipe worker`) — the SANDBOX runner: registers with a HUB
11
- like a CI runner, claims jobs and executes agent work (Claude Code
12
- headless). It holds no production credentials: read-only repo access and
13
- the Claude token arrive encrypted from the CLI with every job and are never
14
- persisted.
3
+ **CodePipe turns your tracker tasks into reviewed pull requests.** Assign a
4
+ YouTrack task to yourself — an AI agent (Claude Code) studies your codebase,
5
+ proposes a solution, waits for your approval, implements it, verifies the
6
+ build and opens a PR. You control every step from a kanban dashboard (works
7
+ from your phone); the agent does the typing.
8
+
9
+ What you get once a project is connected:
10
+
11
+ - **A task pipeline instead of a chat.** Every task moves through explicit
12
+ phases analysis your review implementation build check → your
13
+ review PR visible as cards on a board. Nothing merges without you.
14
+ - **Approval gates.** At each gate you Approve, Reject with a comment (the
15
+ agent redoes the step with your instruction), or just comment.
16
+ - **Rework by comment.** After the PR exists, reply
17
+ `@codepipe rework: <what to change>` in the YouTrack task — the agent picks
18
+ it up and updates the PR.
19
+ - **Your credentials never leave your machine.** The CLI on your laptop is
20
+ the only thing holding YouTrack and git tokens; the orchestrating HUB has
21
+ no git access and no production tokens at all. Agent runners receive
22
+ read-only access encrypted per job and never persist it.
23
+ - **Works with an empty repo or an existing codebase** — you can start a
24
+ brand-new project or point CodePipe at years of history.
25
+
26
+ One package, one `codepipe` bin, two roles — for solo work you run both on
27
+ your machine with a single command (`codepipe up`):
28
+
29
+ - **CLI** — the local daemon that holds your credentials and performs every
30
+ write (branches, pushes, PRs, tracker updates);
31
+ - **worker** — the agent runner (Claude Code headless) that claims jobs and
32
+ does the analysis/implementation work.
33
+
34
+ ---
35
+
36
+ ## Before you start: the checklist
37
+
38
+ Everything you need in place before `codepipe init`:
39
+
40
+ 1. **Node.js 22+** and **git** on your machine.
41
+
42
+ 2. **Claude Code + a Claude subscription.** Agents run on your Claude
43
+ account. Install [Claude Code](https://claude.com/claude-code), make sure
44
+ `claude` is on `PATH`, then run `claude setup-token` and copy the token
45
+ (`sk-ant-…`) — the setup wizard will ask for it.
46
+
47
+ 3. **A YouTrack project.** You need three things:
48
+ - the instance URL (e.g. `https://yourteam.youtrack.cloud`);
49
+ - a permanent token: YouTrack → your avatar → *Account Security* →
50
+ *Tokens* → *New token…*;
51
+ - the project key (e.g. `DEV`).
52
+
53
+ The project must have a **`Stage` custom field** (enum) — that is the
54
+ column set CodePipe reads and moves. The default config expects at least
55
+ the values `Backlog`, `Develop` and `Review`: tasks in `Develop` enter the
56
+ pipeline, `Backlog` shows up as the dashboard TODO section, and `Review`
57
+ is where a task is moved once its PR is open. (Column names are
58
+ configurable later in `.codepipe/project.yaml` / `regimen.yaml`.)
59
+
60
+ 4. **A project repository** on **GitHub, GitLab or Bitbucket** — empty or
61
+ with existing code, both work — and an access token for that host:
62
+ - **GitHub**: a classic PAT with `repo` + `workflow`, or a fine-grained
63
+ PAT with *Administration RW + Contents RW + Workflows RW + Metadata R*
64
+ (Administration is what lets the wizard create the Context Repo for
65
+ you; if the repos live in an org, approve the token in the org
66
+ settings);
67
+ - **GitLab**: a PAT with `api` (or `read_api` + `write_repository`);
68
+ - **Bitbucket**: your Atlassian account email + a scoped API token
69
+ (id.atlassian.com → *Security* → *API tokens* → *Create API token with
70
+ scopes*, app *Bitbucket*): `read:account`, `read:repository` +
71
+ `write:repository`, `write:pullrequest`, plus `admin:repository` so the
72
+ wizard can create the Context Repo.
73
+
74
+ 5. **A CodePipe account** — nothing to prepare: it is created automatically
75
+ during setup from your email. During the beta, new accounts wait for
76
+ operator approval (you get an email when it happens).
15
77
 
16
78
  ## Install
17
79
 
@@ -19,72 +81,128 @@ bin, two roles:
19
81
  npm i -g @code-partner/codepipe
20
82
  ```
21
83
 
22
- Requires Node.js 22+. (`@code-partner/devpipe-cli` and
23
- `@code-partner/devpipe-sandbox` are deprecated aliases of this package.)
84
+ (`@code-partner/devpipe-cli` and `@code-partner/devpipe-sandbox` are
85
+ deprecated aliases of this package.)
86
+
87
+ ## Step 1 — register the project: `codepipe init`
24
88
 
25
- ## Quick start
89
+ Two ways to start, depending on where your code is:
26
90
 
27
91
  ```bash
92
+ # A) fresh workspace — repos will be cloned for you
28
93
  mkdir ~/Projects/acme && cd ~/Projects/acme
29
- codepipe init # magic-link auth; HUB creates the project + Context Repo,
30
- # clones it into .codepipe/, clones project repos as siblings,
31
- # stores secrets in ~/.codepipe/secrets/<project>.json
32
- codepipe up # CLI daemon + embedded worker in one command, or:
33
- codepipe # open the REPL with an embedded daemon
94
+ codepipe init
95
+
96
+ # B) you already have the code checked out — run it inside the repo
97
+ cd ~/Projects/acme-api
98
+ codepipe init
34
99
  ```
35
100
 
36
- Already have the code checked out? Run `codepipe init` **inside the repo**: it
37
- detects `origin`, prefills the wizard (host/owner/name, project id, default
38
- branch) and registers the checkout in place `.codepipe/` is created inside
39
- the repo (offered for the repo's `.gitignore`), no sibling clone, and the
40
- usual indexing step picks up the existing code.
101
+ In case B the wizard detects `origin`, prefills the repo questions and
102
+ registers the checkout in place no duplicate clone; `.codepipe/` is created
103
+ inside the repo and offered for its `.gitignore`.
104
+
105
+ The wizard asks, in order (Ctrl+C is safe at any point — a re-run resumes
106
+ from where you stopped):
41
107
 
42
- `codepipe up` is the solo-developer mode: it supervises the CLI daemon and an
43
- embedded worker together. The worker is an ordinary SANDBOX (HUB queue, sealed
44
- cred-bundles no local shortcuts); it auto-registers on first run using an
45
- account-issued token (no dashboard visit) and its cred-channel key is pinned
46
- automatically the fingerprint is read locally, not relayed through the HUB.
108
+ 1. **Where should this project run** pick `local` for solo work (`farm` is
109
+ for hosting the daemon on a separate always-on machine).
110
+ 2. **HUB URL** accept the default unless you self-host.
111
+ 3. **Your account email** a browser tab opens to confirm this CLI with one
112
+ click; no account yet means one is created and confirmed by email (plus
113
+ operator approval during the beta — the wizard waits, and it is safe to
114
+ Ctrl+C and re-run later).
115
+ 4. **Project id and name** — a short slug (e.g. `acme`) and a display name.
116
+ 5. **Automation level** — `assisted`: every phase starts only when you press
117
+ Run on the dashboard (recommended to learn the ropes); `full`: tasks run
118
+ end-to-end to a PR, pausing only at gates you keep. You can change it
119
+ later.
120
+ 6. **YouTrack URL, token and project key** — checked live before moving on.
121
+ 7. **Allow CodePipe to write to YouTrack?** — yes: it moves tasks between
122
+ columns and comments the PR link; no: YouTrack stays strictly read-only
123
+ (you move cards yourself).
124
+ 8. **Project repositories** — paste a clone URL per repo; the host token is
125
+ asked once per host and verified live. Connect one repo or several.
126
+ 9. **Context Repo** — the git repo where CodePipe keeps its prompts,
127
+ knowledge base and task artifacts (analysis, patches). Accept the default
128
+ name and the wizard **creates it next to your first project repo**; or
129
+ attach to an existing one.
130
+ 10. **Your YouTrack login** — only tasks assigned to you enter the pipeline
131
+ (lift the filter later with `require_assignee: false` in
132
+ `.codepipe/project.yaml`).
133
+ 11. **Claude OAuth token** — paste the `claude setup-token` output. Skippable,
134
+ but no agent job runs until you set it (`codepipe login` does it later).
47
135
 
48
- Continuing on another machine:
136
+ Then init does the actual setup — this is the "first run" work:
137
+
138
+ - **creates (or attaches to) the Context Repo** on your git host and
139
+ scaffolds it;
140
+ - **registers the project on the HUB** under your account (re-running init
141
+ on an existing project is safe — it reuses it);
142
+ - **clones the Context Repo** into `.codepipe/` and writes your local config
143
+ next to it: `project.yaml` (repos, board columns, sync rules) and
144
+ `regimen.yaml` (automation, gates, build/CI loops) — plain YAML you can
145
+ edit any time;
146
+ - **clones the project repos** as siblings of `.codepipe/` (skipped for an
147
+ in-place init — your checkout is the workspace);
148
+ - **saves secrets** to `~/.codepipe/secrets/<project>.json` (mode 0600 —
149
+ tokens never land in a repo);
150
+ - **offers to index the codebase** — a one-time agent job that writes
151
+ `knowledge/INDEX.md` into the Context Repo, a map of your code that makes
152
+ every later analysis faster and better grounded. Say yes; it runs in the
153
+ background once the daemon and worker are up.
154
+
155
+ ## Step 2 — start it: `codepipe up`
49
156
 
50
157
  ```bash
51
- mkdir ~/Projects/acme && cd ~/Projects/acme
52
- codepipe clone acme # re-clone the workspace; re-enter your tokens
158
+ cd ~/Projects/acme # the folder you ran init in
159
+ codepipe up
53
160
  ```
54
161
 
55
- ## Worker (SANDBOX runner)
162
+ One command, both roles: the CLI daemon connects to the HUB, and an embedded
163
+ agent worker registers itself automatically on the first run (no dashboard
164
+ visit, no manual tokens) and starts claiming jobs. Leave it running while you
165
+ work; Ctrl+C stops both.
56
166
 
57
- On a terminal, `codepipe worker` on an unregistered machine opens an
58
- **interactive wizard**: log in by email (magic-link, like
59
- `codepipe init`) or reuse this machine's CLI account, pick "all my projects"
60
- or a subset, and the wizard registers the runner and starts the claim-loop.
61
- Runners are bound to your account and only serve your projects.
167
+ Prefer a terminal UI? `codepipe` (no arguments) opens an interactive REPL
168
+ with the daemon embedded see the command list below.
62
169
 
63
- Headless servers register non-interactively flags or env vars:
170
+ ## Step 3run your first task
64
171
 
65
- ```bash
66
- codepipe worker register \
67
- --hub https://hub.example.com \ # env CODEPIPE_HUB_URL
68
- --token <registration token> \ # env CODEPIPE_WORKER_REG_TOKEN
69
- --llm claude-headless # env CODEPIPE_WORKER_LLM
70
- # --name / CODEPIPE_WORKER_NAME, --projects / CODEPIPE_WORKER_PROJECTS
71
- # prints the key fingerprint confirm it on the CLI (pin-on-register)
172
+ 1. Open the dashboard (your HUB URL) and sign in with the same email — your
173
+ project card is there, with the setup/index progress on it.
174
+ 2. In YouTrack, take a task, **assign it to yourself** and move it to
175
+ **`Develop`** (or create it in `Backlog` and press *Develop* on the
176
+ dashboard card).
177
+ 3. Watch it on the board: the agent analyzes the task and produces
178
+ `SOLUTION.md` (+ questions, if any). In `assisted` mode press **Run** to
179
+ start each phase.
180
+ 4. **Review gate:** read the proposed solution, then Approve — or Reject
181
+ with a comment and get a revised one.
182
+ 5. The agent implements, the build check runs lint/build/tests, and after
183
+ your second approval the CLI pushes the branch and **opens the PR**
184
+ (task moves to `Review` with a PR-link comment, if writes are on).
185
+ 6. Want changes after reviewing the PR? Comment in the YouTrack task:
72
186
 
73
- codepipe worker # connect to HUB and run the claim-loop (= worker start)
74
- ```
187
+ ```
188
+ @codepipe rework: use the existing retry helper instead of a new one
189
+ ```
75
190
 
76
- The worker config lives at `~/.codepipe/worker/config.json`
77
- (`--profile <id>` → `~/.codepipe/worker/profiles/<id>/config.json`;
78
- `CODEPIPE_SANDBOX_CONFIG` overrides). A pre-existing registration at the old
79
- `~/.devpipe-sandbox/config.json` keeps working without a re-register.
191
+ The task loops back through analysis to an updated PR.
80
192
 
81
- For the agent backend, Claude Code (`claude`) must be on `PATH`. On a fresh
82
- Linux server use the installer served by your HUB instead
83
- (`curl -fsSL https://<your-hub>/install-sandbox.sh | sudo bash -s -- …`) —
84
- it also sets up Node 22, the agent toolchain, rootless Podman, an isolated
85
- `devpipe` user and systemd units.
193
+ ## Day-to-day commands
194
+
195
+ ```
196
+ codepipe up daemon + agent worker in one process (solo mode)
197
+ codepipe interactive REPL with an embedded daemon
198
+ codepipe daemon headless daemon (launchd/systemd; --profile for multi-project)
199
+ codepipe sync clone/fetch the project repos per project.yaml
200
+ codepipe login set/replace the Claude token (--shared for machine-wide)
201
+ codepipe clone <id> reconstruct the workspace on another machine
202
+ codepipe worker … run the agent worker separately (see below)
203
+ ```
86
204
 
87
- ## REPL commands
205
+ REPL commands:
88
206
 
89
207
  ```
90
208
  /status connection, project, Context Repo branch, siblings
@@ -99,28 +217,59 @@ it also sets up Node 22, the agent toolchain, rootless Podman, an isolated
99
217
  /quit stop the daemon and exit
100
218
  ```
101
219
 
102
- `/apply` and `/unstash` work when the project's `project.yaml` sets
103
- `apply.mode: local` (or a task is overridden with `@codepipe apply: local`).
104
- In that mode HUB never pushes for you — you review the staged change, commit,
105
- push and open the PR yourself, then `/applied <key> --pr <url>`.
220
+ `/apply` and `/unstash` support the **local apply mode** (`apply.mode: local`
221
+ in `project.yaml`, or per-task with `@codepipe apply: local`): CodePipe never
222
+ pushes for you — you review the staged change locally, commit, push and open
223
+ the PR yourself, then `/applied <key> --pr <url>`.
106
224
 
107
- ## Other commands
225
+ ## Running the worker elsewhere (optional)
108
226
 
227
+ Solo mode embeds the worker, but you can also run it on a separate machine —
228
+ a desktop with spare cores, a home server, a cloud box:
229
+
230
+ ```bash
231
+ codepipe worker # interactive wizard on an unregistered machine
109
232
  ```
110
- codepipe up CLI daemon + embedded worker (solo-developer mode)
111
- codepipe daemon headless WS daemon (launchd/systemd; --profile for multi-project)
112
- codepipe sync materialise sibling repos without opening the REPL
113
- codepipe worker register register this machine as a SANDBOX worker
114
- codepipe worker start claim-loop (also the default: `codepipe worker`)
233
+
234
+ Log in by email, pick "all my projects" or a subset — runners are bound to
235
+ your account and only serve your projects. Headless servers register
236
+ non-interactively:
237
+
238
+ ```bash
239
+ codepipe worker register \
240
+ --hub https://hub.example.com \ # env CODEPIPE_HUB_URL
241
+ --token <registration token> \ # env CODEPIPE_WORKER_REG_TOKEN
242
+ --llm claude-headless # env CODEPIPE_WORKER_LLM
243
+ # --name / CODEPIPE_WORKER_NAME, --projects / CODEPIPE_WORKER_PROJECTS
244
+ # prints the key fingerprint — confirm it on the CLI (pin-on-register)
245
+
246
+ codepipe worker # connect to HUB and run the claim-loop (= worker start)
115
247
  ```
116
248
 
249
+ The worker config lives at `~/.codepipe/worker/config.json`
250
+ (`--profile <id>` → `~/.codepipe/worker/profiles/<id>/config.json`;
251
+ `CODEPIPE_SANDBOX_CONFIG` overrides). For the agent backend, Claude Code
252
+ (`claude`) must be on `PATH`. On a fresh Linux server use the installer
253
+ served by your HUB instead
254
+ (`curl -fsSL https://<your-hub>/install-sandbox.sh | sudo bash -s -- …`) —
255
+ it also sets up Node 22, the agent toolchain, rootless Podman, an isolated
256
+ `devpipe` user and systemd units.
257
+
117
258
  ## Where things live
118
259
 
119
- - `.codepipe/` in the workspace — the cloned Context Repo plus runtime state
120
- (`session.log`, `apply-queue.json`, both gitignored).
121
- - Project repos — siblings of `.codepipe/`, ordinary clones over SSH.
260
+ - `.codepipe/` in the workspace — the cloned Context Repo, your local
261
+ `project.yaml` / `regimen.yaml`, plus runtime state (gitignored).
262
+ - Project repos — siblings of `.codepipe/` (or the checkout itself for an
263
+ in-place init).
122
264
  - `~/.codepipe/secrets/<project>.json` — tokens, mode 0600, never in a repo.
123
- - `~/.codepipe-sandbox/config.json` — worker registration (HUB URL, sandbox
124
- ID, keypair), mode 0600; `~/.codepipe-sandbox/repos/` — read-only repo cache.
265
+ - `~/.codepipe/worker/config.json` — worker registration (HUB URL, runner
266
+ id, keypair), mode 0600.
267
+
268
+ ## Continuing on another machine
269
+
270
+ ```bash
271
+ mkdir ~/Projects/acme && cd ~/Projects/acme
272
+ codepipe clone acme # re-clone the workspace; re-enter your tokens
273
+ ```
125
274
 
126
275
  See the platform docs for architecture and the pipeline state machine.