@vite-hub/forge 0.6.1 → 0.8.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 (25) hide show
  1. package/README.md +13 -2
  2. package/dist/crypto-DydCoK4e-BCG61qh5.js +123 -0
  3. package/dist/{webhooks-Bc6QhmI8-eK71_mJE.js → define-C9xZZNVR-C-oojQRP.js} +3 -1118
  4. package/dist/{definition-BQFdu9ti-WxMjcAEl.js → definition-BQFdu9ti-BZgR-gkB.js} +5 -4
  5. package/dist/{github-CHzhqYOr.js → definition-s83gxg2p-JwDgFji9.js} +27 -28
  6. package/dist/{events-BL0zcgMf-9TwyYtCt.js → events-BL0zcgMf-Exs7JLX1.js} +5 -2
  7. package/dist/{events-DDdJnmD2-BSMoOqjV.js → events-DDdJnmD2-CdPFePvp.js} +5 -3
  8. package/dist/{events-DHqSJ5KI-z2-5_1vo.js → events-DHqSJ5KI-mRtn-qQ0.js} +5 -3
  9. package/dist/{events-DXE-Ul2S-BzTkugIK.js → events-DXE-Ul2S-BEUw4sQF.js} +5 -3
  10. package/dist/{feed-B1OiHFg0-DevZZe0y.js → feed-B1OiHFg0-ppQHqkxG.js} +4 -2
  11. package/dist/{feed-DROLF1tb-CtRfA_7N.js → feed-DROLF1tb-CMAanXw8.js} +4 -2
  12. package/dist/{feed-iWegqepj-ConxMpg4.js → feed-iWegqepj-DKBLqhvD.js} +4 -2
  13. package/dist/{forgejo-4sbZukng.js → forgejo-Deckk49p.js} +2 -2
  14. package/dist/{gitea-Cj7qy2X3.js → gitea-ChQKeRrf.js} +2 -2
  15. package/dist/{gitee-CKt4pEC0-BuLWggck.js → gitee-CKt4pEC0-BuzC1PrM.js} +1 -1
  16. package/dist/{gitlab-CS0shW2u.js → gitlab-CzCikZzN.js} +5 -4
  17. package/dist/{graphql-DxRA9BGO-BBbmTmWi.js → graphql-DxRA9BGO-Cy511t8-.js} +2 -1
  18. package/dist/index.d.ts +91 -3
  19. package/dist/index.js +400 -65
  20. package/dist/kit-CrquHPqr.js +4 -0
  21. package/dist/{templates-0m5QBVIh-D1fZeoC-.js → templates-0m5QBVIh-C1DcQ_yo.js} +1 -2
  22. package/dist/utils-DEwhctg5-BM3AMnSs.js +1213 -0
  23. package/dist/webhooks-Bc6QhmI8-CgoCnwj1.js +71 -0
  24. package/package.json +2 -2
  25. package/dist/model-Biiu1CfI-CVLamGai.js +0 -288
