@leitwerk-dev/github 0.2.1 → 0.3.1

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 CHANGED
@@ -112,17 +112,25 @@ The local adapter supports `createIssue`, `setIssueLabel`, `setMembership`,
112
112
  `editFeedback` and `failNextResponse`. Membership, label events, feedback edits,
113
113
  write outcomes and Git history survive restart.
114
114
 
115
- Tool authorization and retry edge cases use an in-memory provider boundary.
116
- The recovery integration exercises real Git and reopens both provider storage and
117
- SQLite receipts: a lost create response and subsequent restart must retain one PR
118
- and the same receipt. This verifies local persistence and tool wiring, not live
119
- GitHub API compatibility.
115
+ ## Repository change process
116
+
117
+ Load [github-repo-change](../github-repo-change/README.md) to create changes from the
118
+ UI or labeled issues. Server-created integrations enumerate available profiles;
119
+ custom integrations may implement `profiles()` for launcher discovery.
120
+ `github_get_ci_diagnostics` verifies the selected process branches and current PR
121
+ head, then reads failed check annotations and Actions jobs. It returns at most ten
122
+ failed check details and ten failed job logs, with 64 KiB per log and explicit
123
+ truncation. Signed log downloads do not receive the API token. Actions read access
124
+ is required. Existing check-source callers remain compatible; the optional
125
+ `afterKey` suppresses a failure already consumed by a process.
126
+
127
+ Local adapter behavior does not establish live GitHub API compatibility.
120
128
 
121
129
  ## API support
122
130
 
123
131
  The following exported declarations are `@public`:
124
132
 
125
- - `@leitwerk-dev/github`: `GITHUB_CHECKS_KIND`, `GITHUB_ISSUE_CANCELLED_KIND`, `GITHUB_PR_FEEDBACK_KIND`, `GITHUB_PR_STATE_KIND`, `GITHUB_PR_TERMINAL_KIND`, `GitHubCheckSummary`, `GitHubGitIdentity`, `GitHubIntegration`, `GitHubIssue`, `GitHubPullRequest`, `default`, `githubExternal`, `githubIntegration`, `githubIssueWatcherSource`, `resolveGitHubProjectBinding`, `setupGitHubIntegration`.
133
+ - `@leitwerk-dev/github`: `GITHUB_CHECKS_KIND`, `GITHUB_ISSUE_CANCELLED_KIND`, `GITHUB_PR_FEEDBACK_KIND`, `GITHUB_PR_STATE_KIND`, `GITHUB_PR_TERMINAL_KIND`, `GitHubCheckSummary`, `GitHubGitIdentity`, `GitHubIntegration`, `GitHubIssue`, `GitHubPullRequest`, `GitHubRepository`, `default`, `githubExternal`, `githubIntegration`, `githubIssueWatcherSource`, `resolveGitHubProjectBinding`, `setupGitHubIntegration`.
126
134
  - `@leitwerk-dev/github/testing`: `LocalGitHubAdapter`, `LocalGitHubOptions`, `LocalGitHubRepository`, `LocalGitHubState`.
127
135
 
128
136
  Members have individual classifications; these exports do not make every member
@@ -137,3 +145,5 @@ Pull requests are matched by branch pair; comments and replies use hidden marker
137
145
  within their repository and thread. Reaction recovery matches the bot's identity.
138
146
  Update recovery compares requested fields, including normalized labels. Logged
139
147
  replays return the current object without reapplying the patch.
148
+
149
+ GitHub polling uses the SDK reporter with live GitHub source kinds and generation forwarding. Conflict reporting uses `createConflictReporter(kind)` without creating another remote object.
@@ -3,6 +3,8 @@ import type { GitHubClient } from "./client.js";
3
3
  export type GitHubClientLike = Pick<GitHubClient, keyof GitHubClient>;
4
4
  /** @public */
