@open-cr-agent/vcs-gitlab 0.2.0 → 0.4.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/README.md +1 -1
- package/dist/adapter.js +8 -5
- package/dist/client.d.ts +2 -1
- package/dist/client.js +4 -2
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -3
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +4 -0
- package/package.json +13 -5
package/README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# @open-cr-agent/vcs-gitlab
|
|
2
2
|
|
|
3
|
-
The adapter for GitLab merge requests of [Open-CR-Agent](https://github.com/jma49/Open-CR-Agent), the multi-agent code reviewer, on GitLab.com and self-managed GitLab. Most users want [`@open-cr-agent/cli`](https://www.npmjs.com/package/@open-cr-agent/cli), which provides the `ocra` command and installs this package; see the [manual](https://
|
|
3
|
+
The adapter for GitLab merge requests of [Open-CR-Agent](https://github.com/jma49/Open-CR-Agent), the multi-agent code reviewer, on GitLab.com and self-managed GitLab. Most users want [`@open-cr-agent/cli`](https://www.npmjs.com/package/@open-cr-agent/cli), which provides the `ocra` command and installs this package; see the [manual](https://ocracloud.com). All `@open-cr-agent` packages are released together at one version. Apache-2.0.
|
package/dist/adapter.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OcraError } from "@open-cr-agent/core";
|
|
2
|
+
import { errorMessage } from "@open-cr-agent/core/internal";
|
|
2
3
|
import { PlatformReview, } from "@open-cr-agent/vcs-platform";
|
|
3
4
|
import { DEVELOPER, GitLabApiError, } from "./client.js";
|
|
4
5
|
// A GitLab merge request as ocra's review conversation (vcs-platform).
|
|
@@ -59,8 +60,9 @@ class GitLabPlatform {
|
|
|
59
60
|
async editor(comment) {
|
|
60
61
|
const editors = await this.noteEditors();
|
|
61
62
|
const id = Number(comment.id);
|
|
62
|
-
if (!editors.has(id))
|
|
63
|
-
throw new
|
|
63
|
+
if (!editors.has(id)) {
|
|
64
|
+
throw new OcraError("VCS_API_FAILED", `GitLab did not say who last edited note ${id}`);
|
|
65
|
+
}
|
|
64
66
|
return editors.get(id);
|
|
65
67
|
}
|
|
66
68
|
async canWrite(login) {
|
|
@@ -154,8 +156,9 @@ class GitLabPlatform {
|
|
|
154
156
|
}
|
|
155
157
|
}
|
|
156
158
|
function diffRefs(mr) {
|
|
157
|
-
if (!mr.diff_refs)
|
|
158
|
-
throw new
|
|
159
|
+
if (!mr.diff_refs) {
|
|
160
|
+
throw new OcraError("VCS_NOT_READY", `merge request !${mr.iid} has no diff yet; try again shortly`);
|
|
161
|
+
}
|
|
159
162
|
return mr.diff_refs;
|
|
160
163
|
}
|
|
161
164
|
// "https://gitlab.example.com/group/sub/project/-/merge_requests/7" names
|
package/dist/client.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OcraError } from "@open-cr-agent/core";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
declare const mergeRequestSchema: z.ZodObject<{
|
|
3
4
|
iid: z.ZodNumber;
|
|
@@ -65,7 +66,7 @@ export interface Position {
|
|
|
65
66
|
new_line: number;
|
|
66
67
|
old_line?: number;
|
|
67
68
|
}
|
|
68
|
-
export declare class GitLabApiError extends
|
|
69
|
+
export declare class GitLabApiError extends OcraError {
|
|
69
70
|
readonly status: number;
|
|
70
71
|
constructor(status: number, message: string);
|
|
71
72
|
}
|
package/dist/client.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OcraError } from "@open-cr-agent/core";
|
|
1
2
|
import { retryDecision } from "@open-cr-agent/vcs-platform";
|
|
2
3
|
import { z } from "zod";
|
|
3
4
|
// Commit ids reach git as arguments; anything else is refused at the boundary.
|
|
@@ -30,11 +31,12 @@ const discussionSchema = z.object({
|
|
|
30
31
|
individual_note: z.boolean(),
|
|
31
32
|
notes: z.array(noteSchema),
|
|
32
33
|
});
|
|
33
|
-
export class GitLabApiError extends
|
|
34
|
+
export class GitLabApiError extends OcraError {
|
|
34
35
|
status;
|
|
35
36
|
constructor(status, message) {
|
|
36
|
-
super(message);
|
|
37
|
+
super("VCS_API_FAILED", message);
|
|
37
38
|
this.status = status;
|
|
39
|
+
this.name = "GitLabApiError";
|
|
38
40
|
}
|
|
39
41
|
}
|
|
40
42
|
const PER_PAGE = 100;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/internal.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-cr-agent/vcs-gitlab",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "GitLab merge request adapter for Open-CR-Agent",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"code-review",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"merge-request"
|
|
9
9
|
],
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
|
-
"homepage": "https://
|
|
11
|
+
"homepage": "https://ocracloud.com",
|
|
12
12
|
"repository": {
|
|
13
13
|
"type": "git",
|
|
14
14
|
"url": "git+https://github.com/jma49/Open-CR-Agent.git",
|
|
@@ -19,19 +19,27 @@
|
|
|
19
19
|
"node": ">=22.19"
|
|
20
20
|
},
|
|
21
21
|
"type": "module",
|
|
22
|
+
"sideEffects": false,
|
|
22
23
|
"exports": {
|
|
23
24
|
".": {
|
|
25
|
+
"@open-cr-agent/source": "./src/index.ts",
|
|
24
26
|
"types": "./dist/index.d.ts",
|
|
25
27
|
"default": "./dist/index.js"
|
|
26
|
-
}
|
|
28
|
+
},
|
|
29
|
+
"./internal": {
|
|
30
|
+
"@open-cr-agent/source": "./src/internal.ts",
|
|
31
|
+
"types": "./dist/internal.d.ts",
|
|
32
|
+
"default": "./dist/internal.js"
|
|
33
|
+
},
|
|
34
|
+
"./package.json": "./package.json"
|
|
27
35
|
},
|
|
28
36
|
"files": [
|
|
29
37
|
"dist",
|
|
30
38
|
"!dist/**/*.map"
|
|
31
39
|
],
|
|
32
40
|
"dependencies": {
|
|
33
|
-
"@open-cr-agent/core": "0.
|
|
34
|
-
"@open-cr-agent/vcs-platform": "0.
|
|
41
|
+
"@open-cr-agent/core": "0.4.0",
|
|
42
|
+
"@open-cr-agent/vcs-platform": "0.4.0",
|
|
35
43
|
"zod": "^4.6.5"
|
|
36
44
|
},
|
|
37
45
|
"publishConfig": {
|