coc-git 2.7.10 → 2.7.12
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/AGENTS.md +61 -0
- package/Readme.md +18 -0
- package/history.md +9 -1
- package/lib/index.js +607 -163
- package/package.json +11 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
## Repository purpose
|
|
4
|
+
|
|
5
|
+
`coc-git` is the Git integration extension for `coc.nvim`. Its runtime entry point is `src/index.ts`; the published entry point is the bundled `lib/index.js`. The extension owns Git-backed buffer state, gutters and blame text, conflict actions, Coc lists, GitHub/GitLab issue completion, and the commands/keymaps declared in `package.json`.
|
|
6
|
+
|
|
7
|
+
## Code map
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
- `src/index.ts` is the activation and registration layer. Register new Coc commands, `<Plug>` keymaps, lists, completion providers, and disposables here.
|
|
11
|
+
- `src/manager.ts` coordinates editor events, live `GitBuffer` instances, configuration, and user-facing operations.
|
|
12
|
+
- `src/model/git.ts` is the low-level child-process wrapper around the configured Git executable.
|
|
13
|
+
- `src/model/repo.ts` implements repository-scoped Git operations; put Git command construction and output parsing there rather than in the activation layer.
|
|
14
|
+
- `src/model/resolver.ts` resolves documents and working directories to repositories and relative paths.
|
|
15
|
+
- `src/model/buffer.ts` owns per-buffer diffs, signs, blame, folds, and conflict state.
|
|
16
|
+
- `src/model/service.ts` owns resolver/repository lifetimes and constructs `GitBuffer` instances.
|
|
17
|
+
- `src/lists/` contains Coc list implementations (`gstatus`, `gfiles`, `gchanges`, `gchunks`, `branches`, `commits`, and `bcommits`). List-specific actions and rendering belong in the corresponding list class.
|
|
18
|
+
- `src/source.ts` implements GitHub/GitLab issue loading plus the `issues` list/completion source.
|
|
19
|
+
- `src/types.ts` is the shared contract for diffs, conflicts, and the configuration object passed into buffer/model code.
|
|
20
|
+
- `package.json` is also the Coc extension manifest: command names, activation, and all user-visible configuration schemas live there.
|
|
21
|
+
- `Readme.md` documents the public commands, keymaps, lists, environment variables, and settings.
|
|
22
|
+
|
|
23
|
+
## Public-contract synchronization
|
|
24
|
+
|
|
25
|
+
When changing a user-facing feature, update every surface that represents the same contract:
|
|
26
|
+
|
|
27
|
+
- A new `git.*` command needs a `commands.registerCommand` registration in `src/index.ts` and an entry under `contributes.commands` in `package.json`. Add it to `Readme.md` when it is intended for direct use.
|
|
28
|
+
- A new `<Plug>(coc-git-...)` mapping needs a `workspace.registerKeymap` registration in `src/index.ts` and matching usage documentation in `Readme.md`.
|
|
29
|
+
- A new `git.*` setting needs a schema entry under `contributes.configuration.properties` in `package.json`, a typed field in `src/types.ts` when consumed beyond the registration layer, and loading/default logic in `DocumentManager.loadConfiguration()` in `src/manager.ts`. Keep defaults identical across those locations and `Readme.md`.
|
|
30
|
+
- A new list must be implemented under `src/lists/`, registered through `listManager` in `src/index.ts`, and added to the documented list names.
|
|
31
|
+
- Preserve the exported `ExtensionApi` shape in `src/index.ts` unless the API change is intentional; other Coc extensions can consume `git`, `resolver`, and `manager` from activation.
|
|
32
|
+
|
|
33
|
+
## Git and editor behavior
|
|
34
|
+
|
|
35
|
+
- Use the configured executable discovered from `git.command`; do not hard-code an executable path. Model-layer Git execution should flow through `Git`, `GitRepo`, or the existing command helpers.
|
|
36
|
+
- Keep Git work asynchronous. Do not introduce synchronous child-process calls into buffer refresh, cursor movement, completion, or list loading paths.
|
|
37
|
+
- Pass arguments as arrays to `Git.exec`, `Git.stream`, or `spawnCommand` when filenames or revisions are involved. The repository already supports paths containing spaces; avoid building an unescaped shell string unless the operation specifically requires an interactive terminal command.
|
|
38
|
+
- Preserve cancellation and disposal behavior around spawned processes and Coc event listeners. Anything registered during activation or manager construction must be owned by the existing `subscriptions`/`disposables` lifecycle.
|
|
39
|
+
- Buffer refreshes are event-driven (`TextChange`, writes when realtime gutters are disabled, `FocusGained`, and `BufEnter`). Changes to diff or blame behavior must account for stale async results and for buffers disposed while repository resolution is still running.
|
|
40
|
+
- Keep Vim and Neovim compatibility. Virtual text, floating windows, namespaces, terminal operations, and popup behavior must retain the existing capability checks or Coc abstractions; do not use a Neovim-only API on an unconditional path.
|
|
41
|
+
- Git output is normalized under `LC_ALL`/`LANG=en_US.UTF-8` and decoded through `iconv-lite`. Parsing code must not depend on the user's localized Git messages.
|
|
42
|
+
- GitHub issue access uses `GITHUB_API_TOKEN`; GitLab access uses `GITLAB_PRIVATE_TOKEN` and `git.gitlab.hosts`. Do not log tokens or put them into rendered list/completion items.
|
|
43
|
+
|
|
44
|
+
## Generated output and dependencies
|
|
45
|
+
|
|
46
|
+
- Do not edit or commit `lib/index.js`; `lib/` is generated and ignored. Change TypeScript under `src/` and rebuild it with `npm run build`.
|
|
47
|
+
- `esbuild.js` must continue to bundle `src/index.ts` for Node while leaving `coc.nvim` external. The bundle target is `node10.12`; avoid emitting runtime syntax or APIs that violate that target unless the target is deliberately raised.
|
|
48
|
+
- Use npm for dependency and lockfile changes. CI installs with `npm ci`, so `package.json` and `package-lock.json` must stay synchronized.
|
|
49
|
+
- `npm run lint` is TypeScript checking (`tsc -p tsconfig.json`), not an ESLint formatting pass. The project enables `noUnusedLocals` and emits nothing during this check.
|
|
50
|
+
|
|
51
|
+
## Verification
|
|
52
|
+
|
|
53
|
+
Run checks according to the affected subsystem:
|
|
54
|
+
|
|
55
|
+
- Type/config/registration changes: `npm run lint` and `npm run build`.
|
|
56
|
+
- Git parsing, repository, buffer, manager, list, source, command, or keymap behavior: `npm test`.
|
|
57
|
+
- Vim-specific behavior: `npm run test:integration:vim`.
|
|
58
|
+
- Neovim-specific behavior: `npm run test:integration:nvim`.
|
|
59
|
+
- Changes intended to pass CI must succeed in both editor variants. The GitHub Actions matrix uses Node 22 and runs typechecking plus the Vim and Neovim integration suites.
|
|
60
|
+
|
|
61
|
+
For manual editor verification, load the rebuilt extension through Coc and exercise the exact public surface changed: the relevant `:CocCommand git.*`, `<Plug>(coc-git-*)` mapping, `:CocList` list, gutter/blame update, conflict action, or issue completion flow. Use a temporary Git repository containing the required staged, unstaged, untracked, renamed, conflicted, or non-UTF-8-path state rather than testing against this checkout's working tree.
|
package/Readme.md
CHANGED
|
@@ -152,6 +152,8 @@ In your vim/neovim, run command:
|
|
|
152
152
|
|
|
153
153
|
- `git.commitFiles.splitCommand`: Command used to open the changed-files TreeView for a commit, default: `"belowright 40vs"`
|
|
154
154
|
|
|
155
|
+
- `git.statusTree.splitCommand`: Command used to open the Git status TreeView, default: `"belowright 40vs"`
|
|
156
|
+
|
|
155
157
|
- `git.floatConfig`: Configure style of float window/popup, extends from floatFactory.floatConfig, default: `{}`.
|
|
156
158
|
|
|
157
159
|
- `git.gitlab.hosts`: Custom GitLab hosts, default: `["gitlab.com"]`
|
|
@@ -279,6 +281,7 @@ related commands.
|
|
|
279
281
|
- `:CocCommand git.copyUrl` Copy url of current line to clipboard.
|
|
280
282
|
- `:CocCommand git.copyPermalink` Copy a permalink for the current line to clipboard.
|
|
281
283
|
- `:CocCommand git.refresh` Refresh Git information for all buffers.
|
|
284
|
+
- `:CocCommand git.statusTree` Open files reported by Git status in a TreeView. File nodes show staged and unstaged status; opening a file jumps to its first changed line when Git can determine one.
|
|
282
285
|
- `:CocCommand git.nextChunk` Navigate to the next chunk.
|
|
283
286
|
- `:CocCommand git.prevChunk` Navigate to the previous chunk.
|
|
284
287
|
- `:CocCommand git.chunkInfo` Show chunk info under cursor.
|
|
@@ -351,6 +354,21 @@ line with a commit.
|
|
|
351
354
|
|
|
352
355
|
Use `git.commitFiles.splitCommand` to configure how the TreeView split opens.
|
|
353
356
|
|
|
357
|
+
#### Git Status TreeView
|
|
358
|
+
|
|
359
|
+
Use `:CocCommand git.statusTree` to display staged, unstaged, conflicted, and
|
|
360
|
+
untracked files grouped by directory. Each file shows Git's two-column status
|
|
361
|
+
and a readable staged/unstaged description. Press `<CR>` on a file to open its
|
|
362
|
+
working-tree version in the previous editor window. For tracked files, the
|
|
363
|
+
cursor moves to the first changed line when Git provides a diff location;
|
|
364
|
+
otherwise it opens at line 1. Files deleted from the working tree open the
|
|
365
|
+
read-only `HEAD` version through the `coc-git:` scheme. The root node refreshes
|
|
366
|
+
the status snapshot. File actions follow each file's status: `Add` stages
|
|
367
|
+
unstaged or untracked files, `Restore staged changes` unstages a file, and
|
|
368
|
+
`Restore working tree changes` discards its tracked working-tree changes.
|
|
369
|
+
|
|
370
|
+
Use `git.statusTree.splitCommand` to configure how the TreeView split opens.
|
|
371
|
+
|
|
354
372
|
For more advance usage, checkout `:h coc-list`.
|
|
355
373
|
|
|
356
374
|
### Issue autocomplete from multiple GitHub repositories
|
package/history.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## 2.7.12
|
|
2
|
+
|
|
3
|
+
- fix: address audited git workflow issues (eb6ee85)
|
|
4
|
+
|
|
5
|
+
## 2.7.11
|
|
6
|
+
|
|
7
|
+
- add AGENTS.md (34ea156)
|
|
8
|
+
- feat: add git status tree view (4bc3f6e)
|
|
9
|
+
|
|
1
10
|
## 2.7.10
|
|
2
11
|
|
|
3
12
|
- docs: add MIT license (172bdca)
|
|
@@ -5,7 +14,6 @@
|
|
|
5
14
|
|
|
6
15
|
## 2.7.9
|
|
7
16
|
|
|
8
|
-
- add a read-only TreeView for files changed by a commit
|
|
9
17
|
- show complete commit files as decorated coc-git virtual documents with chunk navigation
|
|
10
18
|
- docs: add coc-git logo (992064f)
|
|
11
19
|
- feat: show staged git gutters and navigate chunks (9410092)
|