This document describes the Git backend implementation in Git/.
The plugin implements the backend JSON-RPC contract (plugin.* and vcs.*)
through @openvcs/sdk/runtime delegates and exposes a single VCS backend id:
git.
- Git operations run directly through the local
gitCLI. - The runtime uses a trust model (no per-capability prompts).
- The plugin currently uses System Git only.
- TypeScript source lives under
src/and compiles into the packagedbin/runtime files. - Shared transport, JSON-RPC framing, host notifications, and exact-method
delegate dispatch now live in
SDK/; this module keeps only Git session state, git subprocess execution, parsers, and Git-specificvcs.*handlers. src/plugin-request-handler.tsnow exportsGitVcsDelegates, aVcsDelegateBasesubclass whose ordinary camelCase methods are mapped to the exactvcs.*JSON-RPC method names consumed by the runtime.- Status reads use
git status --porcelain=1 --branch -z -uallso file paths are NUL-delimited and not C-quoted. - After porcelain parsing, the plugin cross-references
.gitmodulespaths so tracked submodule entries are surfaced with a dedicated submodule status marker for the client UI. - For rename and copy records, the porcelain format includes two NUL-terminated
paths: the original/source path first, then the new/destination path. The
plugin assigns
pathto the new path andold_pathto the original path. - Network commands (
fetch,push,pull) omit optional arguments (remote, refspec, branch) when not provided, allowing Git to use its defaults instead of receiving empty string arguments. - Clone uses
git clone --recurse-submodulesso repositories arrive with submodules initialized by default. - The Repository menu submodule toolkit keeps pinned
git submodule updatebehavior separate from explicit--remoteupdates that follow the configured branch in.gitmodules.
The plugin stores lightweight runtime state:
- active session map (
session_id -> workdir)
package.json.openvcs declares:
module.exec:openvcs-git-plugin.jsmodule.vcs_backends:gitbin/plugin.js: compiled author module exportingOnPluginStart()
This plugin is published and consumed as an npm package with these runtime files:
openvcs.git/
package.json
bin/openvcs-git-plugin.js (SDK-generated bootstrap, entry point)
bin/plugin.js (authored module with PluginDefinition + OnPluginStart)
bin/plugin-helpers.js
bin/plugin-request-handler.js
bin/plugin-runtime.js
openvcs build now generates bin/openvcs-git-plugin.js as the SDK-owned
bootstrap (referenced by module.exec in the manifest). The authored Git module
lives in src/plugin.ts and compiles to bin/plugin.js, where PluginDefinition
declares runtime options up front and OnPluginStart() validates Git, constructs
GitVcsDelegates, and assigns PluginDefinition.vcs = delegates.toDelegates()
before the SDK runtime starts processing requests.