@@ -1,5 +1,6 @@
1
- import { B as memo, F as hostOf, I as isFirstPage, J as requireIssueOrPull, K as rateLimitPart, M as getManyConcurrently, N as hasEveryLabel, O as createListing, P as hexColour, Q as summariseChecks, R as latestCommentOf, U as milestoneId, V as memoBy, X as resolveToken, Y as requireThread, a as verifyHmacSignature, at as toWarning, ct as changeBase64, d as perKind, dt as inDirectories, et as teamOrg, f as reviewState, g as verb, it as toPullStats, lt as existingFiles, mt as toFileContent, nt as toFileStatus, ot as versionAtLeast, r as nativeEventsFor, rt as toPage, s as WRITE_VERBS, t as eventKindsOf, tt as toDate, u as eventTime, ut as fromBase64, w as actorLogin, y as githubShapedWeb, z as mapConcurrent } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { A as toMergeError, T as UnsupportedOperationError, b as NotFoundError, k as soleMergeMethod, m as ForgeError, n as isNamespaceRef, s as reactionContent, u as BranchMovedError } from "./model-Biiu1CfI-CVLamGai.js";
1
+ import { S as inDirectories, T as toFileContent, b as existingFiles, c as reviewState, f as verb, h as githubShapedWeb, n as WRITE_VERBS, o as eventTime, s as perKind, x as fromBase64, y as changeBase64 } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { A as resolveToken, B as versionAtLeast, E as rateLimitPart, F as toDate, I as toFileStatus, J as reactionContent, L as toPage, M as summariseChecks, O as requireIssueOrPull, P as teamOrg, R as toPullStats, S as milestoneId, U as isNamespaceRef, Z as BranchMovedError, _ as latestCommentOf, b as memoBy, d as getManyConcurrently, dt as UnsupportedOperationError, f as hasEveryLabel, h as isFirstPage, ht as toMergeError, k as requireThread, m as hostOf, mt as soleMergeMethod, n as actorLogin, o as createListing, ot as NotFoundError, p as hexColour, tt as ForgeError, v as mapConcurrent, y as memo, z as toWarning } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { a as verifyHmacSignature, r as nativeEventsFor, t as eventKindsOf } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
3
4
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/web-C0rMyC0A.mjs
4
5
  const RESERVED_PATHS = [
5
6
  "-",
@@ -1027,7 +1028,7 @@ function forgejoWebhooks(profile) {
1027
1028
  return ({ options, origin }) => ({
1028
1029
  events: FORGEJO_WEBHOOK_EVENTS,
1029
1030
  verify: (delivery) => verifyForgejoSignature(delivery, options.webhookSecret, profile.headers),
1030
- translate: async (delivery) => (await import("./events-DXE-Ul2S-BzTkugIK.js")).translateForgejoWebhook(origin, delivery, profile.headers)
1031
+ translate: async (delivery) => (await import("./events-DXE-Ul2S-BEUw4sQF.js")).translateForgejoWebhook(origin, delivery, profile.headers)
1031
1032
  });
1032
1033
  }
1033
1034
  const YAML_FILE = /\.ya?ml$/i;
@@ -1528,7 +1529,7 @@ function setupForgejo({ options, origin, fetcher: baseFetcher, baseUrl }, profil
1528
1529
  return released(isGitea ? giteaMinimum : forgejoMinimum);
1529
1530
  }
1530
1531
  async function feedPage(path, listOptions, query) {
1531
- const { toFeedEvent } = await import("./feed-iWegqepj-ConxMpg4.js");
1532
+ const { toFeedEvent } = await import("./feed-iWegqepj-DKBLqhvD.js");
1532
1533
  return list(path, listOptions, (raw) => toFeedEvent(origin, raw), { query });
1533
1534
  }
1534
1535
  async function setBlocked(scope, login, blocked, options) {
@@ -1,5 +1,7 @@
1
- import { B as memo, C as abortable, D as createFetcher, E as checkRunState, F as hostOf, G as rateLimitOf, I as isFirstPage, J as requireIssueOrPull, K as rateLimitPart, L as iteratePages, M as getManyConcurrently, O as createListing, Q as summariseChecks, R as latestCommentOf, T as anySignal, U as milestoneId, W as phased, X as resolveToken, Y as requireThread, Z as sleep, _ as OWNER_NAME, _t as signRs256Jwt, a as verifyHmacSignature, at as toWarning, c as defineForgeProvider, ct as changeBase64, d as perKind, dt as inDirectories, et as teamOrg, f as reviewState, ft as isSha, g as verb, it as toPullStats, j as forgeIterable, k as degradesToWarning, lt as existingFiles, m as supportOnly, mt as toFileContent, nt as toFileStatus, ot as versionAtLeast, pt as splitMessage, q as rateLimitReset, r as nativeEventsFor, rt as toPage, s as WRITE_VERBS, t as eventKindsOf, tt as toDate, u as eventTime, ut as fromBase64, w as actorLogin, y as githubShapedWeb } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { A as toMergeError, O as isSecondaryRateLimit, S as ReadOnlyError, T as UnsupportedOperationError, _ as InsufficientScopeError, b as NotFoundError, f as ForbiddenError, g as ForgeTimeoutError, k as soleMergeMethod, l as AuthenticationRequiredError, m as ForgeError, n as isNamespaceRef, p as ForgeApiError, r as isResolvedThread, s as reactionContent, t as REACTION_CONTENTS, u as BranchMovedError, v as MergeBlockedError, x as RateLimitedError, y as MergeConflictError } from "./model-Biiu1CfI-CVLamGai.js";
1
+ import { C as isSha, S as inDirectories, T as toFileContent, b as existingFiles, c as reviewState, f as verb, h as githubShapedWeb, n as WRITE_VERBS, o as eventTime, p as OWNER_NAME, s as perKind, u as supportOnly, w as splitMessage, x as fromBase64, y as changeBase64 } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { $ as ForbiddenError, A as resolveToken, B as versionAtLeast, D as rateLimitReset, E as rateLimitPart, F as toDate, H as REACTION_CONTENTS, I as toFileStatus, J as reactionContent, L as toPage, M as summariseChecks, O as requireIssueOrPull, P as teamOrg, R as toPullStats, S as milestoneId, T as rateLimitOf, U as isNamespaceRef, W as isResolvedThread, X as AuthenticationRequiredError, Z as BranchMovedError, _ as latestCommentOf, a as createFetcher, at as MergeConflictError, c as degradesToWarning, ct as ReadOnlyError, d as getManyConcurrently, dt as UnsupportedOperationError, et as ForgeApiError, g as iteratePages, h as isFirstPage, ht as toMergeError, i as checkRunState, it as MergeBlockedError, j as sleep, k as requireThread, m as hostOf, mt as soleMergeMethod, n as actorLogin, nt as ForgeTimeoutError, o as createListing, ot as NotFoundError, pt as isSecondaryRateLimit, r as anySignal, rt as InsufficientScopeError, st as RateLimitedError, t as abortable, tt as ForgeError, u as forgeIterable, w as phased, y as memo, z as toWarning } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { a as verifyHmacSignature, r as nativeEventsFor, t as eventKindsOf } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
4
+ import { i as signRs256Jwt } from "./crypto-DydCoK4e-BCG61qh5.js";
3
5
  import { t as toAuthorAssociation } from "./association-Ds6Tgs0W-CgBVH3ii.js";
4
6
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/web-C4ZtN2uk.mjs
5
7
  const RESERVED_PATHS = [
@@ -225,7 +227,7 @@ function graphqlOperations(document) {
225
227
  }
226
228
  function createGraphQLClient(fetcher, url, context) {
227
229
  return async (document, variables, options) => {
228
- const query = typeof document === "string" ? (await import("./graphql-DxRA9BGO-BBbmTmWi.js"))[document] : document.query;
230
+ const query = typeof document === "string" ? (await import("./graphql-DxRA9BGO-Cy511t8-.js"))[document] : document.query;
229
231
  const operationName = graphqlOperations(query)[0]?.name;
230
232
  const { data, response } = await fetcher.json(url, {
231
233
  method: "POST",
@@ -1535,7 +1537,7 @@ function githubWebhooks(events) {
1535
1537
  return ({ options, origin }) => ({
1536
1538
  events,
1537
1539
  verify: (delivery) => verifyGitHubSignature(delivery, options.webhookSecret),
1538
- translate: async (delivery) => (await import("./events-DHqSJ5KI-z2-5_1vo.js")).translateGitHubWebhook(origin, delivery)
1540
+ translate: async (delivery) => (await import("./events-DHqSJ5KI-mRtn-qQ0.js")).translateGitHubWebhook(origin, delivery)
1539
1541
  });
1540
1542
  }
1541
1543
  const DISCUSSION_CLOSE_REASONS = {
@@ -1665,7 +1667,7 @@ function setupGitHub(ctx, profile) {
1665
1667
  })).values()];
1666
1668
  let result;
1667
1669
  try {
1668
- const { query, variables } = (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).recentDiscussionsQuery(repos);
1670
+ const { query, variables } = (await import("./graphql-DxRA9BGO-Cy511t8-.js")).recentDiscussionsQuery(repos);
1669
1671
  result = await graphql({ query }, variables);
1670
1672
  } catch (error) {
1671
1673
  if (error instanceof InsufficientScopeError || error instanceof ForgeApiError && error.status === 200) return [toWarning("discussion_unresolved", error)];
@@ -1747,7 +1749,7 @@ function setupGitHub(ctx, profile) {
1747
1749
  number: Number(ref.number)
1748
1750
  }, options)).repository?.discussion;
1749
1751
  if (!discussion) throw new NotFoundError(`Discussion ${ref.number} not found`, 404, "", context);
1750
- return (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).toDiscussionThread(ref, discussion);
1752
+ return (await import("./graphql-DxRA9BGO-Cy511t8-.js")).toDiscussionThread(ref, discussion);
1751
1753
  }
1752
1754
  async function discussionCommentPage(ref, listOptions) {
1753
1755
  const comments = (await graphql("DISCUSSION_COMMENTS", {
@@ -1828,7 +1830,7 @@ function setupGitHub(ctx, profile) {
1828
1830
  ref
1829
1831
  });
1830
1832
  if (!batchable.length) return results;
1831
- const g = await import("./graphql-DxRA9BGO-BBbmTmWi.js");
1833
+ const g = await import("./graphql-DxRA9BGO-Cy511t8-.js");
1832
1834
  for (let start = 0; start < batchable.length; start += GRAPHQL_BATCH) {
1833
1835
  const chunk = batchable.slice(start, start + GRAPHQL_BATCH);
1834
1836
  const { query, variables } = g.threadsBatchQuery(chunk.map((item) => item.ref));
@@ -1890,7 +1892,7 @@ function setupGitHub(ctx, profile) {
1890
1892
  async function sponsorableMany(logins, options) {
1891
1893
  const results = Array.from({ length: logins.length });
1892
1894
  if (!logins.length) return results;
1893
- const g = await import("./graphql-DxRA9BGO-BBbmTmWi.js");
1895
+ const g = await import("./graphql-DxRA9BGO-Cy511t8-.js");
1894
1896
  const url = graphqlUrl(baseUrl);
1895
1897
  for (let start = 0; start < logins.length; start += SPONSORABLE_BATCH) {
1896
1898
  const chunk = logins.slice(start, start + SPONSORABLE_BATCH);
@@ -1984,7 +1986,7 @@ function setupGitHub(ctx, profile) {
1984
1986
  field: query.sort === "created" || !query.sort ? "CREATED_AT" : "UPDATED_AT",
1985
1987
  direction: direction.toUpperCase()
1986
1988
  }, query);
1987
- const { toDiscussionThread } = await import("./graphql-DxRA9BGO-BBbmTmWi.js");
1989
+ const { toDiscussionThread } = await import("./graphql-DxRA9BGO-Cy511t8-.js");
1988
1990
  const discussions = data.repository?.discussions;
1989
1991
  return {
1990
1992
  items: (discussions?.nodes ?? []).map((node) => toDiscussionThread({
@@ -2095,7 +2097,7 @@ function setupGitHub(ctx, profile) {
2095
2097
  async function commentsPage(thread, listOptions = {}) {
2096
2098
  const ref = requireThread(thread, context);
2097
2099
  if (ref.kind === "discussion") {
2098
- const [page, { toDiscussionComment }] = await Promise.all([discussionCommentPage(ref, listOptions), import("./graphql-DxRA9BGO-BBbmTmWi.js")]);
2100
+ const [page, { toDiscussionComment }] = await Promise.all([discussionCommentPage(ref, listOptions), import("./graphql-DxRA9BGO-Cy511t8-.js")]);
2099
2101
  return {
2100
2102
  ...page,
2101
2103
  items: page.items.map(({ comment }) => toDiscussionComment(ref, comment))
@@ -2126,7 +2128,7 @@ function setupGitHub(ctx, profile) {
2126
2128
  id,
2127
2129
  reason: reason?.toUpperCase() ?? null
2128
2130
  }, options_)).closeDiscussion : (await graphql("REOPEN_DISCUSSION", { id }, options_)).reopenDiscussion;
2129
- return (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).toDiscussionThread(ref, data.discussion);
2131
+ return (await import("./graphql-DxRA9BGO-Cy511t8-.js")).toDiscussionThread(ref, data.discussion);
2130
2132
  }
2131
2133
  const reason = options_.reasonRaw ?? options_.reason;
2132
2134
  const { data } = await fetcher.json(threadPath(ref), {
@@ -2380,7 +2382,7 @@ function setupGitHub(ctx, profile) {
2380
2382
  number: Number(ref.number),
2381
2383
  first: Math.min(listOptions.perPage ?? 50, 100),
2382
2384
  after: listOptions.cursor?.token ?? null
2383
- }, listOptions), import("./graphql-DxRA9BGO-BBbmTmWi.js")]);
2385
+ }, listOptions), import("./graphql-DxRA9BGO-Cy511t8-.js")]);
2384
2386
  const pull = data.repository?.pullRequest;
2385
2387
  if (!pull) throw new NotFoundError(`Pull request ${ref.number} not found`, 404, "", context);
2386
2388
  const { nodes, pageInfo } = pull.reviewThreads;
@@ -2407,7 +2409,7 @@ function setupGitHub(ctx, profile) {
2407
2409
  if (thread.kind === "discussion") {
2408
2410
  const data = await graphql("GET_DISCUSSION_COMMENT", { id: ref.id }, options);
2409
2411
  if (!data.node?.id) throw new NotFoundError(`Comment ${ref.id} not found`, 404, "", context);
2410
- return (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).toDiscussionComment(thread, data.node);
2412
+ return (await import("./graphql-DxRA9BGO-Cy511t8-.js")).toDiscussionComment(thread, data.node);
2411
2413
  }
2412
2414
  const { data } = await fetcher.json(commentPath(ref), { signal: options?.signal });
2413
2415
  return toComment(thread, data);
@@ -2464,7 +2466,7 @@ function setupGitHub(ctx, profile) {
2464
2466
  number: Number(ref.number),
2465
2467
  first: Math.min(listOptions.perPage ?? 50, 100),
2466
2468
  after: listOptions.cursor?.token ?? null
2467
- }, listOptions), import("./graphql-DxRA9BGO-BBbmTmWi.js")]);
2469
+ }, listOptions), import("./graphql-DxRA9BGO-Cy511t8-.js")]);
2468
2470
  const references = data.repository?.thread?.references;
2469
2471
  if (!references) throw new NotFoundError(`Thread ${ref.number} not found`, 404, "", context);
2470
2472
  return {
@@ -2786,7 +2788,7 @@ function setupGitHub(ctx, profile) {
2786
2788
  signal: listOptions.signal
2787
2789
  });
2788
2790
  const poll = recordPoll(path, listOptions.cursor, result.response);
2789
- const { toFeedEvents } = await import("./events-DHqSJ5KI-z2-5_1vo.js");
2791
+ const { toFeedEvents } = await import("./events-DHqSJ5KI-mRtn-qQ0.js");
2790
2792
  const page = toPage(result, (raw) => toFeedEvents(context, raw));
2791
2793
  return {
2792
2794
  ...page,
@@ -2881,7 +2883,7 @@ function setupGitHub(ctx, profile) {
2881
2883
  }
2882
2884
  async function templates(repo, options = {}) {
2883
2885
  const signal = options.signal;
2884
- return (await import("./templates-0m5QBVIh-D1fZeoC-.js")).readTemplates(repo, options.kind ? [options.kind] : ["issue", "pull_request"], {
2886
+ return (await import("./templates-0m5QBVIh-C1DcQ_yo.js")).readTemplates(repo, options.kind ? [options.kind] : ["issue", "pull_request"], {
2885
2887
  list: async (ref, path) => {
2886
2888
  const { data } = await fetcher.json(`${repoPath(ref)}/contents${path ? `/${path.split("/").map(encodeURIComponent).join("/")}` : ""}`, { signal });
2887
2889
  return Array.isArray(data) ? data : [];
@@ -3003,7 +3005,7 @@ function setupGitHub(ctx, profile) {
3003
3005
  expectedHeadOid: head,
3004
3006
  message: splitMessage(input.message),
3005
3007
  fileChanges
3006
- } }, options), import("./graphql-DxRA9BGO-BBbmTmWi.js")]);
3008
+ } }, options), import("./graphql-DxRA9BGO-Cy511t8-.js")]);
3007
3009
  return toGraphQLCommit(repo, data.createCommitOnBranch.commit);
3008
3010
  } catch (error) {
3009
3011
  if (input.createFrom !== void 0) await swapBranch(repo, input.branch, head, ZERO_OID).catch(() => {});
@@ -3171,7 +3173,7 @@ function setupGitHub(ctx, profile) {
3171
3173
  const [data, { toGraphQLActor, GRAPHQL_REACTIONS }] = await Promise.all([graphql("NODE_REACTIONS", {
3172
3174
  id,
3173
3175
  after: listOptions.cursor?.token ?? null
3174
- }, listOptions), import("./graphql-DxRA9BGO-BBbmTmWi.js")]);
3176
+ }, listOptions), import("./graphql-DxRA9BGO-Cy511t8-.js")]);
3175
3177
  const reactions = data.node?.reactions;
