{"_id":"@agent-trees/atree","_rev":"4-0f15d95d72bbf37711a1684a5604fc6d","name":"@agent-trees/atree","dist-tags":{"latest":"0.4.0"},"versions":{"0.1.0":{"name":"@agent-trees/atree","version":"0.1.0","keywords":["git","worktree","cli","developer-tools","ai","agents"],"license":"MIT","_id":"@agent-trees/atree@0.1.0","maintainers":[{"name":"roro121","email":"rohit121@gmail.com"}],"homepage":"https://github.com/rohit121/agent-trees","bugs":{"url":"https://github.com/rohit121/agent-trees/issues"},"bin":{"atree":"dist/atree.js"},"dist":{"shasum":"a61079cff7ccf19633ec26ce38c5a12b3ca233e0","tarball":"https://registry.npmjs.org/@agent-trees/atree/-/atree-0.1.0.tgz","fileCount":4,"integrity":"sha512-xPYmV1SSgqJ2/aSZGobyfqraCbG0NGtP6ndyoFwzbsC2tH0jMaJpbTUd8YypLOZy2hIkwy9AAe0+BhiaQEiGMQ==","signatures":[{"sig":"MEQCIDSMAxXqqPEnM5THJTekdNKjYAvpbdYXXMTo8+PfTA1xAiBUBUvQe8dEQyjoN6kVHxdGwmd6wd6zh9H8CgTI6D1zcA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1514585},"type":"module","engines":{"node":">=22"},"gitHead":"451662bf7b024f89baee4d42f4d140e7d7d8b4f6","scripts":{"dev":"bun run src/index.ts","build":"bun build src/index.ts --target node --outfile dist/atree.js --banner '#!/usr/bin/env node' && chmod +x dist/atree.js","prepublishOnly":"bun run build"},"_npmUser":{"name":"roro121","email":"rohit121@gmail.com"},"repository":{"url":"git+https://github.com/rohit121/agent-trees.git","type":"git"},"_npmVersion":"10.9.2","description":"Git worktrees for humans and agents","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ink":"^6.8.0","chalk":"^5.6.2","execa":"^9.6.1","react":"^19.2.4","commander":"^14.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5","@types/react":"^19.2.14"},"_npmOperationalInternal":{"tmp":"tmp/atree_0.1.0_1774086602472_0.2506459641733636","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"name":"@agent-trees/atree","version":"0.2.0","keywords":["git","worktree","cli","developer-tools","ai","agents"],"license":"MIT","_id":"@agent-trees/atree@0.2.0","maintainers":[{"name":"roro121","email":"rohit121@gmail.com"}],"homepage":"https://github.com/rohit121/agent-trees","bugs":{"url":"https://github.com/rohit121/agent-trees/issues"},"bin":{"atree":"dist/atree.js"},"dist":{"shasum":"1f04241dca6a56b221f7e4d249e22be9ca6ecf62","tarball":"https://registry.npmjs.org/@agent-trees/atree/-/atree-0.2.0.tgz","fileCount":4,"integrity":"sha512-58pC5kf+5wQ+pjjkdIllvF5oJhzDfRXhxXYd5yk9NTwXwxg2VtTeSI2ru9oL0EEpMQzOZ93P9MFHYCPTrJIgKw==","signatures":[{"sig":"MEYCIQCzZeow4tz8UeUWC5MTio9cth2/32VROSY/Uqqv3J8jLgIhAJzxa+uD1Kd41N4opyqfwQeLRQz1f0ocIIz56uhcwT3N","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1536268},"type":"module","engines":{"node":">=22"},"gitHead":"b14f02ee770cb3472223c1eadfd38c425ecc4992","scripts":{"dev":"bun run src/index.ts","build":"bun build src/index.ts --target node --outfile dist/atree.js --banner '#!/usr/bin/env node' && chmod +x dist/atree.js","prepublishOnly":"bun run build"},"_npmUser":{"name":"roro121","email":"rohit121@gmail.com"},"repository":{"url":"git+https://github.com/rohit121/agent-trees.git","type":"git"},"_npmVersion":"10.9.2","description":"Git worktrees for humans and agents","directories":{},"_nodeVersion":"22.14.0","dependencies":{"ink":"^6.8.0","chalk":"^5.6.2","execa":"^9.6.1","react":"^19.2.4","commander":"^14.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5","@types/react":"^19.2.14"},"_npmOperationalInternal":{"tmp":"tmp/atree_0.2.0_1774264196953_0.38095390483697367","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@agent-trees/atree","version":"0.3.0","keywords":["git","worktree","cli","developer-tools","ai","agents"],"license":"MIT","_id":"@agent-trees/atree@0.3.0","maintainers":[{"name":"roro121","email":"rohit121@gmail.com"}],"homepage":"https://github.com/rohit121/agent-trees","bugs":{"url":"https://github.com/rohit121/agent-trees/issues"},"bin":{"atree":"dist/atree.js"},"dist":{"shasum":"9f4a1e97e982d52ec415eb3f8c178f608fb38668","tarball":"https://registry.npmjs.org/@agent-trees/atree/-/atree-0.3.0.tgz","fileCount":4,"integrity":"sha512-xYzSY+YH/jkWJGlbL0VG4+bEarBAr1zr8up6NKIob+9ErJdVzKZ5xEvXt1WNmXZi3KHSpAIJYjo5BKTruuX9HA==","signatures":[{"sig":"MEYCIQC/CueZu8VBL1VzVe79I7SgY/g45RQDXe9ZMUuoFsZyTwIhAMibithn1NB5CLCx5aGKgVn417/DM3sxAx/gMp42cK0y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":1556080},"type":"module","engines":{"node":">=22"},"gitHead":"c6ec13934f966b641e214906097d3f6e4b409bcc","scripts":{"dev":"bun run src/index.ts","test":"bun test","build":"bun build src/index.ts --target node --outfile dist/atree.js --banner '#!/usr/bin/env node' && chmod +x dist/atree.js","prepublishOnly":"bun run build"},"_npmUser":{"name":"roro121","email":"rohit121@gmail.com"},"repository":{"url":"git+https://github.com/rohit121/agent-trees.git","type":"git"},"_npmVersion":"11.11.0","description":"Git worktrees for humans and agents","directories":{},"_nodeVersion":"25.8.1","dependencies":{"ink":"^6.8.0","chalk":"^5.6.2","execa":"^9.6.1","react":"^19.2.4","commander":"^14.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest","typescript":"^5","@types/react":"^19.2.14"},"_npmOperationalInternal":{"tmp":"tmp/atree_0.3.0_1775761495035_0.12000910817675203","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@agent-trees/atree","version":"0.4.0","description":"Git worktrees for humans and agents","type":"module","bin":{"atree":"dist/atree.js"},"scripts":{"dev":"bun run src/index.ts","build":"bun build src/index.ts --target node --outfile dist/atree.js --banner '#!/usr/bin/env node' && chmod +x dist/atree.js","test":"bun test","prepublishOnly":"bun run build"},"keywords":["git","worktree","cli","developer-tools","ai","agents"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/rohit121/agent-trees.git"},"homepage":"https://github.com/rohit121/agent-trees","bugs":{"url":"https://github.com/rohit121/agent-trees/issues"},"engines":{"node":">=22"},"devDependencies":{"@types/bun":"latest","@types/react":"^19.2.14","typescript":"^5"},"publishConfig":{"access":"public"},"dependencies":{"chalk":"^5.6.2","commander":"^14.0.3","execa":"^9.6.1","ink":"^6.8.0","react":"^19.2.4"},"gitHead":"984ecc9249f5c174f5adfc85b0273da1a7aed53a","_id":"@agent-trees/atree@0.4.0","_nodeVersion":"25.8.1","_npmVersion":"11.11.0","dist":{"integrity":"sha512-DcDTHCxfIAjCp6IbANtIMFLcFYvQZnTkgSk2JwUgKoPRXwmxOGEN1hKfKE4LiQIFsRPRjTvfAAg2paof8C5m9Q==","shasum":"2101d567d8b3602501ea9c093df4fe717fd36ee2","tarball":"https://registry.npmjs.org/@agent-trees/atree/-/atree-0.4.0.tgz","fileCount":4,"unpackedSize":1558081,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDkQavtSA76kaQ9qvxc0rbJmjR3435Fqhefg9UQ/AVKxAIgb85/55aWIRjtrau0Rqknk9lCyAxxmWK82bp8dekgRy8="}]},"_npmUser":{"name":"roro121","email":"rohit121@gmail.com"},"directories":{},"maintainers":[{"name":"roro121","email":"rohit121@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/atree_0.4.0_1775795607413_0.17809735747407096"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-21T09:50:02.392Z","modified":"2026-04-10T04:33:27.763Z","0.1.0":"2026-03-21T09:50:02.671Z","0.2.0":"2026-03-23T11:09:57.157Z","0.3.0":"2026-04-09T19:04:55.176Z","0.4.0":"2026-04-10T04:33:27.636Z"},"bugs":{"url":"https://github.com/rohit121/agent-trees/issues"},"license":"MIT","homepage":"https://github.com/rohit121/agent-trees","keywords":["git","worktree","cli","developer-tools","ai","agents"],"repository":{"type":"git","url":"git+https://github.com/rohit121/agent-trees.git"},"description":"Git worktrees for humans and agents","maintainers":[{"name":"roro121","email":"rohit121@gmail.com"}],"readme":"# Agent Trees\n\n> Git worktrees for humans and agents.\n\n## The new way of building\n\nAI coding agents have changed how we work. Instead of one developer, one branch, one terminal — you're now running **2 or 3 features in parallel**, each with its own agent. One agent is building the auth flow, another is refactoring the API, a third is fixing a bug. All at the same time.\n\nGit supports this with worktrees — separate working directories, each on their own branch, sharing the same repo. But the moment you try to actually use them, you hit a wall:\n\n- Your `.env` files live in the main branch. Each worktree needs them, but they're not there.\n- `node_modules` is 400MB. You don't want to reinstall it for every branch.\n- Your dev server hardcodes port 3000. Three agents, three dev servers — they all fight over the same port.\n- Every new worktree is a fresh checkout with none of the setup your main branch has.\n\nSo instead of parallelism, you end up manually copying files, symlinking directories, and babysitting each agent's environment. The overhead kills the benefit.\n\n**Agent Trees fixes this.** One command to spawn a worktree that's fully wired up — dependencies linked, env files shared, services ready to run.\n\n## How it works\n\n```bash\natree spawn feature-auth\n```\n\nThat's it. Agent Trees:\n\n1. Creates a git worktree for the branch\n2. Symlinks `node_modules` (and any other configured dirs) from your main branch — no reinstall\n3. Symlinks your `.env`, `.env.local` and other config files from your main branch\n4. Runs any `postSpawn` hooks you've configured (migrations, code generation, etc.)\n\nYour agent can immediately `cd` in and start working. No setup, no missing env vars, no port conflicts to resolve manually.\n\n```\nyour-repo/                  ← main branch, primary worktree\nyour-repo-feature-auth/     ← spawned by atree, fully wired up\nyour-repo-fix-payments/     ← spawned by atree, fully wired up\n```\n\n## Install\n\n```bash\nnpm install -g @agent-trees/atree\n# or\nnpx @agent-trees/atree init\n```\n\n**From source:**\n```bash\ngit clone https://github.com/rohit121/agent-trees\ncd agent-trees\nbun install && bun run build\ncp dist/atree.js /usr/local/bin/atree\n```\n\n## Getting started\n\n```bash\natree init\n```\n\n`atree init` walks you through setup interactively:\n\n1. **Explains what it will do** and asks permission before touching anything\n2. **Detects AI agents** you already have installed — `claude`, `codex`, `gemini`, or any custom CLI\n3. **Scans your repo** — reads `package.json`, `Procfile`, `docker-compose.yml`, lock files, and other signals to understand your stack\n4. **For monorepos:** detects workspace packages and lets you pick which ones to include\n5. **Asks the agent** to generate a tailored `atreeconfig.json` for your project\n6. **Shows you the result** and asks for confirmation before writing anything\n\nIf no AI agent is found, it falls back to heuristic detection.\n\n## Usage\n\n```bash\natree init                   # set up agent trees in current repo\natree spawn <branch>         # create a worktree, link deps + env\natree spawn -b <branch>      # create a worktree on a new branch\natree status                 # show all active trees and changed files\natree dev                    # start dev server for current tree\natree dev --all              # start all trees in parallel with prefixed logs\natree sync                   # re-link deps/env if symlinks break\natree kill <branch>          # remove a worktree\natree add <packages...>      # install packages safely via primary worktree\natree add -D <packages...>   # install as dev dependency\natree remove <packages...>   # remove packages safely across worktrees\n```\n\n## Package management across worktrees\n\nWhen dependencies are symlinked from the primary worktree, running `npm install` or `bun add` directly in a feature worktree causes dependency drift — the install writes to the shared `node_modules` but only updates the feature branch's `package.json`. Use `atree add` and `atree remove` instead.\n\n### Adding packages\n\n```bash\natree add stripe              # install in primary, sync to current branch\natree add -D vitest           # add as dev dependency\natree add -w apps/web react   # target a monorepo workspace\n```\n\n`atree add` installs via the primary worktree (where dependencies actually live), then syncs the manifest and lock file back to your current branch. A file lock prevents two agents from racing.\n\n### Removing packages\n\nRemoving is asymmetric by design:\n\n- **From a feature branch:** `atree remove stripe` removes it from your branch's `package.json` only. The package stays in the shared dependency directory so other branches aren't broken. It gets pruned naturally when your branch merges and a clean install runs.\n- **From the primary branch:** `atree remove stripe` checks all active worktrees first. If another branch still uses the package, you'll see a warning and need `--force` to proceed.\n\n### Supported languages\n\n| Ecosystem | Package managers | Shared directory | Manifest file |\n|-----------|-----------------|------------------|---------------|\n| **Node.js** | bun, npm, pnpm, yarn | `node_modules` | `package.json` |\n| **Python** | poetry, uv, pip | `.venv` | `pyproject.toml` |\n| **Rust** | cargo | `target` | `Cargo.toml` |\n| **Go** | go | — | `go.mod` |\n\nAuto-detection uses lock files to pick the right package manager. For projects with multiple ecosystems (e.g. a Node frontend + Python backend), detection is based on the directory you target with `--workspace`.\n\n### Limitations\n\n- **Version conflicts across branches:** Since all worktrees share the same dependency directory, downgrading a package (e.g. `atree add react@17` when `react@18` is installed) affects every branch. `atree add` warns when it detects a version change.\n- **pip lacks structured manifests:** For plain `pip` projects (no `pyproject.toml`), manifest syncing works by file copy rather than structured merge. Consider using `poetry` or `uv` for better dependency management.\n- **Go modules:** Go doesn't have a shared install directory like `node_modules`. `atree add` for Go runs `go get` in the primary worktree and syncs `go.mod`/`go.sum`.\n\n## Config\n\nCommit `atreeconfig.json` to share setup with your team.\n\n### Sharing dependencies and env files\n\nThe `share` array lists directories to symlink from the primary worktree into every spawned tree. The `env.files` array lists files to symlink the same way.\n\n```json\n{\n  \"primary\": \"main\",\n  \"share\": [\"node_modules\"],\n  \"env\": {\n    \"files\": [\".env\", \".env.local\"]\n  },\n  \"hooks\": {\n    \"postSpawn\": \"npm install\"\n  }\n}\n```\n\nSymlinks are visible — they show up in `ls -la`:\n\n```\nlrwxr-xr-x  node_modules -> /path/to/primary/node_modules\nlrwxr-xr-x  .env -> /path/to/primary/.env\n```\n\nBundlers, runtimes, and editors follow symlinks transparently. If something breaks, `git worktree list` and `ls -la` tell you everything.\n\n### Services\n\nThe `services` map defines what `atree dev` starts. Each service has a `command`, an `instance` mode, and an optional `cwd`.\n\n```json\n{\n  \"services\": {\n    \"web\": {\n      \"command\": \"npm run dev\",\n      \"instance\": \"tree\"\n    },\n    \"db\": {\n      \"command\": \"docker compose up db\",\n      \"instance\": \"shared\"\n    }\n  }\n}\n```\n\n| `instance` | behaviour |\n|------------|-----------|\n| `tree`     | one instance per worktree — each branch runs its own |\n| `shared`   | runs once from the primary worktree, all trees share it |\n\nUse `shared` for infrastructure that doesn't change per branch (databases, queues, mock servers). Use `tree` for the code you're actively developing.\n\n### Monorepo support\n\nFor monorepos, `atree init` detects workspace packages and lets you select which ones to include. Each selected package gets its own service entry and its own symlinked `node_modules` (or `.venv` for Python).\n\n```json\n{\n  \"primary\": \"main\",\n  \"share\": [\"node_modules\", \"apps/web/node_modules\", \"apps/api/node_modules\"],\n  \"env\": {\n    \"files\": [\".env\", \"apps/web/.env\", \"apps/api/.env\"]\n  },\n  \"services\": {\n    \"db\": {\n      \"command\": \"docker compose up db\",\n      \"instance\": \"shared\"\n    },\n    \"api\": {\n      \"command\": \"npm run dev\",\n      \"instance\": \"shared\",\n      \"cwd\": \"apps/api\"\n    },\n    \"web\": {\n      \"command\": \"npm run dev\",\n      \"instance\": \"tree\",\n      \"cwd\": \"apps/web\"\n    }\n  }\n}\n```\n\nThis is the key pattern for monorepos: mark the services you're not changing as `shared` so they run once from the primary tree, and only run `tree` instances for the packages you're actively developing. When you spawn a feature branch, `atree dev` starts only the `tree` services — the rest are already running.\n\n### Hooks\n\n```json\n{\n  \"hooks\": {\n    \"postSpawn\": \"npm install\",\n    \"preKill\": \"npm run cleanup\"\n  }\n}\n```\n\n`postSpawn` runs inside the new worktree immediately after it's created — good for installing deps, running migrations, or generating code.\n\n## What gets checked in\n\n```\natreeconfig.json    ✅  shared team config\n.atree/             ❌  machine-local (added to .gitignore by atree init)\n```\n\n## Requirements\n\n- git >= 2.25\n- Node >= 22\n\n## Development\n\n```bash\nbun install\nbun run dev -- init        # run any command locally\nbun run build              # bundle to dist/atree.js\n```\n\n## License\n\nMIT\n","readmeFilename":"README.md"}