plugin-git-manager 1.2.27 → 1.2.28
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/README.md +133 -108
- package/client-v2.d.ts +2 -2
- package/client-v2.js +1 -1
- package/client.d.ts +3 -3
- package/client.js +1 -1
- package/dist/client/{326.90c276058682b536.js → 313.d38fc1d40c4589b9.js} +1 -1
- package/dist/client/900.a48beac7e2ebee7d.js +10 -0
- package/dist/client/index.js +1 -1
- package/dist/client-v2/156.445366026c1cc9a8.js +10 -0
- package/dist/client-v2/{326.42b7b53651ffab3a.js → 313.3c867179c3a1e817.js} +1 -1
- package/dist/client-v2/434.19c7579c06b9077c.js +10 -0
- package/dist/client-v2/900.e6155002a9c97e7f.js +10 -0
- package/dist/client-v2/928.bba701b5a1ece58e.js +10 -0
- package/dist/client-v2/index.js +1 -1
- package/dist/externalVersion.js +9 -8
- package/dist/locale/en-US.json +307 -297
- package/dist/locale/vi-VN.json +295 -292
- package/dist/locale/zh-CN.json +61 -51
- package/dist/node_modules/simple-git/dist/cjs/index.js +25 -25
- package/dist/node_modules/simple-git/package.json +1 -1
- package/dist/node_modules/zod/index.cjs +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/actions/git-actions.js +90 -36
- package/dist/server/actions/gitlab-api.js +4 -2
- package/dist/server/actions/poller.js +5 -2
- package/dist/server/actions/review.js +20 -10
- package/dist/server/plugin.js +6 -4
- package/dist/server/poller.js +46 -45
- package/dist/server/request-method-policy.js +75 -0
- package/dist/server/services/registry-content-service.js +4 -3
- package/dist/server/utils/get-repo-account.js +3 -2
- package/dist/server/utils/url-security.js +24 -0
- package/package.json +61 -43
- package/server.d.ts +2 -2
- package/server.js +1 -1
- package/src/client/__tests__/RunReviewButton.test.tsx +73 -0
- package/src/client/ai-context.tsx +114 -114
- package/src/client/components/AIEmployeeSelect.tsx +63 -63
- package/src/client/components/CommitHistory.tsx +374 -374
- package/src/client/components/FileExplorer.tsx +386 -386
- package/src/client/components/GitAccounts.tsx +179 -179
- package/src/client/components/GitManagerSettings.tsx +160 -160
- package/src/client/components/GitOperations.tsx +220 -220
- package/src/client/components/LLMModelSelect.tsx +63 -63
- package/src/client/components/LLMServiceSelect.tsx +58 -58
- package/src/client/components/MarkdownView.tsx +80 -80
- package/src/client/components/MergeRequests.tsx +790 -790
- package/src/client/components/PollingStatus.tsx +225 -225
- package/src/client/components/RepositoryConfig.tsx +335 -335
- package/src/client/components/RepositoryPermissions.tsx +123 -123
- package/src/client/components/ReviewFlows.tsx +303 -303
- package/src/client/components/ReviewHistory.tsx +566 -566
- package/src/client/components/RunReviewButton.tsx +63 -55
- package/src/client/context/GitManagerContext.tsx +92 -92
- package/src/client/index.tsx +91 -82
- package/src/client/locale.ts +9 -9
- package/src/client/promptTemplates.ts +31 -31
- package/src/client-v2/ai-context.tsx +99 -0
- package/src/client-v2/components/SubtreeSplits.tsx +547 -547
- package/src/client-v2/index.tsx +1 -1
- package/src/client-v2/locale.ts +8 -8
- package/src/client-v2/plugin.tsx +67 -39
- package/src/index.ts +2 -2
- package/src/locale/en-US.json +307 -297
- package/src/locale/vi-VN.json +295 -292
- package/src/locale/zh-CN.json +61 -51
- package/src/server/__tests__/git-actions.test.ts +24 -24
- package/src/server/__tests__/git-security.test.ts +170 -0
- package/src/server/__tests__/plugin-url-security.test.ts +17 -17
- package/src/server/__tests__/poller-lifecycle.test.ts +71 -0
- package/src/server/__tests__/poller.test.ts +37 -37
- package/src/server/__tests__/repository-access.test.ts +752 -752
- package/src/server/__tests__/review.test.ts +137 -137
- package/src/server/__tests__/role-permissions.test.ts +147 -147
- package/src/server/__tests__/smoke.test.ts +139 -17
- package/src/server/__tests__/subtree.test.ts +85 -85
- package/src/server/actions/git-actions.ts +540 -480
- package/src/server/actions/gitlab-api.ts +422 -411
- package/src/server/actions/poller.ts +39 -27
- package/src/server/actions/review.ts +1388 -1369
- package/src/server/actions/role-permissions.ts +321 -321
- package/src/server/actions/subtree.ts +508 -508
- package/src/server/ai-tools.ts +319 -319
- package/src/server/collections/gitAccounts.ts +56 -56
- package/src/server/collections/gitCodeReviews.ts +199 -199
- package/src/server/collections/gitRepositories.ts +87 -87
- package/src/server/collections/gitReviewFlows.ts +108 -108
- package/src/server/collections/gitSubtreeConfigs.ts +38 -38
- package/src/server/collections/gitSubtreeRuns.ts +30 -30
- package/src/server/index.ts +2 -2
- package/src/server/migrations/20260508000000-add-auto-review-flow-id.ts +29 -29
- package/src/server/migrations/20260712000000-add-git-accounts.ts +198 -198
- package/src/server/migrations/20260730000000-migrate-legacy-repository-permissions.ts +81 -81
- package/src/server/plugin.ts +372 -361
- package/src/server/poller.ts +351 -352
- package/src/server/repository-access.ts +773 -773
- package/src/server/request-method-policy.ts +55 -0
- package/src/server/services/__tests__/registry-content-service.test.ts +359 -345
- package/src/server/services/registry-content-service.ts +495 -484
- package/src/server/utils/__tests__/redact.test.ts +56 -56
- package/src/server/utils/__tests__/url-security.test.ts +85 -85
- package/src/server/utils/get-repo-account.ts +51 -41
- package/src/server/utils/gitlab-url.ts +38 -38
- package/src/server/utils/redact.ts +87 -87
- package/src/server/utils/url-security.ts +128 -95
- package/dist/client/900.acf7d1fa22f95e71.js +0 -10
- package/dist/client-v2/434.7a27051db18526c0.js +0 -10
- package/dist/client-v2/900.f32b9dc85249fc0a.js +0 -10
package/README.md
CHANGED
|
@@ -1,108 +1,133 @@
|
|
|
1
|
-
# plugin-git-manager
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
Manage Git repositories with PAT authentication and run AI-powered code reviews on
|
|
5
|
-
merge requests. Combines repository operations (clone/pull/push/diff) with a configurable
|
|
6
|
-
review pipeline backed by AI Employees.
|
|
7
|
-
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
- **
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- **
|
|
40
|
-
|
|
41
|
-
- **
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
###
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
-
|
|
103
|
-
|
|
104
|
-
-
|
|
105
|
-
|
|
106
|
-
-
|
|
107
|
-
|
|
108
|
-
|
|
1
|
+
# plugin-git-manager
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
Manage Git repositories with PAT authentication and run AI-powered code reviews on
|
|
5
|
+
merge requests. Combines repository operations (clone/pull/push/diff) with a configurable
|
|
6
|
+
review pipeline backed by AI Employees.
|
|
7
|
+
|
|
8
|
+
## Upgrade to 1.2.28
|
|
9
|
+
|
|
10
|
+
This release includes the Skill Registry tree-limit contract and the Git Manager security fixes.
|
|
11
|
+
|
|
12
|
+
- Set each self-hosted GitLab account's **Base URL** to its HTTPS origin. A blank Base URL means
|
|
13
|
+
`https://gitlab.com` for GitLab and `https://github.com` for GitHub. Repository and account origins
|
|
14
|
+
must match, including the port. GitHub Enterprise API endpoints are not implemented.
|
|
15
|
+
- Use the final repository URL. Authenticated Git and provider API requests reject redirects.
|
|
16
|
+
- Use Git 2.31 or newer for process-scoped credential configuration. PATs are no longer written into
|
|
17
|
+
remote URLs or Git configuration. The plugin clears inherited Git command/config/trace overrides
|
|
18
|
+
for its Git subprocesses. `GIT_SSL_CAINFO` and `GIT_SSL_CAPATH` remain available for private CAs.
|
|
19
|
+
- Repository paths must resolve strictly below `GIT_REPOS_BASE_PATH`. The base directory itself,
|
|
20
|
+
traversal paths, and symlinks/junctions escaping the base are rejected, including clone destinations
|
|
21
|
+
below a linked parent. Keep that storage directory writable only by trusted service operators.
|
|
22
|
+
- Call mutation actions with **POST**, including `subtreeOptions` and `subtreePreview`, which fetch
|
|
23
|
+
remote refs. GET and HEAD return 405 before executing these actions. The bundled clients already use POST.
|
|
24
|
+
- Poller timers, in-flight guards and status belong to each application. Stopping one application
|
|
25
|
+
does not stop another application's poller. A running cycle retains its guard until it finishes.
|
|
26
|
+
- AI chat is optional in both clients. It uses the installed AI plugin manager and is disabled when
|
|
27
|
+
that plugin is absent. Standard Git screens can load without the AI module.
|
|
28
|
+
|
|
29
|
+
The HTTP integration test loads the real plugin and checks resource registration, method enforcement,
|
|
30
|
+
POST checkout and junction rejection. Additional tests cover credential origin matching, redirect
|
|
31
|
+
policy, credential-free Git config, lock recovery, poller isolation and optional AI chat.
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
### Repository management
|
|
36
|
+
- **Clone, fetch, pull, push** to external Git providers (GitHub, GitLab, etc.).
|
|
37
|
+
- **PAT authentication** — Personal Access Tokens are held in Git accounts and redacted
|
|
38
|
+
from API responses. Git operations receive credentials through the child process environment.
|
|
39
|
+
- **File & diff browser** — view commits, changed files, and inline diffs from the
|
|
40
|
+
NocoBase UI.
|
|
41
|
+
- **Merge Request integration** — list, filter, and inspect GitLab MRs (overview,
|
|
42
|
+
changes, comments).
|
|
43
|
+
|
|
44
|
+
### AI code review
|
|
45
|
+
- **Review Flows** — configurable per repository or global (apply to all repos).
|
|
46
|
+
Each flow binds an AI Employee, an optional LLM service / model override,
|
|
47
|
+
trigger mode, post mode, branch filter (regex), and extra prompt instructions.
|
|
48
|
+
- **Trigger modes**:
|
|
49
|
+
- `manual` — run from the Merge Requests tab.
|
|
50
|
+
- `onMergeRequestCreated` — auto-trigger when a new MR is detected by the poller.
|
|
51
|
+
- `both` — manual + auto.
|
|
52
|
+
- **Post modes**:
|
|
53
|
+
- `auto` — review is posted to the MR as soon as it completes.
|
|
54
|
+
- `manual` — review is held in the Review History tab pending approval.
|
|
55
|
+
- `disabled` — review is generated and stored but never posted.
|
|
56
|
+
- **Re-review on new commits** — every review tracks `headSha` (the SHA that was
|
|
57
|
+
reviewed) and `latestSha` (the latest known SHA on the MR). The Merge Requests
|
|
58
|
+
tab flags MRs whose `latestSha !== headSha` so reviewers can re-run the flow.
|
|
59
|
+
- **One review per MR** — re-running a review UPSERTs the existing record, preserving
|
|
60
|
+
history through `metadata` while keeping the row count bounded.
|
|
61
|
+
|
|
62
|
+
### Background poller
|
|
63
|
+
- **5-minute interval** — polls open MRs for repos with `autoReview` enabled.
|
|
64
|
+
- **Per-repo opt-in** — toggle `Auto Review` on the repository row to enable polling
|
|
65
|
+
for that repo. Disabled repos are never queried.
|
|
66
|
+
- **Smart re-poll** — uses GitLab `updated_after` (with a 1-second safety buffer) so
|
|
67
|
+
each tick only fetches MRs that have changed since the last poll.
|
|
68
|
+
- **No auto re-trigger** — auto-poll only triggers a review the **first time** an MR
|
|
69
|
+
is seen. When new commits arrive on an already-reviewed MR, the poller refreshes
|
|
70
|
+
`latestSha` only; re-review must be initiated manually.
|
|
71
|
+
- **Status panel** — the Polling tab shows poller state (running/stopped), last tick,
|
|
72
|
+
last error, and provides `Poll Now` / `Poll Now (All)` actions.
|
|
73
|
+
|
|
74
|
+
## Collections
|
|
75
|
+
| Name | Purpose |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `gitRepositories` | Connected repos, PAT, default branch, `autoReview` flag, `lastPolledAt`. |
|
|
78
|
+
| `gitReviewFlows` | Review pipeline definitions (AI employee, trigger mode, post mode, branch filter). |
|
|
79
|
+
| `gitCodeReviews` | Review records — one per MR target — with status, markdown output, metadata, post status. |
|
|
80
|
+
|
|
81
|
+
## Permissions
|
|
82
|
+
The plugin registers two ACL snippets:
|
|
83
|
+
- `pm.plugin-git-manager.read` — list/get on repos, flows, reviews + read-only Git
|
|
84
|
+
operations (status, log, diff, MR queries, poller status).
|
|
85
|
+
- `pm.plugin-git-manager.write` — create/update/destroy on collections + write Git
|
|
86
|
+
operations (clone, pull, push, checkout) + review actions
|
|
87
|
+
(`triggerReview`, `reviewApprovePost`, `reviewReject`, `pollNow`).
|
|
88
|
+
|
|
89
|
+
## Usage
|
|
90
|
+
|
|
91
|
+
### 1. Connect a repository
|
|
92
|
+
1. Open **Settings → Git Manager → Repositories**.
|
|
93
|
+
2. Click **Add Repository** and provide the clone URL, username, and PAT.
|
|
94
|
+
3. (Optional) Toggle **Auto Review** to enable background polling for this repo.
|
|
95
|
+
|
|
96
|
+
### 2. Configure a Review Flow
|
|
97
|
+
1. Open the **Review Flows** tab.
|
|
98
|
+
2. Click **Add Review Flow** and set:
|
|
99
|
+
- **Repository** — leave empty for a global flow.
|
|
100
|
+
- **AI Employee** — username of the AI Employee that will run the review.
|
|
101
|
+
- **Trigger Mode** — `Manual`, `On Merge Request Created`, or `Both`.
|
|
102
|
+
- **Post Mode** — `Auto post to MR`, `Manual approval before posting`, or
|
|
103
|
+
`Do not post`.
|
|
104
|
+
- **Branch Filter** — optional regex; only MRs whose source branch matches will
|
|
105
|
+
be picked up.
|
|
106
|
+
- **Additional Instructions** — extra prompt text appended to every review run.
|
|
107
|
+
|
|
108
|
+
### 3. Run a review
|
|
109
|
+
- **Manual** — from the **Merge Requests** tab, click **Run Review** on any open MR.
|
|
110
|
+
- **Automatic** — enable **Auto Review** on the repo and create a flow with
|
|
111
|
+
trigger mode `On Merge Request Created` or `Both`. Within ~5 minutes the poller
|
|
112
|
+
will detect new MRs and trigger reviews.
|
|
113
|
+
|
|
114
|
+
### 4. Approve or reject
|
|
115
|
+
If the flow uses `manual` post mode, completed reviews land in the **Review History**
|
|
116
|
+
tab with status **Pending Approval**. From there:
|
|
117
|
+
- **Approve & Post** — posts the review as a note on the MR.
|
|
118
|
+
- **Reject** — marks the review as rejected; nothing is posted.
|
|
119
|
+
- **Edit before posting** — tweak the markdown before approving.
|
|
120
|
+
|
|
121
|
+
### 5. Re-review on new commits
|
|
122
|
+
When new commits are pushed to an already-reviewed MR, the Merge Requests tab shows
|
|
123
|
+
a **New commits** badge. Click **Re-run** to overwrite the existing review with a
|
|
124
|
+
fresh one for the latest `headSha`.
|
|
125
|
+
|
|
126
|
+
## Notes & limits
|
|
127
|
+
- The poller fetches at most 50 MRs per repo per tick (`per_page=50`). Repos with
|
|
128
|
+
more than 50 open MRs may need manual `Poll Now` runs to catch up.
|
|
129
|
+
- GitLab is the only fully-supported MR provider for the review pipeline; basic
|
|
130
|
+
Git operations work against any provider.
|
|
131
|
+
- The poller is in-process. In multi-instance deployments it runs on every node;
|
|
132
|
+
the `isPolling` flag prevents overlap within a single process but not across
|
|
133
|
+
nodes. Co-ordinate via a single primary node if needed.
|
package/client-v2.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './dist/client-v2';
|
|
2
|
-
export { default } from './dist/client-v2';
|
|
1
|
+
export * from './dist/client-v2';
|
|
2
|
+
export { default } from './dist/client-v2';
|
package/client-v2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/client-v2/index.js');
|
|
1
|
+
module.exports = require('./dist/client-v2/index.js');
|
package/client.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
|
-
export * from './dist/client';
|
|
3
|
-
export { default } from './dist/client';
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
export * from './dist/client';
|
|
3
|
+
export { default } from './dist/client';
|
package/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = require('./dist/client/index.js');
|
|
1
|
+
module.exports = require('./dist/client/index.js');
|