3176
3178
  return {
3177
3179
  items: (reactions?.nodes ?? []).flatMap((raw) => {
@@ -3209,7 +3211,7 @@ function setupGitHub(ctx, profile) {
3209
3211
  if (thread.kind === "discussion") {
3210
3212
  await graphql("ADD_REACTION", {
3211
3213
  id: "thread" in target ? target.id : await nodeId(thread, options),
3212
- content: (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).REACTION_CONTENT[reaction]
3214
+ content: (await import("./graphql-DxRA9BGO-Cy511t8-.js")).REACTION_CONTENT[reaction]
3213
3215
  }, options);
3214
3216
  return;
3215
3217
  }
@@ -3224,7 +3226,7 @@ function setupGitHub(ctx, profile) {
3224
3226
  if (thread.kind === "discussion") {
3225
3227
  await graphql("REMOVE_REACTION", {
3226
3228
  id: "thread" in target ? target.id : await nodeId(thread, options),
3227
- content: (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).REACTION_CONTENT[reaction]
3229
+ content: (await import("./graphql-DxRA9BGO-Cy511t8-.js")).REACTION_CONTENT[reaction]
3228
3230
  }, options);
3229
3231
  return;
3230
3232
  }
@@ -3691,7 +3693,7 @@ function setupGitHub(ctx, profile) {
3691
3693
  eventsPage: verb(true, async (thread, listOptions = {}) => {
3692
3694
  const ref = requireThread(thread, context);
3693
3695
  if (ref.kind === "discussion") {
3694
- const [page, { toDiscussionCommentEvent }] = await Promise.all([discussionCommentPage(ref, listOptions), import("./graphql-DxRA9BGO-BBbmTmWi.js")]);
3696
+ const [page, { toDiscussionCommentEvent }] = await Promise.all([discussionCommentPage(ref, listOptions), import("./graphql-DxRA9BGO-Cy511t8-.js")]);
3695
3697
  return {
3696
3698
  ...page,
3697
3699
  items: page.items.map(({ comment, isReply }) => toDiscussionCommentEvent(ref, comment, isReply))
@@ -3762,7 +3764,7 @@ function setupGitHub(ctx, profile) {
3762
3764
  id: await discussionId(ref, options),
3763
3765
  body
3764
3766
  }, options);
3765
- return (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).toDiscussionComment(ref, data.addDiscussionComment.comment);
3767
+ return (await import("./graphql-DxRA9BGO-Cy511t8-.js")).toDiscussionComment(ref, data.addDiscussionComment.comment);
3766
3768
  }
3767
3769
  const { data } = await fetcher.json(`${repoPath(ref.repo)}/issues/${encodeURIComponent(ref.number)}/comments`, {
3768
3770
  method: "POST",
@@ -3782,7 +3784,7 @@ function setupGitHub(ctx, profile) {
3782
3784
  id: ref.id,
3783
3785
  body
3784
3786
  }, options);
3785
- return (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).toDiscussionComment(thread, data.updateDiscussionComment.comment);
3787
+ return (await import("./graphql-DxRA9BGO-Cy511t8-.js")).toDiscussionComment(thread, data.updateDiscussionComment.comment);
3786
3788
  }
3787
3789
  const { data } = await fetcher.json(commentPath(ref), {
3788
3790
  method: "PATCH",
@@ -3884,7 +3886,7 @@ function setupGitHub(ctx, profile) {
3884
3886
  title: input.title,
3885
3887
  body: input.body
3886
3888
  }, options);
3887
- return (await import("./graphql-DxRA9BGO-BBbmTmWi.js")).toDiscussionThread(ref, data.updateDiscussion.discussion);
3889
+ return (await import("./graphql-DxRA9BGO-Cy511t8-.js")).toDiscussionThread(ref, data.updateDiscussion.discussion);
3888
3890
  }
3889
3891
  const target = requireIssueOrPull(ref, context, "update");
3890
3892
  const json = {
@@ -4264,7 +4266,4 @@ function githubScopesFor(verb) {
4264
4266
  };
4265
4267
  return {};
4266
4268
  }
4267
- // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/github/index.mjs
4268
- /** Creates a GitHub provider for github.com or a GitHub Enterprise Server instance. */
4269
- const github = /* @__PURE__ */ defineForgeProvider(/* @__PURE__ */ githubDefinition(GITHUB_PROFILE));
4270
- export { toThreadState as a, github, toRepoRef as i, toIssueType as n, toLabels as r, toActor as t };
4269
+ export { toLabels as a, toIssueType as i, githubDefinition as n, toRepoRef as o, toActor as r, toThreadState as s, GITHUB_PROFILE as t };
@@ -1,5 +1,8 @@
1
- import { gt as headerValue, ht as bodyText, i as refEvent, p as snapshotOfThread, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { a as toRepoRef, i as toPullThread, n as toActor, r as toIssueThread, t as FORGE } from "./gitee-CKt4pEC0-BuLWggck.js";
1
+ import { n as headerValue, t as bodyText } from "./crypto-DydCoK4e-BCG61qh5.js";
2
+ import { l as snapshotOfThread, o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
3
+ import { F as toDate } from "./utils-DEwhctg5-BM3AMnSs.js";
4
+ import { i as refEvent } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
5
+ import { a as toRepoRef, i as toPullThread, n as toActor, r as toIssueThread, t as FORGE } from "./gitee-CKt4pEC0-BuzC1PrM.js";
3
6
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-BL0zcgMf.mjs
4
7
  const STATES = {
5
8
  open: "open",
@@ -1,6 +1,8 @@
1
- import { gt as headerValue, h as threadSnapshot, ht as bodyText, i as refEvent, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { E as WebhookVerificationError } from "./model-Biiu1CfI-CVLamGai.js";
3
- import { a as toRepoRef, i as toLabel, n as approvalId, o as toState, r as toActor, t as FORGE } from "./gitlab-CS0shW2u.js";
1
+ import { n as headerValue, t as bodyText } from "./crypto-DydCoK4e-BCG61qh5.js";
2
+ import { F as toDate, ft as WebhookVerificationError } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { a as eventAction, d as threadSnapshot, o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
4
+ import { i as refEvent } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
5
+ import { a as toRepoRef, i as toLabel, n as approvalId, o as toState, r as toActor, t as FORGE } from "./gitlab-CzCikZzN.js";
4
6
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-DDdJnmD2.mjs
5
7
  const EVENT_HEADER = "x-gitlab-event";
6
8
  function snapshotOf(instance, raw) {
@@ -1,6 +1,8 @@
1
- import { f as reviewState, gt as headerValue, h as threadSnapshot, ht as bodyText, i as refEvent, it as toPullStats, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { E as WebhookVerificationError } from "./model-Biiu1CfI-CVLamGai.js";
3
- import { a as toThreadState, i as toRepoRef, n as toIssueType, r as toLabels, t as toActor } from "./github-CHzhqYOr.js";
1
+ import { n as headerValue, t as bodyText } from "./crypto-DydCoK4e-BCG61qh5.js";
2
+ import { F as toDate, R as toPullStats, ft as WebhookVerificationError } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { a as eventAction, c as reviewState, d as threadSnapshot, o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
4
+ import { i as refEvent } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
5
+ import { a as toLabels, i as toIssueType, o as toRepoRef, r as toActor, s as toThreadState } from "./definition-s83gxg2p-JwDgFji9.js";
4
6
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-DHqSJ5KI.mjs
5
7
  const EVENT_HEADER = "x-github-event";
6
8
  const DELIVERY_HEADER = "x-github-delivery";
@@ -1,6 +1,8 @@
1
- import { f as reviewState, ht as bodyText, i as refEvent, l as eventAction, n as firstHeader, p as snapshotOfThread, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { E as WebhookVerificationError } from "./model-Biiu1CfI-CVLamGai.js";
3
- import { a as toActor, o as toRepoRef, s as toThread, t as FORGEJO_HEADERS } from "./definition-BQFdu9ti-WxMjcAEl.js";
1
+ import { t as bodyText } from "./crypto-DydCoK4e-BCG61qh5.js";
2
+ import { F as toDate, ft as WebhookVerificationError } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { a as eventAction, c as reviewState, l as snapshotOfThread, o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
4
+ import { i as refEvent, n as firstHeader } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
5
+ import { a as toActor, o as toRepoRef, s as toThread, t as FORGEJO_HEADERS } from "./definition-BQFdu9ti-BZgR-gkB.js";
4
6
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/events-DXE-Ul2S.mjs
5
7
  const EVENT_KINDS = {
6
8
  issue_comment: "comment",
@@ -1,5 +1,7 @@
1
- import { i as refEvent, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { n as approvalId, r as toActor, s as toThreadKind, t as FORGE } from "./gitlab-CS0shW2u.js";
1
+ import { a as eventAction, o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { F as toDate } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { i as refEvent } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
4
+ import { n as approvalId, r as toActor, s as toThreadKind, t as FORGE } from "./gitlab-CzCikZzN.js";
3
5
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/feed-B1OiHFg0.mjs
4
6
  const FEED_STATES = {
5
7
  opened: {
@@ -1,5 +1,7 @@
1
- import { i as refEvent, l as eventAction, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { a as toRepoRef, n as toActor, t as FORGE } from "./gitee-CKt4pEC0-BuLWggck.js";
1
+ import { a as eventAction, o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { F as toDate } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { i as refEvent } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
4
+ import { a as toRepoRef, n as toActor, t as FORGE } from "./gitee-CKt4pEC0-BuzC1PrM.js";
3
5
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/feed-DROLF1tb.mjs
4
6
  /** Summaries of the feed event types that have no shared kind. */
5
7
  const FEED_SUMMARIES = { WatchEvent: "watched the repository" };
@@ -1,5 +1,7 @@
1
- import { i as refEvent, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { a as toActor, o as toRepoRef } from "./definition-BQFdu9ti-WxMjcAEl.js";
1
+ import { o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { F as toDate } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { i as refEvent } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
4
+ import { a as toActor, o as toRepoRef } from "./definition-BQFdu9ti-BZgR-gkB.js";
3
5
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/feed-iWegqepj.mjs
4
6
  /** Activity types about an issue or a pull request, whose `content` starts with its number. */
5
7
  const FEED_THREAD_OPS = {
@@ -1,5 +1,5 @@
1
- import { c as defineForgeProvider } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { i as forgejoDefinition, n as FORGEJO_PROFILE } from "./definition-BQFdu9ti-WxMjcAEl.js";
1
+ import { i as defineForgeProvider } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { i as forgejoDefinition, n as FORGEJO_PROFILE } from "./definition-BQFdu9ti-BZgR-gkB.js";
3
3
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/forgejo/index.mjs
4
4
  /** Creates a Forgejo provider for Codeberg or any self-hosted Forgejo instance. */
5
5
  const forgejo = /* @__PURE__ */ defineForgeProvider(/* @__PURE__ */ forgejoDefinition(FORGEJO_PROFILE));
@@ -1,5 +1,5 @@
1
- import { c as defineForgeProvider } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { c as GITEA_WEB, i as forgejoDefinition, r as GITEA_HEADERS } from "./definition-BQFdu9ti-WxMjcAEl.js";
1
+ import { i as defineForgeProvider } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { c as GITEA_WEB, i as forgejoDefinition, r as GITEA_HEADERS } from "./definition-BQFdu9ti-BZgR-gkB.js";
3
3
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/gitea/index.mjs
4
4
  /** Creates a Gitea provider for gitea.com or any self-hosted Gitea instance. */
5
5
  const gitea = /* @__PURE__ */ defineForgeProvider(/* @__PURE__ */ forgejoDefinition({
@@ -1,4 +1,4 @@
1
- import { tt as toDate } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
1
+ import { F as toDate } from "./utils-DEwhctg5-BM3AMnSs.js";
2
2
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/gitee-CKt4pEC0.mjs
3
3
  const FORGE = "gitee";
4
4
  function toActor(instance, user) {
@@ -1,5 +1,6 @@
1
- import { $ as syntheticReview, A as firstPageEtag, B as memo, H as mergeCommitMessage, I as isFirstPage, J as requireIssueOrPull, K as rateLimitPart, L as iteratePages, M as getManyConcurrently, O as createListing, P as hexColour, S as webUrlFor, U as milestoneId, V as memoBy, W as phased, X as resolveToken, Y as requireThread, at as toWarning, b as lineOf, c as defineForgeProvider, ct as changeBase64, d as perKind, et as teamOrg, g as verb, k as degradesToWarning, lt as existingFiles, mt as toFileContent, o as verifySharedToken, ot as versionAtLeast, r as nativeEventsFor, rt as toPage, s as WRITE_VERBS, st as withEtag, t as eventKindsOf, tt as toDate, u as eventTime, ut as fromBase64, v as bareSha, x as rangeOf, z as mapConcurrent } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
2
- import { A as toMergeError, C as TokenRevokedError, T as UnsupportedOperationError, _ as InsufficientScopeError, b as NotFoundError, f as ForbiddenError, k as soleMergeMethod, l as AuthenticationRequiredError, n as isNamespaceRef, p as ForgeApiError, s as reactionContent, u as BranchMovedError, w as UnresolvedThreadError } from "./model-Biiu1CfI-CVLamGai.js";
1
+ import { T as toFileContent, _ as rangeOf, b as existingFiles, f as verb, g as lineOf, i as defineForgeProvider, m as bareSha, n as WRITE_VERBS, o as eventTime, s as perKind, v as webUrlFor, x as fromBase64, y as changeBase64 } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { $ as ForbiddenError, A as resolveToken, B as versionAtLeast, E as rateLimitPart, F as toDate, J as reactionContent, L as toPage, N as syntheticReview, O as requireIssueOrPull, P as teamOrg, S as milestoneId, U as isNamespaceRef, V as withEtag, X as AuthenticationRequiredError, Z as BranchMovedError, b as memoBy, c as degradesToWarning, d as getManyConcurrently, dt as UnsupportedOperationError, et as ForgeApiError, g as iteratePages, h as isFirstPage, ht as toMergeError, k as requireThread, l as firstPageEtag, lt as TokenRevokedError, mt as soleMergeMethod, o as createListing, ot as NotFoundError, p as hexColour, rt as InsufficientScopeError, ut as UnresolvedThreadError, v as mapConcurrent, w as phased, x as mergeCommitMessage, y as memo, z as toWarning } from "./utils-DEwhctg5-BM3AMnSs.js";
3
+ import { o as verifySharedToken, r as nativeEventsFor, t as eventKindsOf } from "./webhooks-Bc6QhmI8-CgoCnwj1.js";
3
4
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/web-DpJoUDx4.mjs
4
5
  const SECTIONS = {
5
6
  issue: "work_items",
@@ -1083,7 +1084,7 @@ async function verifyGitLabToken(delivery, secret) {
1083
1084
  const gitlabWebhooks = ({ options, instance }) => ({
1084
1085
  events: GITLAB_WEBHOOK_EVENTS,
1085
1086
  verify: (delivery) => verifyGitLabToken(delivery, options.webhookSecret),
1086
- translate: async (delivery) => (await import("./events-DDdJnmD2-BSMoOqjV.js")).translateGitLabWebhook(instance, delivery)
1087
+ translate: async (delivery) => (await import("./events-DDdJnmD2-CdPFePvp.js")).translateGitLabWebhook(instance, delivery)
1087
1088
  });
1088
1089
  const PROJECT_ORDER = {
1089
1090
  created: "created_at",
@@ -1645,7 +1646,7 @@ const gitlab = /* @__PURE__ */ defineForgeProvider({
1645
1646
  });
1646
1647
  const warnings = [];
1647
1648
  if (!repo) await resolveProjects([...new Set((result.data ?? []).flatMap((raw) => typeof raw.project_id === "number" ? [raw.project_id] : []))].filter((id) => !projectRefs.has(id)), listOptions.signal, warnings);
1648
- const { toFeedEvent } = await import("./feed-B1OiHFg0-DevZZe0y.js");
1649
+ const { toFeedEvent } = await import("./feed-B1OiHFg0-ppQHqkxG.js");
1649
1650
  return toPage(result, (raw) => toFeedEvent(instance, raw, repo ?? (typeof raw.project_id === "number" ? projectRefs.get(raw.project_id) : void 0)), warnings);
1650
1651
  }
1651
1652
  async function setSubscribed(thread, subscribed, options) {
@@ -1,4 +1,5 @@
1
- import { it as toPullStats, tt as toDate, u as eventTime } from "./webhooks-Bc6QhmI8-eK71_mJE.js";
1
+ import { o as eventTime } from "./define-C9xZZNVR-C-oojQRP.js";
2
+ import { F as toDate, R as toPullStats } from "./utils-DEwhctg5-BM3AMnSs.js";
2
3
  import { t as toAuthorAssociation } from "./association-Ds6Tgs0W-CgBVH3ii.js";
3
4
  // ../../node_modules/.pnpm/forges@0.4.1/node_modules/forges/dist/graphql-DxRA9BGO.mjs
4
5
  const ACTOR_FIELDS = `__typename login avatarUrl url ... on User { databaseId name } ... on Bot { databaseId }`;
package/dist/index.d.ts CHANGED
@@ -3752,6 +3752,45 @@ interface GitHubProvider extends ForgeProvider<true> {
3752
3752
  */
3753
3753
  graphql: GitHubGraphQL;
3754
3754
  }
3755
+ /** The tokens of one person who authorized the GitHub App, and who that person is. */
3756
+ interface ForgeUserGrant {
3757
+ token: string;
3758
+ /** `undefined` when the GitHub App has user token expiry turned off. */
3759
+ expiresAt: Date | undefined;
3760
+ refreshToken: string | undefined;
3761
+ refreshTokenExpiresAt: Date | undefined;
3762
+ /** From `GET /user` with the new token. */
3763
+ login: string;
3764
+ id: number;
3765
+ }
3766
+ /** Codes of the errors that `forge.user` returns. */
3767
+ type ForgeUserErrorCode = "FORGE_USER_AUTH_FAILED" | "FORGE_REQUEST_FAILED";
3768
+ /**
3769
+ * GitHub App user-to-server tokens: send a person to GitHub, trade the code for their token, and act as them.
3770
+ * Set only for GitHub when `VITEHUB_GITHUB_CLIENT_ID` and `VITEHUB_GITHUB_CLIENT_SECRET` are set.
3771
+ */
3772
+ interface ForgeUser {
3773
+ /** The GitHub page that asks the person to authorize the App. GitHub redirects to `redirectUri` with `code` and `state`. */
3774
+ authorizeUrl(options: {
3775
+ redirectUri: string;
3776
+ state: string;
3777
+ }): string;
3778
+ /** Trades the `code` of the callback for a user token. */
3779
+ exchange(options: {
3780
+ code: string;
3781
+ redirectUri: string;
3782
+ signal?: AbortSignal;
3783
+ }): Promise<Result<ForgeUserGrant, ForgeUserErrorCode>>;
3784
+ /** Trades a refresh token for a new user token. GitHub revokes the old refresh token. */
3785
+ refresh(options: {
3786
+ refreshToken: string;
3787
+ signal?: AbortSignal;
3788
+ }): Promise<Result<ForgeUserGrant, ForgeUserErrorCode>>;
3789
+ /** A `forges` GitHub provider that acts as the person who owns `token`. */
3790
+ provider(options: {
3791
+ token: string;
3792
+ }): GitHubProvider;
3793
+ }
3755
3794
  /** A response body that a later request can revalidate with `If-None-Match`. */
3756
3795
  interface ForgeCachedResponse {
3757
3796
  etag: string;
@@ -3797,10 +3836,12 @@ interface ForgeEnvField {
3797
3836
  /** Host variable names in lookup order. The `VITEHUB_` name comes first, then the `forges` name. */
3798
3837
  names: readonly [string, ...string[]];
3799
3838
  secret?: true;
3839
+ /** What the value unlocks, in one sentence. Server Env shows it next to the declaration. */
3840
+ description: string;
3800
3841
  }
3801
3842
  /** Server Env fields of each Forge. */
3802
3843
  type ForgeEnv = {
3803
- github: Record<"appId" | "installationId" | "appOwner" | "appInstallations" | "privateKey" | "privateKeyPath" | "token" | "webhookSecret", ForgeEnvField>;
3844
+ github: Record<"appId" | "baseUrl" | "clientId" | "clientSecret" | "installationId" | "appOwner" | "appInstallations" | "privateKey" | "privateKeyPath" | "token" | "webhookSecret", ForgeEnvField>;
3804
3845
  gitlab: Record<"baseUrl" | "token" | "webhookSecret", ForgeEnvField>;
3805
3846
  forgejo: Record<"baseUrl" | "token" | "webhookSecret", ForgeEnvField>;
3806
3847
  gitea: Record<"baseUrl" | "token" | "webhookSecret", ForgeEnvField>;
@@ -3865,7 +3906,7 @@ interface UseForgeOptions<TKind extends ForgeKind = "github"> {
3865
3906
  forge?: TKind;
3866
3907
  /**
3867
3908
  * GitHub: the API base, for GitHub Enterprise Server. GitLab, Forgejo and Gitea: the instance root.
3868
- * Default for GitLab, Forgejo and Gitea: `VITEHUB_GITLAB_BASE_URL`, `VITEHUB_FORGEJO_BASE_URL` or `VITEHUB_GITEA_BASE_URL`.
3909
+ * Default: `VITEHUB_GITHUB_BASE_URL`, `VITEHUB_GITLAB_BASE_URL`, `VITEHUB_FORGEJO_BASE_URL` or `VITEHUB_GITEA_BASE_URL`.
3869
3910
  */
3870
3911
  baseUrl?: string;
3871
3912
  /** Default: the bindings of the active Cloudflare request, then `process.env`. */
@@ -3922,6 +3963,11 @@ interface Forge$1<TKind extends ForgeKind = ForgeKind> {
3922
3963
  /** `"app"`: GitHub App installation tokens. `"token"`: the configured token. */
3923
3964
  readonly auth: "app" | "token";
3924
3965
  readonly baseUrl: string | undefined;
3966
+ /**
3967
+ * GitHub App user-to-server tokens, to act as a person who authorized the App.
3968
+ * `undefined` unless the Forge is GitHub and `VITEHUB_GITHUB_CLIENT_ID` and `VITEHUB_GITHUB_CLIENT_SECRET` are set.
3969
+ */
3970
+ readonly user: ForgeUser | undefined;
3925
3971
  /** A token for API calls, `git`, or `gh`. Installation tokens are cached until one minute before they expire. */
3926
3972
  token(options?: ForgeCallOptions): Promise<Result<ForgeToken, ForgeTokenErrorCode>>;
3927
3973
  /** A `forges` provider that uses `token()`. Get a new one for each job: an installation token expires after one hour. */
@@ -3941,6 +3987,26 @@ interface Forge$1<TKind extends ForgeKind = ForgeKind> {
3941
3987
  * ```
3942
3988
  */
3943
3989
  export declare function useForge<TKind extends ForgeKind = "github">(options?: UseForgeOptions<TKind>): Forge$1<TKind>;
3990
+ /** What `checkForge()` found: the Forge, how it signs in, and whether `forge.user` is set. */
3991
+ interface ForgeCheck<TKind extends ForgeKind = ForgeKind> {
3992
+ kind: TKind;
3993
+ auth: "app" | "token";
3994
+ /** Whether the GitHub App client ID and secret are set, so `forge.user` can sign people in. */
3995
+ user: boolean;
3996
+ }
3997
+ /** Codes that `checkForge()` returns. */
3998
+ type ForgeCheckErrorCode = "FORGE_MISSING_ENV" | "FORGE_INVALID_ENV";
3999
+ /**
4000
+ * Checks the Forge env and sends no request, for example for a Setup page. It returns `[undefined, { kind, auth, user }]`
4001
+ * when local configuration is valid, or `[error, undefined]` with a configuration error. It checks the base URL
4002
+ * and signs locally with the GitHub App private key, but does not check that the forge accepts the credentials.
4003
+ *
4004
+ * ```ts
4005
+ * const [error] = await checkForge()
4006
+ * if (error) return { configured: false, fix: error.fix }
4007
+ * ```
4008
+ */
4009
+ export declare function checkForge<TKind extends ForgeKind = "github">(options?: UseForgeOptions<TKind>): Promise<Result<ForgeCheck<TKind>, ForgeCheckErrorCode>>;
3944
4010
  interface ForgeArchiveOptions {
3945
4011
  /** Branch, tag or commit sha. */
3946
4012
  ref: string;
@@ -3954,6 +4020,28 @@ interface ForgeArchiveOptions {
3954
4020
  * (https://github.com/danielroe/forges/issues/191).
3955
4021
  */
3956
4022
  export declare function forgeArchive(provider: ForgeProvider, repo: RepoRef, options: ForgeArchiveOptions): Promise<ReadableStream<Uint8Array>>;
4023
+ interface ReadForgeArchiveOptions {
4024
+ /** Branch, tag or commit sha. A branch or tag resolves to its commit first, so `commit` names the archived tree. */
4025
+ ref: string;
4026
+ /** The largest archive to read, compressed. Pass a non-negative safe integer. Default: 64 MiB. */
4027
+ maxBytes?: number;
4028
+ signal?: AbortSignal;
4029
+ }
4030
+ interface ForgeArchive {
4031
+ /** The full commit sha of the archived tree. */
4032
+ commit: string;
4033
+ /** The `tar.gz` bytes. */
4034
+ bytes: Uint8Array<ArrayBuffer>;
4035
+ }
4036
+ /**
4037
+ * The repository tree at `ref` as `tar.gz` bytes, with the commit it came from. Reads at most `maxBytes` (64 MiB by
4038
+ * default). GitHub only.
4039
+ *
4040
+ * ```ts
4041
+ * const { commit, bytes } = await readForgeArchive(provider, repo, { ref: "main", maxBytes: 32 * 1024 * 1024 })
4042
+ * ```
4043
+ */
4044
+ export declare function readForgeArchive(provider: ForgeProvider, repo: RepoRef, options: ReadForgeArchiveOptions): Promise<ForgeArchive>;
3957
4045
  /**
3958
4046
  * The bytes of one Git blob, by its sha. The blob of a symlink holds the link target.
3959
4047
  * Gap: `forges` reads files by path only, and GitHub follows a symlink path to its target.
@@ -4143,4 +4231,4 @@ export declare function githubInstallationRouting(env: GitHubInstallationEnv): G
4143
4231
  * reach the repository.
4144
4232
  */
4145
4233
  export declare function githubInstallationFor(routing: GitHubInstallationRouting, repository: string | undefined): number | undefined;
4146
- export { type BaseOptions, BranchMovedError, type BranchRules, type Check, type CiRun, type CiRunRef, type Commit, type Forge$1 as Forge, ForgeApiError, type ForgeAppIdentity, type ForgeArchiveOptions, type ForgeCachedResponse, type ForgeCallOptions, type ForgeCommitFilesInput, type ForgeConditionalRequests, type ForgeConnection, type ForgeEnv, type ForgeEnvField, type ForgeEnvSource, type ForgeErrorCode, type ForgeFileChange, type ForgeFileMode, type ForgeGitCredentials, type ForgeGitCredentialsInput, type ForgeKind, type ForgeMemoryCacheOptions, type ForgeMergeOptions, type ForgeProvider, type ForgeProviderOf, type ForgeResponseCache, ForgeTimeoutError, type ForgeToken, type ForgeTokenErrorCode, type GitHubAppCredentials, type GitHubAppDelivery, type GitHubAppInput, type GitHubAppRepository, type GitHubBranchRuleDetails, type GitHubInstallationEnv, type GitHubInstallationRouting, type GitHubProvider, MergeBlockedError, type MergeMethod, type MergeOptions, type MergeResult, NotFoundError, type Page, RateLimitedError, type RepoRef, type RequiredCheck, type Thread, type ThreadRef, type TreeEntry, type UseForgeOptions, repoRef };
4234
+ export { type BaseOptions, BranchMovedError, type BranchRules, type Check, type CiRun, type CiRunRef, type Comment, type Commit, type Forge$1 as Forge, ForgeApiError, type ForgeAppIdentity, type ForgeArchive, type ForgeArchiveOptions, type ForgeCachedResponse, type ForgeCallOptions, type ForgeCheck, type ForgeCheckErrorCode, type ForgeCommitFilesInput, type ForgeConditionalRequests, type ForgeConnection, type ForgeEnv, type ForgeEnvField, type ForgeEnvSource, type ForgeErrorCode, type ForgeFileChange, type ForgeFileMode, type ForgeGitCredentials, type ForgeGitCredentialsInput, type ForgeKind, type ForgeMemoryCacheOptions, type ForgeMergeOptions, type ForgeProvider, type ForgeProviderOf, type ForgeResponseCache, ForgeTimeoutError, type ForgeToken, type ForgeTokenErrorCode, type ForgeUser, type ForgeUserErrorCode, type ForgeUserGrant, type GitHubAppCredentials, type GitHubAppDelivery, type GitHubAppInput, type GitHubAppRepository, type GitHubBranchRuleDetails, type GitHubInstallationEnv, type GitHubInstallationRouting, type GitHubProvider, MergeBlockedError, type MergeMethod, type MergeOptions, type MergeResult, NotFoundError, type Page, RateLimitedError, type ReadForgeArchiveOptions, type RepoRef, type RequiredCheck, type Thread, type ThreadRef, type TreeEntry, type UseForgeOptions, repoRef };