ghagga-forge 3.1.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/LICENSE +21 -0
- package/README.md +3 -0
- package/dist/adapters/github/github-app-credential-provider.d.ts +102 -0
- package/dist/adapters/github/github-app-credential-provider.d.ts.map +1 -0
- package/dist/adapters/github/github-app-credential-provider.js +166 -0
- package/dist/adapters/github/github-app-credential-provider.js.map +1 -0
- package/dist/adapters/github/github-client-port.d.ts +92 -0
- package/dist/adapters/github/github-client-port.d.ts.map +1 -0
- package/dist/adapters/github/github-client-port.js +24 -0
- package/dist/adapters/github/github-client-port.js.map +1 -0
- package/dist/adapters/github/github-forge-adapter.d.ts +105 -0
- package/dist/adapters/github/github-forge-adapter.d.ts.map +1 -0
- package/dist/adapters/github/github-forge-adapter.js +225 -0
- package/dist/adapters/github/github-forge-adapter.js.map +1 -0
- package/dist/adapters/github/static-token-provider.d.ts +30 -0
- package/dist/adapters/github/static-token-provider.d.ts.map +1 -0
- package/dist/adapters/github/static-token-provider.js +35 -0
- package/dist/adapters/github/static-token-provider.js.map +1 -0
- package/dist/adapters/gitlab/gitlab-client-port.d.ts +82 -0
- package/dist/adapters/gitlab/gitlab-client-port.d.ts.map +1 -0
- package/dist/adapters/gitlab/gitlab-client-port.js +27 -0
- package/dist/adapters/gitlab/gitlab-client-port.js.map +1 -0
- package/dist/adapters/gitlab/gitlab-forge-adapter.d.ts +118 -0
- package/dist/adapters/gitlab/gitlab-forge-adapter.d.ts.map +1 -0
- package/dist/adapters/gitlab/gitlab-forge-adapter.js +238 -0
- package/dist/adapters/gitlab/gitlab-forge-adapter.js.map +1 -0
- package/dist/comment-id.d.ts +45 -0
- package/dist/comment-id.d.ts.map +1 -0
- package/dist/comment-id.js +48 -0
- package/dist/comment-id.js.map +1 -0
- package/dist/errors.d.ts +48 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +67 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/lint-boundary.d.ts +36 -0
- package/dist/lint-boundary.d.ts.map +1 -0
- package/dist/lint-boundary.impl.d.mts +41 -0
- package/dist/lint-boundary.impl.mjs +400 -0
- package/dist/lint-boundary.js +35 -0
- package/dist/lint-boundary.js.map +1 -0
- package/dist/ports/ci-runner.d.ts +48 -0
- package/dist/ports/ci-runner.d.ts.map +1 -0
- package/dist/ports/ci-runner.js +10 -0
- package/dist/ports/ci-runner.js.map +1 -0
- package/dist/ports/credential-provider.d.ts +32 -0
- package/dist/ports/credential-provider.d.ts.map +1 -0
- package/dist/ports/credential-provider.js +10 -0
- package/dist/ports/credential-provider.js.map +1 -0
- package/dist/ports/forge-adapter.d.ts +174 -0
- package/dist/ports/forge-adapter.d.ts.map +1 -0
- package/dist/ports/forge-adapter.js +34 -0
- package/dist/ports/forge-adapter.js.map +1 -0
- package/dist/ports/webhook-codec.d.ts +41 -0
- package/dist/ports/webhook-codec.d.ts.map +1 -0
- package/dist/ports/webhook-codec.js +18 -0
- package/dist/ports/webhook-codec.js.map +1 -0
- package/dist/project.d.ts +32 -0
- package/dist/project.d.ts.map +1 -0
- package/dist/project.js +41 -0
- package/dist/project.js.map +1 -0
- package/dist/ref.d.ts +20 -0
- package/dist/ref.d.ts.map +1 -0
- package/dist/ref.js +21 -0
- package/dist/ref.js.map +1 -0
- package/dist/registry.d.ts +69 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +68 -0
- package/dist/registry.js.map +1 -0
- package/dist/types.d.ts +310 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +50 -0
- package/dist/types.js.map +1 -0
- package/package.json +64 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical forge-agnostic domain types.
|
|
3
|
+
*
|
|
4
|
+
* These types are the lingua franca between GHAGGA's core review engine and any
|
|
5
|
+
* concrete forge adapter (GitHub / GitLab / Gitea). They are deliberately
|
|
6
|
+
* provider-neutral: nothing here leaks a GitHub PR number, a GitLab IID, or a
|
|
7
|
+
* Gitea path as a bare primitive that could be mis-assigned across forges.
|
|
8
|
+
*
|
|
9
|
+
* Invariants enforced by these shapes:
|
|
10
|
+
* - R-COMMENTID: comment identifiers are BOXED ({@link CommentId}), never a bare
|
|
11
|
+
* number — a GitHub comment id and a GitLab note id must never be cross-assigned.
|
|
12
|
+
* - RepoRef identity keys on {@link RepoRef.nativeId} — `path` is mutable (repos
|
|
13
|
+
* get renamed/moved) and MUST NOT participate in identity.
|
|
14
|
+
* - ChangeRequestRef uses {@link ChangeRequestRef.iid} (project-scoped) with an
|
|
15
|
+
* optional {@link ChangeRequestRef.globalId} for forges that expose one.
|
|
16
|
+
*/
|
|
17
|
+
/** The forge providers GHAGGA can target. */
|
|
18
|
+
export declare const FORGE_KIND: {
|
|
19
|
+
readonly GITHUB: "github";
|
|
20
|
+
readonly GITLAB: "gitlab";
|
|
21
|
+
readonly GITEA: "gitea";
|
|
22
|
+
};
|
|
23
|
+
export type ForgeKind = (typeof FORGE_KIND)[keyof typeof FORGE_KIND];
|
|
24
|
+
/** How a single file changed within a change request. */
|
|
25
|
+
export declare const CHANGE_KIND: {
|
|
26
|
+
readonly ADDED: "added";
|
|
27
|
+
readonly MODIFIED: "modified";
|
|
28
|
+
readonly REMOVED: "removed";
|
|
29
|
+
readonly RENAMED: "renamed";
|
|
30
|
+
};
|
|
31
|
+
export type ChangeKind = (typeof CHANGE_KIND)[keyof typeof CHANGE_KIND];
|
|
32
|
+
/** Whether an {@link Actor} is a human or an automated account. */
|
|
33
|
+
export declare const ACTOR_KIND: {
|
|
34
|
+
readonly USER: "user";
|
|
35
|
+
readonly BOT: "bot";
|
|
36
|
+
};
|
|
37
|
+
export type ActorKind = (typeof ACTOR_KIND)[keyof typeof ACTOR_KIND];
|
|
38
|
+
/**
|
|
39
|
+
* Relationship between a comment author and the repository.
|
|
40
|
+
*
|
|
41
|
+
* Mirrors GitHub's `author_association`; other forges map their nearest
|
|
42
|
+
* equivalent. Used for trust/permission gating (e.g. only act on commands from
|
|
43
|
+
* owners/members/collaborators).
|
|
44
|
+
*/
|
|
45
|
+
export declare const AUTHOR_ASSOCIATION: {
|
|
46
|
+
readonly OWNER: "owner";
|
|
47
|
+
readonly MEMBER: "member";
|
|
48
|
+
readonly COLLABORATOR: "collaborator";
|
|
49
|
+
readonly CONTRIBUTOR: "contributor";
|
|
50
|
+
readonly NONE: "none";
|
|
51
|
+
};
|
|
52
|
+
export type AuthorAssociation = (typeof AUTHOR_ASSOCIATION)[keyof typeof AUTHOR_ASSOCIATION];
|
|
53
|
+
/**
|
|
54
|
+
* Stable identity of a repository on a given forge.
|
|
55
|
+
*
|
|
56
|
+
* IDENTITY RULE (R-COMMENTID family): two RepoRefs are the same repository iff
|
|
57
|
+
* their `kind` AND `nativeId` match. `path` is a human-friendly *label* that can
|
|
58
|
+
* change when a repo is renamed/transferred — it MUST NOT be used for identity
|
|
59
|
+
* comparison or as a lookup key.
|
|
60
|
+
*/
|
|
61
|
+
export interface RepoRef {
|
|
62
|
+
/** Which forge this repo lives on. */
|
|
63
|
+
kind: ForgeKind;
|
|
64
|
+
/**
|
|
65
|
+
* OPAQUE forge-native identity string. It is the numeric repo/project id WHEN
|
|
66
|
+
* resolvable (GitHub repo id, GitLab project id) — immutable across
|
|
67
|
+
* rename/transfer — but it MAY be a path-shaped legacy/fallback value
|
|
68
|
+
* (e.g. `owner/repo`) when the numeric id could not be resolved (an old
|
|
69
|
+
* in-flight job, or a network/404 failure during CLI resolution; both are
|
|
70
|
+
* intentional safe degradations, not bugs).
|
|
71
|
+
*
|
|
72
|
+
* Consumers MUST treat this as an opaque identity token: compare it for
|
|
73
|
+
* equality, key on it, persist it — but MUST NOT assume it parses as a number.
|
|
74
|
+
* `Number(ref.nativeId)` is NOT safe (a path-shaped fallback yields NaN).
|
|
75
|
+
*/
|
|
76
|
+
nativeId: string;
|
|
77
|
+
/** Human-friendly "owner/name" path. Mutable — NOT part of identity. */
|
|
78
|
+
path?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Reference to a single change request (PR / MR).
|
|
82
|
+
*
|
|
83
|
+
* `iid` is the project-scoped number a human sees (GitHub PR number, GitLab MR
|
|
84
|
+
* IID). `globalId` is the forge-global identifier when one exists (GitLab MRs
|
|
85
|
+
* have both; GitHub does not expose a separate global PR number).
|
|
86
|
+
*/
|
|
87
|
+
export interface ChangeRequestRef {
|
|
88
|
+
/** The repository this change request belongs to. */
|
|
89
|
+
repo: RepoRef;
|
|
90
|
+
/** Project-scoped identifier (PR number / MR IID). */
|
|
91
|
+
iid: number;
|
|
92
|
+
/** Forge-global identifier, when the forge exposes one. */
|
|
93
|
+
globalId?: string;
|
|
94
|
+
}
|
|
95
|
+
/** A human or bot account on a forge. */
|
|
96
|
+
export interface Actor {
|
|
97
|
+
/** Login / username. */
|
|
98
|
+
login: string;
|
|
99
|
+
/** Whether this account is a human or an automated bot. */
|
|
100
|
+
kind: ActorKind;
|
|
101
|
+
}
|
|
102
|
+
/** One file changed within a change request. */
|
|
103
|
+
export interface ChangedFile {
|
|
104
|
+
/** Current path of the file. Always available. */
|
|
105
|
+
path: string;
|
|
106
|
+
/**
|
|
107
|
+
* How the file changed. Optional because the GitHub PR file-list endpoint
|
|
108
|
+
* wrapper does not expose it; populated only when a richer source is available.
|
|
109
|
+
*/
|
|
110
|
+
changeKind?: ChangeKind;
|
|
111
|
+
/**
|
|
112
|
+
* Lines added. Optional because the GitHub PR file-list endpoint wrapper does
|
|
113
|
+
* not expose it; populated only when a richer source is available.
|
|
114
|
+
*/
|
|
115
|
+
additions?: number;
|
|
116
|
+
/**
|
|
117
|
+
* Lines removed. Optional because the GitHub PR file-list endpoint wrapper
|
|
118
|
+
* does not expose it; populated only when a richer source is available.
|
|
119
|
+
*/
|
|
120
|
+
deletions?: number;
|
|
121
|
+
}
|
|
122
|
+
/** A single commit in a change request. */
|
|
123
|
+
export interface Commit {
|
|
124
|
+
/**
|
|
125
|
+
* Commit SHA. Optional because the GitHub PR commit-list endpoint wrapper only
|
|
126
|
+
* returns messages; populated only when a richer source is available.
|
|
127
|
+
*/
|
|
128
|
+
sha?: string;
|
|
129
|
+
/** Full commit message. Always available. */
|
|
130
|
+
message: string;
|
|
131
|
+
/**
|
|
132
|
+
* Commit author. Optional because the GitHub PR commit-list endpoint wrapper
|
|
133
|
+
* does not expose author identity; populated only when a richer source is
|
|
134
|
+
* available.
|
|
135
|
+
*/
|
|
136
|
+
author?: Actor;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Optional diff anchoring SHAs.
|
|
140
|
+
*
|
|
141
|
+
* When present, ALL THREE are required (the three-dot base, the head, and the
|
|
142
|
+
* GitLab-style start SHA). The whole block is optional; partial diffRefs are not
|
|
143
|
+
* representable by design.
|
|
144
|
+
*/
|
|
145
|
+
export interface DiffRefs {
|
|
146
|
+
/** Merge-base / comparison base SHA. */
|
|
147
|
+
baseSha: string;
|
|
148
|
+
/** Head SHA of the change request. */
|
|
149
|
+
headSha: string;
|
|
150
|
+
/** Start SHA (GitLab diff_refs.start_sha analogue). */
|
|
151
|
+
startSha: string;
|
|
152
|
+
}
|
|
153
|
+
/** A unified diff plus optional anchoring SHAs. */
|
|
154
|
+
export interface UnifiedDiff {
|
|
155
|
+
/** The raw unified-diff text. */
|
|
156
|
+
text: string;
|
|
157
|
+
/** Anchoring SHAs; all-or-nothing (see {@link DiffRefs}). */
|
|
158
|
+
diffRefs?: DiffRefs;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* A full change request projection (after fetch).
|
|
162
|
+
*
|
|
163
|
+
* Carries the fields the review engine needs to anchor a review: head SHA, the
|
|
164
|
+
* base branch it targets, and the author.
|
|
165
|
+
*/
|
|
166
|
+
export interface ChangeRequest {
|
|
167
|
+
/** Reference identifying this change request. */
|
|
168
|
+
ref: ChangeRequestRef;
|
|
169
|
+
/** Head commit SHA. */
|
|
170
|
+
headSha: string;
|
|
171
|
+
/** Branch this change request targets. */
|
|
172
|
+
baseBranch: string;
|
|
173
|
+
/** Author of the change request. */
|
|
174
|
+
author: Actor;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* BOXED comment identifier (R-COMMENTID).
|
|
178
|
+
*
|
|
179
|
+
* Never pass a bare number where a comment id is expected. The `kind` tag plus
|
|
180
|
+
* the opaque `raw` value prevents a GitHub comment id from being silently used
|
|
181
|
+
* as a GitLab note id (and vice-versa). `raw` is intentionally `string | number`
|
|
182
|
+
* because forges differ (GitHub: number, GitLab note id: number, but some
|
|
183
|
+
* resources are string-keyed) — consumers MUST treat it as opaque.
|
|
184
|
+
*/
|
|
185
|
+
export interface CommentId {
|
|
186
|
+
/** Discriminator naming the resource/forge the id belongs to. */
|
|
187
|
+
kind: string;
|
|
188
|
+
/** Opaque forge-native identifier. Treat as opaque — do not parse. */
|
|
189
|
+
raw: string | number;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Result of upserting the single summary comment.
|
|
193
|
+
*
|
|
194
|
+
* `created` is the surviving summary comment id; `deleted` lists any stale prior
|
|
195
|
+
* summary comment ids that were removed during the upsert (idempotency cleanup).
|
|
196
|
+
*
|
|
197
|
+
* BOUNDARY DECISION (forge-agnostic P1): ids here are PLAIN FORGE-NATIVE
|
|
198
|
+
* primitives (e.g. GitHub numeric comment ids), NOT boxed {@link CommentId}.
|
|
199
|
+
* The {@link CommentId} boxing ({kind, raw}) happens caller-LOCAL (review.ts)
|
|
200
|
+
* after the adapter returns — it is NOT part of the adapter↔caller wire shape.
|
|
201
|
+
* `CommentId` remains the canonical boxed type for cross-forge comment
|
|
202
|
+
* identity elsewhere; only THIS result intentionally stays native.
|
|
203
|
+
*/
|
|
204
|
+
export interface UpsertSummaryResult {
|
|
205
|
+
/** The forge-native id of the summary comment that now exists. */
|
|
206
|
+
created: number;
|
|
207
|
+
/** Forge-native ids of stale summary comments removed during upsert. */
|
|
208
|
+
deleted: number[];
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Outcome of publishing a batch of inline comments.
|
|
212
|
+
*
|
|
213
|
+
* Partial success is representable: `posted` holds the ids that succeeded,
|
|
214
|
+
* `failed` records the index (into the input array) and error for each failure.
|
|
215
|
+
*/
|
|
216
|
+
export interface PublishReport {
|
|
217
|
+
/** Comment ids that were successfully posted. */
|
|
218
|
+
posted: CommentId[];
|
|
219
|
+
/** Per-item failures, keyed by input index. */
|
|
220
|
+
failed: PublishFailure[];
|
|
221
|
+
}
|
|
222
|
+
/** A single inline-publish failure. */
|
|
223
|
+
export interface PublishFailure {
|
|
224
|
+
/** Index into the input {@link InlineComment} array. */
|
|
225
|
+
index: number;
|
|
226
|
+
/** Human-readable error. */
|
|
227
|
+
error: string;
|
|
228
|
+
/**
|
|
229
|
+
* The HTTP status of the underlying forge failure, when one was carried on the
|
|
230
|
+
* thrown error (e.g. `401`, `403`, `422`, `500`). Absent when the failure had
|
|
231
|
+
* no usable numeric status (e.g. a network error or a non-HTTP throw). Lets a
|
|
232
|
+
* caller distinguish an auth failure from a transient/server one WITHOUT
|
|
233
|
+
* string-parsing {@link PublishFailure.error}. Additive + optional, so older
|
|
234
|
+
* consumers are unaffected.
|
|
235
|
+
*/
|
|
236
|
+
status?: number;
|
|
237
|
+
/**
|
|
238
|
+
* `true` when the failure was an AUTHENTICATION/authorization failure (HTTP
|
|
239
|
+
* 401/403). A static-token forge cannot recover from this (nothing to re-mint),
|
|
240
|
+
* so a caller can surface "fix your token" guidance instead of treating it as a
|
|
241
|
+
* retry-able transient. Absent/`false` for non-auth failures. Additive +
|
|
242
|
+
* optional.
|
|
243
|
+
*/
|
|
244
|
+
authFailure?: boolean;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Declarative capability HINTS for an adapter.
|
|
248
|
+
*
|
|
249
|
+
* R-CAPABILITY: these flags are HINTS ONLY (e.g. for UI / planning). They MUST
|
|
250
|
+
* NOT be used as the runtime guard for calling an optional method. The runtime
|
|
251
|
+
* guard is ALWAYS method-presence (`'methodName' in adapter`). See
|
|
252
|
+
* `ports/forge-adapter.ts`.
|
|
253
|
+
*/
|
|
254
|
+
export interface ForgeCapabilities {
|
|
255
|
+
/** Adapter can add reactions to comments. */
|
|
256
|
+
readonly reactions: boolean;
|
|
257
|
+
/** Adapter can publish inline (line-anchored) comments. */
|
|
258
|
+
readonly inlineComments: boolean;
|
|
259
|
+
/** Adapter can read a dependency graph for the repo. */
|
|
260
|
+
readonly graphRead: boolean;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* An HTML marker embedded in a comment body to identify GHAGGA-owned comments.
|
|
264
|
+
*
|
|
265
|
+
* Typically an HTML comment like `<!-- ghagga:summary -->` so it renders
|
|
266
|
+
* invisibly but is machine-extractable for idempotent upserts.
|
|
267
|
+
*/
|
|
268
|
+
export interface CommentMarker {
|
|
269
|
+
/** The literal HTML marker string. */
|
|
270
|
+
html: string;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* A comment normalized into forge-agnostic shape.
|
|
274
|
+
*
|
|
275
|
+
* Produced by the webhook codec when parsing an incoming comment event so the
|
|
276
|
+
* core engine never touches forge-specific payload shapes.
|
|
277
|
+
*/
|
|
278
|
+
export interface NormalizedComment {
|
|
279
|
+
/** Change request the comment belongs to. */
|
|
280
|
+
ref: ChangeRequestRef;
|
|
281
|
+
/** Boxed id of the comment itself. */
|
|
282
|
+
commentId: CommentId;
|
|
283
|
+
/** Comment body (markdown). */
|
|
284
|
+
body: string;
|
|
285
|
+
/** Who wrote the comment. */
|
|
286
|
+
author: Actor;
|
|
287
|
+
/** Author's relationship to the repo (trust gating). */
|
|
288
|
+
association: AuthorAssociation;
|
|
289
|
+
}
|
|
290
|
+
/** A parsed, forge-agnostic webhook event. */
|
|
291
|
+
export type ForgeEvent = {
|
|
292
|
+
type: 'comment';
|
|
293
|
+
comment: NormalizedComment;
|
|
294
|
+
} | {
|
|
295
|
+
type: 'unsupported';
|
|
296
|
+
raw: unknown;
|
|
297
|
+
};
|
|
298
|
+
/**
|
|
299
|
+
* Minimal tenant-routing hint extracted from a webhook BEFORE verification.
|
|
300
|
+
*
|
|
301
|
+
* Used in the two-phase webhook flow to pick the right secret/credentials for
|
|
302
|
+
* the verify step. Contains no trusted data — only enough to route.
|
|
303
|
+
*/
|
|
304
|
+
export interface TenantHint {
|
|
305
|
+
/** Which forge the webhook came from. */
|
|
306
|
+
forge: ForgeKind;
|
|
307
|
+
/** Opaque tenant routing key (installation id, project namespace, …). */
|
|
308
|
+
tenantKey: string;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,6CAA6C;AAC7C,eAAO,MAAM,UAAU;;;;CAIb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAErE,yDAAyD;AACzD,eAAO,MAAM,WAAW;;;;;CAKd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAC;AAExE,mEAAmE;AACnE,eAAO,MAAM,UAAU;;;CAGb,CAAC;AAEX,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAI7F;;;;;;;GAOG;AACH,MAAM,WAAW,OAAO;IACtB,sCAA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MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,GAAG,EAAE,gBAAgB,CAAC;IACtB,sCAAsC;IACtC,SAAS,EAAE,SAAS,CAAC;IACrB,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,6BAA6B;IAC7B,MAAM,EAAE,KAAK,CAAC;IACd,wDAAwD;IACxD,WAAW,EAAE,iBAAiB,CAAC;CAChC;AAED,8CAA8C;AAC9C,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,OAAO,EAAE,iBAAiB,CAAA;CAAE,GAC/C;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,GAAG,EAAE,OAAO,CAAA;CAAE,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,KAAK,EAAE,SAAS,CAAC;IACjB,yEAAyE;IACzE,SAAS,EAAE,MAAM,CAAC;CACnB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical forge-agnostic domain types.
|
|
3
|
+
*
|
|
4
|
+
* These types are the lingua franca between GHAGGA's core review engine and any
|
|
5
|
+
* concrete forge adapter (GitHub / GitLab / Gitea). They are deliberately
|
|
6
|
+
* provider-neutral: nothing here leaks a GitHub PR number, a GitLab IID, or a
|
|
7
|
+
* Gitea path as a bare primitive that could be mis-assigned across forges.
|
|
8
|
+
*
|
|
9
|
+
* Invariants enforced by these shapes:
|
|
10
|
+
* - R-COMMENTID: comment identifiers are BOXED ({@link CommentId}), never a bare
|
|
11
|
+
* number — a GitHub comment id and a GitLab note id must never be cross-assigned.
|
|
12
|
+
* - RepoRef identity keys on {@link RepoRef.nativeId} — `path` is mutable (repos
|
|
13
|
+
* get renamed/moved) and MUST NOT participate in identity.
|
|
14
|
+
* - ChangeRequestRef uses {@link ChangeRequestRef.iid} (project-scoped) with an
|
|
15
|
+
* optional {@link ChangeRequestRef.globalId} for forges that expose one.
|
|
16
|
+
*/
|
|
17
|
+
// ─── Kind enums (const-object pattern → single source of truth) ──
|
|
18
|
+
/** The forge providers GHAGGA can target. */
|
|
19
|
+
export const FORGE_KIND = {
|
|
20
|
+
GITHUB: 'github',
|
|
21
|
+
GITLAB: 'gitlab',
|
|
22
|
+
GITEA: 'gitea',
|
|
23
|
+
};
|
|
24
|
+
/** How a single file changed within a change request. */
|
|
25
|
+
export const CHANGE_KIND = {
|
|
26
|
+
ADDED: 'added',
|
|
27
|
+
MODIFIED: 'modified',
|
|
28
|
+
REMOVED: 'removed',
|
|
29
|
+
RENAMED: 'renamed',
|
|
30
|
+
};
|
|
31
|
+
/** Whether an {@link Actor} is a human or an automated account. */
|
|
32
|
+
export const ACTOR_KIND = {
|
|
33
|
+
USER: 'user',
|
|
34
|
+
BOT: 'bot',
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Relationship between a comment author and the repository.
|
|
38
|
+
*
|
|
39
|
+
* Mirrors GitHub's `author_association`; other forges map their nearest
|
|
40
|
+
* equivalent. Used for trust/permission gating (e.g. only act on commands from
|
|
41
|
+
* owners/members/collaborators).
|
|
42
|
+
*/
|
|
43
|
+
export const AUTHOR_ASSOCIATION = {
|
|
44
|
+
OWNER: 'owner',
|
|
45
|
+
MEMBER: 'member',
|
|
46
|
+
COLLABORATOR: 'collaborator',
|
|
47
|
+
CONTRIBUTOR: 'contributor',
|
|
48
|
+
NONE: 'none',
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,oEAAoE;AAEpE,6CAA6C;AAC7C,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC;AAIX,yDAAyD;AACzD,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,KAAK,EAAE,OAAO;IACd,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AAIX,mEAAmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;CACF,CAAC;AAIX;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,IAAI,EAAE,MAAM;CACJ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ghagga-forge",
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"description": "Forge-agnostic ports and domain types for GHAGGA (GitHub / GitLab / Gitea)",
|
|
10
|
+
"author": "JNZader",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "https://github.com/JNZader/ghagga.git",
|
|
15
|
+
"directory": "packages/forge"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/JNZader/ghagga#readme",
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/JNZader/ghagga/issues"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"ghagga",
|
|
23
|
+
"forge",
|
|
24
|
+
"github",
|
|
25
|
+
"gitlab",
|
|
26
|
+
"gitea",
|
|
27
|
+
"code-review"
|
|
28
|
+
],
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=20.0.0"
|
|
31
|
+
},
|
|
32
|
+
"main": "./dist/index.js",
|
|
33
|
+
"types": "./dist/index.d.ts",
|
|
34
|
+
"exports": {
|
|
35
|
+
".": {
|
|
36
|
+
"import": "./dist/index.js",
|
|
37
|
+
"types": "./dist/index.d.ts"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"dist",
|
|
42
|
+
"README.md"
|
|
43
|
+
],
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"ghagga-core": "3.1.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^25.9.1",
|
|
49
|
+
"typescript": "^6.0.3",
|
|
50
|
+
"vitest": "^4.1.9"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"build": "tsc && node scripts/copy-impl-assets.mjs",
|
|
54
|
+
"dev": "tsc --watch",
|
|
55
|
+
"typecheck": "tsc --noEmit",
|
|
56
|
+
"lint": "node scripts/lint-boundary.mjs && node scripts/lint-server-forge-boundary.mjs",
|
|
57
|
+
"lint:boundary": "node scripts/lint-boundary.mjs",
|
|
58
|
+
"lint:server-forge-boundary": "node scripts/lint-server-forge-boundary.mjs",
|
|
59
|
+
"test": "vitest run",
|
|
60
|
+
"test:coverage": "vitest run --coverage",
|
|
61
|
+
"test:watch": "vitest",
|
|
62
|
+
"clean": "rm -rf dist"
|
|
63
|
+
}
|
|
64
|
+
}
|