- SDK source is authored in
src/and compiled to runtime files inbin/andlib/. - npm package entry is at repo root (
package.json,src/,bin/,lib/,test/). src/bin/openvcs.tscompiles to the executable entrypoint installed by npm (bin/openvcs.js).src/lib/cli.tsroutes subcommands.src/lib/build.tsimplements plugin asset builds (openvcs build).src/lib/init.tsimplements interactive plugin scaffolding (openvcs init).src/lib/fs-utils.tscontains file-copy and path safety helpers.src/lib/runtime/contains the shared Node plugin runtime, JSON-RPC transport, and delegate dispatcher.src/lib/types/contains shared protocol, plugin, host, and VCS contract types.- Build outputs go into plugin runtime files such as
bin/and generated SDKlib/outputs.
- SDK owns plugin runtime asset builds plus Node plugin authoring helpers.
- Plugins are ordinary npm packages that ship
package.jsonwith anopenvcsobject, runtime files underbin/, optionalthemes/, and runtime dependencies fromdependencies. - The canonical host contract still lives in
Client/Backend/src/plugin_runtime/protocol.rs; SDK runtime/types mirror that contract for plugin authors. - Keep manifest fields and bundle structure consistent with host expectations.
npm install(install SDK dependencies).npm run build(compile TypeScript sources tobin/andlib/).npm test(compile then run Node tests vianode --test).npm run openvcs -- <args>(run the local CLI with a prebuild step).openvcs build --plugin-dir /path/to/pluginto build plugin runtime assets.openvcs init [--theme] [dir]to scaffold plugin projects.- Install path for users is npm:
npm install --save-dev @openvcs/sdk. - CI release channels publish npm prereleases on
Beta(beta),Devpush commits (edge), and scheduledDevnightlies (nightly).
- Author code in TypeScript (
src/**/*.ts) targeting Node 18+. - Compiled outputs in
bin/andlib/are generated artifacts; do not edit them manually. - Prefer small, focused modules in
src/lib/and keep files under 1000 lines. - Use clear error messages that include the relevant path/flag/context.
- Keep path validation strict for security-sensitive code paths.
- API surfaces should return rich error messages explaining path, capability, or validation issues.
- Code plugins should expose a
build:pluginnpm script so SDK build can invoke compilation explicitly.
- When you change behavior, workflows, CLI flags, npm packaging expectations, or manifest expectations, ALWAYS update the relevant documentation in the same change, even if the user does not explicitly ask.
- All code files MUST be no more than 1000 lines; split files before they exceed this limit.
- Keep Node tests in
test/near the feature area they validate. - Name tests descriptively and cover bundle safety checks (symlinks, path traversal, native addons).
- Before PRs, run
npm test.
- Use short, imperative commit messages (<=72 chars) such as
sdk: validate manifest fields. - PRs should explain the new workflow, list commands/tests run, and surface any user-visible bundle changes (new capabilities, layout updates, etc.).
- Update this AGENTS whenever SDK workflows or packaging expectations change so the guidance stays fresh.