pi-kage 0.3.5 → 0.3.7

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 +40 -21
  2. package/bin/kage.mjs +690 -620
  3. package/package.json +13 -3
package/README.md CHANGED
@@ -8,37 +8,41 @@
8
8
 
9
9
  <p align="center"><img src="./assets/demo.svg" alt="kage demo" width="100%"></p>
10
10
 
11
- `kage` copies your repo into an isolated sibling folder, drops you straight into a **fresh**
12
- [pi](https://github.com/earendil-works) session to work in parallel, and when you're done merges the
13
- clone's new sessions back into the original and dispels the clone.
11
+ `kage` runs multiple AI coding-agent sessions against one repo in parallel. The problem it solves:
12
+ point two agents at the same checkout and they fight over one working tree — editing the same files,
13
+ colliding on branches, tripping over each other's uncommitted changes.
14
+
15
+ Instead of a shared [`git worktree`](https://git-scm.com/docs/git-worktree), kage gives each session
16
+ its own **full copy** of the repo in a sibling folder — its own working tree, its own `.git`. Code
17
+ comes back through git (a PR, or a branch fetch); the agent's session memory comes back through
18
+ `~/.pi`. kage never copies a working tree back onto the origin, so concurrent sessions can't collide.
19
+ And like a real Naruto shadow clone, the clone carries the agent's memory out and returns it on
20
+ dispel (see [How it works](#how-it-works)).
14
21
 
15
22
  ```bash
16
23
  npm install -g pi-kage
17
24
  cd my-app
18
- kage # 🥷 clone ../my-app--kage-<ts>, open a fresh pi (origin history resumable)
25
+ kage # 🥷 clone -> ../my-app--kage-<ts>, open a fresh pi (origin history resumable)
19
26
  # ...work in the clone: commit, push, open a PR, quit pi...
20
27
  kage finish # 💨 merge the clone's new sessions back, delete the clone
21
28
  ```
22
29
 
23
30
  ---
24
31
 
25
- ## The problem
26
-
27
- Running **multiple agent sessions on the same repo at once** is a mess: they edit the same files,
28
- fight over the working tree, and collide on branches. You end up babysitting merge conflicts
29
- instead of shipping.
32
+ ## Why a full copy instead of `git worktree`?
30
33
 
31
- ## The idea
34
+ A worktree is the obvious way to get a second working directory, but every worktree shares the
35
+ repo's single `.git`. For parallel agents that shared `.git` is the problem:
32
36
 
33
- A shadow clone is a **full, independent copy** of the repo like a second engineer on a second
34
- machine. Each parallel session gets its own working tree, branch, commits, and PR. Code merges the
35
- normal way: on GitHub. No local collisions, ever. And like a real Naruto shadow clone, it carries
36
- your memory out and returns it on dispel (see [How it works](#how-it-works)).
37
+ - you can't check out the same branch in two worktrees;
38
+ - stash, refs, config, and the index are shared;
39
+ - a worktree is a clean checkout no `node_modules`, `.env`, `.venv`, or build cache so each one
40
+ needs a full setup pass before the agent can build or run anything.
37
41
 
38
- Why a full folder copy instead of `git worktree`? A worktree shares one `.git`, which means you
39
- can't check out the same branch twice, you share stash/refs, and you get a *fresh* checkout with no
40
- `node_modules` / `.env` / build cache. A real copy avoids all of that. On macOS APFS the copy is a
41
- `cp -c` clonefile (copy-on-write): near-instant and space-free until files diverge.
42
+ A full copy has none of those constraints: independent `.git`, independent branches, and every
43
+ untracked or gitignored file is already in place. The price is disk and copy time which on macOS
44
+ APFS kage avoids with a `cp -c` clonefile (copy-on-write): the clone is near-instant and uses no
45
+ extra space until files actually diverge. Non-reflink filesystems fall back to a full recursive copy.
42
46
 
43
47
  ## Install
44
48
 
@@ -62,7 +66,7 @@ From source:
62
66
 
63
67
  ```bash
64
68
  git clone https://github.com/kid7st/kage
65
- cd kage && npm link
69
+ cd kage && npm install && npm link # `npm install` builds bin/kage.mjs from src/ (TypeScript)
66
70
  ```
67
71
 
68
72
  Requires **git**, [**pi**](https://github.com/earendil-works), and **Node ≥ 18** on your `PATH`.
@@ -168,9 +172,24 @@ pass `--push` / `--pr` / `--force`.
168
172
 
169
173
  ## Development
170
174
 
175
+ The CLI and its tests are written in TypeScript and compiled with `tsc`:
176
+
177
+ - `src/kage.mts` → `bin/kage.mjs` — a single, zero-runtime-dependency file (the only thing the
178
+ install script + npm package ship).
179
+ - `test/kage.test.mts` → `dist/kage.test.mjs` — black-box `node:test` smoke tests that spawn the
180
+ built CLI (compiled to `dist/` so they run on every Node in CI, no TS loader needed).
181
+
182
+ `bin/` and `dist/` are build artifacts — both gitignored. `bin/` is produced on `npm install`
183
+ (via `prepare`), so `npm link` from a clone just works.
184
+
185
+ Linting/formatting is handled by [Biome](https://biomejs.dev) — a dev-only dependency that never
186
+ ships in the package, so the zero-runtime-dependency artifact is unaffected.
187
+
171
188
  ```bash
172
- npm run lint # syntax check
173
- npm test # node:test smoke tests (temp repos, no network)
189
+ npm run build # tsc: src/kage.mts -> bin/kage.mjs
190
+ npm run format # biome: auto-format + safe lint fixes
191
+ npm run lint # biome (lint + format check) + tsc type check (src + test)
192
+ npm test # build CLI + tests, then run node:test smoke tests (temp repos, no network)
174
193
  ```
175
194
 
176
195
  Releases publish automatically: bump `version` in `package.json`, then