@leitwerk-dev/github 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +40 -0
  2. package/dist/authorization.d.ts +4 -0
  3. package/dist/authorization.d.ts.map +1 -1
  4. package/dist/binding.d.ts +1 -0
  5. package/dist/binding.d.ts.map +1 -1
  6. package/dist/capability.d.ts +6 -1
  7. package/dist/capability.d.ts.map +1 -1
  8. package/dist/{chunk-PVE52UFH.js → chunk-OAOKE6LC.js} +162 -20
  9. package/dist/chunk-OAOKE6LC.js.map +1 -0
  10. package/dist/client.d.ts +143 -8
  11. package/dist/client.d.ts.map +1 -1
  12. package/dist/external.d.ts +66 -0
  13. package/dist/external.d.ts.map +1 -1
  14. package/dist/index.d.ts +13 -11
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +160 -168
  17. package/dist/index.js.map +1 -1
  18. package/dist/issue-provider.d.ts.map +1 -1
  19. package/dist/issue-watcher.d.ts +12 -0
  20. package/dist/issue-watcher.d.ts.map +1 -1
  21. package/dist/poll-report.d.ts +2 -18
  22. package/dist/poll-report.d.ts.map +1 -1
  23. package/dist/provider.d.ts +3 -1
  24. package/dist/provider.d.ts.map +1 -1
  25. package/dist/testing/tool-fixture.d.ts +192 -0
  26. package/dist/testing/tool-fixture.d.ts.map +1 -0
  27. package/dist/testing.d.ts +67 -3
  28. package/dist/testing.d.ts.map +1 -1
  29. package/dist/testing.js +46 -4
  30. package/dist/testing.js.map +1 -1
  31. package/dist/tools.d.ts +1 -2
  32. package/dist/tools.d.ts.map +1 -1
  33. package/package.json +6 -7
  34. package/src/authorization.ts +9 -1
  35. package/src/binding.ts +1 -0
  36. package/src/capability.ts +6 -1
  37. package/src/client.ts +315 -28
  38. package/src/external.ts +54 -0
  39. package/src/index.ts +33 -11
  40. package/src/issue-provider.ts +4 -12
  41. package/src/issue-watcher.ts +16 -1
  42. package/src/poll-report.ts +5 -23
  43. package/src/provider.ts +1 -1
  44. package/src/testing/tool-fixture.ts +137 -0
  45. package/src/testing.ts +108 -9
  46. package/src/tools.ts +183 -175
  47. package/dist/chunk-PVE52UFH.js.map +0 -1
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  GitHubClient,
3
3
  assertGitHubRepository,
4
4
  parseGitHubProfiles
5
- } from "./chunk-PVE52UFH.js";
5
+ } from "./chunk-OAOKE6LC.js";
6
6
 
7
7
  // src/index.ts
8
8
  import { coreHostCapabilities } from "@leitwerk-dev/process-sdk";
@@ -46,34 +46,40 @@ var GITHUB_PR_FEEDBACK_KIND = "@leitwerk-public/github.pr_feedback";
46
46
  var GITHUB_ISSUE_CANCELLED_KIND = "@leitwerk-public/github.issue_cancelled";
47
47
  var GITHUB_CHECKS_KIND = "@leitwerk-public/github.checks";