5
5
  export interface GitHubIntegration {
6
+ /** @public */
7
+ profiles?(): readonly string[];
6
8
  /** @public */
7
9
  client(profile: string): GitHubClientLike;
8
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,YAAY,CAAC,CAAC;AAEtE,cAAc;AACd,MAAM,WAAW,iBAAiB;IACjC,cAAc;IACd,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC1C;AAED,cAAc;AACd,eAAO,MAAM,iBAAiB,wEAE7B,CAAC"}
1
+ {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,iEAAiE;AACjE,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,YAAY,EAAE,MAAM,YAAY,CAAC,CAAC;AAEtE,cAAc;AACd,MAAM,WAAW,iBAAiB;IACjC,cAAc;IACd,QAAQ,CAAC,IAAI,SAAS,MAAM,EAAE,CAAC;IAC/B,cAAc;IACd,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAAC;CAC1C;AAED,cAAc;AACd,eAAO,MAAM,iBAAiB,wEAE7B,CAAC"}
@@ -299,7 +299,8 @@ var GitHubClient = class extends RepositoryHttpClient {
299
299
  failed
300
300
  };
301
301
  }
302
- /** Human feedback checked against current membership; delivery receipts use raw reads. @internal */
302
+ /** Human feedback checked against current membership; delivery receipts use raw reads. */
303
+ /** @internal */
303
304
  async listActionablePullRequestFeedback(owner, repo, number, signal) {
304
305
  return actionableFeedback(
305
306
  this,
@@ -319,6 +320,121 @@ var GitHubClient = class extends RepositoryHttpClient {
319
320
  const segment = kind === "inline" ? "pulls/comments" : "issues/comments";
320
321
  return this.pages(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`);
321
322
  }
323
+ /** @public */
324
+ async getCiDiagnostics(owner, repo, pullRequestNumber, headSha, signal) {
325
+ const pr = await this.getPullRequest(owner, repo, pullRequestNumber, signal);
326
+ if (pr.state !== "open" || pr.merged || pr.head.sha !== headSha)
327
+ throw new Error("CI diagnostics target a stale pull request revision");
328
+ const prefix = this.repositoryPath(owner, repo);
329
+ const checks = [];
330
+ for (let page = 1; ; page++) {
331
+ const batch = await this.request(
332
+ `${prefix}/commits/${encodeURIComponent(headSha)}/check-runs?filter=latest&per_page=100&page=${page}`,
333
+ { signal }
334
+ );
335
+ checks.push(...batch.check_runs);
336
+ if (batch.check_runs.length < 100) break;
337
+ }
338
+ const failed = checks.filter(
339
+ (c) => c.conclusion && !["success", "neutral", "skipped"].includes(c.conclusion)
340
+ );
341
+ const annotations = await Promise.all(
342
+ failed.slice(0, 10).map(async (check) => ({
343
+ /** @public */
344
+ id: check.id,
345
+ /** @public */
346
+ name: check.name,
347
+ /** @public */
348
+ output: check.output,
349
+ /** @public */
350
+ annotations: (await this.pages(`${prefix}/check-runs/${check.id}/annotations`, signal)).slice(0, 100)
351
+ }))
352
+ );
353
+ const jobs = [];
354
+ for (let page = 1; jobs.length < 10; page++) {
355
+ const runs = await this.request(
356
+ `${prefix}/actions/runs?head_sha=${encodeURIComponent(headSha)}&per_page=100&page=${page}`,
357
+ { signal }
358
+ );
359
+ for (const run of runs.workflow_runs) {
360
+ if (run.head_sha !== headSha || run.head_branch !== pr.head.ref || !run.conclusion || ["success", "neutral", "skipped"].includes(run.conclusion))
361
+ continue;
362
+ for (let jobPage = 1; jobs.length < 10; jobPage++) {
363
+ const batch = await this.request(`${prefix}/actions/runs/${run.id}/jobs?filter=latest&per_page=100&page=${jobPage}`, {
364
+ signal
365
+ });
366
+ for (const job of batch.jobs) {
367
+ if (!job.conclusion || ["success", "neutral", "skipped"].includes(job.conclusion) || jobs.length >= 10)
368
+ continue;
369
+ jobs.push({
370
+ id: job.id,
371
+ name: job.name,
372
+ html_url: job.html_url,
373
+ log: await this.readJobLog(owner, repo, job.id, signal)
374
+ });
375
+ }
376
+ if (batch.jobs.length < 100) break;
377
+ }
378
+ }
379
+ if (runs.workflow_runs.length < 100) break;
380
+ }
381
+ const refreshed = await this.getPullRequest(owner, repo, pullRequestNumber, signal);
382
+ if (refreshed.head.sha !== headSha || refreshed.state !== "open" || refreshed.merged)
383
+ throw new Error("CI diagnostics were superseded");
384
+ return {
385
+ /** @public */
386
+ headSha,
387
+ /** @public */
388
+ checks: annotations,
389
+ /** @public */
390
+ jobs,
391
+ /** @public */
392
+ truncated: failed.length > 10 || jobs.length >= 10
393
+ };
394
+ }
395
+ async readJobLog(owner, repo, job, signal) {
396
+ const timeout = signal ? AbortSignal.any([signal, AbortSignal.timeout(3e4)]) : AbortSignal.timeout(3e4);
397
+ let response = await fetch(
398
+ `${this.profile.apiBaseUrl}${this.repositoryPath(owner, repo)}/actions/jobs/${job}/logs`,
399
+ {
400
+ headers: {
401
+ Authorization: `Bearer ${this.profile.token}`,
402
+ Accept: "application/vnd.github+json"
403
+ },
404
+ redirect: "manual",
405
+ signal: timeout
406
+ }
407
+ );
408
+ if (response.status === 302) {
409
+ const location = new URL(response.headers.get("location") ?? "");
410
+ if (location.protocol !== "https:" || location.username || location.password)
411
+ throw new Error("Invalid GitHub log download URL");
412
+ await response.body?.cancel();
413
+ response = await fetch(location, { redirect: "error", signal: timeout });
414
+ }
415
+ if (!response.ok) throw new IntegrationHttpError(response.status, "GitHub job log unavailable");
416
+ const reader = response.body?.getReader();
417
+ if (!reader) return { text: "", truncated: false };
418
+ const chunks = [];
419
+ let bytes = 0;
420
+ let truncated = false;
421
+ try {
422
+ for (; ; ) {
423
+ const next = await reader.read();
424
+ if (next.done) break;
425
+ const part = next.value.slice(0, 65536 - bytes);
426
+ chunks.push(part);
427
+ bytes += part.length;
428
+ if (bytes === 65536) {
429
+ truncated = true;
430
+ break;
431
+ }
432
+ }
433
+ } finally {
434
+ await reader.cancel();
435
+ }
436
+ return { text: Buffer.concat(chunks).toString("utf8"), truncated };
437
+ }
322
438
  /** @internal */
323
439
  listReleases(owner, repo) {
324
440
  return this.pages(`${this.repositoryPath(owner, repo)}/releases`);
@@ -341,4 +457,4 @@ export {
341
457
  assertGitHubRepository,
342
458
  GitHubClient
343
459
  };
344
- //# sourceMappingURL=chunk-6X3F3VHK.js.map
460
+ //# sourceMappingURL=chunk-PNHJ5QZ6.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/authorization.ts","../src/client.ts"],"sourcesContent":["import type { GitHubClient, GitHubFeedbackItem, GitHubIssue } from \"./client.js\";\n\ntype MembershipClient = Pick<GitHubClient, \"profile\" | \"isOrganizationMember\">;\n\nexport async function authorizedTrigger(\n\tclient: MembershipClient & Pick<GitHubClient, \"getIssue\" | \"listIssueEvents\">,\n\towner: string,\n\trepo: string,\n\tnumber: number,\n\ttrigger: string,\n\tdone: string,\n) {\n\tif (\n\t\tclient.profile.allowedOrganization &&\n\t\towner.toLowerCase() !== client.profile.allowedOrganization.toLowerCase()\n\t)\n\t\treturn null;\n\tconst issue = (await client.getIssue(owner, repo, number)) as GitHubIssue & {\n\t\t/** @internal */\n\t\tpull_request?: unknown;\n\t};\n\tif (\n\t\tissue.pull_request ||\n\t\tissue.state !== \"open\" ||\n\t\t!issue.labels.some((label) => label.name === trigger) ||\n\t\tissue.labels.some((label) => label.name === done)\n\t)\n\t\treturn null;\n\tconst last = (await client.listIssueEvents(owner, repo, number))\n\t\t.filter(\n\t\t\t(event) =>\n\t\t\t\t(event.event === \"labeled\" || event.event === \"unlabeled\") && event.label?.name === trigger,\n\t\t)\n\t\t.sort((a, b) => b.id - a.id)[0];\n\tif (\n\t\tlast?.event !== \"labeled\" ||\n\t\t!last.actor?.login ||\n\t\t!(await client.isOrganizationMember(last.actor.login))\n\t)\n\t\treturn null;\n\treturn {\n\t\t/** @internal */\n\t\tissue,\n\t\t/** @internal */\n\t\tactor: last.actor.login,\n\t\t/** @internal */\n\t\teventId: last.id,\n\t};\n}\n\nexport async function actionableFeedback(client: MembershipClient, feedback: GitHubFeedbackItem[]) {\n\tconst authorized: GitHubFeedbackItem[] = [];\n\tfor (const item of feedback) {\n\t\tif (\n\t\t\titem.author.toLowerCase() === client.profile.botLogin.toLowerCase() ||\n\t\t\titem.body.includes(\"<!-- leitwerk-write:\")\n\t\t)\n\t\t\tcontinue;\n\t\tif (await client.isOrganizationMember(item.author)) authorized.push(item);\n\t}\n\treturn authorized;\n}\n","import { asUnknownRecord } from \"@leitwerk-dev/domain\";\nimport {\n\ttype RepositoryFeedbackItem as GitHubFeedbackItem,\n\ttype RepositoryIssue as GitHubIssue,\n\ttype RepositoryPullRequest as GitHubPullRequest,\n\tIntegrationHttpError,\n\tnormalizeRepositoryFeedback as normalize,\n\tRepositoryHttpClient,\n} from \"@leitwerk-dev/process-sdk\";\n\nimport { actionableFeedback, authorizedTrigger } from \"./authorization.js\";\n\nexport type { GitHubFeedbackItem, GitHubIssue, GitHubPullRequest };\n\n/** @internal */\ninterface GitHubLabel {\n\t/** @internal */\n\tid: number;\n\t/** @internal */\n\tname: string;\n}\n\n/** @public */\nexport interface GitHubRepository {\n\t/** @public */\n\tname: string;\n\t/** @internal */\n\tfull_name: string;\n\t/** @public */\n\towner: {\n\t\t/** @public */\n\t\tlogin: string;\n\t};\n\t/** @public */\n\tssh_url: string;\n\t/** @public */\n\tdefault_branch: string;\n\t/** @internal */\n\thtml_url: string;\n\t/** @internal */\n\tarchived: boolean;\n\t/** @internal */\n\thas_issues: boolean;\n}\n/** @public */\nexport interface GitHubGitIdentity {\n\t/** @internal */\n\tprovider: \"github\";\n\t/** @internal */\n\tprofile: string;\n\t/** @internal */\n\tlogin: string;\n\t/** @public */\n\tname: string;\n\t/** @public */\n\temail: string;\n}\n/** @public */\nexport interface GitHubLabelEvent {\n\t/** @internal */\n\tid: number;\n\t/** @internal */\n\tevent: string;\n\t/** @public */\n\tlabel?: {\n\t\t/** @public */\n\t\tname: string;\n\t};\n\t/** @public */\n\tactor: {\n\t\t/** @public */\n\t\tlogin: string;\n\t} | null;\n}\n\n/** @internal */\nexport interface GitHubProfile {\n\t/** @internal */\n\tapiBaseUrl: string;\n\t/** @internal */\n\ttoken: string;\n\t/** @internal */\n\tbotLogin: string;\n\t/** @internal */\n\tallowedOrganization?: string;\n}\n\n/** @public */\nexport interface GitHubCheckSummary {\n\t/** @public */\n\theadSha: string;\n\t/** @public */\n\tstatus: \"pending\" | \"success\" | \"failure\";\n\t/** @public */\n\ttotal: number;\n\t/** @public */\n\tfailed: Array<{\n\t\t/** @internal */\n\t\tname: string;\n\t\t/** @public */\n\t\tconclusion: string | null;\n\t\t/** @public */\n\t\turl: string | null;\n\t}>;\n}\n\n/** @public */\nexport interface GitHubRelease {\n\t/** @internal */\n\tid: number;\n\t/** @public */\n\ttag_name: string;\n\t/** @internal */\n\ttarget_commitish: string;\n\t/** @internal */\n\tdraft: boolean;\n\t/** @internal */\n\tprerelease: boolean;\n\t/** @internal */\n\thtml_url: string;\n\t/** @public */\n\tassets: Array<{\n\t\t/** @public */\n\t\tname: string;\n\t\t/** @public */\n\t\turl: string;\n\t\t/** @public */\n\t\tbrowser_download_url: string;\n\t}>;\n}\n\n/** @internal */\nexport function parseGitHubProfiles(value: unknown): Map<string, GitHubProfile> {\n\tconst profiles = new Map<string, GitHubProfile>();\n\tfor (const [name, raw] of Object.entries(\n\t\tasUnknownRecord(asUnknownRecord(value)?.profiles) ?? {},\n\t)) {\n\t\tconst config = asUnknownRecord(raw) ?? {};\n\t\tconst apiBaseUrl =\n\t\t\ttypeof config.api_base_url === \"string\"\n\t\t\t\t? config.api_base_url.replace(/\\/+$/, \"\")\n\t\t\t\t: \"https://api.github.com\";\n\t\tconst token = typeof config.token === \"string\" ? config.token.trim() : \"\";\n\t\tconst botLogin = typeof config.bot_login === \"string\" ? config.bot_login.trim() : \"leitwerk\";\n\t\tif (!/^https:\\/\\//.test(apiBaseUrl))\n\t\t\tthrow new Error(`GitHub profile '${name}' requires an HTTPS api_base_url`);\n\t\tif (!token) throw new Error(`GitHub profile '${name}' requires a token`);\n\t\tif (!botLogin) throw new Error(`GitHub profile '${name}' requires bot_login`);\n\t\tconst allowedOrganization = config.allowed_organization;\n\t\tif (\n\t\t\tallowedOrganization !== undefined &&\n\t\t\t(typeof allowedOrganization !== \"string\" || !/^[a-z0-9-]+$/i.test(allowedOrganization))\n\t\t) {\n\t\t\tthrow new Error(`GitHub profile '${name}' requires a valid allowed_organization`);\n\t\t}\n\t\tprofiles.set(name, {\n\t\t\tapiBaseUrl,\n\t\t\ttoken,\n\t\t\tbotLogin,\n\t\t\t...(typeof allowedOrganization === \"string\"\n\t\t\t\t? { allowedOrganization: allowedOrganization.toLowerCase() }\n\t\t\t\t: {}),\n\t\t});\n\t}\n\treturn profiles;\n}\n\n/** @internal */\nexport function assertGitHubRepository(profile: GitHubProfile, owner: string, repo: string): void {\n\tif (\n\t\t!/^[a-z0-9-]+$/i.test(owner) ||\n\t\t!/^[a-z0-9_.-]+$/i.test(repo) ||\n\t\trepo === \".\" ||\n\t\trepo === \"..\"\n\t) {\n\t\tthrow new Error(\"Invalid GitHub repository\");\n\t}\n\tif (\n\t\tprofile.allowedOrganization &&\n\t\towner.toLowerCase() !== profile.allowedOrganization.toLowerCase()\n\t) {\n\t\tthrow new Error(`GitHub project must belong to ${profile.allowedOrganization}`);\n\t}\n}\n\n/** @public */\nexport class GitHubClient extends RepositoryHttpClient {\n\t/** @internal */\n\tconstructor(/** @internal */ readonly profile: GitHubProfile) {\n\t\tsuper(\"GitHub\", profile.apiBaseUrl, {\n\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\tAuthorization: `Bearer ${profile.token}`,\n\t\t\t\"X-GitHub-Api-Version\": \"2022-11-28\",\n\t\t});\n\t}\n\n\t/** @internal */\n\tprotected override response(path: string, init: RequestInit = {}): Promise<Response> {\n\t\treturn super.response(path, {\n\t\t\t...init,\n\t\t\tredirect: \"error\",\n\t\t\tsignal: init.signal ?? AbortSignal.timeout(30_000),\n\t\t});\n\t}\n\n\t/** @internal */\n\tprotected override repositoryPath(owner: string, repo: string): string {\n\t\tassertGitHubRepository(this.profile, owner, repo);\n\t\treturn super.repositoryPath(owner, repo);\n\t}\n\n\t/** @internal */\n\tasync listRepositories() {\n\t\treturn (\n\t\t\tawait this.pages<GitHubRepository>(\n\t\t\t\tthis.profile.allowedOrganization\n\t\t\t\t\t? `/orgs/${this.profile.allowedOrganization}/repos?type=all`\n\t\t\t\t\t: \"/user/repos?affiliation=owner,collaborator,organization_member\",\n\t\t\t)\n\t\t).filter(\n\t\t\t(repo) =>\n\t\t\t\t(!this.profile.allowedOrganization ||\n\t\t\t\t\trepo.owner.login.toLowerCase() === this.profile.allowedOrganization.toLowerCase()) &&\n\t\t\t\t!repo.archived &&\n\t\t\t\trepo.has_issues,\n\t\t);\n\t}\n\t/** @internal */\n\tasync listOpenIssues(owner: string, repo: string) {\n\t\treturn (\n\t\t\tawait this.pages<\n\t\t\t\tGitHubIssue & {\n\t\t\t\t\t/** @internal */\n\t\t\t\t\tpull_request?: unknown;\n\t\t\t\t}\n\t\t\t>(`${this.repositoryPath(owner, repo)}/issues?state=open`)\n\t\t).filter((issue) => !issue.pull_request);\n\t}\n\t/** @internal */\n\tlistIssueEvents(owner: string, repo: string, number: number) {\n\t\treturn this.pages<GitHubLabelEvent>(\n\t\t\t`${this.repositoryPath(owner, repo)}/issues/${number}/events`,\n\t\t);\n\t}\n\t/** @internal */\n\tasync isOrganizationMember(login: string): Promise<boolean> {\n\t\tif (!this.profile.allowedOrganization) return true;\n\t\tif (!/^[a-z0-9-]+$/i.test(login)) return false;\n\t\ttry {\n\t\t\tconst response = await this.response(\n\t\t\t\t`/orgs/${this.profile.allowedOrganization}/members/${encodeURIComponent(login)}`,\n\t\t\t);\n\t\t\treturn response.status === 204;\n\t\t} catch (error) {\n\t\t\tif (error instanceof IntegrationHttpError) {\n\t\t\t\tif (error.status === 404) return false;\n\t\t\t\tthrow new Error(`GitHub membership check failed with ${error.status}`);\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\t/** @internal */\n\tasync authorizedTrigger(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\ttrigger: string,\n\t\tdone: string,\n\t) {\n\t\treturn authorizedTrigger(this, owner, repo, number, trigger, done);\n\t}\n\t/** @public */\n\tasync resolveGitIdentity(profile: string): Promise<GitHubGitIdentity> {\n\t\tconst user = await this.request<{ login: string; name: string | null; id: number }>(\"/user\");\n\t\tif (user.login !== this.profile.botLogin)\n\t\t\tthrow new Error(\"GitHub authenticated user does not match bot_login\");\n\t\treturn {\n\t\t\tprovider: \"github\",\n\t\t\tprofile,\n\t\t\tlogin: user.login,\n\t\t\tname: user.name || user.login,\n\t\t\temail: `${user.id}+${user.login}@users.noreply.github.com`,\n\t\t};\n\t}\n\t/** @public */\n\tupdateIssue(owner: string, repo: string, number: number, patch: Record<string, unknown>) {\n\t\treturn this.request<GitHubIssue>(`${this.repositoryPath(owner, repo)}/issues/${number}`, {\n\t\t\tmethod: \"PATCH\",\n\t\t\tbody: JSON.stringify(patch),\n\t\t});\n\t}\n\t/** @internal */\n\tlistLabels(owner: string, repo: string) {\n\t\treturn this.pages<GitHubLabel>(`${this.repositoryPath(owner, repo)}/labels`);\n\t}\n\t/** @internal */\n\tcreateLabel(owner: string, repo: string, name: string) {\n\t\treturn this.request<GitHubLabel>(`${this.repositoryPath(owner, repo)}/labels`, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ name, color: \"238636\" }),\n\t\t});\n\t}\n\t/** @internal */\n\tasync ensureLabel(owner: string, repo: string, name: string) {\n\t\tconst labels = await this.listLabels(owner, repo);\n\t\treturn labels.find((label) => label.name === name) ?? this.createLabel(owner, repo, name);\n\t}\n\t/** @internal */\n\taddFeedbackReaction(owner: string, repo: string, kind: string, id: number) {\n\t\tconst segment = kind === \"inline\" ? \"pulls/comments\" : \"issues/comments\";\n\t\treturn this.request(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody: JSON.stringify({ content: \"eyes\" }),\n\t\t});\n\t}\n\t/** @internal */\n\tasync replyFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tpr: number,\n\t\tkind: string,\n\t\tid: number,\n\t\tbody: string,\n\t) {\n\t\tif (kind === \"inline\")\n\t\t\treturn this.writeJson(\n\t\t\t\t`${this.repositoryPath(owner, repo)}/pulls/${pr}/comments/${id}/replies`,\n\t\t\t\t\"POST\",\n\t\t\t\t{ body },\n\t\t\t);\n\t\treturn this.addIssueComment(owner, repo, pr, body);\n\t}\n\n\t/** @internal */\n\tgetCommit(owner: string, repo: string, ref: string) {\n\t\treturn this.request<{\n\t\t\t/** @internal */\n\t\t\tsha: string;\n\t\t}>(`${this.repositoryPath(owner, repo)}/commits/${encodeURIComponent(ref)}`);\n\t}\n\n\t/** @public */\n\tasync isAncestor(owner: string, repo: string, ancestor: string, descendant: string) {\n\t\tconst comparison = await this.request<{ status: string }>(\n\t\t\t`${this.repositoryPath(owner, repo)}/compare/${encodeURIComponent(ancestor)}...${encodeURIComponent(descendant)}`,\n\t\t);\n\t\treturn comparison.status === \"identical\" || comparison.status === \"ahead\";\n\t}\n\n\t/** @public */\n\tasync listPullRequestFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\tsignal?: AbortSignal,\n\t): Promise<GitHubFeedbackItem[]> {\n\t\tconst prefix = `${this.repositoryPath(owner, repo)}`;\n\t\tconst [conversation, reviews, inline] = await Promise.all([\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/issues/${number}/comments`, signal),\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/pulls/${number}/reviews`, signal),\n\t\t\tthis.pages<Record<string, unknown>>(`${prefix}/pulls/${number}/comments`, signal),\n\t\t]);\n\n\t\tconst candidates = [\n\t\t\t...conversation.map((item) => ({ kind: \"conversation\" as const, item })),\n\t\t\t...reviews.map((item) => ({ kind: \"review\" as const, item })),\n\t\t\t...inline.map((item) => ({ kind: \"inline\" as const, item })),\n\t\t];\n\t\tconst feedback: GitHubFeedbackItem[] = [];\n\t\tconst needsProvenance: typeof candidates = [];\n\t\tfor (const candidate of candidates) {\n\t\t\tconst { kind, item } = candidate;\n\t\t\tconst normalized = normalize(kind, item);\n\t\t\tif (!normalized) continue;\n\t\t\tconst createdAt = typeof item.created_at === \"string\" ? Date.parse(item.created_at) : NaN;\n\t\t\tconst updatedAt = typeof item.updated_at === \"string\" ? Date.parse(item.updated_at) : NaN;\n\t\t\tif (\n\t\t\t\t!this.profile.allowedOrganization ||\n\t\t\t\t(kind !== \"review\" && Number.isFinite(createdAt) && createdAt === updatedAt)\n\t\t\t) {\n\t\t\t\tfeedback.push(normalized);\n\t\t\t} else if (typeof item.node_id === \"string\" && item.node_id) {\n\t\t\t\t// REST attributes edited bodies to their original author. Reviews also\n\t\t\t\t// omit edit timestamps, so obtain the body and latest editor together.\n\t\t\t\tneedsProvenance.push(candidate);\n\t\t\t}\n\t\t}\n\t\tfor (let offset = 0; offset < needsProvenance.length; offset += 100) {\n\t\t\tconst batch = needsProvenance.slice(offset, offset + 100);\n\t\t\tconst response = await this.request<{\n\t\t\t\tdata?: { nodes?: Array<Record<string, unknown> | null> };\n\t\t\t\terrors?: unknown[];\n\t\t\t}>(\"/graphql\", {\n\t\t\t\tmethod: \"POST\",\n\t\t\t\tsignal,\n\t\t\t\tbody: JSON.stringify({\n\t\t\t\t\tquery: `query LeitwerkFeedbackProvenance($ids: [ID!]!) {\n\t\t\t\t\t\tnodes(ids: $ids) {\n\t\t\t\t\t\t\tid __typename\n\t\t\t\t\t\t\t... on IssueComment { body createdAt lastEditedAt author { login } editor { login } }\n\t\t\t\t\t\t\t... on PullRequestReview { body createdAt submittedAt lastEditedAt author { login } editor { login } }\n\t\t\t\t\t\t\t... on PullRequestReviewComment { body createdAt lastEditedAt author { login } editor { login } path line }\n\t\t\t\t\t\t}\n\t\t\t\t\t}`,\n\t\t\t\t\tvariables: { ids: batch.map(({ item }) => item.node_id) },\n\t\t\t\t}),\n\t\t\t});\n\t\t\tif (response.errors?.length || !Array.isArray(response.data?.nodes)) {\n\t\t\t\tthrow new Error(\"GitHub feedback provenance lookup failed\");\n\t\t\t}\n\t\t\tconst snapshots = new Map(\n\t\t\t\tresponse.data.nodes.filter((node) => node !== null).map((node) => [node.id, node]),\n\t\t\t);\n\t\t\tfor (const { kind, item } of batch) {\n\t\t\t\tconst snapshot = snapshots.get(item.node_id);\n\t\t\t\tconst expectedType = {\n\t\t\t\t\tconversation: \"IssueComment\",\n\t\t\t\t\treview: \"PullRequestReview\",\n\t\t\t\t\tinline: \"PullRequestReviewComment\",\n\t\t\t\t}[kind];\n\t\t\t\tif (!snapshot || snapshot.__typename !== expectedType) continue;\n\t\t\t\tconst publishedAt = kind === \"review\" ? snapshot.submittedAt : snapshot.createdAt;\n\t\t\t\tif (typeof publishedAt !== \"string\" || !Number.isFinite(Date.parse(publishedAt))) continue;\n\t\t\t\tconst editedAt = snapshot.lastEditedAt;\n\t\t\t\tif (editedAt !== null) {\n\t\t\t\t\tif (typeof editedAt !== \"string\" || !Number.isFinite(Date.parse(editedAt))) continue;\n\t\t\t\t\tconst editor = asUnknownRecord(snapshot.editor)?.login;\n\t\t\t\t\tif (typeof editor !== \"string\" || !(await this.isOrganizationMember(editor))) continue;\n\t\t\t\t}\n\t\t\t\tconst normalized = normalize(kind, {\n\t\t\t\t\t...snapshot,\n\t\t\t\t\tid: item.id,\n\t\t\t\t\tuser: snapshot.author,\n\t\t\t\t\tcreated_at: editedAt ?? publishedAt,\n\t\t\t\t});\n\t\t\t\tif (normalized) feedback.push(normalized);\n\t\t\t}\n\t\t}\n\t\treturn feedback;\n\t}\n\n\t/** @public */\n\tasync getCheckSummary(owner: string, repo: string, headSha: string): Promise<GitHubCheckSummary> {\n\t\tconst runs: Array<Record<string, unknown>> = [];\n\t\tfor (let page = 1; ; page++) {\n\t\t\tconst response = await this.request<{ check_runs: Array<Record<string, unknown>> }>(\n\t\t\t\t`${this.repositoryPath(owner, repo)}/commits/${headSha}/check-runs?per_page=100&page=${page}`,\n\t\t\t);\n\t\t\truns.push(...response.check_runs);\n\t\t\tif (response.check_runs.length < 100) break;\n\t\t}\n\t\tconst terminalSuccess = new Set([\"success\", \"neutral\", \"skipped\"]);\n\t\tconst failed = runs\n\t\t\t.filter((run) => run.status === \"completed\" && !terminalSuccess.has(String(run.conclusion)))\n\t\t\t.map((run) => ({\n\t\t\t\tname: String(run.name ?? \"unknown\"),\n\t\t\t\tconclusion: typeof run.conclusion === \"string\" ? run.conclusion : null,\n\t\t\t\turl: typeof run.html_url === \"string\" ? run.html_url : null,\n\t\t\t}));\n\t\tconst pending = runs.some((run) => run.status !== \"completed\");\n\t\treturn {\n\t\t\theadSha,\n\t\t\tstatus: failed.length ? \"failure\" : pending || !runs.length ? \"pending\" : \"success\",\n\t\t\ttotal: runs.length,\n\t\t\tfailed,\n\t\t};\n\t}\n\n\t/** Human feedback checked against current membership; delivery receipts use raw reads. */\n\t/** @internal */\n\tasync listActionablePullRequestFeedback(\n\t\towner: string,\n\t\trepo: string,\n\t\tnumber: number,\n\t\tsignal?: AbortSignal,\n\t) {\n\t\treturn actionableFeedback(\n\t\t\tthis,\n\t\t\tawait this.listPullRequestFeedback(owner, repo, number, signal),\n\t\t);\n\t}\n\n\t/** @internal */\n\tlistFeedbackReplies(owner: string, repo: string, pr: number, kind: string) {\n\t\treturn kind === \"inline\"\n\t\t\t? this.pages<Record<string, unknown>>(\n\t\t\t\t\t`${this.repositoryPath(owner, repo)}/pulls/${pr}/comments`,\n\t\t\t\t)\n\t\t\t: this.listIssueComments(owner, repo, pr);\n\t}\n\n\t/** @internal */\n\tlistFeedbackReactions(owner: string, repo: string, kind: string, id: number) {\n\t\tif (kind !== \"inline\" && kind !== \"conversation\")\n\t\t\tthrow new Error(\"Reviews do not support reactions\");\n\t\tconst segment = kind === \"inline\" ? \"pulls/comments\" : \"issues/comments\";\n\t\treturn this.pages<{\n\t\t\t/** @internal */\n\t\t\tid: number;\n\t\t\t/** @internal */\n\t\t\tcontent: string;\n\t\t\t/** @internal */\n\t\t\tuser: {\n\t\t\t\t/** @internal */\n\t\t\t\tlogin: string;\n\t\t\t};\n\t\t}>(`${this.repositoryPath(owner, repo)}/${segment}/${id}/reactions`);\n\t}\n\n\t/** @public */\n\tasync getCiDiagnostics(\n\t\towner: string,\n\t\trepo: string,\n\t\tpullRequestNumber: number,\n\t\theadSha: string,\n\t\tsignal?: AbortSignal,\n\t) {\n\t\tconst pr = await this.getPullRequest(owner, repo, pullRequestNumber, signal);\n\t\tif (pr.state !== \"open\" || pr.merged || pr.head.sha !== headSha)\n\t\t\tthrow new Error(\"CI diagnostics target a stale pull request revision\");\n\t\tconst prefix = this.repositoryPath(owner, repo);\n\t\tconst checks: Array<{\n\t\t\t/** @internal */\n\t\t\tid: number;\n\t\t\tname: string;\n\t\t\tconclusion: string | null;\n\t\t\t/** @public */\n\t\t\toutput?: {\n\t\t\t\t/** @public */\n\t\t\t\ttitle?: string;\n\t\t\t\t/** @public */\n\t\t\t\tsummary?: string;\n\t\t\t\t/** @public */\n\t\t\t\ttext?: string;\n\t\t\t};\n\t\t}> = [];\n\t\tfor (let page = 1; ; page++) {\n\t\t\tconst batch = await this.request<{ check_runs: typeof checks }>(\n\t\t\t\t`${prefix}/commits/${encodeURIComponent(headSha)}/check-runs?filter=latest&per_page=100&page=${page}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t\tchecks.push(...batch.check_runs);\n\t\t\tif (batch.check_runs.length < 100) break;\n\t\t}\n\t\tconst failed = checks.filter(\n\t\t\t(c) => c.conclusion && ![\"success\", \"neutral\", \"skipped\"].includes(c.conclusion),\n\t\t);\n\t\tconst annotations = await Promise.all(\n\t\t\tfailed.slice(0, 10).map(async (check) => ({\n\t\t\t\t/** @public */\n\t\t\t\tid: check.id,\n\t\t\t\t/** @public */\n\t\t\t\tname: check.name,\n\t\t\t\t/** @public */\n\t\t\t\toutput: check.output,\n\t\t\t\t/** @public */\n\t\t\t\tannotations: (\n\t\t\t\t\tawait this.pages<unknown>(`${prefix}/check-runs/${check.id}/annotations`, signal)\n\t\t\t\t).slice(0, 100),\n\t\t\t})),\n\t\t);\n\t\tconst jobs: Array<{\n\t\t\t/** @public */\n\t\t\tid: number;\n\t\t\t/** @public */\n\t\t\tname: string;\n\t\t\t/** @public */\n\t\t\thtml_url: string;\n\t\t\t/** @public */\n\t\t\tlog: {\n\t\t\t\t/** @public */\n\t\t\t\ttext: string;\n\t\t\t\t/** @public */\n\t\t\t\ttruncated: boolean;\n\t\t\t};\n\t\t}> = [];\n\t\tfor (let page = 1; jobs.length < 10; page++) {\n\t\t\tconst runs = await this.request<{\n\t\t\t\tworkflow_runs: Array<{\n\t\t\t\t\tid: number;\n\t\t\t\t\thead_sha: string;\n\t\t\t\t\thead_branch: string;\n\t\t\t\t\tconclusion: string | null;\n\t\t\t\t}>;\n\t\t\t}>(\n\t\t\t\t`${prefix}/actions/runs?head_sha=${encodeURIComponent(headSha)}&per_page=100&page=${page}`,\n\t\t\t\t{ signal },\n\t\t\t);\n\t\t\tfor (const run of runs.workflow_runs) {\n\t\t\t\tif (\n\t\t\t\t\trun.head_sha !== headSha ||\n\t\t\t\t\trun.head_branch !== pr.head.ref ||\n\t\t\t\t\t!run.conclusion ||\n\t\t\t\t\t[\"success\", \"neutral\", \"skipped\"].includes(run.conclusion)\n\t\t\t\t)\n\t\t\t\t\tcontinue;\n\t\t\t\tfor (let jobPage = 1; jobs.length < 10; jobPage++) {\n\t\t\t\t\tconst batch = await this.request<{\n\t\t\t\t\t\tjobs: Array<{ id: number; name: string; html_url: string; conclusion: string | null }>;\n\t\t\t\t\t}>(`${prefix}/actions/runs/${run.id}/jobs?filter=latest&per_page=100&page=${jobPage}`, {\n\t\t\t\t\t\tsignal,\n\t\t\t\t\t});\n\t\t\t\t\tfor (const job of batch.jobs) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!job.conclusion ||\n\t\t\t\t\t\t\t[\"success\", \"neutral\", \"skipped\"].includes(job.conclusion) ||\n\t\t\t\t\t\t\tjobs.length >= 10\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tjobs.push({\n\t\t\t\t\t\t\tid: job.id,\n\t\t\t\t\t\t\tname: job.name,\n\t\t\t\t\t\t\thtml_url: job.html_url,\n\t\t\t\t\t\t\tlog: await this.readJobLog(owner, repo, job.id, signal),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tif (batch.jobs.length < 100) break;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (runs.workflow_runs.length < 100) break;\n\t\t}\n\t\tconst refreshed = await this.getPullRequest(owner, repo, pullRequestNumber, signal);\n\t\tif (refreshed.head.sha !== headSha || refreshed.state !== \"open\" || refreshed.merged)\n\t\t\tthrow new Error(\"CI diagnostics were superseded\");\n\t\treturn {\n\t\t\t/** @public */\n\t\t\theadSha,\n\t\t\t/** @public */\n\t\t\tchecks: annotations,\n\t\t\t/** @public */\n\t\t\tjobs,\n\t\t\t/** @public */\n\t\t\ttruncated: failed.length > 10 || jobs.length >= 10,\n\t\t};\n\t}\n\tprivate async readJobLog(\n\t\towner: string,\n\t\trepo: string,\n\t\tjob: number,\n\t\tsignal?: AbortSignal,\n\t): Promise<{ text: string; truncated: boolean }> {\n\t\tconst timeout = signal\n\t\t\t? AbortSignal.any([signal, AbortSignal.timeout(30000)])\n\t\t\t: AbortSignal.timeout(30000);\n\t\tlet response = await fetch(\n\t\t\t`${this.profile.apiBaseUrl}${this.repositoryPath(owner, repo)}/actions/jobs/${job}/logs`,\n\t\t\t{\n\t\t\t\theaders: {\n\t\t\t\t\tAuthorization: `Bearer ${this.profile.token}`,\n\t\t\t\t\tAccept: \"application/vnd.github+json\",\n\t\t\t\t},\n\t\t\t\tredirect: \"manual\",\n\t\t\t\tsignal: timeout,\n\t\t\t},\n\t\t);\n\t\tif (response.status === 302) {\n\t\t\tconst location = new URL(response.headers.get(\"location\") ?? \"\");\n\t\t\tif (location.protocol !== \"https:\" || location.username || location.password)\n\t\t\t\tthrow new Error(\"Invalid GitHub log download URL\");\n\t\t\tawait response.body?.cancel();\n\t\t\t// Signed storage URLs must never receive the GitHub credential.\n\t\t\tresponse = await fetch(location, { redirect: \"error\", signal: timeout });\n\t\t}\n\t\tif (!response.ok) throw new IntegrationHttpError(response.status, \"GitHub job log unavailable\");\n\t\tconst reader = response.body?.getReader();\n\t\tif (!reader) return { text: \"\", truncated: false };\n\t\tconst chunks: Uint8Array[] = [];\n\t\tlet bytes = 0;\n\t\tlet truncated = false;\n\t\ttry {\n\t\t\tfor (;;) {\n\t\t\t\tconst next = await reader.read();\n\t\t\t\tif (next.done) break;\n\t\t\t\tconst part = next.value.slice(0, 65536 - bytes);\n\t\t\t\tchunks.push(part);\n\t\t\t\tbytes += part.length;\n\t\t\t\tif (bytes === 65536) {\n\t\t\t\t\ttruncated = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tawait reader.cancel();\n\t\t}\n\t\treturn { text: Buffer.concat(chunks).toString(\"utf8\"), truncated };\n\t}\n\n\t/** @internal */\n\tlistReleases(owner: string, repo: string) {\n\t\treturn this.pages<GitHubRelease>(`${this.repositoryPath(owner, repo)}/releases`);\n\t}\n\n\t/** @public */\n\tdownloadReleaseAsset(asset: GitHubRelease[\"assets\"][number]): Promise<string> {\n\t\tconst url = new URL(asset.url);\n\t\tif (`${url.protocol}//${url.host}` !== this.profile.apiBaseUrl)\n\t\t\tthrow new Error(\"GitHub release asset URL does not match the configured API origin\");\n\t\treturn this.response(`${url.pathname}${url.search}`, {\n\t\t\theaders: { Accept: \"application/octet-stream\" },\n\t\t}).then((response) => response.text());\n\t}\n}\n"],"mappings":";AAIA,eAAsB,kBACrB,QACA,OACA,MACA,QACA,SACA,MACC;AACD,MACC,OAAO,QAAQ,uBACf,MAAM,YAAY,MAAM,OAAO,QAAQ,oBAAoB,YAAY;AAEvE,WAAO;AACR,QAAM,QAAS,MAAM,OAAO,SAAS,OAAO,MAAM,MAAM;AAIxD,MACC,MAAM,gBACN,MAAM,UAAU,UAChB,CAAC,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,OAAO,KACpD,MAAM,OAAO,KAAK,CAAC,UAAU,MAAM,SAAS,IAAI;AAEhD,WAAO;AACR,QAAM,QAAQ,MAAM,OAAO,gBAAgB,OAAO,MAAM,MAAM,GAC5D;AAAA,IACA,CAAC,WACC,MAAM,UAAU,aAAa,MAAM,UAAU,gBAAgB,MAAM,OAAO,SAAS;AAAA,EACtF,EACC,KAAK,CAAC,GAAG,MAAM,EAAE,KAAK,E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AAAA,EAGA,qBAAqB,OAAyD;AAC7E,UAAM,MAAM,IAAI,IAAI,MAAM,GAAG;AAC7B,QAAI,GAAG,IAAI,QAAQ,KAAK,IAAI,IAAI,OAAO,KAAK,QAAQ;AACnD,YAAM,IAAI,MAAM,mEAAmE;AACpF,WAAO,KAAK,SAAS,GAAG,IAAI,QAAQ,GAAG,IAAI,MAAM,IAAI;AAAA,MACpD,SAAS,EAAE,QAAQ,2BAA2B;AAAA,IAC/C,CAAC,EAAE,KAAK,CAAC,aAAa,SAAS,KAAK,CAAC;AAAA,EACtC;AACD;","names":[]}
package/dist/client.d.ts CHANGED
@@ -1,5 +1,12 @@
1
1
  import { type RepositoryFeedbackItem as GitHubFeedbackItem, type RepositoryIssue as GitHubIssue, type RepositoryPullRequest as GitHubPullRequest, RepositoryHttpClient } from "@leitwerk-dev/process-sdk";
2
2
  export type { GitHubFeedbackItem, GitHubIssue, GitHubPullRequest };
3
+ /** @internal */
4
+ interface GitHubLabel {
5
+ /** @internal */
6
+ id: number;
7
+ /** @internal */
8
+ name: string;
9
+ }
3
10
  /** @public */
4
11
  export interface GitHubRepository {
5
12
  /** @public */
@@ -41,25 +48,18 @@ export interface GitHubLabelEvent {
41
48
  id: number;
42
49
  /** @internal */
43
50
  event: string;
44
- /** @internal */
51
+ /** @public */
45
52
  label?: {
46
- /** @internal */
53
+ /** @public */
47
54
  name: string;
48
55
  };
49
- /** @internal */
56
+ /** @public */
50
57
  actor: {
51
- /** @internal */
58
+ /** @public */
52
59
  login: string;
53
60
  } | null;
54
61
  }
55
62
  /** @internal */
56
- interface GitHubLabel {
57
- /** @internal */
58
- id: number;
59
- /** @internal */
60
- name: string;
61
- }
62
- /** @internal */
63
63
  export interface GitHubProfile {
64
64
  /** @internal */
65
65
  apiBaseUrl: string;
@@ -80,7 +80,7 @@ export interface GitHubCheckSummary {
80
80
  total: number;
81
81
  /** @public */
82
82
  failed: Array<{
83
- /** @public */
83
+ /** @internal */
84
84
  name: string;
85
85
  /** @public */
86
86
  conclusion: string | null;
@@ -104,11 +104,11 @@ export interface GitHubRelease {
104
104
  html_url: string;
105
105
  /** @public */
106
106
  assets: Array<{
107
- /** @internal */
107
+ /** @public */
108
108
  name: string;
109
- /** @internal */
109
+ /** @public */
110
110
  url: string;
111
- /** @internal */
111
+ /** @public */
112
112
  browser_download_url: string;
113
113
  }>;
114
114
  }
@@ -121,9 +121,7 @@ export declare class GitHubClient extends RepositoryHttpClient {
121
121
  /** @internal */
122
122
  readonly profile: GitHubProfile;
123
123
  /** @internal */
124
- constructor(
125
- /** @internal */
126
- profile: GitHubProfile);
124
+ constructor(/** @internal */ profile: GitHubProfile);
127
125
  /** @internal */
128
126
  protected response(path: string, init?: RequestInit): Promise<Response>;
129
127
  /** @internal */
@@ -176,7 +174,8 @@ export declare class GitHubClient extends RepositoryHttpClient {
176
174
  listPullRequestFeedback(owner: string, repo: string, number: number, signal?: AbortSignal): Promise<GitHubFeedbackItem[]>;
177
175
  /** @public */
178
176
  getCheckSummary(owner: string, repo: string, headSha: string): Promise<GitHubCheckSummary>;
179
- /** Human feedback checked against current membership; delivery receipts use raw reads. @internal */
177
+ /** Human feedback checked against current membership; delivery receipts use raw reads. */
178
+ /** @internal */
180
179
  listActionablePullRequestFeedback(owner: string, repo: string, number: number, signal?: AbortSignal): Promise<GitHubFeedbackItem[]>;
181
180
  /** @internal */
182
181
  listFeedbackReplies(owner: string, repo: string, pr: number, kind: string): Promise<Record<string, unknown>[]>;
@@ -192,6 +191,48 @@ export declare class GitHubClient extends RepositoryHttpClient {
192
191
  login: string;
193
192
  };
194
193
  }[]>;
194
+ /** @public */
195
+ getCiDiagnostics(owner: string, repo: string, pullRequestNumber: number, headSha: string, signal?: AbortSignal): Promise<{
196
+ /** @public */
197
+ headSha: string;
198
+ /** @public */
199
+ checks: {
200
+ /** @public */
201
+ id: number;
202
+ /** @public */
203
+ name: string;
204
+ /** @public */
205
+ output: {
206
+ /** @public */
207
+ title?: string;
208
+ /** @public */
209
+ summary?: string;
210
+ /** @public */
211
+ text?: string;
212
+ } | undefined;
213
+ /** @public */
214
+ annotations: unknown[];
215
+ }[];
216
+ /** @public */
217
+ jobs: {
218
+ /** @public */
219
+ id: number;
220
+ /** @public */
221
+ name: string;
222
+ /** @public */
223
+ html_url: string;
224
+ /** @public */
225
+ log: {
226
+ /** @public */
227
+ text: string;
228
+ /** @public */
229
+ truncated: boolean;
230
+ };
231
+ }[];
232
+ /** @public */
233
+ truncated: boolean;
234
+ }>;
235
+ private readJobLog;
195
236
  /** @internal */
196
237
  listReleases(owner: string, repo: string): Promise<GitHubRelease[]>;
197
238
  /** @public */
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AACA,OAAO,EACN,KAAK,sBAAsB,IAAI,kBAAkB,EACjD,KAAK,eAAe,IAAI,WAAW,EACnC,KAAK,qBAAqB,IAAI,iBAAiB,EAG/C,oBAAoB,EACpB,MAAM,2BAA2B,CAAC;AAInC,YAAY,EAAE,kBAAkB,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;AAEnE,cAAc;AACd,MAAM,WAAW,gBAAgB;IAChC,cAAc;IACd,IAAI,EAAE,MAAM,CAAC;IACb,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc;IACd,KAAK,EAAE;QACN,cAAc;QACd,KAAK,EAAE,MAAM,CAAC;KACd,CAAC;IACF,cAAc;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,gBAAgB;IAChB,UAAU,EAAE,OAAO,CAAC;CACpB;AACD,cAAc;AACd,MAAM,WAAW,iBAAiB;IACjC,gBAAgB;IAChB,QAAQ,EAAE,QAAQ,CAAC;IACnB,gBAAgB;IAChB,OAAO,EAAE,MAAM,CA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B;IAChB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAQzE,gBAAgB;IAChB,qBAAqB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM;QAKzE,gBAAgB;YACZ,MAAM;QACV,gBAAgB;iBACP,MAAM;QACf,gBAAgB;cACV;YACL,gBAAgB;YAChB,KAAK,EAAE,MAAM,CAAC;SACd;;IAIH,cAAc;IACR,gBAAgB,CACrB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,iBAAiB,EAAE,MAAM,EACzB,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,WAAW;QA8GnB,cAAc;;QAEd,cAAc;;YA9Eb,cAAc;;YAEd,cAAc;;YAEd,cAAc;;gBAzBd,cAAc;wBACN,MAAM;gBACd,cAAc;0BACJ,MAAM;gBAChB,cAAc;uBACP,MAAM;;YAsBb,cAAc;;;QA0Ef,cAAc;;YAnEd,cAAc;gBACV,MAAM;YACV,cAAc;kBACR,MAAM;YACZ,cAAc;sBACJ,MAAM;YAChB,cAAc;iBACT;gBACJ,cAAc;gBACd,IAAI,EAAE,MAAM,CAAC;gBACb,cAAc;gBACd,SAAS,EAAE,OAAO,CAAC;aACnB;;QAyDD,cAAc;;;YAIF,UAAU;IAoDxB,gBAAgB;IAChB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;IAIxC,cAAc;IACd,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAQ7E"}
@@ -105,6 +105,7 @@ export declare const githubExternal: {
105
105
  /** @public */
106
106
  state: TState;
107
107
  }) => {
108
+ afterKey?: string;
108
109
  profile: string;
109
110
  owner: string;
110
111
  repo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AAC;IACrB,cAAc;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,cAAc;AACd,eAAO,MAAM,kBAAkB,mCAAmC,CAAC;AAEnE,cAAc;AACd,eAAO,MAAM,cAAc;IAC1B,cAAc;;;;;;;mBAEF,MAAM;iBACR,MAAM;eACR,MAAM;cACP,MAAM;kBACF,MAAM;iBACP,MAAM;;IAMhB,cAAc;;;;;;;IAOd,cAAc;;;;;;;IAOd,cAAc;;;;;;;IAOd,gBAAgB;;;;;;;IAMhB,cAAc;;;;;;;CAOd,CAAC"}
package/dist/index.d.ts CHANGED
@@ -14,7 +14,7 @@ export declare function setupGitHubIntegration(api: Parameters<NonNullable<Leitw
14
14
  export { resolveGitHubProjectBinding } from "./binding.js";
15
15
  export type { GitHubIntegration } from "./capability.js";
16
16
  export { githubIntegration } from "./capability.js";
17
- export type { GitHubCheckSummary, GitHubGitIdentity, GitHubIssue, GitHubPullRequest, } from "./client.js";
17
+ export type { GitHubCheckSummary, GitHubGitIdentity, GitHubIssue, GitHubPullRequest, GitHubRepository, } from "./client.js";
18
18
  export { GITHUB_CHECKS_KIND, GITHUB_ISSUE_CANCELLED_KIND, GITHUB_PR_FEEDBACK_KIND, GITHUB_PR_STATE_KIND, GITHUB_PR_TERMINAL_KIND, githubExternal, } from "./external.js";
19
19
  export { githubIssueWatcherSource } from "./issue-watcher.js";
20
20
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAC/F,OAAO,EAAE,KAAK,iBAAiB,EAAqB,MAAM,iBAAiB,CAAC;AAY5E,cAAc;AACd,QAAA,MAAM,SAAS,EAAE,uBAahB,CAAC;AAEF,eAAe,SAAS,CAAC;AAEzB,8EAA8E;AAC9E,wBAAgB,sBAAsB,CACrC,GAAG,EAAE,UAAU,CAAC,W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iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,YAAY,EACX,kBAAkB,EAClB,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,gBAAgB,GAChB,MAAM,aAAa,CAAC;AACrB,OAAO,EACN,kBAAkB,EAClB,2BAA2B,EAC3B,uBAAuB,EACvB,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  GitHubClient,
3
3
  assertGitHubRepository,
4
4
  parseGitHubProfiles
5
- } from "./chunk-6X3F3VHK.js";
5
+ } from "./chunk-PNHJ5QZ6.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { coreHostCapabilities } from "@leitwerk-dev/process-sdk";
@@ -14,15 +14,15 @@ var githubIntegration = createCapabilityToken(
14
14
  );
15
15
 
16
16
  // src/provider.ts
17
+ import { conflictEvidence, createConflictReporter } from "@leitwerk-dev/coding/repository-rebase";
17
18
  import { asUnknownRecord as asUnknownRecord2 } from "@leitwerk-dev/domain";
18
- import { conflictEvidence, createConflictReporter } from "@leitwerk-dev/repository-rebase";
19
19
  import { createPollSchedule as createPollSchedule2, emptyPollResult } from "@leitwerk-dev/watcher-utils";
20
20
 
21
21
  // src/external.ts
22
+ import { describeConflict } from "@leitwerk-dev/coding/repository-rebase";
22
23
  import {
23
24
  defineExternalActionSource
24
25
  } from "@leitwerk-dev/process-sdk";
25
- import { describeConflict } from "@leitwerk-dev/repository-rebase";
26
26
  var GITHUB_PR_STATE_KIND = "@leitwerk-private/github.pr_state";
27
27
  var GITHUB_RELEASE_KIND = "@leitwerk-private/github.release";
28
28
  function describeGitHubEvent(event) {
@@ -97,7 +97,6 @@ import {
97
97
  parseRepositoryPullRequestConfig as parsePrConfig,
98
98
  repositoryFeedbackBatch
99
99
  } from "@leitwerk-dev/process-sdk";
100
- import { sameSubscription as sameSubscription2 } from "@leitwerk-dev/repository-rebase";
101
100
  import { createPollSchedule } from "@leitwerk-dev/watcher-utils";
102
101
 
103
102
  // src/issue-watcher.ts
@@ -117,27 +116,18 @@ var githubIssueWatcherSource = defineProcessWatcherSource({
117
116
  import {
118
117
  createExternalSourcePollReporter
119
118
  } from "@leitwerk-dev/process-sdk";
120
- import { sameSubscription } from "@leitwerk-dev/repository-rebase";
121
119
  function githubPollReporter(sources, result) {
122
- const report = createExternalSourcePollReporter(sources, result, { forwardGeneration: true });
123
- const current = (armed) => [
124
- GITHUB_CHECKS_KIND,
125
- GITHUB_PR_STATE_KIND,
126
- GITHUB_PR_TERMINAL_KIND,
127
- GITHUB_PR_FEEDBACK_KIND,
128
- GITHUB_ISSUE_CANCELLED_KIND,
129
- GITHUB_RELEASE_KIND
130
- ].some((kind) => sources.listArmed(kind).some((value) => sameSubscription(armed, value)));
131
- return {
132
- ...report,
133
- async fire(armed, event, mergeKey) {
134
- if (!current(armed)) return false;
135
- return report.fire(armed, event, mergeKey);
136
- },
137
- observe(armed, input) {
138
- if (current(armed)) return report.observe(armed, input);
139
- }
140
- };
120
+ return createExternalSourcePollReporter(sources, result, {
121
+ forwardGeneration: true,
122
+ currentKinds: [
123
+ GITHUB_CHECKS_KIND,
124
+ GITHUB_PR_STATE_KIND,
125
+ GITHUB_PR_TERMINAL_KIND,
126
+ GITHUB_PR_FEEDBACK_KIND,
127
+ GITHUB_ISSUE_CANCELLED_KIND,
128
+ GITHUB_RELEASE_KIND
129
+ ]
130
+ });
141
131
  }
142
132
 
143
133
  // src/issue-provider.ts
@@ -252,8 +242,7 @@ function createGitHubIssuePolling(deps, integration, options = {}) {
252
242
  await poll(GITHUB_PR_TERMINAL_KIND, parsePrConfig, async (config, armed) => {
253
243
  const pr = await integration.client(config.profile).getPullRequest(config.owner, config.repo, config.prNumber);
254
244
  if (!pr.merged && pr.state !== "closed") return;
255
- if (!deps.externalSources.listArmed(GITHUB_PR_TERMINAL_KIND).some((current) => sameSubscription2(armed, current)))
256
- return;
245
+ if (!report.isCurrent(GITHUB_PR_TERMINAL_KIND, armed)) return;
257
246
  terminalInstances.add(armed.instanceId);
258
247
  const outcome = pr.merged ? "merged" : "closed";
259
248
  if (config.terminalOutcome && config.terminalOutcome !== outcome) return;
@@ -292,11 +281,9 @@ function createGitHubIssuePolling(deps, integration, options = {}) {
292
281
  }
293
282
  });
294
283
  if (checks.status !== "failure") return;
295
- await report.fire(
296
- armed,
297
- { checks },
298
- `${checks.headSha}:${checks.failed.map((run) => run.url).join(":")}`
299
- );
284
+ const evidenceKey = `${checks.headSha}:${checks.failed.map((run) => run.url).join(":")}`;
285
+ if (config.afterKey === evidenceKey) return;
286
+ await report.fire(armed, { checks }, evidenceKey);
300
287
  }
301
288
  );
302
289
  await poll(GITHUB_ISSUE_CANCELLED_KIND, parseIssueCancelledConfig, async (config, armed) => {
@@ -367,7 +354,7 @@ function parse(value) {
367
354
  function createGitHubProvider(deps, integration, options = {}) {
368
355
  const due = createPollSchedule2();
369
356
  const pollIssues = createGitHubIssuePolling(deps, integration, options);
370
- const reportConflict = createConflictReporter(deps.externalSources, GITHUB_PR_STATE_KIND);
357
+ const reportConflict = createConflictReporter(GITHUB_PR_STATE_KIND);
371
358
  return deps.polling.create({
372
359
  id: "github",
373
360
  pollInterval: () => "5s",
@@ -735,6 +722,29 @@ ${marker}`;
735
722
  }
736
723
  });
737
724
  }
725
+ api.tool({
726
+ name: "github_get_ci_diagnostics",
727
+ description: "Read failed check annotations and bounded Actions logs for the current request revision",
728
+ parameters: projectParameters(
729
+ { pullRequestNumber: { type: "integer" }, headSha: { type: "string" } },
730
+ ["pullRequestNumber", "headSha"]
731
+ ),
732
+ async execute(ctx, input) {
733
+ const t = target(ctx);
734
+ const client = integration.client(t.profile);
735
+ const number = numberArg(input, "pullRequestNumber");
736
+ const pr = await client.getPullRequest(t.owner, t.repo, number, ctx.signal);
737
+ if (pr.head.ref !== ctx.project?.workBranch || pr.base.ref !== ctx.project.baseBranch)
738
+ throw new Error("Pull request does not belong to the process branches");
739
+ return client.getCiDiagnostics(
740
+ t.owner,
741
+ t.repo,
742
+ number,
743
+ stringArg(input, "headSha"),
744
+ ctx.signal
745
+ );
746
+ }
747
+ });
738
748
  api.tool({
739
749
  name: "github_get_checks",
740
750
  description: "Read GitHub Actions check runs for a commit",
@@ -757,6 +767,7 @@ var extension = {
757
767
  setupServer(api, config) {
758
768
  const profiles = parseGitHubProfiles(config);
759
769
  const integration = {
770
+ profiles: () => [...profiles.keys()],
760
771
  client(profile) {
761
772
  const value = profiles.get(profile);
762
773
  if (!value) throw new Error(`Unknown GitHub profile '${profile}'`);