@openvcs/git-plugin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +66 -0
- package/LICENSE +674 -0
- package/README.md +66 -0
- package/bin/git.js +446 -0
- package/bin/openvcs-git-plugin.js +10 -0
- package/bin/plugin-helpers.js +149 -0
- package/bin/plugin-request-handler.js +336 -0
- package/bin/plugin-runtime.js +38 -0
- package/bin/plugin-types.js +3 -0
- package/bin/plugin.js +53 -0
- package/bin/submodules.js +190 -0
- package/icon.png +0 -0
- package/package.json +48 -0
- package/src/git.ts +615 -0
- package/src/plugin-helpers.ts +184 -0
- package/src/plugin-request-handler.ts +593 -0
- package/src/plugin-runtime.ts +52 -0
- package/src/plugin-types.ts +35 -0
- package/src/plugin.ts +75 -0
- package/src/submodules.ts +219 -0
- package/tsconfig.json +16 -0
package/ARCHITECTURE.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Git Plugin Architecture
|
|
2
|
+
|
|
3
|
+
This document describes the Git backend implementation in `Git/`.
|
|
4
|
+
|
|
5
|
+
## Responsibility
|
|
6
|
+
|
|
7
|
+
The plugin implements the backend JSON-RPC contract (`plugin.*` and `vcs.*`)
|
|
8
|
+
through `@openvcs/sdk/runtime` delegates and exposes a single VCS backend id:
|
|
9
|
+
`git`.
|
|
10
|
+
|
|
11
|
+
## Command execution
|
|
12
|
+
|
|
13
|
+
- Git operations run directly through the local `git` CLI.
|
|
14
|
+
- The runtime uses a trust model (no per-capability prompts).
|
|
15
|
+
- The plugin currently uses System Git only.
|
|
16
|
+
- TypeScript source lives under `src/` and compiles into the packaged `bin/`
|
|
17
|
+
runtime files.
|
|
18
|
+
- Shared transport, JSON-RPC framing, host notifications, and exact-method
|
|
19
|
+
delegate dispatch now live in `SDK/`; this module keeps only Git session
|
|
20
|
+
state, git subprocess execution, parsers, and Git-specific `vcs.*` handlers.
|
|
21
|
+
- `src/plugin-request-handler.ts` now exports `GitVcsDelegates`, a
|
|
22
|
+
`VcsDelegateBase` subclass whose ordinary camelCase methods are mapped to the
|
|
23
|
+
exact `vcs.*` JSON-RPC method names consumed by the runtime.
|
|
24
|
+
- Status reads use `git status --porcelain=1 --branch -z -uall` so file paths are
|
|
25
|
+
NUL-delimited and not C-quoted.
|
|
26
|
+
- For rename and copy records, the porcelain format includes two NUL-terminated
|
|
27
|
+
paths: the original/source path first, then the new/destination path. The
|
|
28
|
+
plugin assigns `path` to the new path and `old_path` to the original path.
|
|
29
|
+
- Network commands (`fetch`, `push`, `pull`) omit optional arguments (remote,
|
|
30
|
+
refspec, branch) when not provided, allowing Git to use its defaults instead
|
|
31
|
+
of receiving empty string arguments.
|
|
32
|
+
|
|
33
|
+
## State
|
|
34
|
+
|
|
35
|
+
The plugin stores lightweight runtime state:
|
|
36
|
+
|
|
37
|
+
- active session map (`session_id -> workdir`)
|
|
38
|
+
|
|
39
|
+
## Manifest
|
|
40
|
+
|
|
41
|
+
`package.json.openvcs` declares:
|
|
42
|
+
|
|
43
|
+
- `module.exec`: `openvcs-git-plugin.js`
|
|
44
|
+
- `module.vcs_backends`: `git`
|
|
45
|
+
- `bin/plugin.js`: compiled author module exporting `OnPluginStart()`
|
|
46
|
+
|
|
47
|
+
## Packaging
|
|
48
|
+
|
|
49
|
+
This plugin is published and consumed as an npm package with these runtime files:
|
|
50
|
+
|
|
51
|
+
```text
|
|
52
|
+
openvcs.git/
|
|
53
|
+
package.json
|
|
54
|
+
bin/openvcs-git-plugin.js (SDK-generated bootstrap, entry point)
|
|
55
|
+
bin/plugin.js (authored module with PluginDefinition + OnPluginStart)
|
|
56
|
+
bin/plugin-helpers.js
|
|
57
|
+
bin/plugin-request-handler.js
|
|
58
|
+
bin/plugin-runtime.js
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
`openvcs build` now generates `bin/openvcs-git-plugin.js` as the SDK-owned
|
|
62
|
+
bootstrap (referenced by `module.exec` in the manifest). The authored Git module
|
|
63
|
+
lives in `src/plugin.ts` and compiles to `bin/plugin.js`, where `PluginDefinition`
|
|
64
|
+
declares runtime options up front and `OnPluginStart()` validates Git, constructs
|
|
65
|
+
`GitVcsDelegates`, and assigns `PluginDefinition.vcs = delegates.toDelegates()`
|
|
66
|
+
before the SDK runtime starts processing requests.
|