sandcastle README

项目的 README,来自 github.com/mattpocock/sandcastle。合并为一个 markdown 文件:README.md。

Sandcastle

What is Sandcastle?

A TypeScript library for orchestrating AI coding agents in isolated sandboxes:

  1. You invoke agents with a single sandcastle.run().
  2. Sandcastle handles sandboxing the agent with a configurable branch strategy.
  3. The commits made on the branches get merged back.

Sandcastle is provider-agnostic. It ships with native sandboxes that use your OS's own process sandbox (Bubblewrap on Linux and WSL2, Seatbelt on macOS), image-based providers for Docker and Podman, and cloud providers for Daytona, E2B, Fly.io Sprites, Modal and Vercel, and you can create your own. Great for parallelizing multiple AFK agents, creating review pipelines, or even just orchestrating your own agents.

Documentation

The docs live in docs/guide, one page per major term, with every term defined in the Glossary, and are published at aihero.dev/sandcastle.

Development

npm install
npm run build    # Bundle with tsup
npm test         # Run tests with vitest
npm run typecheck # Type-check

License

MIT

sandcastle (mattpocock/sandcastle)

正在搜索数据库…

这是什么?Sandcastle 是一个 TypeScript 库,用于在隔离的沙箱中编排 Claude Code 等 AI 编程代理。你只需调用一次 sandcastle.run(),运行产生的提交就会自动合并回你的代码仓库。
这是一个在代码里调用的库,还是独立的命令行应用?它主要是一个 TypeScript 库,通过 run()、interactive() 或 createSandbox() 以编程方式调用;唯一的命令行部分是 init 脚手架工具,它会帮你生成配置文件。
怎么让它跑起来?安装该包,运行 npx @ai-hero/sandcastle init 生成 .sandcastle 目录,在 .sandcastle/.env 中填入你的令牌,然后用 npx tsx 运行 .sandcastle/main.ts。
开始之前需要先装好什么?你需要 Git,以及一个沙箱提供方,例如 Docker Desktop、Podman,或 Vercel 的 Firecracker 微型虚拟机;另外还需要 CLAUDE_CODE_OAUTH_TOKEN(通过 claude setup-token 获取)或 Anthropic API 密钥二者之一。
如果我不想要容器隔离,能完全不用沙箱吗?可以。noSandbox() 提供方会让代理直接在主机上运行,而不是在容器里运行。这样更方便,但会去掉本项目所依托的隔离安全保障。
它自带哪些内置沙箱提供方?内置了 Docker、Podman 和 Vercel(通过 @vercel/sandbox 使用 Firecracker 微型虚拟机)。你也可以用 createBindMountSandboxProvider 或 createIsolatedSandboxProvider 创建自己的提供方。
为什么要用 createSandbox(),而不直接用 run()?createSandbox() 会启动一个容器,你可以在同一分支上让多次代理运行复用它,并在调用之间保留已安装的依赖和构建产物;run() 则适用于单次一次性调用。
代理做出的改动怎么回到我的代码仓库?沙箱中在其分支上产生的提交会合并回主机上的代码仓库。使用 await using 会触发自动清理:如果有未提交的改动,就保留工作树;如果没有改动,就将其删除。
大小
6 MB
星标
9.2K
时长
8个月
提交 · 90 天