Develop Nerve
Requirements: Node.js 24+, pnpm 11.20.0, and rustup. The repository’s rust-toolchain.toml installs the pinned Rust toolchain (currently 1.97.1).
git clone https://github.com/ThilinaTLM/nerve.gitcd nervepnpm installpnpm desktop:devDevelopment commands
Section titled “Development commands”pnpm desktop:dev # isolated source desktop (slot 1)pnpm desktop:prod # source desktop against real user datapnpm dev # daemon + Vite workbenchpnpm dev:ui # UI against a running slot daemonpnpm storage:copy --slot 2 # stopped ~/.nerve -> unused slot 2pnpm build # TypeScript packages and staged Workbench assetspnpm build:native # host Rust addon in packages/native/prebuilds/localpnpm fix # Rust, TypeScript, Svelte, and ESLint fixespnpm check # formatting, lint, boundaries, package and Rust checkspnpm test:focused # select relevant tests with conservative fallbackspnpm run test:full # run the complete package and Rust test suitepnpm dev and pnpm desktop:dev build the host native addon automatically. The desktop command builds only the native addon, Workbench runtime, and desktop shell; use pnpm build when you need every workspace, including the public website. Release prebuilds are separate architecture-specific files and are produced by GitHub Actions.
Development uses data/storage-N and a separate data/desktop-profile-N, with slot 1 as the default. desktop:dev, dev, and dev:ui accept --slot N (1–100). HTTP uses 43967 + 2*(N-1); HTTPS uses the next port; Vite uses 5173 + (N-1). Full development ignores ambient home/profile/target overrides, binds loopback, and refuses occupied ports or mismatched daemon ownership.
For real-data feature/migration testing, stop the production desktop/daemon, run pnpm storage:copy --slot 2, then pnpm desktop:dev --slot 2. To copy an existing slot or archived home instead, stop its desktop/daemon and select its source path:
pnpm storage:copy --from data/storage-0-34-1-do-not-use --slot 4# Or copy a numbered slot:pnpm storage:copy --from data/storage-2 --slot 4pnpm desktop:dev --slot 4Relative source paths resolve from the working directory; absolute paths also work. Omitting --from still selects ~/.nerve. Copies require an unused destination, reject linked storage content, and exclude transient ownership and backup state. Desktop profiles are not copied. Copied credentials and project paths can still access real services/files; storage isolation is not a sandbox. Stop the slot owner before discarding/recopying it. Automated tests continue using fresh temporary homes.
desktop:prod is an explicit source-build launch against ~/.nerve (or an overridden NERVE_HOME), not a release build. It may migrate or change your real data. Installed/npm desktop defaults remain unchanged. See Contributing for safe slot cleanup and ownership rules.
Enable trusted-LAN and mobile HTTPS access from Settings → System → Network, then restart the owned daemon when prompted.
For UI-only development against a running daemon:
NERVE_HOME="$HOME/.nerve" NERVE_API_TARGET=http://127.0.0.1:3747 pnpm dev:uiFor the public site:
pnpm --filter @nervekit/website devpnpm --filter @nervekit/website checkpnpm --filter @nervekit/website buildIsolation
Section titled “Isolation”Use explicit NERVE_HOME, ports, and Electron profile overrides for tests that can migrate or mutate state. The normal profile intentionally sits outside NERVE_HOME; changing only one does not fully isolate a desktop test.
Before completing code changes, repository policy requires pnpm fix && pnpm check && pnpm test:focused. Fix failures and rerun the chain. Docs-only changes need diff/path/command review, not code validation. Use pnpm test:focused --base HEAD to select tests for uncommitted changes; the default includes branch changes against origin/main. Broader validation belongs in CI; run pnpm test:full locally only for a specific concern or explicit request. Run pnpm test:browser separately when browser behavior is relevant.