@volter/twin-github 0.1.2 → 2.0.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 (215) hide show
  1. package/README.md +88 -36
  2. package/client/github-mirror.css +277 -319
  3. package/client/github-mirror.d.ts +418 -0
  4. package/client/github-mirror.js +485 -0
  5. package/client/github-mirror.tsx +153 -357
  6. package/client/pulls-rest.ts +159 -0
  7. package/client/pulls-workspace.tsx +841 -0
  8. package/dist/client/github-mirror.bundle.js +239 -0
  9. package/dist/client/github-mirror.css +916 -0
  10. package/dist/client/github-mirror.d.ts +418 -0
  11. package/dist/client/github-mirror.js +485 -0
  12. package/dist/client/github-mirror.tsx +1315 -0
  13. package/dist/client/pulls-rest.d.ts +42 -0
  14. package/dist/client/pulls-rest.js +140 -0
  15. package/dist/client/pulls-rest.ts +159 -0
  16. package/dist/client/pulls-workspace.bundle.js +22 -0
  17. package/dist/client/pulls-workspace.d.ts +114 -0
  18. package/dist/client/pulls-workspace.js +418 -0
  19. package/dist/client/pulls-workspace.tsx +841 -0
  20. package/dist/src/cli.d.ts +2 -0
  21. package/dist/src/cli.js +40 -0
  22. package/dist/src/generated/graphql-sdl.gen.json +1 -0
  23. package/dist/src/generated/graphql.gen.json +1 -0
  24. package/dist/src/generated/surface.gen.json +1 -0
  25. package/dist/src/generated/ui.gen.json +1 -0
  26. package/dist/src/github-budget.d.ts +69 -0
  27. package/dist/src/github-budget.js +172 -0
  28. package/dist/src/github-capabilities.d.ts +5 -0
  29. package/dist/src/github-capabilities.js +4468 -0
  30. package/dist/src/github-conformance.d.ts +43 -0
  31. package/dist/src/github-conformance.js +76 -0
  32. package/dist/src/github-connector.d.ts +307 -0
  33. package/dist/src/github-connector.js +1398 -0
  34. package/dist/src/github-events.d.ts +41 -0
  35. package/dist/src/github-events.js +230 -0
  36. package/dist/src/github-git-http.d.ts +49 -0
  37. package/dist/src/github-git-http.js +185 -0
  38. package/dist/src/github-git-plane.d.ts +114 -0
  39. package/dist/src/github-git-plane.js +407 -0
  40. package/dist/src/github-mirror-state.d.ts +2 -0
  41. package/dist/src/github-mirror-state.js +335 -0
  42. package/dist/src/github-mirror-ui.d.ts +20 -0
  43. package/dist/src/github-mirror-ui.js +101 -0
  44. package/dist/src/github-server.d.ts +14 -0
  45. package/dist/src/github-server.js +240 -0
  46. package/dist/src/github-shared.d.ts +12 -0
  47. package/dist/src/github-shared.js +21 -0
  48. package/dist/src/github-twin.d.ts +1411 -0
  49. package/dist/src/github-twin.js +4084 -0
  50. package/dist/src/github-ui-conformance.d.ts +4 -0
  51. package/dist/src/github-ui-conformance.js +105 -0
  52. package/dist/src/github-ui-structure.d.ts +18 -0
  53. package/dist/src/github-ui-structure.js +251 -0
  54. package/dist/src/graphql-wire.d.ts +22 -0
  55. package/dist/src/graphql-wire.js +89 -0
  56. package/dist/src/index.d.ts +17 -0
  57. package/dist/src/index.js +101 -0
  58. package/dist/src/manifest.d.ts +8 -0
  59. package/dist/src/manifest.js +597 -0
  60. package/dist/src/npm-registry.d.ts +7 -0
  61. package/dist/src/npm-registry.js +47 -0
  62. package/dist/src/screens/app-installation.d.ts +3 -0
  63. package/dist/src/screens/app-installation.js +166 -0
  64. package/dist/src/screens/app-manifest.d.ts +3 -0
  65. package/dist/src/screens/app-manifest.js +81 -0
  66. package/dist/src/screens/oauth.d.ts +15 -0
  67. package/dist/src/screens/oauth.js +257 -0
  68. package/dist/src/screens/session.d.ts +8 -0
  69. package/dist/src/screens/session.js +159 -0
  70. package/dist/src/semantics/actions.d.ts +2 -0
  71. package/dist/src/semantics/actions.js +413 -0
  72. package/dist/src/semantics/activity.d.ts +4 -0
  73. package/dist/src/semantics/activity.js +161 -0
  74. package/dist/src/semantics/apps.d.ts +2 -0
  75. package/dist/src/semantics/apps.js +144 -0
  76. package/dist/src/semantics/branches.d.ts +2 -0
  77. package/dist/src/semantics/branches.js +136 -0
  78. package/dist/src/semantics/checks.d.ts +2 -0
  79. package/dist/src/semantics/checks.js +176 -0
  80. package/dist/src/semantics/code-scanning-upload.d.ts +2 -0
  81. package/dist/src/semantics/code-scanning-upload.js +97 -0
  82. package/dist/src/semantics/codespaces.d.ts +2 -0
  83. package/dist/src/semantics/codespaces.js +58 -0
  84. package/dist/src/semantics/commits.d.ts +2 -0
  85. package/dist/src/semantics/commits.js +109 -0
  86. package/dist/src/semantics/contents.d.ts +2 -0
  87. package/dist/src/semantics/contents.js +131 -0
  88. package/dist/src/semantics/deployments.d.ts +2 -0
  89. package/dist/src/semantics/deployments.js +127 -0
  90. package/dist/src/semantics/gists.d.ts +2 -0
  91. package/dist/src/semantics/gists.js +86 -0
  92. package/dist/src/semantics/git.d.ts +2 -0
  93. package/dist/src/semantics/git.js +235 -0
  94. package/dist/src/semantics/graphql.d.ts +7 -0
  95. package/dist/src/semantics/graphql.js +512 -0
  96. package/dist/src/semantics/index.d.ts +5 -0
  97. package/dist/src/semantics/index.js +62 -0
  98. package/dist/src/semantics/issues.d.ts +2 -0
  99. package/dist/src/semantics/issues.js +456 -0
  100. package/dist/src/semantics/keys.d.ts +2 -0
  101. package/dist/src/semantics/keys.js +66 -0
  102. package/dist/src/semantics/labels.d.ts +2 -0
  103. package/dist/src/semantics/labels.js +100 -0
  104. package/dist/src/semantics/meta.d.ts +12 -0
  105. package/dist/src/semantics/meta.js +144 -0
  106. package/dist/src/semantics/notifications.d.ts +4 -0
  107. package/dist/src/semantics/notifications.js +62 -0
  108. package/dist/src/semantics/orgs.d.ts +2 -0
  109. package/dist/src/semantics/orgs.js +420 -0
  110. package/dist/src/semantics/packages.d.ts +2 -0
  111. package/dist/src/semantics/packages.js +55 -0
  112. package/dist/src/semantics/pages.d.ts +2 -0
  113. package/dist/src/semantics/pages.js +176 -0
  114. package/dist/src/semantics/projects.d.ts +2 -0
  115. package/dist/src/semantics/projects.js +239 -0
  116. package/dist/src/semantics/pulls.d.ts +2 -0
  117. package/dist/src/semantics/pulls.js +462 -0
  118. package/dist/src/semantics/push-reactions.d.ts +101 -0
  119. package/dist/src/semantics/push-reactions.js +513 -0
  120. package/dist/src/semantics/releases.d.ts +19 -0
  121. package/dist/src/semantics/releases.js +231 -0
  122. package/dist/src/semantics/repo-invitations.d.ts +2 -0
  123. package/dist/src/semantics/repo-invitations.js +98 -0
  124. package/dist/src/semantics/repos.d.ts +17 -0
  125. package/dist/src/semantics/repos.js +390 -0
  126. package/dist/src/semantics/rulesets.d.ts +2 -0
  127. package/dist/src/semantics/rulesets.js +111 -0
  128. package/dist/src/semantics/search.d.ts +2 -0
  129. package/dist/src/semantics/search.js +84 -0
  130. package/dist/src/semantics/security.d.ts +2 -0
  131. package/dist/src/semantics/security.js +177 -0
  132. package/dist/src/semantics/shared.d.ts +61 -0
  133. package/dist/src/semantics/shared.js +151 -0
  134. package/dist/src/semantics/users.d.ts +2 -0
  135. package/dist/src/semantics/users.js +255 -0
  136. package/dist/src/semantics/webhooks.d.ts +2 -0
  137. package/dist/src/semantics/webhooks.js +107 -0
  138. package/dist/test-fixtures/github-a11y-reference.pr-list.SOURCE.md +56 -0
  139. package/dist/test-fixtures/github-a11y-reference.pr-list.json +1447 -0
  140. package/dist/test-fixtures/github-comment-schema.SOURCE.md +11 -0
  141. package/dist/test-fixtures/github-comment-schema.json +702 -0
  142. package/dist/test-fixtures/github-known-deviations.json +94 -0
  143. package/dist/test-fixtures/github-openapi-operations.SOURCE.md +76 -0
  144. package/dist/test-fixtures/github-openapi-operations.json +362 -0
  145. package/dist/test-fixtures/github-pull-schema.SOURCE.md +37 -0
  146. package/dist/test-fixtures/github-pull-schema.json +3601 -0
  147. package/dist/test-fixtures/github-review-schema.SOURCE.md +12 -0
  148. package/dist/test-fixtures/github-review-schema.json +236 -0
  149. package/package.json +20 -11
  150. package/src/cli.ts +7 -6
  151. package/src/generated/graphql-sdl.gen.json +1 -0
  152. package/src/generated/graphql.gen.json +1 -0
  153. package/src/generated/surface.gen.json +1 -0
  154. package/src/generated/ui.gen.json +1 -0
  155. package/src/github-a11y-snapshot.uitest.ts +5 -5
  156. package/src/github-budget.ts +4 -4
  157. package/src/github-capabilities.ts +1993 -556
  158. package/src/github-conformance.ts +12 -7
  159. package/src/github-connector.ts +108 -96
  160. package/src/github-events.ts +223 -95
  161. package/src/github-git-http.ts +47 -83
  162. package/src/github-git-plane.ts +247 -385
  163. package/src/github-journey.uitest.ts +28 -44
  164. package/src/github-mirror-state.ts +23 -61
  165. package/src/github-mirror-ui.ts +16 -10
  166. package/src/github-server.ts +158 -60
  167. package/src/github-shared.ts +1 -1
  168. package/src/github-twin.ts +1525 -4494
  169. package/src/github-ui-conformance.ts +7 -8
  170. package/src/github-ui-structure.ts +19 -18
  171. package/src/graphql-wire.ts +115 -0
  172. package/src/index.ts +47 -7
  173. package/src/manifest.ts +605 -0
  174. package/src/npm-registry.ts +43 -0
  175. package/src/screens/app-installation.tsx +217 -0
  176. package/src/screens/app-manifest.tsx +97 -0
  177. package/src/screens/oauth.tsx +258 -0
  178. package/src/screens/session.tsx +186 -0
  179. package/src/semantics/actions.ts +395 -0
  180. package/src/semantics/activity.ts +171 -0
  181. package/src/semantics/apps.ts +133 -0
  182. package/src/semantics/branches.ts +133 -0
  183. package/src/semantics/checks.ts +163 -0
  184. package/src/semantics/code-scanning-upload.ts +92 -0
  185. package/src/semantics/codespaces.ts +58 -0
  186. package/src/semantics/commits.ts +109 -0
  187. package/src/semantics/contents.ts +112 -0
  188. package/src/semantics/deployments.ts +116 -0
  189. package/src/semantics/gists.ts +85 -0
  190. package/src/semantics/git.ts +226 -0
  191. package/src/semantics/graphql.ts +505 -0
  192. package/src/semantics/index.ts +68 -0
  193. package/src/semantics/issues.ts +434 -0
  194. package/src/semantics/keys.ts +66 -0
  195. package/src/semantics/labels.ts +91 -0
  196. package/src/semantics/meta.ts +139 -0
  197. package/src/semantics/notifications.ts +58 -0
  198. package/src/semantics/orgs.ts +383 -0
  199. package/src/semantics/packages.ts +59 -0
  200. package/src/semantics/pages.ts +154 -0
  201. package/src/semantics/projects.ts +246 -0
  202. package/src/semantics/pulls.ts +421 -0
  203. package/src/semantics/push-reactions.ts +471 -0
  204. package/src/semantics/releases.ts +213 -0
  205. package/src/semantics/repo-invitations.ts +112 -0
  206. package/src/semantics/repos.ts +373 -0
  207. package/src/semantics/rulesets.ts +107 -0
  208. package/src/semantics/search.ts +83 -0
  209. package/src/semantics/security.ts +153 -0
  210. package/src/semantics/shared.ts +181 -0
  211. package/src/semantics/users.ts +252 -0
  212. package/src/semantics/webhooks.ts +101 -0
  213. package/test-fixtures/github-known-deviations.json +7 -8
  214. package/test-fixtures/github-openapi-operations.json +46 -227
  215. package/src/github-graphql.ts +0 -398
