Node.js SDK
@eidos.space/graft is the in-process integration for Node.js. It uses the
same Rust repository implementation as the CLI, but keeps one
repository session resident across calls.
Use the SDK when your application needs:
- frequent status, history, or diff reads without starting a subprocess;
- typed results and structured error codes;
- cancellable repository operations;
- explicit coordination around operations that replace worktree files.
Use the CLI instead for evaluation, scripts, and short-lived automation.
Install
Section titled “Install”pnpm add @eidos.space/graftThe package supports Node.js 20 and newer and ships prebuilt Node-API 8 binaries for supported macOS, Linux, and Windows targets. Consumers do not need a Rust toolchain or a system SQLite library.
Runtime model
Section titled “Runtime model”- Keep one
RepositorySessionfor each canonical repository path. - Calls on one session run serially; different repositories can run in parallel.
- Keep repository paths, credentials, and the native object outside untrusted UI code.
- Close the session when the application stops using the repository.
Continue
Section titled “Continue” SDK quickstart Open a session, initialize a repository, read status, and commit app state.
Sessions and worktree safety Coordinate SQLite handles, cancellation, repository writers, and shutdown.