@leitwerk-dev/gitlab 0.0.0-bootstrap.0 → 0.2.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 +39 -1
- package/dist/LICENSE +13 -0
- package/dist/capability.d.ts +10 -0
- package/dist/capability.d.ts.map +1 -0
- package/dist/chunk-5GBBPAG5.js +656 -0
- package/dist/chunk-5GBBPAG5.js.map +1 -0
- package/dist/client.d.ts +179 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/external.d.ts +32 -0
- package/dist/external.d.ts.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/merge-request.test-fixture.d.ts +3 -0
- package/dist/merge-request.test-fixture.d.ts.map +1 -0
- package/dist/selection.d.ts +17 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/testing.d.ts +32 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/testing.js +209 -0
- package/dist/testing.js.map +1 -0
- package/dist/tools.d.ts +33 -0
- package/dist/tools.d.ts.map +1 -0
- package/package.json +54 -14
- package/src/capability.ts +24 -0
- package/src/client.ts +483 -0
- package/src/external.ts +144 -0
- package/src/index.ts +54 -0
- package/src/merge-request.test-fixture.ts +16 -0
- package/src/selection.ts +61 -0
- package/src/testing.ts +239 -0
- package/src/tools.ts +182 -0
package/dist/testing.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import {
|
|
2
|
+
setupGitLabIntegration
|
|
3
|
+
} from "./chunk-5GBBPAG5.js";
|
|
4
|
+
|
|
5
|
+
// src/testing.ts
|
|
6
|
+
import { execFileSync } from "child_process";
|
|
7
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
8
|
+
import path from "path";
|
|
9
|
+
var LocalGitLabAdapter = class {
|
|
10
|
+
constructor(root, baseUrl = "https://gitlab.test") {
|
|
11
|
+
this.root = root;
|
|
12
|
+
this.baseUrl = baseUrl;
|
|
13
|
+
mkdirSync(root, { recursive: true });
|
|
14
|
+
const file = path.join(root, "gitlab.json");
|
|
15
|
+
this.state = existsSync(file) ? JSON.parse(readFileSync(file, "utf8")) : { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };
|
|
16
|
+
}
|
|
17
|
+
root;
|
|
18
|
+
baseUrl;
|
|
19
|
+
state;
|
|
20
|
+
loseNextCommentResponse = false;
|
|
21
|
+
loseNextReplyResponse = false;
|
|
22
|
+
loseNextReactionResponse = false;
|
|
23
|
+
save() {
|
|
24
|
+
writeFileSync(path.join(this.root, "gitlab.json"), JSON.stringify(this.state), { mode: 384 });
|
|
25
|
+
}
|
|
26
|
+
append(items, item, kind) {
|
|
27
|
+
items.push(item);
|
|
28
|
+
this.save();
|
|
29
|
+
const flag = `loseNext${kind}Response`;
|
|
30
|
+
if (this[flag]) {
|
|
31
|
+
this[flag] = false;
|
|
32
|
+
const action = {
|
|
33
|
+
Comment: "comment write",
|
|
34
|
+
Reply: "discussion reply",
|
|
35
|
+
Reaction: "reaction write"
|
|
36
|
+
};
|
|
37
|
+
throw new Error(`Response lost after ${action[kind]}`);
|
|
38
|
+
}
|
|
39
|
+
return item;
|
|
40
|
+
}
|
|
41
|
+
project(id) {
|
|
42
|
+
const p = this.state.projects.find((p2) => p2.id === id || p2.path_with_namespace === id);
|
|
43
|
+
if (!p) throw new Error("Unknown test project");
|
|
44
|
+
return p;
|
|
45
|
+
}
|
|
46
|
+
git(id, args) {
|
|
47
|
+
return execFileSync(
|
|
48
|
+
"git",
|
|
49
|
+
["-c", "core.hooksPath=/dev/null", "--git-dir", this.project(id).http_url_to_repo, ...args],
|
|
50
|
+
{ encoding: "utf8" }
|
|
51
|
+
).trim();
|
|
52
|
+
}
|
|
53
|
+
addProject(name, bare) {
|
|
54
|
+
const project = {
|
|
55
|
+
id: this.state.projects.length + 1,
|
|
56
|
+
path_with_namespace: name,
|
|
57
|
+
http_url_to_repo: bare,
|
|
58
|
+
web_url: `${this.baseUrl}/${name}`,
|
|
59
|
+
default_branch: "main"
|
|
60
|
+
};
|
|
61
|
+
this.state.projects.push(project);
|
|
62
|
+
this.save();
|
|
63
|
+
return project;
|
|
64
|
+
}
|
|
65
|
+
openMr(project, branch) {
|
|
66
|
+
const mr = {
|
|
67
|
+
iid: this.state.mrs.length + 1,
|
|
68
|
+
project_id: project.id,
|
|
69
|
+
target_project_id: project.id,
|
|
70
|
+
source_project_id: project.id,
|
|
71
|
+
title: "Update dependency",
|
|
72
|
+
description: "Renovate upgrade",
|
|
73
|
+
state: "opened",
|
|
74
|
+
labels: ["renovate"],
|
|
75
|
+
sha: this.git(project.id, ["rev-parse", branch]),
|
|
76
|
+
source_branch: branch,
|
|
77
|
+
target_branch: "main",
|
|
78
|
+
web_url: `${project.web_url}/-/merge_requests/${this.state.mrs.length + 1}`
|
|
79
|
+
};
|
|
80
|
+
this.state.mrs.push(mr);
|
|
81
|
+
this.save();
|
|
82
|
+
return mr;
|
|
83
|
+
}
|
|
84
|
+
pipeline(mr, status) {
|
|
85
|
+
const value = {
|
|
86
|
+
id: this.state.pipelines.length + 1,
|
|
87
|
+
project_id: mr.source_project_id,
|
|
88
|
+
sha: this.git(mr.source_project_id, ["rev-parse", mr.source_branch]),
|
|
89
|
+
ref: mr.source_branch,
|
|
90
|
+
status,
|
|
91
|
+
source: "merge_request_event",
|
|
92
|
+
web_url: `${this.project(mr.source_project_id).web_url}/-/pipelines/${this.state.pipelines.length + 1}`
|
|
93
|
+
};
|
|
94
|
+
this.state.pipelines.push(value);
|
|
95
|
+
this.save();
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
client() {
|
|
99
|
+
const mr = (id, iid) => {
|
|
100
|
+
const m = this.state.mrs.find((m2) => m2.project_id === id && m2.iid === iid);
|
|
101
|
+
if (!m) throw new Error("Unknown test MR");
|
|
102
|
+
return m;
|
|
103
|
+
};
|
|
104
|
+
const commit = (id, ref) => ({
|
|
105
|
+
id: this.git(id, ["rev-parse", ref]),
|
|
106
|
+
parent_ids: this.git(id, ["show", "-s", "--format=%P", ref]).split(" ").filter(Boolean),
|
|
107
|
+
message: this.git(id, ["show", "-s", "--format=%B", ref])
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
baseUrl: this.baseUrl,
|
|
111
|
+
getProject: async (id) => structuredClone(this.project(id)),
|
|
112
|
+
listProjects: async () => structuredClone(this.state.projects),
|
|
113
|
+
getGroup: async (id) => ({ id: 1, full_path: String(id) }),
|
|
114
|
+
listGroupProjects: async (group) => structuredClone(
|
|
115
|
+
this.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`))
|
|
116
|
+
),
|
|
117
|
+
getMergeRequest: async (id, iid) => ({
|
|
118
|
+
...structuredClone(mr(id, iid)),
|
|
119
|
+
sha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id
|
|
120
|
+
}),
|
|
121
|
+
listMergeRequests: async (id, label) => structuredClone(
|
|
122
|
+
this.state.mrs.filter(
|
|
123
|
+
(m) => m.project_id === id && m.state === "opened" && m.labels.includes(label)
|
|
124
|
+
)
|
|
125
|
+
),
|
|
126
|
+
getBranch: async (id, branch) => ({
|
|
127
|
+
name: branch,
|
|
128
|
+
can_push: true,
|
|
129
|
+
protected: false,
|
|
130
|
+
commit: commit(id, branch)
|
|
131
|
+
}),
|
|
132
|
+
getCommit: async (id, ref) => commit(id, ref),
|
|
133
|
+
getChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),
|
|
134
|
+
listMergeRequestPipelines: async (id, iid) => structuredClone(
|
|
135
|
+
this.state.pipelines.filter(
|
|
136
|
+
(p) => p.project_id === mr(id, iid).source_project_id && p.ref === mr(id, iid).source_branch
|
|
137
|
+
)
|
|
138
|
+
),
|
|
139
|
+
listBranchPipelines: async (id, branch, sha) => structuredClone(
|
|
140
|
+
this.state.pipelines.filter(
|
|
141
|
+
(p) => p.project_id === id && p.ref === branch && p.sha === sha && p.source === "push"
|
|
142
|
+
)
|
|
143
|
+
),
|
|
144
|
+
getPipeline: async (id, pipeline) => {
|
|
145
|
+
const p = this.state.pipelines.find((p2) => p2.project_id === id && p2.id === pipeline);
|
|
146
|
+
if (!p) throw new Error("Unknown test pipeline");
|
|
147
|
+
return structuredClone(p);
|
|
148
|
+
},
|
|
149
|
+
listFailedJobs: async (id, pipeline) => [
|
|
150
|
+
{
|
|
151
|
+
id: pipeline * 100,
|
|
152
|
+
name: "test",
|
|
153
|
+
status: "failed",
|
|
154
|
+
web_url: `${this.project(id).web_url}/-/jobs/${pipeline * 100}`,
|
|
155
|
+
failure_reason: "script_failure"
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
getJobTrace: async () => ({
|
|
159
|
+
text: "Expected new dependency API; test failed",
|
|
160
|
+
truncated: false
|
|
161
|
+
}),
|
|
162
|
+
resolveGitIdentity: async () => ({
|
|
163
|
+
name: "Leitwerk Bot",
|
|
164
|
+
email: "bot@gitlab.test",
|
|
165
|
+
username: "bot"
|
|
166
|
+
}),
|
|
167
|
+
listNotes: async (id, iid) => structuredClone(this.state.notes[`${id}:${iid}`] ?? []),
|
|
168
|
+
listMergeRequestFeedback: async (id, iid) => structuredClone(this.state.feedback?.[`${id}:${iid}`] ?? []),
|
|
169
|
+
getDiscussion: async (id, iid, discussionId) => ({
|
|
170
|
+
id: discussionId,
|
|
171
|
+
notes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({
|
|
172
|
+
...structuredClone(note),
|
|
173
|
+
system: false,
|
|
174
|
+
created_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
175
|
+
author: { username: "bot" }
|
|
176
|
+
}))
|
|
177
|
+
}),
|
|
178
|
+
replyToDiscussion: async (id, iid, discussionId, body) => {
|
|
179
|
+
const key = `${id}:${iid}:${discussionId}`;
|
|
180
|
+
this.state.discussionNotes ??= {};
|
|
181
|
+
this.state.discussionNotes[key] ??= [];
|
|
182
|
+
const notes = this.state.discussionNotes[key];
|
|
183
|
+
return this.append(notes, { id: notes.length + 1, body }, "Reply");
|
|
184
|
+
},
|
|
185
|
+
listNoteReactions: async (id, iid, noteId) => structuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),
|
|
186
|
+
addNoteReaction: async (id, iid, noteId, name) => {
|
|
187
|
+
const key = `${id}:${iid}:${noteId}`;
|
|
188
|
+
this.state.reactions ??= {};
|
|
189
|
+
this.state.reactions[key] ??= [];
|
|
190
|
+
const reactions = this.state.reactions[key];
|
|
191
|
+
if (reactions.some((reaction2) => reaction2.name === name && reaction2.user.username === "bot"))
|
|
192
|
+
throw new Error("Reaction already exists");
|
|
193
|
+
const reaction = { id: reactions.length + 1, name, user: { username: "bot" } };
|
|
194
|
+
return this.append(reactions, reaction, "Reaction");
|
|
195
|
+
},
|
|
196
|
+
addNote: async (id, iid, body) => {
|
|
197
|
+
const key = `${id}:${iid}`;
|
|
198
|
+
this.state.notes[key] ??= [];
|
|
199
|
+
const notes = this.state.notes[key];
|
|
200
|
+
return this.append(notes, { id: notes.length + 1, body }, "Comment");
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
export {
|
|
206
|
+
LocalGitLabAdapter,
|
|
207
|
+
setupGitLabIntegration
|
|
208
|
+
};
|
|
209
|
+
//# sourceMappingURL=testing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/testing.ts"],"sourcesContent":["import { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type {\n\tGitLabClientLike,\n\tGitLabDiff,\n\tGitLabFeedback,\n\tGitLabMergeRequest,\n\tGitLabNote,\n\tGitLabNoteReaction,\n\tGitLabPipeline,\n\tGitLabProject,\n} from \"./client.js\";\n\nexport type {\n\tGitLabClientLike,\n\tGitLabMergeRequest,\n\tGitLabPipeline,\n\tGitLabProject,\n} from \"./client.js\";\nexport { setupGitLabIntegration } from \"./index.js\";\n\ninterface LocalState {\n\tprojects: GitLabProject[];\n\tmrs: GitLabMergeRequest[];\n\tpipelines: GitLabPipeline[];\n\tnotes: Record<string, GitLabNote[]>;\n\tdiffs: Record<string, GitLabDiff[]>;\n\tfeedback?: Record<string, GitLabFeedback[]>;\n\tdiscussionNotes?: Record<string, GitLabNote[]>;\n\treactions?: Record<string, GitLabNoteReaction[]>;\n}\n/** Persistent GitLab test boundary. Repository URLs use local Git's file transport. */\nexport class LocalGitLabAdapter {\n\tstate: LocalState;\n\tloseNextCommentResponse = false;\n\tloseNextReplyResponse = false;\n\tloseNextReactionResponse = false;\n\tconstructor(\n\t\treadonly root: string,\n\t\treadonly baseUrl = \"https://gitlab.test\",\n\t) {\n\t\tmkdirSync(root, { recursive: true });\n\t\tconst file = path.join(root, \"gitlab.json\");\n\t\tthis.state = existsSync(file)\n\t\t\t? JSON.parse(readFileSync(file, \"utf8\"))\n\t\t\t: { projects: [], mrs: [], pipelines: [], notes: {}, diffs: {} };\n\t}\n\tsave() {\n\t\twriteFileSync(path.join(this.root, \"gitlab.json\"), JSON.stringify(this.state), { mode: 0o600 });\n\t}\n\tprivate append<T>(items: T[], item: T, kind: \"Comment\" | \"Reply\" | \"Reaction\"): T {\n\t\titems.push(item);\n\t\tthis.save();\n\t\tconst flag = `loseNext${kind}Response` as const;\n\t\tif (this[flag]) {\n\t\t\tthis[flag] = false;\n\t\t\tconst action = {\n\t\t\t\tComment: \"comment write\",\n\t\t\t\tReply: \"discussion reply\",\n\t\t\t\tReaction: \"reaction write\",\n\t\t\t};\n\t\t\tthrow new Error(`Response lost after ${action[kind]}`);\n\t\t}\n\t\treturn item;\n\t}\n\tprivate project(id: number | string) {\n\t\tconst p = this.state.projects.find((p) => p.id === id || p.path_with_namespace === id);\n\t\tif (!p) throw new Error(\"Unknown test project\");\n\t\treturn p;\n\t}\n\tprivate git(id: number, args: string[]) {\n\t\treturn execFileSync(\n\t\t\t\"git\",\n\t\t\t[\"-c\", \"core.hooksPath=/dev/null\", \"--git-dir\", this.project(id).http_url_to_repo, ...args],\n\t\t\t{ encoding: \"utf8\" },\n\t\t).trim();\n\t}\n\taddProject(name: string, bare: string): GitLabProject {\n\t\tconst project: GitLabProject = {\n\t\t\tid: this.state.projects.length + 1,\n\t\t\tpath_with_namespace: name,\n\t\t\thttp_url_to_repo: bare,\n\t\t\tweb_url: `${this.baseUrl}/${name}`,\n\t\t\tdefault_branch: \"main\",\n\t\t};\n\t\tthis.state.projects.push(project);\n\t\tthis.save();\n\t\treturn project;\n\t}\n\topenMr(project: GitLabProject, branch: string): GitLabMergeRequest {\n\t\tconst mr: GitLabMergeRequest = {\n\t\t\tiid: this.state.mrs.length + 1,\n\t\t\tproject_id: project.id,\n\t\t\ttarget_project_id: project.id,\n\t\t\tsource_project_id: project.id,\n\t\t\ttitle: \"Update dependency\",\n\t\t\tdescription: \"Renovate upgrade\",\n\t\t\tstate: \"opened\",\n\t\t\tlabels: [\"renovate\"],\n\t\t\tsha: this.git(project.id, [\"rev-parse\", branch]),\n\t\t\tsource_branch: branch,\n\t\t\ttarget_branch: \"main\",\n\t\t\tweb_url: `${project.web_url}/-/merge_requests/${this.state.mrs.length + 1}`,\n\t\t};\n\t\tthis.state.mrs.push(mr);\n\t\tthis.save();\n\t\treturn mr;\n\t}\n\tpipeline(mr: GitLabMergeRequest, status: string): GitLabPipeline {\n\t\tconst value: GitLabPipeline = {\n\t\t\tid: this.state.pipelines.length + 1,\n\t\t\tproject_id: mr.source_project_id,\n\t\t\tsha: this.git(mr.source_project_id, [\"rev-parse\", mr.source_branch]),\n\t\t\tref: mr.source_branch,\n\t\t\tstatus,\n\t\t\tsource: \"merge_request_event\",\n\t\t\tweb_url: `${this.project(mr.source_project_id).web_url}/-/pipelines/${this.state.pipelines.length + 1}`,\n\t\t};\n\t\tthis.state.pipelines.push(value);\n\t\tthis.save();\n\t\treturn value;\n\t}\n\tclient(): GitLabClientLike {\n\t\tconst mr = (id: number, iid: number) => {\n\t\t\tconst m = this.state.mrs.find((m) => m.project_id === id && m.iid === iid);\n\t\t\tif (!m) throw new Error(\"Unknown test MR\");\n\t\t\treturn m;\n\t\t};\n\t\tconst commit = (id: number, ref: string) => ({\n\t\t\tid: this.git(id, [\"rev-parse\", ref]),\n\t\t\tparent_ids: this.git(id, [\"show\", \"-s\", \"--format=%P\", ref]).split(\" \").filter(Boolean),\n\t\t\tmessage: this.git(id, [\"show\", \"-s\", \"--format=%B\", ref]),\n\t\t});\n\t\treturn {\n\t\t\tbaseUrl: this.baseUrl,\n\t\t\tgetProject: async (id) => structuredClone(this.project(id)),\n\t\t\tlistProjects: async () => structuredClone(this.state.projects),\n\t\t\tgetGroup: async (id) => ({ id: 1, full_path: String(id) }),\n\t\t\tlistGroupProjects: async (group) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.projects.filter((p) => p.path_with_namespace.startsWith(`${group}/`)),\n\t\t\t\t),\n\t\t\tgetMergeRequest: async (id, iid) => ({\n\t\t\t\t...structuredClone(mr(id, iid)),\n\t\t\t\tsha: commit(mr(id, iid).source_project_id, mr(id, iid).source_branch).id,\n\t\t\t}),\n\t\t\tlistMergeRequests: async (id, label) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.mrs.filter(\n\t\t\t\t\t\t(m) => m.project_id === id && m.state === \"opened\" && m.labels.includes(label),\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetBranch: async (id, branch) => ({\n\t\t\t\tname: branch,\n\t\t\t\tcan_push: true,\n\t\t\t\tprotected: false,\n\t\t\t\tcommit: commit(id, branch),\n\t\t\t}),\n\t\t\tgetCommit: async (id, ref) => commit(id, ref),\n\t\t\tgetChanges: async (id, iid) => structuredClone(this.state.diffs[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestPipelines: async (id, iid) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) =>\n\t\t\t\t\t\t\tp.project_id === mr(id, iid).source_project_id && p.ref === mr(id, iid).source_branch,\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tlistBranchPipelines: async (id, branch, sha) =>\n\t\t\t\tstructuredClone(\n\t\t\t\t\tthis.state.pipelines.filter(\n\t\t\t\t\t\t(p) => p.project_id === id && p.ref === branch && p.sha === sha && p.source === \"push\",\n\t\t\t\t\t),\n\t\t\t\t),\n\t\t\tgetPipeline: async (id, pipeline) => {\n\t\t\t\tconst p = this.state.pipelines.find((p) => p.project_id === id && p.id === pipeline);\n\t\t\t\tif (!p) throw new Error(\"Unknown test pipeline\");\n\t\t\t\treturn structuredClone(p);\n\t\t\t},\n\t\t\tlistFailedJobs: async (id, pipeline) => [\n\t\t\t\t{\n\t\t\t\t\tid: pipeline * 100,\n\t\t\t\t\tname: \"test\",\n\t\t\t\t\tstatus: \"failed\",\n\t\t\t\t\tweb_url: `${this.project(id).web_url}/-/jobs/${pipeline * 100}`,\n\t\t\t\t\tfailure_reason: \"script_failure\",\n\t\t\t\t},\n\t\t\t],\n\t\t\tgetJobTrace: async () => ({\n\t\t\t\ttext: \"Expected new dependency API; test failed\",\n\t\t\t\ttruncated: false,\n\t\t\t}),\n\t\t\tresolveGitIdentity: async () => ({\n\t\t\t\tname: \"Leitwerk Bot\",\n\t\t\t\temail: \"bot@gitlab.test\",\n\t\t\t\tusername: \"bot\",\n\t\t\t}),\n\t\t\tlistNotes: async (id, iid) => structuredClone(this.state.notes[`${id}:${iid}`] ?? []),\n\t\t\tlistMergeRequestFeedback: async (id, iid) =>\n\t\t\t\tstructuredClone(this.state.feedback?.[`${id}:${iid}`] ?? []),\n\t\t\tgetDiscussion: async (id, iid, discussionId) => ({\n\t\t\t\tid: discussionId,\n\t\t\t\tnotes: (this.state.discussionNotes?.[`${id}:${iid}:${discussionId}`] ?? []).map((note) => ({\n\t\t\t\t\t...structuredClone(note),\n\t\t\t\t\tsystem: false,\n\t\t\t\t\tcreated_at: new Date().toISOString(),\n\t\t\t\t\tauthor: { username: \"bot\" },\n\t\t\t\t})),\n\t\t\t}),\n\t\t\treplyToDiscussion: async (id, iid, discussionId, body) => {\n\t\t\t\tconst key = `${id}:${iid}:${discussionId}`;\n\t\t\t\tthis.state.discussionNotes ??= {};\n\t\t\t\tthis.state.discussionNotes[key] ??= [];\n\t\t\t\tconst notes = this.state.discussionNotes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Reply\");\n\t\t\t},\n\t\t\tlistNoteReactions: async (id, iid, noteId) =>\n\t\t\t\tstructuredClone(this.state.reactions?.[`${id}:${iid}:${noteId}`] ?? []),\n\t\t\taddNoteReaction: async (id, iid, noteId, name) => {\n\t\t\t\tconst key = `${id}:${iid}:${noteId}`;\n\t\t\t\tthis.state.reactions ??= {};\n\t\t\t\tthis.state.reactions[key] ??= [];\n\t\t\t\tconst reactions = this.state.reactions[key];\n\t\t\t\tif (\n\t\t\t\t\treactions.some((reaction) => reaction.name === name && reaction.user.username === \"bot\")\n\t\t\t\t)\n\t\t\t\t\tthrow new Error(\"Reaction already exists\");\n\t\t\t\tconst reaction = { id: reactions.length + 1, name, user: { username: \"bot\" } };\n\t\t\t\treturn this.append(reactions, reaction, \"Reaction\");\n\t\t\t},\n\t\t\taddNote: async (id, iid, body) => {\n\t\t\t\tconst key = `${id}:${iid}`;\n\t\t\t\tthis.state.notes[key] ??= [];\n\t\t\t\tconst notes = this.state.notes[key];\n\t\t\t\treturn this.append(notes, { id: notes.length + 1, body }, \"Comment\");\n\t\t\t},\n\t\t};\n\t}\n}\n"],"mappings":";;;;;AAAA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,cAAc,qBAAqB;AACnE,OAAO,UAAU;AA+BV,IAAM,qBAAN,MAAyB;AAAA,EAK/B,YACU,MACA,UAAU,uBAClB;AAFQ;AACA;AAET,cAAU,MAAM,EAAE,WAAW,KAAK,CAAC;AACnC,UAAM,OAAO,KAAK,KAAK,MAAM,aAAa;AAC1C,S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C,YACC,UAAU,KAAK,CAACE,cAAaA,UAAS,SAAS,QAAQA,UAAS,KAAK,aAAa,KAAK;AAEvF,gBAAM,IAAI,MAAM,yBAAyB;AAC1C,cAAM,WAAW,EAAE,IAAI,UAAU,SAAS,GAAG,MAAM,MAAM,EAAE,UAAU,MAAM,EAAE;AAC7E,eAAO,KAAK,OAAO,WAAW,UAAU,UAAU;AAAA,MACnD;AAAA,MACA,SAAS,OAAO,IAAI,KAAK,SAAS;AACjC,cAAM,MAAM,GAAG,EAAE,IAAI,GAAG;AACxB,aAAK,MAAM,MAAM,GAAG,MAAM,CAAC;AAC3B,cAAM,QAAQ,KAAK,MAAM,MAAM,GAAG;AAClC,eAAO,KAAK,OAAO,OAAO,EAAE,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,SAAS;AAAA,MACpE;AAAA,IACD;AAAA,EACD;AACD;","names":["p","m","reaction"]}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type ExternalWriteLogRepoLike } from "@leitwerk-dev/external-writes";
|
|
2
|
+
import { type IntegrationToolExecutionContext, type ServerExtensionAPI } from "@leitwerk-dev/process-sdk";
|
|
3
|
+
import type { GitLabIntegration } from "./capability.js";
|
|
4
|
+
import { type GitLabClientLike } from "./client.js";
|
|
5
|
+
export declare function resolveGitLabBinding(ctx: Pick<IntegrationToolExecutionContext, "project" | "process">): {
|
|
6
|
+
profile: string;
|
|
7
|
+
projectId: number;
|
|
8
|
+
iid: number;
|
|
9
|
+
};
|
|
10
|
+
export declare function ensureGitLabComment(input: {
|
|
11
|
+
client: GitLabClientLike;
|
|
12
|
+
writes: ExternalWriteLogRepoLike;
|
|
13
|
+
instanceId: string;
|
|
14
|
+
projectId: number;
|
|
15
|
+
iid: number;
|
|
16
|
+
writeKey: string;
|
|
17
|
+
body: string;
|
|
18
|
+
discussionId?: string;
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
}): Promise<{
|
|
21
|
+
marker: string;
|
|
22
|
+
}>;
|
|
23
|
+
export declare function ensureGitLabSeenReaction(input: {
|
|
24
|
+
client: GitLabClientLike;
|
|
25
|
+
writes: ExternalWriteLogRepoLike;
|
|
26
|
+
instanceId: string;
|
|
27
|
+
projectId: number;
|
|
28
|
+
iid: number;
|
|
29
|
+
noteId: number;
|
|
30
|
+
signal?: AbortSignal;
|
|
31
|
+
}): Promise<void>;
|
|
32
|
+
export declare function registerGitLabTools(api: ServerExtensionAPI, integration: GitLabIntegration, writes: ExternalWriteLogRepoLike): void;
|
|
33
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,wBAAwB,EAE7B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACN,KAAK,+BAA+B,EAGpC,KAAK,kBAAkB,EAEvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,KAAK,gBAAgB,EAAuB,MAAM,aAAa,CAAC;AACzE,wBAAgB,oBAAoB,CACnC,GAAG,EAAE,IAAI,CAAC,+BAA+B,EAAE,SAAS,GAAG,SAAS,CAAC,GAC/D;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAcrD;AAYD,wBAAsB,mBAAmB,CAAC,KAAK,EAAE;IAChD,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,wBAAwB,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAsB9B;AACD,wBAAsB,wBAAwB,CAAC,KAAK,EAAE;IACrD,MAAM,EAAE,gBAAgB,CAAC;IACzB,MAAM,EAAE,wBAAwB,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,WAAW,CAAC;CACrB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBhB;AACD,wBAAgB,mBAAmB,CAClC,GAAG,EAAE,kBAAkB,EACvB,WAAW,EAAE,iBAAiB,EAC9B,MAAM,EAAE,wBAAwB,QAwEhC"}
|
package/package.json
CHANGED
|
@@ -1,16 +1,56 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
2
|
+
"name": "@leitwerk-dev/gitlab",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"leitwerk": {
|
|
6
|
+
"extension": {
|
|
7
|
+
"source": "./src/index.ts",
|
|
8
|
+
"import": "./dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"discover": false
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"source": "./src/index.ts",
|
|
15
|
+
"import": "./dist/index.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./testing": {
|
|
19
|
+
"source": "./src/testing.ts",
|
|
20
|
+
"import": "./dist/testing.js",
|
|
21
|
+
"types": "./dist/testing.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@leitwerk-dev/domain": "0.2.0",
|
|
29
|
+
"@leitwerk-dev/external-writes": "0.2.0",
|
|
30
|
+
"@leitwerk-dev/process-sdk": "0.2.0",
|
|
31
|
+
"@leitwerk-dev/watcher-utils": "0.2.0",
|
|
32
|
+
"@leitwerk-dev/test-support": "0.2.0"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"tsup": "^8.5.1",
|
|
36
|
+
"@types/node": "^26.2.0"
|
|
37
|
+
},
|
|
38
|
+
"license": "Apache-2.0",
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=26 <27"
|
|
44
|
+
},
|
|
45
|
+
"files": [
|
|
46
|
+
"dist/**",
|
|
47
|
+
"src/**",
|
|
48
|
+
"!dist/**/*.test.*",
|
|
49
|
+
"!src/**/*.test.ts"
|
|
50
|
+
],
|
|
51
|
+
"repository": {
|
|
52
|
+
"type": "git",
|
|
53
|
+
"url": "git+https://github.com/leitwerk-dev/leitwerk.git",
|
|
54
|
+
"directory": "extensions/gitlab"
|
|
55
|
+
}
|
|
16
56
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCapabilityToken,
|
|
3
|
+
type RepositoryCredentialProject,
|
|
4
|
+
type RepositoryCredentialRequirement,
|
|
5
|
+
} from "@leitwerk-dev/process-sdk";
|
|
6
|
+
import type { GitLabClientLike } from "./client.js";
|
|
7
|
+
export interface GitLabIntegration {
|
|
8
|
+
profiles(): readonly string[];
|
|
9
|
+
client(profile: string): GitLabClientLike;
|
|
10
|
+
}
|
|
11
|
+
export const gitlabIntegration = createCapabilityToken<GitLabIntegration>(
|
|
12
|
+
"@leitwerk-dev/gitlab.integration",
|
|
13
|
+
);
|
|
14
|
+
/** Internal references are derived from the same profile as API access. */
|
|
15
|
+
export function gitlabRepositoryCredentials(
|
|
16
|
+
profile: string,
|
|
17
|
+
projects: readonly RepositoryCredentialProject[],
|
|
18
|
+
): RepositoryCredentialRequirement[] {
|
|
19
|
+
return projects.map((project) => ({
|
|
20
|
+
projectKey: project.key,
|
|
21
|
+
kind: "git_https",
|
|
22
|
+
credentialRef: `gitlab:${profile}`,
|
|
23
|
+
}));
|
|
24
|
+
}
|