48
48
  var githubExternal = {
49
+ /** @public */
49
50
  checks: defineExternalActionSource({
50
51
  kind: GITHUB_CHECKS_KIND,
51
52
  describeEvent: describeGitHubEvent,
52
53
  label: "GitHub Actions failures"
53
54
  }),
55
+ /** @public */
54
56
  issueCancelled: defineExternalActionSource({
55
57
  kind: GITHUB_ISSUE_CANCELLED_KIND,
56
58
  describeEvent: () => ({ summary: "Source issue cancelled" }),
57
59
  label: "GitHub source issue cancelled",
58
60
  description: "Fires when the source issue closes or loses its trigger label"
59
61
  }),
62
+ /** @public */
60
63
  pullRequestTerminal: defineExternalActionSource({
61
64
  kind: GITHUB_PR_TERMINAL_KIND,
62
65
  describeEvent: describeGitHubEvent,
63
66
  label: "GitHub pull request merged or closed",
64
67
  description: "Fires when the tracked pull request reaches a terminal state"
65
68
  }),
69
+ /** @public */
66
70
  pullRequestFeedback: defineExternalActionSource({
67
71
  kind: GITHUB_PR_FEEDBACK_KIND,
68
72
  describeEvent: () => ({ summary: "Pull request feedback received" }),
69
73
  label: "GitHub pull request feedback",
70
74
  description: "Fires after unseen human feedback has been quiet long enough to batch"
71
75
  }),
76
+ /** @internal */
72
77
  releaseContaining: defineExternalActionSource({
73
78
  kind: GITHUB_RELEASE_KIND,
74
79
  label: "Published GitHub release",
75
80
  description: "Fires when a published release contains the tracked merge commit"
76
81
  }),
82
+ /** @public */
77
83
  pullRequestState: defineExternalActionSource({
78
84
  kind: GITHUB_PR_STATE_KIND,
79
85
  describeEvent: describeGitHubEvent,
@@ -91,7 +97,6 @@ import {
91
97
  parseRepositoryPullRequestConfig as parsePrConfig,
92
98
  repositoryFeedbackBatch
93
99
  } from "@leitwerk-dev/process-sdk";
94
- import { sameSubscription as sameSubscription2 } from "@leitwerk-dev/repository-rebase";
95
100
  import { createPollSchedule } from "@leitwerk-dev/watcher-utils";
96
101
 
97
102
  // src/issue-watcher.ts
@@ -111,27 +116,18 @@ var githubIssueWatcherSource = defineProcessWatcherSource({
111
116
  import {
112
117
  createExternalSourcePollReporter
113
118
  } from "@leitwerk-dev/process-sdk";
114
- import { sameSubscription } from "@leitwerk-dev/repository-rebase";
115
119
  function githubPollReporter(sources, result) {
116
- const report = createExternalSourcePollReporter(sources, result, { forwardGeneration: true });
117
- const current = (armed) => [
118
- GITHUB_CHECKS_KIND,
119
- GITHUB_PR_STATE_KIND,
120
- GITHUB_PR_TERMINAL_KIND,
121
- GITHUB_PR_FEEDBACK_KIND,
122
- GITHUB_ISSUE_CANCELLED_KIND,
123
- GITHUB_RELEASE_KIND
124
- ].some((kind) => sources.listArmed(kind).some((value) => sameSubscription(armed, value)));
125
- return {
126
- ...report,
127
- async fire(armed, event, mergeKey) {
128
- if (!current(armed)) return false;
129
- return report.fire(armed, event, mergeKey);
130
- },
131
- observe(armed, input) {
132
- if (current(armed)) return report.observe(armed, input);
133
- }
134
- };
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
+ });
135
131
  }
136
132
 
137
133
  // src/issue-provider.ts
@@ -246,8 +242,7 @@ function createGitHubIssuePolling(deps, integration, options = {}) {
246
242
  await poll(GITHUB_PR_TERMINAL_KIND, parsePrConfig, async (config, armed) => {
247
243
  const pr = await integration.client(config.profile).getPullRequest(config.owner, config.repo, config.prNumber);
248
244
  if (!pr.merged && pr.state !== "closed") return;
249
- if (!deps.externalSources.listArmed(GITHUB_PR_TERMINAL_KIND).some((current) => sameSubscription2(armed, current)))
250
- return;
245
+ if (!report.isCurrent(GITHUB_PR_TERMINAL_KIND, armed)) return;
251
246
  terminalInstances.add(armed.instanceId);
252
247
  const outcome = pr.merged ? "merged" : "closed";
253
248
  if (config.terminalOutcome && config.terminalOutcome !== outcome) return;
@@ -286,11 +281,9 @@ function createGitHubIssuePolling(deps, integration, options = {}) {
286
281
  }
287
282
  });
288
283
  if (checks.status !== "failure") return;
289
- await report.fire(
290
- armed,
291
- { checks },
292
- `${checks.headSha}:${checks.failed.map((run) => run.url).join(":")}`
293
- );
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);
294
287
  }
295
288
  );
296
289
  await poll(GITHUB_ISSUE_CANCELLED_KIND, parseIssueCancelledConfig, async (config, armed) => {
@@ -361,7 +354,7 @@ function parse(value) {
361
354
  function createGitHubProvider(deps, integration, options = {}) {
362
355
  const due = createPollSchedule2();
363
356
  const pollIssues = createGitHubIssuePolling(deps, integration, options);
364
- const reportConflict = createConflictReporter(deps.externalSources, GITHUB_PR_STATE_KIND);
357
+ const reportConflict = createConflictReporter(GITHUB_PR_STATE_KIND);
365
358
  return deps.polling.create({
366
359
  id: "github",
367
360
  pollInterval: () => "5s",
@@ -500,11 +493,8 @@ function createGitHubProvider(deps, integration, options = {}) {
500
493
 
501
494
  // src/tools.ts
502
495
  import {
503
- createWriteIdentity,
504
- ensureWrite,
505
- recordWriteIfMissing
506
- } from "@leitwerk-dev/external-writes";
507
- import {
496
+ existingObject,
497
+ matchesPatch,
508
498
  numberArg,
509
499
  objectArg,
510
500
  projectParameters,
@@ -517,13 +507,7 @@ var resolveGitHubProjectBinding = (ctx) => resolveRepositoryProjectBinding(ctx,
517
507
 
518
508
  // src/tools.ts
519
509
  var object = (value) => objectArg(value, "Expected an object");
520
- async function reconcileComment(comments, marker, body, post) {
521
- const existing = (await comments).find((comment) => String(comment.body).includes(marker));
522
- return existing ?? post(`${body()}
523
-
524
- ${marker}`);
525
- }
526
- function registerGitHubTools(api, integration, writes) {
510
+ function registerGitHubTools(api, integration) {
527
511
  const target = (ctx) => {
528
512
  const binding = resolveGitHubProjectBinding(ctx);
529
513
  assertGitHubRepository(
@@ -536,11 +520,7 @@ function registerGitHubTools(api, integration, writes) {
536
520
  api.tool({
537
521
  name: "github_resolve_git_identity",
538
522
  description: "Resolve the configured GitHub Git identity",
539
- parameters: {
540
- type: "object",
541
- properties: { projectKey: { type: "string" } },
542
- required: ["projectKey"]
543
- },
523
+ parameters: projectParameters(),
544
524
  async execute(ctx) {
545
525
  const t = target(ctx);
546
526
  return integration.client(t.profile).resolveGitIdentity(t.profile);
@@ -551,12 +531,22 @@ function registerGitHubTools(api, integration, writes) {
551
531
  "github_update_issue",
552
532
  "github_add_issue_comment",
553
533
  "github_add_pull_request_feedback_reaction",
554
- "github_reply_to_pull_request_feedback"
534
+ "github_reply_to_pull_request_feedback",
535
+ "github_add_pull_request_comment",
536
+ "github_update_pull_request"
555
537
  ]) {
538
+ const pullRequest = name === "github_add_pull_request_comment" || name === "github_update_pull_request";
539
+ const update = name === "github_update_issue" || name === "github_update_pull_request";
556
540
  api.tool({
557
541
  name,
558
- description: "Reconcile GitHub delivery in the current process project",
559
- parameters: {
542
+ description: pullRequest ? update ? "Update a GitHub pull request" : "Comment on a GitHub pull request" : "Reconcile GitHub delivery in the current process project",
543
+ parameters: pullRequest ? projectParameters(
544
+ {
545
+ pullRequestNumber: { type: "integer" },
546
+ ...update ? { patch: { type: "object" } } : { body: { type: "string" }, writeKey: { type: "string" } }
547
+ },
548
+ ["pullRequestNumber", update ? "patch" : "body"]
549
+ ) : {
560
550
  type: "object",
561
551
  properties: {
562
552
  projectKey: { type: "string" },
@@ -575,64 +565,96 @@ function registerGitHubTools(api, integration, writes) {
575
565
  const input = object(args);
576
566
  const t = target(ctx);
577
567
  const client = integration.client(t.profile);
578
- const key = typeof input.writeKey === "string" ? stringArg(input, "writeKey") : ctx.idempotencyKey;
568
+ const key = !(pullRequest && update) && typeof input.writeKey === "string" ? stringArg(input, "writeKey") : ctx.idempotencyKey;
569
+ const signal = pullRequest ? ctx.signal : void 0;
579
570
  const marker = `<!-- leitwerk-write:${ctx.process.id}:${key} -->`;
580
- let value;
581
- const result = await ensureWrite(
582
- writes,
583
- ctx.process.id,
584
- createWriteIdentity(name, key),
585
- async () => {
586
- if (name === "github_ensure_label")
587
- value = await client.ensureLabel(t.owner, t.repo, stringArg(input, "name"));
588
- else if (name === "github_update_issue") {
589
- const issueNumber = numberArg(input, "issueNumber");
590
- const current = await client.getIssue(t.owner, t.repo, issueNumber);
591
- const patch = object(input.patch);
592
- const same = Object.entries(patch).every(
593
- ([key2, expected]) => JSON.stringify(
594
- key2 === "labels" ? current.labels.map((label) => label.name).sort() : object(current)[key2]
595
- ) === JSON.stringify(
596
- key2 === "labels" && Array.isArray(expected) ? [...expected].sort() : expected
597
- )
598
- );
599
- value = same ? current : await client.updateIssue(t.owner, t.repo, issueNumber, patch);
600
- } else if (name === "github_add_pull_request_feedback_reaction") {
601
- const kind = stringArg(input, "feedbackKind");
602
- const id = numberArg(input, "feedbackId");
603
- const reactions = await client.listFeedbackReactions(t.owner, t.repo, kind, id);
604
- value = reactions.find(
605
- (reaction) => reaction.content === "eyes" && reaction.user.login.toLowerCase() === client.profile.botLogin.toLowerCase()
606
- ) ?? await client.addFeedbackReaction(t.owner, t.repo, kind, id);
607
- } else {
608
- const issueNumber = numberArg(
609
- { issueNumber: input.issueNumber ?? input.pullRequestNumber },
610
- "issueNumber"
611
- );
612
- value = await reconcileComment(
613
- name === "github_reply_to_pull_request_feedback" ? client.listFeedbackReplies(
571
+ const issueNumber = () => numberArg(
572
+ input,
573
+ pullRequest || input.issueNumber == null ? "pullRequestNumber" : "issueNumber"
574
+ );
575
+ const findComment = async () => {
576
+ const replies = name === "github_reply_to_pull_request_feedback" ? await client.listFeedbackReplies(
577
+ t.owner,
578
+ t.repo,
579
+ issueNumber(),
580
+ stringArg(input, "feedbackKind")
581
+ ) : await client.listIssueComments(t.owner, t.repo, issueNumber(), signal);
582
+ return replies.find(
583
+ (comment) => String(comment.body).includes(marker) && (name !== "github_reply_to_pull_request_feedback" || input.feedbackKind !== "inline" || object(comment).in_reply_to_id === numberArg(input, "feedbackId"))
584
+ ) ?? null;
585
+ };
586
+ const result = await ctx.externalWrites.ensure(
587
+ {
588
+ writeType: pullRequest ? update ? "github.update_pr" : "github.comment" : name,
589
+ dedupKey: key
590
+ },
591
+ {
592
+ reconcile: async (phase) => existingObject(async () => {
593
+ if (name === "github_ensure_label")
594
+ return (await client.listLabels(t.owner, t.repo)).find(
595
+ (label) => label.name === stringArg(input, "name")
596
+ ) ?? null;
597
+ if (update) {
598
+ const current = await client[pullRequest ? "getPullRequest" : "getIssue"](
614
599
  t.owner,
615
600
  t.repo,
616
- issueNumber,
617
- stringArg(input, "feedbackKind")
618
- ) : client.listIssueComments(t.owner, t.repo, issueNumber),
619
- marker,
620
- () => stringArg(input, "body"),
621
- (body) => name === "github_add_issue_comment" ? client.addIssueComment(t.owner, t.repo, issueNumber, body) : client.replyFeedback(
601
+ issueNumber(),
602
+ signal
603
+ );
604
+ return current && (phase === "already_recorded" || matchesPatch(current, object(input.patch))) ? current : null;
605
+ }
606
+ if (name === "github_add_pull_request_feedback_reaction")
607
+ return (await client.listFeedbackReactions(
608
+ t.owner,
609
+ t.repo,
610
+ stringArg(input, "feedbackKind"),
611
+ numberArg(input, "feedbackId")
612
+ )).find(
613
+ (reaction) => reaction.content === "eyes" && reaction.user.login.toLowerCase() === client.profile.botLogin.toLowerCase()
614
+ ) ?? null;
615
+ return findComment();
616
+ }),
617
+ execute: async () => {
618
+ if (name === "github_ensure_label")
619
+ return client.createLabel(t.owner, t.repo, stringArg(input, "name"));
620
+ if (update)
621
+ return pullRequest ? object(
622
+ await client.updatePullRequest(
623
+ t.owner,
624
+ t.repo,
625
+ issueNumber(),
626
+ object(input.patch),
627
+ signal
628
+ )
629
+ ) : client.updateIssue(t.owner, t.repo, issueNumber(), object(input.patch));
630
+ if (name === "github_add_pull_request_feedback_reaction")
631
+ return object(
632
+ await client.addFeedbackReaction(
633
+ t.owner,
634
+ t.repo,
635
+ stringArg(input, "feedbackKind"),
636
+ numberArg(input, "feedbackId")
637
+ )
638
+ );
639
+ const body = `${stringArg(input, "body")}
640
+
641
+ ${marker}`;
642
+ return object(
643
+ await (name === "github_add_issue_comment" || pullRequest ? client.addIssueComment(t.owner, t.repo, issueNumber(), body, signal) : client.replyFeedback(
622
644
  t.owner,
623
645
  t.repo,
624
- issueNumber,
646
+ issueNumber(),
625
647
  stringArg(input, "feedbackKind"),
626
648
  numberArg(input, "feedbackId"),
627
649
  body
628
- )
650
+ ))
629
651
  );
630
- }
631
- return { value };
652
+ },
653
+ toMetadata: (value) => pullRequest ? { owner: t.owner, repo: t.repo, pullRequestNumber: issueNumber() } : { value }
632
654
  }
633
655
  );
634
656
  if (name === "github_ensure_label") return { name: stringArg(input, "name") };
635
- return value ?? result;
657
+ return result;
636
658
  }
637
659
  });
638
660
  }
@@ -655,31 +677,19 @@ function registerGitHubTools(api, integration, writes) {
655
677
  const find = async () => (await client.listPullRequests(t.owner, t.repo, "all")).find(
656
678
  (candidate) => candidate.head.ref === head && candidate.base.ref === base
657
679
  ) ?? null;
658
- let pr = await find();
659
- const identity = createWriteIdentity("github.ensure_pr", ctx.idempotencyKey);
660
- if (!pr) {
661
- try {
662
- await ensureWrite(writes, ctx.process.id, identity, async () => {
663
- pr = await client.createPullRequest(t.owner, t.repo, {
664
- title: stringArg(input, "title"),
665
- body: stringArg(input, "body"),
666
- head,
667
- base
668
- });
669
- return { number: pr.number, url: pr.html_url };
670
- });
671
- } catch (error) {
672
- pr = await find();
673
- if (!pr) throw error;
680
+ return ctx.externalWrites.ensure(
681
+ { writeType: "github.ensure_pr", dedupKey: ctx.idempotencyKey },
682
+ {
683
+ reconcile: () => existingObject(find),
684
+ execute: () => client.createPullRequest(t.owner, t.repo, {
685
+ title: stringArg(input, "title"),
686
+ body: stringArg(input, "body"),
687
+ head,
688
+ base
689
+ }),
690
+ toMetadata: (pr) => ({ number: pr.number, url: pr.html_url })
674
691
  }
675
- pr ??= await find();
676
- }
677
- if (!pr) throw new Error("GitHub pull request creation could not be reconciled");
678
- recordWriteIfMissing(writes, ctx.process.id, identity, {
679
- number: pr.number,
680
- url: pr.html_url
681
- });
682
- return pr;
692
+ );
683
693
  }
684
694
  });
685
695
  for (const [name, description, numberName, method] of [
@@ -712,6 +722,29 @@ function registerGitHubTools(api, integration, writes) {
712
722
  }
713
723
  });
714
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
+ });
715
748
  api.tool({
716
749
  name: "github_get_checks",
717
750
  description: "Read GitHub Actions check runs for a commit",
@@ -721,55 +754,20 @@ function registerGitHubTools(api, integration, writes) {
721
754
  return integration.client(t.profile).getCheckSummary(t.owner, t.repo, stringArg(input, "headSha"));
722
755
  }
723
756
  });
724
- for (const definition of [
725
- { name: "github_add_pull_request_comment", update: false },
726
- { name: "github_update_pull_request", update: true }
727
- ]) {
728
- api.tool({
729
- name: definition.name,
730
- description: definition.update ? "Update a GitHub pull request" : "Comment on a GitHub pull request",
731
- parameters: projectParameters(
732
- {
733
- pullRequestNumber: { type: "integer" },
734
- ...definition.update ? { patch: { type: "object" } } : { body: { type: "string" }, writeKey: { type: "string" } }
735
- },
736
- ["pullRequestNumber", definition.update ? "patch" : "body"]
737
- ),
738
- async execute(ctx, input) {
739
- const t = target(ctx);
740
- const pr = numberArg(input, "pullRequestNumber");
741
- const key = !definition.update && typeof input.writeKey === "string" ? stringArg(input, "writeKey") : ctx.idempotencyKey;
742
- return ensureWrite(
743
- writes,
744
- ctx.process.id,
745
- createWriteIdentity(definition.update ? "github.update_pr" : "github.comment", key),
746
- async () => {
747
- if (definition.update)
748
- await integration.client(t.profile).updatePullRequest(t.owner, t.repo, pr, object(input.patch), ctx.signal);
749
- else {
750
- const client = integration.client(t.profile);
751
- await reconcileComment(
752
- client.listIssueComments(t.owner, t.repo, pr, ctx.signal),
753
- `<!-- leitwerk-write:${ctx.process.id}:${key} -->`,
754
- () => stringArg(input, "body"),
755
- (body) => client.addIssueComment(t.owner, t.repo, pr, body, ctx.signal)
756
- );
757
- }
758
- return { owner: t.owner, repo: t.repo, pullRequestNumber: pr };
759
- }
760
- );
761
- }
762
- });
763
- }
764
757
  }
765
758
 
766
759
  // src/index.ts
767
- var manifest = { id: "github", version: "0.1.9" };
760
+ var manifest = {
761
+ id: "github",
762
+ /** @internal */
763
+ version: "0.1.9"
764
+ };
768
765
  var extension = {
769
766
  manifest,
770
767
  setupServer(api, config) {
771
768
  const profiles = parseGitHubProfiles(config);
772
769
  const integration = {
770
+ profiles: () => [...profiles.keys()],
773
771
  client(profile) {
774
772
  const value = profiles.get(profile);
775
773
  if (!value) throw new Error(`Unknown GitHub profile '${profile}'`);
@@ -784,7 +782,7 @@ function setupGitHubIntegration(api, integration, options = {}) {
784
782
  api.provide(githubIntegration, integration);
785
783
  const deps = api.get(coreHostCapabilities.serverSetup);
786
784
  if (!deps || Array.isArray(deps)) return;
787
- registerGitHubTools(api, integration, deps.externalWrites);
785
+ registerGitHubTools(api, integration);
788
786
  return createGitHubProvider(deps, integration, options);
789
787
  }
790
788
  export {
@@ -793,16 +791,10 @@ export {
793
791
  GITHUB_PR_FEEDBACK_KIND,
794
792
  GITHUB_PR_STATE_KIND,
795
793
  GITHUB_PR_TERMINAL_KIND,
796
- GITHUB_RELEASE_KIND,
797
- GitHubClient,
798
- assertGitHubRepository,
799
794
  index_default as default,
800
- describeGitHubEvent,
801
795
  githubExternal,
802
796
  githubIntegration,
803
797
  githubIssueWatcherSource,
804
- manifest,
805
- parseGitHubProfiles,
806
798
  resolveGitHubProjectBinding,
807
799
  setupGitHubIntegration
808
800
  };