@@ -0,0 +1,1411 @@
1
+ /** What the World keeps of a person's password: its hash, never the password (src/screens/session.tsx checks it). */
2
+ export declare const passwordHash: (login: string, password: string) => string;
3
+ /** A person's authenticator app: the RFC 6238 code of a base32 secret at an instant, as GitHub's TOTP setup encodes it
4
+ * (docs.github.com/authentication/securing-your-account-with-two-factor-authentication-2fa/configuring-two-factor-authentication:
5
+ * SHA1, 6 digits, a 30-second period). `step` counts 30-second periods since the epoch. */
6
+ export declare const totpStep: (at: string) => number;
7
+ export declare function totpCode(secret: string, step: number): string;
8
+ /** The engine slot's plane, as handlers reach it (semantics/ imports shared helpers from here). */
9
+ export { deleteBareRepo, deleteGitRefInPlane, diffFilesInPlane, mergeBaseInPlane, mergeIntoBranchInPlane, ensureBareRepo, forkBareRepo, setBareRepoHead, hasBareRepo, isAncestorInPlane, isValidBranchName, listGitPlaneRefs, objectExistsInPlane, objectTypeInPlane, readGitBlobFromPlane, readGitCommitFromPlane, readGitTagFromPlane, readGitTreeFromPlane, updateGitRefInPlane, writeGitBlobToPlane, writeGitCommitToPlane, writeGitTagToPlane, writeGitTreeToPlane, } from './github-git-plane.js';
10
+ export declare function mergePullRequest(repo: string, pr: GithubPr, method: 'merge' | 'squash' | 'rebase', occurredAt: string, root: string | undefined, merger: string | undefined, write: GithubWrite): Promise<{
11
+ ok: true;
12
+ sha: string;
13
+ } | {
14
+ ok: false;
15
+ status: number;
16
+ message: string;
17
+ }>;
18
+ export declare function rulesetsFor(st: GithubState, repo: string, branch: string, enforcement?: 'active' | 'evaluate'): GithubRuleset[];
19
+ /** A stored write as the kernel records it: a handler passes its context's (semantics/shared.ts `put`). */
20
+ export type GithubWrite = (w: {
21
+ operation: string;
22
+ subjectType: string;
23
+ subjectId: string;
24
+ fields: Record<string, unknown>;
25
+ }) => Promise<unknown>;
26
+ /** A write decided from the tree with nothing written in between (semantics/shared.ts `atomic` for a
27
+ * handler's context; the kernel's lock otherwise). */
28
+ export type GithubAtomic = <T>(decide: () => {
29
+ value: T;
30
+ write?: Parameters<GithubWrite>[0];
31
+ }) => Promise<T>;
32
+ export declare function kernelAtomic(occurredAt: string, root?: string): GithubAtomic;
33
+ export declare function recordRulesetVersion(repo: string, id: number, login: string, occurredAt: string, root: string | undefined, write: GithubWrite): Promise<void>;
34
+ export declare function recordRuleSuite(repo: string, suite: Omit<GithubRuleSuite, 'id'>, occurredAt: string, root: string | undefined, write: GithubWrite): Promise<void>;
35
+ export type GithubReview = {
36
+ id: number;
37
+ repository: string;
38
+ number: number;
39
+ state?: string;
40
+ body?: string;
41
+ submitted_at?: string;
42
+ commit_id?: string;
43
+ user_login?: string;
44
+ user_type?: 'User' | 'Bot';
45
+ /** the reviewer's relation to the repository when they submitted it */
46
+ author_association?: string;
47
+ };
48
+ export type GithubReviewOverlay = {
49
+ id: number;
50
+ state?: string;
51
+ body?: string;
52
+ dismissed_message?: string;
53
+ };
54
+ export type GithubComment = {
55
+ id: number;
56
+ repository: string;
57
+ number: number;
58
+ kind: 'issue' | 'review';
59
+ subject_id?: string;
60
+ commit_id?: string;
61
+ body?: string;
62
+ created_at?: string;
63
+ updated_at?: string;
64
+ path?: string;
65
+ line?: number;
66
+ side?: string;
67
+ start_line?: number;
68
+ diff_hunk?: string;
69
+ in_reply_to?: number;
70
+ review_id?: number;
71
+ user_login?: string;
72
+ user_type?: 'User' | 'Bot';
73
+ external_id?: string;
74
+ /** the writer's relation to the repository when they wrote it */
75
+ author_association?: string;
76
+ };
77
+ export type GithubPullFile = {
78
+ filename: string;
79
+ status: string;
80
+ additions: number;
81
+ deletions: number;
82
+ changes: number;
83
+ patch?: string;
84
+ sha?: string;
85
+ previous_filename?: string;
86
+ };
87
+ export type GithubPullCommit = {
88
+ sha: string;
89
+ message?: string;
90
+ author_name?: string;
91
+ author_email?: string;
92
+ author_date?: string;
93
+ };
94
+ export type GithubPr = {
95
+ id: string;
96
+ number: number;
97
+ repository: string;
98
+ /** the repository it was opened in, when a transfer has since moved it: its id stays the one it was given there */
99
+ born_in?: string;
100
+ locked?: boolean;
101
+ active_lock_reason?: string | null;
102
+ updated_at?: string;
103
+ user_login?: string | null;
104
+ user_type?: string;
105
+ /** the author's relation to the repository when they opened it (GitHub's author_association) */
106
+ author_association?: string;
107
+ maintainer_can_modify?: boolean;
108
+ base_ref?: string;
109
+ head_sha?: string;
110
+ head_ref?: string;
111
+ /** the repository the head branch lives in when it is not the pull request's own: a fork in the same network, as a
112
+ * pull request from a fork has it (docs.github.com/pull-requests/collaborating-with-pull-requests/proposing-changes-
113
+ * to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork) */
114
+ head_repo?: string;
115
+ changed_files?: number;
116
+ commits?: number;
117
+ additions?: number;
118
+ deletions?: number;
119
+ review_count: number;
120
+ comment_count: number;
121
+ title?: string;
122
+ body?: string;
123
+ state?: string;
124
+ merged?: boolean;
125
+ merged_at?: string;
126
+ merge_commit_sha?: string;
127
+ merged_by_login?: string;
128
+ created_at?: string;
129
+ labels?: string[];
130
+ assignees?: string[];
131
+ requested_reviewers?: string[];
132
+ milestone?: number;
133
+ draft?: boolean;
134
+ merge_method?: string;
135
+ mergeable_state?: string;
136
+ state_history?: Array<{
137
+ state: string;
138
+ state_reason?: string | null;
139
+ at?: string;
140
+ }>;
141
+ /** what happened to it, in order, from its writes: who labeled, assigned, milestoned, locked, closed or reopened it, and when */
142
+ activity?: GithubActivity[];
143
+ is_pull_request?: boolean;
144
+ };
145
+ export type GithubStatus = {
146
+ id: number;
147
+ repository: string;
148
+ sha: string;
149
+ state: string;
150
+ context?: string;
151
+ description?: string;
152
+ target_url?: string;
153
+ created_at?: string;
154
+ updated_at?: string;
155
+ };
156
+ export type GithubCheckRun = {
157
+ id: number;
158
+ /** the checking system's own id for the run, as it gave it */
159
+ external_id?: string;
160
+ repository: string;
161
+ head_sha: string;
162
+ name: string;
163
+ status?: string;
164
+ conclusion?: string;
165
+ details_url?: string;
166
+ started_at?: string;
167
+ completed_at?: string;
168
+ check_suite_id?: number;
169
+ /** the GitHub App that wrote the run; an observed run may not say */
170
+ app_slug?: string;
171
+ output_title?: string;
172
+ output_summary?: string;
173
+ output_text?: string;
174
+ annotations?: GithubCheckAnnotation[];
175
+ };
176
+ export type GithubCheckAnnotation = {
177
+ path: string;
178
+ start_line: number;
179
+ end_line: number;
180
+ annotation_level: string;
181
+ message: string;
182
+ title?: string;
183
+ raw_details?: string;
184
+ start_column?: number;
185
+ end_column?: number;
186
+ };
187
+ export type GithubMilestone = {
188
+ id: number;
189
+ number: number;
190
+ repository: string;
191
+ title?: string;
192
+ description?: string;
193
+ state?: string;
194
+ due_on?: string;
195
+ created_at?: string;
196
+ updated_at?: string;
197
+ /** who created it */
198
+ creator_login?: string;
199
+ /** the open and closed issues and pull requests in it, counted by the fold */
200
+ open_issues?: number;
201
+ closed_issues?: number;
202
+ };
203
+ export type GithubIssue = {
204
+ id: string;
205
+ number: number;
206
+ repository: string;
207
+ /** the repository it was opened in, when a transfer has since moved it: its id stays the one it was given there */
208
+ born_in?: string;
209
+ title?: string;
210
+ body?: string;
211
+ state?: string;
212
+ created_at?: string;
213
+ updated_at?: string;
214
+ labels?: string[];
215
+ assignees?: string[];
216
+ milestone?: number;
217
+ state_reason?: string | null;
218
+ state_history?: Array<{
219
+ state: string;
220
+ state_reason?: string | null;
221
+ at?: string;
222
+ }>;
223
+ /** what happened to it, in order, from its writes: who labeled, assigned, milestoned, locked, closed or reopened it, and when */
224
+ activity?: GithubActivity[];
225
+ locked?: boolean;
226
+ active_lock_reason?: string | null;
227
+ sub_issue_numbers?: number[];
228
+ parent_issue_number?: number;
229
+ /** who opened it */
230
+ user_login?: string | null;
231
+ /** their relation to the repository when they opened it */
232
+ author_association?: string;
233
+ };
234
+ export type GithubReaction = {
235
+ id: number;
236
+ repository: string;
237
+ subject_type: 'issue' | 'comment' | 'discussion' | 'release';
238
+ subject_key: string;
239
+ content: string;
240
+ created_at?: string;
241
+ };
242
+ export type GithubLabel = {
243
+ id: number;
244
+ repository: string;
245
+ name: string;
246
+ color?: string;
247
+ description?: string | null;
248
+ default?: boolean;
249
+ };
250
+ export type GithubRepo = {
251
+ id: number;
252
+ owner: string;
253
+ name: string;
254
+ full_name: string;
255
+ description?: string | null;
256
+ private?: boolean;
257
+ default_branch?: string;
258
+ topics?: string[];
259
+ homepage?: string | null;
260
+ has_issues?: boolean;
261
+ has_projects?: boolean;
262
+ has_wiki?: boolean;
263
+ has_discussions?: boolean;
264
+ archived?: boolean;
265
+ fork?: boolean;
266
+ parent_full_name?: string;
267
+ created_at?: string;
268
+ updated_at?: string;
269
+ /** What GitHub counts and detects on a repository, as observed from the vendor or, for a local
270
+ * repository, derived by the fold from the World (stars, watchers, forks, open issues and pull
271
+ * requests, the last push, the files' bytes, their language and licence). */
272
+ facts?: GithubRepoFacts;
273
+ };
274
+ export type GithubRepoFacts = {
275
+ stargazers_count: number;
276
+ subscribers_count: number;
277
+ forks_count: number;
278
+ open_issues_count: number;
279
+ pushed_at: string | null;
280
+ size: number;
281
+ language: string | null;
282
+ license: Record<string, unknown> | null;
283
+ has_pages: boolean;
284
+ };
285
+ export type GithubBranch = {
286
+ repository: string;
287
+ name: string;
288
+ commit_sha: string;
289
+ protected?: boolean;
290
+ protection_config?: {
291
+ required_status_checks?: {
292
+ strict: boolean;
293
+ contexts: string[];
294
+ checks: Array<{
295
+ context: string;
296
+ app_id: number | null;
297
+ }>;
298
+ } | null;
299
+ enforce_admins?: boolean;
300
+ required_pull_request_reviews?: Record<string, unknown> | null;
301
+ restrictions?: Record<string, unknown> | null;
302
+ };
303
+ };
304
+ export type GithubCollaborator = {
305
+ repository: string;
306
+ login: string;
307
+ permission: string;
308
+ };
309
+ export type GithubWebhook = {
310
+ id: number;
311
+ repository: string;
312
+ name: string;
313
+ active: boolean;
314
+ events: string[];
315
+ url?: string;
316
+ content_type?: string;
317
+ secret?: string;
318
+ created_at?: string;
319
+ updated_at?: string;
320
+ };
321
+ export type GithubContentFile = {
322
+ repository: string;
323
+ path: string;
324
+ content_b64?: string;
325
+ sha: string;
326
+ size: number;
327
+ branch?: string;
328
+ };
329
+ export type GithubUser = {
330
+ login: string;
331
+ id: number;
332
+ type: 'User' | 'Organization';
333
+ name?: string | null;
334
+ bio?: string | null;
335
+ company?: string | null;
336
+ blog?: string | null;
337
+ location?: string | null;
338
+ email?: string | null;
339
+ };
340
+ export type GithubGistFile = {
341
+ filename: string;
342
+ content?: string;
343
+ language?: string;
344
+ size?: number;
345
+ };
346
+ /** One saved version of a gist: its id (a sha), when, by whom, and its files then. */
347
+ export type GithubGistVersion = {
348
+ version: string;
349
+ committed_at: string;
350
+ user_login: string;
351
+ files: GithubGistFile[];
352
+ additions: number;
353
+ deletions: number;
354
+ };
355
+ export type GithubGist = {
356
+ id: string;
357
+ /** who created it */
358
+ owner?: string;
359
+ description?: string | null;
360
+ public?: boolean;
361
+ files: GithubGistFile[];
362
+ created_at?: string;
363
+ updated_at?: string;
364
+ /** its versions, newest first: every create and every edit of its files saves one */
365
+ history?: GithubGistVersion[];
366
+ };
367
+ export type GithubNotification = {
368
+ id: string;
369
+ repository: string;
370
+ subject_title: string;
371
+ subject_type: string;
372
+ subject_url?: string;
373
+ reason: string;
374
+ unread: boolean;
375
+ updated_at?: string;
376
+ /** The person's own choice about the thread: absent while it stands as GitHub made it (subscribed, since they
377
+ * take part), set when they subscribe or ignore it, null once they unsubscribe. */
378
+ subscription?: {
379
+ subscribed: boolean;
380
+ ignored: boolean;
381
+ created_at?: string;
382
+ } | null;
383
+ };
384
+ export type GithubWorkflow = {
385
+ id: number;
386
+ repository: string;
387
+ name: string;
388
+ path: string;
389
+ state?: string;
390
+ created_at?: string;
391
+ updated_at?: string;
392
+ };
393
+ export type GithubWorkflowRun = {
394
+ id: number;
395
+ repository: string;
396
+ workflow_id: number;
397
+ name?: string;
398
+ run_number: number;
399
+ event: string;
400
+ status: string;
401
+ conclusion?: string;
402
+ head_sha: string;
403
+ head_branch?: string;
404
+ created_at?: string;
405
+ updated_at?: string;
406
+ actor_login?: string;
407
+ approvals?: {
408
+ environment: string;
409
+ state: 'approved' | 'rejected';
410
+ comment: string;
411
+ user_login: string;
412
+ at: string;
413
+ }[];
414
+ /** the repository the run's commit came from when it is not the run's own: the fork of a pull request from one */
415
+ head_repository?: string;
416
+ };
417
+ export type GithubJobStep = {
418
+ name: string;
419
+ status: string;
420
+ conclusion?: string;
421
+ number: number;
422
+ };
423
+ export type GithubJob = {
424
+ id: number;
425
+ run_id: number;
426
+ repository: string;
427
+ name: string;
428
+ status: string;
429
+ conclusion?: string;
430
+ head_sha: string;
431
+ started_at?: string;
432
+ completed_at?: string;
433
+ steps: GithubJobStep[];
434
+ /** the runner labels its workflow's `runs-on` asks for, its workflow's name and its run's branch, when queued */
435
+ labels?: string[];
436
+ workflow_name?: string;
437
+ head_branch?: string;
438
+ created_at?: string;
439
+ };
440
+ export type GithubReleaseAsset = {
441
+ id: number;
442
+ repository: string;
443
+ release_id: number;
444
+ name: string;
445
+ label?: string;
446
+ content_type?: string;
447
+ size?: number;
448
+ state?: string;
449
+ download_count?: number;
450
+ created_at?: string;
451
+ updated_at?: string;
452
+ /** who uploaded it */
453
+ uploader_login?: string;
454
+ };
455
+ export type GithubRelease = {
456
+ id: number;
457
+ repository: string;
458
+ tag_name: string;
459
+ target_commitish?: string;
460
+ name?: string;
461
+ body?: string;
462
+ draft?: boolean;
463
+ prerelease?: boolean;
464
+ created_at?: string;
465
+ published_at?: string;
466
+ /** who created it: a person, or an app's bot (a workflow's GITHUB_TOKEN is github-actions[bot]) */
467
+ author_login?: string;
468
+ };
469
+ export type GithubTag = {
470
+ name: string;
471
+ commit_sha: string;
472
+ repository: string;
473
+ };
474
+ export type GithubDiscussionCategory = {
475
+ id: number;
476
+ repository: string;
477
+ name: string;
478
+ slug: string;
479
+ emoji?: string;
480
+ description?: string;
481
+ is_answerable?: boolean;
482
+ };
483
+ export type GithubDiscussion = {
484
+ number: number;
485
+ repository: string;
486
+ title?: string;
487
+ body?: string;
488
+ category_slug?: string;
489
+ state?: string;
490
+ state_reason?: string;
491
+ answer_comment_id?: number | null;
492
+ locked?: boolean;
493
+ created_at?: string;
494
+ updated_at?: string;
495
+ };
496
+ export type GithubDiscussionComment = {
497
+ id: number;
498
+ repository: string;
499
+ discussion_number: number;
500
+ parent_id?: number | null;
501
+ body?: string;
502
+ is_answer?: boolean;
503
+ created_at?: string;
504
+ updated_at?: string;
505
+ };
506
+ export type GithubGitRef = {
507
+ repository: string;
508
+ ref: string;
509
+ object_sha: string;
510
+ object_type: string;
511
+ };
512
+ export type GithubGitCommit = {
513
+ repository: string;
514
+ sha: string;
515
+ message: string;
516
+ tree_sha: string;
517
+ parents: string[];
518
+ author_name?: string;
519
+ author_email?: string;
520
+ created_at?: string;
521
+ };
522
+ export type GithubGitTreeEntry = {
523
+ path: string;
524
+ mode: string;
525
+ type: string;
526
+ sha: string;
527
+ size?: number;
528
+ };
529
+ export type GithubGitTree = {
530
+ repository: string;
531
+ sha: string;
532
+ tree: GithubGitTreeEntry[];
533
+ truncated?: boolean;
534
+ };
535
+ export type GithubGitBlob = {
536
+ repository: string;
537
+ sha: string;
538
+ content_b64: string;
539
+ size: number;
540
+ encoding: string;
541
+ };
542
+ export type GithubGitTagObject = {
543
+ repository: string;
544
+ sha: string;
545
+ tag: string;
546
+ message: string;
547
+ object_sha: string;
548
+ object_type: string;
549
+ tagger_name?: string;
550
+ created_at?: string;
551
+ };
552
+ export type GithubDeployment = {
553
+ payload?: unknown;
554
+ id: number;
555
+ repository: string;
556
+ ref: string;
557
+ sha: string;
558
+ task: string;
559
+ environment: string;
560
+ description?: string | null;
561
+ transient_environment?: boolean;
562
+ production_environment?: boolean;
563
+ created_at?: string;
564
+ updated_at?: string;
565
+ creator_login?: string;
566
+ };
567
+ export type GithubDeploymentStatus = {
568
+ id: number;
569
+ repository: string;
570
+ deployment_id: number;
571
+ state: string;
572
+ description?: string | null;
573
+ environment?: string;
574
+ environment_url?: string;
575
+ log_url?: string;
576
+ created_at?: string;
577
+ creator_login?: string;
578
+ };
579
+ export type GithubEnvironment = {
580
+ repository: string;
581
+ born_in?: string;
582
+ name: string;
583
+ wait_timer?: number;
584
+ reviewers?: string[];
585
+ created_at?: string;
586
+ updated_at?: string;
587
+ };
588
+ export type GithubActionsSecret = {
589
+ scope: string;
590
+ container: string;
591
+ name: string;
592
+ created_at?: string;
593
+ updated_at?: string; /** an organization's: all, private or selected repositories */
594
+ visibility?: string;
595
+ };
596
+ export type GithubActionsVariable = {
597
+ scope: string;
598
+ container: string;
599
+ name: string;
600
+ value: string;
601
+ created_at?: string;
602
+ updated_at?: string; /** an organization's: all, private or selected repositories */
603
+ visibility?: string;
604
+ };
605
+ export type GithubActionsCache = {
606
+ id: number;
607
+ repository: string;
608
+ key: string;
609
+ ref: string;
610
+ size_in_bytes: number;
611
+ created_at?: string;
612
+ last_accessed_at?: string;
613
+ };
614
+ export type GithubActionsArtifact = {
615
+ id: number;
616
+ repository: string;
617
+ name: string;
618
+ size_in_bytes: number;
619
+ run_id?: number;
620
+ expired?: boolean;
621
+ created_at?: string;
622
+ };
623
+ export type GithubOrg = {
624
+ login: string;
625
+ description?: string | null;
626
+ name?: string | null;
627
+ company?: string | null;
628
+ blog?: string | null;
629
+ location?: string | null;
630
+ email?: string | null;
631
+ billing_email?: string | null;
632
+ created_at?: string;
633
+ updated_at?: string;
634
+ two_factor_requirement_enabled?: boolean;
635
+ };
636
+ export type GithubOrgMembership = {
637
+ org: string;
638
+ login: string;
639
+ role: string;
640
+ state: string;
641
+ created_at?: string;
642
+ };
643
+ export type GithubOutsideCollaborator = {
644
+ org: string;
645
+ login: string;
646
+ };
647
+ export type GithubOrgWebhook = {
648
+ id: number;
649
+ org: string;
650
+ name: string;
651
+ active: boolean;
652
+ events: string[];
653
+ url?: string;
654
+ content_type?: string;
655
+ created_at?: string;
656
+ updated_at?: string;
657
+ };
658
+ export type GithubTeam = {
659
+ id: number;
660
+ org: string;
661
+ slug: string;
662
+ name: string;
663
+ description?: string | null;
664
+ privacy?: string;
665
+ permission?: string;
666
+ created_at?: string;
667
+ updated_at?: string;
668
+ };
669
+ export type GithubTeamMembership = {
670
+ org: string;
671
+ team_slug: string;
672
+ login: string;
673
+ role: string;
674
+ state: string;
675
+ };
676
+ export type GithubTeamRepo = {
677
+ org: string;
678
+ team_slug: string;
679
+ repository: string;
680
+ permission: string;
681
+ };
682
+ export type GithubCommitComment = {
683
+ id: number;
684
+ repository: string;
685
+ commit_sha: string;
686
+ body?: string;
687
+ path?: string | null;
688
+ line?: number | null;
689
+ position?: number | null;
690
+ created_at?: string;
691
+ updated_at?: string;
692
+ };
693
+ export type GithubIssueType = {
694
+ id: number;
695
+ org: string;
696
+ name: string;
697
+ description?: string | null;
698
+ color?: string | null;
699
+ is_enabled?: boolean;
700
+ created_at?: string;
701
+ updated_at?: string;
702
+ };
703
+ export type GithubDeployKey = {
704
+ id: number;
705
+ repository: string;
706
+ key: string;
707
+ title: string;
708
+ read_only: boolean;
709
+ created_at?: string;
710
+ };
711
+ export type GithubAutolink = {
712
+ id: number;
713
+ repository: string;
714
+ key_prefix: string;
715
+ url_template: string;
716
+ is_alphanumeric: boolean;
717
+ };
718
+ export type GithubRuleset = {
719
+ id: number;
720
+ repository: string;
721
+ name: string;
722
+ target: string;
723
+ enforcement: string;
724
+ rules: Array<Record<string, unknown>>;
725
+ conditions?: Record<string, unknown>;
726
+ bypass_actors?: Array<Record<string, unknown>>;
727
+ created_at?: string;
728
+ updated_at?: string;
729
+ versions?: {
730
+ version_id: number;
731
+ actor_login: string;
732
+ updated_at: string;
733
+ state: Record<string, unknown>;
734
+ }[];
735
+ };
736
+ export type GithubRuleSuite = {
737
+ id: number;
738
+ repository: string;
739
+ ref: string;
740
+ actor_login: string;
741
+ before_sha: string;
742
+ after_sha: string;
743
+ pushed_at: string;
744
+ result: 'pass' | 'fail' | 'bypass';
745
+ rules: {
746
+ ruleset_id: number;
747
+ ruleset_name: string;
748
+ rule_type: string;
749
+ enforcement: string;
750
+ result: 'pass' | 'fail';
751
+ details: string | null;
752
+ }[];
753
+ };
754
+ export type GithubUserEmail = {
755
+ email: string;
756
+ primary: boolean;
757
+ verified: boolean;
758
+ visibility: string | null;
759
+ };
760
+ export type GithubUserSshKey = {
761
+ id: number;
762
+ key: string;
763
+ title: string;
764
+ created_at?: string;
765
+ };
766
+ export type GithubUserGpgKey = {
767
+ id: number;
768
+ key_id: string;
769
+ raw_key: string;
770
+ created_at?: string;
771
+ };
772
+ export type GithubProject = {
773
+ creator_login?: string;
774
+ id: number;
775
+ owner: string;
776
+ owner_type: string;
777
+ number: number;
778
+ title: string;
779
+ short_description?: string | null;
780
+ readme?: string | null;
781
+ public?: boolean;
782
+ closed?: boolean;
783
+ created_at?: string;
784
+ updated_at?: string;
785
+ };
786
+ export type GithubProjectField = {
787
+ id: number;
788
+ project_id: number;
789
+ name: string;
790
+ data_type: string;
791
+ options?: Array<{
792
+ id: string;
793
+ name: string;
794
+ description: string;
795
+ color: string;
796
+ }>;
797
+ created_at?: string;
798
+ updated_at?: string;
799
+ };
800
+ export type GithubProjectItem = {
801
+ id: number;
802
+ project_id: number;
803
+ content_type: 'Issue' | 'PullRequest' | 'DraftIssue';
804
+ content_repository?: string;
805
+ content_number?: number;
806
+ title?: string;
807
+ body?: string;
808
+ field_values: Record<string, unknown>;
809
+ creator_login?: string;
810
+ created_at?: string;
811
+ updated_at?: string;
812
+ };
813
+ export type GithubProjectView = {
814
+ id: number;
815
+ project_id: number;
816
+ number: number;
817
+ name: string;
818
+ layout: string;
819
+ filter?: string | null;
820
+ visible_fields?: number[];
821
+ sort_by?: unknown[];
822
+ group_by?: number[];
823
+ vertical_group_by?: number[];
824
+ creator_login?: string;
825
+ created_at?: string;
826
+ updated_at?: string;
827
+ };
828
+ /** Where and on what an analysis last found a code scanning alert. */
829
+ export type GithubCodeScanningInstance = {
830
+ ref: string;
831
+ analysis_key: string;
832
+ commit_sha: string;
833
+ state: string;
834
+ message: string;
835
+ path: string;
836
+ start_line: number;
837
+ end_line: number;
838
+ };
839
+ export type GithubCodeScanningAlert = {
840
+ dismissed_by_login?: string | null;
841
+ number: number;
842
+ repository: string;
843
+ state: string;
844
+ rule_id: string;
845
+ rule_severity: string;
846
+ rule_description?: string;
847
+ tool_name: string;
848
+ tool_version?: string;
849
+ dismissed_reason?: string | null;
850
+ dismissed_comment?: string | null;
851
+ dismissed_at?: string | null;
852
+ created_at?: string;
853
+ updated_at?: string;
854
+ fixed_at?: string | null;
855
+ most_recent_instance?: GithubCodeScanningInstance;
856
+ };
857
+ export type GithubCodeScanningAnalysis = {
858
+ id: number;
859
+ repository: string;
860
+ ref: string;
861
+ commit_sha: string;
862
+ analysis_key: string;
863
+ environment?: string;
864
+ tool_name: string;
865
+ results_count: number;
866
+ rules_count: number;
867
+ sarif_id?: string;
868
+ created_at?: string;
869
+ deletable?: boolean;
870
+ };
871
+ export type GithubDependabotAlert = {
872
+ dismissed_by_login?: string | null;
873
+ number: number;
874
+ repository: string;
875
+ state: string;
876
+ package_name: string;
877
+ ecosystem: string;
878
+ ghsa_id: string;
879
+ severity: string;
880
+ summary?: string;
881
+ manifest_path?: string;
882
+ dismissed_reason?: string | null;
883
+ dismissed_comment?: string | null;
884
+ dismissed_at?: string | null;
885
+ created_at?: string;
886
+ updated_at?: string;
887
+ };
888
+ /** Where a secret was found: the file, its lines and columns, the blob and the commit. */
889
+ export type GithubSecretLocation = {
890
+ path: string;
891
+ start_line: number;
892
+ end_line: number;
893
+ start_column: number;
894
+ end_column: number;
895
+ blob_sha: string;
896
+ commit_sha: string;
897
+ };
898
+ export type GithubSecretScanningAlert = {
899
+ number: number;
900
+ repository: string;
901
+ state: string;
902
+ secret_type: string;
903
+ secret_type_display_name?: string;
904
+ resolution?: string | null;
905
+ resolution_comment?: string | null;
906
+ resolved_at?: string | null;
907
+ created_at?: string;
908
+ updated_at?: string;
909
+ locations?: GithubSecretLocation[];
910
+ _secret?: string;
911
+ };
912
+ export type GithubAppInstallation = {
913
+ id: number;
914
+ account_login: string;
915
+ account_type: string;
916
+ app_id: number;
917
+ app_slug: string;
918
+ target_type: string;
919
+ repository_selection: string;
920
+ permissions: Record<string, string>;
921
+ events: string[];
922
+ created_at?: string;
923
+ updated_at?: string;
924
+ repositories?: string[];
925
+ };
926
+ export type GithubAppRegistration = {
927
+ id: number;
928
+ slug: string;
929
+ name: string;
930
+ owner: string;
931
+ client_id: string;
932
+ permissions: Record<string, string>;
933
+ events: string[];
934
+ setup_url?: string;
935
+ callback_url?: string;
936
+ request_oauth_on_install: boolean;
937
+ hook_url?: string;
938
+ webhook_secret?: string;
939
+ description?: string | null;
940
+ created_at?: string; /** the app's homepage (a manifest's `url`) */
941
+ url?: string;
942
+ };
943
+ /** The registered GitHub Apps at `root`. */
944
+ export declare function githubApps(root?: string): GithubAppRegistration[];
945
+ /** GitHub's App object (GET /apps/{app_slug}). */
946
+ export declare function toGithubApp(a: GithubAppRegistration, installations: number, st?: GithubState): Record<string, unknown>;
947
+ /** One thing done to an issue or pull request, as its timeline tells it. */
948
+ export type GithubActivity = {
949
+ event: 'labeled' | 'unlabeled' | 'assigned' | 'unassigned' | 'milestoned' | 'demilestoned' | 'locked' | 'unlocked' | 'closed' | 'reopened' | 'merged';
950
+ at?: string;
951
+ by?: string;
952
+ label?: string;
953
+ assignee?: string;
954
+ milestone?: unknown;
955
+ state_reason?: string | null;
956
+ lock_reason?: string | null;
957
+ commit_id?: string | null;
958
+ };
959
+ export type GithubOAuthGrant = {
960
+ token: string;
961
+ client_id: string;
962
+ scopes: string[];
963
+ created_at?: string;
964
+ login?: string;
965
+ };
966
+ export type GithubPackage = {
967
+ id: number;
968
+ name: string;
969
+ package_type: string;
970
+ owner: string;
971
+ visibility: string;
972
+ created_at?: string;
973
+ updated_at?: string;
974
+ };
975
+ export type GithubPackageVersion = {
976
+ id: number;
977
+ package_name: string;
978
+ package_type: string;
979
+ owner: string;
980
+ name: string;
981
+ tags?: string[];
982
+ created_at?: string;
983
+ updated_at?: string;
984
+ };
985
+ export type GithubPagesSite = {
986
+ repository: string;
987
+ cname?: string | null;
988
+ cert_requested_at?: string | null;
989
+ status: string;
990
+ source_branch: string;
991
+ source_path: string;
992
+ build_type?: string;
993
+ public?: boolean;
994
+ https_enforced?: boolean;
995
+ html_url?: string;
996
+ created_at?: string;
997
+ updated_at?: string;
998
+ };
999
+ export type GithubPagesBuild = {
1000
+ id: number;
1001
+ repository: string;
1002
+ status: string;
1003
+ error_message?: string | null;
1004
+ commit?: string;
1005
+ duration?: number;
1006
+ created_at?: string;
1007
+ };
1008
+ export type GithubCodespace = {
1009
+ name: string;
1010
+ repository: string;
1011
+ state: string;
1012
+ machine: string;
1013
+ git_branch: string;
1014
+ owner: string;
1015
+ created_at?: string;
1016
+ updated_at?: string;
1017
+ };
1018
+ /** One person's star or watch of a repository (`from` → `to` = login → owner/repo), or a follow (follower → followee). */
1019
+ export type GithubEdge = {
1020
+ from: string;
1021
+ to: string;
1022
+ };
1023
+ export type GithubState = {
1024
+ prs: GithubPr[];
1025
+ issues: GithubIssue[];
1026
+ reviews: GithubReview[];
1027
+ comments: GithubComment[];
1028
+ statuses: GithubStatus[];
1029
+ checkRuns: GithubCheckRun[];
1030
+ milestones: GithubMilestone[];
1031
+ workflows: GithubWorkflow[];
1032
+ workflowRuns: GithubWorkflowRun[];
1033
+ jobs: GithubJob[];
1034
+ releases: GithubRelease[];
1035
+ releaseAssets: GithubReleaseAsset[];
1036
+ tags: GithubTag[];
1037
+ discussions: GithubDiscussion[];
1038
+ discussionComments: GithubDiscussionComment[];
1039
+ reactions: GithubReaction[];
1040
+ labels: GithubLabel[];
1041
+ repos: GithubRepo[];
1042
+ branches: GithubBranch[];
1043
+ collaborators: GithubCollaborator[];
1044
+ webhooks: GithubWebhook[];
1045
+ contents: GithubContentFile[];
1046
+ gists: GithubGist[];
1047
+ notifications: GithubNotification[];
1048
+ gitRefs: GithubGitRef[];
1049
+ gitCommits: GithubGitCommit[];
1050
+ gitTrees: GithubGitTree[];
1051
+ gitBlobs: GithubGitBlob[];
1052
+ gitTagObjects: GithubGitTagObject[];
1053
+ deployments: GithubDeployment[];
1054
+ deploymentStatuses: GithubDeploymentStatus[];
1055
+ environments: GithubEnvironment[];
1056
+ actionsSecrets: GithubActionsSecret[];
1057
+ actionsVariables: GithubActionsVariable[];
1058
+ actionsCaches: GithubActionsCache[];
1059
+ actionsArtifacts: GithubActionsArtifact[];
1060
+ orgs: GithubOrg[];
1061
+ orgMembers: GithubOrgMembership[];
1062
+ outsideCollaborators: GithubOutsideCollaborator[];
1063
+ orgWebhooks: GithubOrgWebhook[];
1064
+ teams: GithubTeam[];
1065
+ teamMembers: GithubTeamMembership[];
1066
+ teamRepos: GithubTeamRepo[];
1067
+ commitComments: GithubCommitComment[];
1068
+ issueTypes: GithubIssueType[];
1069
+ deployKeys: GithubDeployKey[];
1070
+ autolinks: GithubAutolink[];
1071
+ rulesets: GithubRuleset[];
1072
+ ruleSuites: GithubRuleSuite[];
1073
+ userEmails: GithubUserEmail[];
1074
+ userSshKeys: GithubUserSshKey[];
1075
+ userGpgKeys: GithubUserGpgKey[];
1076
+ blockedUsers: Set<string>;
1077
+ userProfile: Partial<GithubUser>;
1078
+ projects: GithubProject[];
1079
+ projectFields: GithubProjectField[];
1080
+ projectItems: GithubProjectItem[];
1081
+ projectViews: GithubProjectView[];
1082
+ stars: Set<string>;
1083
+ watching: Set<string>;
1084
+ following: Set<string>;
1085
+ starEdges: GithubEdge[];
1086
+ watchEdges: GithubEdge[];
1087
+ followEdges: GithubEdge[];
1088
+ codeScanningAlerts: GithubCodeScanningAlert[];
1089
+ codeScanningAnalyses: GithubCodeScanningAnalysis[];
1090
+ dependabotAlerts: GithubDependabotAlert[];
1091
+ secretScanningAlerts: GithubSecretScanningAlert[];
1092
+ appInstallations: GithubAppInstallation[];
1093
+ oauthGrants: GithubOAuthGrant[];
1094
+ packages: GithubPackage[];
1095
+ packageVersions: GithubPackageVersion[];
1096
+ pagesSites: GithubPagesSite[];
1097
+ pagesBuilds: GithubPagesBuild[];
1098
+ codespaces: GithubCodespace[];
1099
+ };
1100
+ /** The category list for a repo: GitHub's defaults (a custom category is made on github.com's discussion settings,
1101
+ * which the twin does not have). */
1102
+ export declare function discussionCategoriesFor(repository: string): GithubDiscussionCategory[];
1103
+ export declare function observedId(subjectId: string): number;
1104
+ /** GitHub's projection of the tree at `root`. */
1105
+ export declare function githubState(root?: string): GithubState;
1106
+ export declare function toLabels(names: string[] | undefined, repository: string, labels?: GithubLabel[]): Array<Record<string, unknown>>;
1107
+ export declare function toAssignees(logins: string[] | undefined): Array<Record<string, unknown>>;
1108
+ export declare function toGithubMilestone(ms: GithubMilestone): Record<string, unknown>;
1109
+ export declare function toGithubRest(pr: GithubPr, milestones?: GithubMilestone[]): Record<string, unknown>;
1110
+ export declare const GITHUB_WORLD_USER = "octocat";
1111
+ /** The user a request's token authenticates, as GitHub attributes a write to the token's owner: a personal token
1112
+ * minted at `POST /_twin/users/:login/tokens` names its user, an app installation's token its bot (`<app>[bot]`).
1113
+ * Any other token (the World's shared fake) names no one, and the twin keeps its deterministic defaults. */
1114
+ export declare function callerLogin(token: string | undefined, root?: string): string | undefined;
1115
+ /** Whether a token GitHub issued has stopped working (an installation token expired with its run, a grant revoked). It is
1116
+ * refused, never taken as the World's own user: "Authenticating with invalid credentials will initially return a
1117
+ * `401 Unauthorized` response" (https://docs.github.com/rest/authentication/authenticating-to-the-rest-api); the message,
1118
+ * "Bad credentials", is GitHub's live answer, which its pages do not quote. A token the twin never issued is the World's
1119
+ * shared token, and is not refused. */
1120
+ export declare function revokedToken(token: string | undefined, root?: string): boolean;
1121
+ export declare function twinUserId(login: string): number;
1122
+ /** How GitHub describes a person's relation to a repository (author_association): its owner, a member of the
1123
+ * organization that owns it, a collaborator, someone whose pull request it merged, or none of these. */
1124
+ export declare function authorAssociation(st: GithubState, repo: string, login: string | null | undefined): string;
1125
+ /** A GitHub node id in the legacy form GitHub still issues and accepts: base64 of the type name's length, the type
1126
+ * name and the object's id (`MDU6SXNzdWUx` is `05:Issue1`). Deterministic, so a replay mints the same one. */
1127
+ export declare const nodeId: (type: string, id: string | number) => string;
1128
+ /** The links GitHub gives every account, as it writes them; the avatar is served by avatars.githubusercontent.com. */
1129
+ export declare function userLinks(login: string, id: number): Record<string, string>;
1130
+ export declare function toSimpleUser(login: string, type?: 'User' | 'Bot'): Record<string, unknown>;
1131
+ export declare function implicitReviewId(repository: string, number: number): number;
1132
+ export declare function reviewStateForEvent(event: unknown): string;
1133
+ export declare function toGithubReview(a: {
1134
+ id: number;
1135
+ repository: string;
1136
+ number: number;
1137
+ state?: string;
1138
+ body?: string;
1139
+ submitted_at?: string;
1140
+ commit_id?: string;
1141
+ user_login?: string;
1142
+ user_type?: 'User' | 'Bot';
1143
+ author_association?: string;
1144
+ }): Record<string, unknown>;
1145
+ export declare function toGithubComment(a: {
1146
+ id: number;
1147
+ repository: string;
1148
+ number: number;
1149
+ body?: string;
1150
+ at?: string;
1151
+ updated_at?: string;
1152
+ user_login?: string;
1153
+ user_type?: 'User' | 'Bot';
1154
+ }): Record<string, unknown>;
1155
+ export declare function serializeIssueComment(c: GithubComment): Record<string, unknown>;
1156
+ export declare function toGithubReviewComment(a: {
1157
+ id: number;
1158
+ repository: string;
1159
+ number: number;
1160
+ body?: string;
1161
+ at?: string;
1162
+ updated_at?: string;
1163
+ path?: string;
1164
+ line?: number;
1165
+ side?: string;
1166
+ start_line?: number;
1167
+ diff_hunk?: string;
1168
+ in_reply_to?: number;
1169
+ review_id?: number;
1170
+ user_login?: string;
1171
+ user_type?: 'User' | 'Bot';
1172
+ commit_id?: string;
1173
+ author_association?: string;
1174
+ }): Record<string, unknown>;
1175
+ export declare function serializeReviewComment(c: GithubComment): Record<string, unknown>;
1176
+ export declare function toGithubPullFile(repository: string, sha: string, f: GithubPullFile): Record<string, unknown>;
1177
+ export declare function issueCommentCount(repository: string, number: number, comments?: GithubComment[]): number;
1178
+ /** An issue's numeric id: GitHub's `id`, distinct from its number, what the sub-issue API names a child by. */
1179
+ export declare function githubIssueId(repo: string, number: number): number;
1180
+ export declare function toGithubIssue(iss: GithubIssue, milestones?: GithubMilestone[], pull?: GithubPr, comments?: GithubComment[]): Record<string, unknown>;
1181
+ export declare function pullRequestAsIssue(pr: GithubPr): GithubIssue;
1182
+ export declare function toGithubStatus(s: GithubStatus): Record<string, unknown>;
1183
+ export declare function combineStatuses(repository: string, sha: string, statuses: GithubStatus[]): Record<string, unknown>;
1184
+ export declare function toGithubCheckRun(c: GithubCheckRun, st?: GithubState): Record<string, unknown>;
1185
+ export declare function toGithubAnnotation(c: GithubCheckRun, an: GithubCheckAnnotation): Record<string, unknown>;
1186
+ export declare function toGithubCheckSuite(repository: string, headSha: string, runs: GithubCheckRun[], app?: string, st?: GithubState): Record<string, unknown>;
1187
+ export declare function toGithubReaction(r: GithubReaction): Record<string, unknown>;
1188
+ export declare function toGithubLabel(l: GithubLabel): Record<string, unknown>;
1189
+ export declare function toGithubRepo(r: GithubRepo): Record<string, unknown>;
1190
+ export declare function toGithubBranch(b: GithubBranch): Record<string, unknown>;
1191
+ export declare function toGithubBranchProtection(b: GithubBranch): Record<string, unknown>;
1192
+ export declare function normalizeRequiredStatusChecks(v: unknown): {
1193
+ strict: boolean;
1194
+ contexts: string[];
1195
+ checks: Array<{
1196
+ context: string;
1197
+ app_id: number | null;
1198
+ }>;
1199
+ } | null;
1200
+ export declare function toGithubCollaborator(c: GithubCollaborator): Record<string, unknown>;
1201
+ export declare function toGithubWebhookConfig(h: GithubWebhook): Record<string, unknown>;
1202
+ export declare function hookConfigOverlaps(hooks: GithubWebhook[], candidate: Pick<GithubWebhook, 'repository' | 'url' | 'content_type' | 'secret' | 'events'>, excluding?: number): boolean;
1203
+ export declare function validateGithubWebhook(body: Record<string, any>, configOnly: boolean, creating: boolean): GithubResponse | undefined;
1204
+ export declare function toGithubWebhook(h: GithubWebhook): Record<string, unknown>;
1205
+ export declare function planeQueryRef(query: string | undefined): string | undefined;
1206
+ export declare function resolvePlaneRef(repo: string, ref: string | undefined, defaultBranch: string, root?: string): Promise<string | null>;
1207
+ type PlaneTreeEntry = {
1208
+ path: string;
1209
+ mode: string;
1210
+ type: string;
1211
+ sha: string;
1212
+ size?: number;
1213
+ };
1214
+ type PlaneLookup = {
1215
+ kind: 'file';
1216
+ entry: PlaneTreeEntry;
1217
+ } | {
1218
+ kind: 'submodule';
1219
+ entry: PlaneTreeEntry;
1220
+ } | {
1221
+ kind: 'dir';
1222
+ entries: PlaneTreeEntry[];
1223
+ };
1224
+ export declare function planeEntryAt(repo: string, commitSha: string, path: string, root?: string): Promise<PlaneLookup | null>;
1225
+ export declare function planeFileContent(repo: string, ref: string, path: string, entry: {
1226
+ sha: string;
1227
+ size?: number;
1228
+ }, root?: string): Promise<Record<string, unknown> | null>;
1229
+ export declare function planeContents(repo: string, ref: string | undefined, path: string, defaultBranch: string, root?: string): Promise<{
1230
+ status: number;
1231
+ body: unknown;
1232
+ } | null>;
1233
+ /** A path's contents: from the git plane when the repository has one; otherwise the file the REST
1234
+ * writes stored, a directory listing of the stored files under it, or the plane's (a `git push`). */
1235
+ export declare function githubContents(state: GithubState, repo: string, p: string, query: string | undefined, root?: string): Promise<GithubResponse>;
1236
+ export declare function planeAncestors(repo: string, sha: string, root?: string): Promise<Map<string, number>>;
1237
+ /** The commits a repository's default branch reaches, read from its history: sha, message and author name (none in a
1238
+ * repository without history). */
1239
+ export declare function defaultBranchCommits(state: GithubState, repo: string, root?: string): Promise<Array<{
1240
+ sha: string;
1241
+ message: string;
1242
+ author: string;
1243
+ }>>;
1244
+ export declare function planeCommitBody(repo: string, sha: string, root?: string): Promise<Record<string, unknown> | null>;
1245
+ export declare function toGithubContent(f: GithubContentFile): Record<string, unknown>;
1246
+ export declare function toGithubUser(u: GithubUser): Record<string, unknown>;
1247
+ /** An organization as GitHub answers it; with the World's state, its public repositories and followers counted. */
1248
+ export declare function toGithubOrg(o: GithubOrg, st?: GithubState): Record<string, unknown>;
1249
+ export declare function toGithubOrgMembership(m: GithubOrgMembership): Record<string, unknown>;
1250
+ export declare function toGithubOrgWebhook(h: GithubOrgWebhook): Record<string, unknown>;
1251
+ /** A team as GitHub answers it; with the World's state, its members and repositories counted (team-full). */
1252
+ export declare function toGithubTeam(t: GithubTeam, st?: GithubState): Record<string, unknown>;
1253
+ /** A team membership as GitHub answers it, addressed under its organization's and team's ids
1254
+ * (docs.github.com/rest/teams/members#get-team-membership-for-a-user). */
1255
+ export declare function toGithubTeamMembership(m: GithubTeamMembership, st?: GithubState): Record<string, unknown>;
1256
+ export declare function toGithubCommitComment(c: GithubCommitComment): Record<string, unknown>;
1257
+ export declare function toGithubIssueType(t: GithubIssueType): Record<string, unknown>;
1258
+ export declare function toGithubGist(g: GithubGist): Record<string, unknown>;
1259
+ export declare function toGithubNotification(n: GithubNotification): Record<string, unknown>;
1260
+ export declare function toGithubWorkflow(w: GithubWorkflow): Record<string, unknown>;
1261
+ export declare function toGithubWorkflowRun(r: GithubWorkflowRun, st?: GithubState): Record<string, unknown>;
1262
+ export declare function toGithubJob(j: GithubJob): Record<string, unknown>;
1263
+ export declare function toGithubReleaseAsset(a: GithubReleaseAsset): Record<string, unknown>;
1264
+ export declare function toGithubRelease(r: GithubRelease, assets?: GithubReleaseAsset[]): Record<string, unknown>;
1265
+ export declare function toGithubTag(t: GithubTag): Record<string, unknown>;
1266
+ export declare function toGithubGitRef(r: GithubGitRef): Record<string, unknown>;
1267
+ export declare function toGithubGitCommit(c: GithubGitCommit): Record<string, unknown>;
1268
+ export declare function toGithubGitTree(t: GithubGitTree): Record<string, unknown>;
1269
+ export declare function toGithubGitBlob(b: GithubGitBlob): Record<string, unknown>;
1270
+ export declare function toGithubGitTagObject(t: GithubGitTagObject): Record<string, unknown>;
1271
+ export declare function toGithubDeployment(d: GithubDeployment): Record<string, unknown>;
1272
+ export declare function toGithubDeploymentStatus(s: GithubDeploymentStatus): Record<string, unknown>;
1273
+ export declare function toGithubEnvironment(e: GithubEnvironment): Record<string, unknown>;
1274
+ export declare function toGithubDeployKey(k: GithubDeployKey): Record<string, unknown>;
1275
+ export declare function toGithubAutolink(a: GithubAutolink): Record<string, unknown>;
1276
+ export declare function toGithubRuleset(r: GithubRuleset): Record<string, unknown>;
1277
+ export declare function toGithubUserEmail(e: GithubUserEmail): Record<string, unknown>;
1278
+ export declare function toGithubUserSshKey(k: GithubUserSshKey): Record<string, unknown>;
1279
+ export declare function toGithubUserGpgKey(k: GithubUserGpgKey): Record<string, unknown>;
1280
+ export declare function toGithubProject(p: GithubProject): Record<string, unknown>;
1281
+ export declare function toGithubCodeScanningAlert(a: GithubCodeScanningAlert): Record<string, unknown>;
1282
+ export declare function toGithubCodeScanningAnalysis(a: GithubCodeScanningAnalysis): Record<string, unknown>;
1283
+ export declare function toGithubDependabotAlert(a: GithubDependabotAlert): Record<string, unknown>;
1284
+ export declare function toGithubSecretScanningAlert(a: GithubSecretScanningAlert): Record<string, unknown>;
1285
+ export declare function toGithubAppInstallation(i: GithubAppInstallation): Record<string, unknown>;
1286
+ export declare function toGithubPackage(p: GithubPackage, versionCount: number): Record<string, unknown>;
1287
+ export declare function toGithubPackageVersion(v: GithubPackageVersion): Record<string, unknown>;
1288
+ export declare function toGithubPagesSite(s: GithubPagesSite): Record<string, unknown>;
1289
+ export declare function toGithubPagesBuild(b: GithubPagesBuild): Record<string, unknown>;
1290
+ export declare function toGithubCodespace(c: GithubCodespace): Record<string, unknown>;
1291
+ export declare function toGithubActionsSecret(s: GithubActionsSecret): Record<string, unknown>;
1292
+ export declare function toGithubActionsVariable(v: GithubActionsVariable): Record<string, unknown>;
1293
+ export declare function toGithubActionsCache(c: GithubActionsCache): Record<string, unknown>;
1294
+ export declare function toGithubActionsArtifact(a: GithubActionsArtifact): Record<string, unknown>;
1295
+ export declare function buildIssueTimeline(repository: string, iss: GithubIssue, extra?: {
1296
+ pull?: GithubPr;
1297
+ comments?: GithubComment[];
1298
+ reviews?: GithubReview[];
1299
+ }): Array<Record<string, unknown>>;
1300
+ export type GithubResponse = {
1301
+ status: number;
1302
+ body: unknown;
1303
+ };
1304
+ export declare function githubNotFound(): GithubResponse;
1305
+ export declare function paginate<T>(items: T[], query: string | undefined): T[];
1306
+ export declare function githubActivityEvents(state: GithubState): Array<Record<string, unknown>>;
1307
+ export declare function nextRepoNumber(st: GithubState, repo: string): number;
1308
+ export declare function normalizeLabels(input: unknown): string[];
1309
+ export declare function normalizeLogins(input: unknown): string[];
1310
+ export declare function applyTriageFields(fields: Record<string, unknown>, body: Record<string, any>): void;
1311
+ export declare function nextSeq(prefix: string, root?: string): number;
1312
+ export declare function actionsId(key: string): number;
1313
+ export declare function seedUser(login: string): GithubUser;
1314
+ export type GithubWriteEvent = {
1315
+ event: string;
1316
+ action: string;
1317
+ repository: string;
1318
+ number: number;
1319
+ pr?: Record<string, unknown>;
1320
+ body?: string;
1321
+ comment?: Record<string, unknown>;
1322
+ review?: Record<string, unknown>;
1323
+ issue?: Record<string, unknown>;
1324
+ ref?: string;
1325
+ before?: string;
1326
+ after?: string;
1327
+ };
1328
+ export type GithubWriteOutcome = {
1329
+ response: GithubResponse;
1330
+ webhook?: GithubWriteEvent;
1331
+ webhooks?: GithubWriteEvent[];
1332
+ };
1333
+ /**
1334
+ * Handle a GitHub REST WRITE as a local action (R5/R18). Supports:
1335
+ * POST /repos/:o/:r/pulls → create PR (pull_request: opened)
1336
+ * PATCH /repos/:o/:r/pulls/:n → edit PR (pull_request: edited/closed)
1337
+ * PUT /repos/:o/:r/pulls/:n/merge → merge PR (pull_request: closed; 405 if not mergeable)
1338
+ * POST /repos/:o/:r/pulls/:n/reviews → submit review (pull_request_review)
1339
+ * POST /repos/:o/:r/issues → create issue (issues: opened)
1340
+ * PATCH /repos/:o/:r/issues/:n → edit issue (issues: edited/closed)
1341
+ * POST /repos/:o/:r/issues/:n/comments → comment (issue_comment)
1342
+ * Mirror mode rejects writes (R4). No real GitHub I/O (R16).
1343
+ */
1344
+ /**
1345
+ * The PR's REAL changed-file list from the git plane: resolve the base branch tip + the PR
1346
+ * head sha; when both commits exist in the bare repo, `git diff-tree` computes the truth.
1347
+ * Null when either side is not in the plane (observed/simulated PRs keep their carried or
1348
+ * empty file lists — never fabricated). This is what merge-gate scope classification reads
1349
+ * (GET /pulls/:n/files + GraphQL changedFiles), so a pushed PR must answer with its actual
1350
+ * paths, not 0 files.
1351
+ */
1352
+ export declare function prPlaneDiffFiles(state: GithubState, repo: string, pr: GithubPr, root?: string): Promise<GithubPullFile[] | null>;
1353
+ /**
1354
+ * GitHub closes open PRs whose HEAD BRANCH is deleted. Shared by the receive-pack reconcile
1355
+ * and the REST ref delete so both paths converge. Returns the closed PR numbers. A pull request's head branch may
1356
+ * live in a fork (`repo` is where the branch was, the callback names the pull request's own repository).
1357
+ */
1358
+ export declare function closePrsForDeletedBranch(repo: string, branch: string, root: string | undefined, occurredAt: string, onChanged: ((snapshot: Record<string, unknown>, repository: string) => void) | undefined, atomically: GithubAtomic, by: {
1359
+ operation: string;
1360
+ actor: 'api' | 'external';
1361
+ }): Promise<number[]>;
1362
+ /**
1363
+ * Re-point every OPEN PR whose head branch is `branch` at the branch's new tip — GitHub's
1364
+ * `synchronize` semantic: a push (receive-pack or an API ref update) moves the PR head, so
1365
+ * statuses/checks/reviews earned on the old head no longer match. Returns the PR numbers
1366
+ * moved (the receive-pack path emits `pull_request synchronize` webhooks for them).
1367
+ */
1368
+ export declare function syncPrHeadsToBranchTip(repo: string, branch: string, sha: string, root: string | undefined, occurredAt: string, onChanged?: (snapshot: Record<string, unknown>, repository: string) => void, atomically?: GithubAtomic): Promise<number[]>;
1369
+ /** Register a GitHub App: {slug, name, owner, permissions, events, setup_url?, callback_url?, request_oauth_on_install?,
1370
+ * hook_attributes?: {url}, webhook_secret?, description?}. GitHub registers apps in its settings UI (the twin's door,
1371
+ * POST /_twin/apps) or from a manifest (src/screens/app-manifest.tsx). A slug that is not one, or is taken, is 422. */
1372
+ export declare function registerGithubApp(body: Record<string, any>, occurredAt: string, root?: string): Promise<{
1373
+ response: GithubResponse;
1374
+ app?: GithubAppRegistration;
1375
+ }>;
1376
+ /** The twin's own doors under /_twin/: what stands in for an act GitHub does in its web UI or its runners, which have
1377
+ * no API. A request to any other path is not a door's (undefined). */
1378
+ export declare function handleGithubDoor(request: Request, scope: {
1379
+ root?: string;
1380
+ now: () => string;
1381
+ }): Promise<Response | undefined>;
1382
+ /** The subject id a write landed under: a head that performed it adopts the vendor's id (an issue's
1383
+ * number), recorded in the alias map. */
1384
+ export declare function adoptedSubjectId(type: string, id: string, root?: string): string;
1385
+ /** A request's issue or pull-request number, resolved through the alias map: a caller on a branch
1386
+ * may still name one by the number it minted locally after the head adopted GitHub's
1387
+ * (docs/contributing/architecture.md#alias-aware-lookup-at-the-request-boundary). */
1388
+ export declare function resolveGithubNumber(owner: string, name: string, number: string, root?: string): string;
1389
+ /** A GitHub REST read made in-process, through the same fetch the server serves (the derived
1390
+ * dispatch, its semantics handlers, and the hand-written routes for what has not moved). */
1391
+ export declare function handleGithubRequest(req: {
1392
+ method: string;
1393
+ path: string;
1394
+ root?: string;
1395
+ token?: string;
1396
+ cookie?: string;
1397
+ }): Promise<GithubResponse>;
1398
+ /** A GitHub REST write made in-process, stamped at `occurredAt` (the World clock when absent). A write
1399
+ * GitHub announces delivers its webhooks from the fetch, as it does over HTTP, and the events it
1400
+ * announced ride the answer: one as `webhook`, several as `webhooks`. */
1401
+ export declare function applyGithubWrite(req: {
1402
+ method: string;
1403
+ path: string;
1404
+ body?: string;
1405
+ root?: string;
1406
+ readOnly?: boolean;
1407
+ occurredAt?: string;
1408
+ token?: string;
1409
+ contentType?: string;
1410
+ cookie?: string;
1411
+ }): Promise<GithubWriteOutcome>;