@open-cr-agent/vcs-gitlab 0.1.2 → 0.3.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/dist/adapter.js CHANGED
@@ -1,4 +1,5 @@
1
- import { errorMessage } from "@open-cr-agent/core";
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 Error(`GitLab did not say who last edited note ${id}`);
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 Error(`merge request !${mr.iid} has no diff yet; try again shortly`);
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 Error {
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 Error {
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
@@ -1,4 +1,3 @@
1
- export * from "./adapter.js";
2
- export * from "./client.js";
3
- export * from "./plugin.js";
1
+ export { GitLabApiError } from "./client.js";
2
+ export { gitlabPlugin } from "./plugin.js";
4
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./adapter.js";
2
- export * from "./client.js";
3
- export * from "./plugin.js";
1
+ export { GitLabApiError } from "./client.js";
2
+ export { gitlabPlugin } from "./plugin.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,2 @@
1
+ export { GitLabApi } from "./client.js";
2
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1,4 @@
1
+ // "@open-cr-agent/vcs-gitlab/internal": what the CLI uses beyond the public
2
+ // entry. Not a contract: any release may change it.
3
+ export { GitLabApi } from "./client.js";
4
+ //# sourceMappingURL=internal.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-cr-agent/vcs-gitlab",
3
- "version": "0.1.2",
3
+ "version": "0.3.0",
4
4
  "description": "GitLab merge request adapter for Open-CR-Agent",
5
5
  "keywords": [
6
6
  "code-review",
@@ -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.1.2",
34
- "@open-cr-agent/vcs-platform": "0.1.2",
41
+ "@open-cr-agent/core": "0.3.0",
42
+ "@open-cr-agent/vcs-platform": "0.3.0",
35
43
  "zod": "^4.6.5"
36
44
  },
37
45
  "publishConfig": {